aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-09-02 05:34:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-23 17:04:36 -0400
commitdd5980d68af4457e600ef6add5b541ce952147e6 (patch)
tree5add13356814721356dcb32f27f0d912ab86716f /arch
parentedb403fbfb0ad56e62d8ebbecc3b846487020e0f (diff)
[ARM] pxa/spitz: convert to use new GPIO API
Original patch from Dmitry Baryshkov's initial scoop gpio conversion work at http://git.infradead.org/users/dbaryshkov/zaurus-2.6.git. Separated into this dedicated generic GPIO conversion patch for the work of deprecating pxa_gpio_mode(). Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/spitz.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index b569f3b4cf3a..fef5018d547d 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -19,6 +19,7 @@
19#include <linux/major.h> 19#include <linux/major.h>
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/gpio.h>
22#include <linux/mmc/host.h> 23#include <linux/mmc/host.h>
23#include <linux/pm.h> 24#include <linux/pm.h>
24#include <linux/backlight.h> 25#include <linux/backlight.h>
@@ -371,17 +372,36 @@ static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, vo
371 pxa_gpio_mode(GPIO109_MMCDAT1_MD); 372 pxa_gpio_mode(GPIO109_MMCDAT1_MD);
372 pxa_gpio_mode(GPIO110_MMCDAT2_MD); 373 pxa_gpio_mode(GPIO110_MMCDAT2_MD);
373 pxa_gpio_mode(GPIO111_MMCDAT3_MD); 374 pxa_gpio_mode(GPIO111_MMCDAT3_MD);
374 pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN); 375
375 pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN); 376 err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT");
377 if (err)
378 goto err_out;
379
380 err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP");
381 if (err)
382 goto err_free_1;
383
384 gpio_direction_input(SPITZ_GPIO_nSD_DETECT);
385 gpio_direction_input(SPITZ_GPIO_nSD_WP);
376 386
377 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); 387 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
378 388
379 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, 389 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
380 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 390 IRQF_DISABLED | IRQF_TRIGGER_RISING |
391 IRQF_TRIGGER_FALLING,
381 "MMC card detect", data); 392 "MMC card detect", data);
382 if (err) 393 if (err) {
383 printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 394 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
395 __func__);
396 goto err_free_2;
397 }
398 return 0;
384 399
400err_free_2:
401 gpio_free(SPITZ_GPIO_nSD_WP);
402err_free_1:
403 gpio_free(SPITZ_GPIO_nSD_DETECT);
404err_out:
385 return err; 405 return err;
386} 406}
387 407
@@ -397,12 +417,14 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
397 417
398static int spitz_mci_get_ro(struct device *dev) 418static int spitz_mci_get_ro(struct device *dev)
399{ 419{
400 return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP); 420 return gpio_get_value(SPITZ_GPIO_nSD_WP);
401} 421}
402 422
403static void spitz_mci_exit(struct device *dev, void *data) 423static void spitz_mci_exit(struct device *dev, void *data)
404{ 424{
405 free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data); 425 free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
426 gpio_free(SPITZ_GPIO_nSD_WP);
427 gpio_free(SPITZ_GPIO_nSD_DETECT);
406} 428}
407 429
408static struct pxamci_platform_data spitz_mci_platform_data = { 430static struct pxamci_platform_data spitz_mci_platform_data = {
@@ -419,6 +441,12 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
419 */ 441 */
420static int spitz_ohci_init(struct device *dev) 442static int spitz_ohci_init(struct device *dev)
421{ 443{
444 int err;
445
446 err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST");
447 if (err)
448 return err;
449
422 /* Only Port 2 is connected */ 450 /* Only Port 2 is connected */
423 pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN); 451 pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
424 pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT); 452 pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
@@ -427,7 +455,7 @@ static int spitz_ohci_init(struct device *dev)
427 /* Setup USB Port 2 Output Control Register */ 455 /* Setup USB Port 2 Output Control Register */
428 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; 456 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
429 457
430 GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST); 458 gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
431 459
432 UHCHR = (UHCHR) & 460 UHCHR = (UHCHR) &
433 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); 461 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);