Skip to content

Commit

Permalink
USB: gadget: s3c2410_udc uses standard GPIO calls
Browse files Browse the repository at this point in the history
Change the gpio code in the s3c2410_udc to use the
generic gpio calls instead of the s3c24xx specific
gpio functions.

Signed-off-by: Ben Dooks <[email protected]>
Signed-off-by: David Brownell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Ben Dooks authored and gregkh committed Jan 7, 2009
1 parent b40fc2a commit ea99ecf
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions drivers/usb/gadget/s3c2410_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/gpio.h>

#include <linux/debugfs.h>
#include <linux/seq_file.h>
Expand All @@ -51,7 +52,6 @@
#include <mach/irqs.h>

#include <mach/hardware.h>
#include <mach/regs-gpio.h>

#include <plat/regs-udc.h>
#include <plat/udc.h>
Expand Down Expand Up @@ -1510,11 +1510,7 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev)

dprintk(DEBUG_NORMAL, "%s()\n", __func__);

/* some cpus cannot read from an line configured to IRQ! */
s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT);
value = s3c2410_gpio_getpin(udc_info->vbus_pin);
s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2);

value = gpio_get_value(udc_info->vbus_pin) ? 1 : 0;
if (udc_info->vbus_pin_inverted)
value = !value;

Expand Down Expand Up @@ -1802,7 +1798,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
struct s3c2410_udc *udc = &memory;
struct device *dev = &pdev->dev;
int retval;
unsigned int irq;
int irq;

dev_dbg(dev, "%s()\n", __func__);

Expand Down Expand Up @@ -1861,7 +1857,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)

/* irq setup after old hardware state is cleaned up */
retval = request_irq(IRQ_USBD, s3c2410_udc_irq,
IRQF_DISABLED, gadget_name, udc);
IRQF_DISABLED, gadget_name, udc);

if (retval != 0) {
dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval);
Expand All @@ -1872,17 +1868,28 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
dev_dbg(dev, "got irq %i\n", IRQ_USBD);

if (udc_info && udc_info->vbus_pin > 0) {
irq = s3c2410_gpio_getirq(udc_info->vbus_pin);
retval = gpio_request(udc_info->vbus_pin, "udc vbus");
if (retval < 0) {
dev_err(dev, "cannot claim vbus pin\n");
goto err_int;
}

irq = gpio_to_irq(udc_info->vbus_pin);
if (irq < 0) {
dev_err(dev, "no irq for gpio vbus pin\n");
goto err_gpio_claim;
}

retval = request_irq(irq, s3c2410_udc_vbus_irq,
IRQF_DISABLED | IRQF_TRIGGER_RISING
| IRQF_TRIGGER_FALLING | IRQF_SHARED,
gadget_name, udc);

if (retval != 0) {
dev_err(dev, "can't get vbus irq %i, err %d\n",
dev_err(dev, "can't get vbus irq %d, err %d\n",
irq, retval);
retval = -EBUSY;
goto err_int;
goto err_gpio_claim;
}

dev_dbg(dev, "got irq %i\n", irq);
Expand All @@ -1902,6 +1909,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev)

return 0;

err_gpio_claim:
if (udc_info && udc_info->vbus_pin > 0)
gpio_free(udc_info->vbus_pin);
err_int:
free_irq(IRQ_USBD, udc);
err_map:
Expand All @@ -1927,7 +1937,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
debugfs_remove(udc->regs_info);

if (udc_info && udc_info->vbus_pin > 0) {
irq = s3c2410_gpio_getirq(udc_info->vbus_pin);
irq = gpio_to_irq(udc_info->vbus_pin);
free_irq(irq, udc);
}

Expand Down

0 comments on commit ea99ecf

Please sign in to comment.