Skip to content

Commit a5ab04a

Browse files
ambarusbebarino
authored andcommitted
clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT
MCK1 feeds the External Bus Interface (EBI). EBI's clock rate is used to translate EBI's timmings to SMC timings, thus we need to handle MCK1 in the EBI driver. Allow MCK1 to be referenced as a PMC_TYPE_CORE clock from phandle in DT. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20220111125310.902856-1-tudor.ambarus@microchip.com Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent ea2be22 commit a5ab04a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

drivers/clk/at91/sama7g5.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ static const struct {
302302
* @ep_count: extra parents count
303303
* @ep_mux_table: mux table for extra parents
304304
* @id: clock id
305+
* @eid: export index in sama7g5->chws[] array
305306
* @c: true if clock is critical and cannot be disabled
306307
*/
307308
static const struct {
@@ -311,6 +312,7 @@ static const struct {
311312
u8 ep_count;
312313
u8 ep_mux_table[4];
313314
u8 id;
315+
u8 eid;
314316
u8 c;
315317
} sama7g5_mckx[] = {
316318
{ .n = "mck1",
@@ -319,6 +321,7 @@ static const struct {
319321
.ep_mux_table = { 5, },
320322
.ep_count = 1,
321323
.ep_chg_id = INT_MIN,
324+
.eid = PMC_MCK1,
322325
.c = 1, },
323326

324327
{ .n = "mck2",
@@ -913,7 +916,7 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
913916
if (IS_ERR(regmap))
914917
return;
915918

916-
sama7g5_pmc = pmc_data_allocate(PMC_CPU + 1,
919+
sama7g5_pmc = pmc_data_allocate(PMC_MCK1 + 1,
917920
nck(sama7g5_systemck),
918921
nck(sama7g5_periphck),
919922
nck(sama7g5_gck), 8);
@@ -1027,6 +1030,9 @@ static void __init sama7g5_pmc_setup(struct device_node *np)
10271030
goto err_free;
10281031

10291032
alloc_mem[alloc_mem_size++] = mux_table;
1033+
1034+
if (sama7g5_mckx[i].eid)
1035+
sama7g5_pmc->chws[sama7g5_mckx[i].eid] = hw;
10301036
}
10311037

10321038
hw = at91_clk_sama7g5_register_utmi(regmap, "utmick", "main_xtal");

include/dt-bindings/clock/at91.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#define PMC_AUDIOIOPLL (PMC_MAIN + 7)
3737
#define PMC_ETHPLL (PMC_MAIN + 8)
3838
#define PMC_CPU (PMC_MAIN + 9)
39+
#define PMC_MCK1 (PMC_MAIN + 10)
3940

4041
#ifndef AT91_PMC_MOSCS
4142
#define AT91_PMC_MOSCS 0 /* MOSCS Flag */

0 commit comments

Comments
 (0)