]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
davinci: move PLL wait time values to clock.h
authorSekhar Nori <nsekhar@ti.com>
Mon, 16 Nov 2009 11:51:33 +0000 (17:21 +0530)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 4 Feb 2010 21:29:33 +0000 (13:29 -0800)
As suspend support is added, the code supporting
the suspend operation needs to bypass PLLs and
needs to access the same wait time values as the
PLL code in clock.c.

To facilitate this, move the PLL wait times to
clock.h where they can be accessed by suspend code.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/clock.h

index baece65cb9c0829ed04bfc210e8894f075512bbe..0fa68c558320a69d238c97da40b32407eee9a28b 100644 (file)
@@ -376,7 +376,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
                locktime = ((2000 * prediv) / 100);
                prediv = (prediv - 1) | PLLDIV_EN;
        } else {
-               locktime = 20;
+               locktime = PLL_LOCK_TIME;
        }
        if (postdiv)
                postdiv = (postdiv - 1) | PLLDIV_EN;
@@ -389,12 +389,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
        ctrl &= ~(PLLCTL_PLLENSRC | PLLCTL_PLLEN);
        __raw_writel(ctrl, pll->base + PLLCTL);
 
-       /*
-        * Wait for 4 OSCIN/CLKIN cycles to ensure that the PLLC has switched
-        * to bypass mode. Delay of 1us ensures we are good for all > 4MHz
-        * OSCIN/CLKIN inputs. Typically the input is ~25MHz.
-        */
-       udelay(1);
+       udelay(PLL_BYPASS_TIME);
 
        /* Reset and enable PLL */
        ctrl &= ~(PLLCTL_PLLRST | PLLCTL_PLLDIS);
@@ -408,11 +403,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
        if (pll->flags & PLL_HAS_POSTDIV)
                __raw_writel(postdiv, pll->base + POSTDIV);
 
-       /*
-        * Wait for PLL to reset properly, OMAP-L138 datasheet says
-        * 'min' time = 125ns
-        */
-       udelay(1);
+       udelay(PLL_RESET_TIME);
 
        /* Bring PLL out of reset */
        ctrl |= PLLCTL_PLLRST;
index c92d77a3008d8086cb5bfc0016a4f9379aef9753..eca4d9972225a513448b8af1adec16dd16ff0259 100644 (file)
 #define PLLDIV_EN       BIT(15)
 #define PLLDIV_RATIO_MASK 0x1f
 
+/*
+ * OMAP-L138 system reference guide recommends a wait for 4 OSCIN/CLKIN
+ * cycles to ensure that the PLLC has switched to bypass mode. Delay of 1us
+ * ensures we are good for all > 4MHz OSCIN/CLKIN inputs. Typically the input
+ * is ~25MHz. Units are micro seconds.
+ */
+#define PLL_BYPASS_TIME                1
+/* From OMAP-L138 datasheet table 6-4. Units are micro seconds */
+#define PLL_RESET_TIME         1
+/*
+ * From OMAP-L138 datasheet table 6-4; assuming prediv = 1, sqrt(pllm) = 4
+ * Units are micro seconds.
+ */
+#define PLL_LOCK_TIME          20
+
 struct pll_data {
        u32 phys_base;
        void __iomem *base;