From: Sean Anderson Date: Wed, 2 Sep 2020 16:43:23 -0400 Subject: [PATCH v5 10/11] riscv: Add pinmux and gpio bindings for Kendryte K210 In-Reply-To: <36d3df83-931a-8e87-8702-e96f482ccb0b@gmx.de> References: <20200815155237.467720-1-seanga2@gmail.com> <20200815155237.467720-11-seanga2@gmail.com> <36d3df83-931a-8e87-8702-e96f482ccb0b@gmx.de> Message-ID: <5a42476c-7aa2-27a3-bf50-ad2862db25c7@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 9/2/20 2:04 PM, Heinrich Schuchardt wrote: > On 15.08.20 17:52, Sean Anderson wrote: >> This patch adds the necessary device tree bindings. >> >> Signed-off-by: Sean Anderson >> Reviewed-by: Simon Glass >> --- >> >> (no changes since v2) >> >> Changes in v2: >> - Convert to use pinmux property >> - Don't hog ISP on boot >> - Re-order GPIOs to match the defaults more closely >> >> arch/riscv/dts/k210-maix-bit.dts | 104 +++++++++++++++++++++++++++++++ >> arch/riscv/dts/k210.dtsi | 12 ++++ >> 2 files changed, 116 insertions(+) >> >> diff --git a/arch/riscv/dts/k210-maix-bit.dts b/arch/riscv/dts/k210-maix-bit.dts >> index 5b32c5fd5f..e840e04ada 100644 >> --- a/arch/riscv/dts/k210-maix-bit.dts >> +++ b/arch/riscv/dts/k210-maix-bit.dts >> @@ -17,6 +17,22 @@ >> stdout-path = "serial0:115200"; >> }; >> >> + gpio-leds { >> + compatible = "gpio-leds"; >> + >> + green { >> + gpios = <&gpio1_0 4 GPIO_ACTIVE_LOW>; >> + }; >> + >> + red { >> + gpios = <&gpio1_0 5 GPIO_ACTIVE_LOW>; >> + }; >> + >> + blue { >> + gpios = <&gpio1_0 6 GPIO_ACTIVE_LOW>; >> + }; >> + }; >> + >> sound { >> compatible = "simple-audio-card"; >> simple-audio-card,format = "i2s"; >> @@ -39,9 +55,97 @@ >> }; >> >> &uarths0 { >> + pinctrl-0 = <&fpioa_uarths>; >> + pinctrl-names = "default"; >> + status = "okay"; >> +}; >> + >> +&gpio0 { >> + pinctrl-0 = <&fpioa_gpiohs>; >> + pinctrl-names = "default"; >> + status = "okay"; >> +}; >> + >> +&gpio1 { >> + pinctrl-0 = <&fpioa_gpio>; >> + pinctrl-names = "default"; >> status = "okay"; >> }; >> >> &i2s0 { >> #sound-dai-cells = <1>; >> + pinctrl-0 = <&fpioa_i2s0>; >> + pinctrl-names = "default"; >> +}; >> + >> +&fpioa { >> + status = "okay"; >> + >> + fpioa_uarths: uarths { >> + pinmux = , >> + ; >> + }; >> + >> + fpioa_gpio: gpio { >> + pinmux = , >> + , >> + , >> + , >> + , >> + , >> + , >> + ; > > On the Maixduino the K210 package pins IO_6 - IO_9, IO_25 - IO_29 serve > as interface to the ESP32 which is used for WLAN. In the schema for the > Maixduino the naming is: > > IO_6 - ESP32_TX > IO_7 - ESP32_RX > IO_8 - ESP32_EN > IO_9 - ESP32_READY > > IO_6 and IO_7 are not mapped in reset state and in a Python example I > found for connecting to a WLAN these lines were not used. > > If the usage of IO_8 and IO_9 differs between the Maixduino and the Maix > Bit, shouldn't they be mapped in k210-maix-bit.dts instead of k210.dtsi? These *are* in k210-maix-bit.dts. > > According to https://github.com/sipeed/MaixPy/issues/127 one of the SPI > interfaces is switched between SD-card and WLAN. The ESP32 connection > uses gpiohs while the SD card does not. > >> + }; >> + >> + fpioa_gpiohs: gpiohs { >> + pinmux = , > > IO_16 is connected to the boot button on the Maixduino and Maix Fit > boards. So I guess we should add an entry compatible = "gpio-keys" for > it and add a comment here. I saw you created a patch for this [1]. Would you like to keep that separate, or should I add it to this series? [1] https://patchwork.ozlabs.org/project/uboot/patch/20200902201159.98034-1-xypron.glpk at gmx.de/ >> + , >> + , >> + , >> + , >> + , >> + , >> + , >> + , >> + , >> + , >> + , >> + ; >> + }; >> + >> + fpioa_i2s0: i2s0 { >> + pinmux = , >> + , >> + ; >> + }; >> + >> + fpioa_dvp: dvp { >> + pinmux = , > > DVP_SDA in 'Maix-Bit-V2.0(Pin assignment table.xlsx' > >> + , > > DVP_SCL > >> + , > > DVP_RST > >> + , > > DVP_VSYNC > >> + , > > DVP_PWDN > >> + , > > DVP_HSYNC > >> + , > > DVP_XCLK > >> + ; > > DVP_PCLK > >> + }; >> + >> + fpioa_spi0: spi0 { >> + pinmux = , /* cs */ > > LCD_CS in 'Maix-Bit-V2.0(Pin assignment table.xlsx' > >> + , /* rst */ > > LCD_RST > >> + , /* dc */ > > LCD_DC > >> + ; /* wr */ > > LCD_WR > > Should the comments be updated to reflect the connection to LCD? Sure. >> + }; >> + >> + fpioa_spi1: spi1 { >> + pinmux = , > > SPI0 MISO in 'Maix-Bit-V2.0(Pin assignment table.xlsx' > >> + , > > SPI0 SCLK > >> + , > > SPI0 MOSI > >> + ; > > SPI0_CS0 > > Should we add comments? I will add some for this spi in the next revision. > > Best regards > > Heinrich > >> + }; >> +}; >> + >> +&dvp0 { >> + pinctrl-0 = <&fpioa_dvp>; >> + pinctrl-names = "default"; >> }; >> diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi >> index 2546c7d4e0..fc7986b326 100644 >> --- a/arch/riscv/dts/k210.dtsi >> +++ b/arch/riscv/dts/k210.dtsi >> @@ -5,6 +5,7 @@ >> >> #include >> #include >> +#include >> #include >> >> / { >> @@ -367,7 +368,18 @@ >> reg = <0x502B0000 0x100>; >> clocks = <&sysclk K210_CLK_FPIOA>; >> resets = <&sysrst K210_RST_FPIOA>; >> + kendryte,sysctl = <&sysctl>; >> + kendryte,power-offset = ; >> + pinctrl-0 = <&fpioa_jtag>; >> + pinctrl-names = "default"; >> status = "disabled"; >> + >> + fpioa_jtag: jtag { >> + pinmux = , >> + , >> + , >> + ; >> + }; >> }; >> >> sha256: sha256 at 502C0000 { >> >