drivers: serial: uart_sam0: Add pinctrl support

Add Atmel sam0 sercom[uart] pinctrl bindings and implements pinctrl at
driver level.  It changes all sam0 boards to use new feature and remove
pinmux driver dependency for sercom[uart].  The samples that require a
binding were update to keep consistency and avoid errors.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-05-18 19:38:06 -03:00 committed by Kumar Gala
commit 62ba4723d4
32 changed files with 329 additions and 256 deletions

View file

@ -46,6 +46,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pa11c_sercom0_pad3 &pa10c_sercom0_pad2>;
}; };
&sercom3 { &sercom3 {

View file

@ -20,28 +20,7 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
#endif #endif
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* 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 (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) && CONFIG_SPI_SAM0)
/* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */ /* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */

View file

@ -52,6 +52,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa16d_sercom3_pad1 &pa17d_sercom3_pad0>;
}; };
&sercom1 { &sercom1 {

View file

@ -17,27 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && defined(CONFIG_UART_SAM0) ARG_UNUSED(muxb);
/* SERCOM3 on RX=PA16/pad 1, TX=PA17/pad 0 */
pinmux_pin_set(muxa, 16, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 17, PINMUX_FUNC_D);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) && defined(CONFIG_SPI_SAM0) #if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) && defined(CONFIG_SPI_SAM0)
/* SPI SERCOM1 on MISO=PB23/pad 3, MOSI=PA0/pad 0, SCK=PA1/pad 1 */ /* SPI SERCOM1 on MISO=PB23/pad 3, MOSI=PA0/pad 0, SCK=PA1/pad 1 */

View file

@ -52,6 +52,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pa7d_sercom0_pad3 &pa6d_sercom0_pad2>;
}; };
&sercom2 { &sercom2 {
@ -60,6 +62,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa9d_sercom2_pad1 &pa8d_sercom2_pad0>;
}; };
/* Drives the on-board DotStar LED */ /* Drives the on-board DotStar LED */

View file

