Skip to contentSkip to conversation

arm: u8500: Enable upstream DT based SD card boot

PATCH Superseded Linus Walleij 1 participant 9 messages Aug 17

Subsystems (3)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Linus Walleij

author maintainer
#0 lore raw

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. Extend the PL180 driver to configure Ux500 signal direction and the SD card supply voltages.

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.

Add a U-Boot overlay for Golden's duplicate regulator names.

The same support is intended for the Codina, Codina TMO, Gavini, Golden, Kyle and Skomer device trees, while Janice remains the default for now.

This has been tested successfully to boot PostmarketOS using the EFI boot flow, with some minimal changes to the PostmarketOS to use systemd-boot and compile in the right kernel configs.

---
Linus Walleij (8):
pinctrl: Add compact Nomadik pin controller
mmc: arm_pl180: Configure Ux500 signal direction
mmc: arm_pl180: Set initial supply voltages
power: regulator: Add AB8500 AUX3 support
configs: stemmy: Enable SD card regulators
configs: stemmy: Boot EFI from external SD card
arm: u8500: Switch Stemmy to upstream Janice device tree
arm: u8500: Give Golden panel regulators unique names

 MAINTAINERS                                       |   2 +
 arch/arm/Kconfig                                  |   5 +
 arch/arm/dts/ste-ux500-samsung-golden-u-boot.dtsi |  11 +
 arch/arm/dts/u8500-u-boot.dtsi                    |  20 ++
 configs/stemmy_defconfig                          |   8 +-
 drivers/mmc/arm_pl180_mmci.c                      |  47 +++++
 drivers/pinctrl/Kconfig                           |   7 +
 drivers/pinctrl/Makefile                          |   1 +
 drivers/pinctrl/pinctrl-nomadik.c                 | 235 ++++++++++++++++++++++
 drivers/power/pmic/ab8500.c                       |   1 +
 drivers/power/regulator/Kconfig                   |   7 +
 drivers/power/regulator/Makefile                  |   1 +
 drivers/power/regulator/ab8500.c                  | 111 ++++++++++
 13 files changed, 453 insertions(+), 3 deletions(-)

---
base-commit: 0b581a9612e46310ee52bf8359165950d38b2a2b
change-id: 20260813-ux500-external-sdcard-a49778d77b21

Best regards,

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

PATCH 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 | 235 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 246 insertions(+)
MAINTAINERS +1 -0
index eb48eea55c5a..a5d6b5be29dc 100644
@@ -787,6 +787,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 1b474a346bf2..5b02ff18bd0e 100644
@@ -1278,6 +1278,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 +235 -0

235 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH 2/8 mmc: arm_pl180: Configure Ux500 signal direction

In reply to Linus Walleij

The Ux500 MMCI variant can control external level-shifter signal directions through the power register. Parse the standard ST MMCI device tree properties and set the corresponding direction and feedback-clock bits.

This is required by the external SD card slot on Samsung Janice, where commands cannot reach the card unless the direction controls are set.

---
 drivers/mmc/arm_pl180_mmci.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/mmc/arm_pl180_mmci.c +13 -0
index f00b0ff0dc95..af21b814641e 100644
@@ -427,6 +427,19 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 		host->version2 = false; /* ARM variant */
 	}
 
+	if (dev_read_bool(dev, "st,sig-dir-dat0"))
+		host->pwr_init |= SDI_PWR_DAT0DIREN;
+	if (dev_read_bool(dev, "st,sig-dir-dat2"))
+		host->pwr_init |= SDI_PWR_DAT2DIREN;
+	if (dev_read_bool(dev, "st,sig-dir-dat31"))
+		host->pwr_init |= SDI_PWR_DAT31DIREN;
+	if (dev_read_bool(dev, "st,sig-dir-dat74"))
+		host->pwr_init |= SDI_PWR_DAT74DIREN;
+	if (dev_read_bool(dev, "st,sig-dir-cmd"))
+		host->pwr_init |= SDI_PWR_CMDDIREN;
+	if (dev_read_bool(dev, "st,sig-pin-fbclk"))
+		host->pwr_init |= SDI_PWR_FBCLKEN;
+
 	gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
 
 	ret = mmc_of_parse(dev, cfg);
Signature · 1 line
2.55.0
author maintainer
#3 lore raw

PATCH 3/8 mmc: arm_pl180: Set initial supply voltages

In reply to Linus Walleij

Obtain the optional vmmc and vqmmc regulators and configure them for the normal SD voltage range before card initialization.

The Ux500 boards supply their SD cards from AB8500 or AB8505 AUX3, whose highest voltage selector is 2.91 V. Request that exact voltage for the Ux500 MMCI variant while retaining the normal 3.3 V target for other PL180 implementations.

Ignore the unsupported set-value operation for fixed regulators; their voltage is already described by their fixed constraints.

---
 drivers/mmc/arm_pl180_mmci.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/mmc/arm_pl180_mmci.c +34 -0
index af21b814641e..654608b7e74c 100644
@@ -16,6 +16,7 @@
 #include <log.h>
 #include <malloc.h>
 #include <mmc.h>
