2018-04-23 15:35:29

by Liming Sun

[permalink] [raw]
Subject: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Signed-off-by: Liming Sun <[email protected]>
---
drivers/mmc/host/Kconfig | 9 +++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..26ac6b5 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -717,6 +717,15 @@ config MMC_DW_K3
Synopsys DesignWare Memory Card Interface driver. Select this option
for platforms based on Hisilicon K3 SoC's.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_PCI
tristate "Synopsys Designware MCI support on PCI bus"
depends on MMC_DW && PCI
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..267b3f1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..12067b1
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 regs;
+
+ /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
+ regs = mci_readl(host, UHS_REG_EXT);
+ regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
+ mci_writel(host, UHS_REG_EXT, regs);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1



2018-04-23 15:37:34

by Liming Sun

[permalink] [raw]
Subject: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Signed-off-by: Liming Sun <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..ee0dd61
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ dwmmc0@4,0 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <4 0x8000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-04-23 15:39:28

by Liming Sun

[permalink] [raw]
Subject: [PATCH v2 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Signed-off-by: Liming Sun <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-04-24 01:12:50

by Shawn Lin

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension

Hi Liming,

On 2018/4/23 23:32, Liming Sun wrote:
> This commit adds extension to the dw_mmc driver for Mellanox BlueField
> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> this SoC.
>
> Signed-off-by: Liming Sun <[email protected]>
> ---
> drivers/mmc/host/Kconfig | 9 +++++
> drivers/mmc/host/Makefile | 1 +
> drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 82 insertions(+)
> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 9589f9c..26ac6b5 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -717,6 +717,15 @@ config MMC_DW_K3
> Synopsys DesignWare Memory Card Interface driver. Select this option
> for platforms based on Hisilicon K3 SoC's.
>
> +config MMC_DW_BLUEFIELD
> + tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
> + depends on MMC_DW
> + select MMC_DW_PLTFM
> + help
> + This selects support for Mellanox BlueField SoC specific extensions to
> + the Synopsys DesignWare Memory Card Interface driver. Select this
> + option for platforms based on Mellanox BlueField SoC's.
> +

It'd better to keep the order, so you could place it before
MMC_DW_EXYNOS.

> config MMC_DW_PCI
> tristate "Synopsys Designware MCI support on PCI bus"
> depends on MMC_DW && PCI
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 6aead24..267b3f1 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
> obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o

Ditto.

> obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> obj-$(CONFIG_MMC_VUB300) += vub300.o
> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
> new file mode 100644
> index 0000000..12067b1
> --- /dev/null
> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2018 Mellanox Technologies.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/mmc.h>
> +#include <linux/of.h>
> +

Ditto.

> +#include "dw_mmc.h"
> +#include "dw_mmc-pltfm.h"
> +
> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
> +{
> + u32 regs;
> +
> + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
> + regs = mci_readl(host, UHS_REG_EXT);
> + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);

GENMASK woule be more readable IMHO.

> + mci_writel(host, UHS_REG_EXT, regs);
> +}
> +
> +static const struct dw_mci_drv_data bluefield_drv_data = {
> + .set_ios = dw_mci_bluefield_set_ios
> +};
> +
> +static const struct of_device_id dw_mci_bluefield_match[] = {
> + { .compatible = "mellanox,bluefield-dw-mshc",
> + .data = &bluefield_drv_data },

Keep the indent.

> + {},
> +};
> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> +
> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> +{
> + const struct dw_mci_drv_data *drv_data = NULL;
> + const struct of_device_id *match;
> +
> + if (pdev->dev.of_node) {
> + match = of_match_node(dw_mci_bluefield_match,
> + pdev->dev.of_node);
> + drv_data = match->data;
> + }
> +
> + return dw_mci_pltfm_register(pdev, drv_data);
> +}
> +
> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> + .probe = dw_mci_bluefield_probe,
> + .remove = dw_mci_pltfm_remove,
> + .driver = {
> + .name = "dwmmc_bluefield",
> + .of_match_table = dw_mci_bluefield_match,
> + .pm = &dw_mci_pltfm_pmops,
> + },
> +};
> +
> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> +
> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> +MODULE_AUTHOR("Mellanox Technologies");
> +MODULE_LICENSE("GPL v2");
>


2018-04-27 19:52:13

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description

On Mon, Apr 23, 2018 at 11:32:21AM -0400, Liming Sun wrote:
> This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> extension on Mellanox BlueField SoC platform.

"dt-bindings: mmc: " is preferred subject prefix.

>
> Signed-off-by: Liming Sun <[email protected]>
> ---
> .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> new file mode 100644
> index 0000000..ee0dd61
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> @@ -0,0 +1,29 @@
> +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> + Mobile Storage Host Controller
> +
> +Read synopsys-dw-mshc.txt for more details
> +
> +The Synopsys designware mobile storage host controller is used to interface
> +a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
> +differences between the core Synopsys dw mshc controller properties described
> +by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
> +specific extensions to the Synopsys Designware Mobile Storage Host Controller.
> +
> +Required Properties:
> +
> +* compatible: should be one of the following.
> + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
> + specific extensions.
> +
> +Example:
> +
> + /* Mellanox Bluefield SoC MMC */
> + dwmmc0@4,0 {

mmc@...

Doesn't look like a correct unit-address either.

> + compatible = "mellanox,bluefield-dw-mshc";
> + reg = <4 0x8000 0x400>;
> + interrupts = <32>;
> + fifo-depth = <0x100>;
> + clock-frequency = <24000000>;
> + bus-width = <8>;
> + cap-mmc-highspeed;
> + };
> --
> 1.8.3.1
>

2018-04-30 14:53:33

by Liming Sun

