All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/3] amlogic: Add support for Odroid-N2
@ 2019-07-22  9:48 ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
with the following specifications:

 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
 - 4GB DDR4 SDRAM
 - Gigabit Ethernet
 - HDMI 2.1 4K/60Hz display
 - 40-pin GPIO header
 - 4 x USB 3.0 Host, 1 x USB OTG
 - eMMC, microSD
 - Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design
of Amlogic G12B with Gigabit boards, which will be used for similar
boards.

Neil Armstrong (3):
  ARM: dts: add support for Odroid-N2
  ARM: meson-g12a: Handle 4GiB DRAM size
  board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h

-- 
2.22.0

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 0/3] amlogic: Add support for Odroid-N2
@ 2019-07-22  9:48 ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot; +Cc: u-boot-amlogic, Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
with the following specifications:

 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
 - 4GB DDR4 SDRAM
 - Gigabit Ethernet
 - HDMI 2.1 4K/60Hz display
 - 40-pin GPIO header
 - 4 x USB 3.0 Host, 1 x USB OTG
 - eMMC, microSD
 - Infrared receiver

This patchset :
- adds the Odroid-N2 from Linux 5.3-rc1
- fixes 4GiB memory support
- adds board support

The board directory is W400, the name of the Amlogic Reference Design
of Amlogic G12B with Gigabit boards, which will be used for similar
boards.

Neil Armstrong (3):
  ARM: dts: add support for Odroid-N2
  ARM: meson-g12a: Handle 4GiB DRAM size
  board: amlogic: add support for Odroid-N2

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 arch/arm/mach-meson/board-g12a.c              |  13 +-
 board/amlogic/w400/MAINTAINERS                |   6 +
 board/amlogic/w400/Makefile                   |   6 +
 board/amlogic/w400/README.odroid-n2           | 130 ++++++
 board/amlogic/w400/README.w400                | 130 ++++++
 board/amlogic/w400/w400.c                     |  18 +
 configs/odroid-n2_defconfig                   |  56 +++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 11 files changed, 836 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h

-- 
2.22.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/3] ARM: dts: add support for Odroid-N2
  2019-07-22  9:48 ` Neil Armstrong
@ 2019-07-22  9:48   ` Neil Armstrong
  -1 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot

Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 4 files changed, 483 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f5535078c7..2baa368215 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -135,7 +135,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxl-s905x-khadas-vim.dtb \
 	meson-gxm-khadas-vim2.dtb \
 	meson-axg-s400.dtb \
-	meson-g12a-u200.dtb
+	meson-g12a-u200.dtb \
+	meson-g12b-odroid-n2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-g12b-odroid-n2.dts b/arch/arm/dts/meson-g12b-odroid-n2.dts
new file mode 100644
index 0000000000..81780ffcc7
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-odroid-n2.dts
@@ -0,0 +1,386 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+/dts-v1/;
+
+#include "meson-g12b.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+
+/ {
+	compatible = "hardkernel,odroid-n2", "amlogic,g12b";
+	model = "Hardkernel ODROID-N2";
+
+	aliases {
+		serial0 = &uart_AO;
+		ethernet0 = &ethmac;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x40000000>;
+	};
+
+	emmc_pwrseq: emmc-pwrseq {
+		compatible = "mmc-pwrseq-emmc";
+		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		blue {
+			label = "n2:blue";
+			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "heartbeat";
+		};
+	};
+
+	tflash_vdd: regulator-tflash_vdd {
+		compatible = "regulator-fixed";
+
+		regulator-name = "TFLASH_VDD";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+
+		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	tf_io: gpio-regulator-tf_io {
+		compatible = "regulator-gpio";
+
+		regulator-name = "TF_IO";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+
+		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+		gpios-states = <0>;
+
+		states = <3300000 0
+			  1800000 1>;
+	};
+
+	flash_1v8: regulator-flash_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "FLASH_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	main_12v: regulator-main_12v {
+		compatible = "regulator-fixed";
+		regulator-name = "12V";
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+		regulator-always-on;
+	};
+
+	vcc_5v: regulator-vcc_5v {
+		compatible = "regulator-fixed";
+		regulator-name = "5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+		vin-supply = <&main_12v>;
+	};
+
+	vcc_1v8: regulator-vcc_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	vcc_3v3: regulator-vcc_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+		/* FIXME: actually controlled by VDDCPU_B_EN */
+	};
+
+	hub_5v: regulator-hub_5v {
+		compatible = "regulator-fixed";
+		regulator-name = "HUB_5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_5v>;
+
+		/* Connected to the Hub CHIPENABLE, LOW sets low power state */
+		gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	usb_pwr_en: regulator-usb_pwr_en {
+		compatible = "regulator-fixed";
+		regulator-name = "USB_PWR_EN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_5v>;
+
+		/* Connected to the microUSB port power enable */
+		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	vddao_1v8: regulator-vddao_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+	};
+
+	vddao_3v3: regulator-vddao_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&main_12v>;
+		regulator-always-on;
+	};
+
+	hdmi-connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&hdmi_tx_tmds_out>;
+			};
+		};
+	};
+
+	sound {
+		compatible = "amlogic,axg-sound-card";
+		model = "G12A-ODROIDN2";
+		audio-aux-devs = <&tdmout_b>;
+		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
+				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
+				"TDM_B Playback", "TDMOUT_B OUT";
+
+		assigned-clocks = <&clkc CLKID_MPLL2>,
+				  <&clkc CLKID_MPLL0>,
+				  <&clkc CLKID_MPLL1>;
+		assigned-clock-parents = <0>, <0>, <0>;
+		assigned-clock-rates = <294912000>,
+				       <270950400>,
+				       <393216000>;
+		status = "okay";
+
+		dai-link-0 {
+			sound-dai = <&frddr_a>;
+		};
+
+		dai-link-1 {
+			sound-dai = <&frddr_b>;
+		};
+
+		dai-link-2 {
+			sound-dai = <&frddr_c>;
+		};
+
+		/* 8ch hdmi interface */
+		dai-link-3 {
+			sound-dai = <&tdmif_b>;
+			dai-format = "i2s";
+			dai-tdm-slot-tx-mask-0 = <1 1>;
+			dai-tdm-slot-tx-mask-1 = <1 1>;
+			dai-tdm-slot-tx-mask-2 = <1 1>;
+			dai-tdm-slot-tx-mask-3 = <1 1>;
+			mclk-fs = <256>;
+
+			codec {
+				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+			};
+		};
+
+		/* hdmi glue */
+		dai-link-4 {
+			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+			codec {
+				sound-dai = <&hdmi_tx>;
+			};
+		};
+	};
+};
+
+&arb {
+	status = "okay";
+};
+
+&cec_AO {
+	pinctrl-0 = <&cec_ao_a_h_pins>;
+	pinctrl-names = "default";
+	status = "disabled";
+	hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+	pinctrl-0 = <&cec_ao_b_h_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+	hdmi-phandle = <&hdmi_tx>;
+};
+
+&clkc_audio {
+	status = "okay";
+};
+
+&ext_mdio {
+	external_phy: ethernet-phy at 0 {
+		/* Realtek RTL8211F (0x001cc916) */	
+		reg = <0>;
+		max-speed = <1000>;
+
+		reset-assert-us = <10000>;
+		reset-deassert-us = <30000>;
+		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+
+		interrupt-parent = <&gpio_intc>;
+		/* MAC_INTR on GPIOZ_14 */
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
+&ethmac {
+	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&external_phy>;
+	amlogic,tx-delay-ns = <2>;
+};
+
+&frddr_a {
+	status = "okay";
+};
+
+&frddr_b {
+	status = "okay";
+};
+
+&frddr_c {
+	status = "okay";
+};
+
+&gpio {
+	/*
+	 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
+	 * to be turned high in order to be detected by the USB Controller
+	 * This signal should be handled by a USB specific power sequence
+	 * in order to reset the Hub when USB bus is powered down.
+	 */
+	usb-hub {
+		gpio-hog;
+		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "usb-hub-reset";
+	};
+};
+
+&hdmi_tx {
+	status = "okay";
+	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+	pinctrl-names = "default";
+	hdmi-supply = <&vcc_5v>;
+};
+
+&hdmi_tx_tmds_port {
+	hdmi_tx_tmds_out: endpoint {
+		remote-endpoint = <&hdmi_connector_in>;
+	};
+};
+
+&ir {
+	status = "okay";
+	pinctrl-0 = <&remote_input_ao_pins>;
+	pinctrl-names = "default";
+};
+
+/* SD card */
+&sd_emmc_b {
+	status = "okay";
+	pinctrl-0 = <&sdcard_c_pins>;
+	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+	pinctrl-names = "default", "clk-gate";
+
+	bus-width = <4>;
+	cap-sd-highspeed;
+	max-frequency = <50000000>;
+	disable-wp;
+
+	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+	vmmc-supply = <&tflash_vdd>;
+	vqmmc-supply = <&tf_io>;
+
+};
+
+/* eMMC */
+&sd_emmc_c {
+	status = "okay";
+	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
+
+	bus-width = <8>;
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	mmc-hs200-1_8v;
+	max-frequency = <200000000>;
+	disable-wp;
+
+	mmc-pwrseq = <&emmc_pwrseq>;
+	vmmc-supply = <&vcc_3v3>;
+	vqmmc-supply = <&flash_1v8>;
+};
+
+&tdmif_b {
+	status = "okay";
+};
+
+&tdmout_b {
+	status = "okay";
+};
+
+&tohdmitx {
+	status = "okay";
+};
+
+&uart_AO {
+	status = "okay";
+	pinctrl-0 = <&uart_ao_a_pins>;
+	pinctrl-names = "default";
+};
+
+&usb {
+	status = "okay";
+	vbus-supply = <&usb_pwr_en>;
+};
+
+&usb2_phy0 {
+	phy-supply = <&vcc_5v>;
+};
+
+&usb2_phy1 {
+	/* Enable the hub which is connected to this port */
+	phy-supply = <&hub_5v>;
+};
diff --git a/arch/arm/dts/meson-g12b.dtsi b/arch/arm/dts/meson-g12b.dtsi
new file mode 100644
index 0000000000..9e88e513b2
--- /dev/null
+++ b/arch/arm/dts/meson-g12b.dtsi
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-g12a.dtsi"
+
+/ {
+	compatible = "amlogic,g12b";
+
+	cpus {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+
+				core1 {
+					cpu = <&cpu1>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu100>;
+				};
+
+				core1 {
+					cpu = <&cpu101>;
+				};
+
+				core2 {
+					cpu = <&cpu102>;
+				};
+
+				core3 {
+					cpu = <&cpu103>;
+				};
+			};
+		};
+
+		/delete-node/ cpu at 2;
+		/delete-node/ cpu at 3;
+
+		cpu100: cpu at 100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x100>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu101: cpu at 101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x101>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu102: cpu at 102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x102>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu103: cpu at 103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x103>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+	};
+};
+
+&clkc {
+	compatible = "amlogic,g12b-clkc";
+};
diff --git a/include/dt-bindings/sound/meson-g12a-tohdmitx.h b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
new file mode 100644
index 0000000000..c5e1f48d30
--- /dev/null
+++ b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_MESON_G12A_TOHDMITX_H
+#define __DT_MESON_G12A_TOHDMITX_H
+
+#define TOHDMITX_I2S_IN_A	0
+#define TOHDMITX_I2S_IN_B	1
+#define TOHDMITX_I2S_IN_C	2
+#define TOHDMITX_I2S_OUT	3
+#define TOHDMITX_SPDIF_IN_A	4
+#define TOHDMITX_SPDIF_IN_B	5
+#define TOHDMITX_SPDIF_OUT	6
+
+#endif /* __DT_MESON_G12A_TOHDMITX_H */
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 1/3] ARM: dts: add support for Odroid-N2
@ 2019-07-22  9:48   ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot; +Cc: u-boot-amlogic, Neil Armstrong

Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
 arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
 .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
 4 files changed, 483 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
 create mode 100644 arch/arm/dts/meson-g12b.dtsi
 create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f5535078c7..2baa368215 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -135,7 +135,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
 	meson-gxl-s905x-khadas-vim.dtb \
 	meson-gxm-khadas-vim2.dtb \
 	meson-axg-s400.dtb \
