]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
I2C and TWL4030 suport on 34xx
authorChandra shekhar <x0044955@ti.com>
Fri, 16 Nov 2007 13:46:52 +0000 (19:16 +0530)
committerTony Lindgren <tony@atomide.com>
Fri, 16 Nov 2007 21:50:45 +0000 (13:50 -0800)
Resubmitting the I2C patch for 3430, after Jarkko's I2C registration helper changes.

Signed-off-by: chandra shekhar <x0044955@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/configs/omap_3430sdp_defconfig
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/plat-omap/i2c.c
drivers/i2c/busses/i2c-omap.c

index 8278bd858d9941491d047b5043d05b1294fde1a0..5f718f69717cef8d318a4e25322d7069d4f77f97 100644 (file)
@@ -601,7 +601,10 @@ CONFIG_HW_RANDOM=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
-# CONFIG_I2C is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_OMAP=y
 
 #
 # SPI support
index 7b65e19896d15563df1470488ea907e3b6042631..50f05ca7dbbaf46521696fe292a2072095ea6b83 100644 (file)
@@ -167,6 +167,13 @@ static struct omap_uart_config sdp3430_uart_config __initdata = {
 static struct omap_board_config_kernel sdp3430_config[] = {
        { OMAP_TAG_UART,        &sdp3430_uart_config },
 };
+static int __init omap3430_i2c_init(void)
+{
+       omap_register_i2c_bus(1, 2600, NULL, 0);
+       omap_register_i2c_bus(2, 400, NULL, 0);
+       omap_register_i2c_bus(3, 400, NULL, 0);
+       return 0;
+}
 
 static void __init omap_3430sdp_init(void)
 {
@@ -180,6 +187,7 @@ static void __init omap_3430sdp_map_io(void)
 {
        omap2_map_common_io();
 }
+arch_initcall(omap3430_i2c_init);
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
        /* Maintainer: Syed Khasim - Texas Instruments Inc */
index b771a5d7b1a9805ad34ae4cc3ed5c58c2f29f44a..237a168963c0fc11b6898529605ac2e759455274 100644 (file)
@@ -88,7 +88,7 @@ static void omap_i2c_mux_pins(int bus_id)
                if (cpu_class_is_omap1()) {
                        omap_cfg_reg(I2C_SCL);
                        omap_cfg_reg(I2C_SDA);
-               } else if (cpu_class_is_omap2()) {
+               } else if (cpu_is_omap24xx()) {
                        omap_cfg_reg(M19_24XX_I2C1_SCL);
                        omap_cfg_reg(L15_24XX_I2C1_SDA);
                }
index 1441ac87dbc8d14ddb7151f65bc7e8a2ae682372..94c29135e55fbc361beb46e6909da8896208eb03 100644 (file)
@@ -160,7 +160,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
 
 static int omap_i2c_get_clocks(struct omap_i2c_dev *dev)
 {
-       if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
+       if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
                dev->iclk = clk_get(dev->dev, "i2c_ick");
                if (IS_ERR(dev->iclk)) {
                        dev->iclk = NULL;
@@ -265,7 +265,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
                        psc = fclk_rate / 12000000;
        }
 
-       if (cpu_is_omap2430()) {
+       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 
                /* HSI2C controller internal clk rate should be 19.2 Mhz */
                internal_clk = 19200;
@@ -603,10 +603,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
                                if (dev->buf_len) {
                                        *dev->buf++ = w;
                                        dev->buf_len--;
-                                       /*
-                                        * Data reg in 2430 is 8 bit wide,
-                                        */
-                                       if (!cpu_is_omap2430()) {
+                                       /* Data reg from 2430 is 8 bit wide */
+                                       if (!cpu_is_omap2430() &&
+                                                       !cpu_is_omap34xx()) {
                                                if (dev->buf_len) {
                                                        *dev->buf++ = w >> 8;
                                                        dev->buf_len--;
@@ -637,10 +636,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
                                if (dev->buf_len) {
                                        w = *dev->buf++;
                                        dev->buf_len--;
-                                       /*
-                                        * Data reg in 2430 is 8 bit wide,
-                                        */
-                                       if (!cpu_is_omap2430()) {
+                                       /* Data reg from  2430 is 8 bit wide */
+                                       if (!cpu_is_omap2430() &&
+                                                       !cpu_is_omap34xx()) {
                                                if (dev->buf_len) {
                                                        w |= *dev->buf++ << 8;
                                                        dev->buf_len--;
@@ -740,7 +738,7 @@ omap_i2c_probe(struct platform_device *pdev)
        if (cpu_is_omap15xx())
                dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20;
 
-       if (cpu_is_omap2430()) {
+       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
                /* Set up the fifo size - Get total size */
                dev->fifo_size = 0x8 <<
                        ((omap_i2c_read_reg(dev, OMAP_I2C_BUFSTAT_REG) >> 14) & 0x3);