All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28  4:12 ` Chen-Yu Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2017-11-28  4:12 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Corentin Labbe

The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
Pi B+ form factor single board computer based on the Allwinner H3 SoC.
The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
and connectors are in the exact same position as on the Raspberry Pi B+.

Raspberry Pi B+ like peripherals supported on this board include:

  - Power input through micro-USB connector (without USB OTG)
  - Native 100 Mbps ethernet using the internal PHY, as opposed to
    USB-based on the RPi
  - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
    being connected through a USB 2.0 hub on the RPi
  - TV and audio output on a 3.5mm TRRS jack
  - HDMI output
  - Micro-SD card slot
  - Standard RPi B+ GPIO header, with the standard peripherals routed to
    the same pins.

    * 5V, 3.3V power, and ground
    * I2C0 on the H3 is routed to I2C1 pins on the RPi header
    * I2C1 on the H3 is routed to I2C0 pins on the RPi header
    * UART1 on the H3 is routed to UART0 pins on the RPi header
    * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
      with GPIO pin PA17 replacing the missing Chip Select 1
    * I2S1 on the H3 is routed to PCM pins on the RPi header

  - Additional peripherals from the H3 are available on different pins.
    These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3

In addition, there are a number of new features:

  - Console UART header
  - Consumer IR receiver
  - Camera interface (not compatible with RPi)
  - Onboard microphone
  - eMMC expansion module port
  - Heatsink mounting holes

This patch adds a dts file for this board that enables all "onboard"
peripherals currently supported. This means no display or camera
support.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---

There are two other variants [1] of this board, with different SoCs and
DRAM configuration. But the board remains the same, thanks to the SoCs
being pin compatible.

Do we need different board compatible strings? FWIW the soc compatible
string already encodes the soc variant, and the DRAM stuff is handled
by the bootloader. The filename also has the SoC family and chip name.
The displayed board model also has the SoC variant included. The board
itself is named "ALL-H3-CC".

I'm asking as we have the same issue with the Bananapi M2+ [2], where
they've released new variants with different SoCs and DRAM capacities
using the same board. Not sure if they are commercially available though.

Last, the LED polarity is wrong. This is due to the EMAC driver not
following the DT binding and looking for the "allwinner,leds-active-low"
under the PHY node, instead of the EMAC node. I've notified Corentin of
this issue.

[1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
[2] http://www.banana-pi.org/m2plus.html
---
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
 2 files changed, 197 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 3c139c63098f..aa68f719692f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-h2-plus-orangepi-zero.dtb \
 	sun8i-h3-bananapi-m2-plus.dtb \
 	sun8i-h3-beelink-x2.dtb \
+	sun8i-h3-libretech-all-h3-cc.dtb \
 	sun8i-h3-nanopi-m1.dtb	\
 	sun8i-h3-nanopi-m1-plus.dtb \
 	sun8i-h3-nanopi-neo.dtb \
diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
new file mode 100644
index 000000000000..6f544e007f71
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2017 Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+#include "sun8i-h3.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Libre Computer Board ALL-H3-CC H3";
+	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
+
+	aliases {
+		ethernet0 = &emac;
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		pwr_led {
+			label = "librecomputer:pwr";
+			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
+			default-state = "on";
+		};
+
+		status_led {
+			label = "librecomputer:status";
+			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+
+		recovery {
+			label = "recovery";
+			linux,code = <BTN_0>;
+			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+		};
+	};
+
+	reg_vcc1v2: vcc1v2 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc1v2";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
+		enable-active-high;
+	};
+
+	reg_vcc3v3: vcc3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&reg_vcc5v0>;
+	};
+
+	/* This represents the board's 5V input */
+	reg_vcc5v0: vcc5v0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+
+	reg_vcc_dram: vcc-dram {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-dram";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
+		enable-active-high;
+	};
+
+	reg_vcc_io: vcc-io {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-io";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc3v3>;
+		gpio = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
+	};
+
+	reg_vdd_cpux: vdd-cpux {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd-cpux";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
+		enable-active-high;
+	};
+};
+
+&codec {
+	allwinner,audio-routing =
+		"Line Out", "LINEOUT",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ehci1 {
+	status = "okay";
+};
+
+&ehci2 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
+&emac {
+	phy-handle = <&int_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_pins_a>;
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_pins_a>;
+	vmmc-supply = <&reg_vcc_io>;
+	bus-width = <4>;
+	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
+	cd-inverted;
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
+
+&ohci1 {
+	status = "okay";
+};
+
+&ohci2 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
+
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbphy {
+	/* VBUS on USB ports are always on */
+	usb0_vbus-supply = <&reg_vcc5v0>;
+	usb1_vbus-supply = <&reg_vcc5v0>;
+	usb2_vbus-supply = <&reg_vcc5v0>;
+	usb3_vbus-supply = <&reg_vcc5v0>;
+	status = "okay";
+};
-- 
2.15.0

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

* [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28  4:12 ` Chen-Yu Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2017-11-28  4:12 UTC (permalink / raw)
  To: linux-arm-kernel

The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
Pi B+ form factor single board computer based on the Allwinner H3 SoC.
The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
and connectors are in the exact same position as on the Raspberry Pi B+.

Raspberry Pi B+ like peripherals supported on this board include:

  - Power input through micro-USB connector (without USB OTG)
  - Native 100 Mbps ethernet using the internal PHY, as opposed to
    USB-based on the RPi
  - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
    being connected through a USB 2.0 hub on the RPi
  - TV and audio output on a 3.5mm TRRS jack
  - HDMI output
  - Micro-SD card slot
  - Standard RPi B+ GPIO header, with the standard peripherals routed to
    the same pins.

    * 5V, 3.3V power, and ground
    * I2C0 on the H3 is routed to I2C1 pins on the RPi header
    * I2C1 on the H3 is routed to I2C0 pins on the RPi header
    * UART1 on the H3 is routed to UART0 pins on the RPi header
    * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
      with GPIO pin PA17 replacing the missing Chip Select 1
    * I2S1 on the H3 is routed to PCM pins on the RPi header

  - Additional peripherals from the H3 are available on different pins.
    These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3

In addition, there are a number of new features:

  - Console UART header
  - Consumer IR receiver
  - Camera interface (not compatible with RPi)
  - Onboard microphone
  - eMMC expansion module port
  - Heatsink mounting holes

This patch adds a dts file for this board that enables all "onboard"
peripherals currently supported. This means no display or camera
support.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

There are two other variants [1] of this board, with different SoCs and
DRAM configuration. But the board remains the same, thanks to the SoCs
being pin compatible.

Do we need different board compatible strings? FWIW the soc compatible
string already encodes the soc variant, and the DRAM stuff is handled
by the bootloader. The filename also has the SoC family and chip name.
The displayed board model also has the SoC variant included. The board
itself is named "ALL-H3-CC".

