From 5e0e2a5bdcca315e79e0dab0fbdcfaa2c94ac445 Mon Sep 17 00:00:00 2001 From: Andrii Pientsov Date: Tue, 30 Nov 2021 17:40:50 +0200 Subject: Update mtcdt.dts for MTCDT-0.2 --- recipes-kernel/linux/linux-at91-5.4.81/mt-at91.h | 19 +++ .../linux/linux-at91-5.4.81/mts-dts/mtcdt.dts | 160 +++++++++++++++------ recipes-kernel/linux/linux-at91_5.4.81.bb | 2 + 3 files changed, 136 insertions(+), 45 deletions(-) create mode 100644 recipes-kernel/linux/linux-at91-5.4.81/mt-at91.h diff --git a/recipes-kernel/linux/linux-at91-5.4.81/mt-at91.h b/recipes-kernel/linux/linux-at91-5.4.81/mt-at91.h new file mode 100644 index 0000000..36fba62 --- /dev/null +++ b/recipes-kernel/linux/linux-at91-5.4.81/mt-at91.h @@ -0,0 +1,19 @@ +#ifndef _DT_BINDINGS_GPIO_MT_AT91_H +#define _DT_BINDINGS_GPIO_MT_AT91_H +/* + * Device tree explicit phandles + * for overlays. First four are AT91. + * Kernel must know about this to + * build the device tree. Overlay + * recipe needs this to find the + * GPIO stanza phandle. + */ + +#define GPIO0_PH 0xffff0000 +#define GPIO1_PH 0xffff0001 +#define GPIO2_PH 0xffff0002 +#define GPIO3_PH 0xffff0003 +#define GPIO4_PCA9557_PH 0xffff0004 +#define GPIO5_PCA9557_PH 0xffff0005 + +#endif diff --git a/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts b/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts index 31b4fab..b7f05c4 100644 --- a/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts @@ -15,6 +15,7 @@ #include #include #include +#include / { @@ -26,9 +27,9 @@ aliases { serial0 = &dbgu; - serial1 = &usart0; - serial2 = &usart1; - serial3 = &usart2; + serial2 = &usart1; // AP1 serial on MTCDT-0.2 + serial4 = &usart3; // AP2 serial on MTCDT-0.2 + serial5 = &uart0; // GNSS on MTCDT-0.2 gpio0 = &pioA; gpio1 = &pioB; gpio2 = &pioC; @@ -371,6 +372,21 @@ atmel,pins = ; /* PC29 periph C */ }; + + pinctrl_usart1_rng: usart1_rng-0 { + atmel,pins = + ; + }; + + pinctrl_usart1_dcd: usart1_dcd-0 { + atmel,pins = + ; + }; + + pinctrl_usart1_dtr: usart1_dtr-0 { + atmel,pins = + ; + }; }; usart2 { @@ -417,6 +433,21 @@ atmel,pins = ; /* PC26 periph B */ }; + + pinctrl_usart3_rng: usart3_rng-0 { + atmel,pins = + ; + }; + + pinctrl_usart3_dcd: usart3_dcd-0 { + atmel,pins = + ; + }; + + pinctrl_usart3_dtr: usart3_dtr-0 { + atmel,pins = + ; + }; }; uart0 { @@ -454,25 +485,27 @@ }; mts-io { - pinctrl_mts_io_out: mts_io-0 { + pinctrl_mts_io_out: mts_io-0 { + // gpio4 and gpio5 are reset in at91bootstrap. They should not be touched in Linux. atmel,pins = - ; /* PD18 USB Hub reset */ - output-high; - }; - pinctrl_mts_io_in: mts_io-1 { + ; /* PD18 USB Hub reset */ + output-high; // ignored by at91_pinctrl + }; + pinctrl_mts_io_in: mts_io-1 { atmel,pins = ; /* PD20 WiFi_BT_LPMode Input */ - }; - pinctrl_mts_io_gnss: mts_io-2 { + }; + // GNSS kept in reset to prevent EXAR from hanging + pinctrl_mts_io_gnss: mts_io-2 { atmel,pins = - ; /* PD15 N_GNSS_RESET */ - output-low; - }; + ; /* PD15 N_GNSS_RESET */ + output-low; // ignored by at91_pinctrl + }; }; mmc0 { @@ -738,6 +771,8 @@ interrupt-controller; #interrupt-cells = <2>; clocks = <&pmc PMC_TYPE_PERIPHERAL 2>; + phandle = ; + phandle,linux = ; }; pioB: gpio@fffff600 { @@ -750,6 +785,8 @@ interrupt-controller; #interrupt-cells = <2>; clocks = <&pmc PMC_TYPE_PERIPHERAL 2>; + phandle = ; + phandle,linux = ; }; pioC: gpio@fffff800 { @@ -761,6 +798,8 @@ interrupt-controller; #interrupt-cells = <2>; clocks = <&pmc PMC_TYPE_PERIPHERAL 3>; + phandle = ; + phandle,linux = ; }; pioD: gpio@fffffa00 { @@ -773,6 +812,8 @@ interrupt-controller; #interrupt-cells = <2>; clocks = <&pmc PMC_TYPE_PERIPHERAL 3>; + phandle = ; + phandle,linux = ; }; }; @@ -900,6 +941,11 @@ clocks = <&pmc PMC_TYPE_PERIPHERAL 6>; clock-names = "usart"; status = "disabled"; + atmel,use-dma-rx; + atmel,use-dma-tx; + rng-gpios = <&pioA 27 GPIO_ACTIVE_LOW>; + dcd-gpios = <&pioA 26 GPIO_ACTIVE_LOW>; + dtr-gpios = <&pioA 25 GPIO_ACTIVE_LOW>; }; usart2: serial@f8024000 { @@ -928,6 +974,11 @@ clocks = <&pmc PMC_TYPE_PERIPHERAL 8>; clock-names = "usart"; status = "disabled"; + atmel,use-dma-rx; + atmel,use-dma-tx; + rng-gpios = <&pioC 14 GPIO_ACTIVE_LOW>; + dcd-gpios = <&pioC 13 GPIO_ACTIVE_LOW>; + dtr-gpios = <&pioC 12 GPIO_ACTIVE_LOW>; }; uart0: serial@f8040000 { @@ -936,11 +987,14 @@ interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0>; + dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(11)>, + <&dma0 1 (AT91_DMA_CFG_PER_ID(12) | AT91_DMA_CFG_FIFOCFG_ASAP)>; + dma-names = "tx", "rx"; clocks = <&pmc PMC_TYPE_PERIPHERAL 15>; clock-names = "usart"; atmel,use-dma-rx; atmel,use-dma-tx; - status = "okay"; + status = "disabled"; }; uart1: serial@f8044000 { @@ -1294,6 +1348,36 @@ /* tempsensor_alert line running to pin PC19 on processor set up an interrupt for this? */ }; + + /* gpio0 through gpio3 are integrated into the SAM9G25 and defined + * in at91sam9x5.dtsi + * pioA == gpio0 + * pioB == gpio1 + * pioC == gpio2 + * pioC == gpio3 + * gpio4 and gpio5 for MTCDT-0.2 follow: + */ + gpio4: pca9557@18 { + compatible = "nxp,pca9557"; + reg = <0x18>; + gpio-controller; + #gpio-cells = <2>; + vcc-supply = <&dummy_reg>; + phandle = ; + phandle,linux = ; + // gpio-base = <128>; + }; + + gpio5: pca9557@19 { + compatible = "nxp,pca9557"; + reg = <0x19>; + gpio-controller; + #gpio-cells = <2>; + vcc-supply = <&dummy_reg>; + phandle = ; + phandle,linux = ; + // gpio-base = <136>; + }; }; i2c-gpio-1 { @@ -1344,38 +1428,17 @@ status = "okay"; compatible = "mts,mts-io"; pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_mts_io_out>; - pinctrl-1 = <&pinctrl_mts_io_in>; - pinctrl-2 = <&pinctrl_mts_io_gnss>; + pinctrl-0 = <&pinctrl_mts_io_out>, <&pinctrl_mts_io_in>, <&pinctrl_mts_io_gnss>; }; leds { compatible = "gpio-leds"; + status = "disabled"; - pa24 { - label = "led-status"; - gpios = <&pioA 24 GPIO_ACTIVE_LOW>; - linux,default-trigger = "default-on"; - }; - - pa25 { - label = "led-a"; - gpios = <&pioA 25 GPIO_ACTIVE_LOW>; - }; - - pa26 { - label = "led-b"; - gpios = <&pioA 26 GPIO_ACTIVE_LOW>; - }; - - pa27 { - label = "led-c"; - gpios = <&pioA 27 GPIO_ACTIVE_LOW>; - }; - - pa28 { - label = "led-d"; - gpios = <&pioA 28 GPIO_ACTIVE_LOW>; + led-status { + label = "led-status"; // LED2 + gpios = <&pioA 24 GPIO_ACTIVE_LOW>; // All + linux,default-trigger = "default-on"; }; }; @@ -1395,4 +1458,11 @@ pinctrl-0 = <&pinctrl_1wire_cm>; status = "disabled"; }; + + /* pca953x driver wants a regulator + * This dummy regulator prevents warnings */ + dummy_reg: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "dummy-supply"; + }; }; diff --git a/recipes-kernel/linux/linux-at91_5.4.81.bb b/recipes-kernel/linux/linux-at91_5.4.81.bb index f742ed7..f57d418 100644 --- a/recipes-kernel/linux/linux-at91_5.4.81.bb +++ b/recipes-kernel/linux/linux-at91_5.4.81.bb @@ -45,6 +45,7 @@ COMMON_PATCHES = " \ file://linux-5.4-OF-DT-Overlay-configfs-interface.patch \ file://linux-5.4-revert-net-macb-Properly-handle-phylink-on-at91rm9200.patch \ file://linux-5.4-bring-back-PAE-bit-and-fix-NCFGR-values-applicable-f.patch \ + file://mt-at91.h \ " SRC_URI_append_mtcdt = "\ @@ -77,6 +78,7 @@ python __anonymous () { copy_mts_dts_files () { # Install MTS device tree files cp -f ${THISDIR}/linux-at91-5.4.81/mts-dts/${MACHINE}.dts ${S}/arch/${ARCH}/boot/dts/ + cp -f ${THISDIR}/linux-at91-5.4.81/mt-at91.h ${S}/include/dt-bindings/gpio } python do_unpack_append () { -- cgit v1.2.3