Skip to contentSkip to conversation

arm: u8500: Enable upstream DT based SD card boot

PATCH Superseded Linus Walleij 2 participants 19 messages Sep 1 – Sep 14

Subsystems (3)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Linus Walleij

author maintainer
#0 lore raw

v7 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.

Backport the pending Linux DTS fixes for Golden's duplicate regulator name and GPIO key labels. These patches are queued for v7.4 on a locked down branch:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ux500-dts-for-soc

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 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 (13):
pinctrl: Add compact Nomadik pin controller
mmc: arm_pl180: Configure Ux500 signal direction
mmc: arm_pl180: Gate idle card clocks
power: regulator: Add driver voltage clamp callback
mmc: arm_pl180: Set initial supply voltages
mmc: arm_pl180: Power down card supplies at OS handoff
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/mmc/arm_pl180_mmci.c                       |   76 ++
 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 +++
 drivers/power/regulator/regulator-uclass.c         |    2 +
 .../src/arm/st/ste-ux500-samsung-golden.dts        |   10 +-
 include/power/regulator.h                          |    6 +
 20 files changed, 624 insertions(+), 1232 deletions(-)

---
base-commit: 3f19667468fb93bcb5702d23aa057b72639e3ac8
change-id: 20260813-ux500-external-sdcard-a49778d77b21

Best regards,

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

PATCH v7 1/13 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 e41ff7700dfa..337293d6f8b0 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 +230 -0

230 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#2 lore raw

PATCH v7 2/13 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 v7 3/13 mmc: arm_pl180: Gate idle card clocks

In reply to Linus Walleij

The MMC core uses mmc->clk_disable to request that the card clock is stopped, but the PL180 driver leaves SDI_CLKCR_CLKEN unchanged. This can leave inactive hosts driving their card clocks.

Honor clk_disable when programming the clock control register.

---
 drivers/mmc/arm_pl180_mmci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/arm_pl180_mmci.c +4 -0
index af21b814641e..28eb367f2e0a 100644
@@ -294,6 +294,10 @@ static int  host_set_ios(struct mmc *dev)
 	u32 sdi_clkcr;
 
 	sdi_clkcr = readl(&host->base->clock);
