]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 5201/1: PXA3xx: Add support for power i2c bus
authorMike Rapoport <mike@compulab.co.il>
Sun, 17 Aug 2008 05:23:05 +0000 (06:23 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 9 Sep 2008 15:32:51 +0000 (16:32 +0100)
Add power I2C support for PXA3xx processors

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/devices.h
arch/arm/mach-pxa/include/mach/i2c.h
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c
drivers/i2c/busses/i2c-pxa.c

index 887c738f5911dd6d333959b489aa3dad5af35731..bb04af4b0aa3f7706b6124cd3ce1539e55d86288 100644 (file)
@@ -32,5 +32,6 @@ extern struct platform_device pxa27x_device_pwm0;
 extern struct platform_device pxa27x_device_pwm1;
 
 extern struct platform_device pxa3xx_device_nand;
+extern struct platform_device pxa3xx_device_i2c_power;
 
 void __init pxa_register_device(struct platform_device *dev, void *data);
index 80596b0134439412bc09c24472923bb7cfdc5cb0..897e71752177ad91e78bbca6374ea2f5cff08f91 100644 (file)
@@ -71,7 +71,11 @@ struct i2c_pxa_platform_data {
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
 
 #ifdef CONFIG_PXA27x
-extern void pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info);
+extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info);
+#endif
+
+#ifdef CONFIG_PXA3xx
+extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info);
 #endif
 
 #endif
index f9f6a9c31f4b06237ab4751c66b9bfc68d55e254..c33cf6ac8c81fdd6c2416bdd54608b339ab6e9f0 100644 (file)
@@ -349,7 +349,7 @@ struct platform_device pxa27x_device_i2c_power = {
        .num_resources  = ARRAY_SIZE(i2c_power_resources),
 };
 
-void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
+void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 {
        local_irq_disable();
        PCFR |= PCFR_PI2CEN;
index 03cbc38103ed230d3bf4f1309b9d8b6a6d0fba99..b3cd5d0b0f353e970d58a9f02f49194b2c87529a 100644 (file)
@@ -203,6 +203,19 @@ static const struct clkops clk_pout_ops = {
        .disable        = clk_pout_disable,
 };
 
+static void clk_dummy_enable(struct clk *clk)
+{
+}
+
+static void clk_dummy_disable(struct clk *clk)
+{
+}
+
+static const struct clkops clk_dummy_ops = {
+       .enable         = clk_dummy_enable,
+       .disable        = clk_dummy_disable,
+};
+
 static struct clk pxa3xx_clks[] = {
        {
                .name           = "CLK_POUT",
@@ -211,6 +224,13 @@ static struct clk pxa3xx_clks[] = {
                .delay          = 70,
        },
 
+       /* Power I2C clock is always on */
+       {
+               .name           = "I2CCLK",
+               .ops            = &clk_dummy_ops,
+               .dev            = &pxa3xx_device_i2c_power.dev,
+       },
+
        PXA3xx_CK("LCDCLK",  LCD,    &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
        PXA3xx_CK("CAMCLK",  CAMERA, &clk_pxa3xx_hsio_ops, NULL),
        PXA3xx_CK("AC97CLK", AC97,   &clk_pxa3xx_ac97_ops, NULL),
@@ -509,6 +529,30 @@ void __init pxa3xx_init_irq(void)
  * device registration specific to PXA3xx.
  */
 
+static struct resource i2c_power_resources[] = {
+       {
+               .start  = 0x40f500c0,
+               .end    = 0x40f500d3,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_PWRI2C,
+               .end    = IRQ_PWRI2C,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device pxa3xx_device_i2c_power = {
+       .name           = "pxa2xx-i2c",
+       .id             = 1,
+       .resource       = i2c_power_resources,
+       .num_resources  = ARRAY_SIZE(i2c_power_resources),
+};
+
+void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
+{
+       pxa3xx_device_i2c_power.dev.platform_data = info;
+}
+
 static struct platform_device *devices[] __initdata = {
 /*     &pxa_device_udc,        The UDC driver is PXA25x only */
        &pxa_device_ffuart,
@@ -522,6 +566,7 @@ static struct platform_device *devices[] __initdata = {
        &pxa3xx_device_ssp4,
        &pxa27x_device_pwm0,
        &pxa27x_device_pwm1,
+       &pxa3xx_device_i2c_power,
 };
 
 static struct sys_device pxa3xx_sysdev[] = {
index 44d838410f15830e45f749eef5d41fcde17a15ff..5d5fbc518b7b37a6c65fdde01119fe4ac7766734 100644 (file)
@@ -60,6 +60,7 @@ struct pxa_i2c {
        u32                     icrlog[32];
 
        void __iomem            *reg_base;
+       unsigned int            reg_shift;
 
        unsigned long           iobase;
        unsigned long           iosize;
@@ -68,11 +69,11 @@ struct pxa_i2c {
        int                     use_pio;
 };
 
-#define _IBMR(i2c)     ((i2c)->reg_base + 0)
-#define _IDBR(i2c)     ((i2c)->reg_base + 8)
-#define _ICR(i2c)      ((i2c)->reg_base + 0x10)
-#define _ISR(i2c)      ((i2c)->reg_base + 0x18)
-#define _ISAR(i2c)     ((i2c)->reg_base + 0x20)
+#define _IBMR(i2c)     ((i2c)->reg_base + (0x0 << (i2c)->reg_shift))
+#define _IDBR(i2c)     ((i2c)->reg_base + (0x4 << (i2c)->reg_shift))
+#define _ICR(i2c)      ((i2c)->reg_base + (0x8 << (i2c)->reg_shift))
+#define _ISR(i2c)      ((i2c)->reg_base + (0xc << (i2c)->reg_shift))
+#define _ISAR(i2c)     ((i2c)->reg_base + (0x10 << (i2c)->reg_shift))
 
 /*
  * I2C Slave mode address
@@ -993,6 +994,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
                ret = -EIO;
                goto eremap;
        }
+       i2c->reg_shift = (cpu_is_pxa3xx() && (dev->id == 1)) ? 0 : 1;
 
        i2c->iobase = res->start;
        i2c->iosize = res_len(res);