-	meson-g12a-u200.dtb
+	meson-g12a-u200.dtb \
+	meson-g12b-odroid-n2.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
diff --git a/arch/arm/dts/meson-g12b-odroid-n2.dts b/arch/arm/dts/meson-g12b-odroid-n2.dts
new file mode 100644
index 0000000000..81780ffcc7
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-odroid-n2.dts
@@ -0,0 +1,386 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+/dts-v1/;
+
+#include "meson-g12b.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
+
+/ {
+	compatible = "hardkernel,odroid-n2", "amlogic,g12b";
+	model = "Hardkernel ODROID-N2";
+
+	aliases {
+		serial0 = &uart_AO;
+		ethernet0 = &ethmac;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x0 0x0 0x40000000>;
+	};
+
+	emmc_pwrseq: emmc-pwrseq {
+		compatible = "mmc-pwrseq-emmc";
+		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		blue {
+			label = "n2:blue";
+			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "heartbeat";
+		};
+	};
+
+	tflash_vdd: regulator-tflash_vdd {
+		compatible = "regulator-fixed";
+
+		regulator-name = "TFLASH_VDD";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+
+		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	tf_io: gpio-regulator-tf_io {
+		compatible = "regulator-gpio";
+
+		regulator-name = "TF_IO";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+
+		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+		gpios-states = <0>;
+
+		states = <3300000 0
+			  1800000 1>;
+	};
+
+	flash_1v8: regulator-flash_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "FLASH_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	main_12v: regulator-main_12v {
+		compatible = "regulator-fixed";
+		regulator-name = "12V";
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+		regulator-always-on;
+	};
+
+	vcc_5v: regulator-vcc_5v {
+		compatible = "regulator-fixed";
+		regulator-name = "5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+		vin-supply = <&main_12v>;
+	};
+
+	vcc_1v8: regulator-vcc_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	vcc_3v3: regulator-vcc_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+		/* FIXME: actually controlled by VDDCPU_B_EN */
+	};
+
+	hub_5v: regulator-hub_5v {
+		compatible = "regulator-fixed";
+		regulator-name = "HUB_5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_5v>;
+
+		/* Connected to the Hub CHIPENABLE, LOW sets low power state */
+		gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	usb_pwr_en: regulator-usb_pwr_en {
+		compatible = "regulator-fixed";
+		regulator-name = "USB_PWR_EN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_5v>;
+
+		/* Connected to the microUSB port power enable */
+		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
+		enable-active-high;
+	};
+
+	vddao_1v8: regulator-vddao_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+	};
+
+	vddao_3v3: regulator-vddao_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&main_12v>;
+		regulator-always-on;
+	};
+
+	hdmi-connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = <&hdmi_tx_tmds_out>;
+			};
+		};
+	};
+
+	sound {
+		compatible = "amlogic,axg-sound-card";
+		model = "G12A-ODROIDN2";
+		audio-aux-devs = <&tdmout_b>;
+		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
+				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
+				"TDM_B Playback", "TDMOUT_B OUT";
+
+		assigned-clocks = <&clkc CLKID_MPLL2>,
+				  <&clkc CLKID_MPLL0>,
+				  <&clkc CLKID_MPLL1>;
+		assigned-clock-parents = <0>, <0>, <0>;
+		assigned-clock-rates = <294912000>,
+				       <270950400>,
+				       <393216000>;
+		status = "okay";
+
+		dai-link-0 {
+			sound-dai = <&frddr_a>;
+		};
+
+		dai-link-1 {
+			sound-dai = <&frddr_b>;
+		};
+
+		dai-link-2 {
+			sound-dai = <&frddr_c>;
+		};
+
+		/* 8ch hdmi interface */
+		dai-link-3 {
+			sound-dai = <&tdmif_b>;
+			dai-format = "i2s";
+			dai-tdm-slot-tx-mask-0 = <1 1>;
+			dai-tdm-slot-tx-mask-1 = <1 1>;
+			dai-tdm-slot-tx-mask-2 = <1 1>;
+			dai-tdm-slot-tx-mask-3 = <1 1>;
+			mclk-fs = <256>;
+
+			codec {
+				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
+			};
+		};
+
+		/* hdmi glue */
+		dai-link-4 {
+			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
+
+			codec {
+				sound-dai = <&hdmi_tx>;
+			};
+		};
+	};
+};
+
+&arb {
+	status = "okay";
+};
+
+&cec_AO {
+	pinctrl-0 = <&cec_ao_a_h_pins>;
+	pinctrl-names = "default";
+	status = "disabled";
+	hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+	pinctrl-0 = <&cec_ao_b_h_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+	hdmi-phandle = <&hdmi_tx>;
+};
+
+&clkc_audio {
+	status = "okay";
+};
+
+&ext_mdio {
+	external_phy: ethernet-phy@0 {
+		/* Realtek RTL8211F (0x001cc916) */	
+		reg = <0>;
+		max-speed = <1000>;
+
+		reset-assert-us = <10000>;
+		reset-deassert-us = <30000>;
+		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+
+		interrupt-parent = <&gpio_intc>;
+		/* MAC_INTR on GPIOZ_14 */
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
+&ethmac {
+	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&external_phy>;
+	amlogic,tx-delay-ns = <2>;
+};
+
+&frddr_a {
+	status = "okay";
+};
+
+&frddr_b {
+	status = "okay";
+};
+
+&frddr_c {
+	status = "okay";
+};
+
+&gpio {
+	/*
+	 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
+	 * to be turned high in order to be detected by the USB Controller
+	 * This signal should be handled by a USB specific power sequence
+	 * in order to reset the Hub when USB bus is powered down.
+	 */
+	usb-hub {
+		gpio-hog;
+		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "usb-hub-reset";
+	};
+};
+
+&hdmi_tx {
+	status = "okay";
+	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+	pinctrl-names = "default";
+	hdmi-supply = <&vcc_5v>;
+};
+
+&hdmi_tx_tmds_port {
+	hdmi_tx_tmds_out: endpoint {
+		remote-endpoint = <&hdmi_connector_in>;
+	};
+};
+
+&ir {
+	status = "okay";
+	pinctrl-0 = <&remote_input_ao_pins>;
+	pinctrl-names = "default";
+};
+
+/* SD card */
+&sd_emmc_b {
+	status = "okay";
+	pinctrl-0 = <&sdcard_c_pins>;
+	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+	pinctrl-names = "default", "clk-gate";
+
+	bus-width = <4>;
+	cap-sd-highspeed;
+	max-frequency = <50000000>;
+	disable-wp;
+
+	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+	vmmc-supply = <&tflash_vdd>;
+	vqmmc-supply = <&tf_io>;
+
+};
+
+/* eMMC */
+&sd_emmc_c {
+	status = "okay";
+	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+	pinctrl-1 = <&emmc_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
+
+	bus-width = <8>;
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	mmc-hs200-1_8v;
+	max-frequency = <200000000>;
+	disable-wp;
+
+	mmc-pwrseq = <&emmc_pwrseq>;
+	vmmc-supply = <&vcc_3v3>;
+	vqmmc-supply = <&flash_1v8>;
+};
+
+&tdmif_b {
+	status = "okay";
+};
+
+&tdmout_b {
+	status = "okay";
+};
+
+&tohdmitx {
+	status = "okay";
+};
+
+&uart_AO {
+	status = "okay";
+	pinctrl-0 = <&uart_ao_a_pins>;
+	pinctrl-names = "default";
+};
+
+&usb {
+	status = "okay";
+	vbus-supply = <&usb_pwr_en>;
+};
+
+&usb2_phy0 {
+	phy-supply = <&vcc_5v>;
+};
+
+&usb2_phy1 {
+	/* Enable the hub which is connected to this port */
+	phy-supply = <&hub_5v>;
+};
diff --git a/arch/arm/dts/meson-g12b.dtsi b/arch/arm/dts/meson-g12b.dtsi
new file mode 100644
index 0000000000..9e88e513b2
--- /dev/null
+++ b/arch/arm/dts/meson-g12b.dtsi
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-g12a.dtsi"
+
+/ {
+	compatible = "amlogic,g12b";
+
+	cpus {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+
+				core1 {
+					cpu = <&cpu1>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu100>;
+				};
+
+				core1 {
+					cpu = <&cpu101>;
+				};
+
+				core2 {
+					cpu = <&cpu102>;
+				};
+
+				core3 {
+					cpu = <&cpu103>;
+				};
+			};
+		};
+
+		/delete-node/ cpu@2;
+		/delete-node/ cpu@3;
+
+		cpu100: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x100>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu101: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x101>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu102: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x102>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+
+		cpu103: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x0 0x103>;
+			enable-method = "psci";
+			next-level-cache = <&l2>;
+		};
+	};
+};
+
+&clkc {
+	compatible = "amlogic,g12b-clkc";
+};
diff --git a/include/dt-bindings/sound/meson-g12a-tohdmitx.h b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
new file mode 100644
index 0000000000..c5e1f48d30
--- /dev/null
+++ b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_MESON_G12A_TOHDMITX_H
+#define __DT_MESON_G12A_TOHDMITX_H
+
+#define TOHDMITX_I2S_IN_A	0
+#define TOHDMITX_I2S_IN_B	1
+#define TOHDMITX_I2S_IN_C	2
+#define TOHDMITX_I2S_OUT	3
+#define TOHDMITX_SPDIF_IN_A	4
+#define TOHDMITX_SPDIF_IN_B	5
+#define TOHDMITX_SPDIF_OUT	6
+
+#endif /* __DT_MESON_G12A_TOHDMITX_H */
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 2/3] ARM: meson-g12a: Handle 4GiB DRAM size
  2019-07-22  9:48 ` Neil Armstrong
@ 2019-07-22  9:48   ` Neil Armstrong
  -1 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot

When configured with 4GiB DRAM size, only 3.8GiB is available, the
I/O beeing mapped in the last 256MiB of the first 4GiB physical memory/

First fixup the mm_region to handle the first 3.8GiB as memory and the
last 256MiB as I/O.

