Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
[pandora-kernel.git] / arch / arm / mach-pxa / pxa25x.c
index e5b417d..c5b845b 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/hardware.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/pxa-regs.h>
+#include <asm/arch/pxa2xx-regs.h>
 #include <asm/arch/mfp-pxa25x.h>
 #include <asm/arch/pm.h>
 #include <asm/arch/dma.h>
@@ -108,6 +109,52 @@ static const struct clkops clk_pxa25x_lcd_ops = {
        .getrate        = clk_pxa25x_lcd_getrate,
 };
 
+static unsigned long gpio12_config_32k[] = {
+       GPIO12_32KHz,
+};
+
+static unsigned long gpio12_config_gpio[] = {
+       GPIO12_GPIO,
+};
+
+static void clk_gpio12_enable(struct clk *clk)
+{
+       pxa2xx_mfp_config(gpio12_config_32k, 1);
+}
+
+static void clk_gpio12_disable(struct clk *clk)
+{
+       pxa2xx_mfp_config(gpio12_config_gpio, 1);
+}
+
+static const struct clkops clk_pxa25x_gpio12_ops = {
+       .enable         = clk_gpio12_enable,
+       .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
@@ -117,29 +164,40 @@ static struct clk pxa25x_hwuart_clk =
        INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
 ;
 
+/*
+ * PXA 2xx clock declarations. Order is important (see aliases below)
+ * Please be careful not to disrupt the ordering.
+ */
 static struct clk pxa25x_clks[] = {
        INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
        INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
        INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
        INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
-       INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev),
+       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),
 
        INIT_CKEN("SSPCLK",  SSP, 3686400, 0, &pxa25x_device_ssp.dev),
        INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
        INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
+       INIT_CKEN("PWMCLK", PWM0, 3686400, 0, &pxa25x_device_pwm0.dev),
+       INIT_CKEN("PWMCLK", PWM1, 3686400, 0, &pxa25x_device_pwm1.dev),
 
        INIT_CKEN("AC97CLK",     AC97,     24576000, 0, NULL),
 
        /*
-       INIT_CKEN("PWMCLK",  PWM0, 3686400,  0, NULL),
-       INIT_CKEN("PWMCLK",  PWM0, 3686400,  0, NULL),
        INIT_CKEN("I2SCLK",  I2S,  14745600, 0, NULL),
        */
        INIT_CKEN("FICPCLK", FICP, 47923000, 0, 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
 
 #define SAVE(x)                sleep_save[SLEEP_SAVE_##x] = x
@@ -260,7 +318,7 @@ void __init pxa25x_init_irq(void)
 }
 
 static struct platform_device *pxa25x_devices[] __initdata = {
-       &pxa_device_udc,
+       &pxa25x_device_udc,
        &pxa_device_ffuart,
        &pxa_device_btuart,
        &pxa_device_stuart,
@@ -269,6 +327,8 @@ static struct platform_device *pxa25x_devices[] __initdata = {
        &pxa25x_device_ssp,
        &pxa25x_device_nssp,
        &pxa25x_device_assp,
+       &pxa25x_device_pwm0,
+       &pxa25x_device_pwm1,
 };
 
 static struct sys_device pxa25x_sysdev[] = {
@@ -284,7 +344,7 @@ static int __init pxa25x_init(void)
        int i, ret = 0;
 
        /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
-       if (cpu_is_pxa25x())
+       if (cpu_is_pxa255())
                clks_register(&pxa25x_hwuart_clk, 1);
 
        if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
@@ -308,9 +368,11 @@ static int __init pxa25x_init(void)
        }
 
        /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
-       if (cpu_is_pxa25x())
+       if (cpu_is_pxa255())
                ret = platform_device_register(&pxa_device_hwuart);
 
+       clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
+
        return ret;
 }