Skip to content

Commit 70b5a92

Browse files
committed
tests: drivers: can: api: support nuvoton numaker_m3334ki
Add support for Nuvoton NuMaker-M3334KI board This target has only 4 MPU regions, so disable userspace test. Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
1 parent 6559364 commit 70b5a92

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

drivers/can/can_numaker.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int can_numaker_get_core_clock(const struct device *dev, uint32_t *rate)
4949
clkdiv_divider = CLK_GetModuleClockDivider(config->clk_modidx) + 1;
5050

5151
switch (clksrc_rate_idx) {
52-
#if defined(CONFIG_SOC_SERIES_M46X)
52+
#if defined(CONFIG_SOC_SERIES_M46X) || defined(CONFIG_SOC_SERIES_M333X)
5353
case (CLK_CLKSEL0_CANFD0SEL_HXT >> CLK_CLKSEL0_CANFD0SEL_Pos):
5454
*rate = __HXT / clkdiv_divider;
5555
break;
@@ -91,19 +91,6 @@ static int can_numaker_get_core_clock(const struct device *dev, uint32_t *rate)
9191
case (CLK_CANFDSEL_CANFD0SEL_HIRC48M_DIV4 >> CLK_CANFDSEL_CANFD0SEL_Pos):
9292
*rate = (__HIRC48M / 4) / clkdiv_divider;
9393
break;
94-
#elif defined(CONFIG_SOC_SERIES_M333X)
95-
case (CLK_CLKSEL0_CANFD0SEL_HXT >> CLK_CLKSEL0_CANFD0SEL_Pos):
96-
*rate = __HXT / clkdiv_divider;
97-
break;
98-
case (CLK_CLKSEL0_CANFD0SEL_PLL_DIV2 >> CLK_CLKSEL0_CANFD0SEL_Pos):
99-
*rate = (CLK_GetPLLClockFreq() / 2) / clkdiv_divider;
100-
break;
101-
case (CLK_CLKSEL0_CANFD0SEL_HCLK >> CLK_CLKSEL0_CANFD0SEL_Pos):
102-
*rate = CLK_GetHCLKFreq() / clkdiv_divider;
103-
break;
104-
case (CLK_CLKSEL0_CANFD0SEL_HIRC >> CLK_CLKSEL0_CANFD0SEL_Pos):
105-
*rate = __HIRC / clkdiv_divider;
106-
break;
10794
#endif
10895
default:
10996
LOG_ERR("Invalid clock source rate index");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_TEST_USERSPACE=n
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
3+
/ {
4+
chosen {
5+
zephyr,canbus = &canfd0;
6+
};
7+
};
8+
9+
&pinctrl {
10+
/* CAN TX/RX --> UNO D8/D9 */
11+
canfd0_default: canfd0_default {
12+
group0 {
13+
pinmux = <PA5MFP_CANFD0_TXD>,
14+
<PA4MFP_CANFD0_RXD>;
15+
};
16+
};
17+
};
18+
19+
&canfd0 {
20+
pinctrl-0 = <&canfd0_default>;
21+
pinctrl-names = "default";
22+
status = "okay";
23+
};

0 commit comments

Comments
 (0)