diff --git a/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c b/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c index c1d5723f5fb1dd..9f80e2094f2dce 100644 --- a/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c +++ b/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c @@ -6,57 +6,58 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS - struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) + struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b))); #endif ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) /* SERCOM0 on RX=PA11/pad 3, TX=PA10/pad 2 */ pinmux_pin_set(muxa, 11, PINMUX_FUNC_C); pinmux_pin_set(muxa, 10, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) /* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */ pinmux_pin_set(muxa, 12, PINMUX_FUNC_D); pinmux_pin_set(muxb, 10, PINMUX_FUNC_D); pinmux_pin_set(muxb, 11, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) #warning Pin mapping may not be configured #endif diff --git a/boards/arm/adafruit_trinket_m0/pinmux.c b/boards/arm/adafruit_trinket_m0/pinmux.c index c2dc1d4d25d881..f9788ea3c52b11 100644 --- a/boards/arm/adafruit_trinket_m0/pinmux.c +++ b/boards/arm/adafruit_trinket_m0/pinmux.c @@ -6,61 +6,62 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) /* SERCOM0 on RX=PA7/pad 3, TX=PA6/pad 2 */ pinmux_pin_set(muxa, 7, PINMUX_FUNC_D); pinmux_pin_set(muxa, 6, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) /* SERCOM2 on RX=PA9/pad 1, TX=PA8/pad 0 */ pinmux_pin_set(muxa, 9, PINMUX_FUNC_D); pinmux_pin_set(muxa, 8, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) /* SPI SERCOM0 on MISO=PA9/pad 1, MOSI=PA6/pad 2, SCK=PA7/pad 3 */ pinmux_pin_set(muxa, 9, PINMUX_FUNC_D); pinmux_pin_set(muxa, 6, PINMUX_FUNC_D); pinmux_pin_set(muxa, 7, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) /* SPI SERCOM1 on MOSI=PA0/pad 0, SCK=PA1/pad 1 */ pinmux_pin_set(muxa, 0, PINMUX_FUNC_D); pinmux_pin_set(muxa, 1, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) #warning Pin mapping may not be configured #endif diff --git a/boards/arm/arduino_zero/pinmux.c b/boards/arm/arduino_zero/pinmux.c index e965fc3cf78281..e9c935bfe4786b 100644 --- a/boards/arm/arduino_zero/pinmux.c +++ b/boards/arm/arduino_zero/pinmux.c @@ -6,59 +6,60 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); - struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); + struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b))); ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) /* SERCOM0 on RX=PA11, TX=PA10 */ pinmux_pin_set(muxa, 11, PINMUX_FUNC_C); pinmux_pin_set(muxa, 10, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) /* SERCOM5 on RX=PB23, TX=PB22 */ pinmux_pin_set(muxb, 23, PINMUX_FUNC_D); pinmux_pin_set(muxb, 22, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) /* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */ pinmux_pin_set(muxa, 12, PINMUX_FUNC_D); pinmux_pin_set(muxb, 10, PINMUX_FUNC_D); pinmux_pin_set(muxb, 11, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) #warning Pin mapping may not be configured #endif diff --git a/boards/arm/atsamd20_xpro/pinmux.c b/boards/arm/atsamd20_xpro/pinmux.c index de4a787a7f8b25..c118c28ceafb68 100644 --- a/boards/arm/atsamd20_xpro/pinmux.c +++ b/boards/arm/atsamd20_xpro/pinmux.c @@ -6,55 +6,56 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); - struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); + struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b))); ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) /* SERCOM3 on RX=PA25, TX=PA24 */ pinmux_pin_set(muxa, 24, PINMUX_FUNC_C); pinmux_pin_set(muxa, 25, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) pinmux_pin_set(muxb, 8, PINMUX_FUNC_D); pinmux_pin_set(muxb, 9, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) /* SPI SERCOM0 on MISO=PA04, MOSI=PA06, SCK=PA07 */ pinmux_pin_set(muxa, 4, PINMUX_FUNC_D); pinmux_pin_set(muxa, 6, PINMUX_FUNC_D); pinmux_pin_set(muxa, 7, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) #warning Pin mapping may not be configured #endif diff --git a/boards/arm/atsamd21_xpro/pinmux.c b/boards/arm/atsamd21_xpro/pinmux.c index 0afa6988cbfcb8..d6808df1bce812 100644 --- a/boards/arm/atsamd21_xpro/pinmux.c +++ b/boards/arm/atsamd21_xpro/pinmux.c @@ -6,55 +6,56 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); - struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); + struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b))); ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) /* SERCOM0 on RX=PA11, TX=PA10 */ pinmux_pin_set(muxa, 11, PINMUX_FUNC_C); pinmux_pin_set(muxa, 10, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if (1, atmel_sam0_uart) /* SERCOM3 ON RX=PA19, TX=PA16 */ pinmux_pin_set(muxa, 19, PINMUX_FUNC_C); pinmux_pin_set(muxa, 16, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) /* SERCOM3 ON RX=PA23, TX=PA22 */ pinmux_pin_set(muxa, 23, PINMUX_FUNC_C); pinmux_pin_set(muxa, 22, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if (4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) /* SPI SERCOM5 on MISO=PB16/pad 0, MOSI=PB22/pad 2, SCK=PB23/pad 3 */ pinmux_pin_set(muxb, 16, PINMUX_FUNC_C); pinmux_pin_set(muxb, 22, PINMUX_FUNC_D); diff --git a/boards/arm/atsame54_xpro/pinmux.c b/boards/arm/atsame54_xpro/pinmux.c index 999308d4bfd719..e7b896746ab27c 100644 --- a/boards/arm/atsame54_xpro/pinmux.c +++ b/boards/arm/atsame54_xpro/pinmux.c @@ -6,6 +6,7 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { @@ -20,83 +21,83 @@ static int board_pinmux_init(struct device *dev) ARG_UNUSED(muxc); ARG_UNUSED(muxd); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) /* SERCOM2 ON RX=PB24, TX=PB25 */ pinmux_pin_set(muxb, 24, PINMUX_FUNC_D); pinmux_pin_set(muxb, 25, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_6_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(6, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_7_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(7, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) /* SERCOM4 ON MOSI=PB27, MISO=PB29, SCK=PB26 */ pinmux_pin_set(muxb, 26, PINMUX_FUNC_D); pinmux_pin_set(muxb, 27, PINMUX_FUNC_D); pinmux_pin_set(muxb, 29, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_6_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(6, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_7_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(7, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_6_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(6, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_7_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(7, atmel_sam0_i2c) pinmux_pin_set(muxd, 8, PINMUX_FUNC_C); pinmux_pin_set(muxd, 9, PINMUX_FUNC_C); #endif diff --git a/boards/arm/atsamr21_xpro/pinmux.c b/boards/arm/atsamr21_xpro/pinmux.c index 637e791af90a89..9e7a8387b6d21c 100644 --- a/boards/arm/atsamr21_xpro/pinmux.c +++ b/boards/arm/atsamr21_xpro/pinmux.c @@ -7,54 +7,55 @@ #include #include +#include static int board_pinmux_init(struct device *dev) { - struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL); - struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL); - struct device *muxc = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_C_LABEL); + struct device *muxa = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_a))); + struct device *muxb = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_b))); + struct device *muxc = device_get_binding(DT_LABEL(DT_NODELABEL(pinmux_c))); ARG_UNUSED(dev); -#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) /* SERCOM0 on RX=PA5, TX=PA4 */ pinmux_pin_set(muxa, 4, PINMUX_FUNC_D); pinmux_pin_set(muxa, 5, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) /* NOTE: SERCOM3 UART is used by the UART driver tests */ /* SERCOM3 on RX=PA22, TX=PA23 */ pinmux_pin_set(muxa, 22, PINMUX_FUNC_C); pinmux_pin_set(muxa, 23, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) /* SERCOM5 on RX=PA23, TX=PA22 */ pinmux_pin_set(muxa, 22, PINMUX_FUNC_D); pinmux_pin_set(muxa, 23, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_spi) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) /** * SPI SERCOM4 on * MISO = PC19/pad 0, @@ -67,30 +68,30 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxb, 30, PINMUX_FUNC_F); pinmux_pin_set(muxc, 18, PINMUX_FUNC_F); #endif -#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_spi) pinmux_pin_set(muxb, 2, PINMUX_FUNC_D); pinmux_pin_set(muxb, 22, PINMUX_FUNC_D); pinmux_pin_set(muxb, 23, PINMUX_FUNC_D); #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_0_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_1_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_i2c) /* SERCOM1 on SDA=PA16, SCL=PA17 */ pinmux_pin_set(muxa, 16, PINMUX_FUNC_C); pinmux_pin_set(muxa, 17, PINMUX_FUNC_C); #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_2_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_3_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_4_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif -#if DT_ATMEL_SAM0_I2C_SERCOM_5_BASE_ADDRESS +#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_i2c) #warning Pin mapping may not be configured #endif diff --git a/drivers/pinmux/pinmux_sam0.c b/drivers/pinmux/pinmux_sam0.c index 58b96cbf9f3af8..a8e2d9fd38f884 100644 --- a/drivers/pinmux/pinmux_sam0.c +++ b/drivers/pinmux/pinmux_sam0.c @@ -69,45 +69,45 @@ const struct pinmux_driver_api pinmux_sam0_api = { .input = pinmux_sam0_input, }; -#if DT_ATMEL_SAM0_PINMUX_PINMUX_A_BASE_ADDRESS +#if DT_HAS_NODE(DT_NODELABEL(pinmux_a)) static const struct pinmux_sam0_config pinmux_sam0_config_0 = { - .regs = (PortGroup *)DT_ATMEL_SAM0_PINMUX_PINMUX_A_BASE_ADDRESS, + .regs = (PortGroup *)DT_REG_ADDR(DT_NODELABEL(pinmux_a)), }; -DEVICE_AND_API_INIT(pinmux_sam0_0, DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL, +DEVICE_AND_API_INIT(pinmux_sam0_0, DT_LABEL(DT_NODELABEL(pinmux_a)), pinmux_sam0_init, NULL, &pinmux_sam0_config_0, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY, &pinmux_sam0_api); #endif -#if DT_ATMEL_SAM0_PINMUX_PINMUX_B_BASE_ADDRESS +#if DT_HAS_NODE(DT_NODELABEL(pinmux_b)) static const struct pinmux_sam0_config pinmux_sam0_config_1 = { - .regs = (PortGroup *)DT_ATMEL_SAM0_PINMUX_PINMUX_B_BASE_ADDRESS, + .regs = (PortGroup *)DT_REG_ADDR(DT_NODELABEL(pinmux_b)), }; -DEVICE_AND_API_INIT(pinmux_sam0_1, DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL, +DEVICE_AND_API_INIT(pinmux_sam0_1, DT_LABEL(DT_NODELABEL(pinmux_b)), pinmux_sam0_init, NULL, &pinmux_sam0_config_1, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY, &pinmux_sam0_api); #endif -#if DT_ATMEL_SAM0_PINMUX_PINMUX_C_BASE_ADDRESS +#if DT_HAS_NODE(DT_NODELABEL(pinmux_c)) static const struct pinmux_sam0_config pinmux_sam0_config_2 = { - .regs = (PortGroup *)DT_ATMEL_SAM0_PINMUX_PINMUX_C_BASE_ADDRESS, + .regs = (PortGroup *)DT_REG_ADDR(DT_NODELABEL(pinmux_c)), }; -DEVICE_AND_API_INIT(pinmux_sam0_2, DT_ATMEL_SAM0_PINMUX_PINMUX_C_LABEL, +DEVICE_AND_API_INIT(pinmux_sam0_2, DT_LABEL(DT_NODELABEL(pinmux_c)), pinmux_sam0_init, NULL, &pinmux_sam0_config_2, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY, &pinmux_sam0_api); #endif -#if DT_ATMEL_SAM0_PINMUX_PINMUX_D_BASE_ADDRESS +#if DT_HAS_NODE(DT_NODELABEL(pinmux_d)) static const struct pinmux_sam0_config pinmux_sam0_config_3 = { - .regs = (PortGroup *)DT_ATMEL_SAM0_PINMUX_PINMUX_D_BASE_ADDRESS, + .regs = (PortGroup *)DT_REG_ADDR(DT_NODELABEL(pinmux_d)), }; -DEVICE_AND_API_INIT(pinmux_sam0_3, DT_ATMEL_SAM0_PINMUX_PINMUX_D_LABEL, +DEVICE_AND_API_INIT(pinmux_sam0_3, DT_LABEL(DT_NODELABEL(pinmux_d)), pinmux_sam0_init, NULL, &pinmux_sam0_config_3, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY, &pinmux_sam0_api); diff --git a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h index 377751eda24cc6..06f1e38741a6cf 100644 --- a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h +++ b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h @@ -30,4 +30,9 @@ #define ATMEL_SAM0_DT_INST_DMA_CHANNEL(n, name) \ ATMEL_SAM0_DT_INST_DMA_CELL(n, name, channel) +/* Use to check if a sercom 'n' is enabled for a given 'compat' */ +#define ATMEL_SAM0_DT_SERCOM_CHECK(n, compat) \ + DT_HAS_NODE(DT_NODELABEL(sercom##n)) && \ + DT_NODE_HAS_COMPAT(DT_NODELABEL(sercom##n), compat) + #endif /* _ATMEL_SAM0_SOC_DT_H_ */