mmc: sdhci-cadence: enable probing from ACPI
Subsystems (3)
PATCH 1/1 mmc: sdhci-cadence: enable probing from ACPI
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
--- drivers/mmc/host/sdhci-cadence-core.c | 22 ++++++++++++---------- drivers/mmc/host/sdhci-cadence-phy-v6.c | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-)
drivers/mmc/host/sdhci-cadence-core.c +12 -10
@@ -5,6 +5,7 @@* Copyright (C) 2026 Altera Corporation */ +#include <linux/acpi.h> #include <linux/bitfield.h> #include <linux/bits.h> #include <linux/dma-mapping.h>
@@ -145,26 +146,26 @@ static int sdhci_cdns4_write_phy_reg(struct sdhci_cdns_priv *priv, u8 addr, u8 dreturn ret; } -static unsigned int sdhci_cdns4_phy_param_count (struct device_node *np) +static unsigned int sdhci_cdns4_phy_param_count (struct device *dev) {unsigned int count =0 ;int i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) -if (of_property_present (np, sdhci_cdns4_phy_cfgs[i].property)) +if (device_property_present (dev, sdhci_cdns4_phy_cfgs[i].property)) count++;return count; } -static void sdhci_cdns4_phy_param_parse (struct device_node *np,struct sdhci_cdns4_phy *phy) +static void sdhci_cdns4_phy_param_parse (struct device *dev,struct sdhci_cdns4_phy *phy) {struct sdhci_cdns4_phy_param *p = phy->phy_params;u32 val;int ret, i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) { - ret =of_property_read_u32 (np, sdhci_cdns4_phy_cfgs[i].property, &val); + ret =device_property_read_u32 (dev, sdhci_cdns4_phy_cfgs[i].property, &val);if (ret)continue ;
@@ -204,7 +205,7 @@ static int sdhci_cdns_set_dma_mask(struct sdhci_host *host)struct device *dev =mmc_dev (host->mmc);int ret; - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data || !data->dma_mask)return 0 ;
@@ -649,13 +650,13 @@ static int sdhci_cdns4_phy_probe(struct platform_device *pdev, struct sdhci_cdnsstruct sdhci_cdns4_phy *phy;unsigned int nr_phy_params; - nr_phy_params =sdhci_cdns4_phy_param_count (dev->of_node); + nr_phy_params =sdhci_cdns4_phy_param_count (dev); phy =devm_kzalloc (dev,struct_size (phy, phy_params, nr_phy_params),GFP_KERNEL );if (!phy)return -ENOMEM ; phy->nr_phy_params = nr_phy_params; -sdhci_cdns4_phy_param_parse (dev->of_node, phy); +sdhci_cdns4_phy_param_parse (dev, phy); priv->phy = phy;return sdhci_cdns4_phy_init (priv);
@@ -673,7 +674,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;static const u16 version =SDHCI_SPEC_400 <<SDHCI_SPEC_VER_SHIFT ; -if (of_device_is_compatible (dev->of_node,"cdns,sd6hc" )) { +/* Note: ACPI only provides one unnamed clock */ +if (!has_acpi_companion (dev) &&device_is_compatible (dev,"cdns,sd6hc" )) { clk =devm_clk_get_enabled (dev,"ciu" );if (IS_ERR (clk))return dev_err_probe (dev,PTR_ERR (clk),"failed to enable ciu clock\n" );
@@ -687,7 +689,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)return PTR_ERR (clk); } - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data)return dev_err_probe (dev, -EINVAL ,"missing platform driver data\n" );
@@ -723,7 +725,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)* For SD6HC, sdhci_add_host() will automatically read capabilities * and version from the host controller registers. */ -if (of_device_is_compatible (dev->of_node,"cdns,sd4hc" )) { +if (device_is_compatible (dev,"cdns,sd4hc" )) {__sdhci_read_caps (host, &version,NULL ,NULL ); ret =sdhci_cdns4_phy_probe (pdev, priv);if (ret)
drivers/mmc/host/sdhci-cadence-phy-v6.c +5 -5
@@ -880,17 +880,17 @@ int sdhci_cdns6_phy_probe(struct platform_device *pdev, struct sdhci_cdns_priv ** Cadence-recommended defaults (2500 ps IO-cell delays, 24 ps DLL * delay element) that are valid for typical SoC packaging. */ - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-input-delay-ps" , - &phy->iocell_input_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-input-delay-ps" , + &phy->iocell_input_delay);if (ret) phy->iocell_input_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-output-delay-ps" , - &phy->iocell_output_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-output-delay-ps" , + &phy->iocell_output_delay);if (ret) phy->iocell_output_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,delay-element-ps" , &phy->delay_element); + ret =device_property_read_u32 (dev,"cdns,delay-element-ps" , &phy->delay_element);if (ret) { phy->delay_element =SDHCI_CDNS6_PHY_DEFAULT_DELAY_ELEMENT ; }else if (!phy->delay_element) {
Signature · 1 line
2.47.3
Quoted 5 lines · Paul Cercueil
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Do you mean in the future? ACPI does not provide clocks at all at the moment does it? Otherwise, clocks registered directly by clk_register_clkdev() can have names. Maybe I misunderstand, but perhaps clarify the commit message.
Quoted 2 lines
Signed-off-by Paul Cercueil <[email protected]>
Nevertheless:
Quoted 128 lines
--- drivers/mmc/host/sdhci-cadence-core.c | 22 ++++++++++++---------- drivers/mmc/host/sdhci-cadence-phy-v6.c | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-)drivers/mmc/host/sdhci-cadence-core.c +12
-10@@ -5,6 +5,7 @@* Copyright (C) 2026 Altera Corporation */ +#include <linux/acpi.h> #include <linux/bitfield.h> #include <linux/bits.h> #include <linux/dma-mapping.h> @@ -145,26 +146,26 @@ static int sdhci_cdns4_write_phy_reg(struct sdhci_cdns_priv *priv, u8 addr, u8 dreturn ret; } -static unsigned int sdhci_cdns4_phy_param_count (struct device_node *np) +static unsigned int sdhci_cdns4_phy_param_count (struct device *dev) {unsigned int count =0 ;int i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) -if (of_property_present (np, sdhci_cdns4_phy_cfgs[i].property)) +if (device_property_present (dev, sdhci_cdns4_phy_cfgs[i].property)) count++;return count; } -static void sdhci_cdns4_phy_param_parse (struct device_node *np,struct sdhci_cdns4_phy *phy) +static void sdhci_cdns4_phy_param_parse (struct device *dev,struct sdhci_cdns4_phy *phy) {struct sdhci_cdns4_phy_param *p = phy->phy_params;u32 val;int ret, i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) { - ret =of_property_read_u32 (np, sdhci_cdns4_phy_cfgs[i].property, &val); + ret =device_property_read_u32 (dev, sdhci_cdns4_phy_cfgs[i].property, &val);if (ret)continue ;@@ -204,7 +205,7 @@ static int sdhci_cdns_set_dma_mask(struct sdhci_host *host)struct device *dev =mmc_dev (host->mmc);int ret; - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data || !data->dma_mask)return 0 ;@@ -649,13 +650,13 @@ static int sdhci_cdns4_phy_probe(struct platform_device *pdev, struct sdhci_cdnsstruct sdhci_cdns4_phy *phy;unsigned int nr_phy_params; - nr_phy_params =sdhci_cdns4_phy_param_count (dev->of_node); + nr_phy_params =sdhci_cdns4_phy_param_count (dev); phy =devm_kzalloc (dev,struct_size (phy, phy_params, nr_phy_params),GFP_KERNEL );if (!phy)return -ENOMEM ; phy->nr_phy_params = nr_phy_params; -sdhci_cdns4_phy_param_parse (dev->of_node, phy); +sdhci_cdns4_phy_param_parse (dev, phy); priv->phy = phy;return sdhci_cdns4_phy_init (priv);@@ -673,7 +674,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;static const u16 version =SDHCI_SPEC_400 <<SDHCI_SPEC_VER_SHIFT ; -if (of_device_is_compatible (dev->of_node,"cdns,sd6hc" )) { +/* Note: ACPI only provides one unnamed clock */ +if (!has_acpi_companion (dev) &&device_is_compatible (dev,"cdns,sd6hc" )) { clk =devm_clk_get_enabled (dev,"ciu" );if (IS_ERR (clk))return dev_err_probe (dev,PTR_ERR (clk),"failed to enable ciu clock\n" );@@ -687,7 +689,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)return PTR_ERR (clk); } - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data)return dev_err_probe (dev, -EINVAL ,"missing platform driver data\n" );@@ -723,7 +725,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)* For SD6HC, sdhci_add_host() will automatically read capabilities * and version from the host controller registers. */ -if (of_device_is_compatible (dev->of_node,"cdns,sd4hc" )) { +if (device_is_compatible (dev,"cdns,sd4hc" )) {__sdhci_read_caps (host, &version,NULL ,NULL ); ret =sdhci_cdns4_phy_probe (pdev, priv);if (ret)drivers/mmc/host/sdhci-cadence-phy-v6.c +5
-5@@ -880,17 +880,17 @@ int sdhci_cdns6_phy_probe(struct platform_device *pdev, struct sdhci_cdns_priv ** Cadence-recommended defaults (2500 ps IO-cell delays, 24 ps DLL * delay element) that are valid for typical SoC packaging. */ - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-input-delay-ps" , - &phy->iocell_input_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-input-delay-ps" , + &phy->iocell_input_delay);if (ret) phy->iocell_input_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-output-delay-ps" , - &phy->iocell_output_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-output-delay-ps" , + &phy->iocell_output_delay);if (ret) phy->iocell_output_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,delay-element-ps" , &phy->delay_element); + ret =device_property_read_u32 (dev,"cdns,delay-element-ps" , &phy->delay_element);if (ret) { phy->delay_element =SDHCI_CDNS6_PHY_DEFAULT_DELAY_ELEMENT ; }else if (!phy->delay_element) {
Hi Adrian,
Le mercredi 04 novembre 2026 à 16:30 +0200, Adrian Hunter a écrit :
Quoted 11 lines · Paul Cercueil
Quoted 5 lines
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Do you mean in the future? ACPI does not provide clocks at all at the moment does it? Otherwise, clocks registered directly by
clk_register_clkdev()can have names. Maybe I misunderstand, but perhaps clarify the commit message.
I sent another patch in parallel of this one, that adds basic support for clock resources introduced in ACPI 6.5:
https://lore.kernel.org/linux-acpi/[email protected]/T/#u
Quoted 6 lines
Quoted 2 lines
Signed-off-by Paul Cercueil <[email protected]>Nevertheless:
Acked-by Adrian Hunter <[email protected]>
Thank you!
Cheers,
-Paul
Quoted 153 lines
Quoted 153 lines
---
drivers/mmc/host/sdhci-cadence-core.c | 22 ++++++++++++----------drivers/mmc/host/sdhci-cadence-phy-v6.c| 10 +++++-----2 files changed, 17 insertions(+), 15 deletions(-)drivers/mmc/host/sdhci- renamed from drivers/mmc/host/sdhci-cadence-core.c +0
-0
cadence-core.c
index745455743b01..c5a4fa8e2fc6100644drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -5,6 +5,7 @@* Copyright (C) 2026 Altera Corporation */
+#include <linux/acpi.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/dma-mapping.h>drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -145,26 +146,26 @@ static int sdhci_cdns4_write_phy_reg(struct
sdhci_cdns_priv*priv, u8 addr, u8 d
return ret;
}drivers/mmc/host/sdhci-cadence-core.c +1
-1-static unsigned int sdhci_cdns4_phy_param_count (struct device_node *np) +static unsigned int sdhci_cdns4_phy_param_count (struct device *dev){
unsigned int count = 0;
int i;
for (i = 0; i <ARRAY_SIZE(sdhci_cdns4_phy_cfgs); i++)drivers/mmc/host/sdhci-cadence-core.c +0
-1- if (of_property_present(np,sdhci_cdns4_phy_cfgs[i].property))
drivers/mmc/host/sdhci-cadence-core.c +1
-0+ if (device_property_present(dev,sdhci_cdns4_phy_cfgs[i].property))
count++;
return count;
}
-static voidsdhci_cdns4_phy_param_parse(struct device_node *np, struct sdhci_cdns4_phy *phy)
+static voidsdhci_cdns4_phy_param_parse(struct device *dev, struct sdhci_cdns4_phy *phy)
{
structsdhci_cdns4_phy_param*p =phy->phy_params; u32 val;
int ret, i;
for (i = 0; i <ARRAY_SIZE(sdhci_cdns4_phy_cfgs); i++) {drivers/mmc/host/sdhci-cadence-core.c +0
-1- ret = of_property_read_u32(np,sdhci_cdns4_phy_cfgs[i].property, &val);
drivers/mmc/host/sdhci-cadence-core.c +1
-0+ ret = device_property_read_u32(dev,sdhci_cdns4_phy_cfgs[i].property, &val);
if (ret)
continue;drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -204,7 +205,7 @@ static int sdhci_cdns_set_dma_mask(struct sdhci_host *host) struct device *dev = mmc_dev(host->mmc); int ret;drivers/mmc/host/sdhci-cadence-core.c +1
-1- data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data || !data->dma_mask)
return 0;drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -649,13 +650,13 @@ static int sdhci_cdns4_phy_probe(struct
platform_device*pdev, structsdhci_cdns
structsdhci_cdns4_phy*phy;
unsigned intnr_phy_params;drivers/mmc/host/sdhci-cadence-core.c +1
-1- nr_phy_params =sdhci_cdns4_phy_param_count (dev->of_node); + nr_phy_params =sdhci_cdns4_phy_param_count (dev);phy =
devm_kzalloc(dev, struct_size(phy, phy_params, nr_phy_params), GFP_KERNEL);
if (!phy)
return-ENOMEM;
phy->nr_phy_params=nr_phy_params;drivers/mmc/host/sdhci-cadence-core.c +1
-1-sdhci_cdns4_phy_param_parse (dev->of_node, phy); +sdhci_cdns4_phy_param_parse (dev, phy);
priv->phy= phy;
returnsdhci_cdns4_phy_init(priv);drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -673,7 +674,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; static const u16 version = SDHCI_SPEC_400 << SDHCI_SPEC_VER_SHIFT;drivers/mmc/host/sdhci-cadence-core.c +2
-1-if (of_device_is_compatible (dev->of_node,"cdns,sd6hc" )) { +/* Note: ACPI only provides one unnamed clock */ + if (!has_acpi_companion(dev) && device_is_compatible(dev,"cdns,sd6hc")) {
clk =devm_clk_get_enabled(dev, "ciu");
if (IS_ERR(clk))
returndev_err_probe(dev, PTR_ERR(clk), "failed to enable ciu clock\n");drivers/mmc/host/sdhci-cadence-core.c +0
-0@@ -687,7 +689,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev) return PTR_ERR(clk); }drivers/mmc/host/sdhci-cadence-core.c +1
-1- data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data)
returndev_err_probe(dev, -EINVAL, "missing platform driver data\n");drivers/mmc/host/sdhci-cadence-core.c +1
-1@@ -723,7 +725,7 @@ static int sdhci_cdns_probe(struct platform_device*pdev) * For SD6HC, sdhci_add_host() will automatically read capabilities * and version from the host controller registers. */ -if (of_device_is_compatible (dev->of_node,"cdns,sd4hc" )) { +if (device_is_compatible (dev,"cdns,sd4hc" )) { __sdhci_read_caps(host, &version, NULL, NULL); ret = sdhci_cdns4_phy_probe(pdev, priv);if (ret)
drivers/mmc/host/sdhci-cadence-phy-v6.c +2
-2@@ -880,17 +880,17 @@ int sdhci_cdns6_phy_probe(struct platform_device*pdev, struct sdhci_cdns_priv * * Cadence-recommended defaults (2500 ps IO-cell delays, 24 ps DLL * delay element) that are valid for typical SoC packaging. */ - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-input-delay- ps", - &phy->iocell_input_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-input-delay-ps" , + &phy->iocell_input_delay); if (ret)
phy->iocell_input_delay=SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY;drivers/mmc/host/sdhci-cadence-phy-v6.c +0
-1- ret = of_property_read_u32(dev->of_node, "cdns,iocell-output-delay-ps",
drivers/mmc/host/sdhci-cadence-phy-v6.c +2
-1- &phy->iocell_output_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-output-delay-ps" , + &phy->iocell_output_delay);if (ret)
phy->iocell_output_delay=SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY;drivers/mmc/host/sdhci-cadence-phy-v6.c +0
-1- ret = of_property_read_u32(dev->of_node, "cdns,delay-element-ps",
&phy->delay_element);drivers/mmc/host/sdhci-cadence-phy-v6.c +1
-0+ ret = device_property_read_u32(dev, "cdns,delay-element-ps", &phy-Quoted 1 line
delay_element);if (ret) {
phy->delay_element=SDHCI_CDNS6_PHY_DEFAULT_DELAY_ELEMENT; } else if (!phy->delay_element) {
Adrian Hunter
maintainerQuoted 15 lines · Paul Cercueil
Hi Adrian,
Le mercredi 04 novembre 2026 à 16:30 +0200, Adrian Hunter a écrit :
Quoted 11 lines · Paul Cercueil
Quoted 5 lines
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Do you mean in the future? ACPI does not provide clocks at all at the moment does it? Otherwise, clocks registered directly by
clk_register_clkdev()can have names. Maybe I misunderstand, but perhaps clarify the commit message.
Quoted 5 lines
I sent another patch in parallel of this one, that adds basic support for clock resources introduced in ACPI 6.5:
Would have been worth mentioning that in a cover letter.
Seems like it gives the clock a name
+ snprintf(name, sizeof(name), "%s-clk%u", dev_name(dev), data->idx++);
+
+ err = devm_clk_hw_register_clkdev(dev, clk, name, dev_name(dev));
but clk_find() doesn't look like it would match then - the comment says:
* An entry with a NULL ID is assumed to be a wildcard. * If an entry has a device ID, it must match * If an entry has a connection ID, it must match <------
Le mercredi 04 novembre 2026 à 18:05 +0200, Adrian Hunter a écrit :
Quoted 32 lines · Paul Cercueil
Quoted 15 lines
Hi Adrian,
Le mercredi 04 novembre 2026 à 16:30 +0200, Adrian Hunter a écrit :
Quoted 11 lines · Paul Cercueil
Quoted 5 lines
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Do you mean in the future? ACPI does not provide clocks at all at the moment does it? Otherwise, clocks registered directly by
clk_register_clkdev()can have names. Maybe I misunderstand, but perhaps clarify the commit message.Quoted 6 lines
I sent another patch in parallel of this one, that adds basic support for clock
resources introduced in ACPI 6.5:Would have been worth mentioning that in a cover letter.
Seems like it gives the clock a name
(quoted diff) +1
-0+ snprintf(name, sizeof(name), "%s-clk%u", dev_name(dev), data-Quoted 1 line
idx++);
(quoted diff) +2
-0+ + err = devm_clk_hw_register_clkdev(dev, clk, name,
dev_name(dev));
Quoted 4 lines
but
clk_find()doesn't look like it would match then - the comment says:
* An entry with a NULL ID is assumed to be a wildcard.
* If an entry has a device ID, it must match
* If an entry has a connection ID, it must match <------
You're missing part 3 ;)
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#u
I also considered not giving them a name (which wouldn't require the clkdev patch), but thought that there's probably some ACPI tables out there that provide more than one fixed clock for the same device, so it felt like the safest option.
Cheers,
-Paul
Quoted 37 lines · Paul Cercueil
Le mercredi 04 novembre 2026 à 18:05 +0200, Adrian Hunter a écrit :
Quoted 30 lines · Paul Cercueil
Quoted 13 lines
Hi Adrian,
Le mercredi 04 novembre 2026 à 16:30 +0200, Adrian Hunter a écrit :
Quoted 10 lines · Paul Cercueil
Quoted 5 lines
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Do you mean in the future? ACPI does not provide clocks at all at the moment does it? Otherwise, clocks registered directly by
clk_register_clkdev()can have names. Maybe I misunderstand, but perhaps clarify the commit message.Quoted 6 lines
I sent another patch in parallel of this one, that adds basic support for clock
resources introduced in ACPI 6.5:Would have been worth mentioning that in a cover letter.
Seems like it gives the clock a name
(quoted diff) +1
-0+ snprintf(name, sizeof(name), "%s-clk%u", dev_name(dev), data-Quoted 1 line
idx++);
(quoted diff) +2
-0+ + err = devm_clk_hw_register_clkdev(dev, clk, name,
dev_name(dev));Quoted 4 lines
but
clk_find()doesn't look like it would match then - the comment says:
* An entry with a NULL ID is assumed to be a wildcard.
* If an entry has a device ID, it must match
* If an entry has a connection ID, it must match <------You're missing part 3 ;)
Quoted 6 lines
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#u
I also considered not giving them a name (which wouldn't require the clkdev patch), but thought that there's probably some ACPI tables out there that provide more than one fixed clock for the same device, so it felt like the safest option.
Note that on ACPI the driver requests a single unnamed clock and uses it as "ciu"; with the proposed clkdev change this resolves to the first clock registered for the device. The "biu" bus clock is not requested and is expected to be kept enabled by firmware.
Quoted 8 lines · Paul Cercueil
Use the device property API instead of the OF-specific property API. This way, the driver will also probe from ACPI.
Note the change in the core's probe function for SD6HC. We can't have named clocks in ACPI.
Signed-off-by Paul Cercueil <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 131 lines
--- drivers/mmc/host/sdhci-cadence-core.c | 22 ++++++++++++---------- drivers/mmc/host/sdhci-cadence-phy-v6.c | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-)drivers/mmc/host/sdhci-cadence-core.c +12
-10@@ -5,6 +5,7 @@* Copyright (C) 2026 Altera Corporation */ +#include <linux/acpi.h> #include <linux/bitfield.h> #include <linux/bits.h> #include <linux/dma-mapping.h> @@ -145,26 +146,26 @@ static int sdhci_cdns4_write_phy_reg(struct sdhci_cdns_priv *priv, u8 addr, u8 dreturn ret; } -static unsigned int sdhci_cdns4_phy_param_count (struct device_node *np) +static unsigned int sdhci_cdns4_phy_param_count (struct device *dev) {unsigned int count =0 ;int i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) -if (of_property_present (np, sdhci_cdns4_phy_cfgs[i].property)) +if (device_property_present (dev, sdhci_cdns4_phy_cfgs[i].property)) count++;return count; } -static void sdhci_cdns4_phy_param_parse (struct device_node *np,struct sdhci_cdns4_phy *phy) +static void sdhci_cdns4_phy_param_parse (struct device *dev,struct sdhci_cdns4_phy *phy) {struct sdhci_cdns4_phy_param *p = phy->phy_params;u32 val;int ret, i;for (i =0 ; i <ARRAY_SIZE (sdhci_cdns4_phy_cfgs); i++) { - ret =of_property_read_u32 (np, sdhci_cdns4_phy_cfgs[i].property, &val); + ret =device_property_read_u32 (dev, sdhci_cdns4_phy_cfgs[i].property, &val);if (ret)continue ;@@ -204,7 +205,7 @@ static int sdhci_cdns_set_dma_mask(struct sdhci_host *host)struct device *dev =mmc_dev (host->mmc);int ret; - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data || !data->dma_mask)return 0 ;@@ -649,13 +650,13 @@ static int sdhci_cdns4_phy_probe(struct platform_device *pdev, struct sdhci_cdnsstruct sdhci_cdns4_phy *phy;unsigned int nr_phy_params; - nr_phy_params =sdhci_cdns4_phy_param_count (dev->of_node); + nr_phy_params =sdhci_cdns4_phy_param_count (dev); phy =devm_kzalloc (dev,struct_size (phy, phy_params, nr_phy_params),GFP_KERNEL );if (!phy)return -ENOMEM ; phy->nr_phy_params = nr_phy_params; -sdhci_cdns4_phy_param_parse (dev->of_node, phy); +sdhci_cdns4_phy_param_parse (dev, phy); priv->phy = phy;return sdhci_cdns4_phy_init (priv);@@ -673,7 +674,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;static const u16 version =SDHCI_SPEC_400 <<SDHCI_SPEC_VER_SHIFT ; -if (of_device_is_compatible (dev->of_node,"cdns,sd6hc" )) { +/* Note: ACPI only provides one unnamed clock */ +if (!has_acpi_companion (dev) &&device_is_compatible (dev,"cdns,sd6hc" )) { clk =devm_clk_get_enabled (dev,"ciu" );if (IS_ERR (clk))return dev_err_probe (dev,PTR_ERR (clk),"failed to enable ciu clock\n" );@@ -687,7 +689,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)return PTR_ERR (clk); } - data =of_device_get_match_data (dev); + data =device_get_match_data (dev);if (!data)return dev_err_probe (dev, -EINVAL ,"missing platform driver data\n" );@@ -723,7 +725,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)* For SD6HC, sdhci_add_host() will automatically read capabilities * and version from the host controller registers. */ -if (of_device_is_compatible (dev->of_node,"cdns,sd4hc" )) { +if (device_is_compatible (dev,"cdns,sd4hc" )) {__sdhci_read_caps (host, &version,NULL ,NULL ); ret =sdhci_cdns4_phy_probe (pdev, priv);if (ret)drivers/mmc/host/sdhci-cadence-phy-v6.c +5
-6@@ -880,17 +880,17 @@ int sdhci_cdns6_phy_probe(struct platform_device *pdev, struct sdhci_cdns_priv ** Cadence-recommended defaults (2500 ps IO-cell delays, 24 ps DLL * delay element) that are valid for typical SoC packaging. */ - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-input-delay-ps" , - &phy->iocell_input_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-input-delay-ps" , + &phy->iocell_input_delay);if (ret) phy->iocell_input_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,iocell-output-delay-ps" , - &phy->iocell_output_delay); + ret =device_property_read_u32 (dev,"cdns,iocell-output-delay-ps" , + &phy->iocell_output_delay);if (ret) phy->iocell_output_delay =SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY ; - ret =of_property_read_u32 (dev->of_node,"cdns,delay-element-ps" , &phy->delay_element); + ret =device_property_read_u32 (dev,"cdns,delay-element-ps" , &phy->delay_element);if (ret) { phy->delay_element =SDHCI_CDNS6_PHY_DEFAULT_DELAY_ELEMENT ; }else if (!phy->delay_element) { --2.47.3