Then limit the real memory reported by the firmware to the available
physical space, 3.8GiB aligned with the mm_region memory zone size.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 arch/arm/mach-meson/board-g12a.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-meson/board-g12a.c b/arch/arm/mach-meson/board-g12a.c
index 1652970fbd..546b9f6039 100644
--- a/arch/arm/mach-meson/board-g12a.c
+++ b/arch/arm/mach-meson/board-g12a.c
@@ -62,21 +62,21 @@ void meson_init_reserved_memory(void *fdt)
 phys_size_t get_effective_memsize(void)
 {
 	/* Size is reported in MiB, convert it in bytes */
-	return ((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
-			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M;
+	return min(((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
+			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M, 0xf5000000);
 }
 
 static struct mm_region g12a_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
-		.size = 0x80000000UL,
+		.size = 0xf5000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
-		.virt = 0xf0000000UL,
-		.phys = 0xf0000000UL,
-		.size = 0x10000000UL,
+		.virt = 0xf5000000UL,
+		.phys = 0xf5000000UL,
+		.size = 0x0b000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE |
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
@@ -129,6 +129,7 @@ void meson_eth_init(phy_interface_t mode, unsigned int flags)
 			     G12A_ETH_REG_0_TX_RATIO(4) |
 			     G12A_ETH_REG_0_PHY_CLK_EN |
 			     G12A_ETH_REG_0_CLK_EN);
+		g12a_enable_external_mdio();
 		break;
 
 	case PHY_INTERFACE_MODE_RMII:
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/3] ARM: meson-g12a: Handle 4GiB DRAM size
@ 2019-07-22  9:48   ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot; +Cc: u-boot-amlogic, Neil Armstrong

When configured with 4GiB DRAM size, only 3.8GiB is available, the
I/O beeing mapped in the last 256MiB of the first 4GiB physical memory/

First fixup the mm_region to handle the first 3.8GiB as memory and the
last 256MiB as I/O.

Then limit the real memory reported by the firmware to the available
physical space, 3.8GiB aligned with the mm_region memory zone size.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 arch/arm/mach-meson/board-g12a.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-meson/board-g12a.c b/arch/arm/mach-meson/board-g12a.c
index 1652970fbd..546b9f6039 100644
--- a/arch/arm/mach-meson/board-g12a.c
+++ b/arch/arm/mach-meson/board-g12a.c
@@ -62,21 +62,21 @@ void meson_init_reserved_memory(void *fdt)
 phys_size_t get_effective_memsize(void)
 {
 	/* Size is reported in MiB, convert it in bytes */
-	return ((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
-			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M;
+	return min(((readl(G12A_AO_SEC_GP_CFG0) & G12A_AO_MEM_SIZE_MASK)
+			>> G12A_AO_MEM_SIZE_SHIFT) * SZ_1M, 0xf5000000);
 }
 
 static struct mm_region g12a_mem_map[] = {
 	{
 		.virt = 0x0UL,
 		.phys = 0x0UL,
-		.size = 0x80000000UL,
+		.size = 0xf5000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
-		.virt = 0xf0000000UL,
-		.phys = 0xf0000000UL,
-		.size = 0x10000000UL,
+		.virt = 0xf5000000UL,
+		.phys = 0xf5000000UL,
+		.size = 0x0b000000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE |
 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
@@ -129,6 +129,7 @@ void meson_eth_init(phy_interface_t mode, unsigned int flags)
 			     G12A_ETH_REG_0_TX_RATIO(4) |
 			     G12A_ETH_REG_0_PHY_CLK_EN |
 			     G12A_ETH_REG_0_CLK_EN);
+		g12a_enable_external_mdio();
 		break;
 
 	case PHY_INTERFACE_MODE_RMII:
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
  2019-07-22  9:48 ` Neil Armstrong
@ 2019-07-22  9:48   ` Neil Armstrong
  -1 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
with the following specifications:

 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
 - 4GB DDR4 SDRAM
 - Gigabit Ethernet
 - HDMI 2.1 4K/60Hz display
 - 40-pin GPIO header
 - 4 x USB 3.0 Host, 1 x USB OTG
 - eMMC, microSD
 - Infrared receiver

The board directory is W400, the name of the Amlogic Reference Design
of Amlogic G12B with Gigabit boards, which will be used for similar
boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 board/amlogic/w400/MAINTAINERS      |   6 ++
 board/amlogic/w400/Makefile         |   6 ++
 board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/w400.c           |  18 ++++
 configs/odroid-n2_defconfig         |  56 ++++++++++++
 6 files changed, 346 insertions(+)
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
new file mode 100644
index 0000000000..6e68fa73f7
--- /dev/null
+++ b/board/amlogic/w400/MAINTAINERS
@@ -0,0 +1,6 @@
+W400
+M:	Neil Armstrong <narmstrong@baylibre.com>
+S:	Maintained
+L:	u-boot-amlogic at groups.io
+F:	board/amlogic/w400/
+F:	configs/odroid-n2_defconfig
diff --git a/board/amlogic/w400/Makefile b/board/amlogic/w400/Makefile
new file mode 100644
index 0000000000..fac4a73afa
--- /dev/null
+++ b/board/amlogic/w400/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2019 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y	:= w400.o
diff --git a/board/amlogic/w400/README.odroid-n2 b/board/amlogic/w400/README.odroid-n2
new file mode 100644
index 0000000000..90070a988d
--- /dev/null
+++ b/board/amlogic/w400/README.odroid-n2
@@ -0,0 +1,130 @@
+U-Boot for ODROID-N2
+====================
+
+ODROID-N2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 4GB DDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 3.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-n2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=odroid-c2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
+       $DIR
+
+ > cd odroid-c2
+ > make odroidn2_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/README.w400 b/board/amlogic/w400/README.w400
new file mode 100644
index 0000000000..25b786d817
--- /dev/null
+++ b/board/amlogic/w400/README.w400
@@ -0,0 +1,130 @@
+U-Boot for Amlogic W400
+=======================
+
+U200 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 10/100 Ethernet (Internal PHY)
+ - 1 x USB 3.0 Host
+ - eMMC
+ - SDcard
+ - Infrared receiver
+ - SDIO WiFi Module
+ - MIPI DSI Connector
+ - Audio HAT Connector
+ - PCI-E M.2 Connector
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+ - Regulators
+ - Clock controller
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make w400_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make g12b_w400_v1_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
+ > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
+ > cp $FIPDIR/g12b/ddr3_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/diag_lpddr4.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/piei.fw fip/
+ > cp $FIPDIR/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
new file mode 100644
index 0000000000..4737865367
--- /dev/null
+++ b/board/amlogic/w400/w400.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/eth.h>
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
new file mode 100644
index 0000000000..38d1549375
--- /dev/null
+++ b/configs/odroid-n2_defconfig
@@ -0,0 +1,56 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_G12A=y
+CONFIG_SYS_BOARD="w400"
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" odroid-n2"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_USB=y
+CONFIG_USB_HOST=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_PHY=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_DM_USB=y
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/3] board: amlogic: add support for Odroid-N2
@ 2019-07-22  9:48   ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-22  9:48 UTC (permalink / raw)
  To: u-boot; +Cc: u-boot-amlogic, Neil Armstrong

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
with the following specifications:

 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
 - 4GB DDR4 SDRAM
 - Gigabit Ethernet
 - HDMI 2.1 4K/60Hz display
 - 40-pin GPIO header
 - 4 x USB 3.0 Host, 1 x USB OTG
 - eMMC, microSD
 - Infrared receiver

The board directory is W400, the name of the Amlogic Reference Design
of Amlogic G12B with Gigabit boards, which will be used for similar
boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 board/amlogic/w400/MAINTAINERS      |   6 ++
 board/amlogic/w400/Makefile         |   6 ++
 board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/w400.c           |  18 ++++
 configs/odroid-n2_defconfig         |  56 ++++++++++++
 6 files changed, 346 insertions(+)
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
new file mode 100644
index 0000000000..6e68fa73f7
--- /dev/null
+++ b/board/amlogic/w400/MAINTAINERS
@@ -0,0 +1,6 @@
+W400
+M:	Neil Armstrong <narmstrong@baylibre.com>
+S:	Maintained
+L:	u-boot-amlogic@groups.io
+F:	board/amlogic/w400/
+F:	configs/odroid-n2_defconfig
diff --git a/board/amlogic/w400/Makefile b/board/amlogic/w400/Makefile
new file mode 100644
index 0000000000..fac4a73afa
--- /dev/null
+++ b/board/amlogic/w400/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2019 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y	:= w400.o
diff --git a/board/amlogic/w400/README.odroid-n2 b/board/amlogic/w400/README.odroid-n2
new file mode 100644
index 0000000000..90070a988d
--- /dev/null
+++ b/board/amlogic/w400/README.odroid-n2
@@ -0,0 +1,130 @@
+U-Boot for ODROID-N2
+====================
+
+ODROID-N2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 4GB DDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 3.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-n2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=odroid-c2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
+       $DIR
+
+ > cd odroid-c2
+ > make odroidn2_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/README.w400 b/board/amlogic/w400/README.w400
new file mode 100644
index 0000000000..25b786d817
--- /dev/null
+++ b/board/amlogic/w400/README.w400
@@ -0,0 +1,130 @@
+U-Boot for Amlogic W400
+=======================
+
+U200 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 10/100 Ethernet (Internal PHY)
+ - 1 x USB 3.0 Host
+ - eMMC
+ - SDcard
+ - Infrared receiver
+ - SDIO WiFi Module
+ - MIPI DSI Connector
+ - Audio HAT Connector
+ - PCI-E M.2 Connector
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+ - Regulators
+ - Clock controller
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make w400_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make g12b_w400_v1_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
+ > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
+ > cp $FIPDIR/g12b/ddr3_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/diag_lpddr4.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/piei.fw fip/
+ > cp $FIPDIR/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
new file mode 100644
index 0000000000..4737865367
--- /dev/null
+++ b/board/amlogic/w400/w400.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/eth.h>
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
new file mode 100644
index 0000000000..38d1549375
--- /dev/null
+++ b/configs/odroid-n2_defconfig
@@ -0,0 +1,56 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_G12A=y
+CONFIG_SYS_BOARD="w400"
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" odroid-n2"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_USB=y
+CONFIG_USB_HOST=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_PHY=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_DM_USB=y
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/3] ARM: dts: add support for Odroid-N2
  2019-07-22  9:48   ` Neil Armstrong
@ 2019-07-22 17:07     ` Anand Moon
  -1 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2019-07-22 17:07 UTC (permalink / raw)
  To: u-boot

Hi Neil,

On Mon, 22 Jul 2019 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
> ("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  arch/arm/dts/Makefile                         |   3 +-
>  arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
>  arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
>  .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
>  4 files changed, 483 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
>  create mode 100644 arch/arm/dts/meson-g12b.dtsi
>  create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
>

I am getting following error while building this on mainline u-boot.

  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CHK     include/generated/generic-asm-offsets.h
  CHK     include/generated/asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/dumpimage.o
  HOSTLD  tools/dumpimage
  HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkimage
  CC      arch/arm/cpu/armv8/fwcall.o
  LD      arch/arm/cpu/armv8/built-in.o
  CC      cmd/version.o
  LD      cmd/built-in.o
  CC      common/main.o
  LD      common/built-in.o
  CC      lib/efi_loader/helloworld.o
  CC      lib/efi_loader/efi_reloc.o
  CC      lib/efi_loader/efi_freestanding.o
  LD      lib/efi_loader/helloworld_efi.so
  OBJCOPY lib/efi_loader/helloworld.efi
  CC      lib/smbios.o
  CC      lib/display_options.o
  LD      lib/built-in.o
  LD      u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1
-d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut
-f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x01000000 $start
$end
  DTC     arch/arm/dts/meson-g12b-odroid-n2.dtb
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:226.1-5 Label or
path arb not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:244.1-12 Label
or path clkc_audio not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:248.1-10 Label
or path ext_mdio not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:264.1-8 Label or
path ethmac not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:273.1-9 Label or
path frddr_a not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:277.1-9 Label or
path frddr_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:281.1-9 Label or
path frddr_c not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:313.1-4 Label or
path ir not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:320.1-11 Label
or path sd_emmc_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:338.1-11 Label
or path sd_emmc_c not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:356.1-9 Label or
path tdmif_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:360.1-10 Label
or path tdmout_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:364.1-10 Label
or path tohdmitx not found
FATAL ERROR: Syntax error parsing input tree
make[2]: *** [scripts/Makefile.lib:308:
arch/arm/dts/meson-g12b-odroid-n2.dtb] Error 1
make[1]: *** [dts/Makefile:38: arch-dtbs] Error 2
make: *** [Makefile:1045: dts/dt.dtb] Error 2


> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index f5535078c7..2baa368215 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -135,7 +135,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
>         meson-gxl-s905x-khadas-vim.dtb \
>         meson-gxm-khadas-vim2.dtb \
>         meson-axg-s400.dtb \
> -       meson-g12a-u200.dtb
> +       meson-g12a-u200.dtb \
> +       meson-g12b-odroid-n2.dtb
>  dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
>         tegra20-medcom-wide.dtb \
>         tegra20-paz00.dtb \
> diff --git a/arch/arm/dts/meson-g12b-odroid-n2.dts b/arch/arm/dts/meson-g12b-odroid-n2.dts
> new file mode 100644
> index 0000000000..81780ffcc7
> --- /dev/null
> +++ b/arch/arm/dts/meson-g12b-odroid-n2.dts
> @@ -0,0 +1,386 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +/dts-v1/;
> +
> +#include "meson-g12b.dtsi"
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/gpio/meson-g12a-gpio.h>
> +#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
> +
> +/ {
> +       compatible = "hardkernel,odroid-n2", "amlogic,g12b";
> +       model = "Hardkernel ODROID-N2";
> +
> +       aliases {
> +               serial0 = &uart_AO;
> +               ethernet0 = &ethmac;
> +       };
> +
> +       chosen {
> +               stdout-path = "serial0:115200n8";
> +       };
> +
> +       memory at 0 {
> +               device_type = "memory";
> +               reg = <0x0 0x0 0x0 0x40000000>;
> +       };
> +
> +       emmc_pwrseq: emmc-pwrseq {
> +               compatible = "mmc-pwrseq-emmc";
> +               reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
> +       };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               blue {
> +                       label = "n2:blue";
> +                       gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
> +                       linux,default-trigger = "heartbeat";
> +               };
> +       };
> +
> +       tflash_vdd: regulator-tflash_vdd {
> +               compatible = "regulator-fixed";
> +
> +               regulator-name = "TFLASH_VDD";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +
> +               gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       tf_io: gpio-regulator-tf_io {
> +               compatible = "regulator-gpio";
> +
> +               regulator-name = "TF_IO";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <3300000>;
> +
> +               gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
> +               gpios-states = <0>;
> +
> +               states = <3300000 0
> +                         1800000 1>;
> +       };
> +
> +       flash_1v8: regulator-flash_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "FLASH_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vcc_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       main_12v: regulator-main_12v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "12V";
> +               regulator-min-microvolt = <12000000>;
> +               regulator-max-microvolt = <12000000>;
> +               regulator-always-on;
> +       };
> +
> +       vcc_5v: regulator-vcc_5v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "5V";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               regulator-always-on;
> +               vin-supply = <&main_12v>;
> +       };
> +
> +       vcc_1v8: regulator-vcc_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VCC_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vcc_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       vcc_3v3: regulator-vcc_3v3 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VCC_3V3";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +               vin-supply = <&vddao_3v3>;
> +               regulator-always-on;
> +               /* FIXME: actually controlled by VDDCPU_B_EN */
> +       };
> +
> +       hub_5v: regulator-hub_5v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "HUB_5V";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               vin-supply = <&vcc_5v>;
> +
> +               /* Connected to the Hub CHIPENABLE, LOW sets low power state */
> +               gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       usb_pwr_en: regulator-usb_pwr_en {
> +               compatible = "regulator-fixed";
> +               regulator-name = "USB_PWR_EN";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               vin-supply = <&vcc_5v>;
> +
> +               /* Connected to the microUSB port power enable */
> +               gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       vddao_1v8: regulator-vddao_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VDDAO_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vddao_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       vddao_3v3: regulator-vddao_3v3 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VDDAO_3V3";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +               vin-supply = <&main_12v>;
> +               regulator-always-on;
> +       };
> +
> +       hdmi-connector {
> +               compatible = "hdmi-connector";
> +               type = "a";
> +
> +               port {
> +                       hdmi_connector_in: endpoint {
> +                               remote-endpoint = <&hdmi_tx_tmds_out>;
> +                       };
> +               };
> +       };
> +
> +       sound {
> +               compatible = "amlogic,axg-sound-card";
> +               model = "G12A-ODROIDN2";
> +               audio-aux-devs = <&tdmout_b>;
> +               audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
> +                               "TDMOUT_B IN 1", "FRDDR_B OUT 1",
> +                               "TDMOUT_B IN 2", "FRDDR_C OUT 1",
> +                               "TDM_B Playback", "TDMOUT_B OUT";
> +
> +               assigned-clocks = <&clkc CLKID_MPLL2>,
> +                                 <&clkc CLKID_MPLL0>,
> +                                 <&clkc CLKID_MPLL1>;
> +               assigned-clock-parents = <0>, <0>, <0>;
> +               assigned-clock-rates = <294912000>,
> +                                      <270950400>,
> +                                      <393216000>;
> +               status = "okay";
> +
> +               dai-link-0 {
> +                       sound-dai = <&frddr_a>;
> +               };
> +
> +               dai-link-1 {
> +                       sound-dai = <&frddr_b>;
> +               };
> +
> +               dai-link-2 {
> +                       sound-dai = <&frddr_c>;
> +               };
> +
> +               /* 8ch hdmi interface */
> +               dai-link-3 {
> +                       sound-dai = <&tdmif_b>;
> +                       dai-format = "i2s";
> +                       dai-tdm-slot-tx-mask-0 = <1 1>;
> +                       dai-tdm-slot-tx-mask-1 = <1 1>;
> +                       dai-tdm-slot-tx-mask-2 = <1 1>;
> +                       dai-tdm-slot-tx-mask-3 = <1 1>;
> +                       mclk-fs = <256>;
> +
> +                       codec {
> +                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
> +                       };
> +               };
> +
> +               /* hdmi glue */
> +               dai-link-4 {
> +                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
> +
> +                       codec {
> +                               sound-dai = <&hdmi_tx>;
> +                       };
> +               };
> +       };
> +};
> +
> +&arb {
> +       status = "okay";
> +};
> +
> +&cec_AO {
> +       pinctrl-0 = <&cec_ao_a_h_pins>;
> +       pinctrl-names = "default";
> +       status = "disabled";
> +       hdmi-phandle = <&hdmi_tx>;
> +};
> +
> +&cecb_AO {
> +       pinctrl-0 = <&cec_ao_b_h_pins>;
> +       pinctrl-names = "default";
> +       status = "okay";
> +       hdmi-phandle = <&hdmi_tx>;
> +};
> +
> +&clkc_audio {
> +       status = "okay";
> +};

While applying this patch I get following warning.

Applying: ARM: dts: add support for Odroid-N2
.git/rebase-apply/patch:280: trailing whitespace.
                /* Realtek RTL8211F (0x001cc916) */
warning: 1 line adds whitespace errors.


> +
> +&ext_mdio {
> +       external_phy: ethernet-phy at 0 {
> +               /* Realtek RTL8211F (0x001cc916) */
> +               reg = <0>;
> +               max-speed = <1000>;
> +
> +               reset-assert-us = <10000>;
> +               reset-deassert-us = <30000>;
> +               reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
> +
> +               interrupt-parent = <&gpio_intc>;
> +               /* MAC_INTR on GPIOZ_14 */
> +               interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
> +       };
> +};
> +
> +&ethmac {
> +       pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
> +       pinctrl-names = "default";
> +       status = "okay";
> +       phy-mode = "rgmii";
> +       phy-handle = <&external_phy>;
> +       amlogic,tx-delay-ns = <2>;
> +};
> +
> +&frddr_a {
> +       status = "okay";
> +};
> +
> +&frddr_b {
> +       status = "okay";
> +};
> +
> +&frddr_c {
> +       status = "okay";
> +};
> +
> +&gpio {
> +       /*
> +        * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
> +        * to be turned high in order to be detected by the USB Controller
> +        * This signal should be handled by a USB specific power sequence
> +        * in order to reset the Hub when USB bus is powered down.
> +        */
> +       usb-hub {
> +               gpio-hog;
> +               gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
> +               output-high;
> +               line-name = "usb-hub-reset";
> +       };
> +};
> +
> +&hdmi_tx {
> +       status = "okay";
> +       pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
> +       pinctrl-names = "default";
> +       hdmi-supply = <&vcc_5v>;
> +};
> +
> +&hdmi_tx_tmds_port {
> +       hdmi_tx_tmds_out: endpoint {
> +               remote-endpoint = <&hdmi_connector_in>;
> +       };
> +};
> +
> +&ir {
> +       status = "okay";
> +       pinctrl-0 = <&remote_input_ao_pins>;
> +       pinctrl-names = "default";
> +};
> +
> +/* SD card */
> +&sd_emmc_b {
> +       status = "okay";
> +       pinctrl-0 = <&sdcard_c_pins>;
> +       pinctrl-1 = <&sdcard_clk_gate_c_pins>;
> +       pinctrl-names = "default", "clk-gate";
> +
> +       bus-width = <4>;
> +       cap-sd-highspeed;
> +       max-frequency = <50000000>;
> +       disable-wp;
> +
> +       cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
> +       vmmc-supply = <&tflash_vdd>;
> +       vqmmc-supply = <&tf_io>;
> +
> +};
> +
> +/* eMMC */
> +&sd_emmc_c {
> +       status = "okay";
> +       pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
> +       pinctrl-1 = <&emmc_clk_gate_pins>;
> +       pinctrl-names = "default", "clk-gate";
> +
> +       bus-width = <8>;
> +       cap-mmc-highspeed;
> +       mmc-ddr-1_8v;
> +       mmc-hs200-1_8v;
> +       max-frequency = <200000000>;
> +       disable-wp;
> +
> +       mmc-pwrseq = <&emmc_pwrseq>;
> +       vmmc-supply = <&vcc_3v3>;
> +       vqmmc-supply = <&flash_1v8>;
> +};
> +
> +&tdmif_b {
> +       status = "okay";
> +};
> +
> +&tdmout_b {
> +       status = "okay";
> +};
> +
> +&tohdmitx {
> +       status = "okay";
> +};
> +
> +&uart_AO {
> +       status = "okay";
> +       pinctrl-0 = <&uart_ao_a_pins>;
> +       pinctrl-names = "default";
> +};
> +
> +&usb {
> +       status = "okay";
> +       vbus-supply = <&usb_pwr_en>;
> +};
> +
> +&usb2_phy0 {
> +       phy-supply = <&vcc_5v>;
> +};
> +
> +&usb2_phy1 {
> +       /* Enable the hub which is connected to this port */
> +       phy-supply = <&hub_5v>;
> +};
> diff --git a/arch/arm/dts/meson-g12b.dtsi b/arch/arm/dts/meson-g12b.dtsi
> new file mode 100644
> index 0000000000..9e88e513b2
> --- /dev/null
> +++ b/arch/arm/dts/meson-g12b.dtsi
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +#include "meson-g12a.dtsi"
> +
> +/ {
> +       compatible = "amlogic,g12b";
> +
> +       cpus {
> +               cpu-map {
> +                       cluster0 {
> +                               core0 {
> +                                       cpu = <&cpu0>;
> +                               };
> +
> +                               core1 {
> +                                       cpu = <&cpu1>;
> +                               };
> +                       };
> +
> +                       cluster1 {
> +                               core0 {
> +                                       cpu = <&cpu100>;
> +                               };
> +
> +                               core1 {
> +                                       cpu = <&cpu101>;
> +                               };
> +
> +                               core2 {
> +                                       cpu = <&cpu102>;
> +                               };
> +
> +                               core3 {
> +                                       cpu = <&cpu103>;
> +                               };
> +                       };
> +               };
> +
> +               /delete-node/ cpu at 2;
> +               /delete-node/ cpu at 3;
> +
> +               cpu100: cpu at 100 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x100>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu101: cpu at 101 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x101>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu102: cpu at 102 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x102>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu103: cpu at 103 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x103>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +       };
> +};
> +
> +&clkc {
> +       compatible = "amlogic,g12b-clkc";
> +};
> diff --git a/include/dt-bindings/sound/meson-g12a-tohdmitx.h b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
> new file mode 100644
> index 0000000000..c5e1f48d30
> --- /dev/null
> +++ b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __DT_MESON_G12A_TOHDMITX_H
> +#define __DT_MESON_G12A_TOHDMITX_H
> +
> +#define TOHDMITX_I2S_IN_A      0
> +#define TOHDMITX_I2S_IN_B      1
> +#define TOHDMITX_I2S_IN_C      2
> +#define TOHDMITX_I2S_OUT       3
> +#define TOHDMITX_SPDIF_IN_A    4
> +#define TOHDMITX_SPDIF_IN_B    5
> +#define TOHDMITX_SPDIF_OUT     6
> +
> +#endif /* __DT_MESON_G12A_TOHDMITX_H */
> --
> 2.22.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [U-Boot] [PATCH 1/3] ARM: dts: add support for Odroid-N2
@ 2019-07-22 17:07     ` Anand Moon
  0 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2019-07-22 17:07 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: U-Boot Mailing List, u-boot-amlogic

Hi Neil,

On Mon, 22 Jul 2019 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
> ("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  arch/arm/dts/Makefile                         |   3 +-
>  arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
>  arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
>  .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
>  4 files changed, 483 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
>  create mode 100644 arch/arm/dts/meson-g12b.dtsi
>  create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
>

I am getting following error while building this on mainline u-boot.

  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CHK     include/generated/generic-asm-offsets.h
  CHK     include/generated/asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/dumpimage.o
  HOSTLD  tools/dumpimage
  HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkimage
  CC      arch/arm/cpu/armv8/fwcall.o
  LD      arch/arm/cpu/armv8/built-in.o
  CC      cmd/version.o
  LD      cmd/built-in.o
  CC      common/main.o
  LD      common/built-in.o
  CC      lib/efi_loader/helloworld.o
  CC      lib/efi_loader/efi_reloc.o
  CC      lib/efi_loader/efi_freestanding.o
  LD      lib/efi_loader/helloworld_efi.so
  OBJCOPY lib/efi_loader/helloworld.efi
  CC      lib/smbios.o
  CC      lib/display_options.o
  LD      lib/built-in.o
  LD      u-boot
  OBJCOPY u-boot.srec
  OBJCOPY u-boot-nodtb.bin
start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1
-d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut
-f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x01000000 $start
$end
  DTC     arch/arm/dts/meson-g12b-odroid-n2.dtb
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:226.1-5 Label or
path arb not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:244.1-12 Label
or path clkc_audio not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:248.1-10 Label
or path ext_mdio not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:264.1-8 Label or
path ethmac not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:273.1-9 Label or
path frddr_a not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:277.1-9 Label or
path frddr_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:281.1-9 Label or
path frddr_c not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:313.1-4 Label or
path ir not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:320.1-11 Label
or path sd_emmc_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:338.1-11 Label
or path sd_emmc_c not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:356.1-9 Label or
path tdmif_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:360.1-10 Label
or path tdmout_b not found
Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:364.1-10 Label
or path tohdmitx not found
FATAL ERROR: Syntax error parsing input tree
make[2]: *** [scripts/Makefile.lib:308:
arch/arm/dts/meson-g12b-odroid-n2.dtb] Error 1
make[1]: *** [dts/Makefile:38: arch-dtbs] Error 2
make: *** [Makefile:1045: dts/dt.dtb] Error 2


> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index f5535078c7..2baa368215 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -135,7 +135,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
>         meson-gxl-s905x-khadas-vim.dtb \
>         meson-gxm-khadas-vim2.dtb \
>         meson-axg-s400.dtb \
> -       meson-g12a-u200.dtb
> +       meson-g12a-u200.dtb \
> +       meson-g12b-odroid-n2.dtb
>  dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
>         tegra20-medcom-wide.dtb \
>         tegra20-paz00.dtb \
> diff --git a/arch/arm/dts/meson-g12b-odroid-n2.dts b/arch/arm/dts/meson-g12b-odroid-n2.dts
> new file mode 100644
> index 0000000000..81780ffcc7
> --- /dev/null
> +++ b/arch/arm/dts/meson-g12b-odroid-n2.dts
> @@ -0,0 +1,386 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +/dts-v1/;
> +
> +#include "meson-g12b.dtsi"
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/gpio/meson-g12a-gpio.h>
> +#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
> +
> +/ {
> +       compatible = "hardkernel,odroid-n2", "amlogic,g12b";
> +       model = "Hardkernel ODROID-N2";
> +
> +       aliases {
> +               serial0 = &uart_AO;
> +               ethernet0 = &ethmac;
> +       };
> +
> +       chosen {
> +               stdout-path = "serial0:115200n8";
> +       };
> +
> +       memory@0 {
> +               device_type = "memory";
> +               reg = <0x0 0x0 0x0 0x40000000>;
> +       };
> +
> +       emmc_pwrseq: emmc-pwrseq {
> +               compatible = "mmc-pwrseq-emmc";
> +               reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
> +       };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               blue {
> +                       label = "n2:blue";
> +                       gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
> +                       linux,default-trigger = "heartbeat";
> +               };
> +       };
> +
> +       tflash_vdd: regulator-tflash_vdd {
> +               compatible = "regulator-fixed";
> +
> +               regulator-name = "TFLASH_VDD";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +
> +               gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       tf_io: gpio-regulator-tf_io {
> +               compatible = "regulator-gpio";
> +
> +               regulator-name = "TF_IO";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <3300000>;
> +
> +               gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
> +               gpios-states = <0>;
> +
> +               states = <3300000 0
> +                         1800000 1>;
> +       };
> +
> +       flash_1v8: regulator-flash_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "FLASH_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vcc_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       main_12v: regulator-main_12v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "12V";
> +               regulator-min-microvolt = <12000000>;
> +               regulator-max-microvolt = <12000000>;
> +               regulator-always-on;
> +       };
> +
> +       vcc_5v: regulator-vcc_5v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "5V";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               regulator-always-on;
> +               vin-supply = <&main_12v>;
> +       };
> +
> +       vcc_1v8: regulator-vcc_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VCC_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vcc_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       vcc_3v3: regulator-vcc_3v3 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VCC_3V3";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +               vin-supply = <&vddao_3v3>;
> +               regulator-always-on;
> +               /* FIXME: actually controlled by VDDCPU_B_EN */
> +       };
> +
> +       hub_5v: regulator-hub_5v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "HUB_5V";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               vin-supply = <&vcc_5v>;
> +
> +               /* Connected to the Hub CHIPENABLE, LOW sets low power state */
> +               gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       usb_pwr_en: regulator-usb_pwr_en {
> +               compatible = "regulator-fixed";
> +               regulator-name = "USB_PWR_EN";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               vin-supply = <&vcc_5v>;
> +
> +               /* Connected to the microUSB port power enable */
> +               gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
> +               enable-active-high;
> +       };
> +
> +       vddao_1v8: regulator-vddao_1v8 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VDDAO_1V8";
> +               regulator-min-microvolt = <1800000>;
> +               regulator-max-microvolt = <1800000>;
> +               vin-supply = <&vddao_3v3>;
> +               regulator-always-on;
> +       };
> +
> +       vddao_3v3: regulator-vddao_3v3 {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VDDAO_3V3";
> +               regulator-min-microvolt = <3300000>;
> +               regulator-max-microvolt = <3300000>;
> +               vin-supply = <&main_12v>;
> +               regulator-always-on;
> +       };
> +
> +       hdmi-connector {
> +               compatible = "hdmi-connector";
> +               type = "a";
> +
> +               port {
> +                       hdmi_connector_in: endpoint {
> +                               remote-endpoint = <&hdmi_tx_tmds_out>;
> +                       };
> +               };
> +       };
> +
> +       sound {
> +               compatible = "amlogic,axg-sound-card";
> +               model = "G12A-ODROIDN2";
> +               audio-aux-devs = <&tdmout_b>;
> +               audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
> +                               "TDMOUT_B IN 1", "FRDDR_B OUT 1",
> +                               "TDMOUT_B IN 2", "FRDDR_C OUT 1",
> +                               "TDM_B Playback", "TDMOUT_B OUT";
> +
> +               assigned-clocks = <&clkc CLKID_MPLL2>,
> +                                 <&clkc CLKID_MPLL0>,
> +                                 <&clkc CLKID_MPLL1>;
> +               assigned-clock-parents = <0>, <0>, <0>;
> +               assigned-clock-rates = <294912000>,
> +                                      <270950400>,
> +                                      <393216000>;
> +               status = "okay";
> +
> +               dai-link-0 {
> +                       sound-dai = <&frddr_a>;
> +               };
> +
> +               dai-link-1 {
> +                       sound-dai = <&frddr_b>;
> +               };
> +
> +               dai-link-2 {
> +                       sound-dai = <&frddr_c>;
> +               };
> +
> +               /* 8ch hdmi interface */
> +               dai-link-3 {
> +                       sound-dai = <&tdmif_b>;
> +                       dai-format = "i2s";
> +                       dai-tdm-slot-tx-mask-0 = <1 1>;
> +                       dai-tdm-slot-tx-mask-1 = <1 1>;
> +                       dai-tdm-slot-tx-mask-2 = <1 1>;
> +                       dai-tdm-slot-tx-mask-3 = <1 1>;
> +                       mclk-fs = <256>;
> +
> +                       codec {
> +                               sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
> +                       };
> +               };
> +
> +               /* hdmi glue */
> +               dai-link-4 {
> +                       sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
> +
> +                       codec {
> +                               sound-dai = <&hdmi_tx>;
> +                       };
> +               };
> +       };
> +};
> +
> +&arb {
> +       status = "okay";
> +};
> +
> +&cec_AO {
> +       pinctrl-0 = <&cec_ao_a_h_pins>;
> +       pinctrl-names = "default";
> +       status = "disabled";
> +       hdmi-phandle = <&hdmi_tx>;
> +};
> +
> +&cecb_AO {
> +       pinctrl-0 = <&cec_ao_b_h_pins>;
> +       pinctrl-names = "default";
> +       status = "okay";
> +       hdmi-phandle = <&hdmi_tx>;
> +};
> +
> +&clkc_audio {
> +       status = "okay";
> +};

While applying this patch I get following warning.

Applying: ARM: dts: add support for Odroid-N2
.git/rebase-apply/patch:280: trailing whitespace.
                /* Realtek RTL8211F (0x001cc916) */
warning: 1 line adds whitespace errors.


> +
> +&ext_mdio {
> +       external_phy: ethernet-phy@0 {
> +               /* Realtek RTL8211F (0x001cc916) */
> +               reg = <0>;
> +               max-speed = <1000>;
> +
> +               reset-assert-us = <10000>;
> +               reset-deassert-us = <30000>;
> +               reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
> +
> +               interrupt-parent = <&gpio_intc>;
> +               /* MAC_INTR on GPIOZ_14 */
> +               interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
> +       };
> +};
> +
> +&ethmac {
> +       pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
> +       pinctrl-names = "default";
> +       status = "okay";
> +       phy-mode = "rgmii";
> +       phy-handle = <&external_phy>;
> +       amlogic,tx-delay-ns = <2>;
> +};
> +
> +&frddr_a {
> +       status = "okay";
> +};
> +
> +&frddr_b {
> +       status = "okay";
> +};
> +
> +&frddr_c {
> +       status = "okay";
> +};
> +
> +&gpio {
> +       /*
> +        * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
> +        * to be turned high in order to be detected by the USB Controller
> +        * This signal should be handled by a USB specific power sequence
> +        * in order to reset the Hub when USB bus is powered down.
> +        */
> +       usb-hub {
> +               gpio-hog;
> +               gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
> +               output-high;
> +               line-name = "usb-hub-reset";
> +       };
> +};
> +
> +&hdmi_tx {
> +       status = "okay";
> +       pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
> +       pinctrl-names = "default";
> +       hdmi-supply = <&vcc_5v>;
> +};
> +
> +&hdmi_tx_tmds_port {
> +       hdmi_tx_tmds_out: endpoint {
> +               remote-endpoint = <&hdmi_connector_in>;
> +       };
> +};
> +
> +&ir {
> +       status = "okay";
> +       pinctrl-0 = <&remote_input_ao_pins>;
> +       pinctrl-names = "default";
> +};
> +
> +/* SD card */
> +&sd_emmc_b {
> +       status = "okay";
> +       pinctrl-0 = <&sdcard_c_pins>;
> +       pinctrl-1 = <&sdcard_clk_gate_c_pins>;
> +       pinctrl-names = "default", "clk-gate";
> +
> +       bus-width = <4>;
> +       cap-sd-highspeed;
> +       max-frequency = <50000000>;
> +       disable-wp;
> +
> +       cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
> +       vmmc-supply = <&tflash_vdd>;
> +       vqmmc-supply = <&tf_io>;
> +
> +};
> +
> +/* eMMC */
> +&sd_emmc_c {
> +       status = "okay";
> +       pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
> +       pinctrl-1 = <&emmc_clk_gate_pins>;
> +       pinctrl-names = "default", "clk-gate";
> +
> +       bus-width = <8>;
> +       cap-mmc-highspeed;
> +       mmc-ddr-1_8v;
> +       mmc-hs200-1_8v;
> +       max-frequency = <200000000>;
> +       disable-wp;
> +
> +       mmc-pwrseq = <&emmc_pwrseq>;
> +       vmmc-supply = <&vcc_3v3>;
> +       vqmmc-supply = <&flash_1v8>;
> +};
> +
> +&tdmif_b {
> +       status = "okay";
> +};
> +
> +&tdmout_b {
> +       status = "okay";
> +};
> +
> +&tohdmitx {
> +       status = "okay";
> +};
> +
> +&uart_AO {
> +       status = "okay";
> +       pinctrl-0 = <&uart_ao_a_pins>;
> +       pinctrl-names = "default";
> +};
> +
> +&usb {
> +       status = "okay";
> +       vbus-supply = <&usb_pwr_en>;
> +};
> +
> +&usb2_phy0 {
> +       phy-supply = <&vcc_5v>;
> +};
> +
> +&usb2_phy1 {
> +       /* Enable the hub which is connected to this port */
> +       phy-supply = <&hub_5v>;
> +};
> diff --git a/arch/arm/dts/meson-g12b.dtsi b/arch/arm/dts/meson-g12b.dtsi
> new file mode 100644
> index 0000000000..9e88e513b2
> --- /dev/null
> +++ b/arch/arm/dts/meson-g12b.dtsi
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2019 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +#include "meson-g12a.dtsi"
> +
> +/ {
> +       compatible = "amlogic,g12b";
> +
> +       cpus {
> +               cpu-map {
> +                       cluster0 {
> +                               core0 {
> +                                       cpu = <&cpu0>;
> +                               };
> +
> +                               core1 {
> +                                       cpu = <&cpu1>;
> +                               };
> +                       };
> +
> +                       cluster1 {
> +                               core0 {
> +                                       cpu = <&cpu100>;
> +                               };
> +
> +                               core1 {
> +                                       cpu = <&cpu101>;
> +                               };
> +
> +                               core2 {
> +                                       cpu = <&cpu102>;
> +                               };
> +
> +                               core3 {
> +                                       cpu = <&cpu103>;
> +                               };
> +                       };
> +               };
> +
> +               /delete-node/ cpu@2;
> +               /delete-node/ cpu@3;
> +
> +               cpu100: cpu@100 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x100>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu101: cpu@101 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x101>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu102: cpu@102 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x102>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +
> +               cpu103: cpu@103 {
> +                       device_type = "cpu";
> +                       compatible = "arm,cortex-a73";
> +                       reg = <0x0 0x103>;
> +                       enable-method = "psci";
> +                       next-level-cache = <&l2>;
> +               };
> +       };
> +};
> +
> +&clkc {
> +       compatible = "amlogic,g12b-clkc";
> +};
> diff --git a/include/dt-bindings/sound/meson-g12a-tohdmitx.h b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
> new file mode 100644
> index 0000000000..c5e1f48d30
> --- /dev/null
> +++ b/include/dt-bindings/sound/meson-g12a-tohdmitx.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __DT_MESON_G12A_TOHDMITX_H
> +#define __DT_MESON_G12A_TOHDMITX_H
> +
> +#define TOHDMITX_I2S_IN_A      0
> +#define TOHDMITX_I2S_IN_B      1
> +#define TOHDMITX_I2S_IN_C      2
> +#define TOHDMITX_I2S_OUT       3
> +#define TOHDMITX_SPDIF_IN_A    4
> +#define TOHDMITX_SPDIF_IN_B    5
> +#define TOHDMITX_SPDIF_OUT     6
> +
> +#endif /* __DT_MESON_G12A_TOHDMITX_H */
> --
> 2.22.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
  2019-07-22  9:48   ` Neil Armstrong
@ 2019-07-22 17:08     ` Anand Moon
  -1 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2019-07-22 17:08 UTC (permalink / raw)
  To: u-boot

Hi Neil,

On Mon, 22 Jul 2019 at 16:00, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
> with the following specifications:
>
>  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
>  - 4GB DDR4 SDRAM
>  - Gigabit Ethernet
>  - HDMI 2.1 4K/60Hz display
>  - 40-pin GPIO header
>  - 4 x USB 3.0 Host, 1 x USB OTG
>  - eMMC, microSD
>  - Infrared receiver
>
> The board directory is W400, the name of the Amlogic Reference Design
> of Amlogic G12B with Gigabit boards, which will be used for similar
> boards.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  board/amlogic/w400/MAINTAINERS      |   6 ++
>  board/amlogic/w400/Makefile         |   6 ++
>  board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
>  board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
>  board/amlogic/w400/w400.c           |  18 ++++
>  configs/odroid-n2_defconfig         |  56 ++++++++++++
>  6 files changed, 346 insertions(+)
>  create mode 100644 board/amlogic/w400/MAINTAINERS
>  create mode 100644 board/amlogic/w400/Makefile
>  create mode 100644 board/amlogic/w400/README.odroid-n2
>  create mode 100644 board/amlogic/w400/README.w400
>  create mode 100644 board/amlogic/w400/w400.c
>  create mode 100644 configs/odroid-n2_defconfig
>
> diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
> new file mode 100644
> index 0000000000..6e68fa73f7
> --- /dev/null
> +++ b/board/amlogic/w400/MAINTAINERS
> @@ -0,0 +1,6 @@
> +W400
> +M:     Neil Armstrong <narmstrong@baylibre.com>
> +S:     Maintained
> +L:     u-boot-amlogic at groups.io
> +F:     board/amlogic/w400/
> +F:     configs/odroid-n2_defconfig
> diff --git a/board/amlogic/w400/Makefile b/board/amlogic/w400/Makefile
> new file mode 100644
> index 0000000000..fac4a73afa
> --- /dev/null
> +++ b/board/amlogic/w400/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# (C) Copyright 2019 BayLibre, SAS
> +# Author: Neil Armstrong <narmstrong@baylibre.com>
> +
> +obj-y  := w400.o
> diff --git a/board/amlogic/w400/README.odroid-n2 b/board/amlogic/w400/README.odroid-n2
> new file mode 100644
> index 0000000000..90070a988d
> --- /dev/null
> +++ b/board/amlogic/w400/README.odroid-n2
> @@ -0,0 +1,130 @@
> +U-Boot for ODROID-N2
> +====================
> +
> +ODROID-N2 is a single board computer manufactured by Hardkernel
> +Co. Ltd with the following specifications:
> +
> + - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
> + - 4GB DDR4 SDRAM
> + - Gigabit Ethernet
> + - HDMI 2.1 4K/60Hz display
> + - 40-pin GPIO header
> + - 4 x USB 3.0 Host, 1 x USB OTG
> + - eMMC, microSD
> + - Infrared receiver
> +
> +Schematics are available on the manufacturer website.
> +
> +Currently the u-boot port supports the following devices:
> + - serial
> + - eMMC, microSD
> + - Ethernet
> + - I2C
> + - Regulators
> + - Reset controller
> + - Clock controller
> + - ADC
> +
> +u-boot compilation
> +==================
> +
> + > export ARCH=arm
> + > export CROSS_COMPILE=aarch64-none-elf-
> + > make odroid-n2_defconfig
> + > make
> +
> +Image creation
> +==============
> +
> +Amlogic doesn't provide sources for the firmware and for tools needed
> +to create the bootloader image, so it is necessary to obtain them from
> +the git tree published by the board vendor:
> +
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
> +

Should we checkout odroidn2-v2015.01 from Hardkernel repository.


> + > DIR=odroid-c2
> + > git clone --depth 1 \
> +       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
> +       $DIR
> +
> + > cd odroid-c2
> + > make odroidn2_defconfig
> + > make
> + > export UBOOTDIR=$PWD
> +
> + Go back to mainline U-Boot source tree then :
> + > mkdir fip
> +
> + > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
> + > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
> + > cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl31.img fip/
> + > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
> + > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/piei.fw fip/
> + > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
> + > cp u-boot.bin fip/bl33.bin
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl30.bin \
> +       fip/zero_tmp \
> +       fip/bl30_zero.bin \
> +       fip/bl301.bin \
> +       fip/bl301_zero.bin \
> +       fip/bl30_new.bin \
> +       bl30
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl2.bin \
> +       fip/zero_tmp \
> +       fip/bl2_zero.bin \
> +       fip/acs.bin \
> +       fip/bl21_zero.bin \
> +       fip/bl2_new.bin \
> +       bl2
> +
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
> +                                       --output fip/bl30_new.bin.g12a.enc \
> +                                       --level v3
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
> +                                       --output fip/bl30_new.bin.enc \
> +                                       --level v3 --type bl30
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
> +                                       --output fip/bl31.img.enc \
> +                                       --level v3 --type bl31
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
> +                                       --output fip/bl33.bin.enc \
> +                                       --level v3 --type bl33 --compress lz4
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
> +                                       --output fip/bl2.n.bin.sig
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
> +               --output fip/u-boot.bin \
> +               --bl2 fip/bl2.n.bin.sig \
> +               --bl30 fip/bl30_new.bin.enc \
> +               --bl31 fip/bl31.img.enc \
> +               --bl33 fip/bl33.bin.enc \
> +               --ddrfw1 fip/ddr4_1d.fw \
> +               --ddrfw2 fip/ddr4_2d.fw \
> +               --ddrfw3 fip/ddr3_1d.fw \
> +               --ddrfw4 fip/piei.fw \
> +               --ddrfw5 fip/lpddr4_1d.fw \
> +               --ddrfw6 fip/lpddr4_2d.fw \
> +               --ddrfw7 fip/diag_lpddr4.fw \
> +               --ddrfw8 fip/aml_ddr.fw \
> +               --level v3
> +
> +and then write the image to SD with:
> +
> + > DEV=/dev/your_sd_device
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
> diff --git a/board/amlogic/w400/README.w400 b/board/amlogic/w400/README.w400
> new file mode 100644
> index 0000000000..25b786d817
> --- /dev/null
> +++ b/board/amlogic/w400/README.w400
> @@ -0,0 +1,130 @@
> +U-Boot for Amlogic W400
> +=======================
> +
> +U200 is a reference board manufactured by Amlogic with the following
> +specifications:
> +
> + - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
> + - 2GB DDR4 SDRAM
> + - 10/100 Ethernet (Internal PHY)
> + - 1 x USB 3.0 Host
> + - eMMC
> + - SDcard
> + - Infrared receiver
> + - SDIO WiFi Module
> + - MIPI DSI Connector
> + - Audio HAT Connector
> + - PCI-E M.2 Connector
> +
> +Schematics are available from Amlogic on demand.
> +
> +Currently the u-boot port supports the following devices:
> + - serial
> + - Ethernet
> + - Regulators
> + - Clock controller
> +
> +u-boot compilation
> +==================
> +
> + > export ARCH=arm
> + > export CROSS_COMPILE=aarch64-none-elf-
> + > make w400_defconfig
> + > make
> +
> +Image creation
> +==============
> +
> +Amlogic doesn't provide sources for the firmware and for tools needed
> +to create the bootloader image, so it is necessary to obtain them from
> +the git tree published by the board vendor:
> +
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
> + > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
> + > cd amlogic-u-boot
> + > make g12b_w400_v1_defconfig
> + > make
> + > export UBOOTDIR=$PWD
> +
> +Download the latest Amlogic Buildroot package, and extract it :
> + > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
> + > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
> + > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
> + > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
> +
> +Go back to mainline U-Boot source tree then :
> + > mkdir fip
> +
> + > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
> + > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
> + > cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
> + > cp $FIPDIR/g12b/ddr3_1d.fw fip/
> + > cp $FIPDIR/g12b/ddr4_1d.fw fip/
> + > cp $FIPDIR/g12b/ddr4_2d.fw fip/
> + > cp $FIPDIR/g12b/diag_lpddr4.fw fip/
> + > cp $FIPDIR/g12b/lpddr4_1d.fw fip/
> + > cp $FIPDIR/g12b/lpddr4_2d.fw fip/
> + > cp $FIPDIR/g12b/piei.fw fip/
> + > cp $FIPDIR/g12b/aml_ddr.fw fip/
> + > cp u-boot.bin fip/bl33.bin
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl30.bin \
> +       fip/zero_tmp \
> +       fip/bl30_zero.bin \
> +       fip/bl301.bin \
> +       fip/bl301_zero.bin \
> +       fip/bl30_new.bin \
> +       bl30
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl2.bin \
> +       fip/zero_tmp \
> +       fip/bl2_zero.bin \
> +       fip/acs.bin \
> +       fip/bl21_zero.bin \
> +       fip/bl2_new.bin \
> +       bl2
> +
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
> +                                       --output fip/bl30_new.bin.g12a.enc \
> +                                       --level v3
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
> +                                       --output fip/bl30_new.bin.enc \
> +                                       --level v3 --type bl30
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
> +                                       --output fip/bl31.img.enc \
> +                                       --level v3 --type bl31
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
> +                                       --output fip/bl33.bin.enc \
> +                                       --level v3 --type bl33
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
> +                                       --output fip/bl2.n.bin.sig
> + > $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
> +               --output fip/u-boot.bin \
> +               --bl2 fip/bl2.n.bin.sig \
> +               --bl30 fip/bl30_new.bin.enc \
> +               --bl31 fip/bl31.img.enc \
> +               --bl33 fip/bl33.bin.enc \
> +               --ddrfw1 fip/ddr4_1d.fw \
> +               --ddrfw2 fip/ddr4_2d.fw \
> +               --ddrfw3 fip/ddr3_1d.fw \
> +               --ddrfw4 fip/piei.fw \
> +               --ddrfw5 fip/lpddr4_1d.fw \
> +               --ddrfw6 fip/lpddr4_2d.fw \
> +               --ddrfw7 fip/diag_lpddr4.fw \
> +               --ddrfw8 fip/aml_ddr.fw \
> +               --level v3
> +
> +and then write the image to SD with:
> +
> + > DEV=/dev/your_sd_device
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
> diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
> new file mode 100644
> index 0000000000..4737865367
> --- /dev/null
> +++ b/board/amlogic/w400/w400.c
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2016 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <environment.h>
> +#include <asm/io.h>
> +#include <asm/arch/eth.h>
> +
> +int misc_init_r(void)
> +{
> +       meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
> +
> +       return 0;
> +}
> diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
> new file mode 100644
> index 0000000000..38d1549375
> --- /dev/null
> +++ b/configs/odroid-n2_defconfig
> @@ -0,0 +1,56 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_MESON=y
> +CONFIG_SYS_TEXT_BASE=0x01000000
> +CONFIG_MESON_G12A=y
> +CONFIG_SYS_BOARD="w400"
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_DEBUG_UART_BASE=0xff803000
> +CONFIG_DEBUG_UART_CLOCK=24000000
> +CONFIG_IDENT_STRING=" odroid-n2"
> +CONFIG_DEBUG_UART=y
> +CONFIG_OF_BOARD_SETUP=y
> +CONFIG_MISC_INIT_R=y
> +# CONFIG_DISPLAY_CPUINFO is not set
> +# CONFIG_CMD_BDI is not set
> +# CONFIG_CMD_IMI is not set
> +CONFIG_CMD_GPIO=y
> +# CONFIG_CMD_LOADS is not set
> +CONFIG_CMD_MMC=y
> +# CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_REGULATOR=y
> +CONFIG_OF_CONTROL=y
> +CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
> +CONFIG_NET_RANDOM_ETHADDR=y
> +CONFIG_DM_GPIO=y
> +CONFIG_DM_MMC=y
> +CONFIG_MMC_MESON_GX=y
> +CONFIG_PHY_REALTEK=y
> +CONFIG_DM_ETH=y
> +CONFIG_ETH_DESIGNWARE=y
> +CONFIG_PINCTRL=y
> +CONFIG_PINCTRL_MESON_G12A=y
> +CONFIG_DM_REGULATOR=y
> +CONFIG_DM_REGULATOR_FIXED=y
> +CONFIG_DM_RESET=y
> +CONFIG_DEBUG_UART_MESON=y
> +CONFIG_DEBUG_UART_ANNOUNCE=y
> +CONFIG_DEBUG_UART_SKIP_INIT=y
> +CONFIG_MESON_SERIAL=y
> +CONFIG_OF_LIBFDT_OVERLAY=y
> +CONFIG_USB=y
> +CONFIG_USB_HOST=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_DOWNLOAD=y
> +CONFIG_PHY=y
> +CONFIG_MESON_G12A_USB_PHY=y
> +CONFIG_DM_USB=y
> +CONFIG_USB_GADGET_DWC2_OTG=y
> +CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
> +CONFIG_USB_XHCI_HCD=y
> +CONFIG_USB_XHCI_DWC3=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_MESON_G12A=y
> +CONFIG_CMD_USB=y
> +CONFIG_CMD_USB_MASS_STORAGE=y
> +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
> +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
> --
> 2.22.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
@ 2019-07-22 17:08     ` Anand Moon
  0 siblings, 0 replies; 17+ messages in thread
From: Anand Moon @ 2019-07-22 17:08 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: U-Boot Mailing List, u-boot-amlogic

Hi Neil,

On Mon, 22 Jul 2019 at 16:00, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
> with the following specifications:
>
>  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
>  - 4GB DDR4 SDRAM
>  - Gigabit Ethernet
>  - HDMI 2.1 4K/60Hz display
>  - 40-pin GPIO header
>  - 4 x USB 3.0 Host, 1 x USB OTG
>  - eMMC, microSD
>  - Infrared receiver
>
> The board directory is W400, the name of the Amlogic Reference Design
> of Amlogic G12B with Gigabit boards, which will be used for similar
> boards.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  board/amlogic/w400/MAINTAINERS      |   6 ++
>  board/amlogic/w400/Makefile         |   6 ++
>  board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
>  board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
>  board/amlogic/w400/w400.c           |  18 ++++
>  configs/odroid-n2_defconfig         |  56 ++++++++++++
>  6 files changed, 346 insertions(+)
>  create mode 100644 board/amlogic/w400/MAINTAINERS
>  create mode 100644 board/amlogic/w400/Makefile
>  create mode 100644 board/amlogic/w400/README.odroid-n2
>  create mode 100644 board/amlogic/w400/README.w400
>  create mode 100644 board/amlogic/w400/w400.c
>  create mode 100644 configs/odroid-n2_defconfig
>
> diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
> new file mode 100644
> index 0000000000..6e68fa73f7
> --- /dev/null
> +++ b/board/amlogic/w400/MAINTAINERS
> @@ -0,0 +1,6 @@
> +W400
> +M:     Neil Armstrong <narmstrong@baylibre.com>
> +S:     Maintained
> +L:     u-boot-amlogic@groups.io
> +F:     board/amlogic/w400/
> +F:     configs/odroid-n2_defconfig
> diff --git a/board/amlogic/w400/Makefile b/board/amlogic/w400/Makefile
> new file mode 100644
> index 0000000000..fac4a73afa
> --- /dev/null
> +++ b/board/amlogic/w400/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# (C) Copyright 2019 BayLibre, SAS
> +# Author: Neil Armstrong <narmstrong@baylibre.com>
> +
> +obj-y  := w400.o
> diff --git a/board/amlogic/w400/README.odroid-n2 b/board/amlogic/w400/README.odroid-n2
> new file mode 100644
> index 0000000000..90070a988d
> --- /dev/null
> +++ b/board/amlogic/w400/README.odroid-n2
> @@ -0,0 +1,130 @@
> +U-Boot for ODROID-N2
> +====================
> +
> +ODROID-N2 is a single board computer manufactured by Hardkernel
> +Co. Ltd with the following specifications:
> +
> + - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
> + - 4GB DDR4 SDRAM
> + - Gigabit Ethernet
> + - HDMI 2.1 4K/60Hz display
> + - 40-pin GPIO header
> + - 4 x USB 3.0 Host, 1 x USB OTG
> + - eMMC, microSD
> + - Infrared receiver
> +
> +Schematics are available on the manufacturer website.
> +
> +Currently the u-boot port supports the following devices:
> + - serial
> + - eMMC, microSD
> + - Ethernet
> + - I2C
> + - Regulators
> + - Reset controller
> + - Clock controller
> + - ADC
> +
> +u-boot compilation
> +==================
> +
> + > export ARCH=arm
> + > export CROSS_COMPILE=aarch64-none-elf-
> + > make odroid-n2_defconfig
> + > make
> +
> +Image creation
> +==============
> +
> +Amlogic doesn't provide sources for the firmware and for tools needed
> +to create the bootloader image, so it is necessary to obtain them from
> +the git tree published by the board vendor:
> +
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
> +

Should we checkout odroidn2-v2015.01 from Hardkernel repository.


> + > DIR=odroid-c2
> + > git clone --depth 1 \
> +       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
> +       $DIR
> +
> + > cd odroid-c2
> + > make odroidn2_defconfig
> + > make
> + > export UBOOTDIR=$PWD
> +
> + Go back to mainline U-Boot source tree then :
> + > mkdir fip
> +
> + > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
> + > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
> + > cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
> + > cp $UBOOTDIR/fip/g12b/bl31.img fip/
> + > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
> + > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
> + > cp $UBOOTDIR/fip/g12b/piei.fw fip/
> + > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
> + > cp u-boot.bin fip/bl33.bin
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl30.bin \
> +       fip/zero_tmp \
> +       fip/bl30_zero.bin \
> +       fip/bl301.bin \
> +       fip/bl301_zero.bin \
> +       fip/bl30_new.bin \
> +       bl30
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl2.bin \
> +       fip/zero_tmp \
> +       fip/bl2_zero.bin \
> +       fip/acs.bin \
> +       fip/bl21_zero.bin \
> +       fip/bl2_new.bin \
> +       bl2
> +
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
> +                                       --output fip/bl30_new.bin.g12a.enc \
> +                                       --level v3
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
> +                                       --output fip/bl30_new.bin.enc \
> +                                       --level v3 --type bl30
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
> +                                       --output fip/bl31.img.enc \
> +                                       --level v3 --type bl31
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
> +                                       --output fip/bl33.bin.enc \
> +                                       --level v3 --type bl33 --compress lz4
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
> +                                       --output fip/bl2.n.bin.sig
> + > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
> +               --output fip/u-boot.bin \
> +               --bl2 fip/bl2.n.bin.sig \
> +               --bl30 fip/bl30_new.bin.enc \
> +               --bl31 fip/bl31.img.enc \
> +               --bl33 fip/bl33.bin.enc \
> +               --ddrfw1 fip/ddr4_1d.fw \
> +               --ddrfw2 fip/ddr4_2d.fw \
> +               --ddrfw3 fip/ddr3_1d.fw \
> +               --ddrfw4 fip/piei.fw \
> +               --ddrfw5 fip/lpddr4_1d.fw \
> +               --ddrfw6 fip/lpddr4_2d.fw \
> +               --ddrfw7 fip/diag_lpddr4.fw \
> +               --ddrfw8 fip/aml_ddr.fw \
> +               --level v3
> +
> +and then write the image to SD with:
> +
> + > DEV=/dev/your_sd_device
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
> diff --git a/board/amlogic/w400/README.w400 b/board/amlogic/w400/README.w400
> new file mode 100644
> index 0000000000..25b786d817
> --- /dev/null
> +++ b/board/amlogic/w400/README.w400
> @@ -0,0 +1,130 @@
> +U-Boot for Amlogic W400
> +=======================
> +
> +U200 is a reference board manufactured by Amlogic with the following
> +specifications:
> +
> + - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
> + - 2GB DDR4 SDRAM
> + - 10/100 Ethernet (Internal PHY)
> + - 1 x USB 3.0 Host
> + - eMMC
> + - SDcard
> + - Infrared receiver
> + - SDIO WiFi Module
> + - MIPI DSI Connector
> + - Audio HAT Connector
> + - PCI-E M.2 Connector
> +
> +Schematics are available from Amlogic on demand.
> +
> +Currently the u-boot port supports the following devices:
> + - serial
> + - Ethernet
> + - Regulators
> + - Clock controller
> +
> +u-boot compilation
> +==================
> +
> + > export ARCH=arm
> + > export CROSS_COMPILE=aarch64-none-elf-
> + > make w400_defconfig
> + > make
> +
> +Image creation
> +==============
> +
> +Amlogic doesn't provide sources for the firmware and for tools needed
> +to create the bootloader image, so it is necessary to obtain them from
> +the git tree published by the board vendor:
> +
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
> + > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
> + > cd amlogic-u-boot
> + > make g12b_w400_v1_defconfig
> + > make
> + > export UBOOTDIR=$PWD
> +
> +Download the latest Amlogic Buildroot package, and extract it :
> + > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
> + > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
> + > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
> + > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
> +
> +Go back to mainline U-Boot source tree then :
> + > mkdir fip
> +
> + > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
> + > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
> + > cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
> + > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
> + > cp $FIPDIR/g12b/ddr3_1d.fw fip/
> + > cp $FIPDIR/g12b/ddr4_1d.fw fip/
> + > cp $FIPDIR/g12b/ddr4_2d.fw fip/
> + > cp $FIPDIR/g12b/diag_lpddr4.fw fip/
> + > cp $FIPDIR/g12b/lpddr4_1d.fw fip/
> + > cp $FIPDIR/g12b/lpddr4_2d.fw fip/
> + > cp $FIPDIR/g12b/piei.fw fip/
> + > cp $FIPDIR/g12b/aml_ddr.fw fip/
> + > cp u-boot.bin fip/bl33.bin
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl30.bin \
> +       fip/zero_tmp \
> +       fip/bl30_zero.bin \
> +       fip/bl301.bin \
> +       fip/bl301_zero.bin \
> +       fip/bl30_new.bin \
> +       bl30
> +
> + > sh fip/blx_fix.sh \
> +       fip/bl2.bin \
> +       fip/zero_tmp \
> +       fip/bl2_zero.bin \
> +       fip/acs.bin \
> +       fip/bl21_zero.bin \
> +       fip/bl2_new.bin \
> +       bl2
> +
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
> +                                       --output fip/bl30_new.bin.g12a.enc \
> +                                       --level v3
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
> +                                       --output fip/bl30_new.bin.enc \
> +                                       --level v3 --type bl30
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
> +                                       --output fip/bl31.img.enc \
> +                                       --level v3 --type bl31
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
> +                                       --output fip/bl33.bin.enc \
> +                                       --level v3 --type bl33
> + > $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
> +                                       --output fip/bl2.n.bin.sig
> + > $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
> +               --output fip/u-boot.bin \
> +               --bl2 fip/bl2.n.bin.sig \
> +               --bl30 fip/bl30_new.bin.enc \
> +               --bl31 fip/bl31.img.enc \
> +               --bl33 fip/bl33.bin.enc \
> +               --ddrfw1 fip/ddr4_1d.fw \
> +               --ddrfw2 fip/ddr4_2d.fw \
> +               --ddrfw3 fip/ddr3_1d.fw \
> +               --ddrfw4 fip/piei.fw \
> +               --ddrfw5 fip/lpddr4_1d.fw \
> +               --ddrfw6 fip/lpddr4_2d.fw \
> +               --ddrfw7 fip/diag_lpddr4.fw \
> +               --ddrfw8 fip/aml_ddr.fw \
> +               --level v3
> +
> +and then write the image to SD with:
> +
> + > DEV=/dev/your_sd_device
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
> + > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
> diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
> new file mode 100644
> index 0000000000..4737865367
> --- /dev/null
> +++ b/board/amlogic/w400/w400.c
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2016 BayLibre, SAS
> + * Author: Neil Armstrong <narmstrong@baylibre.com>
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <environment.h>
> +#include <asm/io.h>
> +#include <asm/arch/eth.h>
> +
> +int misc_init_r(void)
> +{
> +       meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
> +
> +       return 0;
> +}
> diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
> new file mode 100644
> index 0000000000..38d1549375
> --- /dev/null
> +++ b/configs/odroid-n2_defconfig
> @@ -0,0 +1,56 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_MESON=y
> +CONFIG_SYS_TEXT_BASE=0x01000000
> +CONFIG_MESON_G12A=y
> +CONFIG_SYS_BOARD="w400"
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_DEBUG_UART_BASE=0xff803000
> +CONFIG_DEBUG_UART_CLOCK=24000000
> +CONFIG_IDENT_STRING=" odroid-n2"
> +CONFIG_DEBUG_UART=y
> +CONFIG_OF_BOARD_SETUP=y
> +CONFIG_MISC_INIT_R=y
> +# CONFIG_DISPLAY_CPUINFO is not set
> +# CONFIG_CMD_BDI is not set
> +# CONFIG_CMD_IMI is not set
> +CONFIG_CMD_GPIO=y
> +# CONFIG_CMD_LOADS is not set
> +CONFIG_CMD_MMC=y
> +# CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_REGULATOR=y
> +CONFIG_OF_CONTROL=y
> +CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
> +CONFIG_NET_RANDOM_ETHADDR=y
> +CONFIG_DM_GPIO=y
> +CONFIG_DM_MMC=y
> +CONFIG_MMC_MESON_GX=y
> +CONFIG_PHY_REALTEK=y
> +CONFIG_DM_ETH=y
> +CONFIG_ETH_DESIGNWARE=y
> +CONFIG_PINCTRL=y
> +CONFIG_PINCTRL_MESON_G12A=y
> +CONFIG_DM_REGULATOR=y
> +CONFIG_DM_REGULATOR_FIXED=y
> +CONFIG_DM_RESET=y
> +CONFIG_DEBUG_UART_MESON=y
> +CONFIG_DEBUG_UART_ANNOUNCE=y
> +CONFIG_DEBUG_UART_SKIP_INIT=y
> +CONFIG_MESON_SERIAL=y
> +CONFIG_OF_LIBFDT_OVERLAY=y
> +CONFIG_USB=y
> +CONFIG_USB_HOST=y
> +CONFIG_USB_GADGET=y
> +CONFIG_USB_GADGET_DOWNLOAD=y
> +CONFIG_PHY=y
> +CONFIG_MESON_G12A_USB_PHY=y
> +CONFIG_DM_USB=y
> +CONFIG_USB_GADGET_DWC2_OTG=y
> +CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
> +CONFIG_USB_XHCI_HCD=y
> +CONFIG_USB_XHCI_DWC3=y
> +CONFIG_USB_DWC3=y
> +CONFIG_USB_DWC3_MESON_G12A=y
> +CONFIG_CMD_USB=y
> +CONFIG_CMD_USB_MASS_STORAGE=y
> +CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
> +CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
> --
> 2.22.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
  2019-07-22 17:08     ` Anand Moon
@ 2019-07-23  7:49       ` Neil Armstrong
  -1 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-23  7:49 UTC (permalink / raw)
  To: u-boot

Hi Anand,

On 22/07/2019 19:08, Anand Moon wrote:
> Hi Neil,
> 
> On Mon, 22 Jul 2019 at 16:00, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
>> with the following specifications:
>>
>>  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
>>  - 4GB DDR4 SDRAM
>>  - Gigabit Ethernet
>>  - HDMI 2.1 4K/60Hz display
>>  - 40-pin GPIO header
>>  - 4 x USB 3.0 Host, 1 x USB OTG
>>  - eMMC, microSD
>>  - Infrared receiver
>>
>> The board directory is W400, the name of the Amlogic Reference Design
>> of Amlogic G12B with Gigabit boards, which will be used for similar
>> boards.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  board/amlogic/w400/MAINTAINERS      |   6 ++
>>  board/amlogic/w400/Makefile         |   6 ++
>>  board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
>>  board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
>>  board/amlogic/w400/w400.c           |  18 ++++
>>  configs/odroid-n2_defconfig         |  56 ++++++++++++
>>  6 files changed, 346 insertions(+)
>>  create mode 100644 board/amlogic/w400/MAINTAINERS
>>  create mode 100644 board/amlogic/w400/Makefile
>>  create mode 100644 board/amlogic/w400/README.odroid-n2
>>  create mode 100644 board/amlogic/w400/README.w400
>>  create mode 100644 board/amlogic/w400/w400.c
>>  create mode 100644 configs/odroid-n2_defconfig
>>
[..]

>> +
>> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
>> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
>> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
>> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
>> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
>> +
> 
> Should we checkout odroidn2-v2015.01 from Hardkernel repository.

Yes, you are right it's a typo !

> 
> 
>> + > DIR=odroid-c2
>> + > git clone --depth 1 \
>> +       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
>> +       $DIR
>> +

[..]

Thanks,
Neil

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
@ 2019-07-23  7:49       ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-23  7:49 UTC (permalink / raw)
  To: Anand Moon; +Cc: U-Boot Mailing List, u-boot-amlogic

Hi Anand,

On 22/07/2019 19:08, Anand Moon wrote:
> Hi Neil,
> 
> On Mon, 22 Jul 2019 at 16:00, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
>> with the following specifications:
>>
>>  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
>>  - 4GB DDR4 SDRAM
>>  - Gigabit Ethernet
>>  - HDMI 2.1 4K/60Hz display
>>  - 40-pin GPIO header
>>  - 4 x USB 3.0 Host, 1 x USB OTG
>>  - eMMC, microSD
>>  - Infrared receiver
>>
>> The board directory is W400, the name of the Amlogic Reference Design
>> of Amlogic G12B with Gigabit boards, which will be used for similar
>> boards.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  board/amlogic/w400/MAINTAINERS      |   6 ++
>>  board/amlogic/w400/Makefile         |   6 ++
>>  board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
>>  board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
>>  board/amlogic/w400/w400.c           |  18 ++++
>>  configs/odroid-n2_defconfig         |  56 ++++++++++++
>>  6 files changed, 346 insertions(+)
>>  create mode 100644 board/amlogic/w400/MAINTAINERS
>>  create mode 100644 board/amlogic/w400/Makefile
>>  create mode 100644 board/amlogic/w400/README.odroid-n2
>>  create mode 100644 board/amlogic/w400/README.w400
>>  create mode 100644 board/amlogic/w400/w400.c
>>  create mode 100644 configs/odroid-n2_defconfig
>>
[..]

>> +
>> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
>> + > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
>> + > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
>> + > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
>> + > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
>> +
> 
> Should we checkout odroidn2-v2015.01 from Hardkernel repository.

Yes, you are right it's a typo !

> 
> 
>> + > DIR=odroid-c2
>> + > git clone --depth 1 \
>> +       https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
>> +       $DIR
>> +

[..]

Thanks,
Neil

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/3] ARM: dts: add support for Odroid-N2
  2019-07-22 17:07     ` Anand Moon
@ 2019-07-23  7:50       ` Neil Armstrong
  -1 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-23  7:50 UTC (permalink / raw)
  To: u-boot

