[ARM] S3C24XX: GPIO: Change usb-simtec.c to use gpiolib.
authorBen Dooks <ben-linux@fluff.org>
Mon, 18 May 2009 19:15:01 +0000 (20:15 +0100)
committerBen Dooks <ben-linux@fluff.org>
Mon, 18 May 2009 19:20:27 +0000 (20:20 +0100)
Make arch/arm/mach-s3c2410/usb-simtec.c use gpiolib to
manage gpio access.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
arch/arm/mach-s3c2410/mach-bast.c
arch/arm/mach-s3c2410/usb-simtec.c

index 496463768de7222267edf631bf0b04c9e49b04c0..31af898534cd59497143f6e0486bd8f9956c611b 100644 (file)
@@ -594,8 +594,6 @@ static void __init bast_map_io(void)
        s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
-
-       usb_simtec_init();
 }
 
 static void __init bast_init(void)
@@ -609,6 +607,7 @@ static void __init bast_init(void)
        i2c_register_board_info(0, bast_i2c_devs,
                                ARRAY_SIZE(bast_i2c_devs));
 
+       usb_simtec_init();
        nor_simtec_init();
 }
 
index dd45eb4a6f0cad074604d61b959057737ee75b8b..6cd9377ddb826d3e4758ca8ce8c0cd7892f7974c 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/timer.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/gpio.h>
 #include <linux/io.h>
 
 #include <asm/mach/arch.h>
@@ -30,7 +31,6 @@
 
 #include <mach/bast-map.h>
 #include <mach/bast-irq.h>
-#include <mach/regs-gpio.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -54,9 +54,9 @@ usb_simtec_powercontrol(int port, int to)
        power_state[port] = to;
 
        if (power_state[0] && power_state[1])
-               s3c2410_gpio_setpin(S3C2410_GPB(4), 0);
+               gpio_set_value(S3C2410_GPB(4), 0);
        else
-               s3c2410_gpio_setpin(S3C2410_GPB(4), 1);
+               gpio_set_value(S3C2410_GPB(4), 1);
 }
 
 static irqreturn_t
@@ -64,7 +64,7 @@ usb_simtec_ocirq(int irq, void *pw)
 {
        struct s3c2410_hcd_info *info = pw;
 
-       if (s3c2410_gpio_getpin(S3C2410_GPG(10)) == 0) {
+       if (gpio_get_value(S3C2410_GPG(10)) == 0) {
                pr_debug("usb_simtec: over-current irq (oc detected)\n");
                s3c2410_usb_report_oc(info, 3);
        } else {
@@ -107,10 +107,27 @@ static struct s3c2410_hcd_info usb_simtec_info = {
 
 int usb_simtec_init(void)
 {
+       int ret;
+
        printk("USB Power Control, (c) 2004 Simtec Electronics\n");
-       s3c_device_usb.dev.platform_data = &usb_simtec_info;
 
-       s3c2410_gpio_cfgpin(S3C2410_GPB(4), S3C2410_GPIO_OUTPUT);
-       s3c2410_gpio_setpin(S3C2410_GPB(4), 1);
+       ret = gpio_request(S3C2410_GPB(4), "USB power control");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPB4\n", __func__);
+               return ret;
+       }
+
+       ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");
+       if (ret < 0) {
+               pr_err("%s: failed to get GPG10\n", __func__);
+               gpio_free(S3C2410_GPB(4));
+               return ret;
+       }
+
+       /* turn power on */
+       gpio_direction_output(S3C2410_GPB(4), 1);
+       gpio_direction_input(S3C2410_GPG(10));
+
+       s3c_device_usb.dev.platform_data = &usb_simtec_info;
        return 0;
 }
This page took 0.028276 seconds and 5 git commands to generate.