Skip to content

USB UAC2 cherry-picks #3032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3bd3fcc
[nrf fromtree] samples: usb: uac2: Leave cache management up to drivers
tmon-nordic May 15, 2025
6c7d6a2
[nrf fromtree] samples: usb: uac2: Make I2S buffers UDC compliant
tmon-nordic May 15, 2025
cff82de
[nrf fromtree] samples: usb: uac2: Implement feedback on nRF54H20
tmon-nordic May 15, 2025
a4d4a8f
[nrf fromtree] drivers: udc_dwc2: Inline vendor quirks if possible
tmon-nordic May 29, 2025
927c406
[nrf fromtree] drivers: udc_dwc2: Disable control IN endpoint on SETUP
tmon-nordic Jun 9, 2025
561bc55
[nrf fromtree] drivers: udc: add SOF Kconfig option and SOF event helper
jfischer-no Apr 22, 2025
1621967
[nrf fromtree] drivers: udc: disable SOF interrupt by default
jfischer-no Apr 2, 2025
7ad8477
[nrf fromtree] usb: device_next: add the missing const qualifier and …
jfischer-no Jun 12, 2025
2f85d72
[nrf fromtree] usb: device_next: hide Kconfig option USBD_MSG_SLAB_CO…
jfischer-no Jun 16, 2025
47e0e53
[nrf fromtree] usb: device_next: allow to limit number or digits in s…
jfischer-no Jun 17, 2025
8fcb714
[nrf fromtree] usb: update USBD_DESC_SERIAL_NUMBER_DEFINE macro descr…
jfischer-no Jun 17, 2025
9705935
[nrf fromtree] usb: device_next: rework CDC ACM serial for flash usage
jfischer-no Jun 12, 2025
42aa69f
[nrf fromtree] drivers: udc_dwc2: Use spin lock for synchronization
tmon-nordic Jun 10, 2025
141b580
[nrf fromtree] drivers: udc_dwc2: Optimize incomplete iso handling
tmon-nordic Jun 10, 2025
79400fb
[nrf fromtree] drivers: udc_dwc2: Disable endpoints asynchronously
tmon-nordic Jan 20, 2025
04f5c8d
[nrf fromtree] usb: device_next: uac2: Do not leak double buffered en…
tmon-nordic Jun 24, 2025
6e2ce98
[nrf fromtree] drivers: udc_dwc2: do not throw error when FIFO settin…
jfischer-no Jul 1, 2025
529316f
[nrf fromtree] include: kernel: add macros to enable allocation from …
vbrzeski Jun 20, 2025
0e816f8
[nrf fromtree] include: usb_ch9: fix USB_FS_ISO_EP_INTERVAL calculation
vbrzeski Jun 25, 2025
74b6be0
[nrf fromtree] usb: device_next: uac2: support higher bInterval values
vbrzeski Jun 25, 2025
7ba4adf
[nrf fromtree] usb: hid: Define sensor page usages IDs
zessadaoui Jun 26, 2025
0db95e7
[nrf fromtree] drivers: clock_control: nrf: add support for HFCLK24M
bjarki-andreasen Jun 23, 2025
a22d3ac
[nrf fromtree] drivers: udc_dwc2: Set EP0 IN CNAK only when necessary
tmon-nordic Jun 26, 2025
edee52c
Revert "[nrf noup] drivers: udc_dwc2: Add nRF54L quirks"
tmon-nordic Jul 8, 2025
3730263
[nrf fromlist] drivers: udc_dwc2: Add nRF54LM20A vendor quirks
tmon-nordic Apr 8, 2025
3843d5f
[nrf fromlist] samples: usb: uac2: Use different PPI channels
57300 Jul 9, 2025
a54569d
[nrf fromlist] drivers: udc_dwc2: Arm control out endpoint in DMA mode
tmon-nordic Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion drivers/clock_control/clock_control_nrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@
nrfx_clock_hfclk_stop();
}

#if NRF_CLOCK_HAS_HFCLK24M
static void hfclk24m_start(void)
{
nrfx_clock_start(NRF_CLOCK_DOMAIN_HFCLK24M);
}

static void hfclk24m_stop(void)
{
nrfx_clock_stop(NRF_CLOCK_DOMAIN_HFCLK24M);
}
#endif

#if NRF_CLOCK_HAS_HFCLK192M
static void hfclk192m_start(void)
{
Expand Down Expand Up @@ -714,7 +726,11 @@
break;
}
#endif