+	if (dev->clk_disable)
+		sdi_clkcr &= ~SDI_CLKCR_CLKEN;
+	else
+		sdi_clkcr |= SDI_CLKCR_CLKEN;
 
 	/* Ramp up the clock rate */
 	if (dev->clock) {
Signature · 1 line
2.55.0
author maintainer
#4 lore raw

PATCH v7 4/13 power: regulator: Add driver voltage clamp callback

In reply to Linus Walleij

The regulator core can clamp a requested voltage against device tree constraints, but it cannot account for discrete values supported by the hardware.

Add an optional set_value_clamp() driver callback. Apply the regulator constraints in the core before asking the driver to select the closest supported voltage in the resulting range. Drivers without the callback retain the existing behavior.

---
 drivers/power/regulator/regulator-uclass.c | 2 ++
 include/power/regulator.h                  | 6 ++++++
 2 files changed, 8 insertions(+)
drivers/power/regulator/regulator-uclass.c +2 -0
index 0f5ba51ad6c2..388c888546a6 100644
@@ -134,6 +134,8 @@ int regulator_set_value_clamp(struct udevice *dev,
 	if (uc_pdata->max_uV != -ENODATA)
 		max_uV = min(max_uV, uc_pdata->max_uV);
 	uV = clamp(target_uV, min_uV, max_uV);
+	if (ops->set_value_clamp)
+		return ops->set_value_clamp(dev, min_uV, uV, max_uV);
 
 	return regulator_set_value(dev, uV);
 }
include/power/regulator.h +6 -0
index 8d4d1450b905..f6838cb4605d 100644
@@ -195,13 +195,19 @@ struct dm_regulator_ops {
 	 * The regulator output value function calls operates on a micro Volts.
 	 *
 	 * get/set_value - get/set output value of the given output number
+	 * set_value_clamp - set the closest supported value within a range
 	 * @dev          - regulator device
 	 * Sets:
 	 * @uV           - set the output value [micro Volts]
+	 * @min_uV       - minimum acceptable output value [micro Volts]
+	 * @target_uV    - preferred output value [micro Volts]
+	 * @max_uV       - maximum acceptable output value [micro Volts]
 	 * @return output value [uV] on success or negative errno if fail.
 	 */
 	int (*get_value)(struct udevice *dev);
 	int (*set_value)(struct udevice *dev, int uV);
+	int (*set_value_clamp)(struct udevice *dev, int min_uV,
+			       int target_uV, int max_uV);
 
 	/**
 	 * The regulator suspend output value function calls operates
Signature · 1 line
2.55.0
author maintainer
#5 lore raw

PATCH v7 5/13 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.

Request the standard 3.3 V target within the allowed 2.7-3.6 V range. The regulator clamp operation lets regulators with discrete selectors choose the closest supported voltage. This selects 2.91 V on AB8500 and 3.05 V on AB8505.

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

---
 drivers/mmc/arm_pl180_mmci.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/mmc/arm_pl180_mmci.c +29 -0
index 28eb367f2e0a..e4c22d4b0782 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,21 @@
 #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
+
 struct arm_pl180_mmc_plat {
 	struct mmc_config cfg;
 	struct mmc mmc;
 };
 
+static int arm_pl180_set_supply_voltage(struct udevice *supply)
+{
+	return regulator_set_value_clamp(supply, SD_VOLTAGE_MIN_UV,
+					 SD_VOLTAGE_UV, SD_VOLTAGE_MAX_UV);
+}
+
 static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
 {
 	u32 hoststatus, statusmask;
@@ -444,6 +455,24 @@ 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);
+			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);
+			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
#6 lore raw

PATCH v7 6/13 mmc: arm_pl180: Power down card supplies at OS handoff

In reply to Linus Walleij

PL180 card supplies remain enabled after probing and while U-Boot is running. They are no longer needed once control is handed to the operating system.

Mark the driver for removal during OS preparation and disable its VMMC and VQMMC supplies from the remove callback.

---
 drivers/mmc/arm_pl180_mmci.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/mmc/arm_pl180_mmci.c +30 -0
index e4c22d4b0782..03d907e9c06f 100644
@@ -44,6 +44,20 @@ static int arm_pl180_set_supply_voltage(struct udevice *supply)
 					 SD_VOLTAGE_UV, SD_VOLTAGE_MAX_UV);
 }
 
+static int arm_pl180_disable_supply(struct udevice *supply)
+{
+	int ret;
+
+	if (!supply)
+		return 0;
+
+	ret = regulator_set_enable_if_allowed(supply, false);
+	if (ret == -ENOSYS)
+		return 0;
+
+	return ret;
+}
+
 static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
 {
 	u32 hoststatus, statusmask;
@@ -487,6 +501,20 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 	return 0;
 }
 
+static int arm_pl180_mmc_remove(struct udevice *dev)
+{
+	struct mmc *mmc = mmc_get_mmc_dev(dev);
+	int ret, vmmc_ret;
+
+	ret = arm_pl180_disable_supply(mmc->vqmmc_supply);
+	if (mmc->vmmc_supply != mmc->vqmmc_supply)
+		vmmc_ret = arm_pl180_disable_supply(mmc->vmmc_supply);
+	else
+		vmmc_ret = 0;
+
+	return ret ? ret : vmmc_ret;
+}
+
 int arm_pl180_mmc_bind(struct udevice *dev)
 {
 	struct arm_pl180_mmc_plat *plat = dev_get_plat(dev);
@@ -550,8 +578,10 @@ U_BOOT_DRIVER(arm_pl180_mmc) = {
 	.of_match = arm_pl180_mmc_match,
 	.ops = &arm_pl180_dm_mmc_ops,
 	.probe = arm_pl180_mmc_probe,
+	.remove = arm_pl180_mmc_remove,
 	.of_to_plat = arm_pl180_mmc_of_to_plat,
 	.bind = arm_pl180_mmc_bind,
 	.priv_auto	= sizeof(struct pl180_mmc_host),
 	.plat_auto	= sizeof(struct arm_pl180_mmc_plat),
+	.flags = DM_FLAG_OS_PREPARE,
 };
Signature · 1 line
2.55.0
author maintainer
#7 lore raw

PATCH v7 7/13 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 337293d6f8b0..09a8ddcee0e5 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 +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.55.0
author maintainer
#8 lore raw

PATCH v7 8/13 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 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
#9 lore raw

PATCH v7 9/13 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.55.0
author maintainer
#10 lore raw

PATCH v7 10/13 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 a02dad22f274..355d7cf8ba91 100644
@@ -503,7 +503,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.55.0
author maintainer
#11 lore raw

PATCH v7 11/13 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 ]

(cherry picked from ux500-dts-for-soc)

---
 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.55.0
author maintainer
#12 lore raw

PATCH v7 12/13 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 ]

(cherry picked from ux500-dts-for-soc)

---
 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.55.0
author maintainer
#13 lore raw

PATCH v7 13/13 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.55.0
#14 lore raw
In reply to Linus Walleij
Quoted 13 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. 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.

Quoted 4 lines

Backport the pending Linux DTS fixes for Golden's duplicate regulator name and GPIO key labels. These patches are queued for v7.4 on a locked down branch:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ux500-dts-for-soc

OK, so, the problem is that since they aren't in Linus' tree, they may get over-written with v7.3-dts once that exists and I do the import. Can those changes live in -u-boot.dtsi file(s) under arch/arm/... until they are available in devicetree-rebasing? Sorry for not catching this earlier.

Signature · 1 line
Tom
author maintainer
#15 lore raw
Quoted 5 lines · Tom Rini

OK, so, the problem is that since they aren't in Linus' tree, they may get over-written with v7.3-dts once that exists and I do the import. Can those changes live in -u-boot.dtsi file(s) under arch/arm/... until they are available in devicetree-rebasing? Sorry for not catching this earlier.

We can just wait until they are upstream I guess? I'm not in any particular hurry.

Could you just merge the driver patches 1-7?

That enables me to work a bit with some MMC throughput improvements on top, right now it works but it's slow.

Yours,
Linus Walleij

#16 lore raw
Quoted 10 lines · Linus Walleij
Quoted 5 lines · Tom Rini

OK, so, the problem is that since they aren't in Linus' tree, they may get over-written with v7.3-dts once that exists and I do the import. Can those changes live in -u-boot.dtsi file(s) under arch/arm/... until they are available in devicetree-rebasing? Sorry for not catching this earlier.

We can just wait until they are upstream I guess? I'm not in any particular hurry.

OK, yes please, lets do that.

Quoted 4 lines

Could you just merge the driver patches 1-7?

That enables me to work a bit with some MMC throughput improvements on top, right now it works but it's slow.

Ah, that I think will run afoul of the email I just hit send on, sorry.

Signature · 1 line
Tom
#17 lore raw
In reply to Linus Walleij
Quoted 24 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. 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.

Backport the pending Linux DTS fixes for Golden's duplicate regulator name and GPIO key labels. These patches are queued for v7.4 on a locked down branch:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ux500-dts-for-soc

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.

Quoted 4 lines

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.

The MMC changes least to a failure to build on at least vexpress_ca9x4. You can see what boards use drivers/mmc/arm_pl180_mmci.c by doing:

$ grep arm_pl180_mmci drivers/mmc/Makefile
obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
$ ./tools/qconfig.py -b
... wait
$ ./tools/qconfig.py -f CONFIG_ARM_PL180_MMCI
11 matches
stemmy stm32746g-eval stm32746g-eval_spl stm32f429-evaluation stm32f469-discovery stm32f746-disco stm32f746-disco_spl stm32f769-disco stm32f769-disco_spl total_compute vexpress_ca9x4

Thanks!

Signature · 1 line
Tom
author maintainer
#18 lore raw
Quoted 9 lines · Tom Rini

The MMC changes least to a failure to build on at least vexpress_ca9x4. You can see what boards use drivers/mmc/arm_pl180_mmci.c by doing:

$ grep arm_pl180_mmci drivers/mmc/Makefile
obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
$ ./tools/qconfig.py -b
... wait
$ ./tools/qconfig.py -f CONFIG_ARM_PL180_MMCI
11 matches
stemmy stm32746g-eval stm32746g-eval_spl stm32f429-evaluation stm32f469-discovery stm32f746-disco stm32f746-disco_spl stm32f769-disco stm32f769-disco_spl total_compute vexpress_ca9x4

Thanks Tom, I'll try to build a bunch of them and see if I can reproduce this and fix it up.

Yours,
Linus Walleij