MMC: add NPCM SDHCI driver support
Subsystems (4)
Tomer Maimon
maintainerv3 cover MMC: add NPCM SDHCI driver support
This patch set adds SDHCI support for the Nuvoton NPCM Baseboard Management Controller (BMC).
Deeply sorry it took that long until sending version three, promise to try to do better on the next versions (if needed) :-),
The NPCM SDHCI driver tested on NPCM750 and NPCM845 EVB.
Addressed comments from:
- Andy Shevchenko : https://www.spinics.net/lists/linux-mmc/msg74824.html
- Adrian Hunter : https://www.spinics.net/lists/linux-mmc/msg73353.html
- Guenter Roeck : https://www.spinics.net/lists/linux-mmc/msg74822.html
Changes since version 2:
- Add data to handle architecture-specific SDHCI parameters.
- Change config place in make and kconfig files.
- Calling sdhci_pltfm_free to to avoid a memory leak on error.
Changes since version 1:
- Use correct spaces in the dt-bindings.
- Drop unused labels from dt-bindings.
- Order by module name in the make a configuration.
- Remove unnecessary blank lines.
- Using devm_clk_get_optional instead of devm_clk_get.
Tomer Maimon (2):
dt-bindings: mmc: npcm,sdhci: Document NPCM SDHCI controller
mmc: sdhci-npcm: Add NPCM SDHCI driver
.../devicetree/bindings/mmc/npcm,sdhci.yaml | 45 +++++++++ drivers/mmc/host/Kconfig | 8 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-npcm.c | 99 +++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml create mode 100644 drivers/mmc/host/sdhci-npcm.c
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH v3 1/2 dt-bindings: mmc: npcm,sdhci: Document NPCM SDHCI controller
Add binding for Nuvoton NPCM SDHCI controller.
--- .../devicetree/bindings/mmc/npcm,sdhci.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml new file +45 -0
@@ -0,0 +1,45 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/npcm,sdhci.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NPCM SDHCI Controller + +maintainers: + - Tomer Maimon <[email protected]> + +allOf: + - $ref: mmc-controller.yaml# + +properties: + compatible: + enum: + - nuvoton,npcm750-sdhci + - nuvoton,npcm845-sdhci + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + +unevaluatedProperties: false + +examples: + - | + mmc@f0840000 { + compatible = "nuvoton,npcm750-sdhci"; + reg = <0xf0840000 0x200>; + interrupts = <0 27 4>; + clocks = <&clk 4>; + };
Signature · 1 line
2.33.0
Tomer Maimon
maintainerPATCH v3 2/2 mmc: sdhci-npcm: Add NPCM SDHCI driver
In reply to Tomer MaimonAdd Nuvoton NPCM BMC sdhci-pltfm controller driver.
--- drivers/mmc/host/Kconfig | 8 +++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-npcm.c | 99 +++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 drivers/mmc/host/sdhci-npcm.c
drivers/mmc/host/Kconfig +8 -0
@@ -429,6 +429,14 @@ config MMC_SDHCI_IPROC If unsure, say N. +config MMC_SDHCI_NPCM + tristate "Secure Digital Host Controller Interface support for NPCM" + depends on ARCH_NPCM || COMPILE_TEST + depends on MMC_SDHCI_PLTFM + help + This provides support for the SD/eMMC controller found in + NPCM BMC family SoCs. + config MMC_MESON_GX tristate "Amlogic S905/GX*/AXG SD/MMC Host Controller support" depends on ARCH_MESON|| COMPILE_TEST
drivers/mmc/host/Makefile +1 -0
@@ -89,6 +89,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_DWCMSHC) += sdhci-of-dwcmshc.o obj-$(CONFIG_MMC_SDHCI_OF_SPARX5) += sdhci-of-sparx5.o obj-$(CONFIG_MMC_SDHCI_BCM_KONA) += sdhci-bcm-kona.o obj-$(CONFIG_MMC_SDHCI_IPROC) += sdhci-iproc.o +obj-$(CONFIG_MMC_SDHCI_NPCM) += sdhci-npcm.o obj-$(CONFIG_MMC_SDHCI_MSM) += sdhci-msm.o obj-$(CONFIG_MMC_SDHCI_ST) += sdhci-st.o obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32) += sdhci-pic32.o
drivers/mmc/host/sdhci-npcm.c new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.33.0
Re: [PATCH v3 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
Quoted 2 lines · Tomer Maimon
Add Nuvoton NPCM BMC sdhci-pltfm controller driver.
...
Quoted 4 lines
+/*
+ * NPCM SDHC MMC host controller driver.
+ *
+ * Copyright (c) 2020 Nuvoton Technology corporation.
Shouldn't it be at least 2020,2023 ?
Quoted 1 line
+ */
...
drivers/mmc/host/sdhci-npcm.c line 12
Quoted 5 lines
drivers/mmc/host/sdhci-npcm.c new file +5
-0+#include <linux/clk.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/mmc/host.h> +#include <linux/mmc/mmc.h>
+ mod_devicetable.h
Quoted 2 lines
drivers/mmc/host/sdhci-npcm.c new file +2
-0+#include <linux/module.h> +#include <linux/of.h>
...
drivers/mmc/host/sdhci-npcm.c line 56
Quoted 9 lines
drivers/mmc/host/sdhci-npcm.c new file +9
-0+ pltfm_host->clk =devm_clk_get_optional (&pdev->dev,NULL ); +if (IS_ERR (pltfm_host->clk)) { + ret =PTR_ERR (pltfm_host->clk); + goto err_sdhci; + } + + ret =clk_prepare_enable (pltfm_host->clk); +if (ret) + goto err_sdhci;
Why not use devm_clk_get_optional_enabled()?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Tomer Maimon
maintainerRe: [PATCH v3 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
Hi Andy,
Thanks for your comments.
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Tomer Maimon
Add Nuvoton NPCM BMC sdhci-pltfm controller driver.
Quoted 8 lines
...
Quoted 4 lines
+/*
+ * NPCM SDHC MMC host controller driver.
+ *
+ * Copyright (c) 2020 Nuvoton Technology corporation.Shouldn't it be at least 2020,2023 ?
will change to 2023
Quoted 5 lines
Quoted 2 lines
+ */
...
Quoted 7 lines
drivers/mmc/host/sdhci-npcm.c line 12
Quoted 5 lines
drivers/mmc/host/sdhci-npcm.c new file +5
-0+#include <linux/clk.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/mmc/host.h> +#include <linux/mmc/mmc.h> +
mod_devicetable.h
why?
Quoted 15 lines
Quoted 2 lines
drivers/mmc/host/sdhci-npcm.c new file +2
-0+#include <linux/module.h> +#include <linux/of.h> ...
drivers/mmc/host/sdhci-npcm.c line 56
Quoted 9 lines
drivers/mmc/host/sdhci-npcm.c new file +9
-0+ pltfm_host->clk =devm_clk_get_optional (&pdev->dev,NULL ); +if (IS_ERR (pltfm_host->clk)) { + ret =PTR_ERR (pltfm_host->clk); + goto err_sdhci; + } + + ret =clk_prepare_enable (pltfm_host->clk); +if (ret) + goto err_sdhci;
Quoted 1 line
Why not use
devm_clk_get_optional_enabled()?
Will do
Quoted 4 lines
--
With Best Regards,
Andy Shevchenko
Best regards,
Tomer
Re: [PATCH v3 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
Quoted 2 lines · Tomer Maimon
Quoted 1 line · Andy Shevchenko
On Mon, Oct 2, 2023 at 8:51 PM Tomer Maimon <[email protected]> wrote:
...
Quoted 2 lines
Quoted 1 line
+
mod_devicetable.hwhy?
of_device_id is defined there.
Signature · 2 lines
With Best Regards, Andy Shevchenko