[permalink] [raw]
Subject: [PATCH v3 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Signed-off-by: Liming Sun <[email protected]>
---
drivers/mmc/host/Kconfig | 9 +++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..26ac6b5 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -717,6 +717,15 @@ config MMC_DW_K3
Synopsys DesignWare Memory Card Interface driver. Select this option
for platforms based on Hisilicon K3 SoC's.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_PCI
tristate "Synopsys Designware MCI support on PCI bus"
depends on MMC_DW && PCI
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..267b3f1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..12067b1
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 regs;
+
+ /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
+ regs = mci_readl(host, UHS_REG_EXT);
+ regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
+ mci_writel(host, UHS_REG_EXT, regs);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1


2018-04-30 14:54:36

by Liming Sun

[permalink] [raw]
Subject: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Signed-off-by: Liming Sun <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..ee0dd61
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ dwmmc0@4,0 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <4 0x8000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-04-30 14:55:55

by Liming Sun

[permalink] [raw]
Subject: [PATCH v3 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Signed-off-by: Liming Sun <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-04-30 14:59:24

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description

Thanks. Updated in v3 2/3.

- Liming

> -----Original Message-----
> From: Rob Herring [mailto:[email protected]]
> Sent: Friday, April 27, 2018 3:51 PM
> To: Liming Sun <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT
> description
>
> On Mon, Apr 23, 2018 at 11:32:21AM -0400, Liming Sun wrote:
> > This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> > extension on Mellanox BlueField SoC platform.
>
> "dt-bindings: mmc: " is preferred subject prefix.
>
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > ---
> > .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29
> ++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-
> dw-mshc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt
> > new file mode 100644
> > index 0000000..ee0dd61
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> > @@ -0,0 +1,29 @@
> > +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> > + Mobile Storage Host Controller
> > +
> > +Read synopsys-dw-mshc.txt for more details
> > +
> > +The Synopsys designware mobile storage host controller is used to
> interface
> > +a SoC with storage medium such as eMMC or SD/MMC cards. This file
> documents
> > +differences between the core Synopsys dw mshc controller properties
> described
> > +by synopsys-dw-mshc.txt and the properties used by the Mellanox
> Bluefield SoC
> > +specific extensions to the Synopsys Designware Mobile Storage Host
> Controller.
> > +
> > +Required Properties:
> > +
> > +* compatible: should be one of the following.
> > + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield
> SoC
> > + specific extensions.
> > +
> > +Example:
> > +
> > + /* Mellanox Bluefield SoC MMC */
> > + dwmmc0@4,0 {
>
> mmc@...
>
> Doesn't look like a correct unit-address either.
>
> > + compatible = "mellanox,bluefield-dw-mshc";
> > + reg = <4 0x8000 0x400>;
> > + interrupts = <32>;
> > + fifo-depth = <0x100>;
> > + clock-frequency = <24000000>;
> > + bus-width = <8>;
> > + cap-mmc-highspeed;
> > + };
> > --
> > 1.8.3.1
> >

2018-05-01 12:48:47

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC

On Mon, Apr 30, 2018 at 10:51:07AM -0400, Liming Sun wrote:
> This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> extension on Mellanox BlueField SoC platform.
>
> Signed-off-by: Liming Sun <[email protected]>
> ---
> .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> new file mode 100644
> index 0000000..ee0dd61
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> @@ -0,0 +1,29 @@
> +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> + Mobile Storage Host Controller
> +
> +Read synopsys-dw-mshc.txt for more details
> +
> +The Synopsys designware mobile storage host controller is used to interface
> +a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
> +differences between the core Synopsys dw mshc controller properties described
> +by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
> +specific extensions to the Synopsys Designware Mobile Storage Host Controller.
> +
> +Required Properties:
> +
> +* compatible: should be one of the following.
> + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
> + specific extensions.
> +
> +Example:
> +
> + /* Mellanox Bluefield SoC MMC */
> + dwmmc0@4,0 {

Still the same issues.

mmc@...

And the unit-address looks wrong.

> + compatible = "mellanox,bluefield-dw-mshc";
> + reg = <4 0x8000 0x400>;
> + interrupts = <32>;
> + fifo-depth = <0x100>;
> + clock-frequency = <24000000>;
> + bus-width = <8>;
> + cap-mmc-highspeed;
> + };
> --
> 1.8.3.1
>

2018-05-01 14:34:57

by Liming Sun

[permalink] [raw]
Subject: [PATCH v4 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Signed-off-by: Liming Sun <[email protected]>
---
drivers/mmc/host/Kconfig | 9 +++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..26ac6b5 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -717,6 +717,15 @@ config MMC_DW_K3
Synopsys DesignWare Memory Card Interface driver. Select this option
for platforms based on Hisilicon K3 SoC's.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_PCI
tristate "Synopsys Designware MCI support on PCI bus"
depends on MMC_DW && PCI
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..267b3f1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..12067b1
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 regs;
+
+ /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
+ regs = mci_readl(host, UHS_REG_EXT);
+ regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
+ mci_writel(host, UHS_REG_EXT, regs);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1


2018-05-01 14:36:20

by Liming Sun

[permalink] [raw]
Subject: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Signed-off-by: Liming Sun <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..75bd844d
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ mmc@0x6008000 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <0x6008000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-05-01 14:37:03

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC

Sorry, my mistake. I missed the last one in the v3 comments.
Fixed it in v4 2/3.

Thanks,
Liming

> -----Original Message-----
> From: Rob Herring [mailto:[email protected]]
> Sent: Tuesday, May 1, 2018 8:48 AM
> To: Liming Sun <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC
>
> On Mon, Apr 30, 2018 at 10:51:07AM -0400, Liming Sun wrote:
> > This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> > extension on Mellanox BlueField SoC platform.
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > ---
> > .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29
> ++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-
> dw-mshc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt
> > new file mode 100644
> > index 0000000..ee0dd61
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> > @@ -0,0 +1,29 @@
> > +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> > + Mobile Storage Host Controller
> > +
> > +Read synopsys-dw-mshc.txt for more details
> > +
> > +The Synopsys designware mobile storage host controller is used to
> interface
> > +a SoC with storage medium such as eMMC or SD/MMC cards. This file
> documents
> > +differences between the core Synopsys dw mshc controller properties
> described
> > +by synopsys-dw-mshc.txt and the properties used by the Mellanox
> Bluefield SoC
> > +specific extensions to the Synopsys Designware Mobile Storage Host
> Controller.
> > +
> > +Required Properties:
> > +
> > +* compatible: should be one of the following.
> > + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield
> SoC
> > + specific extensions.
> > +
> > +Example:
> > +
> > + /* Mellanox Bluefield SoC MMC */
> > + dwmmc0@4,0 {
>
> Still the same issues.
>
> mmc@...
>
> And the unit-address looks wrong.
>
> > + compatible = "mellanox,bluefield-dw-mshc";
> > + reg = <4 0x8000 0x400>;
> > + interrupts = <32>;
> > + fifo-depth = <0x100>;
> > + clock-frequency = <24000000>;
> > + bus-width = <8>;
> > + cap-mmc-highspeed;
> > + };
> > --
> > 1.8.3.1
> >

2018-05-01 14:37:48

by Liming Sun

[permalink] [raw]
Subject: [PATCH v4 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Signed-off-by: Liming Sun <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-05-01 16:26:45

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC

On Tue, May 01, 2018 at 10:32:34AM -0400, Liming Sun wrote:
> This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> extension on Mellanox BlueField SoC platform.
>
> Signed-off-by: Liming Sun <[email protected]>
> ---
> .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> new file mode 100644
> index 0000000..75bd844d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> @@ -0,0 +1,29 @@
> +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> + Mobile Storage Host Controller
> +
> +Read synopsys-dw-mshc.txt for more details
> +
> +The Synopsys designware mobile storage host controller is used to interface
> +a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
> +differences between the core Synopsys dw mshc controller properties described
> +by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
> +specific extensions to the Synopsys Designware Mobile Storage Host Controller.
> +
> +Required Properties:
> +
> +* compatible: should be one of the following.
> + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
> + specific extensions.
> +
> +Example:
> +
> + /* Mellanox Bluefield SoC MMC */
> + mmc@0x6008000 {

Drop the '0x'.

Building your dtb with 'W=1' will warn on this.

With that,

Reviewed-by: Rob Herring <[email protected]>

> + compatible = "mellanox,bluefield-dw-mshc";
> + reg = <0x6008000 0x400>;
> + interrupts = <32>;
> + fifo-depth = <0x100>;
> + clock-frequency = <24000000>;
> + bus-width = <8>;
> + cap-mmc-highspeed;
> + };
> --
> 1.8.3.1
>

2018-05-01 18:30:02

by Liming Sun

[permalink] [raw]
Subject: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Cc: [email protected]
Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
drivers/mmc/host/Kconfig | 9 +++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
3 files changed, 82 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..26ac6b5 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -717,6 +717,15 @@ config MMC_DW_K3
Synopsys DesignWare Memory Card Interface driver. Select this option
for platforms based on Hisilicon K3 SoC's.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_PCI
tristate "Synopsys Designware MCI support on PCI bus"
depends on MMC_DW && PCI
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..267b3f1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..12067b1
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 regs;
+
+ /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
+ regs = mci_readl(host, UHS_REG_EXT);
+ regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
+ mci_writel(host, UHS_REG_EXT, regs);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1


2018-05-01 18:30:08

by Liming Sun

[permalink] [raw]
Subject: [PATCH v5 2/3] dt-bindings: mmc: Add binding for BlueField SoC

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Cc: [email protected]
Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..b0f0999
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ mmc@6008000 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <0x6008000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-05-01 18:31:23

by Liming Sun

[permalink] [raw]
Subject: [PATCH v5 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Cc: [email protected]
Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-05-01 19:10:59

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC

Thanks! Updated in v5 2/3.

> -----Original Message-----
> From: Rob Herring [mailto:[email protected]]
> Sent: Tuesday, May 1, 2018 12:25 PM
> To: Liming Sun <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC
>
> On Tue, May 01, 2018 at 10:32:34AM -0400, Liming Sun wrote:
> > This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> > extension on Mellanox BlueField SoC platform.
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > ---
> > .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29
> ++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-
> dw-mshc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-
> mshc.txt
> > new file mode 100644
> > index 0000000..75bd844d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> > @@ -0,0 +1,29 @@
> > +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> > + Mobile Storage Host Controller
> > +
> > +Read synopsys-dw-mshc.txt for more details
> > +
> > +The Synopsys designware mobile storage host controller is used to
> interface
> > +a SoC with storage medium such as eMMC or SD/MMC cards. This file
> documents
> > +differences between the core Synopsys dw mshc controller properties
> described
> > +by synopsys-dw-mshc.txt and the properties used by the Mellanox
> Bluefield SoC
> > +specific extensions to the Synopsys Designware Mobile Storage Host
> Controller.
> > +
> > +Required Properties:
> > +
> > +* compatible: should be one of the following.
> > + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield
> SoC
> > + specific extensions.
> > +
> > +Example:
> > +
> > + /* Mellanox Bluefield SoC MMC */
> > + mmc@0x6008000 {
>
> Drop the '0x'.
>
> Building your dtb with 'W=1' will warn on this.
>
> With that,
>
> Reviewed-by: Rob Herring <[email protected]>
>
> > + compatible = "mellanox,bluefield-dw-mshc";
> > + reg = <0x6008000 0x400>;
> > + interrupts = <32>;
> > + fifo-depth = <0x100>;
> > + clock-frequency = <24000000>;
> > + bus-width = <8>;
> > + cap-mmc-highspeed;
> > + };
> > --
> > 1.8.3.1
> >

2018-05-02 01:03:59

by Shawn Lin

[permalink] [raw]
Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension

On 2018/5/2 2:19, Liming Sun wrote:
> This commit adds extension to the dw_mmc driver for Mellanox BlueField
> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> this SoC.
>
> Cc: [email protected]

Why?

> Signed-off-by: Liming Sun <[email protected]>
> Reviewed-by: David Woods <[email protected]>
> ---
> drivers/mmc/host/Kconfig | 9 +++++
> drivers/mmc/host/Makefile | 1 +
> drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 82 insertions(+)
> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 9589f9c..26ac6b5 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -717,6 +717,15 @@ config MMC_DW_K3
> Synopsys DesignWare Memory Card Interface driver. Select this option
> for platforms based on Hisilicon K3 SoC's.
>
> +config MMC_DW_BLUEFIELD

And did you have feedback of my comment in V2??
http://lists-archives.com/linux-kernel/29104830-mmc-dw_mmc-bluefield-add-driver-extension.html

> + tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
> + depends on MMC_DW
> + select MMC_DW_PLTFM
> + help
> + This selects support for Mellanox BlueField SoC specific extensions to
> + the Synopsys DesignWare Memory Card Interface driver. Select this
> + option for platforms based on Mellanox BlueField SoC's.
> +
> config MMC_DW_PCI
> tristate "Synopsys Designware MCI support on PCI bus"
> depends on MMC_DW && PCI
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 6aead24..267b3f1 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
> obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> obj-$(CONFIG_MMC_VUB300) += vub300.o
> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
> new file mode 100644
> index 0000000..12067b1
> --- /dev/null
> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2018 Mellanox Technologies.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/mmc.h>
> +#include <linux/of.h>
> +
> +#include "dw_mmc.h"
> +#include "dw_mmc-pltfm.h"
> +
> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
> +{
> + u32 regs;
> +
> + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
> + regs = mci_readl(host, UHS_REG_EXT);
> + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
> + mci_writel(host, UHS_REG_EXT, regs);
> +}
> +
> +static const struct dw_mci_drv_data bluefield_drv_data = {
> + .set_ios = dw_mci_bluefield_set_ios
> +};
> +
> +static const struct of_device_id dw_mci_bluefield_match[] = {
> + { .compatible = "mellanox,bluefield-dw-mshc",
> + .data = &bluefield_drv_data },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> +
> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> +{
> + const struct dw_mci_drv_data *drv_data = NULL;
> + const struct of_device_id *match;
> +
> + if (pdev->dev.of_node) {
> + match = of_match_node(dw_mci_bluefield_match,
> + pdev->dev.of_node);
> + drv_data = match->data;
> + }
> +
> + return dw_mci_pltfm_register(pdev, drv_data);
> +}
> +
> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> + .probe = dw_mci_bluefield_probe,
> + .remove = dw_mci_pltfm_remove,
> + .driver = {
> + .name = "dwmmc_bluefield",
> + .of_match_table = dw_mci_bluefield_match,
> + .pm = &dw_mci_pltfm_pmops,
> + },
> +};
> +
> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> +
> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> +MODULE_AUTHOR("Mellanox Technologies");
> +MODULE_LICENSE("GPL v2");
>


2018-05-02 08:17:51

by Jaehoon Chung

[permalink] [raw]
Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension

Hi,

On 05/02/2018 03:19 AM, Liming Sun wrote:
> This commit adds extension to the dw_mmc driver for Mellanox BlueField
> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> this SoC.

Could you heck Shawn's comments? And add the minor comment.

>
> Cc: [email protected]
> Signed-off-by: Liming Sun <[email protected]>
> Reviewed-by: David Woods <[email protected]>
> ---
> drivers/mmc/host/Kconfig | 9 +++++
> drivers/mmc/host/Makefile | 1 +
> drivers/mmc/host/dw_mmc-bluefield.c | 72 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 82 insertions(+)
> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 9589f9c..26ac6b5 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -717,6 +717,15 @@ config MMC_DW_K3
> Synopsys DesignWare Memory Card Interface driver. Select this option
> for platforms based on Hisilicon K3 SoC's.
>
> +config MMC_DW_BLUEFIELD
> + tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
> + depends on MMC_DW
> + select MMC_DW_PLTFM
> + help
> + This selects support for Mellanox BlueField SoC specific extensions to
> + the Synopsys DesignWare Memory Card Interface driver. Select this
> + option for platforms based on Mellanox BlueField SoC's.
> +
> config MMC_DW_PCI
> tristate "Synopsys Designware MCI support on PCI bus"
> depends on MMC_DW && PCI
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 6aead24..267b3f1 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
> obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> obj-$(CONFIG_MMC_VUB300) += vub300.o
> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
> new file mode 100644
> index 0000000..12067b1
> --- /dev/null
> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2018 Mellanox Technologies.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/mmc.h>
> +#include <linux/of.h>
> +
> +#include "dw_mmc.h"
> +#include "dw_mmc-pltfm.h"
> +
> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
> +{
> + u32 regs;
> +
> + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT. */
> + regs = mci_readl(host, UHS_REG_EXT);
> + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);

I want to use the macro. Not (4 << 23)..

> + mci_writel(host, UHS_REG_EXT, regs);
> +}
> +
> +static const struct dw_mci_drv_data bluefield_drv_data = {
> + .set_ios = dw_mci_bluefield_set_ios
> +};
> +
> +static const struct of_device_id dw_mci_bluefield_match[] = {
> + { .compatible = "mellanox,bluefield-dw-mshc",
> + .data = &bluefield_drv_data },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> +
> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> +{
> + const struct dw_mci_drv_data *drv_data = NULL;
> + const struct of_device_id *match;
> +
> + if (pdev->dev.of_node) {
> + match = of_match_node(dw_mci_bluefield_match,
> + pdev->dev.of_node);
> + drv_data = match->data;
> + }
> +
> + return dw_mci_pltfm_register(pdev, drv_data);
> +}
> +
> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> + .probe = dw_mci_bluefield_probe,
> + .remove = dw_mci_pltfm_remove,
> + .driver = {
> + .name = "dwmmc_bluefield",
> + .of_match_table = dw_mci_bluefield_match,
> + .pm = &dw_mci_pltfm_pmops,
> + },
> +};
> +
> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> +
> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> +MODULE_AUTHOR("Mellanox Technologies");
> +MODULE_LICENSE("GPL v2");
>


2018-05-02 12:46:20

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension

Please see response inline.

Thanks,
Liming

> -----Original Message-----
> From: Shawn Lin [mailto:[email protected]]
> Sent: Tuesday, May 1, 2018 9:02 PM
> To: Liming Sun <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Rob Herring
> <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
>
> On 2018/5/2 2:19, Liming Sun wrote:
> > This commit adds extension to the dw_mmc driver for Mellanox BlueField
> > SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> > this SoC.
> >
> > Cc: [email protected]
>
> Why?

[Liming] This is recommended value from HW team. Without this setting, the eMMC
controller and cards can be found in Linux, but not stable. Writing to it could caused
CRC error.

>
> > Signed-off-by: Liming Sun <[email protected]>
> > Reviewed-by: David Woods <[email protected]>
> > ---
> > drivers/mmc/host/Kconfig | 9 +++++
> > drivers/mmc/host/Makefile | 1 +
> > drivers/mmc/host/dw_mmc-bluefield.c | 72
> +++++++++++++++++++++++++++++++++++++
> > 3 files changed, 82 insertions(+)
> > create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
> >
> > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> > index 9589f9c..26ac6b5 100644
> > --- a/drivers/mmc/host/Kconfig
> > +++ b/drivers/mmc/host/Kconfig
> > @@ -717,6 +717,15 @@ config MMC_DW_K3
> > Synopsys DesignWare Memory Card Interface driver. Select this
> option
> > for platforms based on Hisilicon K3 SoC's.
> >
> > +config MMC_DW_BLUEFIELD
>
> And did you have feedback of my comment in V2$B!)(B
> http://lists-archives.com/linux-kernel/29104830-mmc-dw_mmc-bluefield-
> add-driver-extension.html
>
> > + tristate "BlueField specific extensions for Synopsys DW Memory Card
> Interface"
> > + depends on MMC_DW
> > + select MMC_DW_PLTFM
> > + help
> > + This selects support for Mellanox BlueField SoC specific extensions
> to
> > + the Synopsys DesignWare Memory Card Interface driver. Select this
> > + option for platforms based on Mellanox BlueField SoC's.
> > +
> > config MMC_DW_PCI
> > tristate "Synopsys Designware MCI support on PCI bus"
> > depends on MMC_DW && PCI
> > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> > index 6aead24..267b3f1 100644
> > --- a/drivers/mmc/host/Makefile
> > +++ b/drivers/mmc/host/Makefile
> > @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-
> k3.o
> > obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> > obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> > obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> > +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> > obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> > obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> > obj-$(CONFIG_MMC_VUB300) += vub300.o
> > diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
> b/drivers/mmc/host/dw_mmc-bluefield.c
> > new file mode 100644
> > index 0000000..12067b1
> > --- /dev/null
> > +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> > @@ -0,0 +1,72 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2018 Mellanox Technologies.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/io.h>
> > +#include <linux/irq.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/mmc/host.h>
> > +#include <linux/mmc/mmc.h>
> > +#include <linux/of.h>
> > +
> > +#include "dw_mmc.h"
> > +#include "dw_mmc-pltfm.h"
> > +
> > +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
> mmc_ios *ios)
> > +{
> > + u32 regs;
> > +
> > + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
> */
> > + regs = mci_readl(host, UHS_REG_EXT);
> > + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
> > + mci_writel(host, UHS_REG_EXT, regs);
> > +}
> > +
> > +static const struct dw_mci_drv_data bluefield_drv_data = {
> > + .set_ios = dw_mci_bluefield_set_ios
> > +};
> > +
> > +static const struct of_device_id dw_mci_bluefield_match[] = {
> > + { .compatible = "mellanox,bluefield-dw-mshc",
> > + .data = &bluefield_drv_data },
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> > +
> > +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> > +{
> > + const struct dw_mci_drv_data *drv_data = NULL;
> > + const struct of_device_id *match;
> > +
> > + if (pdev->dev.of_node) {
> > + match = of_match_node(dw_mci_bluefield_match,
> > + pdev->dev.of_node);
> > + drv_data = match->data;
> > + }
> > +
> > + return dw_mci_pltfm_register(pdev, drv_data);
> > +}
> > +
> > +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> > + .probe = dw_mci_bluefield_probe,
> > + .remove = dw_mci_pltfm_remove,
> > + .driver = {
> > + .name = "dwmmc_bluefield",
> > + .of_match_table = dw_mci_bluefield_match,
> > + .pm = &dw_mci_pltfm_pmops,
> > + },
> > +};
> > +
> > +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> > +
> > +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> > +MODULE_AUTHOR("Mellanox Technologies");
> > +MODULE_LICENSE("GPL v2");
> >


2018-05-03 07:25:55

by Shawn Lin

[permalink] [raw]
Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension


On 2018/5/2 20:45, Liming Sun wrote:
> Please see response inline.
>
> Thanks,
> Liming
>
>> -----Original Message-----
>> From: Shawn Lin [mailto:[email protected]]
>> Sent: Tuesday, May 1, 2018 9:02 PM
>> To: Liming Sun <[email protected]>; Mark Rutland
>> <[email protected]>; Jaehoon Chung <[email protected]>;
>> Catalin Marinas <[email protected]>; Will Deacon
>> <[email protected]>
>> Cc: Ulf Hansson <[email protected]>; Rob Herring
>> <[email protected]>; [email protected]; linux-
>> [email protected]; [email protected]; linux-
>> [email protected]; [email protected]
>> Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
>>
>> On 2018/5/2 2:19, Liming Sun wrote:
>>> This commit adds extension to the dw_mmc driver for Mellanox BlueField
>>> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
>>> this SoC.
>>>
>>> Cc: [email protected]
>>
>> Why?
>
> [Liming] This is recommended value from HW team. Without this setting, the eMMC
> controller and cards can be found in Linux, but not stable. Writing to it could caused
> CRC error.

Well, I refered to the "Cc: [email protected]" in the commit msg.

>
>>
>>> Signed-off-by: Liming Sun <[email protected]>
>>> Reviewed-by: David Woods <[email protected]>
>>> ---
>>> drivers/mmc/host/Kconfig | 9 +++++
>>> drivers/mmc/host/Makefile | 1 +
>>> drivers/mmc/host/dw_mmc-bluefield.c | 72
>> +++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 82 insertions(+)
>>> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
>>>
>>> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
>>> index 9589f9c..26ac6b5 100644
>>> --- a/drivers/mmc/host/Kconfig
>>> +++ b/drivers/mmc/host/Kconfig
>>> @@ -717,6 +717,15 @@ config MMC_DW_K3
>>> Synopsys DesignWare Memory Card Interface driver. Select this
>> option
>>> for platforms based on Hisilicon K3 SoC's.
>>>
>>> +config MMC_DW_BLUEFIELD
>>
>> And did you have feedback of my comment in V2$B!)(B
>> http://lists-archives.com/linux-kernel/29104830-mmc-dw_mmc-bluefield-
>> add-driver-extension.html
>>
>>> + tristate "BlueField specific extensions for Synopsys DW Memory Card
>> Interface"
>>> + depends on MMC_DW
>>> + select MMC_DW_PLTFM
>>> + help
>>> + This selects support for Mellanox BlueField SoC specific extensions
>> to
>>> + the Synopsys DesignWare Memory Card Interface driver. Select this
>>> + option for platforms based on Mellanox BlueField SoC's.
>>> +
>>> config MMC_DW_PCI
>>> tristate "Synopsys Designware MCI support on PCI bus"
>>> depends on MMC_DW && PCI
>>> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
>>> index 6aead24..267b3f1 100644
>>> --- a/drivers/mmc/host/Makefile
>>> +++ b/drivers/mmc/host/Makefile
>>> @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-
>> k3.o
>>> obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
>>> obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
>>> obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
>>> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
>>> obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
>>> obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
>>> obj-$(CONFIG_MMC_VUB300) += vub300.o
>>> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
>> b/drivers/mmc/host/dw_mmc-bluefield.c
>>> new file mode 100644
>>> index 0000000..12067b1
>>> --- /dev/null
>>> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
>>> @@ -0,0 +1,72 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Copyright (C) 2018 Mellanox Technologies.
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License as published by
>>> + * the Free Software Foundation; either version 2 of the License, or
>>> + * (at your option) any later version.
>>> + */
>>> +
>>> +#include <linux/module.h>
>>> +#include <linux/io.h>
>>> +#include <linux/irq.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/pm_runtime.h>
>>> +#include <linux/mmc/host.h>
>>> +#include <linux/mmc/mmc.h>
>>> +#include <linux/of.h>
>>> +
>>> +#include "dw_mmc.h"
>>> +#include "dw_mmc-pltfm.h"
>>> +
>>> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
>> mmc_ios *ios)
>>> +{
>>> + u32 regs;
>>> +
>>> + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
>> */
>>> + regs = mci_readl(host, UHS_REG_EXT);
>>> + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
>>> + mci_writel(host, UHS_REG_EXT, regs);
>>> +}
>>> +
>>> +static const struct dw_mci_drv_data bluefield_drv_data = {
>>> + .set_ios = dw_mci_bluefield_set_ios
>>> +};
>>> +
>>> +static const struct of_device_id dw_mci_bluefield_match[] = {
>>> + { .compatible = "mellanox,bluefield-dw-mshc",
>>> + .data = &bluefield_drv_data },
>>> + {},
>>> +};
>>> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
>>> +
>>> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
>>> +{
>>> + const struct dw_mci_drv_data *drv_data = NULL;
>>> + const struct of_device_id *match;
>>> +
>>> + if (pdev->dev.of_node) {
>>> + match = of_match_node(dw_mci_bluefield_match,
>>> + pdev->dev.of_node);
>>> + drv_data = match->data;
>>> + }
>>> +
>>> + return dw_mci_pltfm_register(pdev, drv_data);
>>> +}
>>> +
>>> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
>>> + .probe = dw_mci_bluefield_probe,
>>> + .remove = dw_mci_pltfm_remove,
>>> + .driver = {
>>> + .name = "dwmmc_bluefield",
>>> + .of_match_table = dw_mci_bluefield_match,
>>> + .pm = &dw_mci_pltfm_pmops,
>>> + },
>>> +};
>>> +
>>> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
>>> +
>>> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
>>> +MODULE_AUTHOR("Mellanox Technologies");
>>> +MODULE_LICENSE("GPL v2");
>>>
>
>
>
>


2018-05-03 14:36:51

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension



> -----Original Message-----
> From: [email protected] [mailto:linux-kernel-
> [email protected]] On Behalf Of Shawn Lin
> Sent: Thursday, May 3, 2018 3:25 AM
> To: Liming Sun <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>
> Cc: [email protected]; Ulf Hansson <[email protected]>; Rob
> Herring <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
>
>
> On 2018/5/2 20:45, Liming Sun wrote:
> > Please see response inline.
> >
> > Thanks,
> > Liming
> >
> >> -----Original Message-----
> >> From: Shawn Lin [mailto:[email protected]]
> >> Sent: Tuesday, May 1, 2018 9:02 PM
> >> To: Liming Sun <[email protected]>; Mark Rutland
> >> <[email protected]>; Jaehoon Chung <[email protected]>;
> >> Catalin Marinas <[email protected]>; Will Deacon
> >> <[email protected]>
> >> Cc: Ulf Hansson <[email protected]>; Rob Herring
> >> <[email protected]>; [email protected]; linux-
> >> [email protected]; [email protected]; linux-
> >> [email protected]; [email protected]
> >> Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver
> extension
> >>
> >> On 2018/5/2 2:19, Liming Sun wrote:
> >>> This commit adds extension to the dw_mmc driver for Mellanox
> BlueField
> >>> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card
> on
> >>> this SoC.
> >>>
> >>> Cc: [email protected]
> >>
> >> Why?
> >
> > [Liming] This is recommended value from HW team. Without this setting,
> the eMMC
> > controller and cards can be found in Linux, but not stable. Writing to it could
> caused
> > CRC error.
>
> Well, I refered to the "Cc: [email protected]" in the commit msg.

[Liming] Sorry, a typo. I meant "[email protected]". Will update it in v6. Thanks!

>
> >
> >>
> >>> Signed-off-by: Liming Sun <[email protected]>
> >>> Reviewed-by: David Woods <[email protected]>
> >>> ---
> >>> drivers/mmc/host/Kconfig | 9 +++++
> >>> drivers/mmc/host/Makefile | 1 +
> >>> drivers/mmc/host/dw_mmc-bluefield.c | 72
> >> +++++++++++++++++++++++++++++++++++++
> >>> 3 files changed, 82 insertions(+)
> >>> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
> >>>
> >>> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> >>> index 9589f9c..26ac6b5 100644
> >>> --- a/drivers/mmc/host/Kconfig
> >>> +++ b/drivers/mmc/host/Kconfig
> >>> @@ -717,6 +717,15 @@ config MMC_DW_K3
> >>> Synopsys DesignWare Memory Card Interface driver. Select this
> >> option
> >>> for platforms based on Hisilicon K3 SoC's.
> >>>
> >>> +config MMC_DW_BLUEFIELD
> >>
> >> And did you have feedback of my comment in V2$B!)(B
> >> http://lists-archives.com/linux-kernel/29104830-mmc-dw_mmc-
> bluefield-
> >> add-driver-extension.html
> >>
> >>> + tristate "BlueField specific extensions for Synopsys DW Memory Card
> >> Interface"
> >>> + depends on MMC_DW
> >>> + select MMC_DW_PLTFM
> >>> + help
> >>> + This selects support for Mellanox BlueField SoC specific extensions
> >> to
> >>> + the Synopsys DesignWare Memory Card Interface driver. Select this
> >>> + option for platforms based on Mellanox BlueField SoC's.
> >>> +
> >>> config MMC_DW_PCI
> >>> tristate "Synopsys Designware MCI support on PCI bus"
> >>> depends on MMC_DW && PCI
> >>> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> >>> index 6aead24..267b3f1 100644
> >>> --- a/drivers/mmc/host/Makefile
> >>> +++ b/drivers/mmc/host/Makefile
> >>> @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) +=
> dw_mmc-
> >> k3.o
> >>> obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> >>> obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> >>> obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> >>> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> >>> obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> >>> obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> >>> obj-$(CONFIG_MMC_VUB300) += vub300.o
> >>> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
> >> b/drivers/mmc/host/dw_mmc-bluefield.c
> >>> new file mode 100644
> >>> index 0000000..12067b1
> >>> --- /dev/null
> >>> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> >>> @@ -0,0 +1,72 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >>> +/*
> >>> + * Copyright (C) 2018 Mellanox Technologies.
> >>> + *
> >>> + * This program is free software; you can redistribute it and/or modify
> >>> + * it under the terms of the GNU General Public License as published by
> >>> + * the Free Software Foundation; either version 2 of the License, or
> >>> + * (at your option) any later version.
> >>> + */
> >>> +
> >>> +#include <linux/module.h>
> >>> +#include <linux/io.h>
> >>> +#include <linux/irq.h>
> >>> +#include <linux/platform_device.h>
> >>> +#include <linux/pm_runtime.h>
> >>> +#include <linux/mmc/host.h>
> >>> +#include <linux/mmc/mmc.h>
> >>> +#include <linux/of.h>
> >>> +
> >>> +#include "dw_mmc.h"
> >>> +#include "dw_mmc-pltfm.h"
> >>> +
> >>> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
> >> mmc_ios *ios)
> >>> +{
> >>> + u32 regs;
> >>> +
> >>> + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
> >> */
> >>> + regs = mci_readl(host, UHS_REG_EXT);
> >>> + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
> >>> + mci_writel(host, UHS_REG_EXT, regs);
> >>> +}
> >>> +
> >>> +static const struct dw_mci_drv_data bluefield_drv_data = {
> >>> + .set_ios = dw_mci_bluefield_set_ios
> >>> +};
> >>> +
> >>> +static const struct of_device_id dw_mci_bluefield_match[] = {
> >>> + { .compatible = "mellanox,bluefield-dw-mshc",
> >>> + .data = &bluefield_drv_data },
> >>> + {},
> >>> +};
> >>> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> >>> +
> >>> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> >>> +{
> >>> + const struct dw_mci_drv_data *drv_data = NULL;
> >>> + const struct of_device_id *match;
> >>> +
> >>> + if (pdev->dev.of_node) {
> >>> + match = of_match_node(dw_mci_bluefield_match,
> >>> + pdev->dev.of_node);
> >>> + drv_data = match->data;
> >>> + }
> >>> +
> >>> + return dw_mci_pltfm_register(pdev, drv_data);
> >>> +}
> >>> +
> >>> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> >>> + .probe = dw_mci_bluefield_probe,
> >>> + .remove = dw_mci_pltfm_remove,
> >>> + .driver = {
> >>> + .name = "dwmmc_bluefield",
> >>> + .of_match_table = dw_mci_bluefield_match,
> >>> + .pm = &dw_mci_pltfm_pmops,
> >>> + },
> >>> +};
> >>> +
> >>> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> >>> +
> >>> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> >>> +MODULE_AUTHOR("Mellanox Technologies");
> >>> +MODULE_LICENSE("GPL v2");
> >>>
> >
> >
> >
> >


