Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: board/nvidia/common/board.c

Issue 6900006: Tegra2: Add more clock support (Closed) Base URL: ssh://gitrw.chromium.org:9222/u-boot-next.git@chromeos-v2011.03
Patch Set: Fixed up comment style Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « arch/arm/include/asm/arch-tegra2/clock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) Copyright 2010,2011 2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com> 3 * NVIDIA Corporation <www.nvidia.com>
4 * 4 *
5 * See file CREDITS for list of people who contributed to this 5 * See file CREDITS for list of people who contributed to this
6 * project. 6 * project.
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of 10 * published by the Free Software Foundation; either version 2 of
(...skipping 10 matching lines...) Expand all
21 * MA 02111-1307 USA 21 * MA 02111-1307 USA
22 */ 22 */
23 23
24 #include <common.h> 24 #include <common.h>
25 #include <ns16550.h> 25 #include <ns16550.h>
26 #include <asm/io.h> 26 #include <asm/io.h>
27 #include <asm/arch/tegra2.h> 27 #include <asm/arch/tegra2.h>
28 #include <asm/arch/sys_proto.h> 28 #include <asm/arch/sys_proto.h>
29 29
30 #include <asm/arch/clk_rst.h> 30 #include <asm/arch/clk_rst.h>
31 #include <asm/arch/clock.h>
31 #include <asm/arch/pinmux.h> 32 #include <asm/arch/pinmux.h>
32 #include <asm/arch/uart.h> 33 #include <asm/arch/uart.h>
33 #include "board.h" 34 #include "board.h"
34 35
35 DECLARE_GLOBAL_DATA_PTR; 36 DECLARE_GLOBAL_DATA_PTR;
36 37
37 const struct tegra2_sysinfo sysinfo = { 38 const struct tegra2_sysinfo sysinfo = {
38 CONFIG_TEGRA2_BOARD_STRING 39 CONFIG_TEGRA2_BOARD_STRING
39 }; 40 };
40 41
(...skipping 25 matching lines...) Expand all
66 return 0; 67 return 0;
67 } 68 }
68 69
69 /* 70 /*
70 * Routine: clock_init_uart 71 * Routine: clock_init_uart
71 * Description: init the PLL and clock for the UART(s) 72 * Description: init the PLL and clock for the UART(s)
72 */ 73 */
73 static void clock_init_uart(void) 74 static void clock_init_uart(void)
74 { 75 {
75 struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE; 76 struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
77 struct clk_pll *pll = &clkrst->crc_pll[CLOCK_PLL_ID_PERIPH];
76 u32 reg; 78 u32 reg;
77 79
78 » reg = readl(&clkrst->crc_pllp_base); 80 » reg = readl(&pll->pll_base);
79 » if (!(reg & PLL_BASE_OVRRIDE)) { 81 » if (!(reg & PLL_BASE_OVRRIDE_BIT)) {
80 /* Override pllp setup for 216MHz operation. */ 82 /* Override pllp setup for 216MHz operation. */
81 » » reg = (PLL_BYPASS | PLL_BASE_OVRRIDE | PLL_DIVP); 83 » » reg = (PLL_BYPASS_BIT | PLL_BASE_OVRRIDE_BIT | PLL_DIVP_VALUE);
82 » » reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ/500) << 8) | PLL_DIVM); 84 » » reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ/500) << 8) | PLL_DIVM_VALUE);
83 » » writel(reg, &clkrst->crc_pllp_base); 85 » » writel(reg, &pll->pll_base);
84 86
85 » » reg |= PLL_ENABLE; 87 » » reg |= PLL_ENABLE_BIT;
86 » » writel(reg, &clkrst->crc_pllp_base); 88 » » writel(reg, &pll->pll_base);
87 89
88 » » reg &= ~PLL_BYPASS; 90 » » reg &= ~PLL_BYPASS_BIT;
89 » » writel(reg, &clkrst->crc_pllp_base); 91 » » writel(reg, &pll->pll_base);
90 } 92 }
91 93
92 /* Now do the UART reset/clock enable */ 94 /* Now do the UART reset/clock enable */
93 #if defined(CONFIG_TEGRA2_ENABLE_UARTA) 95 #if defined(CONFIG_TEGRA2_ENABLE_UARTA)
94 » /* Assert Reset to UART */ 96 » /* Assert UART reset and enable clock */
95 » reg = readl(&clkrst->crc_rst_dev_l); 97 » reset_set_enable(PERIPH_ID_UART1, 1);
96 » reg |= SWR_UARTA_RST;» » /* SWR_UARTA_RST = 1 */ 98 » clock_enable(PERIPH_ID_UART1);
97 » writel(reg, &clkrst->crc_rst_dev_l);
98
99 » /* Enable clk to UART */
100 » reg = readl(&clkrst->crc_clk_out_enb_l);
101 » reg |= CLK_ENB_UARTA;» » /* CLK_ENB_UARTA = 1 */
102 » writel(reg, &clkrst->crc_clk_out_enb_l);
103 99
104 /* Enable pllp_out0 to UART */ 100 /* Enable pllp_out0 to UART */
105 reg = readl(&clkrst->crc_clk_src_uarta); 101 reg = readl(&clkrst->crc_clk_src_uarta);
106 reg &= 0x3FFFFFFF; /* UARTA_CLK_SRC = 00, PLLP_OUT0 */ 102 reg &= 0x3FFFFFFF; /* UARTA_CLK_SRC = 00, PLLP_OUT0 */
107 writel(reg, &clkrst->crc_clk_src_uarta); 103 writel(reg, &clkrst->crc_clk_src_uarta);
108 104
109 /* wait for 2us */ 105 /* wait for 2us */
110 udelay(2); 106 udelay(2);
111 107
112 /* De-assert reset to UART */ 108 /* De-assert reset to UART */
113 » reg = readl(&clkrst->crc_rst_dev_l); 109 » reset_set_enable(PERIPH_ID_UART1, 0);
114 » reg &= ~SWR_UARTA_RST;» » /* SWR_UARTA_RST = 0 */
115 » writel(reg, &clkrst->crc_rst_dev_l);
116 #endif /* CONFIG_TEGRA2_ENABLE_UARTA */ 110 #endif /* CONFIG_TEGRA2_ENABLE_UARTA */
117 #if defined(CONFIG_TEGRA2_ENABLE_UARTD) 111 #if defined(CONFIG_TEGRA2_ENABLE_UARTD)
118 » /* Assert Reset to UART */ 112 » /* Assert UART reset and enable clock */
119 » reg = readl(&clkrst->crc_rst_dev_u); 113 » reset_set_enable(PERIPH_ID_UART4, 1);
120 » reg |= SWR_UARTD_RST;» » /* SWR_UARTD_RST = 1 */ 114 » clock_enable(PERIPH_ID_UART4);
121 » writel(reg, &clkrst->crc_rst_dev_u);
122
123 » /* Enable clk to UART */
124 » reg = readl(&clkrst->crc_clk_out_enb_u);
125 » reg |= CLK_ENB_UARTD;» » /* CLK_ENB_UARTD = 1 */
126 » writel(reg, &clkrst->crc_clk_out_enb_u);
127 115
128 /* Enable pllp_out0 to UART */ 116 /* Enable pllp_out0 to UART */
129 reg = readl(&clkrst->crc_clk_src_uartd); 117 reg = readl(&clkrst->crc_clk_src_uartd);
130 reg &= 0x3FFFFFFF; /* UARTD_CLK_SRC = 00, PLLP_OUT0 */ 118 reg &= 0x3FFFFFFF; /* UARTD_CLK_SRC = 00, PLLP_OUT0 */
131 writel(reg, &clkrst->crc_clk_src_uartd); 119 writel(reg, &clkrst->crc_clk_src_uartd);
132 120
133 /* wait for 2us */ 121 /* wait for 2us */
134 udelay(2); 122 udelay(2);
135 123
136 /* De-assert reset to UART */ 124 /* De-assert reset to UART */
137 » reg = readl(&clkrst->crc_rst_dev_u); 125 » reset_set_enable(PERIPH_ID_UART4, 0);
138 » reg &= ~SWR_UARTD_RST;» » /* SWR_UARTD_RST = 0 */
139 » writel(reg, &clkrst->crc_rst_dev_u);
140 #endif /* CONFIG_TEGRA2_ENABLE_UARTD */ 126 #endif /* CONFIG_TEGRA2_ENABLE_UARTD */
141 } 127 }
142 128
143 /* 129 /*
144 * Routine: pin_mux_uart 130 * Routine: pin_mux_uart
145 * Description: setup the pin muxes/tristate values for the UART(s) 131 * Description: setup the pin muxes/tristate values for the UART(s)
146 */ 132 */
147 static void pin_mux_uart(void) 133 static void pin_mux_uart(void)
148 { 134 {
149 struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE; 135 struct pmux_tri_ctlr *pmt = (struct pmux_tri_ctlr *)NV_PA_APB_MISC_BASE;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 */ 189 */
204 int board_init(void) 190 int board_init(void)
205 { 191 {
206 /* boot param addr */ 192 /* boot param addr */
207 gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100); 193 gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100);
208 /* board id for Linux */ 194 /* board id for Linux */
209 gd->bd->bi_arch_number = CONFIG_MACH_TYPE; 195 gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
210 196
211 return 0; 197 return 0;
212 } 198 }
OLDNEW
« no previous file with comments | « arch/arm/include/asm/arch-tegra2/clock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698