@ -15,31 +15,7 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxa)); __ASSERT_NO_MSG(device_is_ready(muxa));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* 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 (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* 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 (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
/* SPI SERCOM0 on MISO=PA9/pad 1, MOSI=PA6/pad 2, SCK=PA7/pad 3 */ /* SPI SERCOM0 on MISO=PA9/pad 1, MOSI=PA6/pad 2, SCK=PA7/pad 3 */

View file

@ -83,6 +83,8 @@
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa23c_sercom3_pad1 &pa22c_sercom3_pad0>;
nina_prog { nina_prog {
compatible = "espressif,esp-at"; compatible = "espressif,esp-at";
label = "NINA_PROG"; label = "NINA_PROG";
@ -116,6 +118,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pb23d_sercom5_pad3 &pb22d_sercom5_pad2>;
}; };
&tcc2 { &tcc2 {

View file

@ -17,31 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if defined(CONFIG_UART_SAM0) ARG_UNUSED(muxb);
#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart)
/* SERCOM3 on RX=PA23/pad 1, TX=PA22/pad 0 */
pinmux_pin_set(muxa, 22, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 23, PINMUX_FUNC_C);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart)
/* SERCOM5 on RX=PB23/pad 3, TX=PB22/pad 2 */
pinmux_pin_set(muxb, 23, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 22, PINMUX_FUNC_D);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart)
#warning Pin mapping may not be configured
#endif
#endif
#if defined(CONFIG_SPI_SAM0) #if defined(CONFIG_SPI_SAM0)
#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi) #if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_spi)

View file

@ -61,6 +61,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pa11c_sercom0_pad3 &pa10c_sercom0_pad2>;
}; };
&sercom5 { &sercom5 {
@ -69,6 +71,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pb23d_sercom5_pad3 &pb22d_sercom5_pad2>;
}; };
&sercom4 { &sercom4 {

View file

@ -17,31 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0) ARG_UNUSED(muxb);
/* SERCOM0 on RX=PA11, TX=PA10 */
pinmux_pin_set(muxa, 11, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 10, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM5 on RX=PB23, TX=PB22 */
pinmux_pin_set(muxb, 23, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 22, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_spi) && CONFIG_SPI_SAM0)
/* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */ /* SPI SERCOM4 on MISO=PA12/pad 0, MOSI=PB10/pad 2, SCK=PB11/pad 3 */

View file

@ -69,6 +69,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <1>; txpo = <1>;
pinctrl-0 = <&pa25c_sercom3_pad3 &pa24c_sercom3_pad2>;
}; };
&sercom4 { &sercom4 {
@ -77,6 +79,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pb9d_sercom4_pad1 &pb8d_sercom4_pad0>;
}; };
&flash0 { &flash0 {

View file

@ -17,28 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0) ARG_UNUSED(muxb);
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM3 on RX=PA25, TX=PA24 */
pinmux_pin_set(muxa, 24, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 25, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
pinmux_pin_set(muxb, 8, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 9, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
/* SPI SERCOM0 on MISO=PA04, MOSI=PA06, SCK=PA07 */ /* SPI SERCOM0 on MISO=PA04, MOSI=PA06, SCK=PA07 */

View file

@ -68,6 +68,8 @@
current-speed = <9600>; current-speed = <9600>;
rxpo = <3>; rxpo = <3>;
txpo = <2>; txpo = <2>;
pinctrl-0 = <&pa11c_sercom0_pad3 &pa10c_sercom0_pad2>;
}; };
&sercom1 { &sercom1 {
@ -76,6 +78,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <3>; rxpo = <3>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa19c_sercom1_pad3 &pa16c_sercom1_pad0>;
}; };
&sercom2 { &sercom2 {
@ -92,6 +96,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa23c_sercom3_pad1 &pa22c_sercom3_pad0>;
}; };
&sercom5 { &sercom5 {

View file

@ -17,31 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0) ARG_UNUSED(muxb);
/* SERCOM0 on RX=PA11, TX=PA10 */
pinmux_pin_set(muxa, 11, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 10, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM3 ON RX=PA19, TX=PA16 */
pinmux_pin_set(muxa, 19, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 16, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM3 ON RX=PA23, TX=PA22 */
pinmux_pin_set(muxa, 23, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 22, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured #warning Pin mapping may not be configured

View file

@ -66,6 +66,8 @@
txpo = <0>; txpo = <0>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
pinctrl-0 = <&pb25d_sercom2_pad1 &pb24d_sercom2_pad0>;
}; };
&sercom4 { &sercom4 {

View file

@ -26,36 +26,6 @@ static int board_pinmux_init(const struct device *dev)
ARG_UNUSED(muxc); ARG_UNUSED(muxc);
ARG_UNUSED(muxd); ARG_UNUSED(muxd);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* NOTE: SERCOM1 UART is used by the UART driver tests */
/* SERCOM1 ON RX=PC22, TX=PC23 */
pinmux_pin_set(muxc, 22, PINMUX_FUNC_C);
pinmux_pin_set(muxc, 23, PINMUX_FUNC_C);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM2 ON RX=PB24, TX=PB25 */
pinmux_pin_set(muxb, 24, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 25, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(6, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(7, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured #warning Pin mapping may not be configured
#endif #endif

View file

@ -113,6 +113,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa5d_sercom0_pad1 &pa4d_sercom0_pad0>;
}; };
&sercom1 { &sercom1 {

View file

@ -20,32 +20,9 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxc)); __ASSERT_NO_MSG(device_is_ready(muxc));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && CONFIG_UART_SAM0) ARG_UNUSED(muxb);
/* SERCOM0 on RX=PA5, TX=PA4 */ ARG_UNUSED(muxc);
pinmux_pin_set(muxa, 4, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 5, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* 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 (ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && CONFIG_UART_SAM0)
/* SERCOM5 on RX=PA23, TX=PA22 */
pinmux_pin_set(muxa, 22, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 23, PINMUX_FUNC_D);
#endif
#if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0) #if (ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && CONFIG_SPI_SAM0)
#warning Pin mapping may not be configured #warning Pin mapping may not be configured

View file

@ -17,28 +17,8 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxb)); __ASSERT_NO_MSG(device_is_ready(muxb));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
#if ATMEL_SAM0_DT_SERCOM_CHECK(4, atmel_sam0_uart) && defined(CONFIG_UART_SAM0) ARG_UNUSED(muxb);
/* SERCOM4 on RX=PB9/pad 1, TX=PB8/pad 0 */
pinmux_pin_set(muxb, 9, PINMUX_FUNC_D);
pinmux_pin_set(muxb, 8, PINMUX_FUNC_D);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(1, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(3, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(5, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
#warning Pin mapping may not be configured
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && defined(CONFIG_I2C_SAM0) #if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && defined(CONFIG_I2C_SAM0)
/* SERCOM2 on SDA=PA08, SCL=PA09 */ /* SERCOM2 on SDA=PA08, SCL=PA09 */

View file

@ -53,6 +53,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pb9d_sercom4_pad1 &pb8d_sercom4_pad0>;
}; };
&sercom0 { &sercom0 {

View file

@ -15,6 +15,7 @@ static int board_pinmux_init(const struct device *dev)
__ASSERT_NO_MSG(device_is_ready(muxa)); __ASSERT_NO_MSG(device_is_ready(muxa));
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(muxa);
/* sercom 3 is always spi - it is the onboard flash */ /* sercom 3 is always spi - it is the onboard flash */
/* SPI SERCOM3 on MISO=PA18, MOSI=PA16, SCK=PA17, CS=PA15*/ /* SPI SERCOM3 on MISO=PA18, MOSI=PA16, SCK=PA17, CS=PA15*/
@ -22,7 +23,6 @@ static int board_pinmux_init(const struct device *dev)
pinmux_pin_set(muxa, 16, PINMUX_FUNC_D); pinmux_pin_set(muxa, 16, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 17, PINMUX_FUNC_D); pinmux_pin_set(muxa, 17, PINMUX_FUNC_D);
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && defined(CONFIG_SPI_SAM0) #if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && defined(CONFIG_SPI_SAM0)
/* SPI SERCOM0 on MISO=PA6, MOSI=PA4, SCK=PA5 */ /* SPI SERCOM0 on MISO=PA6, MOSI=PA4, SCK=PA5 */
pinmux_pin_set(muxa, 6, PINMUX_FUNC_D); pinmux_pin_set(muxa, 6, PINMUX_FUNC_D);
@ -30,24 +30,12 @@ static int board_pinmux_init(const struct device *dev)
pinmux_pin_set(muxa, 5, PINMUX_FUNC_D); pinmux_pin_set(muxa, 5, PINMUX_FUNC_D);
#endif #endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
/* SERCOM0 on RX=PA5, TX=PA4 */
pinmux_pin_set(muxa, 5, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 4, PINMUX_FUNC_C);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && defined(CONFIG_I2C_SAM0) #if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && defined(CONFIG_I2C_SAM0)
/* SERCOM2 on SDA=PA08, SCL=PA09 */ /* SERCOM2 on SDA=PA08, SCL=PA09 */
pinmux_pin_set(muxa, 4, PINMUX_FUNC_D); pinmux_pin_set(muxa, 4, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 5, PINMUX_FUNC_D); pinmux_pin_set(muxa, 5, PINMUX_FUNC_D);
#endif #endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
/* SERCOM0 on RX=PA9, TX=PA8 */
pinmux_pin_set(muxa, 9, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 8, PINMUX_FUNC_C);
#endif
#ifdef CONFIG_USB_DC_SAM0 #ifdef CONFIG_USB_DC_SAM0
/* USB DP on PA25, USB DM on PA24 */ /* USB DP on PA25, USB DM on PA24 */
pinmux_pin_set(muxa, 25, PINMUX_FUNC_G); pinmux_pin_set(muxa, 25, PINMUX_FUNC_G);

View file

@ -82,6 +82,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa9d_sercom2_pad1 &pa8d_sercom2_pad0>;
}; };
&sercom3 { &sercom3 {

View file

@ -51,6 +51,8 @@ struct uart_sam0_dev_cfg {
uint8_t rx_dma_request; uint8_t rx_dma_request;
uint8_t rx_dma_channel; uint8_t rx_dma_channel;
#endif #endif
uint32_t num_pins;
struct soc_port_pin pins[];
}; };
/* Device run time data */ /* Device run time data */
@ -557,6 +559,9 @@ static int uart_sam0_init(const struct device *dev)
SERCOM_USART_CTRLA_CPOL | SERCOM_USART_CTRLA_DORD; SERCOM_USART_CTRLA_CPOL | SERCOM_USART_CTRLA_DORD;
wait_synchronization(usart); wait_synchronization(usart);
/* Enable PINMUX based on PINCTRL */
soc_port_list_configure(cfg->pins, cfg->num_pins);
dev_data->config_cache.flow_ctrl = UART_CFG_FLOW_CTRL_NONE; dev_data->config_cache.flow_ctrl = UART_CFG_FLOW_CTRL_NONE;
dev_data->config_cache.parity = UART_CFG_PARITY_NONE; dev_data->config_cache.parity = UART_CFG_PARITY_NONE;
dev_data->config_cache.stop_bits = UART_CFG_STOP_BITS_1; dev_data->config_cache.stop_bits = UART_CFG_STOP_BITS_1;
@ -1215,6 +1220,8 @@ static const struct uart_sam0_dev_cfg uart_sam0_config_##n = { \
.gclk_core_id = DT_INST_CLOCKS_CELL_BY_NAME(n, gclk, periph_ch),\ .gclk_core_id = DT_INST_CLOCKS_CELL_BY_NAME(n, gclk, periph_ch),\
.pads = UART_SAM0_SERCOM_PADS(n), \ .pads = UART_SAM0_SERCOM_PADS(n), \
.collision_detect = UART_SAM0_SERCOM_PADS(n), \ .collision_detect = UART_SAM0_SERCOM_PADS(n), \
.num_pins = ATMEL_SAM0_DT_INST_NUM_PINS(n), \
.pins = ATMEL_SAM0_DT_INST_PINS(n), \
UART_SAM0_IRQ_HANDLER_FUNC(n) \ UART_SAM0_IRQ_HANDLER_FUNC(n) \
UART_SAM0_DMA_CHANNELS(n) \ UART_SAM0_DMA_CHANNELS(n) \
} }
@ -1227,6 +1234,8 @@ static const struct uart_sam0_dev_cfg uart_sam0_config_##n = { \
.gclk_clkctrl_id = DT_INST_CLOCKS_CELL_BY_NAME(n, gclk, clkctrl_id),\ .gclk_clkctrl_id = DT_INST_CLOCKS_CELL_BY_NAME(n, gclk, clkctrl_id),\
.pads = UART_SAM0_SERCOM_PADS(n), \ .pads = UART_SAM0_SERCOM_PADS(n), \
.collision_detect = UART_SAM0_SERCOM_PADS(n), \ .collision_detect = UART_SAM0_SERCOM_PADS(n), \
.num_pins = ATMEL_SAM0_DT_INST_NUM_PINS(n), \
.pins = ATMEL_SAM0_DT_INST_PINS(n), \
UART_SAM0_IRQ_HANDLER_FUNC(n) \ UART_SAM0_IRQ_HANDLER_FUNC(n) \
UART_SAM0_DMA_CHANNELS(n) \ UART_SAM0_DMA_CHANNELS(n) \
} }

View file

@ -0,0 +1,77 @@
/*
* Copyright (c) 2021 Gerson Fernando Budke
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "pinctrl_atmel_sam.h"
/ {
soc {
pinctrl@41004400 {
/* instance, signal, port, pin, peripheral [, flags] */
DT_ATMEL_PORT(sercom0, pad0, a, 4, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, a, 5, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, a, 6, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, a, 7, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad0, a, 8, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, a, 9, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, a, 10, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, a, 11, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, a, 0, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, a, 1, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, a, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, a, 31, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, a, 16, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, a, 17, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad2, a, 18, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad3, a, 19, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, a, 8, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, a, 9, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, a, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, a, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, a, 12, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, a, 13, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, a, 14, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, a, 15, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, a, 16, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, a, 17, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 18, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 19, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 20, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 21, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, a, 22, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, a, 23, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 24, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 25, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, b, 8, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 9, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, b, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, b, 12, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 13, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 14, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, b, 15, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, a, 12, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, a, 13, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, a, 14, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, a, 15, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, b, 16, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, b, 17, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, a, 20, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, a, 21, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, a, 22, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, a, 23, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, a, 24, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, a, 25, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 22, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 23, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, b, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, b, 31, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 0, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 1, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 2, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 3, d, pinmux-enable);
};
};
};

