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