Open sageve opened 1 month ago
Thanks for raising this. This is indeed something we'll need to address, however I'll split this in 2 distinct tasks:
However, I'm less in favor to do device specific dt property to address this (as proposed above).
I haven't known that you're working on a solution to address prescalers. I would prefer if we omit an extra dt property as well.
First of all, thank you for implementing HS USB support in the u5 series.
Is your enhancement proposal related to a problem? Please describe.
The HS USB PHY of the stm32u59x/stm32u5ax controller can be clocked from HSE, HSE/2, PLL1_P or PLL1_P/2. Also different input clock rates are supported. Currently, the driver leaves the default clock source at HSE and the frequency is hard coded to16 MHz.
Describe the solution you'd like
I think a good solution would be adding a clock handle in the device tree:
Since the input frequency can be set to PLL1_P/2, the driver cannot calculate the frequency from the device tree. I suggest that an additional property informs about the actual input frequency:
phy-clock-frequency = <DT_FREQ_M(24)>
Describe alternatives you've considered
Currently, I configured PLL1_P to 16 MHz and changed the default clock source to PLL1_P in a early SYS_INIT hook. But that's not a clean solution.