2018-05-03 15:48:26

by Liming Sun

[permalink] [raw]
Subject: [PATCH v6 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
drivers/mmc/host/Kconfig | 9 ++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 87 +++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..26ac6b5 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -717,6 +717,15 @@ config MMC_DW_K3
Synopsys DesignWare Memory Card Interface driver. Select this option
for platforms based on Hisilicon K3 SoC's.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_PCI
tristate "Synopsys Designware MCI support on PCI bus"
depends on MMC_DW && PCI
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..267b3f1 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
obj-$(CONFIG_MMC_VUB300) += vub300.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..21db031
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+#define UHS_REG_EXT_SAMPLE_WIDTH 7
+#define UHS_REG_EXT_SAMPLE_SHIFT 16
+#define UHS_REG_EXT_DRIVE_WIDTH 7
+#define UHS_REG_EXT_DRIVE_SHIFT 23
+
+#define BLUEFIELD_UHS_REG_EXT_SAMPLE 2
+#define BLUEFIELD_UHS_REG_EXT_DRIVE 4
+
+#define SET_REG_FIELD(reg, value, width, shift) \
+ ((reg) = (((reg) & ~(((1 << (width)) - 1) << (shift))) | \
+ ((value) << (shift))))
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 reg;
+
+ /* Update the Drive and Sample fields in register UHS_REG_EXT. */
+ reg = mci_readl(host, UHS_REG_EXT);
+ SET_REG_FIELD(reg, BLUEFIELD_UHS_REG_EXT_SAMPLE,
+ UHS_REG_EXT_SAMPLE_WIDTH, UHS_REG_EXT_SAMPLE_SHIFT);
+ SET_REG_FIELD(reg, BLUEFIELD_UHS_REG_EXT_DRIVE,
+ UHS_REG_EXT_DRIVE_WIDTH, UHS_REG_EXT_DRIVE_SHIFT);
+ mci_writel(host, UHS_REG_EXT, reg);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1


2018-05-03 15:49:15

by Liming Sun

[permalink] [raw]
Subject: [PATCH v6 2/3] dt-bindings: mmc: Add binding for BlueField SoC

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..b0f0999
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ mmc@6008000 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <0x6008000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-05-03 15:50:22

by Liming Sun

[permalink] [raw]
Subject: [PATCH v6 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-05-03 15:53:27

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension

Thanks. Updated in v6. Removed the "Cc: [email protected]" which is a typo. Will do it later for stable branch. Also addressed the comment to use MACROs in patch 1/3.

> -----Original Message-----
> From: Jaehoon Chung [mailto:[email protected]]
> Sent: Wednesday, May 2, 2018 4:17 AM
> To: Liming Sun <[email protected]>; Ulf Hansson
> <[email protected]>; Rob Herring <[email protected]>; Mark
> Rutland <[email protected]>; Catalin Marinas
> <[email protected]>; Will Deacon <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> Subject: Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
>
> Hi,
>
> On 05/02/2018 03:19 AM, Liming Sun wrote:
> > This commit adds extension to the dw_mmc driver for Mellanox BlueField
> > SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> > this SoC.
>
> Could you heck Shawn's comments? And add the minor comment.
>
> >
> > Cc: [email protected]
> > Signed-off-by: Liming Sun <[email protected]>
> > Reviewed-by: David Woods <[email protected]>
> > ---
> > drivers/mmc/host/Kconfig | 9 +++++
> > drivers/mmc/host/Makefile | 1 +
> > drivers/mmc/host/dw_mmc-bluefield.c | 72
> +++++++++++++++++++++++++++++++++++++
> > 3 files changed, 82 insertions(+)
> > create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
> >
> > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> > index 9589f9c..26ac6b5 100644
> > --- a/drivers/mmc/host/Kconfig
> > +++ b/drivers/mmc/host/Kconfig
> > @@ -717,6 +717,15 @@ config MMC_DW_K3
> > Synopsys DesignWare Memory Card Interface driver. Select this
> option
> > for platforms based on Hisilicon K3 SoC's.
> >
> > +config MMC_DW_BLUEFIELD
> > + tristate "BlueField specific extensions for Synopsys DW Memory Card
> Interface"
> > + depends on MMC_DW
> > + select MMC_DW_PLTFM
> > + help
> > + This selects support for Mellanox BlueField SoC specific extensions
> to
> > + the Synopsys DesignWare Memory Card Interface driver. Select this
> > + option for platforms based on Mellanox BlueField SoC's.
> > +
> > config MMC_DW_PCI
> > tristate "Synopsys Designware MCI support on PCI bus"
> > depends on MMC_DW && PCI
> > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> > index 6aead24..267b3f1 100644
> > --- a/drivers/mmc/host/Makefile
> > +++ b/drivers/mmc/host/Makefile
> > @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-
> k3.o
> > obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> > obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> > obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> > +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> > obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> > obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> > obj-$(CONFIG_MMC_VUB300) += vub300.o
> > diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
> b/drivers/mmc/host/dw_mmc-bluefield.c
> > new file mode 100644
> > index 0000000..12067b1
> > --- /dev/null
> > +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> > @@ -0,0 +1,72 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2018 Mellanox Technologies.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/io.h>
> > +#include <linux/irq.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/mmc/host.h>
> > +#include <linux/mmc/mmc.h>
> > +#include <linux/of.h>
> > +
> > +#include "dw_mmc.h"
> > +#include "dw_mmc-pltfm.h"
> > +
> > +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
> mmc_ios *ios)
> > +{
> > + u32 regs;
> > +
> > + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
> */
> > + regs = mci_readl(host, UHS_REG_EXT);
> > + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
>
> I want to use the macro. Not (4 << 23)..
>
> > + mci_writel(host, UHS_REG_EXT, regs);
> > +}
> > +
> > +static const struct dw_mci_drv_data bluefield_drv_data = {
> > + .set_ios = dw_mci_bluefield_set_ios
> > +};
> > +
> > +static const struct of_device_id dw_mci_bluefield_match[] = {
> > + { .compatible = "mellanox,bluefield-dw-mshc",
> > + .data = &bluefield_drv_data },
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> > +
> > +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> > +{
> > + const struct dw_mci_drv_data *drv_data = NULL;
> > + const struct of_device_id *match;
> > +
> > + if (pdev->dev.of_node) {
> > + match = of_match_node(dw_mci_bluefield_match,
> > + pdev->dev.of_node);
> > + drv_data = match->data;
> > + }
> > +
> > + return dw_mci_pltfm_register(pdev, drv_data);
> > +}
> > +
> > +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> > + .probe = dw_mci_bluefield_probe,
> > + .remove = dw_mci_pltfm_remove,
> > + .driver = {
> > + .name = "dwmmc_bluefield",
> > + .of_match_table = dw_mci_bluefield_match,
> > + .pm = &dw_mci_pltfm_pmops,
> > + },
> > +};
> > +
> > +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> > +
> > +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> > +MODULE_AUTHOR("Mellanox Technologies");
> > +MODULE_LICENSE("GPL v2");
> >

2018-05-08 13:08:28

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension

Sorry Shawn, somehow I missed this comment...
Will update it in v7 soon.

> -----Original Message-----
> From: Shawn Lin [mailto:[email protected]]
> Sent: Monday, April 23, 2018 9:11 PM
> To: Liming Sun <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Rob Herring
> <[email protected]>; Mark Rutland <[email protected]>; Jaehoon
> Chung <[email protected]>; Catalin Marinas
> <[email protected]>; Will Deacon <[email protected]>;
> [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
>
> Hi Liming,
>
> On 2018/4/23 23:32, Liming Sun wrote:
> > This commit adds extension to the dw_mmc driver for Mellanox BlueField
> > SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> > this SoC.
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > ---
> > drivers/mmc/host/Kconfig | 9 +++++
> > drivers/mmc/host/Makefile | 1 +
> > drivers/mmc/host/dw_mmc-bluefield.c | 72
> +++++++++++++++++++++++++++++++++++++
> > 3 files changed, 82 insertions(+)
> > create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
> >
> > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> > index 9589f9c..26ac6b5 100644
> > --- a/drivers/mmc/host/Kconfig
> > +++ b/drivers/mmc/host/Kconfig
> > @@ -717,6 +717,15 @@ config MMC_DW_K3
> > Synopsys DesignWare Memory Card Interface driver. Select this
> option
> > for platforms based on Hisilicon K3 SoC's.
> >
> > +config MMC_DW_BLUEFIELD
> > + tristate "BlueField specific extensions for Synopsys DW Memory Card
> Interface"
> > + depends on MMC_DW
> > + select MMC_DW_PLTFM
> > + help
> > + This selects support for Mellanox BlueField SoC specific extensions
> to
> > + the Synopsys DesignWare Memory Card Interface driver. Select this
> > + option for platforms based on Mellanox BlueField SoC's.
> > +
>
> It'd better to keep the order, so you could place it before
> MMC_DW_EXYNOS.
>
> > config MMC_DW_PCI
> > tristate "Synopsys Designware MCI support on PCI bus"
> > depends on MMC_DW && PCI
> > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> > index 6aead24..267b3f1 100644
> > --- a/drivers/mmc/host/Makefile
> > +++ b/drivers/mmc/host/Makefile
> > @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-
> k3.o
> > obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> > obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> > obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> > +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
>
> Ditto.
>
> > obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> > obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> > obj-$(CONFIG_MMC_VUB300) += vub300.o
> > diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
> b/drivers/mmc/host/dw_mmc-bluefield.c
> > new file mode 100644
> > index 0000000..12067b1
> > --- /dev/null
> > +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> > @@ -0,0 +1,72 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2018 Mellanox Technologies.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/io.h>
> > +#include <linux/irq.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/mmc/host.h>
> > +#include <linux/mmc/mmc.h>
> > +#include <linux/of.h>
> > +
>
> Ditto.
>
> > +#include "dw_mmc.h"
> > +#include "dw_mmc-pltfm.h"
> > +
> > +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
> mmc_ios *ios)
> > +{
> > + u32 regs;
> > +
> > + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
> */
> > + regs = mci_readl(host, UHS_REG_EXT);
> > + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
>
> GENMASK woule be more readable IMHO.
>
> > + mci_writel(host, UHS_REG_EXT, regs);
> > +}
> > +
> > +static const struct dw_mci_drv_data bluefield_drv_data = {
> > + .set_ios = dw_mci_bluefield_set_ios
> > +};
> > +
> > +static const struct of_device_id dw_mci_bluefield_match[] = {
> > + { .compatible = "mellanox,bluefield-dw-mshc",
> > + .data = &bluefield_drv_data },
>
> Keep the indent.
>
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> > +
> > +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> > +{
> > + const struct dw_mci_drv_data *drv_data = NULL;
> > + const struct of_device_id *match;
> > +
> > + if (pdev->dev.of_node) {
> > + match = of_match_node(dw_mci_bluefield_match,
> > + pdev->dev.of_node);
> > + drv_data = match->data;
> > + }
> > +
> > + return dw_mci_pltfm_register(pdev, drv_data);
> > +}
> > +
> > +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> > + .probe = dw_mci_bluefield_probe,
> > + .remove = dw_mci_pltfm_remove,
> > + .driver = {
> > + .name = "dwmmc_bluefield",
> > + .of_match_table = dw_mci_bluefield_match,
> > + .pm = &dw_mci_pltfm_pmops,
> > + },
> > +};
> > +
> > +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> > +
> > +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> > +MODULE_AUTHOR("Mellanox Technologies");
> > +MODULE_LICENSE("GPL v2");
> >


2018-05-08 18:48:59

by Liming Sun

[permalink] [raw]
Subject: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension

This commit adds extension to the dw_mmc driver for Mellanox BlueField
SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
this SoC.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
drivers/mmc/host/Kconfig | 9 +++++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/dw_mmc-bluefield.c | 81 +++++++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9589f9c..7784f76 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -690,6 +690,15 @@ config MMC_DW_PLTFM

If unsure, say Y.

+config MMC_DW_BLUEFIELD
+ tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
+ depends on MMC_DW
+ select MMC_DW_PLTFM
+ help
+ This selects support for Mellanox BlueField SoC specific extensions to
+ the Synopsys DesignWare Memory Card Interface driver. Select this
+ option for platforms based on Mellanox BlueField SoC's.
+
config MMC_DW_EXYNOS
tristate "Exynos specific extensions for Synopsys DW Memory Card Interface"
depends on MMC_DW
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6aead24..85dc132 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -49,6 +49,7 @@ thunderx-mmc-objs := cavium.o cavium-thunderx.o
obj-$(CONFIG_MMC_CAVIUM_THUNDERX) += thunderx-mmc.o
obj-$(CONFIG_MMC_DW) += dw_mmc.o
obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o
+obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
obj-$(CONFIG_MMC_DW_EXYNOS) += dw_mmc-exynos.o
obj-$(CONFIG_MMC_DW_HI3798CV200) += dw_mmc-hi3798cv200.o
obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
new file mode 100644
index 0000000..54c3fbb
--- /dev/null
+++ b/drivers/mmc/host/dw_mmc-bluefield.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Mellanox Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
+
+#define UHS_REG_EXT_SAMPLE_MASK GENMASK(22, 16)
+#define UHS_REG_EXT_DRIVE_MASK GENMASK(29, 23)
+#define BLUEFIELD_UHS_REG_EXT_SAMPLE 2
+#define BLUEFIELD_UHS_REG_EXT_DRIVE 4
+
+static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
+{
+ u32 reg;
+
+ /* Update the Drive and Sample fields in register UHS_REG_EXT. */
+ reg = mci_readl(host, UHS_REG_EXT);
+ reg &= ~UHS_REG_EXT_SAMPLE_MASK;
+ reg |= FIELD_PREP(UHS_REG_EXT_SAMPLE_MASK,
+ BLUEFIELD_UHS_REG_EXT_SAMPLE);
+ reg &= ~UHS_REG_EXT_DRIVE_MASK;
+ reg |= FIELD_PREP(UHS_REG_EXT_DRIVE_MASK, BLUEFIELD_UHS_REG_EXT_DRIVE);
+ mci_writel(host, UHS_REG_EXT, reg);
+}
+
+static const struct dw_mci_drv_data bluefield_drv_data = {
+ .set_ios = dw_mci_bluefield_set_ios
+};
+
+static const struct of_device_id dw_mci_bluefield_match[] = {
+ { .compatible = "mellanox,bluefield-dw-mshc",
+ .data = &bluefield_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
+
+static int dw_mci_bluefield_probe(struct platform_device *pdev)
+{
+ const struct dw_mci_drv_data *drv_data = NULL;
+ const struct of_device_id *match;
+
+ if (pdev->dev.of_node) {
+ match = of_match_node(dw_mci_bluefield_match,
+ pdev->dev.of_node);
+ drv_data = match->data;
+ }
+
+ return dw_mci_pltfm_register(pdev, drv_data);
+}
+
+static struct platform_driver dw_mci_bluefield_pltfm_driver = {
+ .probe = dw_mci_bluefield_probe,
+ .remove = dw_mci_pltfm_remove,
+ .driver = {
+ .name = "dwmmc_bluefield",
+ .of_match_table = dw_mci_bluefield_match,
+ .pm = &dw_mci_pltfm_pmops,
+ },
+};
+
+module_platform_driver(dw_mci_bluefield_pltfm_driver);
+
+MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
+MODULE_AUTHOR("Mellanox Technologies");
+MODULE_LICENSE("GPL v2");
--
1.8.3.1


2018-05-08 18:50:37

by Liming Sun

[permalink] [raw]
Subject: [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC

This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
extension on Mellanox BlueField SoC platform.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt

diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
new file mode 100644
index 0000000..b0f0999
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
@@ -0,0 +1,29 @@
+* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
+ Mobile Storage Host Controller
+
+Read synopsys-dw-mshc.txt for more details
+
+The Synopsys designware mobile storage host controller is used to interface
+a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
+differences between the core Synopsys dw mshc controller properties described
+by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
+specific extensions to the Synopsys Designware Mobile Storage Host Controller.
+
+Required Properties:
+
+* compatible: should be one of the following.
+ - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
+ specific extensions.
+
+Example:
+
+ /* Mellanox Bluefield SoC MMC */
+ mmc@6008000 {
+ compatible = "mellanox,bluefield-dw-mshc";
+ reg = <0x6008000 0x400>;
+ interrupts = <32>;
+ fifo-depth = <0x100>;
+ clock-frequency = <24000000>;
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ };
--
1.8.3.1


2018-05-08 18:52:07

by Liming Sun

[permalink] [raw]
Subject: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

This patch updates arm64 defconfig to enable dw_mmc-bluefield,
which is a driver extension of Synopsys Designware MMC for the
Mellanox BlueField Soc.

Signed-off-by: Liming Sun <[email protected]>
Reviewed-by: David Woods <[email protected]>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..43464ab 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
CONFIG_MMC_DW_EXYNOS=y
CONFIG_MMC_DW_K3=y
CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_DW_BLUEFIELD=y
CONFIG_MMC_SUNXI=y
CONFIG_MMC_BCM2835=y
CONFIG_MMC_SDHCI_XENON=y
--
1.8.3.1


2018-05-08 18:55:46

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension

Thanks Shawn. Patch v7 has been sent out to address these comments.

> -----Original Message-----
> From: Shawn Lin [mailto:[email protected]]
> Sent: Monday, April 23, 2018 9:11 PM
> To: Liming Sun <[email protected]>
> Cc: Ulf Hansson <[email protected]>; Rob Herring
> <[email protected]>; Mark Rutland <[email protected]>; Jaehoon
> Chung <[email protected]>; Catalin Marinas
> <[email protected]>; Will Deacon <[email protected]>;
> [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
>
> Hi Liming,
>
> On 2018/4/23 23:32, Liming Sun wrote:
> > This commit adds extension to the dw_mmc driver for Mellanox BlueField
> > SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> > this SoC.
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > ---
> > drivers/mmc/host/Kconfig | 9 +++++
> > drivers/mmc/host/Makefile | 1 +
> > drivers/mmc/host/dw_mmc-bluefield.c | 72
> +++++++++++++++++++++++++++++++++++++
> > 3 files changed, 82 insertions(+)
> > create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
> >
> > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> > index 9589f9c..26ac6b5 100644
> > --- a/drivers/mmc/host/Kconfig
> > +++ b/drivers/mmc/host/Kconfig
> > @@ -717,6 +717,15 @@ config MMC_DW_K3
> > Synopsys DesignWare Memory Card Interface driver. Select this
> option
> > for platforms based on Hisilicon K3 SoC's.
> >
> > +config MMC_DW_BLUEFIELD
> > + tristate "BlueField specific extensions for Synopsys DW Memory Card
> Interface"
> > + depends on MMC_DW
> > + select MMC_DW_PLTFM
> > + help
> > + This selects support for Mellanox BlueField SoC specific extensions
> to
> > + the Synopsys DesignWare Memory Card Interface driver. Select this
> > + option for platforms based on Mellanox BlueField SoC's.
> > +
>
> It'd better to keep the order, so you could place it before
> MMC_DW_EXYNOS.

Updated in v7 1/3.

>
> > config MMC_DW_PCI
> > tristate "Synopsys Designware MCI support on PCI bus"
> > depends on MMC_DW && PCI
> > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> > index 6aead24..267b3f1 100644
> > --- a/drivers/mmc/host/Makefile
> > +++ b/drivers/mmc/host/Makefile
> > @@ -55,6 +55,7 @@ obj-$(CONFIG_MMC_DW_K3) += dw_mmc-
> k3.o
> > obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o
> > obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o
> > obj-$(CONFIG_MMC_DW_ZX) += dw_mmc-zx.o
> > +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
>
> Ditto.

Updated in v7 1/3.

>
> > obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
> > obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
> > obj-$(CONFIG_MMC_VUB300) += vub300.o
> > diff --git a/drivers/mmc/host/dw_mmc-bluefield.c
> b/drivers/mmc/host/dw_mmc-bluefield.c
> > new file mode 100644
> > index 0000000..12067b1
> > --- /dev/null
> > +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> > @@ -0,0 +1,72 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2018 Mellanox Technologies.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/io.h>
> > +#include <linux/irq.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/mmc/host.h>
> > +#include <linux/mmc/mmc.h>
> > +#include <linux/of.h>
> > +
>
> Ditto.

Updated in v7 1/3.

>
> > +#include "dw_mmc.h"
> > +#include "dw_mmc-pltfm.h"
> > +
> > +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct
> mmc_ios *ios)
> > +{
> > + u32 regs;
> > +
> > + /* Set drive=4 (bit 29:23) and sample=2 (bit 22:16) in UHS_REG_EXT.
> */
> > + regs = mci_readl(host, UHS_REG_EXT);
> > + regs = (regs & ~0x3F100000 & ~0x7F0000) | (4 << 23) | (2 << 16);
>
> GENMASK woule be more readable IMHO.

Updated in v7 1/3.

>
> > + mci_writel(host, UHS_REG_EXT, regs);
> > +}
> > +
> > +static const struct dw_mci_drv_data bluefield_drv_data = {
> > + .set_ios = dw_mci_bluefield_set_ios
> > +};
> > +
> > +static const struct of_device_id dw_mci_bluefield_match[] = {
> > + { .compatible = "mellanox,bluefield-dw-mshc",
> > + .data = &bluefield_drv_data },
>
> Keep the indent.

Updated in v7 1/3, assuming this comment is to let the ".data" aligned with the ".compatible".

>
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> > +
> > +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> > +{
> > + const struct dw_mci_drv_data *drv_data = NULL;
> > + const struct of_device_id *match;
> > +
> > + if (pdev->dev.of_node) {
> > + match = of_match_node(dw_mci_bluefield_match,
> > + pdev->dev.of_node);
> > + drv_data = match->data;
> > + }
> > +
> > + return dw_mci_pltfm_register(pdev, drv_data);
> > +}
> > +
> > +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> > + .probe = dw_mci_bluefield_probe,
> > + .remove = dw_mci_pltfm_remove,
> > + .driver = {
> > + .name = "dwmmc_bluefield",
> > + .of_match_table = dw_mci_bluefield_match,
> > + .pm = &dw_mci_pltfm_pmops,
> > + },
> > +};
> > +
> > +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> > +
> > +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> > +MODULE_AUTHOR("Mellanox Technologies");
> > +MODULE_LICENSE("GPL v2");
> >


2018-05-09 01:46:16

by Shawn Lin

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension


On 2018/5/9 2:46, Liming Sun wrote:
> This commit adds extension to the dw_mmc driver for Mellanox BlueField
> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> this SoC.
>

Reviewed-by: Shawn Lin <[email protected]>





2018-05-21 11:38:16

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension

On 8 May 2018 at 20:46, Liming Sun <[email protected]> wrote:
> This commit adds extension to the dw_mmc driver for Mellanox BlueField
> SoC. It updates the UHS_REG_EXT register to bring up the eMMC card on
> this SoC.
>
> Signed-off-by: Liming Sun <[email protected]>
> Reviewed-by: David Woods <[email protected]>

Thanks, applied for next!

Kind regards
Uffe

> ---
> drivers/mmc/host/Kconfig | 9 +++++
> drivers/mmc/host/Makefile | 1 +
> drivers/mmc/host/dw_mmc-bluefield.c | 81 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 91 insertions(+)
> create mode 100644 drivers/mmc/host/dw_mmc-bluefield.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 9589f9c..7784f76 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -690,6 +690,15 @@ config MMC_DW_PLTFM
>
> If unsure, say Y.
>
> +config MMC_DW_BLUEFIELD
> + tristate "BlueField specific extensions for Synopsys DW Memory Card Interface"
> + depends on MMC_DW
> + select MMC_DW_PLTFM
> + help
> + This selects support for Mellanox BlueField SoC specific extensions to
> + the Synopsys DesignWare Memory Card Interface driver. Select this
> + option for platforms based on Mellanox BlueField SoC's.
> +
> config MMC_DW_EXYNOS
> tristate "Exynos specific extensions for Synopsys DW Memory Card Interface"
> depends on MMC_DW
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 6aead24..85dc132 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -49,6 +49,7 @@ thunderx-mmc-objs := cavium.o cavium-thunderx.o
> obj-$(CONFIG_MMC_CAVIUM_THUNDERX) += thunderx-mmc.o
> obj-$(CONFIG_MMC_DW) += dw_mmc.o
> obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o
> +obj-$(CONFIG_MMC_DW_BLUEFIELD) += dw_mmc-bluefield.o
> obj-$(CONFIG_MMC_DW_EXYNOS) += dw_mmc-exynos.o
> obj-$(CONFIG_MMC_DW_HI3798CV200) += dw_mmc-hi3798cv200.o
> obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o
> diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c
> new file mode 100644
> index 0000000..54c3fbb
> --- /dev/null
> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> @@ -0,0 +1,81 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2018 Mellanox Technologies.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/bitops.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/mmc.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +
> +#include "dw_mmc.h"
> +#include "dw_mmc-pltfm.h"
> +
> +#define UHS_REG_EXT_SAMPLE_MASK GENMASK(22, 16)
> +#define UHS_REG_EXT_DRIVE_MASK GENMASK(29, 23)
> +#define BLUEFIELD_UHS_REG_EXT_SAMPLE 2
> +#define BLUEFIELD_UHS_REG_EXT_DRIVE 4
> +
> +static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
> +{
> + u32 reg;
> +
> + /* Update the Drive and Sample fields in register UHS_REG_EXT. */
> + reg = mci_readl(host, UHS_REG_EXT);
> + reg &= ~UHS_REG_EXT_SAMPLE_MASK;
> + reg |= FIELD_PREP(UHS_REG_EXT_SAMPLE_MASK,
> + BLUEFIELD_UHS_REG_EXT_SAMPLE);
> + reg &= ~UHS_REG_EXT_DRIVE_MASK;
> + reg |= FIELD_PREP(UHS_REG_EXT_DRIVE_MASK, BLUEFIELD_UHS_REG_EXT_DRIVE);
> + mci_writel(host, UHS_REG_EXT, reg);
> +}
> +
> +static const struct dw_mci_drv_data bluefield_drv_data = {
> + .set_ios = dw_mci_bluefield_set_ios
> +};
> +
> +static const struct of_device_id dw_mci_bluefield_match[] = {
> + { .compatible = "mellanox,bluefield-dw-mshc",
> + .data = &bluefield_drv_data },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
> +
> +static int dw_mci_bluefield_probe(struct platform_device *pdev)
> +{
> + const struct dw_mci_drv_data *drv_data = NULL;
> + const struct of_device_id *match;
> +
> + if (pdev->dev.of_node) {
> + match = of_match_node(dw_mci_bluefield_match,
> + pdev->dev.of_node);
> + drv_data = match->data;
> + }
> +
> + return dw_mci_pltfm_register(pdev, drv_data);
> +}
> +
> +static struct platform_driver dw_mci_bluefield_pltfm_driver = {
> + .probe = dw_mci_bluefield_probe,
> + .remove = dw_mci_pltfm_remove,
> + .driver = {
> + .name = "dwmmc_bluefield",
> + .of_match_table = dw_mci_bluefield_match,
> + .pm = &dw_mci_pltfm_pmops,
> + },
> +};
> +
> +module_platform_driver(dw_mci_bluefield_pltfm_driver);
> +
> +MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
> +MODULE_AUTHOR("Mellanox Technologies");
> +MODULE_LICENSE("GPL v2");
> --
> 1.8.3.1
>

2018-05-21 11:38:37

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

On 8 May 2018 at 20:46, Liming Sun <[email protected]> wrote:
> This patch updates arm64 defconfig to enable dw_mmc-bluefield,
> which is a driver extension of Synopsys Designware MMC for the
> Mellanox BlueField Soc.
>
> Signed-off-by: Liming Sun <[email protected]>
> Reviewed-by: David Woods <[email protected]>

I have applied the other parts in the series, but not this one as it's
probably better it goes via arm soc.

I can take it, but then I need an ack from arm64 folkz...

Kind regards
Uffe

> ---
> arch/arm64/configs/defconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index ecf6137..43464ab 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
> CONFIG_MMC_DW_EXYNOS=y
> CONFIG_MMC_DW_K3=y
> CONFIG_MMC_DW_ROCKCHIP=y
> +CONFIG_MMC_DW_BLUEFIELD=y
> CONFIG_MMC_SUNXI=y
> CONFIG_MMC_BCM2835=y
> CONFIG_MMC_SDHCI_XENON=y
> --
> 1.8.3.1
>

2018-05-21 11:39:01

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC

On 8 May 2018 at 20:46, Liming Sun <[email protected]> wrote:
> This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> extension on Mellanox BlueField SoC platform.
>
> Signed-off-by: Liming Sun <[email protected]>
> Reviewed-by: David Woods <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>

Thanks, applied for next!

Kind regards
Uffe

> ---
> .../devicetree/bindings/mmc/bluefield-dw-mshc.txt | 29 ++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> new file mode 100644
> index 0000000..b0f0999
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/bluefield-dw-mshc.txt
> @@ -0,0 +1,29 @@
> +* Mellanox Bluefield SoC specific extensions to the Synopsys Designware
> + Mobile Storage Host Controller
> +
> +Read synopsys-dw-mshc.txt for more details
> +
> +The Synopsys designware mobile storage host controller is used to interface
> +a SoC with storage medium such as eMMC or SD/MMC cards. This file documents
> +differences between the core Synopsys dw mshc controller properties described
> +by synopsys-dw-mshc.txt and the properties used by the Mellanox Bluefield SoC
> +specific extensions to the Synopsys Designware Mobile Storage Host Controller.
> +
> +Required Properties:
> +
> +* compatible: should be one of the following.
> + - "mellanox,bluefield-dw-mshc": for controllers with Mellanox Bluefield SoC
> + specific extensions.
> +
> +Example:
> +
> + /* Mellanox Bluefield SoC MMC */
> + mmc@6008000 {
> + compatible = "mellanox,bluefield-dw-mshc";
> + reg = <0x6008000 0x400>;
> + interrupts = <32>;
> + fifo-depth = <0x100>;
> + clock-frequency = <24000000>;
> + bus-width = <8>;
> + cap-mmc-highspeed;
> + };
> --
> 1.8.3.1
>

2018-05-21 19:37:23

by Liming Sun

[permalink] [raw]
Subject: RE: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver

Thanks! I'll try to send this one to arm soc.

Best regards,
Liming

> -----Original Message-----
> From: Ulf Hansson [mailto:[email protected]]
> Sent: Monday, May 21, 2018 7:36 AM
> To: Liming Sun <[email protected]>
> Cc: Rob Herring <[email protected]>; Mark Rutland
> <[email protected]>; Jaehoon Chung <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected];
> [email protected]; Linux Kernel Mailing List <linux-
> [email protected]>
> Subject: Re: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield
> driver
>
> On 8 May 2018 at 20:46, Liming Sun <[email protected]> wrote:
> > This patch updates arm64 defconfig to enable dw_mmc-bluefield,
> > which is a driver extension of Synopsys Designware MMC for the
> > Mellanox BlueField Soc.
> >
> > Signed-off-by: Liming Sun <[email protected]>
> > Reviewed-by: David Woods <[email protected]>
>
> I have applied the other parts in the series, but not this one as it's
> probably better it goes via arm soc.
>
> I can take it, but then I need an ack from arm64 folkz...
>
> Kind regards
> Uffe
>
> > ---
> > arch/arm64/configs/defconfig | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> > index ecf6137..43464ab 100644
> > --- a/arch/arm64/configs/defconfig
> > +++ b/arch/arm64/configs/defconfig
> > @@ -487,6 +487,7 @@ CONFIG_MMC_DW=y
> > CONFIG_MMC_DW_EXYNOS=y
> > CONFIG_MMC_DW_K3=y
> > CONFIG_MMC_DW_ROCKCHIP=y
> > +CONFIG_MMC_DW_BLUEFIELD=y
> > CONFIG_MMC_SUNXI=y
> > CONFIG_MMC_BCM2835=y
> > CONFIG_MMC_SDHCI_XENON=y
> > --
> > 1.8.3.1
> >

2019-01-18 10:08:19

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension

Liming,

On Tue, 8 May 2018, Liming Sun wrote:
> index 0000000..54c3fbb
> --- /dev/null
> +++ b/drivers/mmc/host/dw_mmc-bluefield.c
> @@ -0,0 +1,81 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2018 Mellanox Technologies.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */

This license information is broken. The SPDX license identifier and the
boiler plate text are contradicting. The SPDX id is GPL v2 only and the
boiler plate says v2 or later.

Please decide which version you want and fix ASAP. If you fix that up
please add a Fixes: tag and cc stable. While at it please remove the boiler
plate text as the SPDX id is sufficient and the boiler plate is redundant
information.

See Documentation/process/license-rules.txt

Thanks,

tglx