All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V6 0/2] Add SDHCI driver for Broadcom BRCMSTB/BMIPS Soc's
@ 2016-06-14 15:37 Al Cooper
  2016-06-14 15:37 ` [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs Al Cooper
  2016-06-14 15:37 ` [PATCH V6 2/2] mmc: DT: sdhci-brcmstb: Add device tree bindings Al Cooper
  0 siblings, 2 replies; 5+ messages in thread
From: Al Cooper @ 2016-06-14 15:37 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, linux-mmc, bcm-kernel-feedback-list; +Cc: Al Cooper

V6 - Call clk_disable_unprepare() on errors in probe function.
     Improve commit message.
V5 - Don't create new device tree properties to disable broken UHS
     modes. Use devm_clk_get() to get clk and change
     clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
V4 - Change the DT compatible property to "brcm,bcm7425-sdhci".
     Add "clocks" property to DT bindings document.
V3 - Don't add new QUIRKS to workaround Host Controller issues.
     It turns out that all the issues could be solved by using
     SDHCI_QUIRK_MISSING_CAPS to supply modified "caps" and "caps1"
     Host Controller registers.

Al Cooper (2):
  mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs
  mmc: DT: sdhci-brcmstb: Add device tree bindings

 .../devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt |  36 ++++++
 MAINTAINERS                                        |   7 +
 drivers/mmc/host/Kconfig                           |  11 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-brcmstb.c                   | 143 +++++++++++++++++++++
 5 files changed, 198 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c

-- 
1.9.0.138.g2de3478


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

