From: Yao Zi <me@ziyao.cc>
To: Yixun Lan <dlan@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mmc: sdhci-of-k1: spacemit: Add support for K3 SoC
Date: Wed, 21 Jan 2026 09:48:19 +0000 [thread overview]
Message-ID: <aXCg43ZepMm1DNHq@pie> (raw)
In-Reply-To: <20260121-07-k3-mmc-v1-2-ff77c07bfdf6@kernel.org>
On Wed, Jan 21, 2026 at 03:27:36PM +0800, Yixun Lan wrote:
> The SDHCI controller found on SpacemiT K3 SoC share the same IP with K1
> generation and introduce a compatible data to denote the change that broken
> 64BIT DMA issue has been fixed.
>
> Signed-off-by: Yixun Lan <dlan@kernel.org>
> ---
> drivers/mmc/host/sdhci-of-k1.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index a160e1d5d9bd..a56cb8a36982 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -259,8 +259,20 @@ static const struct sdhci_pltfm_data spacemit_sdhci_k1_pdata = {
> SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> };
>
> +static const struct sdhci_pltfm_data spacemit_sdhci_k3_pdata = {
> + .ops = &spacemit_sdhci_ops,
> + .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> + SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
> + SDHCI_QUIRK_32BIT_ADMA_SIZE |
> + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> + SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
> + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> +};
> +
> static const struct of_device_id spacemit_sdhci_of_match[] = {
> - { .compatible = "spacemit,k1-sdhci" },
> + { .compatible = "spacemit,k1-sdhci", .data = &spacemit_sdhci_k1_pdata },
> + { .compatible = "spacemit,k3-sdhci", .data = &spacemit_sdhci_k3_pdata },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, spacemit_sdhci_of_match);
> @@ -271,10 +283,16 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
> struct spacemit_sdhci_host *sdhst;
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> + const struct sdhci_pltfm_data *data;
> struct mmc_host_ops *mops;
> int ret;
>
> - host = sdhci_pltfm_init(pdev, &spacemit_sdhci_k1_pdata, sizeof(*sdhst));
> +
> + data = of_device_get_match_data(&pdev->dev);
> + if (!data)
> + return dev_err_probe(dev, -EINVAL, "failed to get platform data\n");
Is there a need to check against return value of
of_device_get_match_data()? It isn't a user input, instead missing the
data seems a kernel bug to me, and shouldn't happen in production.
Regards,
Yao Zi
WARNING: multiple messages have this Message-ID (diff)
From: Yao Zi <me@ziyao.cc>
To: Yixun Lan <dlan@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mmc: sdhci-of-k1: spacemit: Add support for K3 SoC
Date: Wed, 21 Jan 2026 09:48:19 +0000 [thread overview]
Message-ID: <aXCg43ZepMm1DNHq@pie> (raw)
In-Reply-To: <20260121-07-k3-mmc-v1-2-ff77c07bfdf6@kernel.org>
On Wed, Jan 21, 2026 at 03:27:36PM +0800, Yixun Lan wrote:
> The SDHCI controller found on SpacemiT K3 SoC share the same IP with K1
> generation and introduce a compatible data to denote the change that broken
> 64BIT DMA issue has been fixed.
>
> Signed-off-by: Yixun Lan <dlan@kernel.org>
> ---
> drivers/mmc/host/sdhci-of-k1.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index a160e1d5d9bd..a56cb8a36982 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -259,8 +259,20 @@ static const struct sdhci_pltfm_data spacemit_sdhci_k1_pdata = {
> SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> };
>
> +static const struct sdhci_pltfm_data spacemit_sdhci_k3_pdata = {
> + .ops = &spacemit_sdhci_ops,
> + .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
> + SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
> + SDHCI_QUIRK_32BIT_ADMA_SIZE |
> + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
> + SDHCI_QUIRK_BROKEN_CARD_DETECTION |
> + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
> + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
> +};
> +
> static const struct of_device_id spacemit_sdhci_of_match[] = {
> - { .compatible = "spacemit,k1-sdhci" },
> + { .compatible = "spacemit,k1-sdhci", .data = &spacemit_sdhci_k1_pdata },
> + { .compatible = "spacemit,k3-sdhci", .data = &spacemit_sdhci_k3_pdata },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, spacemit_sdhci_of_match);
> @@ -271,10 +283,16 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
> struct spacemit_sdhci_host *sdhst;
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> + const struct sdhci_pltfm_data *data;
> struct mmc_host_ops *mops;
> int ret;
>
> - host = sdhci_pltfm_init(pdev, &spacemit_sdhci_k1_pdata, sizeof(*sdhst));
> +
> + data = of_device_get_match_data(&pdev->dev);
> + if (!data)
> + return dev_err_probe(dev, -EINVAL, "failed to get platform data\n");
Is there a need to check against return value of
of_device_get_match_data()? It isn't a user input, instead missing the
data seems a kernel bug to me, and shouldn't happen in production.
Regards,
Yao Zi
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-01-21 9:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 7:27 [PATCH 0/2] mmc: spacemit: Add support for K3 SoC Yixun Lan
2026-01-21 7:27 ` Yixun Lan
2026-01-21 7:27 ` [PATCH 1/2] dt-bindings: mmc: spacemit,sdhci: add " Yixun Lan
2026-01-21 7:27 ` Yixun Lan
2026-01-21 16:46 ` Rob Herring (Arm)
2026-01-21 16:46 ` Rob Herring (Arm)
2026-01-21 7:27 ` [PATCH 2/2] mmc: sdhci-of-k1: spacemit: Add " Yixun Lan
2026-01-21 7:27 ` Yixun Lan
2026-01-21 9:48 ` Yao Zi [this message]
2026-01-21 9:48 ` Yao Zi
2026-01-21 10:44 ` Yixun Lan
2026-01-21 10:44 ` Yixun Lan
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=aXCg43ZepMm1DNHq@pie \
--to=me@ziyao.cc \
--cc=adrian.hunter@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.