#if NRF_CLOCK_HAS_HFCLK24M
case NRFX_CLOCK_EVT_HFCLK24M_STARTED:
clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK24M);
break;
#endif
#if NRF_CLOCK_HAS_HFCLK192M
case NRFX_CLOCK_EVT_HFCLK192M_STARTED:
clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK192M);
Expand Down Expand Up @@ -843,6 +859,13 @@
.stop = lfclk_stop,
IF_ENABLED(CONFIG_LOG, (.name = "lfclk",))
},
#if NRF_CLOCK_HAS_HFCLK24M
[CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = {
.start = hfclk24m_start,
.stop = hfclk24m_stop,
IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",))
},
#endif
#if NRF_CLOCK_HAS_HFCLK192M
[CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = {
.start = hfclk192m_start,
Expand All @@ -859,7 +882,7 @@
#endif
}
};

Check notice on line 885 in drivers/clock_control/clock_control_nrf.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/clock_control/clock_control_nrf.c:885 - IF_ENABLED(CONFIG_LOG, (.name = "hfclk",)) - }, - [CLOCK_CONTROL_NRF_TYPE_LFCLK] = { - .start = lfclk_start, - .stop = lfclk_stop, - IF_ENABLED(CONFIG_LOG, (.name = "lfclk",)) - }, + IF_ENABLED(CONFIG_LOG, (.name = "hfclk",)) }, + [CLOCK_CONTROL_NRF_TYPE_LFCLK] = { + .start = lfclk_start, + .stop = lfclk_stop, + IF_ENABLED(CONFIG_LOG, (.name = "lfclk",)) }, #if NRF_CLOCK_HAS_HFCLK24M - [CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = { - .start = hfclk24m_start, - .stop = hfclk24m_stop, - IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",)) - }, + [CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = { + .start = hfclk24m_start, + .stop = hfclk24m_stop, + IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",)) }, #endif #if NRF_CLOCK_HAS_HFCLK192M - [CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = { - .start = hfclk192m_start, - .stop = hfclk192m_stop, - IF_ENABLED(CONFIG_LOG, (.name = "hfclk192m",)) - }, + [CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = { + .start = hfclk192m_start, + .stop = hfclk192m_stop, + IF_ENABLED(CONFIG_LOG, (.name = "hfclk192m",)) }, #endif #if NRF_CLOCK_HAS_HFCLKAUDIO - [CLOCK_CONTROL_NRF_TYPE_HFCLKAUDIO] = { - .start = hfclkaudio_start, - .stop = hfclkaudio_stop, - IF_ENABLED(CONFIG_LOG, (.name = "hfclkaudio",)) - }, -#endif - } -}; + [CLOCK_CONTROL_NRF_TYPE_HFCLKAUDIO] = { + .start = hfclkaudio_start, + .stop = hfclkaudio_stop, + IF_ENABLED(CONFIG_LOG, (.name = "hfclkaudio",)) }, +#endif + }};
DEVICE_DT_DEFINE(DT_NODELABEL(clock), clk_init, NULL,
&data, &config,
PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY,
Expand Down
6 changes: 6 additions & 0 deletions drivers/usb/udc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ config UDC_BUF_FORCE_NOCACHE
Place the buffer pools in the nocache memory region if the driver
cannot handle buffers in cached memory.

config UDC_ENABLE_SOF
bool "SOF interrupt processing"
help
Enabled SoF interrupts can cause a very high CPU load on high-speed
controllers because the interrupt rate would be 125 µs.

config UDC_WORKQUEUE
bool "Use a dedicate work queue for UDC drivers"
help
Expand Down
7 changes: 4 additions & 3 deletions drivers/usb/udc/udc_ambiq.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@
case AM_HAL_USB_DEV_EVT_BUS_RESET:
/* enable usb bus interrupts */
am_hal_usb_intr_usb_enable(priv->usb_handle,
USB_CFG2_SOFE_Msk | USB_CFG2_ResumeE_Msk |
USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk);
IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_CFG2_SOFE_Msk |))
USB_CFG2_ResumeE_Msk |
USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk);
/* init the endpoint */

Check notice on line 162 in drivers/usb/udc/udc_ambiq.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/usb/udc/udc_ambiq.c:162 - IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_CFG2_SOFE_Msk |)) - USB_CFG2_ResumeE_Msk | - USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); + IF_ENABLED(CONFIG_UDC_ENABLE_SOF, (USB_CFG2_SOFE_Msk |)) USB_CFG2_ResumeE_Msk | + USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk);
am_hal_usb_ep_init(priv->usb_handle, 0, 0, EP0_MPS);
/* Set USB device speed to HAL */
am_hal_usb_set_dev_speed(priv->usb_handle, priv->usb_speed);
Expand All @@ -174,7 +175,7 @@
udc_submit_event(dev, UDC_EVT_RESUME, 0);
break;
case AM_HAL_USB_DEV_EVT_SOF:
udc_submit_event(dev, UDC_EVT_SOF, 0);
udc_submit_sof_event(dev);
break;
case AM_HAL_USB_DEV_EVT_SUSPEND:
/* Handle USB Suspend event, then set device state to suspended */
Expand Down
23 changes: 23 additions & 0 deletions drivers/usb/udc/udc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,29 @@ int udc_submit_event(const struct device *dev,
int udc_submit_ep_event(const struct device *dev,
struct net_buf *const buf,
const int err);

/**
* @brief Helper function to send UDC SOF event to a higher level.
*
* Type of this event is hardcoded to UDC_EVT_SOF.
*
* @param[in] dev Pointer to device struct of the driver instance
*/
#if defined(CONFIG_UDC_ENABLE_SOF)
static inline void udc_submit_sof_event(const struct device *dev)
{
struct udc_data *data = dev->data;
struct udc_event drv_evt = {
.type = UDC_EVT_SOF,
.dev = dev,
};

(void)data->event_cb(dev, &drv_evt);
}
#else
#define udc_submit_sof_event(dev) ARG_UNUSED(dev)
#endif

/**
* @brief Helper function to enable endpoint.
*
Expand Down
Loading
Loading