Skip to contentSkip to conversation

arm: u8500: Enable upstream DT based SD card boot

PATCH In review Linus Walleij 2 participants 10 messages Oct 23 – Nov 4

Subsystems (2)
lore
Share & tools
lore

Linus Walleij

author maintainer
#0 lore raw

v8 cover arm: u8500: Enable upstream DT based SD card boot

Switch the U8500 Stemmy configuration to the upstream Samsung Janice device tree and enable booting an EFI system from the external SD card.

Add compact DB8500 pinctrl support for applying the default states from the upstream device trees.

The upstream device trees describe the SD card supplies through the AB8500 or AB8505 PMIC. Add support for the AUX3 regulator used as vmmc-supply, using the existing AB8500 PMIC driver for register access. Enable fixed regulators for the vqmmc level shifters used on the other supported Samsung boards.

Backport the Linux DTS fixes for Golden's duplicate regulator name and GPIO key labels. These patches are now in the upstream Linux kernel tree.

The seven supported device trees are packaged into a FIT appended to U-Boot. The Samsung firmware machine ID selects the matching tree at runtime. Codina TMO shares the Codina machine ID and is distinguished by board ID. This keeps the board-specific SD supplies, level-shifter GPIOs and MMCI signal-direction settings in their respective device trees while using a single U-Boot binary.

This has been tested successfully to boot PostmarketOS on all the known Sansung Ux500 devices using the EFI boot flow, with some minimal changes to the PostmarketOS to use systemd-boot and compile in the right EFI kernel configs and EFI stub.

---
Changes in v8:
- Rebased on U-Boot main branch and dropping the Pl180 improvements
already upstream.
- Link to v7: https://patch.msgid.link/[email protected]

Changes in v7:
- Picked up final ACKs.
- Rebased on aug 29 main branch.
- Added committ IDs that will be upstream in the Linux kernel
once the pull requests go in from the ux500-dts-for-soc branch.
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ux500-dts-for-soc
- Link to v6: https://patch.msgid.link/[email protected]

Changes in v6:
- Stop enabling PL180 power-save mode when gating idle card clocks.
- Reformat and group the AB8500 regulator register definitions.
- Document the disabled SDIO controller in the U8500 overlay.
- Scope multi-DTB FIT settings to Stemmy.
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- Replace Golden U-Boot overlays with pending Linux DTS backports.
- Add a regulator clamp API in a separate preparatory patch.
- Select the closest supported initial SD supply voltage.
- Support the AB8505 VAUX3 3.05 V selector override.
- Recognize normal and low-power VAUX3 states as enabled.
- Recognize the alternate Gavini firmware machine ID 3296.
- Boot tested on all Ux500 devices including Gavini and Kyle.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Package all seven Stemmy device trees in an appended FIT.
- Select the Stemmy device tree using the firmware machine and board IDs.
- Print the firmware machine and board IDs for diagnostics.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Disable unsupported DDR mode on the internal eMMC controller.
- Gate idle PL180 card clocks and honor clock-disable requests.
- Shut down PL180 card supplies at OS handoff.
- Skip global EFI boot entries when scanning the external SD card.
- Disable the unused WLAN SDIO controller in U-Boot.
- Remove the obsolete downstream Stemmy and DBx500 device trees.
- Provide a fixed clock for the internal eMMC controller.
- Enter fastboot when the volume-down button is held.
- Use standard DM helpers to bind the AB8500 AUX3 regulator.
- Select 3.3 V supplies for eMMC-only PL180 hosts.
- Use Nomadik DT-binding macros in the pinctrl driver.
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Use the new mailing list address, no other changes.
- Link to v1: https://patch.msgid.link/[email protected]

