Skip to content
Permalink
Browse files

soc: sam0: Remove SERCOM defines from dts_fixup.h

Move SERCOM peripherals to use the raw defines generated from DTS
parsing.  This adds aliases to the DTS so that the SERCOM number
can still be used for clocking and pinmux.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
  • Loading branch information...
Sizurka authored and MaureenHelm committed Mar 25, 2019
1 parent 07d18e3 commit 4709816a69f0d18a789fa03a98a2f5755078c2eb
@@ -10,53 +10,53 @@
static int board_pinmux_init(struct device *dev)
{
struct device *muxa = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_A_LABEL);
#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
struct device *muxb = device_get_binding(DT_ATMEL_SAM0_PINMUX_PINMUX_B_LABEL);
#endif
ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

@@ -13,54 +13,54 @@ static int board_pinmux_init(struct device *dev)

ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

#if DT_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

@@ -14,51 +14,51 @@ static int board_pinmux_init(struct device *dev)

ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif

#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

@@ -14,47 +14,47 @@ static int board_pinmux_init(struct device *dev)

ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
pinmux_pin_set(muxb, 8, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 9, PINMUX_FUNC_D);
#endif
#if DT_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

#if DT_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

@@ -14,47 +14,47 @@ static int board_pinmux_init(struct device *dev)

ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
#error Pin mapping is not configured
#endif

#if DT_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
/* 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);
@@ -15,45 +15,45 @@ static int board_pinmux_init(struct device *dev)

ARG_UNUSED(dev);

#if DT_UART_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS
/* 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_UART_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_UART_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS
/* 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_SPI_SAM0_SERCOM0_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM1_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM2_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM3_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM4_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS
#error Pin mapping is not configured
#endif
#if DT_SPI_SAM0_SERCOM5_BASE_ADDRESS
#if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS
pinmux_pin_set(muxb, 2, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 22, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 23, PINMUX_FUNC_D);

0 comments on commit 4709816

Please sign in to comment.
You can’t perform that action at this time.