arm: u8500: Enable upstream DT based SD card boot
Subsystems (3)
Linus Walleij
maintainerv2 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.
---
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
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]>
Linus Walleij
maintainerPATCH v2 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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [PATCH v2 1/8] pinctrl: Add compact Nomadik pin controller
Quoted 31 lines · Linus Walleij
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.
Signed-off-by Linus Walleij <[email protected]>--- 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(+)[....]
drivers/pinctrl/pinctrl-nomadik.c new file +6
-0@@ -0,0 +1,235 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2026 Linus Walleij <[email protected]> */ + +#include <dm.h> +#include <dm/pinctrl.h> +#include <vsprintf.h>
drivers/pinctrl/pinctrl-nomadik.c line 16
Quoted 10 lines
drivers/pinctrl/pinctrl-nomadik.c new file +10
-0+#include <asm/io.h> + +#define NMK_GPIO_BANKS 9 +#define NMK_GPIO_PER_BANK 32 + +#define NMK_INPUT_NOPULL 0 +#define NMK_INPUT_PULLUP 1 +#define NMK_INPUT_PULLDOWN 2 +#define NMK_OUTPUT_LOW 0 +#define NMK_OUTPUT_HIGH 1
Can we somehow reuse the defines in dts/upstream/include/dt-bindings/pinctrl/nomadik.h for this?
Looks fine to me otherwise!
Thanks,
Stephan
Linus Walleij
maintainerPATCH v2 2/8 mmc: arm_pl180: Configure Ux500 signal direction
In reply to Linus WalleijThe 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
@@ -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
Re: [PATCH v2 2/8] mmc: arm_pl180: Configure Ux500 signal direction
Quoted 9 lines · 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.
Signed-off-by Linus Walleij <[email protected]>
Quoted 32 lines
--- drivers/mmc/arm_pl180_mmci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/mmc/arm_pl180_mmci.c +13
-0@@ -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 · 2 lines
-- 2.55.0
Linus Walleij
maintainerPATCH v2 3/8 mmc: arm_pl180: Set initial supply voltages
In reply to Linus WalleijObtain 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
@@ -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
Re: [PATCH v2 3/8] mmc: arm_pl180: Set initial supply voltages
Quoted 60 lines · 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.
Signed-off-by Linus Walleij <[email protected]>--- drivers/mmc/arm_pl180_mmci.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)drivers/mmc/arm_pl180_mmci.c +13
-0@@ -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;
drivers/mmc/arm_pl180_mmci.c static int arm_pl180_mmc_probe(struct udevice *dev) · line 439
Quoted 5 lines
drivers/mmc/arm_pl180_mmci.c +1
-0@@ -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 ;
Do we need to differentiate between MMC and SD here and for the voltage below? There seems to be the magic number VOLTAGE_WINDOW_MMC / VOLTAGE_WINDOW_SD here, which I have set to MMC in the Ux500 case above. The other platforms have it set to VOLTAGE_WINDOW_SD...
If I'm reading this correctly this voltage is sent to the card to let it pick the preferred voltage, but it doesn't look like U-Boot is designed to act on that signal...
Thanks,
Stephan
Linus Walleij
maintainerPATCH v2 4/8 power: regulator: Add AB8500 AUX3 support
In reply to Linus WalleijAdd 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [PATCH v2 4/8] power: regulator: Add AB8500 AUX3 support
Quoted 29 lines · 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_U8500so the driver can instantiate from the upstream device trees.Signed-off-by Linus Walleij <[email protected]>--- 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(+)[...]
drivers/power/regulator/ab8500.c new file +5
-0@@ -0,0 +1,111 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* ST-Ericsson AB8500/AB8505 LDO AUX3 regulator */ + +#include <dm.h> +#include <dm/device-internal.h>
drivers/power/regulator/ab8500.c line 15
Quoted 10 lines
drivers/power/regulator/ab8500.c new file +10
-0+#include <dm/lists.h> +#include <linux/errno.h> +#include <power/ab8500.h> +#include <power/pmic.h> +#include <power/regulator.h> + +#define AB8500_VAUX3_REGU AB8500_REGU_CTRL2(0x0a) +#define AB8500_VAUX3_SEL AB8500_REGU_CTRL2(0x21) +#define AB8500_VAUX3_EN_MASK GENMASK(1, 0) +#define AB8500_VAUX3_EN BIT(0)
Nitpick: Can you call this _REGU_EN maybe to make it clear that this belongs to the REGU register?
Quoted 70 lines
drivers/power/regulator/ab8500.c new file +70
-0+#define AB8500_VAUX3_SEL_MASK GENMASK(2, 0) + +static const int ab8500_vaux3_voltages[] = { +1200000 ,1500000 ,1800000 ,2100000 , +2500000 ,2750000 ,2790000 ,2910000 , +}; + +static struct udevice *ab8500_regulator_pmic (struct udevice *dev) +{ +return dev->parent->parent; +} + +static int ab8500_regulator_get_value (struct udevice *dev) +{ +int ret; + + ret =pmic_reg_read (ab8500_regulator_pmic (dev),AB8500_VAUX3_SEL ); +if (ret <0 ) +return ret; + ret &=AB8500_VAUX3_SEL_MASK ; + +return ab8500_vaux3_voltages[ret]; +} + +static int ab8500_regulator_set_value (struct udevice *dev,int uV) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (ab8500_vaux3_voltages); i++) { +if (ab8500_vaux3_voltages[i] == uV) +return pmic_clrsetbits (ab8500_regulator_pmic (dev), +AB8500_VAUX3_SEL , +AB8500_VAUX3_SEL_MASK , i); + } + +return -EINVAL ; +} + +static int ab8500_regulator_get_enable (struct udevice *dev) +{ +int ret; + + ret =pmic_reg_read (ab8500_regulator_pmic (dev),AB8500_VAUX3_REGU ); +if (ret <0 ) +return ret; + +return (ret &AB8500_VAUX3_EN_MASK ) ==AB8500_VAUX3_EN ; +} + +static int ab8500_regulator_set_enable (struct udevice *dev,bool enable) +{ +return pmic_clrsetbits (ab8500_regulator_pmic (dev),AB8500_VAUX3_REGU , +AB8500_VAUX3_EN_MASK , + enable ?AB8500_VAUX3_EN :0 ); +} + +static const struct dm_regulator_ops ab8500_regulator_ops = { + .get_value = ab8500_regulator_get_value, + .set_value = ab8500_regulator_set_value, + .get_enable = ab8500_regulator_get_enable, + .set_enable = ab8500_regulator_set_enable, +}; + +U_BOOT_DRIVER (ab8500_ldo_aux3) = { + .name ="ab8500_ldo_aux3" , + .id =UCLASS_REGULATOR , + .ops = &ab8500_regulator_ops, +}; + +static int ab8500_regulators_bind (struct udevice *dev)
drivers/power/regulator/ab8500.c line 95
Quoted 10 lines
drivers/power/regulator/ab8500.c new file +10
-0+{ +struct driver *drv =lists_driver_lookup_name ("ab8500_ldo_aux3" ); +ofnode node; + +dev_for_each_subnode (node, dev) { +if (!strcmp (ofnode_get_name (node),"ab8500_ldo_aux3" )) +return device_bind_with_driver_data (dev, drv, +ofnode_get_name (node),0 , + node,NULL ); + }
dev_read_subnode(node, "ab8500_ldo_aux3") and device_bind_driver_to_node() instead of lists_driver_lookup_name() + device_bind_with_driver_data() should be a bit simpler.
Thanks,
Stephan
Linus Walleij
maintainerPATCH v2 5/8 configs: stemmy: Enable SD card regulators
In reply to Linus WalleijHave 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
@@ -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
Re: [PATCH v2 5/8] configs: stemmy: Enable SD card regulators
Quoted 5 lines · Linus Walleij
Have
ARCH_U8500imply the fixed regulator driver needed by level shifters on the supported boards. The architecture already enables the regulator core and Nomadik GPIO driver.Signed-off-by Linus Walleij <[email protected]>
Nitpick: "arm: u8500: ..." or something like that might be a better $subject prefix for this.
Anyway:
Quoted 20 lines
--- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm/Kconfig +1
-0@@ -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_TIMERSignature · 2 lines
-- 2.55.0
Linus Walleij
maintainerPATCH v2 6/8 configs: stemmy: Boot EFI from external SD card
In reply to Linus WalleijReplace 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
@@ -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
Re: [PATCH v2 6/8] configs: stemmy: Boot EFI from external SD card
Quoted 9 lines · 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.
Signed-off-by Linus Walleij <[email protected]>
I think it would be nice to keep Fastboot as a fallback, e.g. when a button is pressed during boot. Some people may want that for updating U-Boot itself.
I had this mapped to the Volume Down button in my original change:
https://github.com/stericsson-mainline/u-boot/commit/3a499aabe598004da889c507095edf8d9b21244e
Nowdays it's a bit easier to do this without extra C code using button_cmd, see e.g.
https://git.u-boot-project.org/u-boot/u-boot/-/commit/359e1d4a57e06ab662ca7e008e881da27e9d3562
Thanks,
Stephan
Linus Walleij
maintainerPATCH v2 7/8 arm: u8500: Switch Stemmy to upstream Janice device tree
In reply to Linus WalleijUse 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
@@ -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
@@ -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
Re: [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree
Quoted 9 lines · 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.
Signed-off-by Linus Walleij <[email protected]>
Hm okay so you're basically dropping support for the internal eMMC in this patch? Can we support both? BOOTSTD should be able to scan multiple storages for boot targets.
I'm also not really sure about selecting Janice as "default" device tree here. Do you expect users to change this setting when they want to build stemmy for another board?
I wonder if we could continue using a single generic binary for all boards using CONFIG_MULTI_DTB_FIT. We should have "fw_mach" in board/ste/stemmy/stemmy.c that should tell us which device we are running on, which seems to be mostly(?) unique:
I'm not sure about codina-tmo, you would need to check which number the bootloader passes.
If these numbers are unique, it should be easy to implement board_fit_config_name_match().
Thanks,
Stephan
Linus Walleij
maintainerRe: [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree
Quoted 3 lines · Stephan Gerhold
Hm okay so you're basically dropping support for the internal eMMC in this patch? Can we support both? BOOTSTD should be able to scan multiple storages for boot targets.
Yeah just laziness on my part, I'll fix it up.
Quoted 3 lines
I'm also not really sure about selecting Janice as "default" device tree here. Do you expect users to change this setting when they want to build stemmy for another board?
I have a script that loops over the Samsung device trees, and recompiles U-Boot for each of them.
https://dflund.se/~triad/krad/makefiles/ux500-uboot.mak
Quoted 5 lines
I wonder if we could continue using a single generic binary for all boards using
CONFIG_MULTI_DTB_FIT. We should have "fw_mach" inboard/ste/stemmy/stemmy.cthat should tell us which device we are running on, which seems to be mostly(?) unique:
Quoted 7 lines
I'm not sure about codina-tmo, you would need to check which number the bootloader passes.
If these numbers are unique, it should be easy to implement
board_fit_config_name_match().
I see the appeal of the ambition to have a "one size fits (pun!) all" U-Boot.
But as it is, some of the DTS attributes on the external SD card are different between the platforms, so we would need to modify the U-Boot internal Stemmy device tree for those, copying over yet properties from the device trees and into the boardfile.
For example Janice and Codina uses a regulator for vqmmc-supply, and those using the "sd_level_translator" for vqmmc-supply actually use different GPIO pins on say Gavini compared to Codina or Golden.
The pin direction settings on the MMC host vary. (Some of these were really tricky to get right.)
So I think no, if we want external SD card boot we need per-device compiled U-Boot binaries with the unique device trees.
Yours,
Linus Walleij
Re: [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree
Quoted 43 lines · Linus Walleij
Quoted 3 lines · Stephan Gerhold
Hm okay so you're basically dropping support for the internal eMMC in this patch? Can we support both? BOOTSTD should be able to scan multiple storages for boot targets.
Yeah just laziness on my part, I'll fix it up.
Quoted 3 lines
I'm also not really sure about selecting Janice as "default" device tree here. Do you expect users to change this setting when they want to build stemmy for another board?
I have a script that loops over the Samsung device trees, and recompiles U-Boot for each of them.
https://dflund.se/~triad/krad/makefiles/ux500-uboot.makQuoted 5 lines
I wonder if we could continue using a single generic binary for all boards using
CONFIG_MULTI_DTB_FIT. We should have "fw_mach" inboard/ste/stemmy/stemmy.cthat should tell us which device we are running on, which seems to be mostly(?) unique:Quoted 7 lines
I'm not sure about codina-tmo, you would need to check which number the bootloader passes.
If these numbers are unique, it should be easy to implement
board_fit_config_name_match().I see the appeal of the ambition to have a "one size fits (pun!) all" U-Boot.
But as it is, some of the DTS attributes on the external SD card are different between the platforms, so we would need to modify the U-Boot internal Stemmy device tree for those, copying over yet properties from the device trees and into the boardfile.
For example Janice and Codina uses a regulator for vqmmc-supply, and those using the "
sd_level_translator" for vqmmc-supply actually use different GPIO pins on say Gavini compared to Codina or Golden.
Quoted 7 lines
The pin direction settings on the MMC host vary. (Some of these were really tricky to get right.)
So I think no, if we want external SD card boot we need per-device compiled U-Boot binaries with the unique device trees.
I wasn't suggesting to use the same DT for all devices. What I suggested is to bundle all the upstream DTBs for the individual devices into a single U-Boot binary (CONFIG_MULTI_DTB_FIT) and pick the correct one at runtime. :)
That should be equivalent to your setup, just more convenient for the user.
The only open question for me is if we can reliably detect codina-tmo based on the mach-type ID, I can't find that in the kernel sources I have.
Thanks,
Stephan
Linus Walleij
maintainerRe: [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree
Quoted 11 lines · Stephan Gerhold
I wasn't suggesting to use the same DT for all devices. What I suggested is to bundle all the upstream DTBs for the individual devices into a single U-Boot binary (
CONFIG_MULTI_DTB_FIT) and pick the correct one at runtime. :)That should be equivalent to your setup, just more convenient for the user.
The only open question for me is if we can reliably detect codina-tmo based on the mach-type ID, I can't find that in the kernel sources I have.
Aha I get it...
I can check the codina TMO, I think it could be an improvement on top of this series though, if I leave the stemmy device tree in place.
It all becomes a bit tautological and hence confusing, because yes we can perhaps embed all the device trees into an FIT and pick the right one depending on magic from the first stage (odin) boot loader, then we overlay that with the U-Boot restrictions, then we come to the EFI boot partition, where again we have all the device trees, again pick the right one, now for Linux, then augment it again, but only partly, without U-Boot overlays, then we boot the kernel with that second augmented device tree.
This is... the way it is I guess. I'll look into the stemmy-FIT-with-many device trees approach.
Yours,
Linus Walleij
Linus Walleij
maintainerRe: [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree
In reply to Stephan GerholdQuoted 7 lines · Stephan Gerhold
I wasn't suggesting to use the same DT for all devices. What I suggested is to bundle all the upstream DTBs for the individual devices into a single U-Boot binary (
CONFIG_MULTI_DTB_FIT) and pick the correct one at runtime. :)That should be equivalent to your setup, just more convenient for the user.
Hey it works!
The bootloader crosses over the 512KB limit but we have space enough for an entire kernel so it's no big deal.
Quoted 3 lines
The only open question for me is if we can reliably detect codina-tmo based on the mach-type ID, I can't find that in the kernel sources I have.
I brought out and booted the device. It is re-using the Codina machine ID.
However we have unique board IDs in another parameter which is enough to discern the Codina-TMOs from the Codinas.
Sending a v4 patch series which should contain all you asked for. It also works.
Yours,
Linus Walleij
Linus Walleij
maintainerPATCH v2 8/8 arm: u8500: Give Golden panel regulators unique names
In reply to Linus WalleijThe 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
@@ -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
Re: [PATCH v2 8/8] arm: u8500: Give Golden panel regulators unique names
Quoted 9 lines · 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.
Signed-off-by Linus Walleij <[email protected]>
I think it's a bit awkward to have multiple regulators with the same name, even on Linux when looking at debugfs for example.
Can you make this change on the Linux side and backport it here?
Or maybe we can use the regulator names from the schematics if we have that (I don't remember :') ).
Thanks,
Stephan
Linus Walleij
maintainerRe: [PATCH v2 8/8] arm: u8500: Give Golden panel regulators unique names
Quoted 4 lines · Stephan Gerhold
I think it's a bit awkward to have multiple regulators with the same name, even on Linux when looking at debugfs for example.
Can you make this change on the Linux side and backport it here?
You're right of course:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#u
I don't know if U-Boot backport device tree changes? Isn't it like a scripted upstream sync?
Quoted 2 lines
Or maybe we can use the regulator names from the schematics if we have that (I don't remember :') ).
No we don't have them...
Yours,
Linus Walleij
Re: [PATCH v2 8/8] arm: u8500: Give Golden panel regulators unique names
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Stephan Gerhold
I think it's a bit awkward to have multiple regulators with the same name, even on Linux when looking at debugfs for example.
Quoted 7 lines
Quoted 1 line
Can you make this change on the Linux side and backport it here?
You're right of course:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#uI don't know if U-Boot backport device tree changes? Isn't it like a scripted upstream sync?
Yes, we pull the vX.Y-dts tags to the main or next branch, depending on how those line up with our own needs, and then allow cherry-picks from the devicetree-rebasing tree as well in the interim to keep things unblocked.
Signature · 1 line
Tom