mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Cercueil <paul.cercueil@bootlin.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Petazzoni	 <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] mmc: sdhci-cadence: enable probing from ACPI
Date: Wed, 04 Nov 2026 15:38:32 +0100	[thread overview]
Message-ID: <21015d0ab9c99bbe8b187792836ecd267e02d4dd.camel@bootlin.com> (raw)
In-Reply-To: <c8dc0612-7ba2-45f0-9aa9-5e312fc8aab4@intel.com>

Hi Adrian,

Le mercredi 04 novembre 2026 à 16:30 +0200, Adrian Hunter a écrit :
> On 03/11/2026 11:35, Paul Cercueil wrote:
> > 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/20261103084718.8222-1-paul.cercueil@bootlin.com/T/#u

> > 
> > Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
> 
> Nevertheless:
> 
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Thank you!

Cheers,
-Paul

> > ---
> >  drivers/mmc/host/sdhci-cadence-core.c   | 22 ++++++++++++----------
> >  drivers/mmc/host/sdhci-cadence-phy-v6.c | 10 +++++-----
> >  2 files changed, 17 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-cadence-core.c b/drivers/mmc/host/sdhci-
> > cadence-core.c
> > index 745455743b01..c5a4fa8e2fc6 100644
> > --- a/drivers/mmc/host/sdhci-cadence-core.c
> > +++ b/drivers/mmc/host/sdhci-cadence-core.c
> > @@ -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 d
> >  	return 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_cdns
> >  	struct 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)
> > diff --git a/drivers/mmc/host/sdhci-cadence-phy-v6.c
> > b/drivers/mmc/host/sdhci-cadence-phy-v6.c
> > index 22d56bb46d75..551a0e3b58ad 100644
> > --- a/drivers/mmc/host/sdhci-cadence-phy-v6.c
> > +++ b/drivers/mmc/host/sdhci-cadence-phy-v6.c
> > @@ -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) {

  reply	other threads:[~2026-11-04 14:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  9:35 Paul Cercueil
2026-11-04 14:30 ` Adrian Hunter
2026-11-04 14:38   ` Paul Cercueil [this message]
2026-11-04 16:05     ` Adrian Hunter
2026-11-04 16:18       ` Paul Cercueil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21015d0ab9c99bbe8b187792836ecd267e02d4dd.camel@bootlin.com \
    --to=paul.cercueil@bootlin.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tanmay.kathpalia@altera.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®