aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMatt Porter2013-03-20 00:38:11 -0500
committerTom Rini2013-05-10 07:25:54 -0500
commit035d563937b5bafbf78b17e07ac50bca47492385 (patch)
tree7bce2fdecf239c31090bb9f003dcd4f7e2f408ad /arch
parent8934f7846501070a5b01c1fab5db27559e9d70d1 (diff)
downloadu-boot-035d563937b5bafbf78b17e07ac50bca47492385.tar.gz
u-boot-035d563937b5bafbf78b17e07ac50bca47492385.tar.xz
u-boot-035d563937b5bafbf78b17e07ac50bca47492385.zip
am33xx: add pll and clock support for TI814x CPSW
Enables required PLLs and clocks for CPSW on TI814x. Signed-off-by: Matt Porter <mporter@ti.com> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7/am33xx/clock_ti814x.c103
-rw-r--r--arch/arm/include/asm/arch-am33xx/hardware_ti814x.h1
2 files changed, 102 insertions, 2 deletions
diff --git a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
index cb4210f6e6..8b2878d4ff 100644
--- a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
+++ b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c
@@ -109,6 +109,8 @@ struct ad_pll {
109#define OSC_SRC_CTRL (PLL_SUBSYS_BASE + 0x2C0) 109#define OSC_SRC_CTRL (PLL_SUBSYS_BASE + 0x2C0)
110 110
111/* PRCM */ 111/* PRCM */
112#define ENET_CLKCTRL_CMPL 0x30000
113
112#define CM_DEFAULT_BASE (PRCM_BASE + 0x0500) 114#define CM_DEFAULT_BASE (PRCM_BASE + 0x0500)
113 115
114struct cm_def { 116struct cm_def {
@@ -183,7 +185,7 @@ struct cm_alwon {
183 unsigned int resv5[2]; 185 unsigned int resv5[2];
184 unsigned int gpmcclkctrl; 186 unsigned int gpmcclkctrl;
185 unsigned int ethernet0clkctrl; 187 unsigned int ethernet0clkctrl;
186 unsigned int resv6[1]; 188 unsigned int ethernet1clkctrl;
187 unsigned int mpuclkctrl; 189 unsigned int mpuclkctrl;
188 unsigned int debugssclkctrl; 190 unsigned int debugssclkctrl;
189 unsigned int l3clkctrl; 191 unsigned int l3clkctrl;
@@ -203,9 +205,67 @@ struct cm_alwon {
203 unsigned int custefuseclkctrl; 205 unsigned int custefuseclkctrl;
204}; 206};
205 207
208#define SATA_PLL_BASE (CTRL_BASE + 0x0720)
209
210struct sata_pll {
211 unsigned int pllcfg0;
212 unsigned int pllcfg1;
213 unsigned int pllcfg2;
214 unsigned int pllcfg3;
215 unsigned int pllcfg4;
216 unsigned int pllstatus;
217 unsigned int rxstatus;
218 unsigned int txstatus;
219 unsigned int testcfg;
220};
221
222#define SEL_IN_FREQ (0x1 << 31)
223#define DIGCLRZ (0x1 << 30)
224#define ENDIGLDO (0x1 << 4)
225#define APLL_CP_CURR (0x1 << 3)
226#define ENBGSC_REF (0x1 << 2)
227#define ENPLLLDO (0x1 << 1)
228#define ENPLL (0x1 << 0)
229
230#define SATA_PLLCFG0_1 (SEL_IN_FREQ | ENBGSC_REF)
231#define SATA_PLLCFG0_2 (SEL_IN_FREQ | ENDIGLDO | ENBGSC_REF)
232#define SATA_PLLCFG0_3 (SEL_IN_FREQ | ENDIGLDO | ENBGSC_REF | ENPLLLDO)
233#define SATA_PLLCFG0_4 (SEL_IN_FREQ | DIGCLRZ | ENDIGLDO | ENBGSC_REF | \
234 ENPLLLDO | ENPLL)
235
236#define PLL_LOCK (0x1 << 0)
237
238#define ENSATAMODE (0x1 << 31)
239#define PLLREFSEL (0x1 << 30)
240#define MDIVINT (0x4b << 18)
241#define EN_CLKAUX (0x1 << 5)
242#define EN_CLK125M (0x1 << 4)
243#define EN_CLK100M (0x1 << 3)
244#define EN_CLK50M (0x1 << 2)
245
246#define SATA_PLLCFG1 (ENSATAMODE | \
247 PLLREFSEL | \
248 MDIVINT | \
249 EN_CLKAUX | \
250 EN_CLK125M | \
251 EN_CLK100M | \
252 EN_CLK50M)
253
254#define DIGLDO_EN_CAPLESSMODE (0x1 << 22)
255#define PLLDO_EN_LDO_STABLE (0x1 << 11)
256#define PLLDO_EN_BUF_CUR (0x1 << 7)
257#define PLLDO_EN_LP (0x1 << 6)
258#define PLLDO_CTRL_TRIM_1_4V (0x10 << 1)
259
260#define SATA_PLLCFG3 (DIGLDO_EN_CAPLESSMODE | \
261 PLLDO_EN_LDO_STABLE | \
262 PLLDO_EN_BUF_CUR | \
263 PLLDO_EN_LP | \
264 PLLDO_CTRL_TRIM_1_4V)
206 265
207const struct cm_alwon *cmalwon = (struct cm_alwon *)CM_ALWON_BASE; 266const struct cm_alwon *cmalwon = (struct cm_alwon *)CM_ALWON_BASE;
208const struct cm_def *cmdef = (struct cm_def *)CM_DEFAULT_BASE; 267const struct cm_def *cmdef = (struct cm_def *)CM_DEFAULT_BASE;
268const struct sata_pll *spll = (struct sata_pll *)SATA_PLL_BASE;
209 269
210/* 270/*
211 * Enable the peripheral clock for required peripherals 271 * Enable the peripheral clock for required peripherals
@@ -221,6 +281,15 @@ static void enable_per_clocks(void)
221 writel(PRCM_MOD_EN, &cmalwon->mmchs1clkctrl); 281 writel(PRCM_MOD_EN, &cmalwon->mmchs1clkctrl);
222 while (readl(&cmalwon->mmchs1clkctrl) != PRCM_MOD_EN) 282 while (readl(&cmalwon->mmchs1clkctrl) != PRCM_MOD_EN)
223 ; 283 ;
284
285 /* Ethernet */
286 writel(PRCM_MOD_EN, &cmalwon->ethclkstctrl);
287 writel(PRCM_MOD_EN, &cmalwon->ethernet0clkctrl);
288 while ((readl(&cmalwon->ethernet0clkctrl) & ENET_CLKCTRL_CMPL) != 0)
289 ;
290 writel(PRCM_MOD_EN, &cmalwon->ethernet1clkctrl);
291 while ((readl(&cmalwon->ethernet1clkctrl) & ENET_CLKCTRL_CMPL) != 0)
292 ;
224} 293}
225 294
226/* 295/*
@@ -365,6 +434,35 @@ void ddr_pll_config(unsigned int ddrpll_m)
365 pll_config(DDR_PLL_BASE, DDR_N, DDR_M, DDR_M2, DDR_CLKCTRL, 1); 434 pll_config(DDR_PLL_BASE, DDR_N, DDR_M, DDR_M2, DDR_CLKCTRL, 1);
366} 435}
367 436
437void sata_pll_config(void)
438{
439 /*
440 * This sequence for configuring the SATA PLL
441 * resident in the control module is documented
442 * in TI8148 TRM section 21.3.1
443 */
444 writel(SATA_PLLCFG1, &spll->pllcfg1);
445 udelay(50);
446
447 writel(SATA_PLLCFG3, &spll->pllcfg3);
448 udelay(50);
449
450 writel(SATA_PLLCFG0_1, &spll->pllcfg0);
451 udelay(50);
452
453 writel(SATA_PLLCFG0_2, &spll->pllcfg0);
454 udelay(50);
455
456 writel(SATA_PLLCFG0_3, &spll->pllcfg0);
457 udelay(50);
458
459 writel(SATA_PLLCFG0_4, &spll->pllcfg0);
460 udelay(50);
461
462 while (((readl(&spll->pllstatus) & PLL_LOCK) == 0))
463 ;
464}
465
368void enable_emif_clocks(void) {}; 466void enable_emif_clocks(void) {};
369 467
370void enable_dmm_clocks(void) 468void enable_dmm_clocks(void)
@@ -397,9 +495,10 @@ void pll_init()
397 /* Enable the control module */ 495 /* Enable the control module */
398 writel(PRCM_MOD_EN, &cmalwon->controlclkctrl); 496 writel(PRCM_MOD_EN, &cmalwon->controlclkctrl);
399 497
498 /* Configure PLLs */
400 mpu_pll_config(); 499 mpu_pll_config();
401
402 l3_pll_config(); 500 l3_pll_config();
501 sata_pll_config();
403 502
404 /* Enable the required peripherals */ 503 /* Enable the required peripherals */
405 enable_per_clocks(); 504 enable_per_clocks();
diff --git a/arch/arm/include/asm/arch-am33xx/hardware_ti814x.h b/arch/arm/include/asm/arch-am33xx/hardware_ti814x.h
index a950ac3c18..8f9315c020 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_ti814x.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_ti814x.h
@@ -29,6 +29,7 @@
29 29
30/* Control Module Base Address */ 30/* Control Module Base Address */
31#define CTRL_BASE 0x48140000 31#define CTRL_BASE 0x48140000
32#define CTRL_DEVICE_BASE 0x48140600
32 33
33/* PRCM Base Address */ 34/* PRCM Base Address */
34#define PRCM_BASE 0x48180000 35#define PRCM_BASE 0x48180000