Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion drivers/usb/udc/udc_dwc2_vendor_quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ DT_INST_FOREACH_STATUS_OKAY(QUIRK_NRF_USBHS_DEFINE)

#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_usbhs_nrf54l)

#define USBHS_DT_WRAPPER_REG_ADDR(n) UINT_TO_POINTER(DT_INST_REG_ADDR_BY_NAME(n, wrapper))
#define USBHS_DT_WRAPPER_REG_ADDR(n) UINT_TO_POINTER(DT_REG_ADDR(DT_INST_PARENT(n)))

#include <nrf.h>
#include <zephyr/logging/log.h>
Expand Down
12 changes: 12 additions & 0 deletions dts/bindings/usb/nordic,nrf-usbhs-wrapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: |
Nordic wrapper for USB controller and PHY hardware. The wrapper is used to
configure, control, and enable/disable the USB PHY, and to enable/disable USB
controller.

compatible: "nordic,nrf-usbhs-wrapper"

include: [base.yaml]

properties:
reg:
required: true
28 changes: 17 additions & 11 deletions dts/vendor/nordic/nrf54lm20a.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,23 @@
prescaler = <0>;
};

usbhs: usbhs@5a000 {
compatible = "nordic,nrf-usbhs-nrf54l", "snps,dwc2";
reg = <0x5a000 0x1000>, <0x50020000 0x1a000>;
reg-names = "wrapper", "core";
interrupts = <90 NRF_DEFAULT_IRQ_PRIORITY>;
num-in-eps = <16>;
num-out-eps = <16>;
ghwcfg1 = <0x0>;
ghwcfg2 = <0x22affc52>;
ghwcfg4 = <0x3e10aa60>;
status = "disabled";
usbhs_wrapper: usbhs_wrapper@5a000 {
compatible = "nordic,nrf-usbhs-wrapper";
reg = <0x5a000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;

usbhs: usbhs@50020000 {
compatible = "nordic,nrf-usbhs-nrf54l", "snps,dwc2";
reg = <0x50020000 0x1a000>;
interrupts = <90 NRF_DEFAULT_IRQ_PRIORITY>;
num-in-eps = <16>;
num-out-eps = <16>;
ghwcfg1 = <0x0>;
ghwcfg2 = <0x22affc52>;
ghwcfg4 = <0x3e10aa60>;
status = "disabled";
};
};

dppic10: dppic@82000 {
Expand Down
58 changes: 58 additions & 0 deletions include/zephyr/drivers/regulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@ typedef uint8_t regulator_error_flags_t;

/** @} */

/**
* @brief Regulator event types
*/
enum regulator_event_type {
/** @brief Regulator voltage is detected */
REGULATOR_VOLTAGE_DETECTED,
/** @brief Regulator voltage is removed */
REGULATOR_VOLTAGE_REMOVED,
};

/** @brief Regulator event structure */
struct regulator_event {
enum regulator_event_type type;
};

/**
* @typedef regulator_callback_t
* @brief Regulator callback function signature
*
* @param dev Regulator device instance
* @param evt Regulator event
* @param user_data User data
*/
typedef void (*regulator_callback_t)(const struct device *dev,
const struct regulator_event *const evt,
const void *const user_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/** @cond INTERNAL_HIDDEN */

typedef int (*regulator_dvs_state_set_t)(const struct device *dev,
Expand Down Expand Up @@ -102,6 +129,8 @@ typedef int (*regulator_get_active_discharge_t)(const struct device *dev,
bool *active_discharge);
typedef int (*regulator_get_error_flags_t)(
const struct device *dev, regulator_error_flags_t *flags);
typedef int (*regulator_set_callback_t)(const struct device *dev,
regulator_callback_t cb, const void *const user_data);

/** @brief Driver-specific API functions to support regulator control. */
__subsystem struct regulator_driver_api {
Expand All @@ -120,6 +149,7 @@ __subsystem struct regulator_driver_api {
regulator_set_active_discharge_t set_active_discharge;
regulator_get_active_discharge_t get_active_discharge;
regulator_get_error_flags_t get_error_flags;
regulator_set_callback_t set_callback;
};

/**
Expand Down Expand Up @@ -765,6 +795,34 @@ static inline int regulator_get_error_flags(const struct device *dev,
return api->get_error_flags(dev, flags);
}

/**
* @brief Set event handler function.
*
* The regulator may generate an interrupt when, for example, the voltage is
* present. This can be used for USB VBUS voltage regulators to notify that a
* device is connected to a port.
*
* @param dev Regulator device instance
* @param cb Event handler
* @param user_data User data
*
* @retval 0 If successful.
* @retval -ENOSYS If not supported by the device.
*/
static inline int regulator_set_callback(const struct device *dev,
regulator_callback_t cb,
const void *const user_data)
{
const struct regulator_driver_api *api =
(const struct regulator_driver_api *)dev->api;

if (api->set_callback == NULL) {
return -ENOSYS;
}

return api->set_callback(dev, cb, user_data);
}

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 0 additions & 2 deletions soc/nordic/validate_base_addresses.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ CHECK_DT_REG(cpuapp_uicr, NRF_APPLICATION_UICR);
CHECK_DT_REG(bicr, NRF_APPLICATION_BICR);
CHECK_DT_REG(cpurad_uicr, NRF_RADIOCORE_UICR);
CHECK_DT_REG(usbd, NRF_USBD);
CHECK_DT_REG(usbhs, NRF_USBHS);
CHECK_DT_REG(usbhs_core, NRF_USBHSCORE0);
CHECK_DT_REG(usbreg, NRF_USBREGULATOR);
CHECK_DT_REG(vmc, NRF_VMC);
CHECK_DT_REG(cpuflpr_clic, NRF_FLPR_VPRCLIC);
Expand Down