clocks: atmel: sam0: Fix gclk and mclk clock bindings
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 atmel,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 <nandojve@gmail.com>
This commit is contained in:
parent
ecd0267508
commit
ea7922195b
44 changed files with 882 additions and 574 deletions
|
@ -14,12 +14,28 @@
|
|||
|
||||
/* clang-format off */
|
||||
|
||||
/* Helper macro to get MCLK register address for corresponding
|
||||
* that has corresponding clock enable bit.
|
||||
#define ATMEL_SAM0_DT_INST_CELL_REG_ADDR_OFFSET(n, cell) \
|
||||
(volatile uint32_t *) \
|
||||
(DT_REG_ADDR(DT_INST_PHANDLE_BY_NAME(n, clocks, cell)) + \
|
||||
DT_INST_CLOCKS_CELL_BY_NAME(n, cell, offset))
|
||||
|
||||
#define ATMEL_SAM0_DT_INST_CELL_PERIPH_MASK(n, name, cell) \
|
||||
BIT(DT_INST_CLOCKS_CELL_BY_NAME(n, name, cell))
|
||||
|
||||
/* Helper macro to get register address that control peripheral clock
|
||||
* enable bit.
|
||||
*/
|
||||
#define MCLK_MASK_DT_INT_REG_ADDR(n) \
|
||||
(DT_REG_ADDR(DT_INST_PHANDLE_BY_NAME(n, clocks, mclk)) + \
|
||||
DT_INST_CLOCKS_CELL_BY_NAME(n, mclk, offset))
|
||||
#define ATMEL_SAM0_DT_INST_MCLK_PM_REG_ADDR_OFFSET(n) \
|
||||
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mclk)), \
|
||||
(ATMEL_SAM0_DT_INST_CELL_REG_ADDR_OFFSET(n, mclk)), \
|
||||
(ATMEL_SAM0_DT_INST_CELL_REG_ADDR_OFFSET(n, pm)))
|
||||
|
||||
/* Helper macro to get peripheral clock bit mask.
|
||||
*/
|
||||
#define ATMEL_SAM0_DT_INST_MCLK_PM_PERIPH_MASK(n, cell) \
|
||||
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mclk)), \
|
||||
(ATMEL_SAM0_DT_INST_CELL_PERIPH_MASK(n, mclk, cell)), \
|
||||
(ATMEL_SAM0_DT_INST_CELL_PERIPH_MASK(n, pm, cell)))
|
||||
|
||||
/* Helper macros for use with ATMEL SAM0 DMAC controller
|
||||
* return 0xff as default value if there is no 'dmas' property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue