From 033a23d1f5114f692c7772feea24c328097689bb Mon Sep 17 00:00:00 2001 From: Chandra shekhar Date: Fri, 16 Nov 2007 19:16:52 +0530 Subject: [PATCH] I2C and TWL4030 suport on 34xx Resubmitting the I2C patch for 3430, after Jarkko's I2C registration helper changes. Signed-off-by: chandra shekhar Signed-off-by: Tony Lindgren --- arch/arm/configs/omap_3430sdp_defconfig | 5 ++++- arch/arm/mach-omap2/board-3430sdp.c | 8 ++++++++ arch/arm/plat-omap/i2c.c | 2 +- drivers/i2c/busses/i2c-omap.c | 20 +++++++++----------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/arch/arm/configs/omap_3430sdp_defconfig b/arch/arm/configs/omap_3430sdp_defconfig index 8278bd858d9..5f718f69717 100644 --- a/arch/arm/configs/omap_3430sdp_defconfig +++ b/arch/arm/configs/omap_3430sdp_defconfig @@ -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 diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 7b65e19896d..50f05ca7dbb 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -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 */ diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index b771a5d7b1a..237a168963c 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -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); } diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 1441ac87dbc..94c29135e55 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -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); -- 2.41.1