aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/csb726.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2009-07-06 16:16:42 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-09-10 06:49:30 -0400
commit7a648256b20c493c99757fe1d248daf7954647bc (patch)
tree82aa6566accc96ea07a89121cb9779090a6dab40 /arch/arm/mach-pxa/csb726.c
parentb405db6c015fe8e4c9d8199a0355bb16d95d7049 (diff)
[ARM] pxa: factor pxamci gpio handling
Several boards use always the same pattern with pxamci : request gpio, request irq for that gpio to detect MMC card insertion, request gpio for read-only mode detection, etc ... Now that pxamci provides platform_data to describe simple gpio management of the MMC external controls, use it. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Mike Rapoport <mike@compulab.co.il> Acked-by: Philipp Zabel <philipp.zabel@gmail.com> Acked-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: rpurdie@rpsys.net Cc: drwyrm@gmail.com Cc: sakoman@gmail.com Cc: marek.vasut@gmail.com Cc: s.hauer@pengutronix.de Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/csb726.c')
-rw-r--r--arch/arm/mach-pxa/csb726.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
index 7d3e1b46e550..79141f862728 100644
--- a/arch/arm/mach-pxa/csb726.c
+++ b/arch/arm/mach-pxa/csb726.c
@@ -130,61 +130,17 @@ static struct pxamci_platform_data csb726_mci_data;
130static int csb726_mci_init(struct device *dev, 130static int csb726_mci_init(struct device *dev,
131 irq_handler_t detect, void *data) 131 irq_handler_t detect, void *data)
132{ 132{
133 int err;
134
135 csb726_mci_data.detect_delay = msecs_to_jiffies(500); 133 csb726_mci_data.detect_delay = msecs_to_jiffies(500);
136
137 err = gpio_request(CSB726_GPIO_MMC_DETECT, "MMC detect");
138 if (err)
139 goto err_det_req;
140
141 err = gpio_direction_input(CSB726_GPIO_MMC_DETECT);
142 if (err)
143 goto err_det_dir;
144
145 err = gpio_request(CSB726_GPIO_MMC_RO, "MMC ro");
146 if (err)
147 goto err_ro_req;
148
149 err = gpio_direction_input(CSB726_GPIO_MMC_RO);
150 if (err)
151 goto err_ro_dir;
152
153 err = request_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), detect,
154 IRQF_DISABLED, "MMC card detect", data);
155 if (err)
156 goto err_irq;
157
158 return 0; 134 return 0;
159
160err_irq:
161err_ro_dir:
162 gpio_free(CSB726_GPIO_MMC_RO);
163err_ro_req:
164err_det_dir:
165 gpio_free(CSB726_GPIO_MMC_DETECT);
166err_det_req:
167 return err;
168}
169
170static int csb726_mci_get_ro(struct device *dev)
171{
172 return gpio_get_value(CSB726_GPIO_MMC_RO);
173}
174
175static void csb726_mci_exit(struct device *dev, void *data)
176{
177 free_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), data);
178 gpio_free(CSB726_GPIO_MMC_RO);
179 gpio_free(CSB726_GPIO_MMC_DETECT);
180} 135}
181 136
182static struct pxamci_platform_data csb726_mci = { 137static struct pxamci_platform_data csb726_mci = {
183 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 138 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
184 .init = csb726_mci_init, 139 .init = csb726_mci_init,
185 .get_ro = csb726_mci_get_ro,
186 /* FIXME setpower */ 140 /* FIXME setpower */
187 .exit = csb726_mci_exit, 141 .gpio_card_detect = CSB726_GPIO_MMC_DETECT,
142 .gpio_card_ro = CSB726_GPIO_MMC_RO,
143 .gpio_power = -1,
188}; 144};
189 145
190static struct pxaohci_platform_data csb726_ohci_platform_data = { 146static struct pxaohci_platform_data csb726_ohci_platform_data = {