I'm asking as we have the same issue with the Bananapi M2+ [2], where
they've released new variants with different SoCs and DRAM capacities
using the same board. Not sure if they are commercially available though.

Last, the LED polarity is wrong. This is due to the EMAC driver not
following the DT binding and looking for the "allwinner,leds-active-low"
under the PHY node, instead of the EMAC node. I've notified Corentin of
this issue.

[1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
[2] http://www.banana-pi.org/m2plus.html
---
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
 2 files changed, 197 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 3c139c63098f..aa68f719692f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-h2-plus-orangepi-zero.dtb \
 	sun8i-h3-bananapi-m2-plus.dtb \
 	sun8i-h3-beelink-x2.dtb \
+	sun8i-h3-libretech-all-h3-cc.dtb \
 	sun8i-h3-nanopi-m1.dtb	\
 	sun8i-h3-nanopi-m1-plus.dtb \
 	sun8i-h3-nanopi-neo.dtb \
diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
new file mode 100644
index 000000000000..6f544e007f71
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+#include "sun8i-h3.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Libre Computer Board ALL-H3-CC H3";
+	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
+
+	aliases {
+		ethernet0 = &emac;
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		pwr_led {
+			label = "librecomputer:pwr";
+			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
+			default-state = "on";
+		};
+
+		status_led {
+			label = "librecomputer:status";
+			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+
+		recovery {
+			label = "recovery";
+			linux,code = <BTN_0>;
+			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+		};
+	};
+
+	reg_vcc1v2: vcc1v2 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc1v2";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
+		enable-active-high;
+	};
+
+	reg_vcc3v3: vcc3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&reg_vcc5v0>;
+	};
+
+	/* This represents the board's 5V input */
+	reg_vcc5v0: vcc5v0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc5v0";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+
+	reg_vcc_dram: vcc-dram {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-dram";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
+		enable-active-high;
+	};
+
+	reg_vcc_io: vcc-io {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-io";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc3v3>;
+		gpio = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
+	};
+
+	reg_vdd_cpux: vdd-cpux {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd-cpux";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		regulator-boot-on;
+		vin-supply = <&reg_vcc5v0>;
+		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
+		enable-active-high;
+	};
+};
+
+&codec {
+	allwinner,audio-routing =
+		"Line Out", "LINEOUT",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&ehci1 {
+	status = "okay";
+};
+
+&ehci2 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
+&emac {
+	phy-handle = <&int_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};
+
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_pins_a>;
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_pins_a>;
+	vmmc-supply = <&reg_vcc_io>;
+	bus-width = <4>;
+	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
+	cd-inverted;
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
+
+&ohci1 {
+	status = "okay";
+};
+
+&ohci2 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
+
+&usb_otg {
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usbphy {
+	/* VBUS on USB ports are always on */
+	usb0_vbus-supply = <&reg_vcc5v0>;
+	usb1_vbus-supply = <&reg_vcc5v0>;
+	usb2_vbus-supply = <&reg_vcc5v0>;
+	usb3_vbus-supply = <&reg_vcc5v0>;
+	status = "okay";
+};
-- 
2.15.0

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

* Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
  2017-11-28  4:12 ` Chen-Yu Tsai
@ 2017-11-28  8:43     ` Maxime Ripard
  -1 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2017-11-28  8:43 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Corentin Labbe

[-- Attachment #1: Type: text/plain, Size: 5987 bytes --]

Hi,

On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
> and connectors are in the exact same position as on the Raspberry Pi B+.
> 
> Raspberry Pi B+ like peripherals supported on this board include:
> 
>   - Power input through micro-USB connector (without USB OTG)
>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>     USB-based on the RPi
>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>     being connected through a USB 2.0 hub on the RPi
>   - TV and audio output on a 3.5mm TRRS jack
>   - HDMI output
>   - Micro-SD card slot
>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
>     the same pins.
> 
>     * 5V, 3.3V power, and ground
>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>       with GPIO pin PA17 replacing the missing Chip Select 1
>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> 
>   - Additional peripherals from the H3 are available on different pins.
>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> 
> In addition, there are a number of new features:
> 
>   - Console UART header
>   - Consumer IR receiver
>   - Camera interface (not compatible with RPi)
>   - Onboard microphone
>   - eMMC expansion module port
>   - Heatsink mounting holes
> 
> This patch adds a dts file for this board that enables all "onboard"
> peripherals currently supported. This means no display or camera
> support.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> 
> There are two other variants [1] of this board, with different SoCs and
> DRAM configuration. But the board remains the same, thanks to the SoCs
> being pin compatible.
> 
> Do we need different board compatible strings?

Yes.

> FWIW the soc compatible string already encodes the soc variant, and
> the DRAM stuff is handled by the bootloader. The filename also has
> the SoC family and chip name.  The displayed board model also has
> the SoC variant included. The board itself is named "ALL-H3-CC".

The point of a board compatible is to identify the way a board
behaves. If we ever need to make any quirks for one particular board,
we have to have a compatible that uniquely identifies it.

However, we can have an intermediate compatible as well to catch all
those similar boards.

Something like:
   compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";

> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> they've released new variants with different SoCs and DRAM capacities
> using the same board. Not sure if they are commercially available though.

You can have a look at the way we handled all the q8 tablets that were
pretty much in the same case. It's been working quite well.

> Last, the LED polarity is wrong. This is due to the EMAC driver not
> following the DT binding and looking for the "allwinner,leds-active-low"
> under the PHY node, instead of the EMAC node. I've notified Corentin of
> this issue.

The DT should be correct, even if the code isn't. This seems to be a
driver bug that should be fixed, but we don't want to change the DT.

> [1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
> [2] http://www.banana-pi.org/m2plus.html
> ---
>  arch/arm/boot/dts/Makefile                         |   1 +
>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
>  2 files changed, 197 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 3c139c63098f..aa68f719692f 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>  	sun8i-h2-plus-orangepi-zero.dtb \
>  	sun8i-h3-bananapi-m2-plus.dtb \
>  	sun8i-h3-beelink-x2.dtb \
> +	sun8i-h3-libretech-all-h3-cc.dtb \

Any reason to use the code name and not the "marketing" name?

>  	sun8i-h3-nanopi-m1.dtb	\
>  	sun8i-h3-nanopi-m1-plus.dtb \
>  	sun8i-h3-nanopi-neo.dtb \
> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> new file mode 100644
> index 000000000000..6f544e007f71
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (C) 2017 Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> + *
> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> + */
> +
> +/dts-v1/;
> +#include "sun8i-h3.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +	model = "Libre Computer Board ALL-H3-CC H3";
> +	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
> +
> +	aliases {
> +		ethernet0 = &emac;
> +		serial0 = &uart0;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		pwr_led {
> +			label = "librecomputer:pwr";

You should have the color there too.

> +			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
> +			default-state = "on";
> +		};
> +
> +		status_led {
> +			label = "librecomputer:status";

Same thing here.

> +			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> +		};
> +	};
> +
> +	gpio_keys {
> +		compatible = "gpio-keys";
> +
> +		recovery {
> +			label = "recovery";
> +			linux,code = <BTN_0>;

How did you pick that keycode?

Looks good otherwise, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28  8:43     ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2017-11-28  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
> and connectors are in the exact same position as on the Raspberry Pi B+.
> 
> Raspberry Pi B+ like peripherals supported on this board include:
> 
>   - Power input through micro-USB connector (without USB OTG)
>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>     USB-based on the RPi
>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>     being connected through a USB 2.0 hub on the RPi
>   - TV and audio output on a 3.5mm TRRS jack
>   - HDMI output
>   - Micro-SD card slot
>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
>     the same pins.
> 
>     * 5V, 3.3V power, and ground
>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>       with GPIO pin PA17 replacing the missing Chip Select 1
>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> 
>   - Additional peripherals from the H3 are available on different pins.
>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> 
> In addition, there are a number of new features:
> 
>   - Console UART header
>   - Consumer IR receiver
>   - Camera interface (not compatible with RPi)
>   - Onboard microphone
>   - eMMC expansion module port
>   - Heatsink mounting holes
> 
> This patch adds a dts file for this board that enables all "onboard"
> peripherals currently supported. This means no display or camera
> support.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> There are two other variants [1] of this board, with different SoCs and
> DRAM configuration. But the board remains the same, thanks to the SoCs
> being pin compatible.
> 
> Do we need different board compatible strings?

Yes.

> FWIW the soc compatible string already encodes the soc variant, and
> the DRAM stuff is handled by the bootloader. The filename also has
> the SoC family and chip name.  The displayed board model also has
> the SoC variant included. The board itself is named "ALL-H3-CC".

The point of a board compatible is to identify the way a board
behaves. If we ever need to make any quirks for one particular board,
we have to have a compatible that uniquely identifies it.

However, we can have an intermediate compatible as well to catch all
those similar boards.

Something like:
   compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";

> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> they've released new variants with different SoCs and DRAM capacities
> using the same board. Not sure if they are commercially available though.

You can have a look at the way we handled all the q8 tablets that were
pretty much in the same case. It's been working quite well.

> Last, the LED polarity is wrong. This is due to the EMAC driver not
> following the DT binding and looking for the "allwinner,leds-active-low"
> under the PHY node, instead of the EMAC node. I've notified Corentin of
> this issue.

The DT should be correct, even if the code isn't. This seems to be a
driver bug that should be fixed, but we don't want to change the DT.

> [1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
> [2] http://www.banana-pi.org/m2plus.html
> ---
>  arch/arm/boot/dts/Makefile                         |   1 +
>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
>  2 files changed, 197 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 3c139c63098f..aa68f719692f 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>  	sun8i-h2-plus-orangepi-zero.dtb \
>  	sun8i-h3-bananapi-m2-plus.dtb \
>  	sun8i-h3-beelink-x2.dtb \
> +	sun8i-h3-libretech-all-h3-cc.dtb \

Any reason to use the code name and not the "marketing" name?

>  	sun8i-h3-nanopi-m1.dtb	\
>  	sun8i-h3-nanopi-m1-plus.dtb \
>  	sun8i-h3-nanopi-neo.dtb \
> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> new file mode 100644
> index 000000000000..6f544e007f71
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
> + *
> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> + */
> +
> +/dts-v1/;
> +#include "sun8i-h3.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +	model = "Libre Computer Board ALL-H3-CC H3";
> +	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
> +
> +	aliases {
> +		ethernet0 = &emac;
> +		serial0 = &uart0;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		pwr_led {
> +			label = "librecomputer:pwr";

You should have the color there too.

> +			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
> +			default-state = "on";
> +		};
> +
> +		status_led {
> +			label = "librecomputer:status";

Same thing here.

> +			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> +		};
> +	};
> +
> +	gpio_keys {
> +		compatible = "gpio-keys";
> +
> +		recovery {
> +			label = "recovery";
> +			linux,code = <BTN_0>;

How did you pick that keycode?

Looks good otherwise, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171128/0a936996/attachment.sig>

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

* Re: Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
  2017-11-28  8:43     ` Maxime Ripard
@ 2017-11-28  9:26         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2017-11-28  9:26 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-sunxi, Corentin Labbe

On Tue, Nov 28, 2017 at 4:43 PM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hi,
>
> On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
>> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
>> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
>> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
>> and connectors are in the exact same position as on the Raspberry Pi B+.
>>
>> Raspberry Pi B+ like peripherals supported on this board include:
>>
>>   - Power input through micro-USB connector (without USB OTG)
>>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>>     USB-based on the RPi
>>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>>     being connected through a USB 2.0 hub on the RPi
>>   - TV and audio output on a 3.5mm TRRS jack
>>   - HDMI output
>>   - Micro-SD card slot
>>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
>>     the same pins.
>>
>>     * 5V, 3.3V power, and ground
>>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>>       with GPIO pin PA17 replacing the missing Chip Select 1
>>     * I2S1 on the H3 is routed to PCM pins on the RPi header
>>
>>   - Additional peripherals from the H3 are available on different pins.
>>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
>>
>> In addition, there are a number of new features:
>>
>>   - Console UART header
>>   - Consumer IR receiver
>>   - Camera interface (not compatible with RPi)
>>   - Onboard microphone
>>   - eMMC expansion module port
>>   - Heatsink mounting holes
>>
>> This patch adds a dts file for this board that enables all "onboard"
>> peripherals currently supported. This means no display or camera
>> support.
>>
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>>
>> There are two other variants [1] of this board, with different SoCs and
>> DRAM configuration. But the board remains the same, thanks to the SoCs
>> being pin compatible.
>>
>> Do we need different board compatible strings?
>
> Yes.
>
>> FWIW the soc compatible string already encodes the soc variant, and
>> the DRAM stuff is handled by the bootloader. The filename also has
>> the SoC family and chip name.  The displayed board model also has
>> the SoC variant included. The board itself is named "ALL-H3-CC".
>
> The point of a board compatible is to identify the way a board
> behaves. If we ever need to make any quirks for one particular board,
> we have to have a compatible that uniquely identifies it.
>
> However, we can have an intermediate compatible as well to catch all
> those similar boards.
>
> Something like:
>    compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";

compatible = "libretech,all-h3-cc-h3", "libretech,all-h3-cc",
"allwinner,sun8i-h3";

(See below about the names.) Does that look confusing?

>
>> I'm asking as we have the same issue with the Bananapi M2+ [2], where
>> they've released new variants with different SoCs and DRAM capacities
>> using the same board. Not sure if they are commercially available though.
>
> You can have a look at the way we handled all the q8 tablets that were
> pretty much in the same case. It's been working quite well.

You mean the sun?i-reference-tablet-design.dtsi files? I'm thinking we
might not have to go that far. The other variants could have:

    #include "sun8i-h3-libretech-all-h3-cc.dts"
    #include "sun8i-h5.dtsi"

    And then override the board compatible and model.

Might not work. I'm not sure at this moment.

>
>> Last, the LED polarity is wrong. This is due to the EMAC driver not
>> following the DT binding and looking for the "allwinner,leds-active-low"
>> under the PHY node, instead of the EMAC node. I've notified Corentin of
>> this issue.
>
> The DT should be correct, even if the code isn't. This seems to be a
> driver bug that should be fixed, but we don't want to change the DT.

So I'll leave it as is, as in the DT is correct.

>
>> [1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
>> [2] http://www.banana-pi.org/m2plus.html
>> ---
>>  arch/arm/boot/dts/Makefile                         |   1 +
>>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
>>  2 files changed, 197 insertions(+)
>>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>>
>> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
>> index 3c139c63098f..aa68f719692f 100644
>> --- a/arch/arm/boot/dts/Makefile
>> +++ b/arch/arm/boot/dts/Makefile
>> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>>       sun8i-h2-plus-orangepi-zero.dtb \
>>       sun8i-h3-bananapi-m2-plus.dtb \
>>       sun8i-h3-beelink-x2.dtb \
>> +     sun8i-h3-libretech-all-h3-cc.dtb \
>
> Any reason to use the code name and not the "marketing" name?

I've asked and this is the preferred name. "Tritium" is more of an internal
codename.

>
>>       sun8i-h3-nanopi-m1.dtb  \
>>       sun8i-h3-nanopi-m1-plus.dtb \
>>       sun8i-h3-nanopi-neo.dtb \
>> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>> new file mode 100644
>> index 000000000000..6f544e007f71
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>> @@ -0,0 +1,196 @@
>> +/*
>> + * Copyright (C) 2017 Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> + *
>> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> + */
>> +
>> +/dts-v1/;
>> +#include "sun8i-h3.dtsi"
>> +
>> +#include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> +     model = "Libre Computer Board ALL-H3-CC H3";
>> +     compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
>> +
>> +     aliases {
>> +             ethernet0 = &emac;
>> +             serial0 = &uart0;
>> +     };
>> +
>> +     chosen {
>> +             stdout-path = "serial0:115200n8";
>> +     };
>> +
>> +     leds {
>> +             compatible = "gpio-leds";
>> +
>> +             pwr_led {
>> +                     label = "librecomputer:pwr";
>
> You should have the color there too.
>
>> +                     gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
>> +                     default-state = "on";
>> +             };
>> +
>> +             status_led {
>> +                     label = "librecomputer:status";
>
> Same thing here.

OK.

>
>> +                     gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
>> +             };
>> +     };
>> +
>> +     gpio_keys {
>> +             compatible = "gpio-keys";
>> +
>> +             recovery {
>> +                     label = "recovery";
>> +                     linux,code = <BTN_0>;
>
> How did you pick that keycode?

It's the same as the Orange Pis. The board however does mark it as
"Power Key". However the H3 (on mainline) does not have the ability
to come back up once powered down, nor do we have the ability to
power it off right now. (We could turn it off using "gpio-poweroff",
though I'm sensing the GPIO usage would conflict with the regulator
drivers.) I'll ask about the intended usage and behavior.

ChenYu

>
> Looks good otherwise, thanks!
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

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

* [linux-sunxi] Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28  9:26         ` Chen-Yu Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2017-11-28  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 28, 2017 at 4:43 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
>> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
>> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
>> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
>> and connectors are in the exact same position as on the Raspberry Pi B+.
>>
>> Raspberry Pi B+ like peripherals supported on this board include:
>>
>>   - Power input through micro-USB connector (without USB OTG)
>>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>>     USB-based on the RPi
>>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>>     being connected through a USB 2.0 hub on the RPi
>>   - TV and audio output on a 3.5mm TRRS jack
>>   - HDMI output
>>   - Micro-SD card slot
>>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
>>     the same pins.
>>
>>     * 5V, 3.3V power, and ground
>>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>>       with GPIO pin PA17 replacing the missing Chip Select 1
>>     * I2S1 on the H3 is routed to PCM pins on the RPi header
>>
>>   - Additional peripherals from the H3 are available on different pins.
>>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
>>
>> In addition, there are a number of new features:
>>
>>   - Console UART header
>>   - Consumer IR receiver
>>   - Camera interface (not compatible with RPi)
>>   - Onboard microphone
>>   - eMMC expansion module port
>>   - Heatsink mounting holes
>>
>> This patch adds a dts file for this board that enables all "onboard"
>> peripherals currently supported. This means no display or camera
>> support.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>
>> There are two other variants [1] of this board, with different SoCs and
>> DRAM configuration. But the board remains the same, thanks to the SoCs
>> being pin compatible.
>>
>> Do we need different board compatible strings?
>
> Yes.
>
>> FWIW the soc compatible string already encodes the soc variant, and
>> the DRAM stuff is handled by the bootloader. The filename also has
>> the SoC family and chip name.  The displayed board model also has
>> the SoC variant included. The board itself is named "ALL-H3-CC".
>
> The point of a board compatible is to identify the way a board
> behaves. If we ever need to make any quirks for one particular board,
> we have to have a compatible that uniquely identifies it.
>
> However, we can have an intermediate compatible as well to catch all
> those similar boards.
>
> Something like:
>    compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";

compatible = "libretech,all-h3-cc-h3", "libretech,all-h3-cc",
"allwinner,sun8i-h3";

(See below about the names.) Does that look confusing?

>
>> I'm asking as we have the same issue with the Bananapi M2+ [2], where
>> they've released new variants with different SoCs and DRAM capacities
>> using the same board. Not sure if they are commercially available though.
>
> You can have a look at the way we handled all the q8 tablets that were
> pretty much in the same case. It's been working quite well.

You mean the sun?i-reference-tablet-design.dtsi files? I'm thinking we
might not have to go that far. The other variants could have:

    #include "sun8i-h3-libretech-all-h3-cc.dts"
    #include "sun8i-h5.dtsi"

    And then override the board compatible and model.

Might not work. I'm not sure at this moment.

>
>> Last, the LED polarity is wrong. This is due to the EMAC driver not
>> following the DT binding and looking for the "allwinner,leds-active-low"
>> under the PHY node, instead of the EMAC node. I've notified Corentin of
>> this issue.
>
> The DT should be correct, even if the code isn't. This seems to be a
> driver bug that should be fixed, but we don't want to change the DT.

So I'll leave it as is, as in the DT is correct.

>
>> [1] https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
>> [2] http://www.banana-pi.org/m2plus.html
>> ---
>>  arch/arm/boot/dts/Makefile                         |   1 +
>>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 +++++++++++++++++++++
>>  2 files changed, 197 insertions(+)
>>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>>
>> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
>> index 3c139c63098f..aa68f719692f 100644
>> --- a/arch/arm/boot/dts/Makefile
>> +++ b/arch/arm/boot/dts/Makefile
>> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>>       sun8i-h2-plus-orangepi-zero.dtb \
>>       sun8i-h3-bananapi-m2-plus.dtb \
>>       sun8i-h3-beelink-x2.dtb \
>> +     sun8i-h3-libretech-all-h3-cc.dtb \
>
> Any reason to use the code name and not the "marketing" name?

I've asked and this is the preferred name. "Tritium" is more of an internal
codename.

>
>>       sun8i-h3-nanopi-m1.dtb  \
>>       sun8i-h3-nanopi-m1-plus.dtb \
>>       sun8i-h3-nanopi-neo.dtb \
>> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>> new file mode 100644
>> index 000000000000..6f544e007f71
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
>> @@ -0,0 +1,196 @@
>> +/*
>> + * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
>> + *
>> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> + */
>> +
>> +/dts-v1/;
>> +#include "sun8i-h3.dtsi"
>> +
>> +#include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> +     model = "Libre Computer Board ALL-H3-CC H3";
>> +     compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
>> +
>> +     aliases {
>> +             ethernet0 = &emac;
>> +             serial0 = &uart0;
>> +     };
>> +
>> +     chosen {
>> +             stdout-path = "serial0:115200n8";
>> +     };
>> +
>> +     leds {
>> +             compatible = "gpio-leds";
>> +
>> +             pwr_led {
>> +                     label = "librecomputer:pwr";
>
> You should have the color there too.
>
>> +                     gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
>> +                     default-state = "on";
>> +             };
>> +
>> +             status_led {
>> +                     label = "librecomputer:status";
>
> Same thing here.

OK.

>
>> +                     gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
>> +             };
>> +     };
>> +
>> +     gpio_keys {
>> +             compatible = "gpio-keys";
>> +
>> +             recovery {
>> +                     label = "recovery";
>> +                     linux,code = <BTN_0>;
>
> How did you pick that keycode?

It's the same as the Orange Pis. The board however does mark it as
"Power Key". However the H3 (on mainline) does not have the ability
to come back up once powered down, nor do we have the ability to
power it off right now. (We could turn it off using "gpio-poweroff",
though I'm sensing the GPIO usage would conflict with the regulator
drivers.) I'll ask about the intended usage and behavior.

ChenYu

>
> Looks good otherwise, thanks!
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
  2017-11-28  4:12 ` Chen-Yu Tsai
@ 2017-11-28 11:11     ` Icenowy Zheng
  -1 siblings, 0 replies; 10+ messages in thread
From: Icenowy Zheng @ 2017-11-28 11:11 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree-u79uwXL29TY76Z2rM5mHXA, Corentin Labbe,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

在 2017-11-28 12:12,Chen-Yu Tsai 写道:
> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting 
> holes
> and connectors are in the exact same position as on the Raspberry Pi 
> B+.
> 
> Raspberry Pi B+ like peripherals supported on this board include:
> 
>   - Power input through micro-USB connector (without USB OTG)
>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>     USB-based on the RPi
>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>     being connected through a USB 2.0 hub on the RPi
>   - TV and audio output on a 3.5mm TRRS jack
>   - HDMI output
>   - Micro-SD card slot
>   - Standard RPi B+ GPIO header, with the standard peripherals routed 
> to
>     the same pins.
> 
>     * 5V, 3.3V power, and ground
>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>       with GPIO pin PA17 replacing the missing Chip Select 1
>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> 
>   - Additional peripherals from the H3 are available on different pins.
>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> 
> In addition, there are a number of new features:
> 
>   - Console UART header
>   - Consumer IR receiver
>   - Camera interface (not compatible with RPi)
>   - Onboard microphone
>   - eMMC expansion module port
>   - Heatsink mounting holes
> 
> This patch adds a dts file for this board that enables all "onboard"
> peripherals currently supported. This means no display or camera
> support.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> 
> There are two other variants [1] of this board, with different SoCs and
> DRAM configuration. But the board remains the same, thanks to the SoCs
> being pin compatible.
> 
> Do we need different board compatible strings? FWIW the soc compatible
> string already encodes the soc variant, and the DRAM stuff is handled
> by the bootloader. The filename also has the SoC family and chip name.
> The displayed board model also has the SoC variant included. The board
> itself is named "ALL-H3-CC".
> 
> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> they've released new variants with different SoCs and DRAM capacities
> using the same board. Not sure if they are commercially available 
> though.

BPi M2+ H5 is not yet commercially available.

> 
> Last, the LED polarity is wrong. This is due to the EMAC driver not
> following the DT binding and looking for the 
> "allwinner,leds-active-low"
> under the PHY node, instead of the EMAC node. I've notified Corentin of
> this issue.
> 
> [1]
> https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
> [2] http://www.banana-pi.org/m2plus.html
> ---
>  arch/arm/boot/dts/Makefile                         |   1 +
>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 
> +++++++++++++++++++++
>  2 files changed, 197 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 3c139c63098f..aa68f719692f 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>  	sun8i-h2-plus-orangepi-zero.dtb \
>  	sun8i-h3-bananapi-m2-plus.dtb \
>  	sun8i-h3-beelink-x2.dtb \
> +	sun8i-h3-libretech-all-h3-cc.dtb \

There's also a H5 variant of this board, so I think the
peripherals should be placed into a DTSI, and have the
board DTS include the SoC DTSI and peripheral DTSI.

>  	sun8i-h3-nanopi-m1.dtb	\
>  	sun8i-h3-nanopi-m1-plus.dtb \
>  	sun8i-h3-nanopi-neo.dtb \
> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> new file mode 100644
> index 000000000000..6f544e007f71
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (C) 2017 Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> + *
> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> + */
> +
> +/dts-v1/;
> +#include "sun8i-h3.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +	model = "Libre Computer Board ALL-H3-CC H3";
> +	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
> +
> +	aliases {
> +		ethernet0 = &emac;
> +		serial0 = &uart0;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		pwr_led {
> +			label = "librecomputer:pwr";
> +			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
> +			default-state = "on";
> +		};
> +
> +		status_led {
> +			label = "librecomputer:status";
> +			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> +		};
> +	};
> +
> +	gpio_keys {
> +		compatible = "gpio-keys";
> +
> +		recovery {
> +			label = "recovery";
> +			linux,code = <BTN_0>;
> +			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> +		};
> +	};
> +
> +	reg_vcc1v2: vcc1v2 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc1v2";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
> +		enable-active-high;
> +	};
> +
> +	reg_vcc3v3: vcc3v3 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc3v3";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		vin-supply = <&reg_vcc5v0>;
> +	};
> +
> +	/* This represents the board's 5V input */
> +	reg_vcc5v0: vcc5v0 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc5v0";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +	};
> +
> +	reg_vcc_dram: vcc-dram {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc-dram";
> +		regulator-min-microvolt = <1500000>;
> +		regulator-max-microvolt = <1500000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
> +		enable-active-high;
> +	};
> +
> +	reg_vcc_io: vcc-io {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc-io";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc3v3>;
> +		gpio = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
> +	};
> +
> +	reg_vdd_cpux: vdd-cpux {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vdd-cpux";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
> +		enable-active-high;
> +	};
> +};
> +
> +&codec {
> +	allwinner,audio-routing =
> +		"Line Out", "LINEOUT",
> +		"MIC1", "Mic",
> +		"Mic",  "MBIAS";
> +	status = "okay";
> +};
> +
> +&ehci0 {
> +	status = "okay";
> +};
> +
> +&ehci1 {
> +	status = "okay";
> +};
> +
> +&ehci2 {
> +	status = "okay";
> +};
> +
> +&ehci3 {
> +	status = "okay";
> +};
> +
> +&emac {
> +	phy-handle = <&int_mii_phy>;
> +	phy-mode = "mii";
> +	allwinner,leds-active-low;
> +	status = "okay";
> +};
> +
> +&ir {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&ir_pins_a>;
> +	status = "okay";
> +};
> +
> +&mmc0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc0_pins_a>;
> +	vmmc-supply = <&reg_vcc_io>;
> +	bus-width = <4>;
> +	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
> +	cd-inverted;
> +	status = "okay";
> +};
> +
> +&ohci0 {
> +	status = "okay";
> +};
> +
> +&ohci1 {
> +	status = "okay";
> +};
> +
> +&ohci2 {
> +	status = "okay";
> +};
> +
> +&ohci3 {
> +	status = "okay";
> +};
> +
> +&uart0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&uart0_pins_a>;
> +	status = "okay";
> +};
> +
> +&usb_otg {
> +	dr_mode = "host";
> +	status = "okay";
> +};
> +
> +&usbphy {
> +	/* VBUS on USB ports are always on */
> +	usb0_vbus-supply = <&reg_vcc5v0>;
> +	usb1_vbus-supply = <&reg_vcc5v0>;
> +	usb2_vbus-supply = <&reg_vcc5v0>;
> +	usb3_vbus-supply = <&reg_vcc5v0>;
> +	status = "okay";
> +};

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28 11:11     ` Icenowy Zheng
  0 siblings, 0 replies; 10+ messages in thread
From: Icenowy Zheng @ 2017-11-28 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

? 2017-11-28 12:12?Chen-Yu Tsai ???
> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting 
> holes
> and connectors are in the exact same position as on the Raspberry Pi 
> B+.
> 
> Raspberry Pi B+ like peripherals supported on this board include:
> 
>   - Power input through micro-USB connector (without USB OTG)
>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
>     USB-based on the RPi
>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
>     being connected through a USB 2.0 hub on the RPi
>   - TV and audio output on a 3.5mm TRRS jack
>   - HDMI output
>   - Micro-SD card slot
>   - Standard RPi B+ GPIO header, with the standard peripherals routed 
> to
>     the same pins.
> 
>     * 5V, 3.3V power, and ground
>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
>     * UART1 on the H3 is routed to UART0 pins on the RPi header
>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
>       with GPIO pin PA17 replacing the missing Chip Select 1
>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> 
>   - Additional peripherals from the H3 are available on different pins.
>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> 
> In addition, there are a number of new features:
> 
>   - Console UART header
>   - Consumer IR receiver
>   - Camera interface (not compatible with RPi)
>   - Onboard microphone
>   - eMMC expansion module port
>   - Heatsink mounting holes
> 
> This patch adds a dts file for this board that enables all "onboard"
> peripherals currently supported. This means no display or camera
> support.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> There are two other variants [1] of this board, with different SoCs and
> DRAM configuration. But the board remains the same, thanks to the SoCs
> being pin compatible.
> 
> Do we need different board compatible strings? FWIW the soc compatible
> string already encodes the soc variant, and the DRAM stuff is handled
> by the bootloader. The filename also has the SoC family and chip name.
> The displayed board model also has the SoC variant included. The board
> itself is named "ALL-H3-CC".
> 
> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> they've released new variants with different SoCs and DRAM capacities
> using the same board. Not sure if they are commercially available 
> though.

BPi M2+ H5 is not yet commercially available.

> 
> Last, the LED polarity is wrong. This is due to the EMAC driver not
> following the DT binding and looking for the 
> "allwinner,leds-active-low"
> under the PHY node, instead of the EMAC node. I've notified Corentin of
> this issue.
> 
> [1]
> https://www.kickstarter.com/projects/librecomputer/libre-computer-board-tritium-sbc-linux-android-7-n
> [2] http://www.banana-pi.org/m2plus.html
> ---
>  arch/arm/boot/dts/Makefile                         |   1 +
>  arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts | 196 
> +++++++++++++++++++++
>  2 files changed, 197 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 3c139c63098f..aa68f719692f 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -953,6 +953,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
>  	sun8i-h2-plus-orangepi-zero.dtb \
>  	sun8i-h3-bananapi-m2-plus.dtb \
>  	sun8i-h3-beelink-x2.dtb \
> +	sun8i-h3-libretech-all-h3-cc.dtb \

There's also a H5 variant of this board, so I think the
peripherals should be placed into a DTSI, and have the
board DTS include the SoC DTSI and peripheral DTSI.

>  	sun8i-h3-nanopi-m1.dtb	\
>  	sun8i-h3-nanopi-m1-plus.dtb \
>  	sun8i-h3-nanopi-neo.dtb \
> diff --git a/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> new file mode 100644
> index 000000000000..6f544e007f71
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-h3-libretech-all-h3-cc.dts
> @@ -0,0 +1,196 @@
> +/*
> + * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
> + *
> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> + */
> +
> +/dts-v1/;
> +#include "sun8i-h3.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +	model = "Libre Computer Board ALL-H3-CC H3";
> +	compatible = "libretech,all-h3-cc", "allwinner,sun8i-h3";
> +
> +	aliases {
> +		ethernet0 = &emac;
> +		serial0 = &uart0;
> +	};
> +
> +	chosen {
> +		stdout-path = "serial0:115200n8";
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		pwr_led {
> +			label = "librecomputer:pwr";
> +			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
> +			default-state = "on";
> +		};
> +
> +		status_led {
> +			label = "librecomputer:status";
> +			gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> +		};
> +	};
> +
> +	gpio_keys {
> +		compatible = "gpio-keys";
> +
> +		recovery {
> +			label = "recovery";
> +			linux,code = <BTN_0>;
> +			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
> +		};
> +	};
> +
> +	reg_vcc1v2: vcc1v2 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc1v2";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
> +		enable-active-high;
> +	};
> +
> +	reg_vcc3v3: vcc3v3 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc3v3";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		vin-supply = <&reg_vcc5v0>;
> +	};
> +
> +	/* This represents the board's 5V input */
> +	reg_vcc5v0: vcc5v0 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc5v0";
> +		regulator-min-microvolt = <5000000>;
> +		regulator-max-microvolt = <5000000>;
> +	};
> +
> +	reg_vcc_dram: vcc-dram {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc-dram";
> +		regulator-min-microvolt = <1500000>;
> +		regulator-max-microvolt = <1500000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
> +		enable-active-high;
> +	};
> +
> +	reg_vcc_io: vcc-io {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc-io";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc3v3>;
> +		gpio = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
> +	};
> +
> +	reg_vdd_cpux: vdd-cpux {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vdd-cpux";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +		regulator-boot-on;
> +		vin-supply = <&reg_vcc5v0>;
> +		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
> +		enable-active-high;
> +	};
> +};
> +
> +&codec {
> +	allwinner,audio-routing =
> +		"Line Out", "LINEOUT",
> +		"MIC1", "Mic",
> +		"Mic",  "MBIAS";
> +	status = "okay";
> +};
> +
> +&ehci0 {
> +	status = "okay";
> +};
> +
> +&ehci1 {
> +	status = "okay";
> +};
> +
> +&ehci2 {
> +	status = "okay";
> +};
> +
> +&ehci3 {
> +	status = "okay";
> +};
> +
> +&emac {
> +	phy-handle = <&int_mii_phy>;
> +	phy-mode = "mii";
> +	allwinner,leds-active-low;
> +	status = "okay";
> +};
> +
> +&ir {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&ir_pins_a>;
> +	status = "okay";
> +};
> +
> +&mmc0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc0_pins_a>;
> +	vmmc-supply = <&reg_vcc_io>;
> +	bus-width = <4>;
> +	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
> +	cd-inverted;
> +	status = "okay";
> +};
> +
> +&ohci0 {
> +	status = "okay";
> +};
> +
> +&ohci1 {
> +	status = "okay";
> +};
> +
> +&ohci2 {
> +	status = "okay";
> +};
> +
> +&ohci3 {
> +	status = "okay";
> +};
> +
> +&uart0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&uart0_pins_a>;
> +	status = "okay";
> +};
> +
> +&usb_otg {
> +	dr_mode = "host";
> +	status = "okay";
> +};
> +
> +&usbphy {
> +	/* VBUS on USB ports are always on */
> +	usb0_vbus-supply = <&reg_vcc5v0>;
> +	usb1_vbus-supply = <&reg_vcc5v0>;
> +	usb2_vbus-supply = <&reg_vcc5v0>;
> +	usb3_vbus-supply = <&reg_vcc5v0>;
> +	status = "okay";
> +};

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

* Re: [linux-sunxi] Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
  2017-11-28  9:26         ` [linux-sunxi] " Chen-Yu Tsai
@ 2017-11-28 12:11             ` Maxime Ripard
  -1 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2017-11-28 12:11 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: devicetree, linux-arm-kernel, linux-sunxi, Corentin Labbe

[-- Attachment #1: Type: text/plain, Size: 5501 bytes --]

Hi,

On Tue, Nov 28, 2017 at 05:26:37PM +0800, Chen-Yu Tsai wrote:
> On Tue, Nov 28, 2017 at 4:43 PM, Maxime Ripard
> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > Hi,
> >
> > On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
> >> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> >> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> >> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
> >> and connectors are in the exact same position as on the Raspberry Pi B+.
> >>
> >> Raspberry Pi B+ like peripherals supported on this board include:
> >>
> >>   - Power input through micro-USB connector (without USB OTG)
> >>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
> >>     USB-based on the RPi
> >>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
> >>     being connected through a USB 2.0 hub on the RPi
> >>   - TV and audio output on a 3.5mm TRRS jack
> >>   - HDMI output
> >>   - Micro-SD card slot
> >>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
> >>     the same pins.
> >>
> >>     * 5V, 3.3V power, and ground
> >>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
> >>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
> >>     * UART1 on the H3 is routed to UART0 pins on the RPi header
> >>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
> >>       with GPIO pin PA17 replacing the missing Chip Select 1
> >>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> >>
> >>   - Additional peripherals from the H3 are available on different pins.
> >>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> >>
> >> In addition, there are a number of new features:
> >>
> >>   - Console UART header
> >>   - Consumer IR receiver
> >>   - Camera interface (not compatible with RPi)
> >>   - Onboard microphone
> >>   - eMMC expansion module port
> >>   - Heatsink mounting holes
> >>
> >> This patch adds a dts file for this board that enables all "onboard"
> >> peripherals currently supported. This means no display or camera
> >> support.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> >> ---
> >>
> >> There are two other variants [1] of this board, with different SoCs and
> >> DRAM configuration. But the board remains the same, thanks to the SoCs
> >> being pin compatible.
> >>
> >> Do we need different board compatible strings?
> >
> > Yes.
> >
> >> FWIW the soc compatible string already encodes the soc variant, and
> >> the DRAM stuff is handled by the bootloader. The filename also has
> >> the SoC family and chip name.  The displayed board model also has
> >> the SoC variant included. The board itself is named "ALL-H3-CC".
> >
> > The point of a board compatible is to identify the way a board
> > behaves. If we ever need to make any quirks for one particular board,
> > we have to have a compatible that uniquely identifies it.
> >
> > However, we can have an intermediate compatible as well to catch all
> > those similar boards.
> >
> > Something like:
> >    compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";
> 
> compatible = "libretech,all-h3-cc-h3", "libretech,all-h3-cc",
> "allwinner,sun8i-h3";
> 
> (See below about the names.) Does that look confusing?

A bit. So they're all going to be called all-h3-cc, even if they don't
sport an H3?

> >
> >> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> >> they've released new variants with different SoCs and DRAM capacities
> >> using the same board. Not sure if they are commercially available though.
> >
> > You can have a look at the way we handled all the q8 tablets that were
> > pretty much in the same case. It's been working quite well.
> 
> You mean the sun?i-reference-tablet-design.dtsi files? I'm thinking we
> might not have to go that far. The other variants could have:
> 
>     #include "sun8i-h3-libretech-all-h3-cc.dts"
>     #include "sun8i-h5.dtsi"
> 
>     And then override the board compatible and model.
> 
> Might not work. I'm not sure at this moment.

It's proven to work quite well with the Q8 stuff. One thing that you
really want to pay attention to is that you wouldn't want to "leak"
devices from the H3 into the H5. I have the feeling that with that
kind of construct we will eventually, and this is much harder to do
with the Q8 stuff.

> >> +                     gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> >> +             };
> >> +     };
> >> +
> >> +     gpio_keys {
> >> +             compatible = "gpio-keys";
> >> +
> >> +             recovery {
> >> +                     label = "recovery";
> >> +                     linux,code = <BTN_0>;
> >
> > How did you pick that keycode?
> 
> It's the same as the Orange Pis. The board however does mark it as
> "Power Key". However the H3 (on mainline) does not have the ability
> to come back up once powered down, nor do we have the ability to
> power it off right now. (We could turn it off using "gpio-poweroff",
> though I'm sensing the GPIO usage would conflict with the regulator
> drivers.) I'll ask about the intended usage and behavior.

Ok, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [linux-sunxi] Re: [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver.
@ 2017-11-28 12:11             ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2017-11-28 12:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Nov 28, 2017 at 05:26:37PM +0800, Chen-Yu Tsai wrote:
> On Tue, Nov 28, 2017 at 4:43 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Hi,
> >
> > On Tue, Nov 28, 2017 at 12:12:11PM +0800, Chen-Yu Tsai wrote:
> >> The Libre Computer Board ALL-H3-CC from Libre Technology is a Raspberry
> >> Pi B+ form factor single board computer based on the Allwinner H3 SoC.
> >> The board has 1GB DDR3 SDRAM, provided by 4 2Gb chips. The mounting holes
> >> and connectors are in the exact same position as on the Raspberry Pi B+.
> >>
> >> Raspberry Pi B+ like peripherals supported on this board include:
> >>
> >>   - Power input through micro-USB connector (without USB OTG)
> >>   - Native 100 Mbps ethernet using the internal PHY, as opposed to
> >>     USB-based on the RPi
> >>   - 4x USB 2.0 host ports, directly connected to the SoC, as opposed to
> >>     being connected through a USB 2.0 hub on the RPi
> >>   - TV and audio output on a 3.5mm TRRS jack
> >>   - HDMI output
> >>   - Micro-SD card slot
> >>   - Standard RPi B+ GPIO header, with the standard peripherals routed to
> >>     the same pins.
> >>
> >>     * 5V, 3.3V power, and ground
> >>     * I2C0 on the H3 is routed to I2C1 pins on the RPi header
> >>     * I2C1 on the H3 is routed to I2C0 pins on the RPi header
> >>     * UART1 on the H3 is routed to UART0 pins on the RPi header
> >>     * SPI0 on the H3 is routed to SPI0 pins on the RPi header,
> >>       with GPIO pin PA17 replacing the missing Chip Select 1
> >>     * I2S1 on the H3 is routed to PCM pins on the RPi header
> >>
> >>   - Additional peripherals from the H3 are available on different pins.
> >>     These include I2S0, JTAG, PWM1, SPDIF, SPI1, and UART3
> >>
> >> In addition, there are a number of new features:
> >>
> >>   - Console UART header
> >>   - Consumer IR receiver
> >>   - Camera interface (not compatible with RPi)
> >>   - Onboard microphone
> >>   - eMMC expansion module port
> >>   - Heatsink mounting holes
> >>
> >> This patch adds a dts file for this board that enables all "onboard"
> >> peripherals currently supported. This means no display or camera
> >> support.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >>
> >> There are two other variants [1] of this board, with different SoCs and
> >> DRAM configuration. But the board remains the same, thanks to the SoCs
> >> being pin compatible.
> >>
> >> Do we need different board compatible strings?
> >
> > Yes.
> >
> >> FWIW the soc compatible string already encodes the soc variant, and
> >> the DRAM stuff is handled by the bootloader. The filename also has
> >> the SoC family and chip name.  The displayed board model also has
> >> the SoC variant included. The board itself is named "ALL-H3-CC".
> >
> > The point of a board compatible is to identify the way a board
> > behaves. If we ever need to make any quirks for one particular board,
> > we have to have a compatible that uniquely identifies it.
> >
> > However, we can have an intermediate compatible as well to catch all
> > those similar boards.
> >
> > Something like:
> >    compatible = "libretech,h3-tritium", "libretech,tritium", "allwinner,sun8i-h3";
> 
> compatible = "libretech,all-h3-cc-h3", "libretech,all-h3-cc",
> "allwinner,sun8i-h3";
> 
> (See below about the names.) Does that look confusing?

A bit. So they're all going to be called all-h3-cc, even if they don't
sport an H3?

> >
> >> I'm asking as we have the same issue with the Bananapi M2+ [2], where
> >> they've released new variants with different SoCs and DRAM capacities
> >> using the same board. Not sure if they are commercially available though.
> >
> > You can have a look at the way we handled all the q8 tablets that were
> > pretty much in the same case. It's been working quite well.
> 
> You mean the sun?i-reference-tablet-design.dtsi files? I'm thinking we
> might not have to go that far. The other variants could have:
> 
>     #include "sun8i-h3-libretech-all-h3-cc.dts"
>     #include "sun8i-h5.dtsi"
> 
>     And then override the board compatible and model.
> 
> Might not work. I'm not sure at this moment.

It's proven to work quite well with the Q8 stuff. One thing that you
really want to pay attention to is that you wouldn't want to "leak"
devices from the H3 into the H5. I have the feeling that with that
kind of construct we will eventually, and this is much harder to do
with the Q8 stuff.

> >> +                     gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
> >> +             };
> >> +     };
> >> +
> >> +     gpio_keys {
> >> +             compatible = "gpio-keys";
> >> +
> >> +             recovery {
> >> +                     label = "recovery";
> >> +                     linux,code = <BTN_0>;
> >
> > How did you pick that keycode?
> 
> It's the same as the Orange Pis. The board however does mark it as
> "Power Key". However the H3 (on mainline) does not have the ability
> to come back up once powered down, nor do we have the ability to
> power it off right now. (We could turn it off using "gpio-poweroff",
> though I'm sensing the GPIO usage would conflict with the regulator
> drivers.) I'll ask about the intended usage and behavior.

Ok, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171128/7d0833ef/attachment.sig>

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

end of thread, other threads:[~2017-11-28 12:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  4:12 [PATCH] ARM: dts: sun8i: h3: Add dts file for Libre Computer Board ALL-H3-CC H3 ver Chen-Yu Tsai
2017-11-28  4:12 ` Chen-Yu Tsai
     [not found] ` <20171128041211.17375-1-wens-jdAy2FN1RRM@public.gmane.org>
2017-11-28  8:43   ` Maxime Ripard
2017-11-28  8:43     ` Maxime Ripard
     [not found]     ` <20171128084359.rzplftb3z53cgukp-YififvaboMKzQB+pC5nmwQ@public.gmane.org>
2017-11-28  9:26       ` Chen-Yu Tsai
2017-11-28  9:26         ` [linux-sunxi] " Chen-Yu Tsai
     [not found]         ` <CAGb2v67dg1dCw+n3aQ1aFqtZXU245v6jQ0E=4onPYjUOpUHjPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-28 12:11           ` Maxime Ripard
2017-11-28 12:11             ` Maxime Ripard
2017-11-28 11:11   ` Icenowy Zheng
2017-11-28 11:11     ` Icenowy Zheng

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.