* [PATCH v5 1/2] dt-bindings: mmc: npcm,sdhci: Document NPCM SDHCI controller
2023-10-02 20:06 [PATCH v5 0/2] add NPCM SDHCI driver support Tomer Maimon
@ 2023-10-02 20:06 ` Tomer Maimon
2023-10-02 20:06 ` [PATCH v5 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver Tomer Maimon
2023-10-10 14:27 ` [PATCH v5 0/2] add NPCM SDHCI driver support Ulf Hansson
2 siblings, 0 replies; 6+ messages in thread
From: Tomer Maimon @ 2023-10-02 20:06 UTC (permalink / raw)
To: ulf.hansson, avifishman70, tali.perry1, joel, venture, yuenn,
benjaminfair, adrian.hunter, skhan, davidgow, pbrobinson, gsomlo,
briannorris, arnd, krakoczy, andy.shevchenko
Cc: openbmc, linux-mmc, devicetree, linux-kernel, Tomer Maimon,
Rob Herring
Add binding for Nuvoton NPCM SDHCI controller.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../devicetree/bindings/mmc/npcm,sdhci.yaml | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
diff --git a/Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml b/Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
new file mode 100644
index 000000000000..196fdbfa16ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
@@ -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 <tmaimon77@gmail.com>
+
+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>;
+ };
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
2023-10-02 20:06 [PATCH v5 0/2] add NPCM SDHCI driver support Tomer Maimon
2023-10-02 20:06 ` [PATCH v5 1/2] dt-bindings: mmc: npcm,sdhci: Document NPCM SDHCI controller Tomer Maimon
@ 2023-10-02 20:06 ` Tomer Maimon
2023-10-03 10:49 ` Andy Shevchenko
2023-10-10 14:27 ` [PATCH v5 0/2] add NPCM SDHCI driver support Ulf Hansson
2 siblings, 1 reply; 6+ messages in thread
From: Tomer Maimon @ 2023-10-02 20:06 UTC (permalink / raw)
To: ulf.hansson, avifishman70, tali.perry1, joel, venture, yuenn,
benjaminfair, adrian.hunter, skhan, davidgow, pbrobinson, gsomlo,
briannorris, arnd, krakoczy, andy.shevchenko
Cc: openbmc, linux-mmc, devicetree, linux-kernel, Tomer Maimon
Add Nuvoton NPCM BMC sdhci-pltfm controller driver.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/Kconfig | 8 +++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/sdhci-npcm.c | 94 +++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+)
create mode 100644 drivers/mmc/host/sdhci-npcm.c
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 554e67103c1a..3999d4fddc73 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -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
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index a693fa3d3f1c..d0be4465f3ec 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -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
diff --git a/drivers/mmc/host/sdhci-npcm.c b/drivers/mmc/host/sdhci-npcm.c
new file mode 100644
index 000000000000..a3045dd2ddeb
--- /dev/null
+++ b/drivers/mmc/host/sdhci-npcm.c
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * NPCM SDHC MMC host controller driver.
+ *
+ * Copyright (c) 2023 Nuvoton Technology corporation.
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of.h>
+
+#include "sdhci-pltfm.h"
+
+static const struct sdhci_pltfm_data npcm7xx_sdhci_pdata = {
+ .quirks = SDHCI_QUIRK_DELAY_AFTER_POWER,
+ .quirks2 = SDHCI_QUIRK2_STOP_WITH_TC |
+ SDHCI_QUIRK2_NO_1_8_V,
+};
+
+static const struct sdhci_pltfm_data npcm8xx_sdhci_pdata = {
+ .quirks = SDHCI_QUIRK_DELAY_AFTER_POWER,
+ .quirks2 = SDHCI_QUIRK2_STOP_WITH_TC,
+};
+
+static int npcm_sdhci_probe(struct platform_device *pdev)
+{
+ const struct sdhci_pltfm_data *data;
+ struct sdhci_pltfm_host *pltfm_host;
+ struct device *dev = &pdev->dev;
+ struct sdhci_host *host;
+ u32 caps;
+ int ret;
+
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -EINVAL;
+
+ host = sdhci_pltfm_init(pdev, data, 0);
+ if (IS_ERR(host))
+ return PTR_ERR(host);
+
+ pltfm_host = sdhci_priv(host);
+
+ pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
+ if (IS_ERR(pltfm_host->clk)) {
+ ret = PTR_ERR(pltfm_host->clk);
+ goto err_sdhci;
+ }
+
+ caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+ if (caps & SDHCI_CAN_DO_8BIT)
+ host->mmc->caps |= MMC_CAP_8_BIT_DATA;
+
+ ret = mmc_of_parse(host->mmc);
+ if (ret)
+ goto err_sdhci;
+
+ ret = sdhci_add_host(host);
+ if (ret)
+ goto err_sdhci;
+
+ return 0;
+
+err_sdhci:
+ sdhci_pltfm_free(pdev);
+ return ret;
+}
+
+static const struct of_device_id npcm_sdhci_of_match[] = {
+ { .compatible = "nuvoton,npcm750-sdhci", .data = &npcm7xx_sdhci_pdata, },
+ { .compatible = "nuvoton,npcm845-sdhci", .data = &npcm8xx_sdhci_pdata, },
+ { }
+};
+MODULE_DEVICE_TABLE(of, npcm_sdhci_of_match);
+
+static struct platform_driver npcm_sdhci_driver = {
+ .driver = {
+ .name = "npcm-sdhci",
+ .of_match_table = npcm_sdhci_of_match,
+ .pm = &sdhci_pltfm_pmops,
+ },
+ .probe = npcm_sdhci_probe,
+ .remove_new = sdhci_pltfm_remove,
+};
+module_platform_driver(npcm_sdhci_driver);
+
+MODULE_DESCRIPTION("NPCM Secure Digital Host Controller Interface driver");
+MODULE_AUTHOR("Tomer Maimon <tomer.maimon@nuvoton.com>");
+MODULE_LICENSE("GPL");
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver
2023-10-02 20:06 ` [PATCH v5 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver Tomer Maimon
@ 2023-10-03 10:49 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-10-03 10:49 UTC (permalink / raw)
To: Tomer Maimon
Cc: ulf.hansson, avifishman70, tali.perry1, joel, venture, yuenn,
benjaminfair, adrian.hunter, skhan, davidgow, pbrobinson, gsomlo,
briannorris, arnd, krakoczy, openbmc, linux-mmc, devicetree,
linux-kernel
On Mon, Oct 2, 2023 at 11:06 PM Tomer Maimon <tmaimon77@gmail.com> wrote:
>
> Add Nuvoton NPCM BMC sdhci-pltfm controller driver.
FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
...
> +static const struct of_device_id npcm_sdhci_of_match[] = {
> + { .compatible = "nuvoton,npcm750-sdhci", .data = &npcm7xx_sdhci_pdata, },
> + { .compatible = "nuvoton,npcm845-sdhci", .data = &npcm8xx_sdhci_pdata, },
Only in case when you need a new version, you may remove the inner
trailing commas,
no need to do this right now.
> + { }
> +};
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/2] add NPCM SDHCI driver support
2023-10-02 20:06 [PATCH v5 0/2] add NPCM SDHCI driver support Tomer Maimon
2023-10-02 20:06 ` [PATCH v5 1/2] dt-bindings: mmc: npcm,sdhci: Document NPCM SDHCI controller Tomer Maimon
2023-10-02 20:06 ` [PATCH v5 2/2] mmc: sdhci-npcm: Add NPCM SDHCI driver Tomer Maimon
@ 2023-10-10 14:27 ` Ulf Hansson
2023-10-10 19:35 ` Tomer Maimon
2 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2023-10-10 14:27 UTC (permalink / raw)
To: Tomer Maimon
Cc: avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair,
adrian.hunter, skhan, davidgow, pbrobinson, gsomlo, briannorris,
arnd, krakoczy, andy.shevchenko, openbmc, linux-mmc, devicetree,
linux-kernel
On Mon, 2 Oct 2023 at 22:06, Tomer Maimon <tmaimon77@gmail.com> wrote:
>
> 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/devicetree/msg638000.html
>
> Changes since version 4:
> - Remove unnecessary clk_disable_unprepare function.
>
> Changes since version 3:
> - Use devm_clk_get_optional_enabled function.
> - Add mod_devicetable.h.
> - Modify copyright year.
>
> 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 | 94 +++++++++++++++++++
> 4 files changed, 148 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
> create mode 100644 drivers/mmc/host/sdhci-npcm.c
>
Applied for next (and by amending patch2 to remove some commas), thanks!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/2] add NPCM SDHCI driver support
2023-10-10 14:27 ` [PATCH v5 0/2] add NPCM SDHCI driver support Ulf Hansson
@ 2023-10-10 19:35 ` Tomer Maimon
0 siblings, 0 replies; 6+ messages in thread
From: Tomer Maimon @ 2023-10-10 19:35 UTC (permalink / raw)
To: Ulf Hansson
Cc: avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair,
adrian.hunter, skhan, davidgow, pbrobinson, gsomlo, briannorris,
arnd, krakoczy, andy.shevchenko, openbmc, linux-mmc, devicetree,
linux-kernel
Thank a lot Ulf
Appreciate it!
On Tue, 10 Oct 2023 at 17:28, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Mon, 2 Oct 2023 at 22:06, Tomer Maimon <tmaimon77@gmail.com> wrote:
> >
> > 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/devicetree/msg638000.html
> >
> > Changes since version 4:
> > - Remove unnecessary clk_disable_unprepare function.
> >
> > Changes since version 3:
> > - Use devm_clk_get_optional_enabled function.
> > - Add mod_devicetable.h.
> > - Modify copyright year.
> >
> > 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 | 94 +++++++++++++++++++
> > 4 files changed, 148 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/mmc/npcm,sdhci.yaml
> > create mode 100644 drivers/mmc/host/sdhci-npcm.c
> >
>
> Applied for next (and by amending patch2 to remove some commas), thanks!
>
> Kind regards
> Uffe
^ permalink raw reply [flat|nested] 6+ messages in thread