Skip to contentSkip to conversation

PinePhone automatic device tree selection

PATCH New Samuel Holland 2 participants 10 messages Oct 24, 2020 – Oct 28, 2020

Subsystems (7)
lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

v2 cover PinePhone automatic device tree selection

This patch series implements a feature to automatically choose the right PinePhone device tree by probing the hardware. It then extends the functionality to pass the chosen DTB name to the boot command. Finally, I add device trees and a defconfig for the PinePhone.

Changes from v1 to v2:
- Removed unnecessary "else"s in DT selection logic
- Updated DT tag reference from v5.9-rc3 to v5.9 (no code change)
- Regenerated defconfig with make savedefconfig
- Added Acked-by and Reviewed-by tags

Samuel Holland (8):
sunxi: board: Use a more descriptive variable name
sunxi: board: Add a helper to get the SPL DT name
sunxi: board: Simplify Pine A64 DT selection logic
sunxi: board: Add PinePhone DT selection logic
sunxi: board: Save the chosen DT name in the SPL header
sunxi: board: Set fdtfile to match the DT chosen by SPL
sunxi: DT: A64: update device tree files
sunxi: a64: Add a defconfig for the PinePhone

 arch/arm/dts/Makefile                         |   4 +
 arch/arm/dts/axp803.dtsi                      |  82 +--
 arch/arm/dts/sun50i-a64-amarula-relic.dts     | 109 +++-
 arch/arm/dts/sun50i-a64-bananapi-m64.dts      | 118 ++--
 arch/arm/dts/sun50i-a64-cpu-opp.dtsi          |  75 +++
 arch/arm/dts/sun50i-a64-nanopi-a64.dts        |  70 +--
 .../dts/sun50i-a64-oceanic-5205-5inmfd.dts    |  31 +-
 arch/arm/dts/sun50i-a64-olinuxino-emmc.dts    |  12 +-
 arch/arm/dts/sun50i-a64-olinuxino.dts         | 113 ++--
 arch/arm/dts/sun50i-a64-orangepi-win.dts      | 127 +++--
 arch/arm/dts/sun50i-a64-pine64-lts.dts        |   7 +-
 arch/arm/dts/sun50i-a64-pine64-plus.dts       |  52 +-
 arch/arm/dts/sun50i-a64-pine64.dts            |  97 ++--
 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi  |  17 -
 arch/arm/dts/sun50i-a64-pinebook.dts          | 237 ++++++--
 arch/arm/dts/sun50i-a64-pinephone-1.0.dts     |  11 +
 arch/arm/dts/sun50i-a64-pinephone-1.1.dts     |  30 +
 arch/arm/dts/sun50i-a64-pinephone-1.2.dts     |  40 ++
 arch/arm/dts/sun50i-a64-pinephone.dtsi        | 429 ++++++++++++++
 arch/arm/dts/sun50i-a64-pinetab.dts           | 460 +++++++++++++++
 arch/arm/dts/sun50i-a64-sopine-baseboard.dts  | 113 ++--
 arch/arm/dts/sun50i-a64-sopine.dtsi           |  69 +--
 arch/arm/dts/sun50i-a64-teres-i-u-boot.dtsi   |  41 --
 arch/arm/dts/sun50i-a64-teres-i.dts           | 138 ++++-
 arch/arm/dts/sun50i-a64.dtsi                  | 532 ++++++++++++++----
 arch/arm/mach-sunxi/Kconfig                   |   7 +
 board/sunxi/board.c                           |  97 +++-
 configs/pinephone_defconfig                   |  12 +
 include/dt-bindings/clock/sun50i-a64-ccu.h    |   4 +-
 include/dt-bindings/clock/sun8i-de2.h         |   3 +
 include/dt-bindings/reset/sun8i-de2.h         |   1 +
 31 files changed, 2488 insertions(+), 650 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-a64-cpu-opp.dtsi
 delete mode 100644 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.0.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.1.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.2.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone.dtsi
 create mode 100644 arch/arm/dts/sun50i-a64-pinetab.dts
 delete mode 100644 arch/arm/dts/sun50i-a64-teres-i-u-boot.dtsi
 create mode 100644 configs/pinephone_defconfig
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH v2 1/8 sunxi: board: Use a more descriptive variable name

