aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-01-28 11:10:32 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-03-13 05:34:15 -0400
commit792067507b8bf5eaf220ee6994423381b7ae5c0b (patch)
tree7b3197f8b6438855d2e18a773c9f5215947c3dcb /arch/arm/mach-mx3
parentc2aaac70cd00cf5d4687cc35f462e3888c9ac76f (diff)
[ARM] PCM037 Board: Add I2C support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/pcm037.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 18cda92432b8..a05e37b731be 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -26,6 +26,8 @@
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/smc911x.h> 27#include <linux/smc911x.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/i2c.h>
30#include <linux/i2c/at24.h>
29 31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -37,6 +39,9 @@
37#include <mach/iomux-mx3.h> 39#include <mach/iomux-mx3.h>
38#include <mach/board-pcm037.h> 40#include <mach/board-pcm037.h>
39#include <mach/mxc_nand.h> 41#include <mach/mxc_nand.h>
42#ifdef CONFIG_I2C_IMX
43#include <mach/i2c.h>
44#endif
40 45
41#include "devices.h" 46#include "devices.h"
42 47
@@ -117,6 +122,46 @@ static struct mxc_nand_platform_data pcm037_nand_board_info = {
117 .hw_ecc = 1, 122 .hw_ecc = 1,
118}; 123};
119 124
125#ifdef CONFIG_I2C_IMX
126static int i2c_1_pins[] = {
127 MX31_PIN_CSPI2_MOSI__SCL,
128 MX31_PIN_CSPI2_MISO__SDA,
129};
130
131static int pcm037_i2c_1_init(struct device *dev)
132{
133 return mxc_iomux_setup_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins),
134 "i2c-1");
135}
136
137static void pcm037_i2c_1_exit(struct device *dev)
138{
139 mxc_iomux_release_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins));
140}
141
142static struct imxi2c_platform_data pcm037_i2c_1_data = {
143 .bitrate = 100000,
144 .init = pcm037_i2c_1_init,
145 .exit = pcm037_i2c_1_exit,
146};
147
148static struct at24_platform_data board_eeprom = {
149 .byte_len = 4096,
150 .page_size = 32,
151 .flags = AT24_FLAG_ADDR16,
152};
153
154static struct i2c_board_info pcm037_i2c_devices[] = {
155 {
156 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
157 .platform_data = &board_eeprom,
158 }, {
159 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
160 .type = "pcf8563",
161 }
162};
163#endif
164
120static struct platform_device *devices[] __initdata = { 165static struct platform_device *devices[] __initdata = {
121 &pcm037_flash, 166 &pcm037_flash,
122 &pcm037_eth, 167 &pcm037_eth,
@@ -156,6 +201,12 @@ static void __init mxc_board_init(void)
156 "pcm037-eth")) 201 "pcm037-eth"))
157 gpio_direction_input(MX31_PIN_GPIO3_1); 202 gpio_direction_input(MX31_PIN_GPIO3_1);
158 203
204#ifdef CONFIG_I2C_IMX
205 i2c_register_board_info(1, pcm037_i2c_devices,
206 ARRAY_SIZE(pcm037_i2c_devices));
207
208 mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data);
209#endif
159 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info); 210 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
160} 211}
161 212