-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
drivers: rtc: sam0: Add RTC calendar driver and clock fixes #81819
base: main
Are you sure you want to change the base?
Conversation
Some platforms require special clock selection options. This could be made using the already defined assigned-clocks. This introduces the assigned-clocks and assigned-clock-names properties to generalize those conditions. Signed-off-by: Gerson Fernando Budke <[email protected]>
Add properties to differentiate the timer counter operating modes. This properties are necessary to spetialize the driver to be used as a normal 16/32-bit counter or to provide the clock/calendar functions. Signed-off-by: Gerson Fernando Budke <[email protected]>
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and MCLK. The old devices had defined the peripheral clock enable bit at PM. On the newer devices this was extracted on a dedicated memory section called Master Clock (MCLK). This change excludes the dedicated bindings in favor of a generic approach that cover all cases. Now the clocks properties is complemented by the assigned-clocks property. It gives the liberty to user to customize the clock source from a generic clock or configure the direct connections. All peripherals drivers were reworked with the newer solution. Signed-off-by: Gerson Fernando Budke <[email protected]>
Configure the Generic Clock Generator to be used as source to RTC. The index 4 is now reserved to RTC. Signed-off-by: Gerson Fernando Budke <[email protected]>
Add Atmel sam0 rtc calendar driver. Signed-off-by: Gerson Fernando Budke <[email protected]>
Add configurations to allow use of RTC driver and tests. Signed-off-by: Gerson Fernando Budke <[email protected]>
8b3d721
to
8ce6005
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the size of this PR, it might make sense to split into one PR reworking the clocking, and follow-up with a PR for adding the RTC.
By the way, did you see #72102 ?
Hi @henrikbrixandersen ,
Yes, I already considered this and will do it.
I know Daniel is working on the management but I'm not following at moment. The main issue with sam0 it that developer should define clock generators and then connect the peripherals to some of that lines. The assigned-clock property makes live easy to the developer assign the lines in the board file. What I made was basic clock configuration which can be improved later. Current these devices don't have clock drivers, only some helpers to enable/disable clock sources. In this case, I consider the step a preparation to clock driver/management and can be reworked. At least, this gives freedom to developers to define their own clock lines and associate until a better solution will be in place. |
This introduces the RTC clock calendar mode on a new RTC driver. At moment the MODE2 is fully implemented and tested with SAMD20, SAMR21 and SAME54 variants to cover all possible situations.
This driver imposes challenges in clock selection. The SAM family requires, in some situations, generic clock matrix configuration to use peripherals and or different oscillators. These generic clocks should be defined by product depending of developer application and it applies to the 1 KHz clock source. Currently in the SoC common initialization are reserved a few generic channels for specific use. The remaining channels after this change can be defined by developer. In the future when a proper clock driver/manager is in place this could be 100% defined at devicetree. To allow such configuration this introduces the Linux assigned-clock property.