The variable "cmp_str" always leaves me wondering if it is the DT name of the current board (yes) or DT name in the FIT config entry (no).

In preparation for expanding the functionality here, rename it to something that obviously means "this is the DT name we are looking for".

---
 board/sunxi/board.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
board/sunxi/board.c +6 -6
index a5cf0b65c7b..d7dfcc78eab 100644
@@ -892,14 +892,14 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 int board_fit_config_name_match(const char *name)
 {
 	struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
-	const char *cmp_str = (const char *)spl;
+	const char *best_dt_name = (const char *)spl;
 
 	/* Check if there is a DT name stored in the SPL header and use that. */
 	if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) {
-		cmp_str += spl->dt_name_offset;
+		best_dt_name += spl->dt_name_offset;
 	} else {
 #ifdef CONFIG_DEFAULT_DEVICE_TREE
-		cmp_str = CONFIG_DEFAULT_DEVICE_TREE;
+		best_dt_name = CONFIG_DEFAULT_DEVICE_TREE;
 #else
 		return 0;
 #endif
@@ -907,15 +907,15 @@ int board_fit_config_name_match(const char *name)
 
 #ifdef CONFIG_PINE64_DT_SELECTION
 /* Differentiate the two Pine64 board DTs by their DRAM size. */
-	if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) {
+	if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) {
 		if ((gd->ram_size > 512 * 1024 * 1024))
 			return !strstr(name, "plus");
 		else
 			return !!strstr(name, "plus");
 	} else {
-		return strcmp(name, cmp_str);
+		return strcmp(name, best_dt_name);
 	}
 #endif
-	return strcmp(name, cmp_str);
+	return strcmp(name, best_dt_name);
 }
 #endif
Signature · 1 line
2.26.2
author maintainer
#2 lore raw

PATCH v2 2/8 sunxi: board: Add a helper to get the SPL DT name

In reply to Samuel Holland

This moves the validity checking and typecasts all to one place away from the string comparison logic, and it detangles the compile-time and runtime control flow.

The new helper will also be used by U-Boot proper in a future commit.

---
 board/sunxi/board.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
board/sunxi/board.c +17 -9
index d7dfcc78eab..a8a05ec59c8 100644
@@ -319,6 +319,17 @@ static struct boot_file_head * get_spl_header(uint8_t req_version)
 	return spl;
 }
 
+static const char *get_spl_dt_name(void)
+{
+	struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
+
+	/* Check if there is a DT name stored in the SPL header. */
+	if (spl != INVALID_SPL_HEADER && spl->dt_name_offset)
+		return (char *)spl + spl->dt_name_offset;
+
+	return NULL;
+}
+
 int dram_init(void)
 {
 	struct boot_file_head *spl = get_spl_header(SPL_DRAM_HEADER_VERSION);
@@ -891,20 +902,17 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
-	struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
-	const char *best_dt_name = (const char *)spl;
+	const char *best_dt_name = get_spl_dt_name();
 
-	/* Check if there is a DT name stored in the SPL header and use that. */
-	if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) {
-		best_dt_name += spl->dt_name_offset;
-	} else {
 #ifdef CONFIG_DEFAULT_DEVICE_TREE
+	if (best_dt_name == NULL)
 		best_dt_name = CONFIG_DEFAULT_DEVICE_TREE;
-#else
-		return 0;
 #endif
-	};
 
+	if (best_dt_name == NULL) {
+		/* No DT name was provided, so accept the first config. */
+		return 0;
+	}
 #ifdef CONFIG_PINE64_DT_SELECTION
 /* Differentiate the two Pine64 board DTs by their DRAM size. */
 	if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) {
Signature · 1 line
2.26.2
author maintainer
#3 lore raw

PATCH v2 3/8 sunxi: board: Simplify Pine A64 DT selection logic

In reply to Samuel Holland

Instead of using an entirely separate matching algorithm, simply update the name of the DT we want to match. Enabling this logic does not depend on the FIT config name, only on the initial guess of the board name.

Importantly, the initial guess must be "sun50i-a64-pine64-plus", because otherwise the logic would trigger when "sun50i-a64-pine64-lts" was written to the SPL header.

---
 board/sunxi/board.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
board/sunxi/board.c +4 -8
index a8a05ec59c8..ec1920c3a39 100644
@@ -914,14 +914,10 @@ int board_fit_config_name_match(const char *name)
 		return 0;
 	}
 #ifdef CONFIG_PINE64_DT_SELECTION
-/* Differentiate the two Pine64 board DTs by their DRAM size. */
-	if (strstr(name, "-pine64") && strstr(best_dt_name, "-pine64")) {
-		if ((gd->ram_size > 512 * 1024 * 1024))
-			return !strstr(name, "plus");
-		else
-			return !!strstr(name, "plus");
-	} else {
-		return strcmp(name, best_dt_name);
+	if (strstr(best_dt_name, "-pine64-plus")) {
+		/* Differentiate the Pine A64 boards by their DRAM size. */
+		if ((gd->ram_size == 512 * 1024 * 1024))
+			best_dt_name = "sun50i-a64-pine64";
 	}
 #endif
 	return strcmp(name, best_dt_name);
Signature · 1 line
2.26.2
author maintainer
#4 lore raw

PATCH v2 4/8 sunxi: board: Add PinePhone DT selection logic

In reply to Samuel Holland

There are two different publicly-released revisions of the PinePhone hardware, versions 1.1 and 1.2; and they need different device trees. Since some GPIO pins were rerouted, we can use that to distinguish between them.

---
 arch/arm/mach-sunxi/Kconfig |  7 +++++++
 board/sunxi/board.c         | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)
arch/arm/mach-sunxi/Kconfig +7 -0
index be0822bfb7d..8421f3b6854 100644
@@ -1010,4 +1010,11 @@ config PINE64_DT_SELECTION
 	  option, the device tree selection code specific to Pine64 which
 	  utilizes the DRAM size will be enabled.
 
+config PINEPHONE_DT_SELECTION
+	bool "Enable PinePhone device tree selection code"
+	depends on MACH_SUN50I
+	help
+	  Enable this option to automatically select the device tree for the
+	  correct PinePhone hardware revision during boot.
+
 endif
board/sunxi/board.c +21 -0
index ec1920c3a39..bff5135c1a1 100644
@@ -27,6 +27,7 @@
 #include <asm/arch/dram.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/prcm.h>
 #include <asm/arch/spl.h>
 #include <linux/delay.h>
 #include <u-boot/crc.h>
@@ -920,6 +921,26 @@ int board_fit_config_name_match(const char *name)
 			best_dt_name = "sun50i-a64-pine64";
 	}
 #endif
+#ifdef CONFIG_PINEPHONE_DT_SELECTION
+	if (strstr(best_dt_name, "-pinephone")) {
+		/* Differentiate the PinePhone revisions by GPIO inputs. */
+		prcm_apb0_enable(PRCM_APB0_GATE_PIO);
+		sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_UP);
+		sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_INPUT);
+		udelay(100);
+
+		/* PL6 is pulled low by the modem on v1.2. */
+		if (gpio_get_value(SUNXI_GPL(6)) == 0)
+			best_dt_name = "sun50i-a64-pinephone-1.2";
+		else
+			best_dt_name = "sun50i-a64-pinephone-1.1";
+
+		sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_DISABLE);
+		sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_DISABLE);
+		prcm_apb0_disable(PRCM_APB0_GATE_PIO);
+	}
+#endif
+
 	return strcmp(name, best_dt_name);
 }
 #endif
Signature · 1 line
2.26.2
author maintainer
#5 lore raw

PATCH v2 5/8 sunxi: board: Save the chosen DT name in the SPL header

In reply to Samuel Holland

This overwrites the name loaded from the SPL image. It will be different if there was previously no name provided, or if a more accurate name was determined by the board variant selection logic. This means that the DT name in the SPL header now always matches the DT appended to U-Boot.

---
 board/sunxi/board.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
board/sunxi/board.c +26 -1
index bff5135c1a1..9d0e29788b1 100644
@@ -331,6 +331,21 @@ static const char *get_spl_dt_name(void)
 	return NULL;
 }
 
