Skip to content

Commit 0b687ba

Browse files
committed
drivers: clock_control: mspm0: Add CANCLK source support
Add support for the CANCLK source for MSPM0. `mspm0_canclk_cfg` config struct is used to provide CAN-FD clock frequency selection. - Select HFCLK (HFXT) freq when `ti,canclk-source = 0` - ELse fall back to SYSOSC frequency. Signed-off-by: Santhosh Charles <[email protected]>
1 parent e26a7bc commit 0b687ba

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/clock_control/clock_control_mspm0.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ static struct mspm0_clk_cfg mspm0_lfclk_cfg = {
5757
.clk_freq = DT_PROP(DT_NODELABEL(lfclk), clock_frequency),
5858
};
5959

60+
static struct mspm0_clk_cfg mspm0_canclk_cfg = {
61+
#if MSPM0_HFCLK_ENABLED && (DT_PROP(canfd0, ti_canclk_source) == 0)
62+
.clk_freq = DT_PROP(DT_NODELABEL(hfxt), clock_frequency),
63+
#else
64+
.clk_freq = DT_PROP(DT_NODELABEL(sysosc), clock_frequency),
65+
#endif
66+
};
67+
6068
static struct mspm0_clk_cfg mspm0_ulpclk_cfg = {
6169
.clk_freq = DT_PROP(DT_NODELABEL(ulpclk), clock_frequency),
6270
.clk_div = MSPM0_ULPCLK_DIV,
@@ -141,8 +149,11 @@ static int clock_mspm0_get_rate(const struct device *dev,
141149
break;
142150
#endif
143151

144-
case MSPM0_CLOCK_MFCLK:
145152
case MSPM0_CLOCK_CANCLK:
153+
*rate = mspm0_canclk_cfg.clk_freq;
154+
break;
155+
156+
case MSPM0_CLOCK_MFCLK:
146157
default:
147158
return -ENOTSUP;
148159
}

0 commit comments

Comments
 (0)