---
Linus Walleij (8):
pinctrl: Add compact Nomadik pin controller
power: regulator: Add AB8500 AUX3 support
arm: u8500: Enable SD card regulators
configs: stemmy: Boot EFI from external SD card
arm: u8500: Switch Stemmy to upstream Janice device tree
ARM: dts: ux500: Make panel regulators have unique names
ARM: dts: ux500: Harmonize GPIO key names
arm: u8500: Package Stemmy device trees in FIT

 MAINTAINERS                                        |    2 +
 arch/arm/Kconfig                                   |    5 +
 arch/arm/dts/Makefile                              |    1 -
 arch/arm/dts/ste-dbx5x0-u-boot.dtsi                |   38 -
 arch/arm/dts/ste-dbx5x0.dtsi                       | 1144 --------------------
 arch/arm/dts/ste-ux500-samsung-stemmy.dts          |   36 -
 arch/arm/dts/u8500-u-boot.dtsi                     |   31 +
 board/ste/stemmy/stemmy.c                          |   77 +-
 configs/stemmy_defconfig                           |   10 +-
 drivers/pinctrl/Kconfig                            |    7 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-nomadik.c                  |  230 ++++
 drivers/power/pmic/ab8500.c                        |    1 +
 drivers/power/regulator/Kconfig                    |    7 +
 drivers/power/regulator/Makefile                   |    1 +
 drivers/power/regulator/ab8500.c                   |  171 +++
 .../src/arm/st/ste-ux500-samsung-golden.dts        |   10 +-
 17 files changed, 540 insertions(+), 1232 deletions(-)

---
base-commit: f97bb5c1ad78e95856917b92c7270c82d4b11e21
change-id: 20260813-ux500-external-sdcard-a49778d77b21

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>
author maintainer
#1 lore raw

PATCH v8 1/8 pinctrl: Add compact Nomadik pin controller

Add the minimal pin control support needed to consume default states from the upstream DB8500 device trees. Resolve the nine Nomadik GPIO banks through nomadik-gpio-chips and apply the mux, direction, value, pull and low-EMI settings directly to their registers.

Only the DB8500 binding and default-state configuration needed by U-Boot are supported. There is no GPIO ownership or sleep-state handling.

---
 MAINTAINERS                       |   1 +
 arch/arm/Kconfig                  |   2 +
 drivers/pinctrl/Kconfig           |   7 ++
 drivers/pinctrl/Makefile          |   1 +
 drivers/pinctrl/pinctrl-nomadik.c | 230 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 241 insertions(+)
MAINTAINERS +1 -0
index 95b1f3b5ab30..dbf523e21107 100644
@@ -774,6 +774,7 @@ S:	Maintained
 F:	arch/arm/dts/ste-*
 F:	arch/arm/mach-u8500/
 F:	drivers/gpio/nmk_gpio.c
+F:	drivers/pinctrl/pinctrl-nomadik.c
 F:	drivers/phy/phy-ab8500-usb.c
 F:	drivers/power/pmic/ab8500.c
 F:	drivers/timer/nomadik-mtu-timer.c
arch/arm/Kconfig +2 -0
index 3e9f3b51031b..8997a82f4f04 100644
@@ -1309,6 +1309,8 @@ config ARCH_U8500
 	imply DM_RTC
 	imply NOMADIK_GPIO
 	imply NOMADIK_MTU_TIMER
+	imply PINCTRL
+	imply PINCTRL_NOMADIK
 	imply PHY
 	imply PL01X_SERIAL
 	imply PMIC_AB8500
drivers/pinctrl/Kconfig +7 -0
index fd30aaeeaa89..04785a927fec 100644
@@ -75,6 +75,13 @@ config PINCONF_RECURSIVE
 	  configuration; you can save memory footprint when this feature is
 	  no needed.
 
+config PINCTRL_NOMADIK
+	bool "Nomadik pin control driver"
+	depends on PINCTRL_FULL
+	help
+	  Enable pin multiplexing and configuration support for the Nomadik
+	  GPIO blocks in the ST-Ericsson DB8500.
+
 config SPL_PINCTRL
 	bool "Support pin controllers in SPL"
 	depends on SPL && SPL_DM
drivers/pinctrl/Makefile +1 -0
index 91149796bb5f..23219626e392 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_PINCTRL_K210)		+= pinctrl-k210.o
 obj-$(CONFIG_PINCTRL_MESON)		+= meson/
 obj-$(CONFIG_PINCTRL_MSCC)		+= mscc/
 obj-$(CONFIG_PINCTRL_MTK)		+= mediatek/
