diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2011-08-24 16:31:35 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-08-25 02:42:38 -0400 |
commit | 2f81b4d977b06fd54e797f04e05091d8da8ddfee (patch) | |
tree | 502c92a73d7f5af919e3c4784b370cf093ebe310 | |
parent | 97f453136e036f084d6024435482ac0a7c9cefef (diff) |
ARM: mx53_loco: Add support for the accelerometer
mx53_loco has a MMA8450 accelerometer connected to i2c0.
Add support for it.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx5/board-mx53_loco.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 4e1d51d252dc..1bb0b3c330fb 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/i2c.h> | ||
25 | 26 | ||
26 | #include <mach/common.h> | 27 | #include <mach/common.h> |
27 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
@@ -42,6 +43,7 @@ | |||
42 | #define LOCO_SD3_CD IMX_GPIO_NR(3, 11) | 43 | #define LOCO_SD3_CD IMX_GPIO_NR(3, 11) |
43 | #define LOCO_SD3_WP IMX_GPIO_NR(3, 12) | 44 | #define LOCO_SD3_WP IMX_GPIO_NR(3, 12) |
44 | #define LOCO_SD1_CD IMX_GPIO_NR(3, 13) | 45 | #define LOCO_SD1_CD IMX_GPIO_NR(3, 13) |
46 | #define LOCO_ACCEL_EN IMX_GPIO_NR(6, 14) | ||
45 | 47 | ||
46 | static iomux_v3_cfg_t mx53_loco_pads[] = { | 48 | static iomux_v3_cfg_t mx53_loco_pads[] = { |
47 | /* FEC */ | 49 | /* FEC */ |
@@ -64,6 +66,10 @@ static iomux_v3_cfg_t mx53_loco_pads[] = { | |||
64 | MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD, | 66 | MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD, |
65 | MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS, | 67 | MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS, |
66 | MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD, | 68 | MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD, |
69 | /* I2C1 */ | ||
70 | MX53_PAD_CSI0_DAT8__I2C1_SDA, | ||
71 | MX53_PAD_CSI0_DAT9__I2C1_SCL, | ||
72 | MX53_PAD_NANDF_CS1__GPIO6_14, /* Accelerometer Enable */ | ||
67 | /* I2C2 */ | 73 | /* I2C2 */ |
68 | MX53_PAD_KEY_COL3__I2C2_SCL, | 74 | MX53_PAD_KEY_COL3__I2C2_SCL, |
69 | MX53_PAD_KEY_ROW3__I2C2_SDA, | 75 | MX53_PAD_KEY_ROW3__I2C2_SDA, |
@@ -257,8 +263,15 @@ static const struct gpio_led_platform_data mx53loco_leds_data __initconst = { | |||
257 | .num_leds = ARRAY_SIZE(mx53loco_leds), | 263 | .num_leds = ARRAY_SIZE(mx53loco_leds), |
258 | }; | 264 | }; |
259 | 265 | ||
266 | static struct i2c_board_info mx53loco_i2c_devices[] = { | ||
267 | { | ||
268 | I2C_BOARD_INFO("mma8450", 0x1C), | ||
269 | }, | ||
270 | }; | ||
271 | |||
260 | static void __init mx53_loco_board_init(void) | 272 | static void __init mx53_loco_board_init(void) |
261 | { | 273 | { |
274 | int ret; | ||
262 | imx53_soc_init(); | 275 | imx53_soc_init(); |
263 | 276 | ||
264 | mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, | 277 | mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, |
@@ -267,6 +280,13 @@ static void __init mx53_loco_board_init(void) | |||
267 | mx53_loco_fec_reset(); | 280 | mx53_loco_fec_reset(); |
268 | imx53_add_fec(&mx53_loco_fec_data); | 281 | imx53_add_fec(&mx53_loco_fec_data); |
269 | imx53_add_imx2_wdt(0, NULL); | 282 | imx53_add_imx2_wdt(0, NULL); |
283 | |||
284 | ret = gpio_request_one(LOCO_ACCEL_EN, GPIOF_OUT_INIT_HIGH, "accel_en"); | ||
285 | if (ret) | ||
286 | pr_err("Cannot request ACCEL_EN pin: %d\n", ret); | ||
287 | |||
288 | i2c_register_board_info(0, mx53loco_i2c_devices, | ||
289 | ARRAY_SIZE(mx53loco_i2c_devices)); | ||
270 | imx53_add_imx_i2c(0, &mx53_loco_i2c_data); | 290 | imx53_add_imx_i2c(0, &mx53_loco_i2c_data); |
271 | imx53_add_imx_i2c(1, &mx53_loco_i2c_data); | 291 | imx53_add_imx_i2c(1, &mx53_loco_i2c_data); |
272 | imx53_add_sdhci_esdhc_imx(0, &mx53_loco_sd1_data); | 292 | imx53_add_sdhci_esdhc_imx(0, &mx53_loco_sd1_data); |