All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
@ 2018-04-23 15:32 Liming Sun
  2018-04-23 15:32 ` [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description Liming Sun
                   ` (17 more replies)
  0 siblings, 18 replies; 40+ messages in thread
From: Liming Sun @ 2018-04-23 15:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-04-23 15:32 ` Liming Sun
  2018-04-27 19:50   ` Rob Herring
  2018-04-23 15:32 ` [PATCH v2 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-04-23 15:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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

Signed-off-by: Liming Sun <lsun@mellanox.com>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v2 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
  2018-04-23 15:32 ` [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description Liming Sun
@ 2018-04-23 15:32 ` Liming Sun
  2018-04-24  1:11 ` [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Shawn Lin
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-04-23 15:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
  2018-04-23 15:32 ` [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description Liming Sun
  2018-04-23 15:32 ` [PATCH v2 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-04-24  1:11 ` Shawn Lin
  2018-05-08 13:06   ` Liming Sun
  2018-05-08 18:55   ` Liming Sun
  2018-04-30 14:51 ` [PATCH v3 " Liming Sun
                   ` (14 subsequent siblings)
  17 siblings, 2 replies; 40+ messages in thread
From: Shawn Lin @ 2018-04-24  1:11 UTC (permalink / raw)
  To: Liming Sun
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon, shawn.lin, linux-mmc, devicetree,
	linux-kernel

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 <lsun@mellanox.com>
> ---
>   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");
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description
  2018-04-23 15:32 ` [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description Liming Sun
@ 2018-04-27 19:50   ` Rob Herring
  2018-04-30 14:57     ` Liming Sun
  0 siblings, 1 reply; 40+ messages in thread
From: Rob Herring @ 2018-04-27 19:50 UTC (permalink / raw)
  To: Liming Sun
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
> ---
>  .../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
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v3 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (2 preceding siblings ...)
  2018-04-24  1:11 ` [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Shawn Lin
@ 2018-04-30 14:51 ` Liming Sun
  2018-04-30 14:51 ` [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-04-30 14:51 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (3 preceding siblings ...)
  2018-04-30 14:51 ` [PATCH v3 " Liming Sun
@ 2018-04-30 14:51 ` Liming Sun
  2018-05-01 12:48   ` Rob Herring
  2018-04-30 14:51 ` [PATCH v3 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-04-30 14:51 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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

Signed-off-by: Liming Sun <lsun@mellanox.com>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v3 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (4 preceding siblings ...)
  2018-04-30 14:51 ` [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-04-30 14:51 ` Liming Sun
  2018-05-01 14:32 ` [PATCH v4 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-04-30 14:51 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description
  2018-04-27 19:50   ` Rob Herring
@ 2018-04-30 14:57     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-04-30 14:57 UTC (permalink / raw)
  To: Rob Herring
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

Thanks. Updated in v3 2/3.

- Liming

> -----Original Message-----
> From: Rob Herring [mailto:robh@kernel.org]
> Sent: Friday, April 27, 2018 3:51 PM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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 <lsun@mellanox.com>
> > ---
> >  .../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
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-30 14:51 ` [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-01 12:48   ` Rob Herring
  2018-05-01 14:36     ` Liming Sun
  0 siblings, 1 reply; 40+ messages in thread
From: Rob Herring @ 2018-05-01 12:48 UTC (permalink / raw)
  To: Liming Sun
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
> ---
>  .../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
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v4 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (5 preceding siblings ...)
  2018-04-30 14:51 ` [PATCH v3 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-05-01 14:32 ` Liming Sun
  2018-05-01 14:32 ` [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 14:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (6 preceding siblings ...)
  2018-05-01 14:32 ` [PATCH v4 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-01 14:32 ` Liming Sun
  2018-05-01 16:24   ` Rob Herring
  2018-05-01 14:32 ` [PATCH v4 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-05-01 14:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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

Signed-off-by: Liming Sun <lsun@mellanox.com>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v4 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (7 preceding siblings ...)
  2018-05-01 14:32 ` [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-01 14:32 ` Liming Sun
  2018-05-01 18:19 ` [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 14:32 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-05-01 12:48   ` Rob Herring
@ 2018-05-01 14:36     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 14:36 UTC (permalink / raw)
  To: Rob Herring
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

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:robh@kernel.org]
> Sent: Tuesday, May 1, 2018 8:48 AM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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 <lsun@mellanox.com>
> > ---
> >  .../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
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-05-01 14:32 ` [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-01 16:24   ` Rob Herring
  2018-05-01 19:10     ` Liming Sun
  0 siblings, 1 reply; 40+ messages in thread
From: Rob Herring @ 2018-05-01 16:24 UTC (permalink / raw)
  To: Liming Sun
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
> ---
>  .../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 <robh@kernel.org>

> +		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
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (8 preceding siblings ...)
  2018-05-01 14:32 ` [PATCH v4 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-05-01 18:19 ` Liming Sun
  2018-05-02  1:02   ` Shawn Lin
  2018-05-02  8:16   ` Jaehoon Chung
  2018-05-01 18:19 ` [PATCH v5 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
                   ` (7 subsequent siblings)
  17 siblings, 2 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 18:19 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel, stable

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: stable@kernel.org
Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (9 preceding siblings ...)
  2018-05-01 18:19 ` [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-01 18:19 ` Liming Sun
  2018-05-01 18:19 ` [PATCH v5 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 18:19 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel, stable

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

Cc: stable@kernel.org
Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v5 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (10 preceding siblings ...)
  2018-05-01 18:19 ` [PATCH v5 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-01 18:19 ` Liming Sun
  2018-05-03 15:45 ` [PATCH v6 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 18:19 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel, stable

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: stable@kernel.org
Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-05-01 16:24   ` Rob Herring
@ 2018-05-01 19:10     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-01 19:10 UTC (permalink / raw)
  To: Rob Herring
  Cc: Ulf Hansson, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, linux-kernel

Thanks! Updated in v5 2/3.

> -----Original Message-----
> From: Rob Herring [mailto:robh@kernel.org]
> Sent: Tuesday, May 1, 2018 12:25 PM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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 <lsun@mellanox.com>
> > ---
> >  .../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 <robh@kernel.org>
> 
> > +		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
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-01 18:19 ` [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-02  1:02   ` Shawn Lin
  2018-05-02 12:45     ` Liming Sun
  2018-05-02  8:16   ` Jaehoon Chung
  1 sibling, 1 reply; 40+ messages in thread
From: Shawn Lin @ 2018-05-02  1:02 UTC (permalink / raw)
  To: Liming Sun, Mark Rutland, Jaehoon Chung, Catalin Marinas, Will Deacon
  Cc: Ulf Hansson, Rob Herring, shawn.lin, linux-mmc, devicetree,
	linux-kernel, stable

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: stable@kernel.org

Why?

> Signed-off-by: Liming Sun <lsun@mellanox.com>
> Reviewed-by: David Woods <dwoods@mellanox.com>
> ---
>   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");
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-01 18:19 ` [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
  2018-05-02  1:02   ` Shawn Lin
@ 2018-05-02  8:16   ` Jaehoon Chung
  2018-05-03 15:52     ` Liming Sun
  1 sibling, 1 reply; 40+ messages in thread
From: Jaehoon Chung @ 2018-05-02  8:16 UTC (permalink / raw)
  To: Liming Sun, Ulf Hansson, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon
  Cc: linux-mmc, devicetree, linux-kernel, stable

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: stable@kernel.org
> Signed-off-by: Liming Sun <lsun@mellanox.com>
> Reviewed-by: David Woods <dwoods@mellanox.com>
> ---
>  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");
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-02  1:02   ` Shawn Lin
@ 2018-05-02 12:45     ` Liming Sun
  2018-05-03  7:25       ` Shawn Lin
  0 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-05-02 12:45 UTC (permalink / raw)
  To: Shawn Lin, Mark Rutland, Jaehoon Chung, Catalin Marinas, Will Deacon
  Cc: Ulf Hansson, Rob Herring, linux-mmc, devicetree, linux-kernel, stable

Please see response inline.

Thanks,
Liming

> -----Original Message-----
> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
> Sent: Tuesday, May 1, 2018 9:02 PM
> To: Liming Sun <lsun@mellanox.com>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
> <robh+dt@kernel.org>; shawn.lin@rock-chips.com; linux-
> mmc@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; stable@kernel.org
> 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: stable@kernel.org
> 
> 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 <lsun@mellanox.com>
> > Reviewed-by: David Woods <dwoods@mellanox.com>
> > ---
> >   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");
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-02 12:45     ` Liming Sun
@ 2018-05-03  7:25       ` Shawn Lin
  2018-05-03 14:35         ` Liming Sun
  0 siblings, 1 reply; 40+ messages in thread
From: Shawn Lin @ 2018-05-03  7:25 UTC (permalink / raw)
  To: Liming Sun, Mark Rutland, Jaehoon Chung, Catalin Marinas, Will Deacon
  Cc: shawn.lin, Ulf Hansson, Rob Herring, linux-mmc, devicetree, linux-kernel


On 2018/5/2 20:45, Liming Sun wrote:
> Please see response inline.
> 
> Thanks,
> Liming
> 
>> -----Original Message-----
>> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
>> Sent: Tuesday, May 1, 2018 9:02 PM
>> To: Liming Sun <lsun@mellanox.com>; Mark Rutland
>> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
>> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
>> <will.deacon@arm.com>
>> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
>> <robh+dt@kernel.org>; shawn.lin@rock-chips.com; linux-
>> mmc@vger.kernel.org; devicetree@vger.kernel.org; linux-
>> kernel@vger.kernel.org; stable@kernel.org
>> 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: stable@kernel.org
>>
>> 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: stable@kernel.org" in the commit msg.

> 
>>
>>> Signed-off-by: Liming Sun <lsun@mellanox.com>
>>> Reviewed-by: David Woods <dwoods@mellanox.com>
>>> ---
>>>    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");
>>>
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 40+ messages in thread

* RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-03  7:25       ` Shawn Lin
@ 2018-05-03 14:35         ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-03 14:35 UTC (permalink / raw)
  To: Shawn Lin, Mark Rutland, Jaehoon Chung, Catalin Marinas, Will Deacon
  Cc: Ulf Hansson, Rob Herring, linux-mmc, devicetree, linux-kernel



> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
> owner@vger.kernel.org] On Behalf Of Shawn Lin
> Sent: Thursday, May 3, 2018 3:25 AM
> To: Liming Sun <lsun@mellanox.com>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>
> Cc: shawn.lin@rock-chips.com; Ulf Hansson <ulf.hansson@linaro.org>; Rob
> Herring <robh+dt@kernel.org>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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:shawn.lin@rock-chips.com]
> >> Sent: Tuesday, May 1, 2018 9:02 PM
> >> To: Liming Sun <lsun@mellanox.com>; Mark Rutland
> >> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> >> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> >> <will.deacon@arm.com>
> >> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
> >> <robh+dt@kernel.org>; shawn.lin@rock-chips.com; linux-
> >> mmc@vger.kernel.org; devicetree@vger.kernel.org; linux-
> >> kernel@vger.kernel.org; stable@kernel.org
> >> 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: stable@kernel.org
> >>
> >> 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: stable@kernel.org" in the commit msg.

[Liming] Sorry, a typo.  I meant "stable@vger.kernel.org". Will update it in v6. Thanks!

> 
> >
> >>
> >>> Signed-off-by: Liming Sun <lsun@mellanox.com>
> >>> Reviewed-by: David Woods <dwoods@mellanox.com>
> >>> ---
> >>>    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");
> >>>
> >
> >
> >
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v6 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (11 preceding siblings ...)
  2018-05-01 18:19 ` [PATCH v5 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-05-03 15:45 ` Liming Sun
  2018-05-03 15:45 ` [PATCH v6 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-03 15:45 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v6 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (12 preceding siblings ...)
  2018-05-03 15:45 ` [PATCH v6 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-03 15:45 ` Liming Sun
  2018-05-03 15:45 ` [PATCH v6 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-03 15:45 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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

Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v6 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (13 preceding siblings ...)
  2018-05-03 15:45 ` [PATCH v6 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-03 15:45 ` Liming Sun
  2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-03 15:45 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-02  8:16   ` Jaehoon Chung
@ 2018-05-03 15:52     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-03 15:52 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson, Rob Herring, Mark Rutland,
	Catalin Marinas, Will Deacon
  Cc: linux-mmc, devicetree, linux-kernel

Thanks. Updated in v6. Removed the "Cc: stable@kernel.org" 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:jh80.chung@samsung.com]
> Sent: Wednesday, May 2, 2018 4:17 AM
> To: Liming Sun <lsun@mellanox.com>; Ulf Hansson
> <ulf.hansson@linaro.org>; Rob Herring <robh+dt@kernel.org>; Mark
> Rutland <mark.rutland@arm.com>; Catalin Marinas
> <catalin.marinas@arm.com>; Will Deacon <will.deacon@arm.com>
> Cc: linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; stable@kernel.org
> 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: stable@kernel.org
> > Signed-off-by: Liming Sun <lsun@mellanox.com>
> > Reviewed-by: David Woods <dwoods@mellanox.com>
> > ---
> >  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");
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* RE: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-24  1:11 ` [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Shawn Lin
@ 2018-05-08 13:06   ` Liming Sun
  2018-05-08 18:55   ` Liming Sun
  1 sibling, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-08 13:06 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon, linux-mmc, devicetree,
	linux-kernel

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

> -----Original Message-----
> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
> Sent: Monday, April 23, 2018 9:11 PM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Jaehoon
> Chung <jh80.chung@samsung.com>; Catalin Marinas
> <catalin.marinas@arm.com>; Will Deacon <will.deacon@arm.com>;
> shawn.lin@rock-chips.com; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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 <lsun@mellanox.com>
> > ---
> >   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");
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (14 preceding siblings ...)
  2018-05-03 15:45 ` [PATCH v6 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-05-08 18:46 ` Liming Sun
  2018-05-09  1:45   ` Shawn Lin
                     ` (2 more replies)
  2018-05-08 18:46 ` [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
  2018-05-08 18:46 ` [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
  17 siblings, 3 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-08 18:46 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (15 preceding siblings ...)
  2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-08 18:46 ` Liming Sun
  2018-05-21 11:36   ` Ulf Hansson
  2018-05-08 18:46 ` [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
  17 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-05-08 18:46 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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

Signed-off-by: Liming Sun <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
                   ` (16 preceding siblings ...)
  2018-05-08 18:46 ` [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-08 18:46 ` Liming Sun
  2018-05-21 11:36   ` Ulf Hansson
  17 siblings, 1 reply; 40+ messages in thread
From: Liming Sun @ 2018-05-08 18:46 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon
  Cc: Liming Sun, linux-mmc, devicetree, linux-kernel

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 <lsun@mellanox.com>
Reviewed-by: David Woods <dwoods@mellanox.com>
---
 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

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* RE: [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-04-24  1:11 ` [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Shawn Lin
  2018-05-08 13:06   ` Liming Sun
@ 2018-05-08 18:55   ` Liming Sun
  1 sibling, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-08 18:55 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon, linux-mmc, devicetree,
	linux-kernel

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

> -----Original Message-----
> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
> Sent: Monday, April 23, 2018 9:11 PM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>; Rob Herring
> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Jaehoon
> Chung <jh80.chung@samsung.com>; Catalin Marinas
> <catalin.marinas@arm.com>; Will Deacon <will.deacon@arm.com>;
> shawn.lin@rock-chips.com; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> 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 <lsun@mellanox.com>
> > ---
> >   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");
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
@ 2018-05-09  1:45   ` Shawn Lin
  2018-05-21 11:36   ` Ulf Hansson
  2019-01-18 10:06   ` Thomas Gleixner
  2 siblings, 0 replies; 40+ messages in thread
From: Shawn Lin @ 2018-05-09  1:45 UTC (permalink / raw)
  To: Liming Sun, Will Deacon
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, shawn.lin, linux-mmc, devicetree, linux-kernel


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 <shawn.lin@rock-chips.com>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
  2018-05-09  1:45   ` Shawn Lin
@ 2018-05-21 11:36   ` Ulf Hansson
  2019-01-18 10:06   ` Thomas Gleixner
  2 siblings, 0 replies; 40+ messages in thread
From: Ulf Hansson @ 2018-05-21 11:36 UTC (permalink / raw)
  To: Liming Sun
  Cc: Rob Herring, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, Linux Kernel Mailing List

On 8 May 2018 at 20:46, Liming Sun <lsun@mellanox.com> 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 <lsun@mellanox.com>
> Reviewed-by: David Woods <dwoods@mellanox.com>

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
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC
  2018-05-08 18:46 ` [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
@ 2018-05-21 11:36   ` Ulf Hansson
  0 siblings, 0 replies; 40+ messages in thread
From: Ulf Hansson @ 2018-05-21 11:36 UTC (permalink / raw)
  To: Liming Sun
  Cc: Rob Herring, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, Linux Kernel Mailing List

On 8 May 2018 at 20:46, Liming Sun <lsun@mellanox.com> wrote:
> This commit adds "mellanox,bluefield-dw-mshc" for dwmmc driver
> extension on Mellanox BlueField SoC platform.
>
> Signed-off-by: Liming Sun <lsun@mellanox.com>
> Reviewed-by: David Woods <dwoods@mellanox.com>
> Reviewed-by: Rob Herring <robh@kernel.org>

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
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-05-08 18:46 ` [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
@ 2018-05-21 11:36   ` Ulf Hansson
  2018-05-21 19:35     ` Liming Sun
  0 siblings, 1 reply; 40+ messages in thread
From: Ulf Hansson @ 2018-05-21 11:36 UTC (permalink / raw)
  To: Liming Sun
  Cc: Rob Herring, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, Linux Kernel Mailing List

On 8 May 2018 at 20:46, Liming Sun <lsun@mellanox.com> 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 <lsun@mellanox.com>
> Reviewed-by: David Woods <dwoods@mellanox.com>

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
>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* RE: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver
  2018-05-21 11:36   ` Ulf Hansson
@ 2018-05-21 19:35     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2018-05-21 19:35 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rob Herring, Mark Rutland, Jaehoon Chung, Catalin Marinas,
	Will Deacon, linux-mmc, devicetree, Linux Kernel Mailing List

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

Best regards,
Liming

> -----Original Message-----
> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
> Sent: Monday, May 21, 2018 7:36 AM
> To: Liming Sun <lsun@mellanox.com>
> Cc: Rob Herring <robh+dt@kernel.org>; Mark Rutland
> <mark.rutland@arm.com>; Jaehoon Chung <jh80.chung@samsung.com>;
> Catalin Marinas <catalin.marinas@arm.com>; Will Deacon
> <will.deacon@arm.com>; linux-mmc@vger.kernel.org;
> devicetree@vger.kernel.org; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield
> driver
> 
> On 8 May 2018 at 20:46, Liming Sun <lsun@mellanox.com> 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 <lsun@mellanox.com>
> > Reviewed-by: David Woods <dwoods@mellanox.com>
> 
> 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
> >

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
  2018-05-09  1:45   ` Shawn Lin
  2018-05-21 11:36   ` Ulf Hansson
@ 2019-01-18 10:06   ` Thomas Gleixner
  2019-01-18 18:14     ` Liming Sun
  2 siblings, 1 reply; 40+ messages in thread
From: Thomas Gleixner @ 2019-01-18 10:06 UTC (permalink / raw)
  To: Liming Sun
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon, linux-mmc, devicetree, LKML,
	Greg KH, Kate Stewart

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

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension
  2019-01-18 10:06   ` Thomas Gleixner
@ 2019-01-18 18:14     ` Liming Sun
  0 siblings, 0 replies; 40+ messages in thread
From: Liming Sun @ 2019-01-18 18:14 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Ulf Hansson, Rob Herring, Mark Rutland, Jaehoon Chung,
	Catalin Marinas, Will Deacon, linux-mmc, devicetree, LKML,
	Greg KH, Kate Stewart, David Woods

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

Thanks Thomas!


A code review has just been sent out to fix this license information. Please let me know if you still see issues.


Regards,

Liming


________________________________
From: Thomas Gleixner <tglx@linutronix.de>
Sent: Friday, January 18, 2019 5:06 AM
To: Liming Sun
Cc: Ulf Hansson; Rob Herring; Mark Rutland; Jaehoon Chung; Catalin Marinas; Will Deacon; linux-mmc@vger.kernel.org; devicetree@vger.kernel.org; LKML; Greg KH; Kate Stewart
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

[-- Attachment #2: Type: text/html, Size: 4899 bytes --]

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2019-01-18 18:14 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 15:32 [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
2018-04-23 15:32 ` [PATCH v2 2/3] Documentation: bluefield-dw-mshc: add DT description Liming Sun
2018-04-27 19:50   ` Rob Herring
2018-04-30 14:57     ` Liming Sun
2018-04-23 15:32 ` [PATCH v2 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-04-24  1:11 ` [PATCH v2 1/3] mmc: dw_mmc-bluefield: Add driver extension Shawn Lin
2018-05-08 13:06   ` Liming Sun
2018-05-08 18:55   ` Liming Sun
2018-04-30 14:51 ` [PATCH v3 " Liming Sun
2018-04-30 14:51 ` [PATCH v3 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
2018-05-01 12:48   ` Rob Herring
2018-05-01 14:36     ` Liming Sun
2018-04-30 14:51 ` [PATCH v3 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-05-01 14:32 ` [PATCH v4 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
2018-05-01 14:32 ` [PATCH v4 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
2018-05-01 16:24   ` Rob Herring
2018-05-01 19:10     ` Liming Sun
2018-05-01 14:32 ` [PATCH v4 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-05-01 18:19 ` [PATCH v5 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
2018-05-02  1:02   ` Shawn Lin
2018-05-02 12:45     ` Liming Sun
2018-05-03  7:25       ` Shawn Lin
2018-05-03 14:35         ` Liming Sun
2018-05-02  8:16   ` Jaehoon Chung
2018-05-03 15:52     ` Liming Sun
2018-05-01 18:19 ` [PATCH v5 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
2018-05-01 18:19 ` [PATCH v5 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-05-03 15:45 ` [PATCH v6 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
2018-05-03 15:45 ` [PATCH v6 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
2018-05-03 15:45 ` [PATCH v6 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-05-08 18:46 ` [PATCH v7 1/3] mmc: dw_mmc-bluefield: Add driver extension Liming Sun
2018-05-09  1:45   ` Shawn Lin
2018-05-21 11:36   ` Ulf Hansson
2019-01-18 10:06   ` Thomas Gleixner
2019-01-18 18:14     ` Liming Sun
2018-05-08 18:46 ` [PATCH v7 2/3] dt-bindings: mmc: Add binding for BlueField SoC Liming Sun
2018-05-21 11:36   ` Ulf Hansson
2018-05-08 18:46 ` [PATCH v7 3/3] arm64: defconfig: Enable dw_mmc-bluefield driver Liming Sun
2018-05-21 11:36   ` Ulf Hansson
2018-05-21 19:35     ` Liming Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.