+obj-$(CONFIG_PINCTRL_NOMADIK)		+= pinctrl-nomadik.o
 obj-$(CONFIG_PINCTRL_PIC32)		+= pinctrl_pic32.o
 obj-$(CONFIG_PINCTRL_QCOM)		+= qcom/
 obj-$(CONFIG_PINCTRL_QE)		+= pinctrl-qe-io.o
drivers/pinctrl/pinctrl-nomadik.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
2.56.0
author maintainer
#2 lore raw

PATCH v8 2/8 power: regulator: Add AB8500 AUX3 support

In reply to Linus Walleij

Add regulator support for LDO AUX3 on AB8500 and AB8505 PMICs. AUX3 supplies the removable SD card on the upstream Ux500 Samsung device trees.

Support the AB8505-specific 3.05 V selector override and clear it after programming an ordinary voltage. Treat both normal and low-power modes as enabled and select the supported voltage closest to a requested target. AB8500 cut 2.0 or later is assumed.

Imply the regulator core for ARCH_U8500 so the driver can instantiate from the upstream device trees.

---
 MAINTAINERS                      |   1 +
 arch/arm/Kconfig                 |   2 +
 drivers/power/pmic/ab8500.c      |   1 +
 drivers/power/regulator/Kconfig  |   7 ++
 drivers/power/regulator/Makefile |   1 +
 drivers/power/regulator/ab8500.c | 171 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 183 insertions(+)
MAINTAINERS +1 -0
index dbf523e21107..6851c5151dbd 100644
@@ -777,6 +777,7 @@ F:	drivers/gpio/nmk_gpio.c
 F:	drivers/pinctrl/pinctrl-nomadik.c
 F:	drivers/phy/phy-ab8500-usb.c
 F:	drivers/power/pmic/ab8500.c
+F:	drivers/power/regulator/ab8500.c
 F:	drivers/timer/nomadik-mtu-timer.c
 F:	drivers/usb/musb-new/ux500.c
 F:	drivers/video/mcde_simple.c
arch/arm/Kconfig +2 -0
index 8997a82f4f04..00f3cd9ec4db 100644
@@ -1306,6 +1306,7 @@ config ARCH_U8500
 	imply ARM_PL180_MMCI
 	imply CLK
 	imply DM_PMIC
+	imply DM_REGULATOR
 	imply DM_RTC
 	imply NOMADIK_GPIO
 	imply NOMADIK_MTU_TIMER
@@ -1314,6 +1315,7 @@ config ARCH_U8500
 	imply PHY
 	imply PL01X_SERIAL
 	imply PMIC_AB8500
+	imply REGULATOR_AB8500
 	imply RTC_PL031
 	imply SYS_THUMB_BUILD
 	imply SYSRESET_SYSCON
drivers/power/pmic/ab8500.c +1 -0
index 9ba096711e14..b9fae7000b78 100644
@@ -253,6 +253,7 @@ static int ab8500_probe(struct udevice *dev)
 
 static const struct udevice_id ab8500_ids[] = {
 	{ .compatible = "stericsson,ab8500" },
+	{ .compatible = "stericsson,ab8505" },
 	{ }
 };
 
drivers/power/regulator/Kconfig +7 -0
index 428689702c87..dbd24415cb5a 100644
@@ -16,6 +16,13 @@ config DM_REGULATOR
 	  for this purpose if PMIC I/O driver is implemented or dm_scan_fdt_dev()
 	  otherwise. Detailed information can be found in the header file.
 
+config REGULATOR_AB8500
+	bool "ST-Ericsson AB8500/AB8505 regulator support"
+	depends on DM_REGULATOR && PMIC_AB8500
+	help
+	  Enable LDO AUX3 regulator support for AB8500 and AB8505 PMICs.
+	  This supply is used to power removable SD cards on Ux500 boards.
+
 config SPL_DM_REGULATOR
 	bool "Enable regulators for SPL"
 	depends on DM_REGULATOR && SPL_POWER
drivers/power/regulator/Makefile +1 -0
index e17937f4c26f..bfe3349e3e5d 100644
@@ -5,6 +5,7 @@
 #
 
 obj-$(CONFIG_$(PHASE_)DM_REGULATOR) += regulator-uclass.o
+obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
 obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o
 obj-$(CONFIG_REGULATOR_AS3722)	+= as3722_regulator.o
 obj-$(CONFIG_$(PHASE_)REGULATOR_AXP) += axp_regulator.o
drivers/power/regulator/ab8500.c new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.56.0
author maintainer
#3 lore raw

PATCH v8 3/8 arm: u8500: Enable SD card regulators

In reply to Linus Walleij

Have ARCH_U8500 imply the fixed regulator driver needed by level shifters on the supported boards. The architecture already enables the regulator core and Nomadik GPIO driver.

---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig +1 -0
index 00f3cd9ec4db..93a0c663043f 100644
@@ -1307,6 +1307,7 @@ config ARCH_U8500
 	imply CLK
 	imply DM_PMIC
 	imply DM_REGULATOR
+	imply DM_REGULATOR_FIXED
 	imply DM_RTC
 	imply NOMADIK_GPIO
 	imply NOMADIK_MTU_TIMER
Signature · 1 line
2.56.0
author maintainer
#4 lore raw

PATCH v8 4/8 configs: stemmy: Boot EFI from external SD card

In reply to Linus Walleij

Replace the fastboot-only command with standard bootflow scanning and enable the EFI loader so the removable SD card can provide the default ARM EFI executable. Filesystem probing is handled by the standard boot framework and does not require the FAT command.
Skip global boot methods so EFI variables cannot redirect the scan to the internal eMMC.

Disable mkeficapsule because generating capsule tools is unrelated to running EFI payloads and adds a host GnuTLS build dependency.

---
 configs/stemmy_defconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
configs/stemmy_defconfig +3 -2
index 631ccababf1c..b1a14ab38210 100644
@@ -14,10 +14,10 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000
 CONFIG_DEFAULT_DEVICE_TREE="ste-ux500-samsung-stemmy"
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x100000
-# CONFIG_EFI_LOADER is not set
+CONFIG_BOOTSTD_FULL=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run fastbootcmd"
+CONFIG_BOOTCOMMAND="bootflow scan -lbG"
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
@@ -43,3 +43,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x685d
 CONFIG_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_MCDE_SIMPLE=y
+# CONFIG_TOOLS_MKEFICAPSULE is not set
Signature · 1 line
2.56.0
author maintainer
#5 lore raw

PATCH v8 5/8 arm: u8500: Switch Stemmy to upstream Janice device tree

In reply to Linus Walleij

Use the upstream Samsung Janice device tree as the initial target for the Stemmy configuration. This also prepares the board to share the upstream Ux500 Samsung device trees with Linux.

U-Boot does not yet implement the U8500 clock providers used by the upstream device tree. Add a U-Boot-specific overlay with the known MTU clock rate and fixed input clocks for the external SD and internal eMMC controllers. Remove the superseded downstream Stemmy and DBx500 device tree files, and disable the unused WLAN SDIO controller for U-Boot.

---
 arch/arm/dts/Makefile                     |    1 -
 arch/arm/dts/ste-dbx5x0-u-boot.dtsi       |   38 -
 arch/arm/dts/ste-dbx5x0.dtsi              | 1144 -----------------------------
 arch/arm/dts/ste-ux500-samsung-stemmy.dts |   36 -
 arch/arm/dts/u8500-u-boot.dtsi            |   31 +
 configs/stemmy_defconfig                  |    3 +-
 6 files changed, 33 insertions(+), 1220 deletions(-)
arch/arm/dts/Makefile +0 -1
index 79e1e6bc0e3f..cf4674042a2c 100644
@@ -502,7 +502,6 @@ dtb-$(CONFIG_TARGET_SL28) += fsl-ls1028a-kontron-sl28.dtb \
 
 dtb-$(CONFIG_TARGET_TEN64) += fsl-ls1088a-ten64.dtb
 
-dtb-$(CONFIG_TARGET_STEMMY) += ste-ux500-samsung-stemmy.dtb
 
 dtb-$(CONFIG_MACH_SUN4I) += \
 	sun4i-a10-inet-3f.dtb \