View file

@ -9,6 +9,8 @@
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/i2c/i2c.h> #include <dt-bindings/i2c/i2c.h>
#include "samd2x-pinctrl.dtsi"
/ { / {
aliases { aliases {
watchdog0 = &wdog; watchdog0 = &wdog;

View file

@ -0,0 +1,151 @@
/*
* Copyright (c) 2021 Gerson Fernando Budke
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "pinctrl_atmel_sam.h"
/ {
soc {
pinctrl@41008000 {
/* instance, signal, port, pin, peripheral [, flags] */
DT_ATMEL_PORT(sercom0, pad0, a, 8, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, a, 9, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, a, 10, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, a, 11, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad0, b, 24, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, b, 25, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, c, 24, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, c, 25, c, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad0, a, 4, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, a, 5, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, a, 6, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, a, 7, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad0, c, 17, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad1, c, 16, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad2, c, 18, d, pinmux-enable);
DT_ATMEL_PORT(sercom0, pad3, c, 19, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, a, 16, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, a, 17, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad2, a, 18, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad3, a, 19, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, c, 22, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, c, 23, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad2, d, 20, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad3, d, 21, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, c, 27, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, c, 28, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad2, b, 22, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad3, b, 23, c, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad0, a, 0, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad1, a, 1, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad2, a, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom1, pad3, a, 31, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, a, 12, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, a, 13, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, a, 14, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, a, 15, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, b, 26, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, b, 27, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, b, 28, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, b, 29, c, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, a, 8, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, a, 9, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, a, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, a, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad0, b, 24, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad1, b, 25, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad2, c, 24, d, pinmux-enable);
DT_ATMEL_PORT(sercom2, pad3, c, 25, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, a, 22, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, a, 23, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 24, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 25, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, b, 20, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, b, 21, c, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 20, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 21, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, a, 17, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, a, 16, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, a, 18, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, a, 19, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad0, c, 23, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad1, c, 22, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad2, d, 20, d, pinmux-enable);
DT_ATMEL_PORT(sercom3, pad3, d, 21, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, b, 12, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 13, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 14, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, b, 15, c, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, b, 8, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 9, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, b, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, a, 13, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, a, 12, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, a, 14, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, a, 15, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad0, b, 27, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 26, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 28, d, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, b, 29, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, b, 16, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, b, 17, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 18, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 19, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, a, 23, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, a, 22, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, a, 20, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, a, 21, c, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, a, 24, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, a, 25, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 22, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 23, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, b, 31, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, b, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad2, b, 0, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad3, b, 1, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad0, b, 2, d, pinmux-enable);
DT_ATMEL_PORT(sercom5, pad1, b, 3, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad0, c, 16, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad1, c, 17, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad2, c, 18, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad3, c, 19, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad0, c, 4, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad1, c, 5, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad2, c, 6, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad3, c, 7, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad0, d, 9, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad1, d, 8, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad2, d, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad3, d, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad0, c, 13, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad1, c, 12, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad2, c, 14, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad3, c, 15, d, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad2, c, 10, c, pinmux-enable);
DT_ATMEL_PORT(sercom6, pad3, c, 11, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad0, c, 12, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad1, c, 13, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad2, c, 14, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad3, c, 15, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad0, d, 8, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad1, d, 9, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad2, d, 10, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad3, d, 11, c, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad0, c, 12, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad1, c, 13, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad2, c, 10, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad3, c, 11, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad0, b, 21, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad1, b, 20, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad2, b, 18, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad3, b, 19, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad0, b, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad1, b, 31, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad2, a, 30, d, pinmux-enable);
DT_ATMEL_PORT(sercom7, pad3, a, 31, d, pinmux-enable);
};
};
};

View file

@ -8,6 +8,8 @@
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/i2c/i2c.h> #include <dt-bindings/i2c/i2c.h>
#include "samd5x-pinctrl.dtsi"
/ { / {
chosen { chosen {
zephyr,flash-controller = &nvmctrl; zephyr,flash-controller = &nvmctrl;

View file

@ -6,6 +6,8 @@
#include <atmel/samd2x.dtsi> #include <atmel/samd2x.dtsi>
#include "samr2x-pinctrl.dtsi"
/ { / {
aliases { aliases {
port-c = &portc; port-c = &portc;

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2021 Gerson Fernando Budke
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
soc {
pinctrl@41004400 {
/* instance, signal, port, pin, peripheral [, flags] */
DT_ATMEL_PORT(sercom4, pad0, c, 19, f, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad1, b, 31, f, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad2, b, 30, f, pinmux-enable);
DT_ATMEL_PORT(sercom4, pad3, c, 18, f, pinmux-enable);
};
};
};

View file

@ -31,6 +31,19 @@ properties:
type: boolean type: boolean
description: Enable collision detection for half-duplex mode. description: Enable collision detection for half-duplex mode.
pinctrl-0:
type: phandles
description: |
PORT pin configuration for RXD & TRD signals. We expect that
the phandles will reference pinctrl nodes. These nodes will
have a nodelabel that matches the Atmel SoC HAL defines and
be of the form p<port><pin><periph>_<inst>_<signal>.
For example the SERCOM0 on SAMR21 would be
pinctrl-0 = <&pa5d_sercom0_pad1 &pa4d_sercom0_pad0>;
required: true
dmas: dmas:
description: | description: |
Optional TX & RX dma specifiers. Each specifier will have a phandle Optional TX & RX dma specifiers. Each specifier will have a phandle

View file

@ -16,6 +16,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa5d_sercom0_pad1 &pa4d_sercom0_pad0>;
}; };
&sercom2 { &sercom2 {

View file

@ -16,6 +16,8 @@
current-speed = <115200>; current-speed = <115200>;
rxpo = <1>; rxpo = <1>;
txpo = <0>; txpo = <0>;
pinctrl-0 = <&pa5d_sercom0_pad1 &pa4d_sercom0_pad0>;
}; };
&sercom2 { &sercom2 {