aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlan Carvalho de Assis <acassis@gmail.com>2009-11-27 11:09:54 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-12-02 06:06:14 -0500
commit9e3e7afe9bd73cc3fe0d742ba3391e864e234923 (patch)
tree4e944d3f94fcc17c50c48f7d02a8d0bd5c595cf2 /arch
parent9c2daf15ac5aba3c7897540c3b606e54550d9c8f (diff)
mx27: mxt_td60: Add support to SD/MMC
This patch configures iomux and i2c io expander in order to add support to SD/MMC cards on i-MXT TD60. Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx2/mxt_td60.c39
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux.h1
2 files changed, 38 insertions, 2 deletions
diff --git a/arch/arm/mach-mx2/mxt_td60.c b/arch/arm/mach-mx2/mxt_td60.c
index dd251f578e20..03dbbdc98955 100644
--- a/arch/arm/mach-mx2/mxt_td60.c
+++ b/arch/arm/mach-mx2/mxt_td60.c
@@ -36,6 +36,7 @@
36#include <mach/iomux.h> 36#include <mach/iomux.h>
37#include <mach/mxc_nand.h> 37#include <mach/mxc_nand.h>
38#include <mach/i2c.h> 38#include <mach/i2c.h>
39#include <linux/i2c/pca953x.h>
39#include <mach/imxfb.h> 40#include <mach/imxfb.h>
40#include <mach/mmc.h> 41#include <mach/mmc.h>
41 42
@@ -132,6 +133,7 @@ static unsigned int mxt_td60_pins[] __initdata = {
132 PE21_PF_SD1_D3, 133 PE21_PF_SD1_D3,
133 PE22_PF_SD1_CMD, 134 PE22_PF_SD1_CMD,
134 PE23_PF_SD1_CLK, 135 PE23_PF_SD1_CLK,
136 PF8_AF_ATA_IORDY,
135 /* SDHC2*/ 137 /* SDHC2*/
136 PB4_PF_SD2_D0, 138 PB4_PF_SD2_D0,
137 PB5_PF_SD2_D1, 139 PB5_PF_SD2_D1,
@@ -150,7 +152,40 @@ static struct imxi2c_platform_data mxt_td60_i2c_data = {
150 .bitrate = 100000, 152 .bitrate = 100000,
151}; 153};
152 154
155/* PCA9557 */
156static int mxt_td60_pca9557_setup(struct i2c_client *client,
157 unsigned gpio_base, unsigned ngpio,
158 void *context)
159{
160 static int mxt_td60_gpio_value[] = {
161 -1, -1, -1, -1, -1, -1, -1, 1
162 };
163 int n;
164
165 for (n = 0; n < ARRAY_SIZE(mxt_td60_gpio_value); ++n) {
166 gpio_request(gpio_base + n, "MXT_TD60 GPIO Exp");
167 if (mxt_td60_gpio_value[n] < 0)
168 gpio_direction_input(gpio_base + n);
169 else
170 gpio_direction_output(gpio_base + n,
171 mxt_td60_gpio_value[n]);
172 gpio_export(gpio_base + n, 0);
173 }
174
175 return 0;
176}
177
178static struct pca953x_platform_data mxt_td60_pca9557_pdata = {
179 .gpio_base = 240, /* place PCA9557 after all MX27 gpio pins */
180 .invert = 0, /* Do not invert */
181 .setup = mxt_td60_pca9557_setup,
182};
183
153static struct i2c_board_info mxt_td60_i2c_devices[] = { 184static struct i2c_board_info mxt_td60_i2c_devices[] = {
185 {
186 I2C_BOARD_INFO("pca9557", 0x18),
187 .platform_data = &mxt_td60_pca9557_pdata,
188 },
154}; 189};
155 190
156static struct imxi2c_platform_data mxt_td60_i2c2_data = { 191static struct imxi2c_platform_data mxt_td60_i2c2_data = {
@@ -201,13 +236,13 @@ static struct imx_fb_platform_data mxt_td60_fb_data = {
201static int mxt_td60_sdhc1_init(struct device *dev, irq_handler_t detect_irq, 236static int mxt_td60_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
202 void *data) 237 void *data)
203{ 238{
204 return request_irq(IRQ_GPIOE(21), detect_irq, IRQF_TRIGGER_RISING, 239 return request_irq(IRQ_GPIOF(8), detect_irq, IRQF_TRIGGER_FALLING,
205 "sdhc1-card-detect", data); 240 "sdhc1-card-detect", data);
206} 241}
207 242
208static void mxt_td60_sdhc1_exit(struct device *dev, void *data) 243static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
209{ 244{
210 free_irq(IRQ_GPIOE(21), data); 245 free_irq(IRQ_GPIOF(8), data);
211} 246}
212 247
213static struct imxmmc_platform_data sdhc1_pdata = { 248static struct imxmmc_platform_data sdhc1_pdata = {
diff --git a/arch/arm/plat-mxc/include/mach/iomux.h b/arch/arm/plat-mxc/include/mach/iomux.h
index 6d49f8ae3259..011cfcd8b820 100644
--- a/arch/arm/plat-mxc/include/mach/iomux.h
+++ b/arch/arm/plat-mxc/include/mach/iomux.h
@@ -123,6 +123,7 @@
123#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x) 123#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
124#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x) 124#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
125#define IRQ_GPIOE(x) (IRQ_GPIOD(32) + x) 125#define IRQ_GPIOE(x) (IRQ_GPIOD(32) + x)
126#define IRQ_GPIOF(x) (IRQ_GPIOE(32) + x)
126 127
127 128
128extern void mxc_gpio_mode(int gpio_mode); 129extern void mxc_gpio_mode(int gpio_mode);