arch/arm/dts/ste-dbx5x0-u-boot.dtsi deleted +0 -38
deleted file mode 100644
index e350175305e9..000000000000
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "skeleton.dtsi"
-#include "ste-dbx5x0.dtsi"
-
-/ {
-	/* FIXME: Remove this when clk driver is implemented */
-	sdmmcclk: sdmmcclk {
-		compatible = "fixed-clock";
-		#clock-cells = <0>;
-		clock-frequency = <100000000>;
-	};
-
-	soc {
-		mtu@a03c6000 {
-			clock-frequency = <133000000>;
-		};
-		uart@80120000 {
-			clock = <38400000>;
-		};
-		uart@80121000 {
-			clock = <38400000>;
-		};
-		uart@80007000 {
-			clock = <38400000>;
-		};
-		mmc@80005000 {
-			clocks = <&sdmmcclk>;
-		};
-	};
-
-	reboot {
-		compatible = "syscon-reboot";
-		regmap = <&prcmu>;
-		offset = <0x228>; /* PRCM_APE_SOFTRST */
-		mask = <0x1>;
-	};
-};
arch/arm/dts/ste-dbx5x0.dtsi deleted +0 -1144

1,144 lines not on this page · raw message

arch/arm/dts/ste-ux500-samsung-stemmy.dts deleted +0 -36
deleted file mode 100644
index 14be86086b22..000000000000
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/dts-v1/;
-
-#include "ste-dbx5x0-u-boot.dtsi"
-#include "ste-ab8500.dtsi"
-
-/ {
-	compatible = "samsung,stemmy", "st-ericsson,u8500";
-
-	chosen {
-		stdout-path = &serial2;
-	};
-
-	soc {
-		/* eMMC */
-		mmc@80005000 {
-			status = "okay";
-
-			arm,primecell-periphid = <0x10480180>;
-			max-frequency = <100000000>;
-			bus-width = <8>;
-
-			non-removable;
-			cap-mmc-highspeed;
-		};
-
-		/* Debugging console UART */
-		uart@80007000 {
-			status = "okay";
-		};
-
-		mcde@a0350000 {
-			status = "okay";
-		};
-	};
-};
arch/arm/dts/u8500-u-boot.dtsi new file +31 -0
new file mode 100644
index 000000000000..cf37a7e140c6
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/ {
+	/* FIXME: Remove this when the U8500 clock driver is implemented */
+	sdmmcclk: sdmmcclk {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <100000000>;
+	};
+
+	soc {
+		mtu@a03c6000 {
+			clock-frequency = <133000000>;
+		};
+
+		mmc@80126000 {
+			clocks = <&sdmmcclk>;
+		};
+
+		mmc@80118000 {
+			/* Typically SDIO, unneeded in U-Boot */
+			status = "disabled";
+		};
+
+		mmc@80005000 {
+			clocks = <&sdmmcclk>;
+			/* U-Boot cannot handle switching the controller to DDR mode */
+			/delete-property/ mmc-ddr-1_8v;
+		};
+	};
+};
configs/stemmy_defconfig +2 -1
index b1a14ab38210..c253780df2ef 100644
@@ -11,7 +11,8 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000
-CONFIG_DEFAULT_DEVICE_TREE="ste-ux500-samsung-stemmy"
+CONFIG_DEFAULT_DEVICE_TREE="st/ste-ux500-samsung-janice"
+CONFIG_OF_UPSTREAM=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x100000
 CONFIG_BOOTSTD_FULL=y
Signature · 1 line
2.56.0
author maintainer
#6 lore raw

PATCH v8 6/8 ARM: dts: ux500: Make panel regulators have unique names

In reply to Linus Walleij

U-Boot is not happy about regulators with the same name though Linux can deal with it. Make the names unique, it's more elegant.

[ upstream commit: a2dd0d9654e9e68b901fe63fe60cab8f4b4aa039 ]

---
 dts/upstream/src/arm/st/ste-ux500-samsung-golden.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