+static void set_spl_dt_name(const char *name)
+{
+	struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION);
+
+	if (spl == INVALID_SPL_HEADER)
+		return;
+
+	/* Promote the header version for U-Boot proper, if needed. */
+	if (spl->spl_signature[3] < SPL_DT_HEADER_VERSION)
+		spl->spl_signature[3] = SPL_DT_HEADER_VERSION;
+
+	strcpy((char *)&spl->string_pool, name);
+	spl->dt_name_offset = offsetof(struct boot_file_head, string_pool);
+}
+
 int dram_init(void)
 {
 	struct boot_file_head *spl = get_spl_header(SPL_DRAM_HEADER_VERSION);
@@ -904,6 +919,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 int board_fit_config_name_match(const char *name)
 {
 	const char *best_dt_name = get_spl_dt_name();
+	int ret;
 
 #ifdef CONFIG_DEFAULT_DEVICE_TREE
 	if (best_dt_name == NULL)
@@ -941,6 +957,15 @@ int board_fit_config_name_match(const char *name)
 	}
 #endif
 
-	return strcmp(name, best_dt_name);
+	ret = strcmp(name, best_dt_name);
+
+	/*
+	 * If one of the FIT configurations matches the most accurate DT name,
+	 * update the SPL header to provide that DT name to U-Boot proper.
+	 */
+	if (ret == 0)
+		set_spl_dt_name(best_dt_name);
+
+	return ret;
 }
 #endif
Signature · 1 line
2.26.2
author maintainer
#6 lore raw

PATCH v2 6/8 sunxi: board: Set fdtfile to match the DT chosen by SPL

In reply to Samuel Holland

Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE. This meant that, regardless of the DT chosen by SPL (either by changing the header in the image or by the selection code at runtime), Linux always used the default DT.

By using the name from the SPL header (which, because of the previous commit, always matches the DT used by U-Boot proper), Linux also sees the same board as U-Boot/SPL, even if the boot script later loads a DT from disk.

---
 board/sunxi/board.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
board/sunxi/board.c +11 -0
index 9d0e29788b1..d7ec66ed847 100644
@@ -870,6 +870,7 @@ static void setup_environment(const void *fdt)
 
 int misc_init_r(void)
 {
+	const char *spl_dt_name;
 	uint boot;
 
 	env_set("fel_booted", NULL);
@@ -888,6 +889,16 @@ int misc_init_r(void)
 		env_set("mmc_bootdev", "1");
 	}
 
+	/* Set fdtfile to match the FIT configuration chosen in SPL. */
+	spl_dt_name = get_spl_dt_name();
+	if (spl_dt_name) {
+		char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : "";
+		char str[64];
+
+		snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name);
+		env_set("fdtfile", str);
+	}
+
 	setup_environment(gd->fdt_blob);
 
 #ifdef CONFIG_USB_ETHER
Signature · 1 line
2.26.2
author maintainer
#7 lore raw

PATCH v2 7/8 sunxi: DT: A64: update device tree files

In reply to Samuel Holland

Import updated device trees from Linux tag v5.9. This picks up new hardware (PinePhone, PineTab); and it drops the U-Boot specific DTSI files for the Pinebook and the Teres-I, since the ANX6345 bridge is now supported upstream.

A couple of headers needed updates for recently-added hardware support.