* [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs
  2016-06-14 15:37 [PATCH V6 0/2] Add SDHCI driver for Broadcom BRCMSTB/BMIPS Soc's Al Cooper
@ 2016-06-14 15:37 ` Al Cooper
  2016-06-15  9:12   ` Adrian Hunter
  2016-06-14 15:37 ` [PATCH V6 2/2] mmc: DT: sdhci-brcmstb: Add device tree bindings Al Cooper
  1 sibling, 1 reply; 5+ messages in thread
From: Al Cooper @ 2016-06-14 15:37 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, linux-mmc, bcm-kernel-feedback-list; +Cc: Al Cooper

Add SDHCI driver for Broadcom BRCMSTB SoCs.
This driver works with all ARM based SoCs and the 7425, 7429
and 7435 MIPS based SoCs.

The driver disables all UHS speed modes by default and relies
on the Device Tree node properties to enable these modes for
SoC/Board combinations that support them.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 MAINTAINERS                      |   7 ++
 drivers/mmc/host/Kconfig         |  11 +++
 drivers/mmc/host/Makefile        |   1 +
 drivers/mmc/host/sdhci-brcmstb.c | 143 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-brcmstb.c

diff --git a/MAINTAINERS b/MAINTAINERS
index a929db8..5b76de9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10190,6 +10190,13 @@ F:	tools/testing/selftests/seccomp/*
 K:	\bsecure_computing
 K:	\bTIF_SECCOMP\b
 
+SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) Broadcom BRCMSTB DRIVER
+M:	Al Cooper <alcooperx@gmail.com>
+L:	linux-mmc@vger.kernel.org
+L:	bcm-kernel-feedback-list@broadcom.com
+S:	Maintained
+F:	drivers/mmc/host/sdhci-brcmstb*
+
 SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
 M:	Ben Dooks <ben-linux@fluff.org>
 M:	Jaehoon Chung <jh80.chung@samsung.com>
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 0aa484c..1038c9a 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -798,3 +798,14 @@ config MMC_SDHCI_MICROCHIP_PIC32
           If you have a controller with this interface, say Y or M here.
 
           If unsure, say N.
+config MMC_SDHCI_BRCMSTB
+	tristate "Broadcom SDIO/SD/MMC support"
+	depends on ARCH_BRCMSTB || BMIPS_GENERIC
+	depends on MMC_SDHCI_PLTFM
+	default y
+	select MMC_SDHCI_IO_ACCESSORS
+	help
+	  This selects support for the SDIO/SD/MMC Host Controller on
+	  Broadcom STB SoCs.
+
+	  If unsure, say Y.
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index af918d2..2075c11 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_MMC_SDHCI_IPROC)		+= sdhci-iproc.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= sdhci-msm.o
 obj-$(CONFIG_MMC_SDHCI_ST)		+= sdhci-st.o
 obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)	+= sdhci-pic32.o
+obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
new file mode 100644
index 0000000..cce10fe
--- /dev/null
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -0,0 +1,143 @@
+/*
+ * sdhci-brcmstb.c Support for SDHCI on Broadcom BRCMSTB SoC's
+ *
+ * Copyright (C) 2015 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/io.h>
+#include <linux/mmc/host.h>
+#include <linux/module.h>
+#include <linux/of.h>
+
+#include "sdhci-pltfm.h"
+
+#ifdef CONFIG_PM_SLEEP
+
+static int sdhci_brcmstb_suspend(struct device *dev)
+{
+	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int res;
+
+	res = sdhci_suspend_host(host);
+	if (res)
+		return res;
+	clk_disable_unprepare(pltfm_host->clk);
+	return res;
+}
+
+static int sdhci_brcmstb_resume(struct device *dev)
+{
+	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int err;
+
+	err = clk_prepare_enable(pltfm_host->clk);
+	if (err)
+		return err;
+	return sdhci_resume_host(host);
+}
+
+#endif /* CONFIG_PM_SLEEP */
+
+static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
+			sdhci_brcmstb_resume);
+
+static const struct sdhci_ops sdhci_brcmstb_ops = {
+	.set_clock = sdhci_set_clock,
+	.set_bus_width = sdhci_set_bus_width,
+	.reset = sdhci_reset,
+	.set_uhs_signaling = sdhci_set_uhs_signaling,
+};
+
+static struct sdhci_pltfm_data sdhci_brcmstb_pdata = {
+	.ops = &sdhci_brcmstb_ops,
+};
+
+static int sdhci_brcmstb_probe(struct platform_device *pdev)
+{
+	struct sdhci_host *host;
+	struct sdhci_pltfm_host *pltfm_host;
+	struct clk *clk;
+	int res;
+
+	clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(clk)) {
+		dev_err(&pdev->dev, "Clock not found in Device Tree\n");
+		clk = NULL;
+	}
+	res = clk_prepare_enable(clk);
+	if (res)
+		return res;
+
+	host = sdhci_pltfm_init(pdev, &sdhci_brcmstb_pdata, 0);
+	if (IS_ERR(host)) {
+		res = PTR_ERR(host);
+		goto err_clk;
+	}
+
+	/* Enable MMC_CAP2_HC_ERASE_SZ for better max discard calculations */
+	host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
+
+	sdhci_get_of_property(pdev);
+	mmc_of_parse(host->mmc);
+
+	/*
+	 * Supply the existing CAPS, but clear the UHS modes. This
+	 * will allow these modes to be specified by device tree
+	 * properties through mmc_of_parse().
+	 */
+	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
+	host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
+			SDHCI_SUPPORT_DDR50);
+	host->quirks |= SDHCI_QUIRK_MISSING_CAPS |
+		SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+
+	res = sdhci_add_host(host);
+	if (res)
+		goto err;
+
+	pltfm_host = sdhci_priv(host);
+	pltfm_host->clk = clk;
+	return res;
+
+err:
+	sdhci_pltfm_free(pdev);
+err_clk:
+	clk_disable_unprepare(clk);
+	return res;
+}
+
+static const struct of_device_id sdhci_brcm_of_match[] = {
+	{ .compatible = "brcm,bcm7425-sdhci" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
+
+static struct platform_driver sdhci_brcmstb_driver = {
+	.driver		= {
+		.name	= "sdhci-brcmstb",
+		.owner	= THIS_MODULE,
+		.pm	= &sdhci_brcmstb_pmops,
+		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
+	},
+	.probe		= sdhci_brcmstb_probe,
+	.remove		= sdhci_pltfm_unregister,
+};
+
+module_platform_driver(sdhci_brcmstb_driver);
+
+MODULE_DESCRIPTION("SDHCI driver for Broadcom BRCMSTB SoCs");
+MODULE_AUTHOR("Broadcom");
+MODULE_LICENSE("GPL v2");
-- 
1.9.0.138.g2de3478


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

* [PATCH V6 2/2] mmc: DT: sdhci-brcmstb: Add device tree bindings
  2016-06-14 15:37 [PATCH V6 0/2] Add SDHCI driver for Broadcom BRCMSTB/BMIPS Soc's Al Cooper
  2016-06-14 15:37 ` [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs Al Cooper
@ 2016-06-14 15:37 ` Al Cooper
  1 sibling, 0 replies; 5+ messages in thread
From: Al Cooper @ 2016-06-14 15:37 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, linux-mmc, bcm-kernel-feedback-list; +Cc: Al Cooper

The example includes the properties required to enable UHS modes.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 .../devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt

diff --git a/Documentation/devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt b/Documentation/devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt
new file mode 100644
index 0000000..8284717
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/brcm,bcm7425-sdhci.txt
@@ -0,0 +1,36 @@
+* BROADCOM BRCMSTB/BMIPS SDHCI Controller
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-brcmstb driver.
+
+NOTE: The driver disables all UHS speed modes by default and depends
+on Device Tree properties to enable them for SoC/Board combinations
+that support them.
+
+Required properties:
+- compatible: "brcm,bcm7425-sdhci"
+
+Refer to clocks/clock-bindings.txt for generic clock consumer properties.
+
+Example:
+
+	sdhci@f03e0100 {
+		compatible = "brcm,bcm7425-sdhci";
+		reg = <0xf03e0000 0x100>;
+		interrupts = <0x0 0x26 0x0>;
+		sdhci,auto-cmd12;
+		clocks = <&sw_sdio>;
+		sd-uhs-sdr50;
+		sd-uhs-ddr50;
+	};
+
+	sdhci@f03e0300 {
+		non-removable;
+		bus-width = <0x8>;
+		compatible = "brcm,bcm7425-sdhci";
+		reg = <0xf03e0200 0x100>;
+		interrupts = <0x0 0x27 0x0>;
+		sdhci,auto-cmd12;
+		clocks = <sw_sdio>;
+		mmc-hs200-1_8v;
+	};
-- 
1.9.0.138.g2de3478


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

* Re: [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs
  2016-06-14 15:37 ` [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs Al Cooper
@ 2016-06-15  9:12   ` Adrian Hunter
  2016-06-16 16:46     ` Alan Cooper
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2016-06-15  9:12 UTC (permalink / raw)
  To: Al Cooper, ulf.hansson, linux-mmc, bcm-kernel-feedback-list

On 14/06/16 18:37, Al Cooper wrote:
> Add SDHCI driver for Broadcom BRCMSTB SoCs.
> This driver works with all ARM based SoCs and the 7425, 7429
> and 7435 MIPS based SoCs.
> 
> The driver disables all UHS speed modes by default and relies
> on the Device Tree node properties to enable these modes for
> SoC/Board combinations that support them.
> 
> Signed-off-by: Al Cooper <alcooperx@gmail.com>

Apart from a minor comment below:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  MAINTAINERS                      |   7 ++
>  drivers/mmc/host/Kconfig         |  11 +++
>  drivers/mmc/host/Makefile        |   1 +
>  drivers/mmc/host/sdhci-brcmstb.c | 143 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 162 insertions(+)
>  create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a929db8..5b76de9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10190,6 +10190,13 @@ F:	tools/testing/selftests/seccomp/*
>  K:	\bsecure_computing
>  K:	\bTIF_SECCOMP\b
>  
> +SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) Broadcom BRCMSTB DRIVER
> +M:	Al Cooper <alcooperx@gmail.com>
> +L:	linux-mmc@vger.kernel.org
> +L:	bcm-kernel-feedback-list@broadcom.com
> +S:	Maintained
> +F:	drivers/mmc/host/sdhci-brcmstb*
> +
>  SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
>  M:	Ben Dooks <ben-linux@fluff.org>
>  M:	Jaehoon Chung <jh80.chung@samsung.com>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 0aa484c..1038c9a 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -798,3 +798,14 @@ config MMC_SDHCI_MICROCHIP_PIC32
>            If you have a controller with this interface, say Y or M here.
>  
>            If unsure, say N.
> +config MMC_SDHCI_BRCMSTB
> +	tristate "Broadcom SDIO/SD/MMC support"
> +	depends on ARCH_BRCMSTB || BMIPS_GENERIC
> +	depends on MMC_SDHCI_PLTFM
> +	default y
> +	select MMC_SDHCI_IO_ACCESSORS

Doesn't look like you are using SDHCI I/O accessors.

> +	help
> +	  This selects support for the SDIO/SD/MMC Host Controller on
> +	  Broadcom STB SoCs.
> +
> +	  If unsure, say Y.
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index af918d2..2075c11 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -76,6 +76,7 @@ obj-$(CONFIG_MMC_SDHCI_IPROC)		+= sdhci-iproc.o
>  obj-$(CONFIG_MMC_SDHCI_MSM)		+= sdhci-msm.o
>  obj-$(CONFIG_MMC_SDHCI_ST)		+= sdhci-st.o
>  obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)	+= sdhci-pic32.o
> +obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
>  
>  ifeq ($(CONFIG_CB710_DEBUG),y)
>  	CFLAGS-cb710-mmc	+= -DDEBUG
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> new file mode 100644
> index 0000000..cce10fe
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -0,0 +1,143 @@
> +/*
> + * sdhci-brcmstb.c Support for SDHCI on Broadcom BRCMSTB SoC's
> + *
> + * Copyright (C) 2015 Broadcom Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <linux/io.h>
> +#include <linux/mmc/host.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +
> +#include "sdhci-pltfm.h"
> +
> +#ifdef CONFIG_PM_SLEEP
> +
> +static int sdhci_brcmstb_suspend(struct device *dev)
> +{
> +	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int res;
> +
> +	res = sdhci_suspend_host(host);
> +	if (res)
> +		return res;
> +	clk_disable_unprepare(pltfm_host->clk);
> +	return res;
> +}
> +
> +static int sdhci_brcmstb_resume(struct device *dev)
> +{
> +	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int err;
> +
> +	err = clk_prepare_enable(pltfm_host->clk);
> +	if (err)
> +		return err;
> +	return sdhci_resume_host(host);
> +}
> +
> +#endif /* CONFIG_PM_SLEEP */
> +
> +static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
> +			sdhci_brcmstb_resume);
> +
> +static const struct sdhci_ops sdhci_brcmstb_ops = {
> +	.set_clock = sdhci_set_clock,
> +	.set_bus_width = sdhci_set_bus_width,
> +	.reset = sdhci_reset,
> +	.set_uhs_signaling = sdhci_set_uhs_signaling,
> +};
> +
> +static struct sdhci_pltfm_data sdhci_brcmstb_pdata = {
> +	.ops = &sdhci_brcmstb_ops,
> +};
> +
> +static int sdhci_brcmstb_probe(struct platform_device *pdev)
> +{
> +	struct sdhci_host *host;
> +	struct sdhci_pltfm_host *pltfm_host;
> +	struct clk *clk;
> +	int res;
> +
> +	clk = devm_clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(clk)) {
> +		dev_err(&pdev->dev, "Clock not found in Device Tree\n");
> +		clk = NULL;
> +	}
> +	res = clk_prepare_enable(clk);
> +	if (res)
> +		return res;
> +
> +	host = sdhci_pltfm_init(pdev, &sdhci_brcmstb_pdata, 0);
> +	if (IS_ERR(host)) {
> +		res = PTR_ERR(host);
> +		goto err_clk;
> +	}
> +
> +	/* Enable MMC_CAP2_HC_ERASE_SZ for better max discard calculations */
> +	host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
> +
> +	sdhci_get_of_property(pdev);
> +	mmc_of_parse(host->mmc);
> +
> +	/*
> +	 * Supply the existing CAPS, but clear the UHS modes. This
> +	 * will allow these modes to be specified by device tree
> +	 * properties through mmc_of_parse().
> +	 */
> +	host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
> +	host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
> +	host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
> +			SDHCI_SUPPORT_DDR50);
> +	host->quirks |= SDHCI_QUIRK_MISSING_CAPS |
> +		SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> +
> +	res = sdhci_add_host(host);
> +	if (res)
> +		goto err;
> +
> +	pltfm_host = sdhci_priv(host);
> +	pltfm_host->clk = clk;
> +	return res;
> +
> +err:
> +	sdhci_pltfm_free(pdev);
> +err_clk:
> +	clk_disable_unprepare(clk);
> +	return res;
> +}
> +
> +static const struct of_device_id sdhci_brcm_of_match[] = {
> +	{ .compatible = "brcm,bcm7425-sdhci" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
> +
> +static struct platform_driver sdhci_brcmstb_driver = {
> +	.driver		= {
> +		.name	= "sdhci-brcmstb",
> +		.owner	= THIS_MODULE,
> +		.pm	= &sdhci_brcmstb_pmops,
> +		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
> +	},
> +	.probe		= sdhci_brcmstb_probe,
> +	.remove		= sdhci_pltfm_unregister,
> +};
> +
> +module_platform_driver(sdhci_brcmstb_driver);
> +
> +MODULE_DESCRIPTION("SDHCI driver for Broadcom BRCMSTB SoCs");
> +MODULE_AUTHOR("Broadcom");
> +MODULE_LICENSE("GPL v2");
> 


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

* Re: [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs
  2016-06-15  9:12   ` Adrian Hunter
@ 2016-06-16 16:46     ` Alan Cooper
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Cooper @ 2016-06-16 16:46 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Ulf Hansson, linux-mmc, bcm-kernel-feedback-list

Re-submit to follow with SDHCI I/O accessors removed from Kconfig
Thanks Adrian

On Wed, Jun 15, 2016 at 5:12 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 14/06/16 18:37, Al Cooper wrote:
>> Add SDHCI driver for Broadcom BRCMSTB SoCs.
>> This driver works with all ARM based SoCs and the 7425, 7429
>> and 7435 MIPS based SoCs.
>>
>> The driver disables all UHS speed modes by default and relies
>> on the Device Tree node properties to enable these modes for
>> SoC/Board combinations that support them.
>>
>> Signed-off-by: Al Cooper <alcooperx@gmail.com>
>
> Apart from a minor comment below:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> ---
>>  MAINTAINERS                      |   7 ++
>>  drivers/mmc/host/Kconfig         |  11 +++
>>  drivers/mmc/host/Makefile        |   1 +
>>  drivers/mmc/host/sdhci-brcmstb.c | 143 +++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 162 insertions(+)
>>  create mode 100644 drivers/mmc/host/sdhci-brcmstb.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index a929db8..5b76de9 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -10190,6 +10190,13 @@ F:   tools/testing/selftests/seccomp/*
>>  K:   \bsecure_computing
>>  K:   \bTIF_SECCOMP\b
>>
>> +SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) Broadcom BRCMSTB DRIVER
>> +M:   Al Cooper <alcooperx@gmail.com>
>> +L:   linux-mmc@vger.kernel.org
>> +L:   bcm-kernel-feedback-list@broadcom.com
>> +S:   Maintained
>> +F:   drivers/mmc/host/sdhci-brcmstb*
>> +
>>  SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
>>  M:   Ben Dooks <ben-linux@fluff.org>
>>  M:   Jaehoon Chung <jh80.chung@samsung.com>
>> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
>> index 0aa484c..1038c9a 100644
>> --- a/drivers/mmc/host/Kconfig
>> +++ b/drivers/mmc/host/Kconfig
>> @@ -798,3 +798,14 @@ config MMC_SDHCI_MICROCHIP_PIC32
>>            If you have a controller with this interface, say Y or M here.
>>
>>            If unsure, say N.
>> +config MMC_SDHCI_BRCMSTB
>> +     tristate "Broadcom SDIO/SD/MMC support"
>> +     depends on ARCH_BRCMSTB || BMIPS_GENERIC
>> +     depends on MMC_SDHCI_PLTFM
>> +     default y
>> +     select MMC_SDHCI_IO_ACCESSORS
>
> Doesn't look like you are using SDHCI I/O accessors.
>
>> +     help
>> +       This selects support for the SDIO/SD/MMC Host Controller on
>> +       Broadcom STB SoCs.
>> +
>> +       If unsure, say Y.
>> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
>> index af918d2..2075c11 100644
>> --- a/drivers/mmc/host/Makefile
>> +++ b/drivers/mmc/host/Makefile
>> @@ -76,6 +76,7 @@ obj-$(CONFIG_MMC_SDHCI_IPROC)               += sdhci-iproc.o
>>  obj-$(CONFIG_MMC_SDHCI_MSM)          += sdhci-msm.o
>>  obj-$(CONFIG_MMC_SDHCI_ST)           += sdhci-st.o
>>  obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)      += sdhci-pic32.o
>> +obj-$(CONFIG_MMC_SDHCI_BRCMSTB)              += sdhci-brcmstb.o
>>
>>  ifeq ($(CONFIG_CB710_DEBUG),y)
>>       CFLAGS-cb710-mmc        += -DDEBUG
>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>> new file mode 100644
>> index 0000000..cce10fe
>> --- /dev/null
>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>> @@ -0,0 +1,143 @@
>> +/*
>> + * sdhci-brcmstb.c Support for SDHCI on Broadcom BRCMSTB SoC's
>> + *
>> + * Copyright (C) 2015 Broadcom Corporation
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + */
>> +
>> +#include <linux/io.h>
>> +#include <linux/mmc/host.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +
>> +#include "sdhci-pltfm.h"
>> +
>> +#ifdef CONFIG_PM_SLEEP
>> +
>> +static int sdhci_brcmstb_suspend(struct device *dev)
>> +{
>> +     struct sdhci_host *host = dev_get_drvdata(dev);
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +     int res;
>> +
>> +     res = sdhci_suspend_host(host);
>> +     if (res)
>> +             return res;
>> +     clk_disable_unprepare(pltfm_host->clk);
>> +     return res;
>> +}
>> +
>> +static int sdhci_brcmstb_resume(struct device *dev)
>> +{
>> +     struct sdhci_host *host = dev_get_drvdata(dev);
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +     int err;
>> +
>> +     err = clk_prepare_enable(pltfm_host->clk);
>> +     if (err)
>> +             return err;
>> +     return sdhci_resume_host(host);
>> +}
>> +
>> +#endif /* CONFIG_PM_SLEEP */
>> +
>> +static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
>> +                     sdhci_brcmstb_resume);
>> +
>> +static const struct sdhci_ops sdhci_brcmstb_ops = {
>> +     .set_clock = sdhci_set_clock,
>> +     .set_bus_width = sdhci_set_bus_width,
>> +     .reset = sdhci_reset,
>> +     .set_uhs_signaling = sdhci_set_uhs_signaling,
>> +};
>> +
>> +static struct sdhci_pltfm_data sdhci_brcmstb_pdata = {
>> +     .ops = &sdhci_brcmstb_ops,
>> +};
>> +
>> +static int sdhci_brcmstb_probe(struct platform_device *pdev)
>> +{
>> +     struct sdhci_host *host;
>> +     struct sdhci_pltfm_host *pltfm_host;
>> +     struct clk *clk;
>> +     int res;
>> +
>> +     clk = devm_clk_get(&pdev->dev, NULL);
>> +     if (IS_ERR(clk)) {
>> +             dev_err(&pdev->dev, "Clock not found in Device Tree\n");
>> +             clk = NULL;
>> +     }
>> +     res = clk_prepare_enable(clk);
>> +     if (res)
>> +             return res;
>> +
>> +     host = sdhci_pltfm_init(pdev, &sdhci_brcmstb_pdata, 0);
>> +     if (IS_ERR(host)) {
>> +             res = PTR_ERR(host);
>> +             goto err_clk;
>> +     }
>> +
>> +     /* Enable MMC_CAP2_HC_ERASE_SZ for better max discard calculations */
>> +     host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ;
>> +
>> +     sdhci_get_of_property(pdev);
>> +     mmc_of_parse(host->mmc);
>> +
>> +     /*
>> +      * Supply the existing CAPS, but clear the UHS modes. This
>> +      * will allow these modes to be specified by device tree
>> +      * properties through mmc_of_parse().
>> +      */
>> +     host->caps = sdhci_readl(host, SDHCI_CAPABILITIES);
>> +     host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1);
>> +     host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
>> +                     SDHCI_SUPPORT_DDR50);
>> +     host->quirks |= SDHCI_QUIRK_MISSING_CAPS |
>> +             SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
>> +
>> +     res = sdhci_add_host(host);
>> +     if (res)
>> +             goto err;
>> +
>> +     pltfm_host = sdhci_priv(host);
>> +     pltfm_host->clk = clk;
>> +     return res;
>> +
>> +err:
>> +     sdhci_pltfm_free(pdev);
>> +err_clk:
>> +     clk_disable_unprepare(clk);
>> +     return res;
>> +}
>> +
>> +static const struct of_device_id sdhci_brcm_of_match[] = {
>> +     { .compatible = "brcm,bcm7425-sdhci" },
>> +     {},
>> +};
>> +MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>> +
>> +static struct platform_driver sdhci_brcmstb_driver = {
>> +     .driver         = {
>> +             .name   = "sdhci-brcmstb",
>> +             .owner  = THIS_MODULE,
>> +             .pm     = &sdhci_brcmstb_pmops,
>> +             .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>> +     },
>> +     .probe          = sdhci_brcmstb_probe,
>> +     .remove         = sdhci_pltfm_unregister,
>> +};
>> +
>> +module_platform_driver(sdhci_brcmstb_driver);
>> +
>> +MODULE_DESCRIPTION("SDHCI driver for Broadcom BRCMSTB SoCs");
>> +MODULE_AUTHOR("Broadcom");
>> +MODULE_LICENSE("GPL v2");
>>
>

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

end of thread, other threads:[~2016-06-16 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 15:37 [PATCH V6 0/2] Add SDHCI driver for Broadcom BRCMSTB/BMIPS Soc's Al Cooper
2016-06-14 15:37 ` [PATCH V6 1/2] mmc: sdhci-brcmstb: Add driver for Broadcom BRCMSTB SoCs Al Cooper
2016-06-15  9:12   ` Adrian Hunter
2016-06-16 16:46     ` Alan Cooper
2016-06-14 15:37 ` [PATCH V6 2/2] mmc: DT: sdhci-brcmstb: Add device tree bindings Al Cooper

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.