Re: [PATCH 5/6] mmc: sdhci-brcmstb: Add BCM2712 support

From: Christophe JAILLET
Date: Sun Apr 14 2024 - 03:29:08 EST


Le 14/04/2024 à 00:14, Andrea della Porta a écrit :
Broadcom BCM2712 SoC has an SDHCI card controller using the SDIO CFG
register block present on other STB chips. Add support for BCM2712
SD capabilities of this chipset.
The silicon is SD Express capable but this driver port does not currently
include that feature yet.
Based on downstream driver by raspberry foundation maintained kernel.

Signed-off-by: Andrea della Porta <andrea.porta-IBi9RG/b67k@xxxxxxxxxxxxxxxx>
---
drivers/mmc/host/sdhci-brcmstb.c | 130 +++++++++++++++++++++++++++++++
1 file changed, 130 insertions(+)

..

+static void sdhci_brcmstb_set_power(struct sdhci_host *host, unsigned char mode,
+ unsigned short vdd)
+{
+ if (!IS_ERR(host->mmc->supply.vmmc)) {
+ struct mmc_host *mmc = host->mmc;

This would look nicer if mmc was defined at the beginning of the function and used in the if (!IS_ERR()) test.

+
+ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+ }
+ sdhci_set_power_noreg(host, mode, vdd);
+}
+
static void sdhci_brcmstb_set_uhs_signaling(struct sdhci_host *host,
unsigned int timing)
{
@@ -168,6 +233,36 @@ static void sdhci_brcmstb_set_uhs_signaling(struct sdhci_host *host,
sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
}

..

@@ -354,6 +468,19 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
if (res)
goto err;
+ priv->pinctrl = devm_pinctrl_get(&pdev->dev);
+ if (IS_ERR(priv->pinctrl)) {
+ no_pinctrl = true;
+ }

Indentation looks to large here.
No need to { }

+ priv->pins_default = pinctrl_lookup_state(priv->pinctrl, "default");
+ if (IS_ERR(priv->pins_default)) {
+ dev_dbg(&pdev->dev, "No pinctrl default state\n");
+ no_pinctrl = true;

Indentation looks to large here.

+ }
+
+ if (no_pinctrl )
+ priv->pinctrl = NULL;
+
/*
* Automatic clock gating does not work for SD cards that may
* voltage switch so only enable it for non-removable devices.

..