---
 arch/arm/dts/Makefile                         |   4 +
 arch/arm/dts/axp803.dtsi                      |  82 +--
 arch/arm/dts/sun50i-a64-amarula-relic.dts     | 109 +++-
 arch/arm/dts/sun50i-a64-bananapi-m64.dts      | 118 ++--
 arch/arm/dts/sun50i-a64-cpu-opp.dtsi          |  75 +++
 arch/arm/dts/sun50i-a64-nanopi-a64.dts        |  70 +--
 .../dts/sun50i-a64-oceanic-5205-5inmfd.dts    |  31 +-
 arch/arm/dts/sun50i-a64-olinuxino-emmc.dts    |  12 +-
 arch/arm/dts/sun50i-a64-olinuxino.dts         | 113 ++--
 arch/arm/dts/sun50i-a64-orangepi-win.dts      | 127 +++--
 arch/arm/dts/sun50i-a64-pine64-lts.dts        |   7 +-
 arch/arm/dts/sun50i-a64-pine64-plus.dts       |  52 +-
 arch/arm/dts/sun50i-a64-pine64.dts            |  97 ++--
 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi  |  17 -
 arch/arm/dts/sun50i-a64-pinebook.dts          | 237 ++++++--
 arch/arm/dts/sun50i-a64-pinephone-1.0.dts     |  11 +
 arch/arm/dts/sun50i-a64-pinephone-1.1.dts     |  30 +
 arch/arm/dts/sun50i-a64-pinephone-1.2.dts     |  40 ++
 arch/arm/dts/sun50i-a64-pinephone.dtsi        | 429 ++++++++++++++
 arch/arm/dts/sun50i-a64-pinetab.dts           | 460 +++++++++++++++
 arch/arm/dts/sun50i-a64-sopine-baseboard.dts  | 113 ++--
 arch/arm/dts/sun50i-a64-sopine.dtsi           |  69 +--
 arch/arm/dts/sun50i-a64-teres-i-u-boot.dtsi   |  41 --
 arch/arm/dts/sun50i-a64-teres-i.dts           | 138 ++++-
 arch/arm/dts/sun50i-a64.dtsi                  | 532 ++++++++++++++----
 include/dt-bindings/clock/sun50i-a64-ccu.h    |   4 +-
 include/dt-bindings/clock/sun8i-de2.h         |   3 +
 include/dt-bindings/reset/sun8i-de2.h         |   1 +
 28 files changed, 2390 insertions(+), 632 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-a64-cpu-opp.dtsi
 delete mode 100644 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.0.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.1.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone-1.2.dts
 create mode 100644 arch/arm/dts/sun50i-a64-pinephone.dtsi
 create mode 100644 arch/arm/dts/sun50i-a64-pinetab.dts
 delete mode 100644 arch/arm/dts/sun50i-a64-teres-i-u-boot.dtsi
arch/arm/dts/Makefile +4 -0
index b195723f164..d15511c699e 100644
@@ -610,6 +610,10 @@ dtb-$(CONFIG_MACH_SUN50I) += \
 	sun50i-a64-pine64-plus.dtb \
 	sun50i-a64-pine64.dtb \
 	sun50i-a64-pinebook.dtb \
+	sun50i-a64-pinephone-1.0.dtb \
+	sun50i-a64-pinephone-1.1.dtb \
+	sun50i-a64-pinephone-1.2.dtb \
+	sun50i-a64-pinetab.dtb \
 	sun50i-a64-sopine-baseboard.dtb \
 	sun50i-a64-teres-i.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
arch/arm/dts/axp803.dtsi +41 -41

95 lines not on this page · raw message

arch/arm/dts/sun50i-a64-amarula-relic.dts +105 -4

139 lines not on this page · raw message

arch/arm/dts/sun50i-a64-bananapi-m64.dts +75 -43

167 lines not on this page · raw message

arch/arm/dts/sun50i-a64-cpu-opp.dtsi new file +75 -0

75 lines not on this page · raw message

arch/arm/dts/sun50i-a64-nanopi-a64.dts +23 -47

95 lines not on this page · raw message

arch/arm/dts/sun50i-a64-oceanic-5205-5inmfd.dts +26 -5
index 6a2154525d1..577f9e1d08a 100644
@@ -1,9 +1,7 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (C) 2019 Oceanic Systems (UK) Ltd.
- * Copyright (C) 2019 Amarula Solutions B.V.
- * Author: Jagan Teki <[email protected]>
- */
+// Copyright (C) 2019 Oceanic Systems (UK) Ltd.
+// Copyright (C) 2019 Amarula Solutions B.V.
+// Author: Jagan Teki <[email protected]>
 
 /dts-v1/;
 
@@ -37,6 +35,22 @@
 	status = "okay";
 };
 
+&i2c0 {
+	status = "okay";
+
+	touchscreen at 5d {
+		compatible = "goodix,gt911";
+		reg = <0x5d>;
+		AVDD28-supply = <&reg_ldo_io0>;			/* VDD_CTP: GPIO0-LDO */
+		interrupt-parent = <&pio>;
+		interrupts = <7 4 IRQ_TYPE_EDGE_FALLING>;
+		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>;	/* CTP-INT: PH4 */
+		reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>;	/* CTP-RST: PH11 */
+		touchscreen-inverted-x;
+		touchscreen-inverted-y;
+	};
+};
+
 &mdio {
 	ext_rgmii_phy: ethernet-phy at 1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
@@ -52,6 +66,13 @@
 	regulator-name = "vcc-phy";
 };
 
