From 9f9ee4816aa768dbfcb3b262f11cfa206a10ca15 Mon Sep 17 00:00:00 2001 From: Jisheng Zhang Date: Tue, 18 Jan 2022 23:06:43 +0800 Subject: [PATCH] sunxi: Add a U-Boot port for the Lichee RV and its dock Signed-off-by: Jisheng Zhang [Samuel: licheepi -> lichee; drop DRAM size; other changes] Signed-off-by: Samuel Holland --- arch/riscv/dts/Makefile | 5 +- arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts | 165 ++++++++++++++++++++ arch/riscv/dts/sun20i-d1-lichee-rv.dts | 88 +++++++++++ configs/lichee_rv_defconfig | 24 +++ 4 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv.dts create mode 100644 configs/lichee_rv_defconfig diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile index 524ce14169c..27c4e2d6476 100644 --- a/arch/riscv/dts/Makefile +++ b/arch/riscv/dts/Makefile @@ -7,7 +7,10 @@ dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb -dtb-$(CONFIG_TARGET_SUNXI) += sun20i-d1-nezha.dtb +dtb-$(CONFIG_TARGET_SUNXI) += \ + sun20i-d1-lichee-rv.dtb \ + sun20i-d1-lichee-rv-dock.dtb \ + sun20i-d1-nezha.dtb include $(srctree)/scripts/Makefile.dts diff --git a/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts new file mode 100644 index 00000000000..0b0f356e2e5 --- /dev/null +++ b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) +// Copyright (C) 2022 Jisheng Zhang +// Copyright (C) 2022 Samuel Holland + +#include + +#include "sun20i-d1-lichee-rv.dts" + +/ { + model = "Sipeed Lichee RV Dock"; + compatible = "sipeed,lichee-rv-dock", "sipeed,lichee-rv", + "allwinner,sun20i-d1"; + + aliases { + mmc1 = &mmc1; + }; + + dmic-card { + compatible = "simple-audio-card"; + #address-cells = <1>; + #size-cells = <0>; + + simple-audio-card,dai-link@0 { + format = "pdm"; + frame-master = <&link0_cpu>; + bitclock-master = <&link0_cpu>; + + link0_cpu: cpu { + sound-dai = <&dmic>; + }; + + link0_codec: codec { + sound-dai = <&dmic_codec>; + }; + }; + }; + + dmic_codec: dmic-codec { + compatible = "dmic-codec"; + num-channels = <2>; + #sound-dai-cells = <0>; + }; + + hdmi_connector: connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&gpio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ + }; +}; + +&codec { + allwinner,routing = "Internal Speaker", "HPOUTL", + "Internal Speaker", "HPOUTR", + "LINEINL", "HPOUTL", + "LINEINR", "HPOUTR", + "MICIN3", "Internal Microphone", + "Internal Microphone", "HBIAS"; + allwinner,widgets = "Microphone", "Internal Microphone", + "Speaker", "Internal Speaker"; + status = "okay"; +}; + +&de { + status = "okay"; +}; + +&dmic { + pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>; + pinctrl-names = "default"; + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&gpio { + dmic_pb11_d0_pin: dmic-pb11-d0-pin { + pins = "PB11"; + function = "dmic"; + }; + + dmic_pe17_clk_pin: dmic-pe17-clk-pin { + pins = "PE17"; + function = "dmic"; + }; + + ledc_pc0_pin: ledc-pc0-pin { + pins = "PC0"; + function = "ledc"; + }; +}; + +&hdmi { + status = "okay"; + + port { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; + }; +}; + +&hdmi_phy { + status = "okay"; +}; + +&ledc { + pinctrl-0 = <&ledc_pc0_pin>; + pinctrl-names = "default"; + status = "okay"; + + led@0 { + reg = <0x0>; + color = ; + function = LED_FUNCTION_STATUS; + }; +}; + +&lradc { + wakeup-source; + status = "okay"; + + button-220 { + label = "OK"; + linux,code = ; + channel = <0>; + voltage = <220000>; + }; +}; + +&mmc1 { + bus-width = <4>; + mmc-pwrseq = <&wifi_pwrseq>; + non-removable; + vmmc-supply = <®_vcc_3v3>; + vqmmc-supply = <®_vcc_3v3>; + pinctrl-0 = <&mmc1_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&uart1 { + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usbphy { + usb1_vbus-supply = <®_vcc>; +}; diff --git a/arch/riscv/dts/sun20i-d1-lichee-rv.dts b/arch/riscv/dts/sun20i-d1-lichee-rv.dts new file mode 100644 index 00000000000..58405d2d6ad --- /dev/null +++ b/arch/riscv/dts/sun20i-d1-lichee-rv.dts @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) +// Copyright (C) 2022 Jisheng Zhang +// Copyright (C) 2022 Samuel Holland + +/dts-v1/; + +#include +#include + +#include "sun20i-d1.dtsi" +#include "sun20i-d1-common-regulators.dtsi" + +/ { + model = "Sipeed Lichee RV"; + compatible = "sipeed,lichee-rv", "allwinner,sun20i-d1"; + + aliases { + mmc0 = &mmc0; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + function = LED_FUNCTION_STATUS; + gpios = <&gpio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */ + }; + }; + + reg_vdd_cpu: vdd-cpu { + compatible = "regulator-fixed"; + regulator-name = "vdd-cpu"; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <®_vcc>; + }; +}; + +&cpu0 { + cpu-supply = <®_vdd_cpu>; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + broken-cd; + bus-width = <4>; + disable-wp; + vmmc-supply = <®_vcc_3v3>; + vqmmc-supply = <®_vcc_3v3>; + pinctrl-0 = <&mmc0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&spi0 { + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&uart0 { + pinctrl-0 = <&uart0_pb8_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_vbus-supply = <®_vcc>; + usb0_vbus_det-gpios = <&gpio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ + status = "okay"; +}; diff --git a/configs/lichee_rv_defconfig b/configs/lichee_rv_defconfig new file mode 100644 index 00000000000..ad41d2c5faa --- /dev/null +++ b/configs/lichee_rv_defconfig @@ -0,0 +1,24 @@ +CONFIG_RISCV=y +CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-lichee-rv" +CONFIG_TARGET_SUNXI=y +CONFIG_ARCH_RV64I=y +CONFIG_RISCV_SMODE=y +# CONFIG_SPL_SMP is not set +CONFIG_SYS_LOAD_ADDR=0x4a000000 +CONFIG_CMD_CLK=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_LSBLK=y +CONFIG_CMD_SPI=y +CONFIG_CMD_WDT=y +CONFIG_CMD_TIMER=y +CONFIG_CMD_REGULATOR=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_SPI=y +CONFIG_USB=y +CONFIG_DM_USB_GADGET=y +CONFIG_USB_MUSB_GADGET=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_USB_FUNCTION_MASS_STORAGE=y