devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea della Porta <andrea.porta@suse.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Andrea della Porta <andrea.porta@suse.com>,
	adrian.hunter@intel.com, alcooperx@gmail.com,
	bcm-kernel-feedback-list@broadcom.com, conor+dt@kernel.org,
	devicetree@vger.kernel.org, florian.fainelli@broadcom.com,
	jonathan@raspberrypi.com, kamal.dasu@broadcom.com,
	krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
	phil@raspberrypi.com, robh@kernel.org, ulf.hansson@linaro.org
Subject: Re: [PATCH 6/6] mmc: sdhci-brcmstb: Add BCM2712 SD Express support
Date: Sat, 27 Apr 2024 13:16:36 +0200	[thread overview]
Message-ID: <ZizelID_-Hxdxp_N@apocalypse> (raw)
In-Reply-To: <57f240af-7e99-4bc1-a2c5-415441aa5f0b@wanadoo.fr>

On 09:34 Sun 14 Apr     , Christophe JAILLET wrote:
> Le 14/04/2024 à 00:14, Andrea della Porta a écrit :
> > Broadcom BCM2712 SDHCI controller is SD Express capable. Add support
> > for sde capability where the implementation is based on downstream driver,
> > diverging from it in the way that init_sd_express callback is invoked:
> > in downstream the sdhci_ops structure has been augmented with a new
> > function ptr 'init_sd_express' that just propagate the call to the
> > driver specific callback so that the callstack from a structure
> > standpoint is mmc_host_ops -> sdhci_ops. The drawback here is in the
> > added level of indirection (the newly added init_sd_express is
> > redundant) and the sdhci_ops structure declaration has to be changed.
> > To overcome this the presented approach consist in patching the mmc_host_ops
> > init_sd_express callback to point directly to the custom function defined in
> > this driver (see struct brcmstb_match_priv).
> > 
> > Signed-off-by: Andrea della Porta <andrea.porta-IBi9RG/b67k@public.gmane.org>
> > ---
> >   drivers/mmc/host/Kconfig         |   1 +
> >   drivers/mmc/host/sdhci-brcmstb.c | 147 ++++++++++++++++++++++++++++++-
> >   2 files changed, 147 insertions(+), 1 deletion(-)
> 
> ...
> 
> > +	if (brcmstb_priv->sde_pcie) {
> > +		struct of_changeset changeset;
> > +		static struct property okay_property = {
> > +			.name = "status",
> > +			.value = "okay",
> > +			.length = 5,
> > +		};
> > +
> > +		/* Enable the pcie controller */
> > +		of_changeset_init(&changeset);
> > +		ret = of_changeset_update_property(&changeset,
> > +						   brcmstb_priv->sde_pcie,
> > +						   &okay_property);
> > +		if (ret) {
> > +			dev_err(dev, "%s: failed to update property - %d\n", __func__,
> > +			       ret);
> > +			return -ENODEV;
> > +		}
> > +		ret = of_changeset_apply(&changeset);
> > +	}
> > +
> > +	dev_dbg(dev, "%s -> %d\n", __func__, ret);
> 
> Is this really useful?

Not really. Removed.