+&reg_ldo_io0 {
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "vdd-ctp";
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pb_pins>;
arch/arm/dts/sun50i-a64-olinuxino-emmc.dts +7 -5
index 96ab0227e82..efb20846de4 100644
@@ -1,8 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (C) 2018 Martin Ayotte <[email protected]>
- * Copyright (C) 2019 Sunil Mohan Adapa <[email protected]>
- */
+// Copyright (C) 2018 Martin Ayotte <[email protected]>
+// Copyright (C) 2019 Sunil Mohan Adapa <[email protected]>
 
 #include "sun50i-a64-olinuxino.dts"
 
@@ -15,9 +13,13 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_pins>;
 	vmmc-supply = <&reg_dcdc1>;
-	vqmmc-supply = <&reg_dcdc1>;
+	vqmmc-supply = <&reg_eldo1>;
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
 	status = "okay";
 };
+
+&pio {
+	vcc-pc-supply = <&reg_eldo1>;
+};
arch/arm/dts/sun50i-a64-olinuxino.dts +71 -42

152 lines not on this page · raw message

arch/arm/dts/sun50i-a64-orangepi-win.dts +85 -42

179 lines not on this page · raw message

arch/arm/dts/sun50i-a64-pine64-lts.dts +2 -5
index 72d6961dc31..302e24be0a3 100644
@@ -1,8 +1,5 @@
-/*
- * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
- *
- * Copyright (c) 2018 ARM Ltd.
- */
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (c) 2018 ARM Ltd.
 
 #include "sun50i-a64-sopine-baseboard.dts"
 
arch/arm/dts/sun50i-a64-pine64-plus.dts +11 -41

58 lines not on this page · raw message

arch/arm/dts/sun50i-a64-pine64.dts +54 -43

128 lines not on this page · raw message

arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi deleted +0 -17
deleted file mode 100644
index 650ab97ec99..00000000000
@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (C) 2018 Vasily Khoruzhick <[email protected]>
- *
- */
-
-#include "sunxi-u-boot.dtsi"
-
-/* The ANX6345 eDP-bridge is on r_i2c */
-&r_i2c {
-	anx6345: edp-bridge at 38 {
-		compatible = "analogix,anx6345";
-		reg = <0x38>;
-		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
-		status = "okay";
-	};
-};
arch/arm/dts/sun50i-a64-pinebook.dts +181 -56

341 lines not on this page · raw message

arch/arm/dts/sun50i-a64-pinephone-1.0.dts new file +11 -0
new file mode 100644
index 00000000000..0c42272106a
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Ondrej Jirman <[email protected]>
+
+/dts-v1/;
+
+#include "sun50i-a64-pinephone.dtsi"
+
+/ {
+	model = "Pine64 PinePhone Developer Batch (1.0)";
+	compatible = "pine64,pinephone-1.0", "allwinner,sun50i-a64";
+};
arch/arm/dts/sun50i-a64-pinephone-1.1.dts new file +30 -0
new file mode 100644
index 00000000000..3e99a87e9ce
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Ondrej Jirman <[email protected]>
+
+/dts-v1/;
+
+#include "sun50i-a64-pinephone.dtsi"
+
+/ {
+	model = "Pine64 PinePhone Braveheart (1.1)";
+	compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64";
+};
+
+&backlight {
+	power-supply = <&reg_ldo_io0>;
+	/*
+	 * PWM backlight circuit on this PinePhone revision was changed since
+	 * 1.0, and the lowest PWM duty cycle that doesn't lead to backlight
+	 * being off is around 20%. Duty cycle for the lowest brightness level
+	 * also varries quite a bit between individual boards, so the lowest
+	 * value here was chosen as a safe default.
+	 */
+	brightness-levels = <
+		774  793  814  842
+		882  935  1003 1088
+		1192 1316 1462 1633
+		1830 2054 2309 2596
+		2916 3271 3664 4096>;
+	num-interpolated-steps = <50>;
+	default-brightness-level = <400>;
+};
arch/arm/dts/sun50i-a64-pinephone-1.2.dts new file +40 -0
new file mode 100644
index 00000000000..a9f5b670c9b
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2020 Ondrej Jirman <[email protected]>
+
+/dts-v1/;
+
+#include "sun50i-a64-pinephone.dtsi"
+
+/ {
+	model = "Pine64 PinePhone (1.2)";
+	compatible = "pine64,pinephone-1.2", "allwinner,sun50i-a64";
+};
+
+&backlight {
+	power-supply = <&reg_ldo_io0>;
+	/*
+	 * PWM backlight circuit on this PinePhone revision was changed since 1.0,
+	 * and the lowest PWM duty cycle that doesn't lead to backlight being off
+	 * is around 10%. Duty cycle for the lowest brightness level also varries
+	 * quite a bit between individual boards, so the lowest value here was
+	 * chosen as a safe default.
+	 */
+	brightness-levels = <
+		5000 5248 5506 5858 6345
+		6987 7805 8823 10062 11543
+		13287 15317 17654 20319 23336
+		26724 30505 34702 39335 44427
+		50000
+	>;
+	num-interpolated-steps = <50>;
+	default-brightness-level = <500>;
+};
+
+&lis3mdl {
+	/*
+	 * Board revision 1.2 fixed routing of the interrupt to DRDY pin,
+	 * enable interrupts.
+	 */
+	interrupt-parent = <&pio>;
+	interrupts = <1 1 IRQ_TYPE_EDGE_RISING>; /* PB1 */
+};
arch/arm/dts/sun50i-a64-pinephone.dtsi new file +429 -0

