Skip to content

Commit 1e15746

Browse files
committed
usb: gadget: udc: atmel: update endpoint allocation for sam9x60
The DPRAM memory from the USB High Speed Device Port (UDPHS) hardware block was increased. This patch updates the endpoint allocation for sam9x60 to take advantage of this larger memory. At the same time the constraint to allocate the endpoints in order was lifted. To handle old and new hardware in the same driver the capabilities (caps) structure was extended. Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
1 parent d64107f commit 1e15746

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

drivers/usb/gadget/udc/atmel_usba_udc.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,12 +1065,14 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
10651065

10661066
case USB_ENDPOINT_XFER_ISOC:
10671067
ep->fifo_size = 1024;
1068-
ep->nr_banks = 2;
1068+
if (ep->udc->caps->ep_prealloc)
1069+
ep->nr_banks = 2;
10691070
break;
10701071

10711072
case USB_ENDPOINT_XFER_BULK:
10721073
ep->fifo_size = 512;
1073-
ep->nr_banks = 1;
1074+
if (ep->udc->caps->ep_prealloc)
1075+
ep->nr_banks = 1;
10741076
break;
10751077

10761078
case USB_ENDPOINT_XFER_INT:
@@ -1080,7 +1082,8 @@ static struct usb_ep *atmel_usba_match_ep(struct usb_gadget *gadget,
10801082
else
10811083
ep->fifo_size =
10821084
roundup_pow_of_two(le16_to_cpu(desc->wMaxPacketSize));
1083-
ep->nr_banks = 1;
1085+
if (ep->udc->caps->ep_prealloc)
1086+
ep->nr_banks = 1;
10841087
break;
10851088
}
10861089

@@ -2033,16 +2036,27 @@ static void at91sam9g45_pulse_bias(struct usba_udc *udc)
20332036

20342037
static const struct usba_udc_caps at91sam9rl_caps = {
20352038
.toggle_bias = at91sam9rl_toggle_bias,
2039+
.ep_prealloc = true,
20362040
};
20372041

20382042
static const struct usba_udc_caps at91sam9g45_caps = {
20392043
.pulse_bias = at91sam9g45_pulse_bias,
2044+
.ep_prealloc = true,
2045+
};
2046+
2047+
static const struct usba_udc_caps sama5d3_caps = {
2048+
.ep_prealloc = true,
2049+
};
2050+
2051+
static const struct usba_udc_caps at91sam9x60_caps = {
2052+
.ep_prealloc = false,
20402053
};
20412054

20422055
static const struct of_device_id atmel_udc_dt_ids[] = {
20432056
{ .compatible = "atmel,at91sam9rl-udc", .data = &at91sam9rl_caps },
20442057
{ .compatible = "atmel,at91sam9g45-udc", .data = &at91sam9g45_caps },
2045-
{ .compatible = "atmel,sama5d3-udc" },
2058+
{ .compatible = "atmel,sama5d3-udc", .data = &sama5d3_caps },
2059+
{ .compatible = "microchip,sam9x60-udc", .data = &at91sam9x60_caps },
20462060
{ /* sentinel */ }
20472061
};
20482062

drivers/usb/gadget/udc/atmel_usba_udc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ struct usba_request {
305305
struct usba_udc_caps {
306306
void (*toggle_bias)(struct usba_udc *udc, int is_on);
307307
void (*pulse_bias)(struct usba_udc *udc);
308+
bool ep_prealloc;
308309
};
309310

310311
struct usba_udc {

0 commit comments

Comments
 (0)