diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2013-05-20 10:36:23 -0400 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2013-05-23 19:13:24 -0400 |
commit | 68522de70e4b08445c10cded43c08b016ebda538 (patch) | |
tree | d0a9f85fe4b26de64a021ef89b4c904e37adc097 /drivers/usb/gadget/atmel_usba_udc.c | |
parent | b3f442b0eedbc20b5ce3f4a96530588d14901199 (diff) |
USB: gadget: atmel_usba: move global struct usba_ep usba_ep to struct usba_udc
so we can have multiple usb gadget instance
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Bo Shen <voice.shen@atmel.com>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r-- | drivers/usb/gadget/atmel_usba_udc.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index f2a970f75bfa..d2ffd0438a6b 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | static struct usba_udc the_udc; | 31 | static struct usba_udc the_udc; |
32 | static struct usba_ep *usba_ep; | ||
33 | 32 | ||
34 | #ifdef CONFIG_USB_GADGET_DEBUG_FS | 33 | #ifdef CONFIG_USB_GADGET_DEBUG_FS |
35 | #include <linux/debugfs.h> | 34 | #include <linux/debugfs.h> |
@@ -1147,7 +1146,7 @@ static int do_test_mode(struct usba_udc *udc) | |||
1147 | * Test_SE0_NAK: Force high-speed mode and set up ep0 | 1146 | * Test_SE0_NAK: Force high-speed mode and set up ep0 |
1148 | * for Bulk IN transfers | 1147 | * for Bulk IN transfers |
1149 | */ | 1148 | */ |
1150 | ep = &usba_ep[0]; | 1149 | ep = &udc->usba_ep[0]; |
1151 | usba_writel(udc, TST, | 1150 | usba_writel(udc, TST, |
1152 | USBA_BF(SPEED_CFG, USBA_SPEED_CFG_FORCE_HIGH)); | 1151 | USBA_BF(SPEED_CFG, USBA_SPEED_CFG_FORCE_HIGH)); |
1153 | usba_ep_writel(ep, CFG, | 1152 | usba_ep_writel(ep, CFG, |
@@ -1165,7 +1164,7 @@ static int do_test_mode(struct usba_udc *udc) | |||
1165 | break; | 1164 | break; |
1166 | case 0x0400: | 1165 | case 0x0400: |
1167 | /* Test_Packet */ | 1166 | /* Test_Packet */ |
1168 | ep = &usba_ep[0]; | 1167 | ep = &udc->usba_ep[0]; |
1169 | usba_ep_writel(ep, CFG, | 1168 | usba_ep_writel(ep, CFG, |
1170 | USBA_BF(EPT_SIZE, USBA_EPT_SIZE_64) | 1169 | USBA_BF(EPT_SIZE, USBA_EPT_SIZE_64) |
1171 | | USBA_EPT_DIR_IN | 1170 | | USBA_EPT_DIR_IN |
@@ -1668,7 +1667,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1668 | 1667 | ||
1669 | for (i = 1; i < USBA_NR_ENDPOINTS; i++) | 1668 | for (i = 1; i < USBA_NR_ENDPOINTS; i++) |
1670 | if (dma_status & (1 << i)) | 1669 | if (dma_status & (1 << i)) |
1671 | usba_dma_irq(udc, &usba_ep[i]); | 1670 | usba_dma_irq(udc, &udc->usba_ep[i]); |
1672 | } | 1671 | } |
1673 | 1672 | ||
1674 | ep_status = USBA_BFEXT(EPT_INT, status); | 1673 | ep_status = USBA_BFEXT(EPT_INT, status); |
@@ -1677,10 +1676,10 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1677 | 1676 | ||
1678 | for (i = 0; i < USBA_NR_ENDPOINTS; i++) | 1677 | for (i = 0; i < USBA_NR_ENDPOINTS; i++) |
1679 | if (ep_status & (1 << i)) { | 1678 | if (ep_status & (1 << i)) { |
1680 | if (ep_is_control(&usba_ep[i])) | 1679 | if (ep_is_control(&udc->usba_ep[i])) |
1681 | usba_control_irq(udc, &usba_ep[i]); | 1680 | usba_control_irq(udc, &udc->usba_ep[i]); |
1682 | else | 1681 | else |
1683 | usba_ep_irq(udc, &usba_ep[i]); | 1682 | usba_ep_irq(udc, &udc->usba_ep[i]); |
1684 | } | 1683 | } |
1685 | } | 1684 | } |
1686 | 1685 | ||
@@ -1705,7 +1704,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) | |||
1705 | DBG(DBG_BUS, "%s bus reset detected\n", | 1704 | DBG(DBG_BUS, "%s bus reset detected\n", |
1706 | usb_speed_string(udc->gadget.speed)); | 1705 | usb_speed_string(udc->gadget.speed)); |
1707 | 1706 | ||
1708 | ep0 = &usba_ep[0]; | 1707 | ep0 = &udc->usba_ep[0]; |
1709 | ep0->ep.desc = &usba_ep0_desc; | 1708 | ep0->ep.desc = &usba_ep0_desc; |
1710 | ep0->state = WAIT_FOR_SETUP; | 1709 | ep0->state = WAIT_FOR_SETUP; |
1711 | usba_ep_writel(ep0, CFG, | 1710 | usba_ep_writel(ep0, CFG, |
@@ -1841,6 +1840,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1841 | struct resource *regs, *fifo; | 1840 | struct resource *regs, *fifo; |
1842 | struct clk *pclk, *hclk; | 1841 | struct clk *pclk, *hclk; |
1843 | struct usba_udc *udc = &the_udc; | 1842 | struct usba_udc *udc = &the_udc; |
1843 | static struct usba_ep *usba_ep; | ||
1844 | int irq, ret, i; | 1844 | int irq, ret, i; |
1845 | 1845 | ||
1846 | regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); | 1846 | regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID); |
@@ -1896,6 +1896,8 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1896 | if (!usba_ep) | 1896 | if (!usba_ep) |
1897 | goto err_alloc_ep; | 1897 | goto err_alloc_ep; |
1898 | 1898 | ||
1899 | udc->usba_ep = usba_ep; | ||
1900 | |||
1899 | the_udc.gadget.ep0 = &usba_ep[0].ep; | 1901 | the_udc.gadget.ep0 = &usba_ep[0].ep; |
1900 | 1902 | ||
1901 | INIT_LIST_HEAD(&usba_ep[0].ep.ep_list); | 1903 | INIT_LIST_HEAD(&usba_ep[0].ep.ep_list); |
@@ -2008,7 +2010,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev) | |||
2008 | usb_del_gadget_udc(&udc->gadget); | 2010 | usb_del_gadget_udc(&udc->gadget); |
2009 | 2011 | ||
2010 | for (i = 1; i < pdata->num_ep; i++) | 2012 | for (i = 1; i < pdata->num_ep; i++) |
2011 | usba_ep_cleanup_debugfs(&usba_ep[i]); | 2013 | usba_ep_cleanup_debugfs(&udc->usba_ep[i]); |
2012 | usba_cleanup_debugfs(udc); | 2014 | usba_cleanup_debugfs(udc); |
2013 | 2015 | ||
2014 | if (gpio_is_valid(udc->vbus_pin)) { | 2016 | if (gpio_is_valid(udc->vbus_pin)) { |