Commit 7a05a2cb authored by Ben Dooks's avatar Ben Dooks
Browse files

[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: default avatarBen Dooks <ben-linux@fluff.org>
parent 5233c178
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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();
}

+24 −7
Original line number Diff line number Diff line
@@ -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;
}