Skip to content

Commit 4c20d17

Browse files
committed
soc: arm: openisa_rv32m1: Add RV32M1 M4 core support
Add the M4 core of the RVM32M1 SoC and a corresponding board configuration to enable the core on the vega board. Signed-off-by: Karsten Koenig <[email protected]>
1 parent 2f053f0 commit 4c20d17

File tree

19 files changed

+1203
-2
lines changed

19 files changed

+1203
-2
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@
274274
/dts/arm/nuvoton/ @ssekar15
275275
/dts/arm/nxp/ @MaureenHelm
276276
/dts/arm/microchip/ @franciscomunoz @albertofloyd @scottwcpg
277+
/dts/arm/rv32m1/ @karstenkoenig
277278
/dts/arm/silabs/efm32gg11b* @oanerer
278279
/dts/arm/silabs/efm32_jg_pg* @chrta
279280
/dts/arm/silabs/efr32bg13p* @mnkp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2020 Karsten Koenig
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library()
5+
zephyr_library_sources(pinmux.c)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2020 Karsten Koenig
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_RV32M1_VEGA_CORTEX
5+
bool "RV32M1 ARM cores"
6+
depends on SOC_OPENISA_RV32M1_ARM
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2020 Karsten Koenig
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_RV32M1_VEGA_CORTEX
5+
6+
config BOARD
7+
default "rv32m1_vega_cortex_m4" if SOC_OPENISA_RV32M1_M4
8+
9+
config UART_RV32M1_LPUART
10+
default y
11+
depends on SERIAL
12+
13+
endif # BOARD_RV32M1_VEGA
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
* Copyright 2018 Foundries.io Ltd
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <init.h>
8+
#include <drivers/pinmux.h>
9+
#include <drivers/gpio.h>
10+
#include <fsl_port.h>
11+
12+
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
13+
struct device *vega_debug_portb;
14+
struct device *vega_debug_portc;
15+
struct device *vega_debug_portd;
16+
#endif
17+
18+
static int rv32m1_vega_pinmux_init(struct device *dev)
19+
{
20+
ARG_UNUSED(dev);
21+
22+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay)
23+
__unused struct device *porta =
24+
device_get_binding(DT_LABEL(DT_NODELABEL(porta)));
25+
#endif
26+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay)
27+
__unused struct device *portb =
28+
device_get_binding(DT_LABEL(DT_NODELABEL(portb)));
29+
#endif
30+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay)
31+
__unused struct device *portc =
32+
device_get_binding(DT_LABEL(DT_NODELABEL(portc)));
33+
#endif
34+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay)
35+
__unused struct device *portd =
36+
device_get_binding(DT_LABEL(DT_NODELABEL(portd)));
37+
#endif
38+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porte), okay)
39+
__unused struct device *porte =
40+
device_get_binding(DT_LABEL(DT_NODELABEL(porte)));
41+
#endif
42+
43+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) && CONFIG_SERIAL
44+
/* LPUART0 RX, TX */
45+
pinmux_pin_set(portc, 7, PORT_PCR_MUX(kPORT_MuxAlt3));
46+
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
47+
#endif
48+
49+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) && CONFIG_SERIAL
50+
/* LPUART1 RX, TX */
51+
pinmux_pin_set(portc, 29, PORT_PCR_MUX(kPORT_MuxAlt2));
52+
pinmux_pin_set(portc, 30, PORT_PCR_MUX(kPORT_MuxAlt2));
53+
#endif
54+
55+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c0), okay) && CONFIG_I2C
56+
/* LPI2C0 SCL, SDA - Arduino header */
57+
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt4));
58+
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt4));
59+
#endif
60+
61+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c3), okay) && CONFIG_I2C
62+
/* LPI2C3 SCL, SDA - FXOS8700 */
63+
pinmux_pin_set(porte, 30, PORT_PCR_MUX(kPORT_MuxAlt3));
64+
pinmux_pin_set(porte, 29, PORT_PCR_MUX(kPORT_MuxAlt3));
65+
#endif
66+
67+
/* FXOS8700 INT1, INT2, RST */
68+
pinmux_pin_set(porte, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
69+
pinmux_pin_set(porte, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
70+
pinmux_pin_set(porte, 27, PORT_PCR_MUX(kPORT_MuxAsGpio));
71+
72+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) && CONFIG_SPI
73+
/* LPSPI0 SCK, SOUT, PCS2, SIN */
74+
pinmux_pin_set(portb, 4, PORT_PCR_MUX(kPORT_MuxAlt2));
75+
pinmux_pin_set(portb, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
76+
pinmux_pin_set(portb, 6, PORT_PCR_MUX(kPORT_MuxAlt2));
77+
pinmux_pin_set(portb, 7, PORT_PCR_MUX(kPORT_MuxAlt2));
78+
#endif
79+
80+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) && CONFIG_SPI
81+
/* LPSPI1 SCK, SIN, SOUT, CS */
82+
pinmux_pin_set(portb, 20, PORT_PCR_MUX(kPORT_MuxAlt2));
83+
pinmux_pin_set(portb, 21, PORT_PCR_MUX(kPORT_MuxAlt2));
84+
pinmux_pin_set(portb, 24, PORT_PCR_MUX(kPORT_MuxAlt2));
85+
pinmux_pin_set(portb, 22, PORT_PCR_MUX(kPORT_MuxAlt2));
86+
#endif
87+
88+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm2), okay) && CONFIG_PWM
89+
/* RGB LEDs as PWM */
90+
pinmux_pin_set(porta, 22, PORT_PCR_MUX(kPORT_MuxAlt6));
91+
pinmux_pin_set(porta, 23, PORT_PCR_MUX(kPORT_MuxAlt6));
92+
pinmux_pin_set(porta, 24, PORT_PCR_MUX(kPORT_MuxAlt6));
93+
#else
94+
/* RGB LEDs as GPIO */
95+
pinmux_pin_set(porta, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
96+
pinmux_pin_set(porta, 23, PORT_PCR_MUX(kPORT_MuxAsGpio));
97+
pinmux_pin_set(porta, 24, PORT_PCR_MUX(kPORT_MuxAsGpio));
98+
#endif
99+
100+
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
101+
102+
pinmux_pin_set(portb, 29, PORT_PCR_MUX(kPORT_MuxAsGpio));
103+
104+
pinmux_pin_set(portc, 28, PORT_PCR_MUX(kPORT_MuxAsGpio));
105+
pinmux_pin_set(portc, 29, PORT_PCR_MUX(kPORT_MuxAsGpio));
106+
pinmux_pin_set(portc, 30, PORT_PCR_MUX(kPORT_MuxAsGpio));
107+
108+
pinmux_pin_set(portd, 0, PORT_PCR_MUX(kPORT_MuxAsGpio));
109+
pinmux_pin_set(portd, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
110+
pinmux_pin_set(portd, 2, PORT_PCR_MUX(kPORT_MuxAsGpio));
111+
pinmux_pin_set(portd, 3, PORT_PCR_MUX(kPORT_MuxAsGpio));
112+
pinmux_pin_set(portd, 4, PORT_PCR_MUX(kPORT_MuxAsGpio));
113+
pinmux_pin_set(portd, 5, PORT_PCR_MUX(kPORT_MuxAsGpio));
114+
115+
struct device *gpio_dev =
116+
device_get_binding(DT_LABEL(DT_NODELABEL(gpiob)));
117+
118+
gpio_pin_configure(gpio_dev, 29, GPIO_OUTPUT);
119+
120+
gpio_dev = device_get_binding(DT_LABEL(DT_NODELABEL(gpioc)));
121+
gpio_pin_configure(gpio_dev, 28, GPIO_OUTPUT);
122+
gpio_pin_configure(gpio_dev, 29, GPIO_OUTPUT);
123+
gpio_pin_configure(gpio_dev, 30, GPIO_OUTPUT);
124+
125+
gpio_dev = device_get_binding(DT_LABEL(DT_NODELABEL(gpiod)));
126+
gpio_pin_configure(gpio_dev, 0, GPIO_OUTPUT);
127+
gpio_pin_configure(gpio_dev, 1, GPIO_OUTPUT);
128+
gpio_pin_configure(gpio_dev, 2, GPIO_OUTPUT);
129+
gpio_pin_configure(gpio_dev, 3, GPIO_OUTPUT);
130+
gpio_pin_configure(gpio_dev, 4, GPIO_OUTPUT);
131+
gpio_pin_configure(gpio_dev, 5, GPIO_OUTPUT);
132+
#endif
133+
134+
return 0;
135+
}
136+
137+
SYS_INIT(rv32m1_vega_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
/*
2+
* Copyright (c) 2018 Foundries.io Ltd
3+
* Copyright (c) 2020 Karsten Koenig
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
led0 = &green_led;
10+
led1 = &blue_led;
11+
led2 = &red_led;
12+
led3 = &sts_led;
13+
pwm-led0 = &blue_pwm_led;
14+
pwm-led1 = &green_pwm_led;
15+
pwm-led2 = &red_pwm_led;
16+
blue-pwm-led = &blue_pwm_led;
17+
green-pwm-led = &green_pwm_led;
18+
red-pwm-led = &red_pwm_led;
19+
sw0 = &user_button_2;
20+
sw1 = &user_button_3;
21+
sw2 = &user_button_4;
22+
sw3 = &user_button_5;
23+
};
24+
25+
leds {
26+
compatible = "gpio-leds";
27+
blue_led: led_0 {
28+
gpios = <&gpioa 22 GPIO_ACTIVE_HIGH>;
29+
label = "User LD1";
30+
};
31+
green_led: led_1 {
32+
gpios = <&gpioa 23 GPIO_ACTIVE_HIGH>;
33+
label = "User LD2";
34+
};
35+
red_led: led_2 {
36+
gpios = <&gpioa 24 GPIO_ACTIVE_HIGH>;
37+
label = "User LD3";
38+
};
39+
sts_led: led_3 {
40+
gpios = <&gpioe 0 GPIO_ACTIVE_HIGH>;
41+
label = "User LD4";
42+
};
43+
};
44+
45+
pwmleds {
46+
compatible = "pwm-leds";
47+
blue_pwm_led: pwm_led_0 {
48+
pwms = <&tpm2 2 0 0>;
49+
label = "User PWM LD1";
50+
};
51+
green_pwm_led: pwm_led_1 {
52+
pwms = <&tpm2 1 0 0>;
53+
label = "User PWM LD2";
54+
};
55+
red_pwm_led: pwm_led_2 {
56+
pwms = <&tpm2 0 0 0>;
57+
label = "User PWM LD3";
58+
};
59+
};
60+
61+
gpio_keys {
62+
compatible = "gpio-keys";
63+
user_button_2: button_0 {
64+
label = "User SW2";
65+
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
66+
};
67+
user_button_3: button_1 {
68+
label = "User SW3";
69+
gpios = <&gpioe 8 GPIO_ACTIVE_LOW>;
70+
};
71+
user_button_4: button_2 {
72+
label = "User SW4";
73+
gpios = <&gpioe 9 GPIO_ACTIVE_LOW>;
74+
};
75+
user_button_5: button_3 {
76+
label = "User SW5";
77+
gpios = <&gpioe 12 GPIO_ACTIVE_LOW>;
78+
};
79+
};
80+
81+
arduino_header: connector {
82+
compatible = "arduino-header-r3";
83+
#gpio-cells = <2>;
84+
gpio-map-mask = <0xffffffff 0xffffffc0>;
85+
gpio-map-pass-thru = <0 0x3f>;
86+
gpio-map = <0 0 &gpioc 11 0>, /* A0 */
87+
<1 0 &gpioc 12 0>, /* A1 */
88+
<2 0 &gpiob 9 0>, /* A2 */
89+
<3 0 &gpioe 4 0>, /* A3 */
90+
<4 0 &gpioe 10 0>, /* A4 */
91+
<5 0 &gpioe 11 0>, /* A5 */
92+
<6 0 &gpioa 25 0>, /* D0 */
93+
<7 0 &gpioa 26 0>, /* D1 */
94+
<8 0 &gpioa 27 0>, /* D2 */
95+
<9 0 &gpiob 13 0>, /* D3 */
96+
<10 0 &gpiob 14 0>, /* D4 */
97+
<11 0 &gpioa 30 0>, /* D5 */
98+
<12 0 &gpioa 31 0>, /* D6 */
99+
<13 0 &gpiob 1 0>, /* D7 */
100+
<14 0 &gpiob 2 0>, /* D8 */
101+
<15 0 &gpiob 3 0>, /* D9 */
102+
<16 0 &gpiob 6 0>, /* D10 */
103+
<17 0 &gpiob 5 0>, /* D11 */
104+
<18 0 &gpiob 7 0>, /* D12 */
105+
<19 0 &gpiob 4 0>, /* D13 */
106+
<20 0 &gpioc 9 0>, /* D14 */
107+
<21 0 &gpioc 10 0>; /* D15 */
108+
};
109+
};
110+
111+
arduino_serial: &lpuart1 {};
112+
113+
&lpuart0 {
114+
current-speed = <115200>;
115+
status = "okay";
116+
};
117+
118+
arduino_i2c: &lpi2c0 {
119+
status = "okay";
120+
};
121+
122+
&lpi2c3 {
123+
status = "okay";
124+
125+
fxos8700@1e {
126+
compatible = "nxp,fxos8700";
127+
reg = <0x1e>;
128+
label = "FXOS8700";
129+
reset-gpios = <&gpioe 27 GPIO_ACTIVE_HIGH>;
130+
int1-gpios = <&gpioe 1 GPIO_ACTIVE_LOW>;
131+
int2-gpios = <&gpioe 22 GPIO_ACTIVE_LOW>;
132+
};
133+
};
134+
135+
arduino_spi: &lpspi0 {
136+
status = "okay";
137+
};
138+
139+
&lpspi1 {
140+
status = "okay";
141+
cs-gpios = <&gpiob 22 0>;
142+
mx25r32: mx25r3235f@0 {
143+
compatible = "jedec,spi-nor";
144+
reg = <0>;
145+
spi-max-frequency = <80000000>;
146+
label = "MX25R32";
147+
jedec-id = [c2 28 16];
148+
size = <33554432>;
149+
has-be32k;
150+
};
151+
};
152+
153+
&tpm2 {
154+
status = "okay";
155+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2018 Foundries.io Ltd
3+
* Copyright (c) 2020 Karsten Koenig
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include "rv32m1/rv32m1_m4.dtsi"
10+
#include "rv32m1_vega_cortex.dtsi"
11+
12+
/ {
13+
model = "OpenISA RV32M1 Vega Cortex-M4";
14+
compatible = "openisa,rv32m1";
15+
16+
chosen {
17+
zephyr,sram = &m4_dtcm;
18+
zephyr,flash = &m4_flash;
19+
zephyr,console = &lpuart0;
20+
zephyr,shell-uart = &lpuart0;
21+
zephyr,uart-pipe = &lpuart0;
22+
zephyr,code-partition = &slot0_partition;
23+
};
24+
};
25+
26+
&m4_flash {
27+
partitions {
28+
compatible = "fixed-partitions";
29+
#address-cells = <1>;
30+
#size-cells = <1>;
31+
32+
slot0_partition: partition@0 {
33+
label = "image-0";
34+
reg = <0x00000000 0x000069000>;
35+
};
36+
slot1_partition: partition@69000 {
37+
label = "image-1";
38+
reg = <0x00069000 0x000069000>;
39+
};
40+
scratch_partition: partition@d2000 {
41+
label = "image-scratch";
42+
reg = <0x000d2000 0x0001e000>;
43+
};
44+
storage_partition: partition@f0000 {
45+
label = "storage";
46+
reg = <0x000f0000 0x00004000>;
47+
};
48+
boot_partition: partition@f4000 {
49+
label = "mcuboot";
50+
reg = <0x000f4000 0x0000C000>;
51+
};
52+
};
53+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
identifier: rv32m1_vega_cortex_m4
2+
name: RV32M1-VEGA-CORTEX-M4
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
supported:
9+
- arduino_gpio
10+
- arduino_i2c
11+
- arduino_spi
12+
- i2c
13+
- pwm
14+
- spi

0 commit comments

Comments
 (0)