Skip to content

Conversation

@mathieuchopstm
Copy link
Contributor

Clean up how clocks are configured/enabled in the driver with multi-instance in mind. Another larger rework will be required for PHYs but this is W.I.P. and will come in a later PR.

While at it, fix a "bug" where driver attempts to obtain rates from non-existent clocks, and get rid of the USB_RAM_SIZE macro that is near refactored code and serves no purpose.

…sumed

Instead of using global macro "USB_RAM_SIZE", replace it by its content
(i.e., DT_INST_PROP()) in the only place where it was used.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
To enable/disable clocks, the UDC driver used function pointers stored in
the instance private data(!), which *could* be NULL... but in practice,
they were always initialized. Furthermore, the clock configuration is
done through Clock Control API calls so the code can be shared by all
instances.

Replace indirect calls through function pointers with direct calls to the
"priv_clock_(dis|en)able" function, which are renamed to "udc_stm32_..."
for consistency with the rest of the driver. The now-unused function
pointers are also removed from the instance data structure.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Instead of using globals, save the clock configuration from DTS in each
instance's configuration block, from which it is consumed by the driver's
clock configuration functions.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants