Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: gadget: s3c2410_udc uses standard GPIO calls

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 <ben-linux@fluff.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Ben Dooks and committed by
Greg Kroah-Hartman
ea99ecfd b40fc2a2

+22 -12
+22 -12
drivers/usb/gadget/s3c2410_udc.c
··· 36 36 #include <linux/interrupt.h> 37 37 #include <linux/platform_device.h> 38 38 #include <linux/clk.h> 39 + #include <linux/gpio.h> 39 40 40 41 #include <linux/debugfs.h> 41 42 #include <linux/seq_file.h> ··· 52 51 #include <mach/irqs.h> 53 52 54 53 #include <mach/hardware.h> 55 - #include <mach/regs-gpio.h> 56 54 57 55 #include <plat/regs-udc.h> 58 56 #include <plat/udc.h> ··· 1510 1510 1511 1511 dprintk(DEBUG_NORMAL, "%s()\n", __func__); 1512 1512 1513 - /* some cpus cannot read from an line configured to IRQ! */ 1514 - s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT); 1515 - value = s3c2410_gpio_getpin(udc_info->vbus_pin); 1516 - s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2); 1517 - 1513 + value = gpio_get_value(udc_info->vbus_pin) ? 1 : 0; 1518 1514 if (udc_info->vbus_pin_inverted) 1519 1515 value = !value; 1520 1516 ··· 1798 1802 struct s3c2410_udc *udc = &memory; 1799 1803 struct device *dev = &pdev->dev; 1800 1804 int retval; 1801 - unsigned int irq; 1805 + int irq; 1802 1806 1803 1807 dev_dbg(dev, "%s()\n", __func__); 1804 1808 ··· 1857 1861 1858 1862 /* irq setup after old hardware state is cleaned up */ 1859 1863 retval = request_irq(IRQ_USBD, s3c2410_udc_irq, 1860 - IRQF_DISABLED, gadget_name, udc); 1864 + IRQF_DISABLED, gadget_name, udc); 1861 1865 1862 1866 if (retval != 0) { 1863 1867 dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval); ··· 1868 1872 dev_dbg(dev, "got irq %i\n", IRQ_USBD); 1869 1873 1870 1874 if (udc_info && udc_info->vbus_pin > 0) { 1871 - irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1875 + retval = gpio_request(udc_info->vbus_pin, "udc vbus"); 1876 + if (retval < 0) { 1877 + dev_err(dev, "cannot claim vbus pin\n"); 1878 + goto err_int; 1879 + } 1880 + 1881 + irq = gpio_to_irq(udc_info->vbus_pin); 1882 + if (irq < 0) { 1883 + dev_err(dev, "no irq for gpio vbus pin\n"); 1884 + goto err_gpio_claim; 1885 + } 1886 + 1872 1887 retval = request_irq(irq, s3c2410_udc_vbus_irq, 1873 1888 IRQF_DISABLED | IRQF_TRIGGER_RISING 1874 1889 | IRQF_TRIGGER_FALLING | IRQF_SHARED, 1875 1890 gadget_name, udc); 1876 1891 1877 1892 if (retval != 0) { 1878 - dev_err(dev, "can't get vbus irq %i, err %d\n", 1893 + dev_err(dev, "can't get vbus irq %d, err %d\n", 1879 1894 irq, retval); 1880 1895 retval = -EBUSY; 1881 - goto err_int; 1896 + goto err_gpio_claim; 1882 1897 } 1883 1898 1884 1899 dev_dbg(dev, "got irq %i\n", irq); ··· 1909 1902 1910 1903 return 0; 1911 1904 1905 + err_gpio_claim: 1906 + if (udc_info && udc_info->vbus_pin > 0) 1907 + gpio_free(udc_info->vbus_pin); 1912 1908 err_int: 1913 1909 free_irq(IRQ_USBD, udc); 1914 1910 err_map: ··· 1937 1927 debugfs_remove(udc->regs_info); 1938 1928 1939 1929 if (udc_info && udc_info->vbus_pin > 0) { 1940 - irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1930 + irq = gpio_to_irq(udc_info->vbus_pin); 1941 1931 free_irq(irq, udc); 1942 1932 } 1943 1933