mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support
Subsystems (4)
Binbin Zhou
maintainercover mmc: Add Loongson-2K0300 SD/SDIO/eMMC controller support
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
Signature · 1 line
2.52.0
Binbin Zhou
maintainerPATCH 1/3 dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300
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.
--- Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml +1 -0
@@ -22,6 +22,7 @@ allOf: properties: compatible: enum: + - loongson,ls2k0300-mmc - loongson,ls2k0500-mmc - loongson,ls2k1000-mmc - loongson,ls2k2000-mmc
Signature · 1 line
2.52.0
Binbin Zhou
maintainerPATCH 2/3 mmc: loongson2: Gathering all SoCs private data together
In reply to Binbin ZhouMore Loongson SoCs will be added, gathering all SoC private data (loongson2_mmc_pdata) together to make the code clearer.
No functional change intended.
--- drivers/mmc/host/loongson2-mmc.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/mmc/host/loongson2-mmc.c +16 -16
@@ -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,
Signature · 1 line
2.52.0
Binbin Zhou
maintainerPATCH 3/3 mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
In reply to Binbin ZhouThis 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.
--- drivers/mmc/host/loongson2-mmc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/mmc/host/loongson2-mmc.c +27 -0
@@ -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 },
Signature · 1 line
2.52.0
Re: [PATCH 1/3] dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K0300
In reply to Binbin Zhoupw-bot: not-applicable
For the whole series:
Quoted 28 lines · 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.
BinbinBinbin Zhou (3):
dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible forLoongson-2K0300mmc: 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
Quoted 19 lines · 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.
BinbinBinbin Zhou (3):
dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible forLoongson-2K0300mmc: loongson2: Gathering all SoCs private data together
mmc: loongson2: Add Loongson-2K0300 SD/SDIO/eMMC controller driver
Quoted 9 lines
.../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