diff options
Diffstat (limited to 'arch/arm/mach-mx1/mx1ads.c')
-rw-r--r-- | arch/arm/mach-mx1/mx1ads.c | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/arch/arm/mach-mx1/mx1ads.c b/arch/arm/mach-mx1/mx1ads.c index 2e4b185fe4a9..89738fe576b1 100644 --- a/arch/arm/mach-mx1/mx1ads.c +++ b/arch/arm/mach-mx1/mx1ads.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/mtd/physmap.h> | 18 | #include <linux/mtd/physmap.h> |
19 | #include <linux/i2c.h> | ||
20 | #include <linux/i2c/pcf857x.h> | ||
19 | 21 | ||
20 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
21 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
@@ -24,7 +26,11 @@ | |||
24 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
25 | #include <mach/common.h> | 27 | #include <mach/common.h> |
26 | #include <mach/imx-uart.h> | 28 | #include <mach/imx-uart.h> |
27 | #include <mach/iomux-mx1-mx2.h> | 29 | #include <mach/irqs.h> |
30 | #ifdef CONFIG_I2C_IMX | ||
31 | #include <mach/i2c.h> | ||
32 | #endif | ||
33 | #include <mach/iomux.h> | ||
28 | #include "devices.h" | 34 | #include "devices.h" |
29 | 35 | ||
30 | /* | 36 | /* |
@@ -104,6 +110,55 @@ static struct platform_device flash_device = { | |||
104 | }; | 110 | }; |
105 | 111 | ||
106 | /* | 112 | /* |
113 | * I2C | ||
114 | */ | ||
115 | |||
116 | #ifdef CONFIG_I2C_IMX | ||
117 | static int i2c_pins[] = { | ||
118 | PA15_PF_I2C_SDA, | ||
119 | PA16_PF_I2C_SCL, | ||
120 | }; | ||
121 | |||
122 | static int i2c_init(struct device *dev) | ||
123 | { | ||
124 | return mxc_gpio_setup_multiple_pins(i2c_pins, | ||
125 | ARRAY_SIZE(i2c_pins), "I2C"); | ||
126 | } | ||
127 | |||
128 | static void i2c_exit(struct device *dev) | ||
129 | { | ||
130 | mxc_gpio_release_multiple_pins(i2c_pins, | ||
131 | ARRAY_SIZE(i2c_pins)); | ||
132 | } | ||
133 | |||
134 | static struct pcf857x_platform_data pcf857x_data[] = { | ||
135 | { | ||
136 | .gpio_base = 4 * 32, | ||
137 | }, { | ||
138 | .gpio_base = 4 * 32 + 16, | ||
139 | } | ||
140 | }; | ||
141 | |||
142 | static struct imxi2c_platform_data mx1ads_i2c_data = { | ||
143 | .bitrate = 100000, | ||
144 | .init = i2c_init, | ||
145 | .exit = i2c_exit, | ||
146 | }; | ||
147 | |||
148 | static struct i2c_board_info mx1ads_i2c_devices[] = { | ||
149 | { | ||
150 | I2C_BOARD_INFO("pcf857x", 0x22), | ||
151 | .type = "pcf8575", | ||
152 | .platform_data = &pcf857x_data[0], | ||
153 | }, { | ||
154 | I2C_BOARD_INFO("pcf857x", 0x24), | ||
155 | .type = "pcf8575", | ||
156 | .platform_data = &pcf857x_data[1], | ||
157 | }, | ||
158 | }; | ||
159 | #endif | ||
160 | |||
161 | /* | ||
107 | * Board init | 162 | * Board init |
108 | */ | 163 | */ |
109 | static void __init mx1ads_init(void) | 164 | static void __init mx1ads_init(void) |
@@ -114,12 +169,19 @@ static void __init mx1ads_init(void) | |||
114 | 169 | ||
115 | /* Physmap flash */ | 170 | /* Physmap flash */ |
116 | mxc_register_device(&flash_device, &mx1ads_flash_data); | 171 | mxc_register_device(&flash_device, &mx1ads_flash_data); |
172 | |||
173 | /* I2C */ | ||
174 | #ifdef CONFIG_I2C_IMX | ||
175 | i2c_register_board_info(0, mx1ads_i2c_devices, | ||
176 | ARRAY_SIZE(mx1ads_i2c_devices)); | ||
177 | |||
178 | mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data); | ||
179 | #endif | ||
117 | } | 180 | } |
118 | 181 | ||
119 | static void __init mx1ads_timer_init(void) | 182 | static void __init mx1ads_timer_init(void) |
120 | { | 183 | { |
121 | mxc_clocks_init(32000); | 184 | mx1_clocks_init(32000); |
122 | mxc_timer_init("gpt_clk"); | ||
123 | } | 185 | } |
124 | 186 | ||
125 | struct sys_timer mx1ads_timer = { | 187 | struct sys_timer mx1ads_timer = { |