drivers: usb_dc_sam_usbhs: default to full-speed
Use DT_INST_ENUM_IDX_OR and always default to full-speed if CONFIG_USB_DC_HAS_HS_SUPPORT is not set or maximum-speed property is not defined. Remove low-speed setting since device stack does not support it. Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
parent
cf8d7764da
commit
48362df588
1 changed files with 5 additions and 14 deletions
|
@ -46,11 +46,8 @@ LOG_MODULE_REGISTER(usb_dc_sam_usbhs);
|
|||
#endif
|
||||
|
||||
#define NUM_OF_EP_MAX DT_INST_PROP(0, num_bidir_endpoints)
|
||||
#if DT_INST_NODE_HAS_PROP(0, maximum_speed)
|
||||
#define USB_MAXIMUM_SPEED DT_INST_ENUM_IDX(0, maximum_speed)
|
||||
#else
|
||||
#define USB_MAXIMUM_SPEED 2 /* Default to high-speed */
|
||||
#endif
|
||||
#define USB_MAXIMUM_SPEED DT_INST_ENUM_IDX_OR(0, maximum_speed, 1)
|
||||
BUILD_ASSERT(USB_MAXIMUM_SPEED, "low-speed is not supported");
|
||||
|
||||
struct usb_device_ep_data {
|
||||
uint16_t mps;
|
||||
|
@ -312,18 +309,12 @@ int usb_dc_attach(void)
|
|||
|
||||
/* Select the speed */
|
||||
regval = USBHS_DEVCTRL_DETACH;
|
||||
#if USB_MAXIMUM_SPEED == 0
|
||||
/* low-speed */
|
||||
regval |= USBHS_DEVCTRL_LS;
|
||||
regval |= USBHS_DEVCTRL_SPDCONF_LOW_POWER;
|
||||
#elif USB_MAXIMUM_SPEED == 1
|
||||
/* full-speed */
|
||||
regval |= USBHS_DEVCTRL_SPDCONF_LOW_POWER;
|
||||
#elif USB_MAXIMUM_SPEED == 2
|
||||
#if (USB_MAXIMUM_SPEED == 2) && IS_ENABLED(CONFIG_USB_DC_HAS_HS_SUPPORT)
|
||||
/* high-speed */
|
||||
regval |= USBHS_DEVCTRL_SPDCONF_NORMAL;
|
||||
#else
|
||||
#error "Unsupported maximum speed defined in device tree."
|
||||
/* full-speed */
|
||||
regval |= USBHS_DEVCTRL_SPDCONF_LOW_POWER;
|
||||
#endif
|
||||
USBHS->USBHS_DEVCTRL = regval;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue