diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-01-28 13:07:11 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-03-13 10:34:12 +0100 |
commit | a4e9a65a1f90e94eca3af1a69b42d039054ef9de (patch) | |
tree | 1280490a9b28f35f74c515fd7bb6f920a8094561 | |
parent | c5d4dbff965b77b39c0188e4146892d76c775a98 (diff) | |
download | op-kernel-dev-a4e9a65a1f90e94eca3af1a69b42d039054ef9de.zip op-kernel-dev-a4e9a65a1f90e94eca3af1a69b42d039054ef9de.tar.gz |
[ARM] PCM038 board: Add I2C support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx2/pcm038.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c index d246eb1..7d935e1 100644 --- a/arch/arm/mach-mx2/pcm038.c +++ b/arch/arm/mach-mx2/pcm038.c @@ -21,11 +21,17 @@ #include <linux/mtd/physmap.h> #include <linux/mtd/plat-ram.h> #include <linux/io.h> +#include <linux/i2c.h> +#include <linux/i2c/at24.h> + #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <mach/common.h> #include <mach/hardware.h> #include <mach/iomux.h> +#ifdef CONFIG_I2C_IMX +#include <mach/i2c.h> +#endif #include <asm/mach/time.h> #include <mach/imx-uart.h> #include <mach/board-pcm038.h> @@ -204,6 +210,51 @@ static void __init pcm038_init_sram(void) __raw_writel(0x22220a00, CSCR_A(1)); } +#ifdef CONFIG_I2C_IMX +static int mxc_i2c1_pins[] = { + PC5_PF_I2C2_SDA, + PC6_PF_I2C2_SCL +}; + +static int pcm038_i2c_1_init(struct device *dev) +{ + return mxc_gpio_setup_multiple_pins(mxc_i2c1_pins, ARRAY_SIZE(mxc_i2c1_pins), + "I2C1"); +} + +static void pcm038_i2c_1_exit(struct device *dev) +{ + mxc_gpio_release_multiple_pins(mxc_i2c1_pins, ARRAY_SIZE(mxc_i2c1_pins)); +} + +static struct imxi2c_platform_data pcm038_i2c_1_data = { + .bitrate = 100000, + .init = pcm038_i2c_1_init, + .exit = pcm038_i2c_1_exit, +}; + +static struct at24_platform_data board_eeprom = { + .byte_len = 4096, + .page_size = 32, + .flags = AT24_FLAG_ADDR16, +}; + +static struct i2c_board_info pcm038_i2c_devices[] = { + [0] = { + I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ + .platform_data = &board_eeprom, + }, + [1] = { + I2C_BOARD_INFO("rtc-pcf8563", 0x51), + .type = "pcf8563" + }, + [2] = { + I2C_BOARD_INFO("lm75", 0x4a), + .type = "lm75" + } +}; +#endif + static void __init pcm038_init(void) { gpio_fec_active(); @@ -216,6 +267,14 @@ static void __init pcm038_init(void) mxc_gpio_mode(PE16_AF_OWIRE); mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info); +#ifdef CONFIG_I2C_IMX + /* only the i2c master 1 is used on this CPU card */ + i2c_register_board_info(1, pcm038_i2c_devices, + ARRAY_SIZE(pcm038_i2c_devices)); + + mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data); +#endif + platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); #ifdef CONFIG_MACH_PCM970_BASEBOARD |