diff --git a/arch/arm/configs/bcmrpi_cutdown_defconfig b/arch/arm/configs/bcmrpi_cutdown_defconfig index 6732014acf13ee..a3da4f0fc620df 100644 --- a/arch/arm/configs/bcmrpi_cutdown_defconfig +++ b/arch/arm/configs/bcmrpi_cutdown_defconfig @@ -492,3 +492,10 @@ CONFIG_CRYPTO_DEFLATE=m # CONFIG_CRYPTO_HW is not set CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=m +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_GPIO=m +CONFIG_I2C_HELPER_AUTO=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig index fcbf8a5b836108..ad9c95618a8811 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -528,3 +528,10 @@ CONFIG_CRYPTO_DEFLATE=m # CONFIG_CRYPTO_HW is not set CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=m +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_GPIO=m +CONFIG_I2C_HELPER_AUTO=y diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c index 54476fcf92d74f..6385544a0a8376 100644 --- a/arch/arm/mach-bcm2708/bcm2708.c +++ b/arch/arm/mach-bcm2708/bcm2708.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -374,6 +375,43 @@ static struct platform_device bcm2708_gpio_device = { .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), }, }; + +#endif + +#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) + +#define I2C_UDELAY 4 + +/* I2C at the pin header */ +static struct i2c_gpio_platform_data bcm2708_i2c_gpio_data0 = { + .sda_pin = 0, /* GPIO 0, SDA0 */ + .sda_is_open_drain = 0, + .scl_pin = 1, /* GPIO 1, SCL0 */ + .scl_is_open_drain = 0, + .udelay = I2C_UDELAY, /* 100 kHz */ + .timeout = 0, /* default to 100 ms */ +}; +static struct platform_device bcm2708_i2c_device0 = { + .name = "i2c-gpio", + .id = 0, + .dev.platform_data = &bcm2708_i2c_gpio_data0, +}; + +/* I2C at the camera connector */ +static struct i2c_gpio_platform_data bcm2708_i2c_gpio_data1 = { + .sda_pin = 2, /* GPIO 2, SDA1 */ + .sda_is_open_drain = 0, + .scl_pin = 3, /* GPIO 3, SCL1 */ + .scl_is_open_drain = 0, + .udelay = I2C_UDELAY, /* 100 kHz */ + .timeout = 0, /* default to 100 ms */ +}; +static struct platform_device bcm2708_i2c_device1 = { + .name = "i2c-gpio", + .id = 1, + .dev.platform_data = &bcm2708_i2c_gpio_data1, +}; + #endif static struct resource bcm2708_systemtimer_resources[] = { @@ -496,6 +534,10 @@ void __init bcm2708_init(void) bcm_register_device(&bcm2708_emmc_device); #endif bcm2708_init_led(); +#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) + bcm_register_device(&bcm2708_i2c_device0); + bcm_register_device(&bcm2708_i2c_device1); +#endif for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) bcm_register_device(&bcm2708_alsa_devices[i]); diff --git a/arch/arm/mach-bcm2708/bcm2708_gpio.c b/arch/arm/mach-bcm2708/bcm2708_gpio.c index 59df912fc84d70..2c9c530605cad5 100644 --- a/arch/arm/mach-bcm2708/bcm2708_gpio.c +++ b/arch/arm/mach-bcm2708/bcm2708_gpio.c @@ -315,7 +315,7 @@ static void __exit bcm2708_gpio_exit(void) platform_driver_unregister(&bcm2708_gpio_driver); } -module_init(bcm2708_gpio_init); +arch_initcall(bcm2708_gpio_init); module_exit(bcm2708_gpio_exit); MODULE_DESCRIPTION("Broadcom BCM2708 GPIO driver");