diff options
author | Ben Dooks <ben-linux@fluff.org> | 2009-05-18 15:15:01 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-05-18 15:20:27 -0400 |
commit | 7a05a2cbd317cbd16e6d1689bb1e5e208eaaba6f (patch) | |
tree | a0de074b2864ec4d7c7fcb16fa532d730276b27d | |
parent | 5233c178d4cedad0acd0eb0f24b2e09f7fafaa1c (diff) |
[ARM] S3C24XX: GPIO: Change usb-simtec.c to use gpiolib.
Make arch/arm/mach-s3c2410/usb-simtec.c use gpiolib to
manage gpio access.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r-- | arch/arm/mach-s3c2410/mach-bast.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/usb-simtec.c | 31 |
2 files changed, 25 insertions, 9 deletions
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 496463768de7..31af898534cd 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -594,8 +594,6 @@ static void __init bast_map_io(void) | |||
594 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); | 594 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); |
595 | s3c24xx_init_clocks(0); | 595 | s3c24xx_init_clocks(0); |
596 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); | 596 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); |
597 | |||
598 | usb_simtec_init(); | ||
599 | } | 597 | } |
600 | 598 | ||
601 | static void __init bast_init(void) | 599 | static void __init bast_init(void) |
@@ -609,6 +607,7 @@ static void __init bast_init(void) | |||
609 | i2c_register_board_info(0, bast_i2c_devs, | 607 | i2c_register_board_info(0, bast_i2c_devs, |
610 | ARRAY_SIZE(bast_i2c_devs)); | 608 | ARRAY_SIZE(bast_i2c_devs)); |
611 | 609 | ||
610 | usb_simtec_init(); | ||
612 | nor_simtec_init(); | 611 | nor_simtec_init(); |
613 | } | 612 | } |
614 | 613 | ||
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c index dd45eb4a6f0c..6cd9377ddb82 100644 --- a/arch/arm/mach-s3c2410/usb-simtec.c +++ b/arch/arm/mach-s3c2410/usb-simtec.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/gpio.h> | ||
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
26 | 27 | ||
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
@@ -30,7 +31,6 @@ | |||
30 | 31 | ||
31 | #include <mach/bast-map.h> | 32 | #include <mach/bast-map.h> |
32 | #include <mach/bast-irq.h> | 33 | #include <mach/bast-irq.h> |
33 | #include <mach/regs-gpio.h> | ||
34 | 34 | ||
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
@@ -54,9 +54,9 @@ usb_simtec_powercontrol(int port, int to) | |||
54 | power_state[port] = to; | 54 | power_state[port] = to; |
55 | 55 | ||
56 | if (power_state[0] && power_state[1]) | 56 | if (power_state[0] && power_state[1]) |
57 | s3c2410_gpio_setpin(S3C2410_GPB(4), 0); | 57 | gpio_set_value(S3C2410_GPB(4), 0); |
58 | else | 58 | else |
59 | s3c2410_gpio_setpin(S3C2410_GPB(4), 1); | 59 | gpio_set_value(S3C2410_GPB(4), 1); |
60 | } | 60 | } |
61 | 61 | ||
62 | static irqreturn_t | 62 | static irqreturn_t |
@@ -64,7 +64,7 @@ usb_simtec_ocirq(int irq, void *pw) | |||
64 | { | 64 | { |
65 | struct s3c2410_hcd_info *info = pw; | 65 | struct s3c2410_hcd_info *info = pw; |
66 | 66 | ||
67 | if (s3c2410_gpio_getpin(S3C2410_GPG(10)) == 0) { | 67 | if (gpio_get_value(S3C2410_GPG(10)) == 0) { |
68 | pr_debug("usb_simtec: over-current irq (oc detected)\n"); | 68 | pr_debug("usb_simtec: over-current irq (oc detected)\n"); |
69 | s3c2410_usb_report_oc(info, 3); | 69 | s3c2410_usb_report_oc(info, 3); |
70 | } else { | 70 | } else { |
@@ -107,10 +107,27 @@ static struct s3c2410_hcd_info usb_simtec_info = { | |||
107 | 107 | ||
108 | int usb_simtec_init(void) | 108 | int usb_simtec_init(void) |
109 | { | 109 | { |
110 | int ret; | ||
111 | |||
110 | printk("USB Power Control, (c) 2004 Simtec Electronics\n"); | 112 | printk("USB Power Control, (c) 2004 Simtec Electronics\n"); |
111 | s3c_device_usb.dev.platform_data = &usb_simtec_info; | ||
112 | 113 | ||
113 | s3c2410_gpio_cfgpin(S3C2410_GPB(4), S3C2410_GPIO_OUTPUT); | 114 | ret = gpio_request(S3C2410_GPB(4), "USB power control"); |
114 | s3c2410_gpio_setpin(S3C2410_GPB(4), 1); | 115 | if (ret < 0) { |
116 | pr_err("%s: failed to get GPB4\n", __func__); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | ret = gpio_request(S3C2410_GPG(10), "USB overcurrent"); | ||
121 | if (ret < 0) { | ||
122 | pr_err("%s: failed to get GPG10\n", __func__); | ||
123 | gpio_free(S3C2410_GPB(4)); | ||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | /* turn power on */ | ||
128 | gpio_direction_output(S3C2410_GPB(4), 1); | ||
129 | gpio_direction_input(S3C2410_GPG(10)); | ||
130 | |||
131 | s3c_device_usb.dev.platform_data = &usb_simtec_info; | ||
115 | return 0; | 132 | return 0; |
116 | } | 133 | } |