Hi Anand,

On 22/07/2019 19:07, Anand Moon wrote:
> Hi Neil,
> 
> On Mon, 22 Jul 2019 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
>> ("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  arch/arm/dts/Makefile                         |   3 +-
>>  arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
>>  arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
>>  .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
>>  4 files changed, 483 insertions(+), 1 deletion(-)
>>  create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
>>  create mode 100644 arch/arm/dts/meson-g12b.dtsi
>>  create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
>>
> 
> I am getting following error while building this on mainline u-boot.

I forgot to explicit in the cover letter, but you'll need https://patchwork.ozlabs.org/patch/1134772/
before this serie.

Neil

> 
>   CHK     include/config/uboot.release
>   UPD     include/config/uboot.release
>   CHK     include/generated/version_autogenerated.h
>   UPD     include/generated/version_autogenerated.h
>   CHK     include/generated/timestamp_autogenerated.h
>   UPD     include/generated/timestamp_autogenerated.h
>   CHK     include/generated/generic-asm-offsets.h
>   CHK     include/generated/asm-offsets.h
>   HOSTCC  tools/mkenvimage.o
>   HOSTLD  tools/mkenvimage
>   HOSTCC  tools/dumpimage.o
>   HOSTLD  tools/dumpimage
>   HOSTCC  tools/mkimage.o
>   HOSTLD  tools/mkimage
>   CC      arch/arm/cpu/armv8/fwcall.o
>   LD      arch/arm/cpu/armv8/built-in.o
>   CC      cmd/version.o
>   LD      cmd/built-in.o
>   CC      common/main.o
>   LD      common/built-in.o
>   CC      lib/efi_loader/helloworld.o
>   CC      lib/efi_loader/efi_reloc.o
>   CC      lib/efi_loader/efi_freestanding.o
>   LD      lib/efi_loader/helloworld_efi.so
>   OBJCOPY lib/efi_loader/helloworld.efi
>   CC      lib/smbios.o
>   CC      lib/display_options.o
>   LD      lib/built-in.o
>   LD      u-boot
>   OBJCOPY u-boot.srec
>   OBJCOPY u-boot-nodtb.bin
> start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1
> -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut
> -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x01000000 $start
> $end
>   DTC     arch/arm/dts/meson-g12b-odroid-n2.dtb
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:226.1-5 Label or
> path arb not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:244.1-12 Label
> or path clkc_audio not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:248.1-10 Label
> or path ext_mdio not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:264.1-8 Label or
> path ethmac not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:273.1-9 Label or
> path frddr_a not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:277.1-9 Label or
> path frddr_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:281.1-9 Label or
> path frddr_c not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:313.1-4 Label or
> path ir not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:320.1-11 Label
> or path sd_emmc_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:338.1-11 Label
> or path sd_emmc_c not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:356.1-9 Label or
> path tdmif_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:360.1-10 Label
> or path tdmout_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:364.1-10 Label
> or path tohdmitx not found
> FATAL ERROR: Syntax error parsing input tree
> make[2]: *** [scripts/Makefile.lib:308:
> arch/arm/dts/meson-g12b-odroid-n2.dtb] Error 1
> make[1]: *** [dts/Makefile:38: arch-dtbs] Error 2
> make: *** [Makefile:1045: dts/dt.dtb] Error 2
> 
> 

[..]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [U-Boot] [PATCH 1/3] ARM: dts: add support for Odroid-N2
@ 2019-07-23  7:50       ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-23  7:50 UTC (permalink / raw)
  To: Anand Moon; +Cc: U-Boot Mailing List, u-boot-amlogic

Hi Anand,

On 22/07/2019 19:07, Anand Moon wrote:
> Hi Neil,
> 
> On Mon, 22 Jul 2019 at 15:50, Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> Import HardKernel Odroid-N2 DT from Linux 5.3-rc1, commit 5f9e832c1370
>> ("Linus 5.3-rc1") based on an Amlogic G12B S922X SoC.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  arch/arm/dts/Makefile                         |   3 +-
>>  arch/arm/dts/meson-g12b-odroid-n2.dts         | 386 ++++++++++++++++++
>>  arch/arm/dts/meson-g12b.dtsi                  |  82 ++++
>>  .../dt-bindings/sound/meson-g12a-tohdmitx.h   |  13 +
>>  4 files changed, 483 insertions(+), 1 deletion(-)
>>  create mode 100644 arch/arm/dts/meson-g12b-odroid-n2.dts
>>  create mode 100644 arch/arm/dts/meson-g12b.dtsi
>>  create mode 100644 include/dt-bindings/sound/meson-g12a-tohdmitx.h
>>
> 
> I am getting following error while building this on mainline u-boot.

I forgot to explicit in the cover letter, but you'll need https://patchwork.ozlabs.org/patch/1134772/
before this serie.

Neil

> 
>   CHK     include/config/uboot.release
>   UPD     include/config/uboot.release
>   CHK     include/generated/version_autogenerated.h
>   UPD     include/generated/version_autogenerated.h
>   CHK     include/generated/timestamp_autogenerated.h
>   UPD     include/generated/timestamp_autogenerated.h
>   CHK     include/generated/generic-asm-offsets.h
>   CHK     include/generated/asm-offsets.h
>   HOSTCC  tools/mkenvimage.o
>   HOSTLD  tools/mkenvimage
>   HOSTCC  tools/dumpimage.o
>   HOSTLD  tools/dumpimage
>   HOSTCC  tools/mkimage.o
>   HOSTLD  tools/mkimage
>   CC      arch/arm/cpu/armv8/fwcall.o
>   LD      arch/arm/cpu/armv8/built-in.o
>   CC      cmd/version.o
>   LD      cmd/built-in.o
>   CC      common/main.o
>   LD      common/built-in.o
>   CC      lib/efi_loader/helloworld.o
>   CC      lib/efi_loader/efi_reloc.o
>   CC      lib/efi_loader/efi_freestanding.o
>   LD      lib/efi_loader/helloworld_efi.so
>   OBJCOPY lib/efi_loader/helloworld.efi
>   CC      lib/smbios.o
>   CC      lib/display_options.o
>   LD      lib/built-in.o
>   LD      u-boot
>   OBJCOPY u-boot.srec
>   OBJCOPY u-boot-nodtb.bin
> start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1
> -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut
> -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x01000000 $start
> $end
>   DTC     arch/arm/dts/meson-g12b-odroid-n2.dtb
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:226.1-5 Label or
> path arb not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:244.1-12 Label
> or path clkc_audio not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:248.1-10 Label
> or path ext_mdio not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:264.1-8 Label or
> path ethmac not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:273.1-9 Label or
> path frddr_a not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:277.1-9 Label or
> path frddr_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:281.1-9 Label or
> path frddr_c not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:313.1-4 Label or
> path ir not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:320.1-11 Label
> or path sd_emmc_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:338.1-11 Label
> or path sd_emmc_c not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:356.1-9 Label or
> path tdmif_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:360.1-10 Label
> or path tdmout_b not found
> Error: arch/arm/dts/.meson-g12b-odroid-n2.dtb.pre.tmp:364.1-10 Label
> or path tohdmitx not found
> FATAL ERROR: Syntax error parsing input tree
> make[2]: *** [scripts/Makefile.lib:308:
> arch/arm/dts/meson-g12b-odroid-n2.dtb] Error 1
> make[1]: *** [dts/Makefile:38: arch-dtbs] Error 2
> make: *** [Makefile:1045: dts/dt.dtb] Error 2
> 
> 

[..]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2
  2019-07-29 13:45 [U-Boot] [PATCH 0/3] amlogic: Add " Neil Armstrong
@ 2019-07-29 13:45 ` Neil Armstrong
  0 siblings, 0 replies; 17+ messages in thread
From: Neil Armstrong @ 2019-07-29 13:45 UTC (permalink / raw)
  To: u-boot

ODROID-N2 is a single board computer manufactured by Hardkernel Co. Ltd
with the following specifications:

 - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
 - 4GB DDR4 SDRAM
 - Gigabit Ethernet
 - HDMI 2.1 4K/60Hz display
 - 40-pin GPIO header
 - 4 x USB 3.0 Host, 1 x USB OTG
 - eMMC, microSD
 - Infrared receiver

The board directory is W400, the name of the Amlogic Reference Design
of Amlogic G12B with Gigabit boards, which will be used for similar
boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 board/amlogic/w400/MAINTAINERS      |   6 ++
 board/amlogic/w400/Makefile         |   6 ++
 board/amlogic/w400/README.odroid-n2 | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/README.w400      | 130 ++++++++++++++++++++++++++++
 board/amlogic/w400/w400.c           |  18 ++++
 configs/odroid-n2_defconfig         |  56 ++++++++++++
 6 files changed, 346 insertions(+)
 create mode 100644 board/amlogic/w400/MAINTAINERS
 create mode 100644 board/amlogic/w400/Makefile
 create mode 100644 board/amlogic/w400/README.odroid-n2
 create mode 100644 board/amlogic/w400/README.w400
 create mode 100644 board/amlogic/w400/w400.c
 create mode 100644 configs/odroid-n2_defconfig

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
new file mode 100644
index 0000000000..6e68fa73f7
--- /dev/null
+++ b/board/amlogic/w400/MAINTAINERS
@@ -0,0 +1,6 @@
+W400
+M:	Neil Armstrong <narmstrong@baylibre.com>
+S:	Maintained
+L:	u-boot-amlogic at groups.io
+F:	board/amlogic/w400/
+F:	configs/odroid-n2_defconfig
diff --git a/board/amlogic/w400/Makefile b/board/amlogic/w400/Makefile
new file mode 100644
index 0000000000..fac4a73afa
--- /dev/null
+++ b/board/amlogic/w400/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2019 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y	:= w400.o
diff --git a/board/amlogic/w400/README.odroid-n2 b/board/amlogic/w400/README.odroid-n2
new file mode 100644
index 0000000000..a8f2c3d7da
--- /dev/null
+++ b/board/amlogic/w400/README.odroid-n2
@@ -0,0 +1,130 @@
+U-Boot for ODROID-N2
+====================
+
+ODROID-N2 is a single board computer manufactured by Hardkernel
+Co. Ltd with the following specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 4GB DDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 4K/60Hz display
+ - 40-pin GPIO header
+ - 4 x USB 3.0 Host, 1 x USB OTG
+ - eMMC, microSD
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make odroid-n2_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=odroid-n2
+ > git clone --depth 1 \
+       https://github.com/hardkernel/u-boot.git -b odroidn2-v2015.01 \
+       $DIR
+
+ > cd odroid-n2
+ > make odroidn2_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/hardkernel/odroidn2/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12b/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12b/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12b/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/README.w400 b/board/amlogic/w400/README.w400
new file mode 100644
index 0000000000..25b786d817
--- /dev/null
+++ b/board/amlogic/w400/README.w400
@@ -0,0 +1,130 @@
+U-Boot for Amlogic W400
+=======================
+
+U200 is a reference board manufactured by Amlogic with the following
+specifications:
+
+ - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 10/100 Ethernet (Internal PHY)
+ - 1 x USB 3.0 Host
+ - eMMC
+ - SDcard
+ - Infrared receiver
+ - SDIO WiFi Module
+ - MIPI DSI Connector
+ - Audio HAT Connector
+ - PCI-E M.2 Connector
+
+Schematics are available from Amlogic on demand.
+
+Currently the u-boot port supports the following devices:
+ - serial
+ - Ethernet
+ - Regulators
+ - Clock controller
+
+u-boot compilation
+==================
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make w400_defconfig
+ > make
+
+Image creation
+==============
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+ > git clone https://github.com/BayLibre/u-boot.git -b buildroot-openlinux-20180418 amlogic-u-boot
+ > cd amlogic-u-boot
+ > make g12b_w400_v1_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+Download the latest Amlogic Buildroot package, and extract it :
+ > wget http://openlinux2.amlogic.com:8000/ARM/filesystem/Linux_BSP/buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz
+ > tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180706.tar.gz buildroot_openlinux_kernel_4.9_fbdev_20180706/bootloader
+ > export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
+ > export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
+
+Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > wget https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh -O fip/blx_fix.sh
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/amlogic/g12b_w400_v1/firmware/acs.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl2/bin/g12b/bl2.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl30/bin/g12b/bl30.bin fip/
+ > cp $BRDIR/bootloader/uboot-repo/bl31_1.3/bin/g12b/bl31.img fip/
+ > cp $FIPDIR/g12b/ddr3_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/ddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/diag_lpddr4.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_1d.fw fip/
+ > cp $FIPDIR/g12b/lpddr4_2d.fw fip/
+ > cp $FIPDIR/g12b/piei.fw fip/
+ > cp $FIPDIR/g12b/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+	fip/bl30.bin \
+	fip/zero_tmp \
+	fip/bl30_zero.bin \
+	fip/bl301.bin \
+	fip/bl301_zero.bin \
+	fip/bl30_new.bin \
+	bl30
+
+ > sh fip/blx_fix.sh \
+	fip/bl2.bin \
+	fip/zero_tmp \
+	fip/bl2_zero.bin \
+	fip/acs.bin \
+	fip/bl21_zero.bin \
+	fip/bl2_new.bin \
+	bl2
+
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+					--output fip/bl30_new.bin.g12a.enc \
+					--level v3
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+					--output fip/bl30_new.bin.enc \
+					--level v3 --type bl30
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+					--output fip/bl31.img.enc \
+					--level v3 --type bl31
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+					--output fip/bl33.bin.enc \
+					--level v3 --type bl33
+ > $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+					--output fip/bl2.n.bin.sig
+ > $FIPDIR/g12b/aml_encrypt_g12b --bootmk \
+		--output fip/u-boot.bin \
+		--bl2 fip/bl2.n.bin.sig \
+		--bl30 fip/bl30_new.bin.enc \
+		--bl31 fip/bl31.img.enc \
+		--bl33 fip/bl33.bin.enc \
+		--ddrfw1 fip/ddr4_1d.fw \
+		--ddrfw2 fip/ddr4_2d.fw \
+		--ddrfw3 fip/ddr3_1d.fw \
+		--ddrfw4 fip/piei.fw \
+		--ddrfw5 fip/lpddr4_1d.fw \
+		--ddrfw6 fip/lpddr4_2d.fw \
+		--ddrfw7 fip/diag_lpddr4.fw \
+		--ddrfw8 fip/aml_ddr.fw \
+		--level v3
+
+and then write the image to SD with:
+
+ > DEV=/dev/your_sd_device
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+ > dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
new file mode 100644
index 0000000000..4737865367
--- /dev/null
+++ b/board/amlogic/w400/w400.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <environment.h>
+#include <asm/io.h>
+#include <asm/arch/eth.h>
+
+int misc_init_r(void)
+{
+	meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+	return 0;
+}
diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
new file mode 100644
index 0000000000..38d1549375
--- /dev/null
+++ b/configs/odroid-n2_defconfig
@@ -0,0 +1,56 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x01000000
+CONFIG_MESON_G12A=y
+CONFIG_SYS_BOARD="w400"
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" odroid-n2"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_USB=y
+CONFIG_USB_HOST=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_PHY=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_DM_USB=y
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-07-29 13:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22  9:48 [U-Boot] [PATCH 0/3] amlogic: Add support for Odroid-N2 Neil Armstrong
2019-07-22  9:48 ` Neil Armstrong
2019-07-22  9:48 ` [U-Boot] [PATCH 1/3] ARM: dts: add " Neil Armstrong
2019-07-22  9:48   ` Neil Armstrong
2019-07-22 17:07   ` [U-Boot] " Anand Moon
2019-07-22 17:07     ` Anand Moon
2019-07-23  7:50     ` Neil Armstrong
2019-07-23  7:50       ` Neil Armstrong
2019-07-22  9:48 ` [U-Boot] [PATCH 2/3] ARM: meson-g12a: Handle 4GiB DRAM size Neil Armstrong
2019-07-22  9:48   ` Neil Armstrong
2019-07-22  9:48 ` [U-Boot] [PATCH 3/3] board: amlogic: add support for Odroid-N2 Neil Armstrong
2019-07-22  9:48   ` Neil Armstrong
2019-07-22 17:08   ` [U-Boot] " Anand Moon
2019-07-22 17:08     ` Anand Moon
2019-07-23  7:49     ` Neil Armstrong
2019-07-23  7:49       ` Neil Armstrong
2019-07-29 13:45 [U-Boot] [PATCH 0/3] amlogic: Add " Neil Armstrong
2019-07-29 13:45 ` [U-Boot] [PATCH 3/3] board: amlogic: add " Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.