arm: Tegra2: Add missing PLLX init
authorTom Warren <twarren.nvidia@gmail.com>
Thu, 14 Apr 2011 12:09:39 +0000 (12:09 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 27 Apr 2011 17:38:09 +0000 (19:38 +0200)
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/cpu/armv7/tegra2/ap20.c
arch/arm/include/asm/arch-tegra2/clk_rst.h

index d3e679748189da7a4935a75f098d02585b937106..60dd5dfc08489c46b1243556fa9adac662451f05 100644 (file)
 
 u32 s_first_boot = 1;
 
+void init_pllx(void)
+{
+       struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+       u32 reg;
+
+       /* If PLLX is already enabled, just return */
+       reg = readl(&clkrst->crc_pllx_base);
+       if (reg & PLL_ENABLE)
+               return;
+
+       /* Set PLLX_MISC */
+       reg = CPCON;                            /* CPCON[11:8]  = 0001 */
+       writel(reg, &clkrst->crc_pllx_misc);
+
+       /* Use 12MHz clock here */
+       reg = (PLL_BYPASS | PLL_DIVM);
+       reg |= (1000 << 8);                     /* DIVN = 0x3E8 */
+       writel(reg, &clkrst->crc_pllx_base);
+
+       reg |= PLL_ENABLE;
+       writel(reg, &clkrst->crc_pllx_base);
+
+       reg &= ~PLL_BYPASS;
+       writel(reg, &clkrst->crc_pllx_base);
+}
+
 static void enable_cpu_clock(int enable)
 {
        struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
@@ -47,6 +73,9 @@ static void enable_cpu_clock(int enable)
         */
 
        if (enable) {
+               /* Initialize PLLX */
+               init_pllx();
+
                /* Wait until all clocks are stable */
                udelay(PLL_STABILIZATION_DELAY);
 
index d67a5d7c2ce3d9c9560ef9c83b3003ec40aabaa6..bd8ad2ca0499118db3de5ee8e094af2e35d4b3a7 100644 (file)
@@ -160,8 +160,8 @@ struct clk_rst_ctlr {
 #define PLL_DIVP               (1 << 20)       /* post divider, b22:20 */
 #define PLL_DIVM               0x0C            /* input divider, b4:0 */
 
-#define SWR_UARTD_RST          (1 << 2)
-#define CLK_ENB_UARTD          (1 << 2)
+#define SWR_UARTD_RST          (1 << 1)
+#define CLK_ENB_UARTD          (1 << 1)
 #define SWR_UARTA_RST          (1 << 6)
 #define CLK_ENB_UARTA          (1 << 6)
 
@@ -189,4 +189,6 @@ struct clk_rst_ctlr {
 #define CPU0_CLK_STP           (1 << 8)
 #define CPU1_CLK_STP           (1 << 9)
 
+#define CPCON                  (1 << 8)
+
 #endif /* CLK_RST_H */