Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts: sam0: convert pinmux driver and board code to new dt macros #24656

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions boards/arm/adafruit_feather_m0_basic_proto/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,58 @@

#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

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

Expand Down
27 changes: 14 additions & 13 deletions boards/arm/adafruit_trinket_m0/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,62 @@

#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

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

Expand Down
29 changes: 15 additions & 14 deletions boards/arm/arduino_zero/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,60 @@

#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

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

Expand Down
29 changes: 15 additions & 14 deletions boards/arm/atsamd20_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,56 @@

#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

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

Expand Down
29 changes: 15 additions & 14 deletions boards/arm/atsamd21_xpro/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,56 @@

#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>

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);
Expand Down
Loading