mbox series

[v2,0/4] LoongArch: Introduce the Loongson-2K MMC host controller driver

Message ID cover.1746581751.git.zhoubinbin@loongson.cn
Headers show
Series LoongArch: Introduce the Loongson-2K MMC host controller driver | expand

Message

Binbin Zhou May 7, 2025, 7:28 a.m. UTC
Hi all:

This patchset introduce the MMC host controller on Loongson-2K series
CPUs.

They are similar, except for the interface characteristics and the use of
DMA engine, specifically, the Loongson-2K0500/Loongson-2K1000 use an
externally shared APBDMA engine, while the Loongson-2K2000 uses an
internally exclusive DMA.

Based on this, I'm splitting the driver into two patches.

List of the patchset:
Patch1: bindings for Loongson-2K0500/Loongson-2K1000;
Patch2: driver for MMC controller using externally shared APBDMA engine;
Patch3: bindings for Loongson-2K2000;
Patch4: driver for MMC controller using internally exclusive DMA.

Thanks.

-------
V2:

patch(1/4):
 - Add reg define for each reg entry.

patch(2/4):
 - Put all code in the c-file;
 - Use mmc_from_priv() instead of host->mmc;
 - Use sdio_signal_irq() instead of mmc_signal_sdio_irq();
 - Use devm_mmc_alloc_host() instead of mmc_alloc_host();
 - Use mmc_regulator_get_supply();

patch(4/4):
 - Add fix_cmd_interrupt function which is needed by Loongson-2K2000.

Link to V1:
https://lore.kernel.org/linux-mmc/cover.1744273956.git.zhoubinbin@loongson.cn/

Binbin Zhou (4):
  dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding
  mmc: loongson2: Add Loongson-2K SD/SDIO controller driver
  dt-bindings: mmc: loongson,ls2k-mmc: Add compatible for
    Loongson-2K2000
  mmc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver

 .../bindings/mmc/loongson,ls2k-mmc.yaml       |  112 ++
 MAINTAINERS                                   |    7 +
 drivers/mmc/host/Kconfig                      |   13 +
 drivers/mmc/host/Makefile                     |    1 +
 drivers/mmc/host/loongson2-mmc.c              | 1007 +++++++++++++++++
 5 files changed, 1140 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
 create mode 100644 drivers/mmc/host/loongson2-mmc.c


base-commit: 9e12816f9a6195f1f5b7c5dc2e388c2458411b97

Comments

Conor Dooley May 8, 2025, 3 p.m. UTC | #1
On Wed, May 07, 2025 at 03:28:05PM +0800, Binbin Zhou wrote:
> Add the Loongson-2K SoC's SD/SDIO/eMMC controller binding with DT schema
> format using json-schema.
> 
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../bindings/mmc/loongson,ls2k-mmc.yaml       | 69 +++++++++++++++++++
>  MAINTAINERS                                   |  6 ++
>  2 files changed, 75 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml b/Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
> new file mode 100644
> index 000000000000..97a0853399f1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mmc/loongson,ls2k-mmc.yaml#

Filename matching a compatible please.
Otherwise this looks okay to me.

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
> +
> +description:
> +  The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
> +  shared apbdma controller) provides the SD and SDIO device interfaces.
> +
> +maintainers:
> +  - Binbin Zhou <zhoubinbin@loongson.cn>
> +
> +allOf:
> +  - $ref: mmc-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - loongson,ls2k0500-mmc
> +      - loongson,ls2k1000-mmc
> +
> +  reg:
> +    items:
> +      - description: Loongson-2K MMC controller registers.
> +      - description: APB DMA config register for Loongson-2K MMC controller.
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  dmas:
> +    maxItems: 1
> +
> +  dma-names:
> +    const: rx-tx
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - dmas
> +  - dma-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/clock/loongson,ls2k-clk.h>
> +
> +    mmc@1fe2c000 {
> +        compatible = "loongson,ls2k1000-mmc";
> +        reg = <0x1fe2c000 0x68>,
> +              <0x1fe00438 0x8>;
> +        interrupt-parent = <&liointc0>;
> +        interrupts = <31 IRQ_TYPE_LEVEL_HIGH>;
> +        clocks = <&clk LOONGSON2_APB_CLK>;
> +        dmas = <&apbdma1 0>;
> +        dma-names = "rx-tx";
> +        bus-width = <4>;
> +        cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 96b827049501..5bf74aa63299 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -13935,6 +13935,12 @@ S:	Maintained
>  F:	Documentation/devicetree/bindings/hwinfo/loongson,ls2k-chipid.yaml
>  F:	drivers/soc/loongson/loongson2_guts.c
>  
> +LOONGSON-2 SOC SERIES MMC/SD/SDIO CONTROLLER DRIVER
> +M:	Binbin Zhou <zhoubinbin@loongson.cn>
> +L:	linux-mmc@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/mmc/loongson,ls2k-mmc.yaml
> +
>  LOONGSON-2 SOC SERIES PM DRIVER
>  M:	Yinbo Zhu <zhuyinbo@loongson.cn>
>  L:	linux-pm@vger.kernel.org
> -- 
> 2.47.1
>