dts/upstream/src/arm/st/ste-ux500-samsung-golden.dts +2 -2
index f736888474e7..d4f364ec8685 100644
@@ -510,7 +510,7 @@
 	panel_reg_1v8: regulator-panel-1v8 {
 		compatible = "regulator-fixed";
 
-		regulator-name = "panel-fixed-supply";
+		regulator-name = "panel-fixed-supply-1v8";
 		regulator-min-microvolt = <1800000>;
 		regulator-max-microvolt = <1800000>;
 		/* GPIO219 */
@@ -527,7 +527,7 @@
 	panel_reg_3v0: regulator-panel-3v0 {
 		compatible = "regulator-fixed";
 
-		regulator-name = "panel-fixed-supply";
+		regulator-name = "panel-fixed-supply-3v0";
 		regulator-min-microvolt = <3000000>;
 		regulator-max-microvolt = <3000000>;
 		/* GPIO219 */
Signature · 1 line
2.56.0
author maintainer
#7 lore raw

PATCH v8 7/8 ARM: dts: ux500: Harmonize GPIO key names

In reply to Linus Walleij

U-Boot want to use the volume down key for activating fastboot mode, however the code there relies on using the key label, and this differs betweem Golden and the other devices, so harmonize this by using the same label as the other devices.

[ upstream commit: 18fb6f060ebaf10aa69f7411868dcde376c528c2 ]

---
 dts/upstream/src/arm/st/ste-ux500-samsung-golden.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
dts/upstream/src/arm/st/ste-ux500-samsung-golden.dts +3 -3
index d4f364ec8685..1bb667300ed3 100644
@@ -391,21 +391,21 @@
 		label = "GPIO Buttons";
 
 		volume-up {
-			label = "Volume Up";
+			label = "VOL+";
 			/* GPIO67 (VOL_UP) */
 			gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_VOLUMEUP>;
 		};
 
 		volume-down {
-			label = "Volume Down";
+			label = "VOL-";
 			/* GPIO92 (VOL_DOWN) */
 			gpios = <&gpio2 28 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_VOLUMEDOWN>;
 		};
 
 		home {
-			label = "Home";
+			label = "HOME";
 			/* GPIO91 (HOME_KEY) */
 			gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_HOMEPAGE>;
Signature · 1 line
2.56.0
author maintainer
#8 lore raw

PATCH v8 8/8 arm: u8500: Package Stemmy device trees in FIT

In reply to Linus Walleij

Build all seven supported Samsung Ux500 device trees into the FIT appended to Stemmy U-Boot. Select the appropriate configuration at runtime from the machine ID passed by the Samsung firmware. Codina and Codina TMO share a machine ID, so distinguish Codina TMO by its board ID.

Keep the multi-DTB FIT selection, default device tree and device tree list in stemmy_defconfig. This leaves the base U8500 platform available to non-Samsung devices (non-Stemmy) using their own board, defconfig and device tree selection.

Print the firmware machine and board IDs to aid diagnostics and future machine ID mappings.

---
 board/ste/stemmy/stemmy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++---
 configs/stemmy_defconfig  |  2 ++
 2 files changed, 74 insertions(+), 5 deletions(-)
board/ste/stemmy/stemmy.c +72 -5
index 66330184af86..8526deeb29bc 100644
@@ -21,6 +21,11 @@ static ulong fw_atags __section(".data");
 static const struct tag *fw_atags_copy;
 static uint fw_atags_size;
 
+#define SBL_BOARD "board_id="
+#define SBL_LCDTYPE "lcdtype="
+static ulong board_id;
+static ulong lcdtype;
+
 void save_boot_params(ulong r0, ulong r1, ulong r2, ulong r3)
 {
 	fw_mach = r1;
@@ -40,6 +45,70 @@ static const struct tag *fw_atags_get(void)
 	return tags;
 }
 
+static ulong fw_board_id_get(void)
+{
+	const struct tag *t, *tags = fw_atags_get();
+	const char *str;
+
+	if (!tags)
+		return 0;
+
+	for_each_tag(t, tags) {
+		if (t->hdr.tag != ATAG_CMDLINE)
+			continue;
+
+		str = strstr(t->u.cmdline.cmdline, SBL_BOARD);
+		if (str)
+			return simple_strtoul(str + strlen(SBL_BOARD), NULL, 10);
+	}
+
+	return 0;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+	const char *dt_name;
+
+	switch (fw_mach) {
+	case 5000:
+		dt_name = "ste-ux500-samsung-janice";
+		break;
+	case 3296:
+	case 5002:
+		dt_name = "ste-ux500-samsung-gavini";
+		break;
+	case 5003:
+		switch (fw_board_id_get()) {
+		case 0x101:
+		case 0x102:
+		case 0x103:
+		case 0x104:
+		case 0x105:
+		case 0x106:
+		case 0x107:
+			dt_name = "ste-ux500-samsung-codina-tmo";
+			break;
+		default:
+			dt_name = "ste-ux500-samsung-codina";
+			break;
+		}
+		break;
+	case 5006:
+		dt_name = "ste-ux500-samsung-kyle";
+		break;
+	case 5008:
+		dt_name = "ste-ux500-samsung-golden";
+		break;
+	case 5009:
+		dt_name = "ste-ux500-samsung-skomer";
+		break;
+	default:
+		return -ENOENT;
+	}
+
+	return strcmp(name, dt_name);
+}
+
 int dram_init(void)
 {
 	const struct tag *t, *tags = fw_atags_get();
@@ -96,11 +165,6 @@ static void parse_serial(const struct tag_serialnr *serialnr)
 	env_set("serial#", serial);
 }
 
-#define SBL_BOARD "board_id="
-#define SBL_LCDTYPE "lcdtype="
-static ulong board_id = 0;
-static ulong lcdtype = 0;
-
 static void parse_cmdline(const struct tag_cmdline *cmdline)
 {
 	char *buf;
@@ -181,6 +245,9 @@ static void copy_atags(const struct tag *tags)
 int misc_init_r(void)
 {
 	copy_atags(fw_atags_get());
+	printf("Firmware machine ID: %lu, board ID: %lu\n",
+	       fw_mach, board_id);
+
 	return 0;
 }
 
configs/stemmy_defconfig +2 -0
index c253780df2ef..7c9df043457e 100644
@@ -12,6 +12,8 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x100000
 CONFIG_DEFAULT_DEVICE_TREE="st/ste-ux500-samsung-janice"
+CONFIG_OF_LIST="st/ste-ux500-samsung-codina st/ste-ux500-samsung-codina-tmo st/ste-ux500-samsung-gavini st/ste-ux500-samsung-golden st/ste-ux500-samsung-janice st/ste-ux500-samsung-kyle st/ste-ux500-samsung-skomer"
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_OF_UPSTREAM=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x100000
Signature · 1 line
2.56.0
#9 lore raw
In reply to Linus Walleij
Quoted 6 lines · Linus Walleij

Switch the U8500 Stemmy configuration to the upstream Samsung Janice device tree and enable booting an EFI system from the external SD card.

Add compact DB8500 pinctrl support for applying the default states from the upstream device trees.

Quoted 7 lines

The upstream device trees describe the SD card supplies through the AB8500 or AB8505 PMIC. Add support for the AUX3 regulator used as vmmc-supply, using the existing AB8500 PMIC driver for register access. Enable fixed regulators for the vqmmc level shifters used on the other supported Samsung boards.

[...]

Applied to u-boot/main, thanks!

[1/8] pinctrl: Add compact Nomadik pin controller

      commit: 5ddbcf8c440e2f104f194fa9a2664b683eff314a
[2/8] power: regulator: Add AB8500 AUX3 support
      commit: d02cccb7684b9d655b8bee82b8dd2cacd8d668ea
[3/8] arm: u8500: Enable SD card regulators
      commit: 93292513d17c9757c1b0494f467b7cbb905887c2
[4/8] configs: stemmy: Boot EFI from external SD card
      commit: 52f68243c96d5615e5654661ed872cabc658920f
[5/8] arm: u8500: Switch Stemmy to upstream Janice device tree
      commit: d970ac095f150588404fd2ef08fa0db4503dfed0
[6/8] ARM: dts: ux500: Make panel regulators have unique names
      commit: c698441e1c8a5f74f0444681df3c67af5e173850
[7/8] ARM: dts: ux500: Harmonize GPIO key names
      commit: 9e14d1457065b34ee6110bfaa59357650d23bd12
[8/8] arm: u8500: Package Stemmy device trees in FIT
      commit: 5d50adae908d8b02497055dce16f3095a0289e0c
Signature · 1 line
Tom