mmc: renesas_sdhi: add regulator dependency
PATCH 1/1 mmc: renesas_sdhi: add regulator dependency
From: Arnd Bergmann <[email protected]>
The driver started using the regulator subsystem and fails to build without that now:
ERROR: modpost: "rdev_get_drvdata" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
ERROR: modpost: "devm_regulator_register" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
Add a Kconfig dependency for this.
The 'select RESET_CONTROLLER' needs to either go away or get changed to a dependency in order to avoid Kconfig dependency loops here. The 'select' is otherwise used by drivers that register a reset controller, but normally not by those that just use one.
--- drivers/mmc/host/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/Kconfig +2 -2
@@ -692,9 +692,9 @@ config MMC_TMIO_CORE config MMC_SDHI tristate "Renesas SDHI SD/SDIO controller support" - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on SUPERH || (ARCH_RENESAS && RESET_CONTROLLER) || COMPILE_TEST + depends on REGULATOR select MMC_TMIO_CORE - select RESET_CONTROLLER if ARCH_RENESAS help This provides support for the SDHI SD/SDIO controller found in Renesas SuperH, ARM and ARM64 based SoCs
Signature · 1 line
2.39.5
drivers/mmc/host/Kconfig config MMC_TMIO_CORE · line 696
Quoted 5 lines · Arnd Bergmann
config
MMC_SDHIdrivers/mmc/host/Kconfig +2
-1tristate "Renesas SDHI SD/SDIO controller support" - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on SUPERH || (ARCH_RENESAS && RESET_CONTROLLER) || COMPILE_TEST + depends on REGULATOR
Hmm, this is too strict IMO. SuperH does not need REGULATOR. But adding REGULATOR to ARCH_RENESAS like RESET_CONTROLLER will still fail for COMPILE_TEST, right?
Maybe we need to maintain the dependency in Kconfig after all:
depends on REGULATOR if ARCH_R8A<whichever needs it>
?
Quoted 9 lines · Wolfram Sang
drivers/mmc/host/Kconfig config MMC_TMIO_CORE · line 696
Quoted 5 lines · Arnd Bergmann
config
MMC_SDHIdrivers/mmc/host/Kconfig +2
-1tristate "Renesas SDHI SD/SDIO controller support" - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on SUPERH || (ARCH_RENESAS && RESET_CONTROLLER) || COMPILE_TEST + depends on REGULATORHmm, this is too strict IMO. SuperH does not need REGULATOR.
I haven't tried building on sh, but I don't see why it wouldn't need the regulator dependency. The code that calls it is
rcfg.of_node = of_get_child_by_name(dev->of_node, "vqmmc-regulator");
if (!of_device_is_available(rcfg.of_node)) {
of_node_put(rcfg.of_node);
rcfg.of_node = NULL;
}
if (rcfg.of_node) {
rcfg.driver_data = priv->host;
rdev = devm_regulator_register(dev, &renesas_sdhi_vqmmc_regulator, &rcfg);
...which sounds like regulators are always needed when of_get_child_by_name() may return a non-NULL pointer, i.e. when CONFIG_OF is enabled.
If this is correct, maybe this is the best variant:
config MMC_SDHI
tristate "Renesas SDHI SD/SDIO controller support"
depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
depends on (REGULATOR && RESET_CONTROLLER) || !OFCONFIG_ARCH_RENESAS is only set when CONFIG_OF is also set, so both subsystem dependencies are covered by that, while SUPERH doesn't currently enable OF, but will need the regulator and reset controller if that patch is ever merged.
Arnd
Quoted 25 lines · Arnd Bergmann
Quoted 9 lines · Wolfram Sang
drivers/mmc/host/Kconfig config MMC_TMIO_CORE · line 696
Quoted 5 lines · Arnd Bergmann
config
MMC_SDHIdrivers/mmc/host/Kconfig +2
-1tristate "Renesas SDHI SD/SDIO controller support" - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on SUPERH || (ARCH_RENESAS && RESET_CONTROLLER) || COMPILE_TEST + depends on REGULATORHmm, this is too strict IMO. SuperH does not need REGULATOR.
I haven't tried building on sh, but I don't see why it wouldn't need the regulator dependency. The code that calls it is
rcfg.of_node = of_get_child_by_name(dev->of_node, "vqmmc-regulator"); if (!of_device_is_available(rcfg.of_node)) { of_node_put(rcfg.of_node); rcfg.of_node = NULL; } if (rcfg.of_node) { rcfg.driver_data = priv->host; rdev = devm_regulator_register(dev, &renesas_sdhi_vqmmc_regulator, &rcfg); ...
Quoted 3 lines
which sounds like regulators are always needed when
of_get_child_by_name()may return a non-NULL pointer, i.e. whenCONFIG_OFis enabled.
rcfg.of_node will be NULLed when the regulator device is not available. Which is only true for a few SoC variants. Most other SoCs use 'vmmc-supply' insteand of 'vqmmc-regulator'.
Quoted 11 lines
If this is correct, maybe this is the best variant:
config
MMC_SDHI
tristate "Renesas SDHI SD/SDIO controller support"depends on SUPERH || ARCH_RENESAS || COMPILE_TEST depends on (REGULATOR && RESET_CONTROLLER) || !OF
CONFIG_ARCH_RENESASis only set whenCONFIG_OFis also set, so both subsystem dependencies are covered by that, while SUPERH doesn't currently enable OF, but will need the regulator and reset controller if that patch is ever merged.
Even given the above, I like this approach and think it still works. But Biju is the SDHI regulator expert here.
Biju Das
Tested-byHi All,
Quoted 31 lines
-----Original Message-----
From: Wolfram Sang <[email protected]>
Sent: 29 March 2025 11:47
Subject: Re: [PATCH] mmc:renesas_sdhi: add regulator dependencyQuoted 25 lines · Arnd Bergmann
Quoted 9 lines · Wolfram Sang
drivers/mmc/host/Kconfig config MMC_TMIO_CORE · line 696
Quoted 5 lines · Arnd Bergmann
config
MMC_SDHIdrivers/mmc/host/Kconfig +2
-1tristate "Renesas SDHI SD/SDIO controller support" - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST + depends on SUPERH || (ARCH_RENESAS && RESET_CONTROLLER) || COMPILE_TEST + depends on REGULATORHmm, this is too strict IMO. SuperH does not need REGULATOR.
I haven't tried building on sh, but I don't see why it wouldn't need the regulator dependency. The code that calls it is
rcfg.of_node = of_get_child_by_name(dev->of_node, "vqmmc-regulator"); if (!of_device_is_available(rcfg.of_node)) { of_node_put(rcfg.of_node); rcfg.of_node = NULL; } if (rcfg.of_node) { rcfg.driver_data = priv->host; rdev = devm_regulator_register(dev, &renesas_sdhi_vqmmc_regulator, &rcfg); ...
Quoted 6 lines
Quoted 3 lines
which sounds like regulators are always needed when
of_get_child_by_name()may return a non-NULL pointer, i.e. whenCONFIG_OFis enabled.rcfg.of_node will be NULLed when the regulator device is not available. Which is only true for a few SoC variants. Most other SoCs use 'vmmc-supply' instean
d of 'vqmmc-
Quoted 1 line
regulator'.
Yes, Only few SoCs has internal regulator support and is based on of_device_is_available().
Quoted 8 lines
Quoted 8 lines
If this is correct, maybe this is the best variant:
config
MMC_SDHI
tristate "Renesas SDHI SD/SDIO controller support"depends on SUPERH || ARCH_RENESAS || COMPILE_TEST depends on (REGULATOR && RESET_CONTROLLER) || !OF
Quoted 7 lines
Quoted 4 lines
CONFIG_ARCH_RENESASis only set whenCONFIG_OFis also set, so both subsystem dependencies are covered by that, while SUPERH doesn't currently enable OF, but will need the regulator and reset controller if that patch is ever merged.Even given the above, I like this approach and think it still works. But Biju is the SDHI regulator expert here.
Cheers,
Biju