@@ -22,6 +22,39 @@ struct numaker_scc_config {
22
22
uint32_t core_clock ;
23
23
};
24
24
25
+ #if defined(CONFIG_SOC_SERIES_M55M1X )
26
+ static const uint64_t numaker_clkmodidx_tab [] = {
27
+ 0x0000000000000000 , 0x0000000000000400 , 0x0000800000000000 , 0x0001008000800000 ,
28
+ 0x0001008000800480 , 0x0001810203FF8000 , 0x0001810203FF8488 , 0x0002018003800000 ,
29
+ 0x0002800000000000 , 0x0003000000000000 , 0x0003800000000000 , 0x0004028283FF8000 ,
30
+ 0x0004028001800080 , 0x0004830301FF8000 , 0x0005000000000000 , 0x0005800000000000 ,
31
+ 0x0005800000000400 , 0x0005800000000800 , 0x0005800000000C00 , 0x0006000000000000 ,
32
+ 0x0006838000800000 , 0x0006838000800480 , 0x0007000000000000 , 0x0007000000000400 ,
33
+ 0x0007000000000800 , 0x0007000000000C00 , 0x0007840000800000 , 0x0007800000004000 ,
34
+ 0x0008000000000000 , 0x0008800000000000 , 0x0008800000000400 , 0x0008800000000800 ,
35
+ 0x0008800000000C00 , 0x0008800000001000 , 0x0008800000001400 , 0x0008800000001800 ,
36
+ 0x0008800000001C00 , 0x0008800000002000 , 0x0008800000002400 , 0x0009000000000000 ,
37
+ 0x0009800000000000 , 0x000A000000000000 , 0x000A800000000000 , 0x000A800000000400 ,
38
+ 0x000A800000000800 , 0x000A800000000C00 , 0x000B048383FF8000 , 0x000B048383FF8488 ,
39
+ 0x000B850000800000 , 0x000C000000000000 , 0x000C858401FF8000 , 0x000D000000000000 ,
40
+ 0x000D860481FF8000 , 0x000E000000000000 , 0x000E800000000000 , 0x000F000000000000 ,
41
+ 0x000F868001800000 , 0x0010000000000000 , 0x0010870003800000 , 0x0010870003800480 ,
42
+ 0x0011078503878000 , 0x0011800000000000 , 0x0012800000000000 , 0x0013000000000000 ,
43
+ 0x0013800000000000 , 0x0013800000000400 , 0x0014080583FF8000 , 0x0014888003800000 ,
44
+ 0x0014888003800480 , 0x0015000000000000 , 0x0015890603FF8000 , 0x0015890603FF8488 ,
45
+ 0x0015890603FF8910 , 0x0016000000000000 , 0x0016898683FF8000 , 0x0016898683FF8488 ,
46
+ 0x00170A0003800000 , 0x00170A0003800480 , 0x00170A0003800900 , 0x00170A0003800D80 ,
47
+ 0x0017800000000000 , 0x0018000000000000 , 0x0018000000000400 , 0x0018000000000800 ,
48
+ 0x0018000000000C00 , 0x0019800000000000 , 0x001A8B0003800000 , 0x001A8B0003800480 ,
49
+ 0x001A8B0003800900 , 0x001A8B0003800D80 , 0x001B000000000000 , 0x001B8B8003800000 ,
50
+ 0x001B8B8003800480 , 0x001C0C0783878000 , 0x001C0C0783878484 , 0x001C0C0783878908 ,
51
+ 0x001C0C0783878D8C , 0x001C0C0783879210 , 0x001C0C0783879694 , 0x001C0C0783879B18 ,
52
+ 0x001C0C0783879F9C , 0x001C0C880387A000 , 0x001C0C880387A484 , 0x001C8D0880878000 ,
53
+ 0x001D0D0880878000 , 0x001D800000000000 , 0x001E000000000000 , 0x001E8D8000800000 ,
54
+ 0x001E8D8000800480 , 0x001F0F8000800000 , 0x001F0F8000800480 ,
55
+ };
56
+ #endif
57
+
25
58
static inline int numaker_scc_on (const struct device * dev , clock_control_subsys_t subsys )
26
59
{
27
60
ARG_UNUSED (dev );
@@ -30,7 +63,12 @@ static inline int numaker_scc_on(const struct device *dev, clock_control_subsys_
30
63
31
64
if (scc_subsys -> subsys_id == NUMAKER_SCC_SUBSYS_ID_PCC ) {
32
65
SYS_UnlockReg ();
66
+ #if defined(CONFIG_SOC_SERIES_M55M1X )
67
+ __ASSERT_NO_MSG (scc_subsys -> pcc .clk_modidx < ARRAY_SIZE (numaker_clkmodidx_tab ));
68
+ CLK_EnableModuleClock (numaker_clkmodidx_tab [scc_subsys -> pcc .clk_modidx ]);
69
+ #else
33
70
CLK_EnableModuleClock (scc_subsys -> pcc .clk_modidx );
71
+ #endif
34
72
SYS_LockReg ();
35
73
} else {
36
74
return - EINVAL ;
@@ -47,7 +85,12 @@ static inline int numaker_scc_off(const struct device *dev, clock_control_subsys
47
85
48
86
if (scc_subsys -> subsys_id == NUMAKER_SCC_SUBSYS_ID_PCC ) {
49
87
SYS_UnlockReg ();
88
+ #if defined(CONFIG_SOC_SERIES_M55M1X )
89
+ __ASSERT_NO_MSG (scc_subsys -> pcc .clk_modidx < ARRAY_SIZE (numaker_clkmodidx_tab ));
90
+ CLK_DisableModuleClock (numaker_clkmodidx_tab [scc_subsys -> pcc .clk_modidx ]);
91
+ #else
50
92
CLK_DisableModuleClock (scc_subsys -> pcc .clk_modidx );
93
+ #endif
51
94
SYS_LockReg ();
52
95
} else {
53
96
return - EINVAL ;
@@ -84,8 +127,15 @@ static inline int numaker_scc_configure(const struct device *dev, clock_control_
84
127
85
128
if (scc_subsys -> subsys_id == NUMAKER_SCC_SUBSYS_ID_PCC ) {
86
129
SYS_UnlockReg ();
130
+ #if defined(CONFIG_SOC_SERIES_M55M1X )
131
+ __ASSERT_NO_MSG (scc_subsys -> pcc .clk_modidx < ARRAY_SIZE (numaker_clkmodidx_tab ));
132
+ CLK_SetModuleClock (numaker_clkmodidx_tab [scc_subsys -> pcc .clk_modidx ],
133
+ scc_subsys -> pcc .clk_src ,
134
+ scc_subsys -> pcc .clk_div );
135
+ #else
87
136
CLK_SetModuleClock (scc_subsys -> pcc .clk_modidx , scc_subsys -> pcc .clk_src ,
88
137
scc_subsys -> pcc .clk_div );
138
+ #endif
89
139
SYS_LockReg ();
90
140
} else {
91
141
return - EINVAL ;
0 commit comments