summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/spitz.c
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-09-02 17:34:33 +0800
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-23 22:04:36 +0100
commitdd5980d68af4457e600ef6add5b541ce952147e6 (patch)
tree5add13356814721356dcb32f27f0d912ab86716f /arch/arm/mach-pxa/spitz.c
parentedb403fbfb0ad56e62d8ebbecc3b846487020e0f (diff)
downloadop-kernel-dev-dd5980d68af4457e600ef6add5b541ce952147e6.zip
op-kernel-dev-dd5980d68af4457e600ef6add5b541ce952147e6.tar.gz
[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/arm/mach-pxa/spitz.c')
-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 b569f3b..fef5018 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -19,6 +19,7 @@
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
+#include <linux/gpio.h>
#include <linux/mmc/host.h>
#include <linux/pm.h>
#include <linux/backlight.h>
@@ -371,17 +372,36 @@ static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, vo
pxa_gpio_mode(GPIO109_MMCDAT1_MD);
pxa_gpio_mode(GPIO110_MMCDAT2_MD);
pxa_gpio_mode(GPIO111_MMCDAT3_MD);
- pxa_gpio_mode(SPITZ_GPIO_nSD_DETECT | GPIO_IN);
- pxa_gpio_mode(SPITZ_GPIO_nSD_WP | GPIO_IN);
+
+ err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT");
+ if (err)
+ goto err_out;
+
+ err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP");
+ if (err)
+ goto err_free_1;
+
+ gpio_direction_input(SPITZ_GPIO_nSD_DETECT);
+ gpio_direction_input(SPITZ_GPIO_nSD_WP);
spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
- IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ IRQF_DISABLED | IRQF_TRIGGER_RISING |
+ IRQF_TRIGGER_FALLING,
"MMC card detect", data);
- if (err)
- printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
+ if (err) {
+ pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
+ __func__);
+ goto err_free_2;
+ }
+ return 0;
+err_free_2:
+ gpio_free(SPITZ_GPIO_nSD_WP);
+err_free_1:
+ gpio_free(SPITZ_GPIO_nSD_DETECT);
+err_out:
return err;
}
@@ -397,12 +417,14 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
static int spitz_mci_get_ro(struct device *dev)
{
- return GPLR(SPITZ_GPIO_nSD_WP) & GPIO_bit(SPITZ_GPIO_nSD_WP);
+ return gpio_get_value(SPITZ_GPIO_nSD_WP);
}
static void spitz_mci_exit(struct device *dev, void *data)
{
free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
+ gpio_free(SPITZ_GPIO_nSD_WP);
+ gpio_free(SPITZ_GPIO_nSD_DETECT);
}
static struct pxamci_platform_data spitz_mci_platform_data = {
@@ -419,6 +441,12 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
*/
static int spitz_ohci_init(struct device *dev)
{
+ int err;
+
+ err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST");
+ if (err)
+ return err;
+
/* Only Port 2 is connected */
pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
@@ -427,7 +455,7 @@ static int spitz_ohci_init(struct device *dev)
/* Setup USB Port 2 Output Control Register */
UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
- GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST);
+ gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
UHCHR = (UHCHR) &
~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
OpenPOWER on IntegriCloud