429 lines not on this page · raw message

arch/arm/dts/sun50i-a64-pinetab.dts new file +460 -0

460 lines not on this page · raw message

arch/arm/dts/sun50i-a64-sopine-baseboard.dts +69 -44

146 lines not on this page · raw message

arch/arm/dts/sun50i-a64-sopine.dtsi +25 -44

77 lines not on this page · raw message

arch/arm/dts/sun50i-a64-teres-i-u-boot.dtsi deleted +0 -41

41 lines not on this page · raw message

arch/arm/dts/sun50i-a64-teres-i.dts +125 -13

189 lines not on this page · raw message

arch/arm/dts/sun50i-a64.dtsi +434 -98

40 lines not on this page · raw message

include/dt-bindings/clock/sun50i-a64-ccu.h +3 -1
index d66432c6e67..318eb15c414 100644

Lines of this file are not shown. View the raw message.

include/dt-bindings/clock/sun8i-de2.h +3 -0
index 3bed63b524a..7768f73b051 100644

Lines of this file are not shown. View the raw message.

include/dt-bindings/reset/sun8i-de2.h +1 -0
index 9526017432f..1c36a6ac86d 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.26.2

Part of the diff is not shown here. View the raw message.

author maintainer
#8 lore raw

PATCH v2 8/8 sunxi: a64: Add a defconfig for the PinePhone

In reply to Samuel Holland

The PinePhone is a smartphone produced by Pine64, with an A64 SoC, 2 or 3 GiB LPDDR3 RAM, 16 or 32 GiB eMMC, 720x1440 MIPI-DSI panel, and Quectel EG25-G modem.

There are two main board revisions: 1.1 for early adopters, and 1.2 for mass production. Since there is code to detect the board revision at boot, one config/image can support both boards.

---
 configs/pinephone_defconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 configs/pinephone_defconfig
configs/pinephone_defconfig new file +12 -0
new file mode 100644
index 00000000000..64ecef59c90
@@ -0,0 +1,12 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_SPL=y
+CONFIG_MACH_SUN50I=y
+CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
+CONFIG_DRAM_CLK=552
+CONFIG_DRAM_ZQ=3881949
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_PINEPHONE_DT_SELECTION=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinephone-1.2"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_OF_LIST="sun50i-a64-pinephone-1.1 sun50i-a64-pinephone-1.2"
Signature · 1 line
2.26.2
#9 lore raw

PATCH v2 8/8 sunxi: a64: Add a defconfig for the PinePhone

Quoted 9 lines · Samuel Holland

The PinePhone is a smartphone produced by Pine64, with an A64 SoC, 2 or 3 GiB LPDDR3 RAM, 16 or 32 GiB eMMC, 720x1440 MIPI-DSI panel, and Quectel EG25-G modem.

There are two main board revisions: 1.1 for early adopters, and 1.2 for mass production. Since there is code to detect the board revision at boot, one config/image can support both boards.

Quoted 6 lines
---
 configs/pinephone_defconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 configs/pinephone_defconfig

Can you update sunxi board maintainers file and send this patch alone.

Except this, all

Applied to u-boot-sunxi/master