aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-04-12 15:16:16 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 06:29:08 -0400
commitd4e7d09f7accd1b0d1c8f149a44deffc8c141a46 (patch)
tree66b73501e3a89ba30da34a6c08c0961f93a0ab77 /arch/arm/mach-pxa
parentbaf1c5d2a08c828d6333e0a37bcdf5afb3d5d003 (diff)
[ARM] 4972/1: Tosa: convert scoop GPIOs usage to generic gpio code
Convert set/reset_scoop_gpio to generic gpio calls. This patch depends on the pxaficp_ir hooks patch. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/tosa.c88
1 files changed, 63 insertions, 25 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 9f5ca5497bb9..49b5b83c0e4c 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -23,6 +23,7 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/gpio.h>
26 27
27#include <asm/setup.h> 28#include <asm/setup.h>
28#include <asm/memory.h> 29#include <asm/memory.h>
@@ -166,8 +167,7 @@ static struct resource tosa_scoop_resources[] = {
166 167
167static struct scoop_config tosa_scoop_setup = { 168static struct scoop_config tosa_scoop_setup = {
168 .io_dir = TOSA_SCOOP_IO_DIR, 169 .io_dir = TOSA_SCOOP_IO_DIR,
169 .io_out = TOSA_SCOOP_IO_OUT, 170 .gpio_base = TOSA_SCOOP_GPIO_BASE,
170
171}; 171};
172 172
173struct platform_device tosascoop_device = { 173struct platform_device tosascoop_device = {
@@ -194,7 +194,7 @@ static struct resource tosa_scoop_jc_resources[] = {
194 194
195static struct scoop_config tosa_scoop_jc_setup = { 195static struct scoop_config tosa_scoop_jc_setup = {
196 .io_dir = TOSA_SCOOP_JC_IO_DIR, 196 .io_dir = TOSA_SCOOP_JC_IO_DIR,
197 .io_out = TOSA_SCOOP_JC_IO_OUT, 197 .gpio_base = TOSA_SCOOP_JC_GPIO_BASE,
198}; 198};
199 199
200struct platform_device tosascoop_jc_device = { 200struct platform_device tosascoop_jc_device = {
@@ -232,20 +232,8 @@ static struct scoop_pcmcia_config tosa_pcmcia_config = {
232/* 232/*
233 * USB Device Controller 233 * USB Device Controller
234 */ 234 */
235static void tosa_udc_command(int cmd)
236{
237 switch(cmd) {
238 case PXA2XX_UDC_CMD_CONNECT:
239 set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
240 break;
241 case PXA2XX_UDC_CMD_DISCONNECT:
242 reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
243 break;
244 }
245}
246
247static struct pxa2xx_udc_mach_info udc_info __initdata = { 235static struct pxa2xx_udc_mach_info udc_info __initdata = {
248 .udc_command = tosa_udc_command, 236 .gpio_pullup = TOSA_GPIO_USB_PULLUP,
249 .gpio_vbus = TOSA_GPIO_USB_IN, 237 .gpio_vbus = TOSA_GPIO_USB_IN,
250 .gpio_vbus_inverted = 1, 238 .gpio_vbus_inverted = 1,
251}; 239};
@@ -264,9 +252,39 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
264 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, 252 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
265 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 253 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
266 "MMC/SD card detect", data); 254 "MMC/SD card detect", data);
267 if (err) 255 if (err) {
268 printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 256 printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
257 goto err_irq;
258 }
259
260 err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp");
261 if (err) {
262 printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
263 goto err_gpio_wp;
264 }
265 err = gpio_direction_input(TOSA_GPIO_SD_WP);
266 if (err)
267 goto err_gpio_wp_dir;
268
269 err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr");
270 if (err) {
271 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
272 goto err_gpio_pwr;
273 }
274 err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0);
275 if (err)
276 goto err_gpio_pwr_dir;
269 277
278 return 0;
279
280err_gpio_pwr_dir:
281 gpio_free(TOSA_GPIO_PWR_ON);
282err_gpio_pwr:
283err_gpio_wp_dir:
284 gpio_free(TOSA_GPIO_SD_WP);
285err_gpio_wp:
286 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
287err_irq:
270 return err; 288 return err;
271} 289}
272 290
@@ -275,19 +293,21 @@ static void tosa_mci_setpower(struct device *dev, unsigned int vdd)
275 struct pxamci_platform_data* p_d = dev->platform_data; 293 struct pxamci_platform_data* p_d = dev->platform_data;
276 294
277 if (( 1 << vdd) & p_d->ocr_mask) { 295 if (( 1 << vdd) & p_d->ocr_mask) {
278 set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); 296 gpio_set_value(TOSA_GPIO_PWR_ON, 1);
279 } else { 297 } else {
280 reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); 298 gpio_set_value(TOSA_GPIO_PWR_ON, 0);
281 } 299 }
282} 300}
283 301
284static int tosa_mci_get_ro(struct device *dev) 302static int tosa_mci_get_ro(struct device *dev)
285{ 303{
286 return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP); 304 return gpio_get_value(TOSA_GPIO_SD_WP);
287} 305}
288 306
289static void tosa_mci_exit(struct device *dev, void *data) 307static void tosa_mci_exit(struct device *dev, void *data)
290{ 308{
309 gpio_free(TOSA_GPIO_PWR_ON);
310 gpio_free(TOSA_GPIO_SD_WP);
291 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); 311 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
292} 312}
293 313
@@ -302,18 +322,36 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
302/* 322/*
303 * Irda 323 * Irda
304 */ 324 */
305static void tosa_irda_transceiver_mode(struct device *dev, int mode) 325static int tosa_irda_startup(struct device *dev)
306{ 326{
307 if (mode & IR_OFF) { 327 int ret;
308 reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); 328
309 } else { 329 ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
310 set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); 330 if (ret)
331 return ret;
332
333 ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
334 if (ret)
335 gpio_free(TOSA_GPIO_IR_POWERDWN);
336
337 return ret;
311 } 338 }
339
340static void tosa_irda_shutdown(struct device *dev)
341{
342 gpio_free(TOSA_GPIO_IR_POWERDWN);
343}
344
345static void tosa_irda_transceiver_mode(struct device *dev, int mode)
346{
347 gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF));
312} 348}
313 349
314static struct pxaficp_platform_data tosa_ficp_platform_data = { 350static struct pxaficp_platform_data tosa_ficp_platform_data = {
315 .transceiver_cap = IR_SIRMODE | IR_OFF, 351 .transceiver_cap = IR_SIRMODE | IR_OFF,
316 .transceiver_mode = tosa_irda_transceiver_mode, 352 .transceiver_mode = tosa_irda_transceiver_mode,
353 .startup = tosa_irda_startup,
354 .shutdown = tosa_irda_shutdown,
317}; 355};
318 356
319/* 357/*