* [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support
@ 2026-03-03 11:27 Binbin Zhou
2026-03-03 11:27 ` [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300 Binbin Zhou
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Binbin Zhou @ 2026-03-03 11:27 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson
Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mmc,
Binbin Zhou
Hi all:
The patchset describes two MMC controllers of the Loongson-2K0300 SoC,
one providing an eMMC interface and the other exporting an SD/SDIO
interface.
Its hardware design is similar to that of the Loongson-2K2000, but it
suffers from hardware defects such as missing CMD48 interrupts.
Thanks.
Binbin
Binbin Zhou (3):
dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for
Loongson-2K0300
mmc: loongson2: Gathering all SoCs private data together
mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
.../bindings/mmc/loongson,ls2k0500-mmc.yaml | 1 +
drivers/mmc/host/loongson2-mmc.c | 59 ++++++++++++++-----
2 files changed, 44 insertions(+), 16 deletions(-)
base-commit: 6a4a4c1cc0012590b8bebf6c95d51687d39b420c
--
2.52.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
@ 2026-03-03 11:27 ` Binbin Zhou
2026-03-03 19:06 ` Conor Dooley
2026-03-03 11:27 ` [PATCH 2/3] mmc: loongson2: Gathering all SoCs private data together Binbin Zhou
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Binbin Zhou @ 2026-03-03 11:27 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson
Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mmc,
Binbin Zhou
Add "loongson,ls2k0300-mmc" dedicated compatible to represent the
eMMC/SD/SDIO controller interface of the Loongson-2K0300 chip.
Its hardware design is similar to that of the Loongson-2K2000, but it
suffers from hardware defects such as missing CMD48 interrupts.
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml b/Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml
index c142421bc723..b3e8d3f13592 100644
--- a/Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml
+++ b/Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml
@@ -22,6 +22,7 @@ allOf:
properties:
compatible:
enum:
+ - loongson,ls2k0300-mmc
- loongson,ls2k0500-mmc
- loongson,ls2k1000-mmc
- loongson,ls2k2000-mmc
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] mmc: loongson2: Gathering all SoCs private data together
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
2026-03-03 11:27 ` [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300 Binbin Zhou
@ 2026-03-03 11:27 ` Binbin Zhou
2026-03-03 11:27 ` [PATCH 3/3] mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver Binbin Zhou
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Binbin Zhou @ 2026-03-03 11:27 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson
Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mmc,
Binbin Zhou
More Loongson SoCs will be added, gathering all SoC private data
(`loongson2_mmc_pdata`) together to make the code clearer.
No functional change intended.
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
drivers/mmc/host/loongson2-mmc.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/loongson2-mmc.c b/drivers/mmc/host/loongson2-mmc.c
index 026cbd80f114..333bed60df3b 100644
--- a/drivers/mmc/host/loongson2-mmc.c
+++ b/drivers/mmc/host/loongson2-mmc.c
@@ -703,14 +703,6 @@ static int ls2k0500_mmc_set_external_dma(struct loongson2_mmc_host *host,
return 0;
}
-static struct loongson2_mmc_pdata ls2k0500_mmc_pdata = {
- .regmap_config = &ls2k0500_mmc_regmap_config,
- .reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
- .setting_dma = ls2k0500_mmc_set_external_dma,
- .prepare_dma = loongson2_mmc_prepare_external_dma,
- .release_dma = loongson2_mmc_release_external_dma,
-};
-
static int ls2k1000_mmc_set_external_dma(struct loongson2_mmc_host *host,
struct platform_device *pdev)
{
@@ -735,14 +727,6 @@ static int ls2k1000_mmc_set_external_dma(struct loongson2_mmc_host *host,
return 0;
}
-static struct loongson2_mmc_pdata ls2k1000_mmc_pdata = {
- .regmap_config = &ls2k0500_mmc_regmap_config,
- .reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
- .setting_dma = ls2k1000_mmc_set_external_dma,
- .prepare_dma = loongson2_mmc_prepare_external_dma,
- .release_dma = loongson2_mmc_release_external_dma,
-};
-
static const struct regmap_config ls2k2000_mmc_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
@@ -855,6 +839,22 @@ static void loongson2_mmc_release_internal_dma(struct loongson2_mmc_host *host,
dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
}
+static struct loongson2_mmc_pdata ls2k0500_mmc_pdata = {
+ .regmap_config = &ls2k0500_mmc_regmap_config,
+ .reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
+ .setting_dma = ls2k0500_mmc_set_external_dma,
+ .prepare_dma = loongson2_mmc_prepare_external_dma,
+ .release_dma = loongson2_mmc_release_external_dma,
+};
+
+static struct loongson2_mmc_pdata ls2k1000_mmc_pdata = {
+ .regmap_config = &ls2k0500_mmc_regmap_config,
+ .reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
+ .setting_dma = ls2k1000_mmc_set_external_dma,
+ .prepare_dma = loongson2_mmc_prepare_external_dma,
+ .release_dma = loongson2_mmc_release_external_dma,
+};
+
static struct loongson2_mmc_pdata ls2k2000_mmc_pdata = {
.regmap_config = &ls2k2000_mmc_regmap_config,
.reorder_cmd_data = ls2k2000_mmc_reorder_cmd_data,
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
2026-03-03 11:27 ` [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300 Binbin Zhou
2026-03-03 11:27 ` [PATCH 2/3] mmc: loongson2: Gathering all SoCs private data together Binbin Zhou
@ 2026-03-03 11:27 ` Binbin Zhou
2026-03-04 8:05 ` [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Huacai Chen
2026-03-09 15:06 ` Ulf Hansson
4 siblings, 0 replies; 7+ messages in thread
From: Binbin Zhou @ 2026-03-03 11:27 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson
Cc: Huacai Chen, Xuerui Wang, loongarch, devicetree, linux-mmc,
Binbin Zhou
This patch describes the two MMC controllers of the Loongson-2K0300 SoC,
one providing an eMMC interface and the other exporting an SD/SDIO
interface.
Its hardware design is similar to that of the Loongson-2K2000, but it
suffers from hardware defects such as missing CMD48 interrupts.
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
drivers/mmc/host/loongson2-mmc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/mmc/host/loongson2-mmc.c b/drivers/mmc/host/loongson2-mmc.c
index 333bed60df3b..f553e92fd9e5 100644
--- a/drivers/mmc/host/loongson2-mmc.c
+++ b/drivers/mmc/host/loongson2-mmc.c
@@ -189,6 +189,12 @@
#define LOONGSON2_MMC_DLLVAL_TIMEOUT_US 4000
#define LOONGSON2_MMC_TXFULL_TIMEOUT_US 500
+/*
+ * Due to a hardware design flaw, the Loongson-2K0300 may fail to recognize the
+ * CMD48 (SD_READ_EXTR_SINGLE) interrupt.
+ */
+#define LOONGSON2_MMC_CMD48_QUIRK BIT(0)
+
/* Loongson-2K1000 SDIO2 DMA routing register */
#define LS2K1000_SDIO_DMA_MASK GENMASK(17, 15)
#define LS2K1000_DMA0_CONF 0x0
@@ -245,6 +251,7 @@ struct loongson2_mmc_host {
};
struct loongson2_mmc_pdata {
+ u32 flags;
const struct regmap_config *regmap_config;
void (*reorder_cmd_data)(struct loongson2_mmc_host *host, struct mmc_command *cmd);
void (*fix_data_timeout)(struct loongson2_mmc_host *host, struct mmc_command *cmd);
@@ -568,6 +575,12 @@ static void loongson2_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct loongson2_mmc_host *host = mmc_priv(mmc);
+ if ((host->pdata->flags & LOONGSON2_MMC_CMD48_QUIRK) &&
+ mrq->cmd->opcode == SD_READ_EXTR_SINGLE) {
+ mmc_request_done(mmc, mrq);
+ return;
+ }
+
host->cmd_is_stop = 0;
host->mrq = mrq;
loongson2_mmc_send_request(mmc);
@@ -839,7 +852,18 @@ static void loongson2_mmc_release_internal_dma(struct loongson2_mmc_host *host,
dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
}
+static struct loongson2_mmc_pdata ls2k0300_mmc_pdata = {
+ .flags = LOONGSON2_MMC_CMD48_QUIRK,
+ .regmap_config = &ls2k2000_mmc_regmap_config,
+ .reorder_cmd_data = ls2k2000_mmc_reorder_cmd_data,
+ .fix_data_timeout = ls2k2000_mmc_fix_data_timeout,
+ .setting_dma = ls2k2000_mmc_set_internal_dma,
+ .prepare_dma = loongson2_mmc_prepare_internal_dma,
+ .release_dma = loongson2_mmc_release_internal_dma,
+};
+
static struct loongson2_mmc_pdata ls2k0500_mmc_pdata = {
+ .flags = 0,
.regmap_config = &ls2k0500_mmc_regmap_config,
.reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
.setting_dma = ls2k0500_mmc_set_external_dma,
@@ -848,6 +872,7 @@ static struct loongson2_mmc_pdata ls2k0500_mmc_pdata = {
};
static struct loongson2_mmc_pdata ls2k1000_mmc_pdata = {
+ .flags = 0,
.regmap_config = &ls2k0500_mmc_regmap_config,
.reorder_cmd_data = ls2k0500_mmc_reorder_cmd_data,
.setting_dma = ls2k1000_mmc_set_external_dma,
@@ -856,6 +881,7 @@ static struct loongson2_mmc_pdata ls2k1000_mmc_pdata = {
};
static struct loongson2_mmc_pdata ls2k2000_mmc_pdata = {
+ .flags = 0,
.regmap_config = &ls2k2000_mmc_regmap_config,
.reorder_cmd_data = ls2k2000_mmc_reorder_cmd_data,
.fix_data_timeout = ls2k2000_mmc_fix_data_timeout,
@@ -984,6 +1010,7 @@ static void loongson2_mmc_remove(struct platform_device *pdev)
}
static const struct of_device_id loongson2_mmc_of_ids[] = {
+ { .compatible = "loongson,ls2k0300-mmc", .data = &ls2k0300_mmc_pdata },
{ .compatible = "loongson,ls2k0500-mmc", .data = &ls2k0500_mmc_pdata },
{ .compatible = "loongson,ls2k1000-mmc", .data = &ls2k1000_mmc_pdata },
{ .compatible = "loongson,ls2k2000-mmc", .data = &ls2k2000_mmc_pdata },
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300
2026-03-03 11:27 ` [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300 Binbin Zhou
@ 2026-03-03 19:06 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2026-03-03 19:06 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson, Huacai Chen, Xuerui Wang, loongarch,
devicetree, linux-mmc
[-- Attachment #1: Type: text/plain, Size: 75 bytes --]
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
` (2 preceding siblings ...)
2026-03-03 11:27 ` [PATCH 3/3] mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver Binbin Zhou
@ 2026-03-04 8:05 ` Huacai Chen
2026-03-09 15:06 ` Ulf Hansson
4 siblings, 0 replies; 7+ messages in thread
From: Huacai Chen @ 2026-03-04 8:05 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ulf Hansson, Xuerui Wang, loongarch, devicetree,
linux-mmc
For the whole series:
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
On Tue, Mar 3, 2026 at 7:27 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Hi all:
>
> The patchset describes two MMC controllers of the Loongson-2K0300 SoC,
> one providing an eMMC interface and the other exporting an SD/SDIO
> interface.
>
> Its hardware design is similar to that of the Loongson-2K2000, but it
> suffers from hardware defects such as missing CMD48 interrupts.
>
> Thanks.
> Binbin
>
> Binbin Zhou (3):
> dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for
> Loongson-2K0300
> mmc: loongson2: Gathering all SoCs private data together
> mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
>
> .../bindings/mmc/loongson,ls2k0500-mmc.yaml | 1 +
> drivers/mmc/host/loongson2-mmc.c | 59 ++++++++++++++-----
> 2 files changed, 44 insertions(+), 16 deletions(-)
>
>
> base-commit: 6a4a4c1cc0012590b8bebf6c95d51687d39b420c
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
` (3 preceding siblings ...)
2026-03-04 8:05 ` [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Huacai Chen
@ 2026-03-09 15:06 ` Ulf Hansson
4 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2026-03-09 15:06 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Huacai Chen, Xuerui Wang, loongarch, devicetree,
linux-mmc
On Tue, 3 Mar 2026 at 12:27, Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Hi all:
>
> The patchset describes two MMC controllers of the Loongson-2K0300 SoC,
> one providing an eMMC interface and the other exporting an SD/SDIO
> interface.
>
> Its hardware design is similar to that of the Loongson-2K2000, but it
> suffers from hardware defects such as missing CMD48 interrupts.
>
> Thanks.
> Binbin
>
> Binbin Zhou (3):
> dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for
> Loongson-2K0300
> mmc: loongson2: Gathering all SoCs private data together
> mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
>
> .../bindings/mmc/loongson,ls2k0500-mmc.yaml | 1 +
> drivers/mmc/host/loongson2-mmc.c | 59 ++++++++++++++-----
> 2 files changed, 44 insertions(+), 16 deletions(-)
>
>
> base-commit: 6a4a4c1cc0012590b8bebf6c95d51687d39b420c
> --
> 2.52.0
>
The series applied for next, thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-09 15:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 11:27 [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Binbin Zhou
2026-03-03 11:27 ` [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300 Binbin Zhou
2026-03-03 19:06 ` Conor Dooley
2026-03-03 11:27 ` [PATCH 2/3] mmc: loongson2: Gathering all SoCs private data together Binbin Zhou
2026-03-03 11:27 ` [PATCH 3/3] mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver Binbin Zhou
2026-03-04 8:05 ` [PATCH 0/3] mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support Huacai Chen
2026-03-09 15:06 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox