]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Clocklib: Fix SA1111 clock name mess.
authorIan Molton <spyro@f2s.com>
Tue, 8 Jul 2008 09:32:50 +0000 (10:32 +0100)
committerIan Molton <spyro@f2s.com>
Thu, 10 Jul 2008 09:28:49 +0000 (10:28 +0100)
This patch uses the ability of PXA's clocklib to alias clock to resolve the
problem caused by sharing the SA1111 IO controller between PXA and SA1100
architectures, which have differing GPIO numbering.

Signed-off-by: Ian Molton <spyro@f2s.com>
arch/arm/common/sa1111.c
arch/arm/mach-pxa/clock.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-sa1100/clock.c

index eb06d0b2cb747344c47fb1395d6f2b6fecf080d9..79fa71d990b5a088d3b5399ab6602dc1c89a4195 100644 (file)
@@ -627,7 +627,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
        if (!sachip)
                return -ENOMEM;
 
-       sachip->clk = clk_get(me, "GPIO27_CLK");
+       sachip->clk = clk_get(me, "SA1111_CLK");
        if (!sachip->clk) {
                ret = PTR_ERR(sachip->clk);
                goto err_free;
index b4d04955dcb0a08774e0214aaac6a7c1453c2d52..630063ffa6fcec90b5f3fbbb66a2588440ac70be 100644 (file)
@@ -101,21 +101,6 @@ unsigned long clk_get_rate(struct clk *clk)
 EXPORT_SYMBOL(clk_get_rate);
 
 
-static void clk_gpio27_enable(struct clk *clk)
-{
-       pxa_gpio_mode(GPIO11_3_6MHz_MD);
-}
-
-static void clk_gpio27_disable(struct clk *clk)
-{
-}
-
-static const struct clkops clk_gpio27_ops = {
-       .enable         = clk_gpio27_enable,
-       .disable        = clk_gpio27_disable,
-};
-
-
 void clk_cken_enable(struct clk *clk)
 {
        CKEN |= 1 << clk->cken;
@@ -131,14 +116,6 @@ const struct clkops clk_cken_ops = {
        .disable        = clk_cken_disable,
 };
 
-static struct clk common_clks[] = {
-       {
-               .name           = "GPIO27_CLK",
-               .ops            = &clk_gpio27_ops,
-               .rate           = 3686400,
-       },
-};
-
 void clks_register(struct clk *clks, size_t num)
 {
        int i;
@@ -148,10 +125,3 @@ void clks_register(struct clk *clks, size_t num)
                list_add(&clks[i].node, &clocks);
        mutex_unlock(&clocks_mutex);
 }
-
-static int __init clk_init(void)
-{
-       clks_register(common_clks, ARRAY_SIZE(common_clks));
-       return 0;
-}
-arch_initcall(clk_init);
index 034d3a6c31d893709ccf53b4215f87a80a218c1f..c5b845b935bb6f5122826507bf640b2deb87e61e 100644 (file)
@@ -132,6 +132,29 @@ static const struct clkops clk_pxa25x_gpio12_ops = {
        .disable        = clk_gpio12_disable,
 };
 
+static unsigned long gpio11_config_3m6[] = {
+       GPIO11_3_6MHz,
+};
+
+static unsigned long gpio11_config_gpio[] = {
+       GPIO11_GPIO,
+};
+
+static void clk_gpio11_enable(struct clk *clk)
+{
+       pxa2xx_mfp_config(gpio11_config_3m6, 1);
+}
+
+static void clk_gpio11_disable(struct clk *clk)
+{
+       pxa2xx_mfp_config(gpio11_config_gpio, 1);
+}
+
+static const struct clkops clk_pxa25x_gpio11_ops = {
+       .enable         = clk_gpio11_enable,
+       .disable        = clk_gpio11_disable,
+};
+
 /*
  * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz)
  * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
@@ -151,6 +174,7 @@ static struct clk pxa25x_clks[] = {
        INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
        INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
        INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa25x_device_udc.dev),
+       INIT_CLK("GPIO11_CLK", &clk_pxa25x_gpio11_ops, 3686400, 0, NULL),
        INIT_CLK("GPIO12_CLK", &clk_pxa25x_gpio12_ops, 32768, 0, NULL),
        INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
        INIT_CKEN("I2CCLK", I2C, 31949000, 0, &pxa_device_i2c.dev),
@@ -169,7 +193,10 @@ static struct clk pxa25x_clks[] = {
        INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
 };
 
-static struct clk gpio7_clk = INIT_CKOTHER("GPIO7_CK", &pxa25x_clks[4], NULL);
+static struct clk pxa2xx_clk_aliases[] = {
+       INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
+       INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
+};
 
 #ifdef CONFIG_PM
 
@@ -344,7 +371,7 @@ static int __init pxa25x_init(void)
        if (cpu_is_pxa255())
                ret = platform_device_register(&pxa_device_hwuart);
 
-       clks_register(&gpio7_clk, 1);
+       clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
 
        return ret;
 }
index fc97fe57ee6feeb473ca4e178251db5c50b32617..b5809c51d13f60335965fdcfdd07ff7e11deb683 100644 (file)
@@ -103,7 +103,7 @@ static void clk_gpio27_disable(void)
 }
 
 static struct clk clk_gpio27 = {
-       .name           = "GPIO27_CLK",
+       .name           = "SA1111_CLK",
        .rate           = 3686400,
        .enable         = clk_gpio27_enable,
        .disable        = clk_gpio27_disable,