> 
> > +	return ret;
> > +}
> > +
> 
> ...
> 
> > @@ -468,6 +581,24 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
> >   	if (res)
> >   		goto err;
> > +	priv->sde_1v8 = devm_regulator_get_optional(&pdev->dev, "sde-1v8");
> > +	if (IS_ERR(priv->sde_1v8))
> > +		priv->flags &= ~BRCMSTB_PRIV_FLAGS_HAS_SD_EXPRESS;
> > +
> > +	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> > +	if (iomem) {
> > +		priv->sde_ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
> > +		if (IS_ERR(priv->sde_ioaddr))
> > +			priv->sde_ioaddr = NULL;
> > +	}
> > +
> > +	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 3);
> > +	if (iomem) {
> > +		priv->sde_ioaddr2 = devm_ioremap_resource(&pdev->dev, iomem);
> > +		if (IS_ERR(priv->sde_ioaddr2))
> > +			priv->sde_ioaddr = NULL;
> 
> sde_ioaddr2 ?
> 
> > +	}
> > +
> >   	priv->pinctrl = devm_pinctrl_get(&pdev->dev);
> >   	if (IS_ERR(priv->pinctrl)) {
> >   			no_pinctrl = true;
> > @@ -478,8 +609,16 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
> >   			no_pinctrl = true;
> >   	}
> > -	if (no_pinctrl )
> > +	priv->pins_sdex = pinctrl_lookup_state(priv->pinctrl, "sd-express");
> > +	if (IS_ERR(priv->pins_sdex)) {
> > +			dev_dbg(&pdev->dev, "No pinctrl sd-express state\n");
> > +			no_pinctrl = true;
> 
> Indentation looks too large.

Ack.

> 
> > +	}
> > +
> > +	if (no_pinctrl || !priv->sde_ioaddr || !priv->sde_ioaddr2) {
> >   		priv->pinctrl = NULL;
> > +		priv->flags &= ~BRCMSTB_PRIV_FLAGS_HAS_SD_EXPRESS;
> > +	}
> >   	/*
> >   	 * Automatic clock gating does not work for SD cards that may
> 
> ...
> 

In general I'll drop SD express patch for now, it will be re-introduced in a future patch.

Best regards,
Andrea

  reply	other threads:[~2024-04-27 11:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13 22:14 [PATCH 0/6] Add support for BCM2712 SD card controller Andrea della Porta
2024-04-13 22:14 ` [PATCH 1/6] dt-bindings: pinctrl: Add support for BCM2712 pin controller Andrea della Porta
2024-04-13 23:22   ` Rob Herring
2024-04-14  6:09   ` Krzysztof Kozlowski
2024-04-14 15:45   ` Florian Fainelli
2024-04-16 12:59     ` Linus Walleij
2024-04-27 10:55     ` Andrea della Porta
2024-04-13 22:14 ` [PATCH 2/6] dt-bindings: mmc: Add support for BCM2712 SD host controller Andrea della Porta
2024-04-13 23:22   ` Rob Herring
2024-04-14  6:11   ` Krzysztof Kozlowski
2024-04-14 15:55   ` Florian Fainelli
2024-04-13 22:14 ` [PATCH 3/6] arm64: dts: broadcom: Add support for BCM2712 Andrea della Porta
2024-04-14  6:22   ` Krzysztof Kozlowski
2024-04-14 16:01   ` Florian Fainelli
2024-04-27 11:02     ` Andrea della Porta
2024-04-15  8:20   ` Stefan Wahren
2024-04-15  8:52     ` Phil Elwell
2024-04-15  9:06       ` Stefan Wahren
2024-04-15 10:43         ` Phil Elwell
2024-04-13 22:14 ` [PATCH 4/6] pinctrl: bcm: Add pinconf/pinmux controller driver " Andrea della Porta
2024-04-14  7:19   ` Christophe JAILLET
2024-04-27 11:04     ` Andrea della Porta
2024-04-14 16:00   ` Florian Fainelli
2024-04-27 11:06     ` Andrea della Porta
2024-04-16 13:07   ` Linus Walleij
2024-04-27 11:13     ` Andrea della Porta
2024-04-13 22:14 ` [PATCH 5/6] mmc: sdhci-brcmstb: Add BCM2712 support Andrea della Porta
2024-04-14  6:25   ` Krzysztof Kozlowski
2024-04-14  7:28   ` Christophe JAILLET
2024-04-14 15:53   ` Florian Fainelli
2024-04-13 22:14 ` [PATCH 6/6] mmc: sdhci-brcmstb: Add BCM2712 SD Express support Andrea della Porta
2024-04-14  7:34   ` Christophe JAILLET
2024-04-27 11:16     ` Andrea della Porta [this message]
2024-04-14 15:55   ` Florian Fainelli
2024-04-27 11:21     ` Andrea della Porta
2024-04-14 10:07 ` [PATCH 0/6] Add support for BCM2712 SD card controller Stefan Wahren
2024-05-02  9:12   ` Andrea della Porta
2024-04-14 15:54 ` Florian Fainelli
2024-04-15 18:47 ` Rob Herring

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=ZizelID_-Hxdxp_N@apocalypse \
    --to=andrea.porta@suse.com \
    --cc=adrian.hunter@intel.com \
    --cc=alcooperx@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=jonathan@raspberrypi.com \
    --cc=kamal.dasu@broadcom.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=robh@kernel.org \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).