+#include <power/regulator.h>
 #include <dm/device_compat.h>
 #include <dm.h>
 
@@ -28,11 +29,22 @@
 #define MMC_CLOCK_MAX	48000000
 #define MMC_CLOCK_MIN	400000
 
+#define SD_VOLTAGE_MIN_UV	2700000
+#define SD_VOLTAGE_UV		3300000
+#define SD_VOLTAGE_MAX_UV	3600000
+#define UX500_SD_VOLTAGE_UV	2910000
+
 struct arm_pl180_mmc_plat {
 	struct mmc_config cfg;
 	struct mmc mmc;
 };
 
+static int arm_pl180_set_supply_voltage(struct udevice *supply, int target_uV)
+{
+	return regulator_set_value_clamp(supply, SD_VOLTAGE_MIN_UV,
+					 target_uV, SD_VOLTAGE_MAX_UV);
+}
+
 static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
 {
 	u32 hoststatus, statusmask;
@@ -385,6 +397,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 	struct pl180_mmc_host *host = dev_get_priv(dev);
 	struct mmc_config *cfg = &pdata->cfg;
 	struct clk clk;
+	int supply_uV = SD_VOLTAGE_UV;
 	u32 periphid;
 	int ret;
 
@@ -422,6 +435,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 		cfg->voltages = VOLTAGE_WINDOW_MMC;
 		cfg->f_min = host->clock_in / (2 + SDI_CLKCR_CLKDIV_INIT_V2);
 		host->version2 = true;
+		supply_uV = UX500_SD_VOLTAGE_UV;
 		break;
 	default:
 		host->version2 = false; /* ARM variant */
@@ -440,6 +454,26 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 	if (dev_read_bool(dev, "st,sig-pin-fbclk"))
 		host->pwr_init |= SDI_PWR_FBCLKEN;
 
+	if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
+		ret = device_get_supply_regulator(dev, "vmmc-supply",
+						  &mmc->vmmc_supply);
+		if (!ret) {
+			ret = arm_pl180_set_supply_voltage(mmc->vmmc_supply,
+							   supply_uV);
+			if (ret && ret != -ENOSYS)
+				return ret;
+		}
+
+		ret = device_get_supply_regulator(dev, "vqmmc-supply",
+						  &mmc->vqmmc_supply);
+		if (!ret) {
+			ret = arm_pl180_set_supply_voltage(mmc->vqmmc_supply,
+							   supply_uV);
+			if (ret && ret != -ENOSYS)
+				return ret;
+		}
+	}
+
 	gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
 
 	ret = mmc_of_parse(dev, cfg);
Signature · 1 line
2.55.0
author maintainer
#4 lore raw

PATCH 4/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, and both PMIC variants use the same control registers.

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 | 111 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 123 insertions(+)
MAINTAINERS +1 -0
index a5d6b5be29dc..8e78a7f224fa 100644
@@ -790,6 +790,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 5b02ff18bd0e..62aa9e8cc565 100644
@@ -1275,6 +1275,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
@@ -1283,6 +1284,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 00a25acfdf99..a27fe4925cf9 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 a40c9d340d98..a500a3da98d4 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 +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#5 lore raw

PATCH 5/8 configs: stemmy: 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 62aa9e8cc565..2a01ac9b7675 100644
@@ -1276,6 +1276,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.55.0
author maintainer
#6 lore raw

PATCH 6/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.

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..57e794c5c88b 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 -lb"
 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.55.0
author maintainer
#7 lore raw

PATCH 7/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 a fixed input clock for the external SD controller.

---
 arch/arm/dts/u8500-u-boot.dtsi | 20 ++++++++++++++++++++
 configs/stemmy_defconfig       |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)
arch/arm/dts/u8500-u-boot.dtsi new file +20 -0
new file mode 100644
index 000000000000..41eaad7f78b9
@@ -0,0 +1,20 @@
+// 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>;
+		};
+	};
+};
configs/stemmy_defconfig +2 -1
index 57e794c5c88b..1f512416c9f4 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.55.0
author maintainer
#8 lore raw

PATCH 8/8 arm: u8500: Give Golden panel regulators unique names

In reply to Linus Walleij

The Golden device tree gives both fixed panel supplies the same regulator-name. U-Boot requires regulator names to be unique and aborts driver-model initialization when binding the second supply.

Add a U-Boot overlay assigning distinct names to the 1.8 V and 3.0 V supplies. Include the common U8500 overlay since a board-specific overlay takes precedence over it.

---
 arch/arm/dts/ste-ux500-samsung-golden-u-boot.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/dts/ste-ux500-samsung-golden-u-boot.dtsi new file +11 -0
new file mode 100644
index 000000000000..647b3f73c413
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "u8500-u-boot.dtsi"
+
+&panel_reg_1v8 {
+	regulator-name = "panel-fixed-supply-1v8";
+};
+
+&panel_reg_3v0 {
+	regulator-name = "panel-fixed-supply-3v0";
+};
Signature · 1 line
2.55.0