Commit 033b8966 authored by Cristian Birsan's avatar Cristian Birsan Committed by Felipe Balbi

usb: gadget: udc: atmel: simplify endpoint allocation

Simplify the endpoint allocation and cleanup the code.
Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 96f31498
...@@ -1091,8 +1091,6 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget, ...@@ -1091,8 +1091,6 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
USBA_BF(EPT_SIZE, fls(ep->fifo_size - 1) - 3); USBA_BF(EPT_SIZE, fls(ep->fifo_size - 1) - 3);
ep->ept_cfg |= USBA_BF(BK_NUMBER, ep->nr_banks); ep->ept_cfg |= USBA_BF(BK_NUMBER, ep->nr_banks);
ep->udc->configured_ep++;
} }
return _ep; return _ep;
...@@ -1786,7 +1784,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ...@@ -1786,7 +1784,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (status & USBA_END_OF_RESET) { if (status & USBA_END_OF_RESET) {
struct usba_ep *ep0, *ep; struct usba_ep *ep0, *ep;
int i, n; int i;
usba_writel(udc, INT_CLR, usba_writel(udc, INT_CLR,
USBA_END_OF_RESET|USBA_END_OF_RESUME USBA_END_OF_RESET|USBA_END_OF_RESUME
...@@ -1834,13 +1832,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ...@@ -1834,13 +1832,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
"ODD: EP0 configuration is invalid!\n"); "ODD: EP0 configuration is invalid!\n");
/* Preallocate other endpoints */ /* Preallocate other endpoints */
n = fifo_mode ? udc->num_ep : udc->configured_ep; for (i = 1; i < udc->num_ep; i++) {
for (i = 1; i < n; i++) {
ep = &udc->usba_ep[i]; ep = &udc->usba_ep[i];
usba_ep_writel(ep, CFG, ep->ept_cfg); if (ep->ep.claimed) {
if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED)) usba_ep_writel(ep, CFG, ep->ept_cfg);
dev_err(&udc->pdev->dev, if (!(usba_ep_readl(ep, CFG) & USBA_EPT_MAPPED))
"ODD: EP%d configuration is invalid!\n", i); dev_err(&udc->pdev->dev,
"ODD: EP%d configuration is invalid!\n", i);
}
} }
} }
...@@ -2025,9 +2024,6 @@ static int atmel_usba_stop(struct usb_gadget *gadget) ...@@ -2025,9 +2024,6 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
if (udc->vbus_pin) if (udc->vbus_pin)
disable_irq(gpiod_to_irq(udc->vbus_pin)); disable_irq(gpiod_to_irq(udc->vbus_pin));
if (fifo_mode == 0)
udc->configured_ep = 1;
udc->suspended = false; udc->suspended = false;
usba_stop(udc); usba_stop(udc);
...@@ -2154,7 +2150,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, ...@@ -2154,7 +2150,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
if (fifo_mode == 0) { if (fifo_mode == 0) {
udc->num_ep = udc_config->num_ep; udc->num_ep = udc_config->num_ep;
udc->configured_ep = 1;
} else { } else {
udc->num_ep = usba_config_fifo_table(udc); udc->num_ep = usba_config_fifo_table(udc);
} }
......
...@@ -336,7 +336,6 @@ struct usba_udc { ...@@ -336,7 +336,6 @@ struct usba_udc {
int irq; int irq;
struct gpio_desc *vbus_pin; struct gpio_desc *vbus_pin;
int num_ep; int num_ep;
int configured_ep;
struct usba_fifo_cfg *fifo_cfg; struct usba_fifo_cfg *fifo_cfg;
struct clk *pclk; struct clk *pclk;
struct clk *hclk; struct clk *hclk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment