linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs
@ 2014-07-09 15:07 Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller Peter Griffin
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This series adds a SDHCI platform driver for ST SoCs, along with
the additional device tree bindings and configuration to enable
the controller to work properly.

Initially it supports the stih416 and stih415 SoCs, and has
been tested on a stih416-b2020 board.

regards,

Peter.

Changes since v1
- Whitespace cleanups
- Use readl_relaxed io accessor
- Add update to MAINTAINERS
- Remove reset controller code from platform driver
- Remove #ifdef around sleep ops
- Use sdhci_pltfm_clk_get_max_clock lib function
- Pass bus-width etc through board device tree node
- Remove unncessary header
- Remove / change some debug messages
- Remove final break from switch case

Changes since v2
- Update CC list with alkml and lkml lists

Changes since v3
- Rebased on v3.16-rc4
- Use sdhci_set_bus_width lib function for set_bus_width
- Remove sdhci_st_8bit_width function
- Use sdhci_set_clock lib function for set_clock

Peter Griffin (10):
  mmc: sdhci-st: Intial support for ST SDHCI controller
  mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
  ARM: STi: DT: Add sdhci pins for stih416
  ARM: STi: DT: Add sdhci controller for stih416
  ARM: STi: DT: Add sdhci pin configuration for stih415
  ARM: STi: DT: Add sdhci controller for stih415
  ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs
  ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.
  ARM: update multi_v7_defconfig for STI
  MAINTAINERS: Add sdhci-st file to ARCH/STI architecture

 Documentation/devicetree/bindings/mmc/sdhci-st.txt |  33 ++++
 MAINTAINERS                                        |   1 +
 arch/arm/boot/dts/stih415-pinctrl.dtsi             |  21 +++
 arch/arm/boot/dts/stih415.dtsi                     |  12 ++
 arch/arm/boot/dts/stih416-b2020.dts                |   8 +
 arch/arm/boot/dts/stih416-b2020e.dts               |   6 +
 arch/arm/boot/dts/stih416-pinctrl.dtsi             |  39 +++++
 arch/arm/boot/dts/stih416.dtsi                     |  24 +++
 arch/arm/boot/dts/stih41x-b2020.dtsi               |   4 +
 arch/arm/boot/dts/stih41x-b2020x.dtsi              |   4 +
 arch/arm/configs/multi_v7_defconfig                |   1 +
 drivers/mmc/host/Kconfig                           |  12 ++
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-st.c                        | 176 +++++++++++++++++++++
 14 files changed, 342 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
 create mode 100644 drivers/mmc/host/sdhci-st.c

-- 
1.9.1

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

* [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-10  7:12   ` Ulf Hansson
  2014-07-09 15:07 ` [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation Peter Griffin
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This platform driver adds initial support for the SDHCI host controller
found on STMicroelectronics SoCs.

It has been tested on STiH41x b2020 platforms currently.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 drivers/mmc/host/Kconfig    |  12 +++
 drivers/mmc/host/Makefile   |   1 +
 drivers/mmc/host/sdhci-st.c | 176 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-st.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index a565254..6615b79 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -290,6 +290,18 @@ config MMC_MOXART
 	  be found on some embedded hardware such as UC-7112-LX.
 	  If you have a controller with this interface, say Y here.
 
+config MMC_SDHCI_ST
+	tristate "SDHCI support on STMicroelectronics SoC"
+	depends on ARCH_STI
+	depends on MMC_SDHCI_PLTFM
+	select MMC_SDHCI_IO_ACCESSORS
+	help
+	  This selects the Secure Digital Host Controller Interface in
+	  STMicroelectronics SoCs.
+
+	  If you have a controller with this interface, say Y or M here.
+	  If unsure, say N.
+
 config MMC_OMAP
 	tristate "TI OMAP Multimedia Card Interface support"
 	depends on ARCH_OMAP
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 7f81ddf..f211eed 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_HLWD)		+= sdhci-of-hlwd.o
 obj-$(CONFIG_MMC_SDHCI_BCM_KONA)	+= sdhci-bcm-kona.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= sdhci-bcm2835.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= sdhci-msm.o
+obj-$(CONFIG_MMC_SDHCI_ST)		+= sdhci-st.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
new file mode 100644
index 0000000..328f348
--- /dev/null
+++ b/drivers/mmc/host/sdhci-st.c
@@ -0,0 +1,176 @@
+/*
+ * Support for SDHCI on STMicroelectronics SoCs
+ *
+ * Copyright (C) 2014 STMicroelectronics Ltd
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ * Contributors: Peter Griffin <peter.griffin@linaro.org>
+ *
+ * Based on sdhci-cns3xxx.c
+ *
+ * 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/of.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/mmc/host.h>
+
+#include "sdhci-pltfm.h"
+
+static u32 sdhci_st_readl(struct sdhci_host *host, int reg)
+{
+	u32 ret;
+
+	switch (reg) {
+	case SDHCI_CAPABILITIES:
+		ret = readl_relaxed(host->ioaddr + reg);
+		/* Support 3.3V and 1.8V */
+		ret &= ~SDHCI_CAN_VDD_300;
+		break;
+	default:
+		ret = readl_relaxed(host->ioaddr + reg);
+	}
+	return ret;
+}
+
+static const struct sdhci_ops sdhci_st_ops = {
+	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
+	.set_clock = sdhci_set_clock,
+	.set_bus_width = sdhci_set_bus_width,
+	.read_l = sdhci_st_readl,
+	.reset = sdhci_reset,
+};
+
+static const struct sdhci_pltfm_data sdhci_st_pdata = {
+	.ops = &sdhci_st_ops,
+	.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
+	    SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+};
+
+
+static int sdhci_st_probe(struct platform_device *pdev)
+{
+	struct sdhci_host *host;
+	struct sdhci_pltfm_host *pltfm_host;
+	struct clk *clk;
+	int ret = 0;
+	u16 host_version;
+
+	clk =  devm_clk_get(&pdev->dev, "mmc");
+	if (IS_ERR(clk)) {
+		dev_err(&pdev->dev, "Peripheral clk not found\n");
+		return PTR_ERR(clk);
+	}
+
+	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
+	if (IS_ERR(host)) {
+		dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
+		return PTR_ERR(host);
+	}
+
+	ret = mmc_of_parse(host->mmc);
+
+	if (ret) {
+		dev_err(&pdev->dev, "Failed mmc_of_parse\n");
+		return ret;
+	}
+
+	clk_prepare_enable(clk);
+
+	pltfm_host = sdhci_priv(host);
+	pltfm_host->clk = clk;
+
+	ret = sdhci_add_host(host);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed sdhci_add_host\n");
+		goto err_out;
+	}
+
+	platform_set_drvdata(pdev, host);
+
+	host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
+
+	dev_info(&pdev->dev, "SDHCI ST Initialised: Host Version: 0x%x Vendor Version 0x%x\n",
+		((host_version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT),
+		((host_version & SDHCI_VENDOR_VER_MASK) >>
+		SDHCI_VENDOR_VER_SHIFT));
+
+	return 0;
+
+err_out:
+	clk_disable_unprepare(clk);
+	sdhci_pltfm_free(pdev);
+
+	return ret;
+}
+
+static int sdhci_st_remove(struct platform_device *pdev)
+{
+	struct sdhci_host *host = platform_get_drvdata(pdev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+	clk_disable_unprepare(pltfm_host->clk);
+
+	return sdhci_pltfm_unregister(pdev);
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int sdhci_st_suspend(struct device *dev)
+{
+	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int ret = sdhci_suspend_host(host);
+
+	if (ret)
+		goto out;
+
+	clk_disable_unprepare(pltfm_host->clk);
+out:
+	return ret;
+}
+
+static int sdhci_st_resume(struct device *dev)
+{
+	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+	clk_prepare_enable(pltfm_host->clk);
+
+	return sdhci_resume_host(host);
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(sdhci_st_pmops, sdhci_st_suspend, sdhci_st_resume);
+
+static const struct of_device_id st_sdhci_match[] = {
+	{ .compatible = "st,sdhci" },
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, st_sdhci_match);
+
+static struct platform_driver sdhci_st_driver = {
+	.probe = sdhci_st_probe,
+	.remove = sdhci_st_remove,
+	.driver = {
+		   .name = "sdhci-st",
+		   .pm = &sdhci_st_pmops,
+		   .of_match_table = of_match_ptr(st_sdhci_match),
+		  },
+};
+
+module_platform_driver(sdhci_st_driver);
+
+MODULE_DESCRIPTION("SDHCI driver for STMicroelectronics SoCs");
+MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:st-sdhci");
-- 
1.9.1

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

* [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-10  7:13   ` Ulf Hansson
  2014-07-09 15:07 ` [PATCH v4 03/10] ARM: STi: DT: Add sdhci pins for stih416 Peter Griffin
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the device tree binding documentation for the ST
SDHCI driver. It documents the differences between the core properties
described by mmc.txt and the properties used by the sdhci-st driver.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 Documentation/devicetree/bindings/mmc/sdhci-st.txt | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt

diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
new file mode 100644
index 0000000..7527db4
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
@@ -0,0 +1,33 @@
+* STMicroelectronics sdhci-st MMC/SD controller
+
+This file documents the differences between the core properties in
+Documentation/devicetree/bindings/mmc/mmc.txt and the properties
+used by the sdhci-st driver.
+
+Required properties:
+- compatible :  Must be "st,sdhci"
+- clock-names : Should be "mmc"
+                See: Documentation/devicetree/bindings/resource-names.txt
+- clocks :      Phandle of the clock used by the sdhci controler
+                See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Optional properties:
+- non-removable: non-removable slot
+                 See: Documentation/devicetree/bindings/mmc/mmc.txt
+- bus-width: Number of data lines
+                 See: Documentation/devicetree/bindings/mmc/mmc.txt
+
+Example:
+
+mmc0: sdhci at fe81e000 {
+	compatible	= "st,sdhci";
+	status		= "disabled";
+	reg		= <0xfe81e000 0x1000>;
+	interrupts	= <GIC_SPI 127 IRQ_TYPE_NONE>;
+	interrupt-names	= "mmcirq";
+	pinctrl-names	= "default";
+	pinctrl-0	= <&pinctrl_mmc0>;
+	clock-names	= "mmc";
+	clocks		= <&clk_s_a1_ls 1>;
+	bus-width       = <8>
+};
-- 
1.9.1

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

* [PATCH v4 03/10] ARM: STi: DT: Add sdhci pins for stih416
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 04/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the required pin config for both SDHCI controllers on
the stih416 SoC.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih416-pinctrl.dtsi | 39 ++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi
index ee6c119..01b5ad0 100644
--- a/arch/arm/boot/dts/stih416-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi
@@ -467,6 +467,45 @@
 					};
 				};
 			};
+
+			mmc0 {
+				pinctrl_mmc0: mmc0 {
+					st,pins {
+						mmcclk  = <&PIO13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>;
+						data0   = <&PIO14 4 ALT4 BIDIR_PU BYPASS 0>;
+						data1   = <&PIO14 5 ALT4 BIDIR_PU BYPASS 0>;
+						data2   = <&PIO14 6 ALT4 BIDIR_PU BYPASS 0>;
+						data3   = <&PIO14 7 ALT4 BIDIR_PU BYPASS 0>;
+						cmd     = <&PIO15 1 ALT4 BIDIR_PU BYPASS 0>;
+						wp      = <&PIO15 3 ALT4 IN>;
+						data4   = <&PIO16 4 ALT4 BIDIR_PU BYPASS 0>;
+						data5   = <&PIO16 5 ALT4 BIDIR_PU BYPASS 0>;
+						data6   = <&PIO16 6 ALT4 BIDIR_PU BYPASS 0>;
+						data7   = <&PIO16 7 ALT4 BIDIR_PU BYPASS 0>;
+						pwr     = <&PIO17 1 ALT4 OUT>;
+						cd      = <&PIO17 2 ALT4 IN>;
+						led     = <&PIO17 3 ALT4 OUT>;
+					};
+				};
+			};
+			mmc1 {
+				pinctrl_mmc1: mmc1 {
+					st,pins {
+						mmcclk  = <&PIO15 0 ALT3 BIDIR_PU NICLK 0 CLK_B>;
+						data0   = <&PIO13 7 ALT3 BIDIR_PU BYPASS 0>;
+						data1   = <&PIO14 1 ALT3 BIDIR_PU BYPASS 0>;
+						data2   = <&PIO14 2 ALT3 BIDIR_PU BYPASS 0>;
+						data3   = <&PIO14 3 ALT3 BIDIR_PU BYPASS 0>;
+						cmd     = <&PIO15 4 ALT3 BIDIR_PU BYPASS 0>;
+						data4   = <&PIO15 6 ALT3 BIDIR_PU BYPASS 0>;
+						data5   = <&PIO15 7 ALT3 BIDIR_PU BYPASS 0>;
+						data6   = <&PIO16 0 ALT3 BIDIR_PU BYPASS 0>;
+						data7   = <&PIO16 1 ALT3 BIDIR_PU BYPASS 0>;
+						pwr     = <&PIO16 2 ALT3 OUT>;
+						nreset  = <&PIO13 6 ALT3 OUT>;
+					};
+				};
+			};
 		};
 
 		pin-controller-fvdp-fe {
-- 
1.9.1

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

* [PATCH v4 04/10] ARM: STi: DT: Add sdhci controller for stih416
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (2 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 03/10] ARM: STi: DT: Add sdhci pins for stih416 Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 05/10] ARM: STi: DT: Add sdhci pin configuration for stih415 Peter Griffin
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds device tree config for both sdhci controllers
on the stih416 SoC.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih416.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi
index 84758d7..98c43cc 100644
--- a/arch/arm/boot/dts/stih416.dtsi
+++ b/arch/arm/boot/dts/stih416.dtsi
@@ -236,5 +236,29 @@
 			resets	= <&powerdown STIH416_KEYSCAN_POWERDOWN>,
 				  <&softreset STIH416_KEYSCAN_SOFTRESET>;
 		};
+
+		mmc0: sdhci at fe81e000 {
+			compatible	= "st,sdhci";
+			status		= "disabled";
+			reg		= <0xfe81e000 0x1000>;
+			interrupts	= <GIC_SPI 127 IRQ_TYPE_NONE>;
+			interrupt-names	= "mmcirq";
+			pinctrl-names	= "default";
+			pinctrl-0	= <&pinctrl_mmc0>;
+			clock-names	= "mmc";
+			clocks		= <&clk_s_a1_ls 1>;
+		};
+
+		mmc1: sdhci at fe81f000 {
+			compatible	= "st,sdhci";
+			status		= "disabled";
+			reg		= <0xfe81f000 0x1000>;
+			interrupts	= <GIC_SPI 128 IRQ_TYPE_NONE>;
+			interrupt-names	= "mmcirq";
+			pinctrl-names	= "default";
+			pinctrl-0	= <&pinctrl_mmc1>;
+			clock-names	= "mmc";
+			clocks		= <&clk_s_a1_ls 8>;
+		};
 	};
 };
-- 
1.9.1

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

* [PATCH v4 05/10] ARM: STi: DT: Add sdhci pin configuration for stih415
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (3 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 04/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 06/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds the required pin config for the sdhci controller
present in the stih415 SoC.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih415-pinctrl.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/stih415-pinctrl.dtsi b/arch/arm/boot/dts/stih415-pinctrl.dtsi
index 8509a03..e574f39 100644
--- a/arch/arm/boot/dts/stih415-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih415-pinctrl.dtsi
@@ -429,6 +429,27 @@
 					};
 				};
 			};
+
+			mmc0 {
+				pinctrl_mmc0: mmc0 {
+					st,pins {
+						mmcclk = <&PIO13 4 ALT4 BIDIR_PU NICLK 0 CLK_B>;
+						data0  = <&PIO14 4 ALT4 BIDIR_PU BYPASS 0>;
+						data1  = <&PIO14 5 ALT4 BIDIR_PU BYPASS 0>;
+						data2  = <&PIO14 6 ALT4 BIDIR_PU BYPASS 0>;
+						data3  = <&PIO14 7 ALT4 BIDIR_PU BYPASS 0>;
+						cmd    = <&PIO15 1 ALT4 BIDIR_PU BYPASS 0>;
+						wp     = <&PIO15 3 ALT4 IN>;
+						data4  = <&PIO16 4 ALT4 BIDIR_PU BYPASS 0>;
+						data5  = <&PIO16 5 ALT4 BIDIR_PU BYPASS 0>;
+						data6  = <&PIO16 6 ALT4 BIDIR_PU BYPASS 0>;
+						data7  = <&PIO16 7 ALT4 BIDIR_PU BYPASS 0>;
+						pwr    = <&PIO17 1 ALT4 OUT>;
+						cd     = <&PIO17 2 ALT4 IN>;
+						led    = <&PIO17 3 ALT4 OUT>;
+					};
+				};
+			};
 		};
 
 		pin-controller-left {
-- 
1.9.1

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

* [PATCH v4 06/10] ARM: STi: DT: Add sdhci controller for stih415
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (4 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 05/10] ARM: STi: DT: Add sdhci pin configuration for stih415 Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 07/10] ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs Peter Griffin
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds device tree config for the sdhci controller
on the stih415 SoC.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih415.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi
index a0f6f75..9198c12 100644
--- a/arch/arm/boot/dts/stih415.dtsi
+++ b/arch/arm/boot/dts/stih415.dtsi
@@ -218,5 +218,17 @@
 			resets	= <&powerdown STIH415_KEYSCAN_POWERDOWN>,
 				  <&softreset STIH415_KEYSCAN_SOFTRESET>;
 		};
+
+		mmc0: sdhci at fe81e000 {
+			compatible      = "st,sdhci";
+			status          = "disabled";
+			reg             = <0xfe81e000 0x1000>;
+			interrupts      = <GIC_SPI 145 IRQ_TYPE_NONE>;
+			interrupt-names = "mmcirq";
+			pinctrl-names   = "default";
+			pinctrl-0       = <&pinctrl_mmc0>;
+			clock-names     = "mmc";
+			clocks          = <&clk_s_a1_ls 1>;
+		};
 	};
 };
-- 
1.9.1

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

* [PATCH v4 07/10] ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (5 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 06/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 08/10] ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards Peter Griffin
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

Because the first sdhci controller is present on both stih415 and
stih416 SoC which can both populate the b2020 board, it can be
enabled in the generic DT file.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih41x-b2020.dtsi  | 4 ++++
 arch/arm/boot/dts/stih41x-b2020x.dtsi | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/stih41x-b2020.dtsi b/arch/arm/boot/dts/stih41x-b2020.dtsi
index d8a8429..5c2df46 100644
--- a/arch/arm/boot/dts/stih41x-b2020.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2020.dtsi
@@ -74,5 +74,9 @@
 
 			pinctrl-0	= <&pinctrl_rgmii1>;
 		};
+
+		mmc0: sdhci at fe81e000 {
+			bus-width = <8>;
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/stih41x-b2020x.dtsi b/arch/arm/boot/dts/stih41x-b2020x.dtsi
index df01c12..f797a06 100644
--- a/arch/arm/boot/dts/stih41x-b2020x.dtsi
+++ b/arch/arm/boot/dts/stih41x-b2020x.dtsi
@@ -8,6 +8,10 @@
  */
 / {
 	soc {
+		mmc0: sdhci at fe81e000 {
+			status = "okay";
+		};
+
 		spifsm: spifsm at fe902000 {
 			#address-cells = <1>;
 			#size-cells    = <1>;
-- 
1.9.1

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

* [PATCH v4 08/10] ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (6 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 07/10] ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:07 ` [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI Peter Griffin
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

The second controller is only present on the stih416 SoC. Also
mark this as non-removeable as its eMMC.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 arch/arm/boot/dts/stih416-b2020.dts  | 8 ++++++++
 arch/arm/boot/dts/stih416-b2020e.dts | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/stih416-b2020.dts b/arch/arm/boot/dts/stih416-b2020.dts
index 4e2df66..d42ff1d 100644
--- a/arch/arm/boot/dts/stih416-b2020.dts
+++ b/arch/arm/boot/dts/stih416-b2020.dts
@@ -12,4 +12,12 @@
 / {
 	model = "STiH416 B2020";
 	compatible = "st,stih416-b2020", "st,stih416";
+
+	soc {
+		mmc1: sdhci at fe81f000 {
+			status       = "okay";
+			bus-width    = <8>;
+			non-removable;
+		};
+	};
 };
diff --git a/arch/arm/boot/dts/stih416-b2020e.dts b/arch/arm/boot/dts/stih416-b2020e.dts
index ba0fa2c..68dfdaf 100644
--- a/arch/arm/boot/dts/stih416-b2020e.dts
+++ b/arch/arm/boot/dts/stih416-b2020e.dts
@@ -31,5 +31,11 @@
 		ethernet1: dwmac at fef08000 {
 			snps,reset-gpio = <&PIO0 7>;
 		};
+
+		mmc1: sdhci at fe81f000 {
+			status       = "okay";
+			bus-width    = <8>;
+			non-removable;
+		};
 	};
 };
-- 
1.9.1

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

* [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (7 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 08/10] ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-21  9:49   ` Maxime Coquelin
  2014-07-09 15:07 ` [PATCH v4 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture Peter Griffin
  2014-07-09 15:51 ` [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Maxime Coquelin
  10 siblings, 1 reply; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch enables SDHCI STI platform driver.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 5348364..8c12c4e 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -311,6 +311,7 @@ CONFIG_MMC_SDHCI_SPEAR=y
 CONFIG_MMC_SDHCI_S3C=y
 CONFIG_MMC_SDHCI_S3C_DMA=y
 CONFIG_MMC_SDHCI_BCM_KONA=y
+CONFIG_MMC_SDHCI_ST=y
 CONFIG_MMC_OMAP=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MMC_MVSDIO=y
-- 
1.9.1

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

* [PATCH v4 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (8 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI Peter Griffin
@ 2014-07-09 15:07 ` Peter Griffin
  2014-07-09 15:51 ` [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Maxime Coquelin
  10 siblings, 0 replies; 17+ messages in thread
From: Peter Griffin @ 2014-07-09 15:07 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6813d0a..8596e44 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1343,6 +1343,7 @@ F:	drivers/pinctrl/pinctrl-st.c
 F:	drivers/media/rc/st_rc.c
 F:	drivers/i2c/busses/i2c-st.c
 F:	drivers/tty/serial/st-asc.c
+F:	drivers/mmc/host/sdhci-st.c
 
 ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
 M:	Lennert Buytenhek <kernel@wantstofly.org>
-- 
1.9.1

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

* [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs
  2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
                   ` (9 preceding siblings ...)
  2014-07-09 15:07 ` [PATCH v4 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture Peter Griffin
@ 2014-07-09 15:51 ` Maxime Coquelin
  2014-07-10 12:51   ` Ulf Hansson
  10 siblings, 1 reply; 17+ messages in thread
From: Maxime Coquelin @ 2014-07-09 15:51 UTC (permalink / raw)
  To: linux-arm-kernel



On 07/09/2014 05:07 PM, Peter Griffin wrote:
> This series adds a SDHCI platform driver for ST SoCs, along with
> the additional device tree bindings and configuration to enable
> the controller to work properly.
>
> Initially it supports the stih416 and stih415 SoCs, and has
> been tested on a stih416-b2020 board.
>
> regards,
>
> Peter.
>
> Changes since v1
> - Whitespace cleanups
> - Use readl_relaxed io accessor
> - Add update to MAINTAINERS
> - Remove reset controller code from platform driver
> - Remove #ifdef around sleep ops
> - Use sdhci_pltfm_clk_get_max_clock lib function
> - Pass bus-width etc through board device tree node
> - Remove unncessary header
> - Remove / change some debug messages
> - Remove final break from switch case
>
> Changes since v2
> - Update CC list with alkml and lkml lists
>
> Changes since v3
> - Rebased on v3.16-rc4
> - Use sdhci_set_bus_width lib function for set_bus_width
> - Remove sdhci_st_8bit_width function
> - Use sdhci_set_clock lib function for set_clock
>
> Peter Griffin (10):
>    mmc: sdhci-st: Intial support for ST SDHCI controller
>    mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
>    ARM: STi: DT: Add sdhci pins for stih416
>    ARM: STi: DT: Add sdhci controller for stih416
>    ARM: STi: DT: Add sdhci pin configuration for stih415
>    ARM: STi: DT: Add sdhci controller for stih415
>    ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs
>    ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.
>    ARM: update multi_v7_defconfig for STI
>    MAINTAINERS: Add sdhci-st file to ARCH/STI architecture
>
>   Documentation/devicetree/bindings/mmc/sdhci-st.txt |  33 ++++
>   MAINTAINERS                                        |   1 +
>   arch/arm/boot/dts/stih415-pinctrl.dtsi             |  21 +++
>   arch/arm/boot/dts/stih415.dtsi                     |  12 ++
>   arch/arm/boot/dts/stih416-b2020.dts                |   8 +
>   arch/arm/boot/dts/stih416-b2020e.dts               |   6 +
>   arch/arm/boot/dts/stih416-pinctrl.dtsi             |  39 +++++
>   arch/arm/boot/dts/stih416.dtsi                     |  24 +++
>   arch/arm/boot/dts/stih41x-b2020.dtsi               |   4 +
>   arch/arm/boot/dts/stih41x-b2020x.dtsi              |   4 +
>   arch/arm/configs/multi_v7_defconfig                |   1 +
>   drivers/mmc/host/Kconfig                           |  12 ++
>   drivers/mmc/host/Makefile                          |   1 +
>   drivers/mmc/host/sdhci-st.c                        | 176 +++++++++++++++++++++
>   14 files changed, 342 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
>   create mode 100644 drivers/mmc/host/sdhci-st.c
>

Thanks Peter.

DT patches queued to git://git.stlinux.com/devel/kernel/linux-sti.git 
sti-dt-for-v3.17-1

Regards,
Maxime

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

* [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller
  2014-07-09 15:07 ` [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller Peter Griffin
@ 2014-07-10  7:12   ` Ulf Hansson
  0 siblings, 0 replies; 17+ messages in thread
From: Ulf Hansson @ 2014-07-10  7:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 9 July 2014 17:07, Peter Griffin <peter.griffin@linaro.org> wrote:
> This platform driver adds initial support for the SDHCI host controller
> found on STMicroelectronics SoCs.
>
> It has been tested on STiH41x b2020 platforms currently.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Acked-by: Maxime Coquelin <maxime.coquelin@st.com>

Thanks! Applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/Kconfig    |  12 +++
>  drivers/mmc/host/Makefile   |   1 +
>  drivers/mmc/host/sdhci-st.c | 176 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 189 insertions(+)
>  create mode 100644 drivers/mmc/host/sdhci-st.c
>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index a565254..6615b79 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -290,6 +290,18 @@ config MMC_MOXART
>           be found on some embedded hardware such as UC-7112-LX.
>           If you have a controller with this interface, say Y here.
>
> +config MMC_SDHCI_ST
> +       tristate "SDHCI support on STMicroelectronics SoC"
> +       depends on ARCH_STI
> +       depends on MMC_SDHCI_PLTFM
> +       select MMC_SDHCI_IO_ACCESSORS
> +       help
> +         This selects the Secure Digital Host Controller Interface in
> +         STMicroelectronics SoCs.
> +
> +         If you have a controller with this interface, say Y or M here.
> +         If unsure, say N.
> +
>  config MMC_OMAP
>         tristate "TI OMAP Multimedia Card Interface support"
>         depends on ARCH_OMAP
> diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
> index 7f81ddf..f211eed 100644
> --- a/drivers/mmc/host/Makefile
> +++ b/drivers/mmc/host/Makefile
> @@ -68,6 +68,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_HLWD)               += sdhci-of-hlwd.o
>  obj-$(CONFIG_MMC_SDHCI_BCM_KONA)       += sdhci-bcm-kona.o
>  obj-$(CONFIG_MMC_SDHCI_BCM2835)                += sdhci-bcm2835.o
>  obj-$(CONFIG_MMC_SDHCI_MSM)            += sdhci-msm.o
> +obj-$(CONFIG_MMC_SDHCI_ST)             += sdhci-st.o
>
>  ifeq ($(CONFIG_CB710_DEBUG),y)
>         CFLAGS-cb710-mmc        += -DDEBUG
> diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
> new file mode 100644
> index 0000000..328f348
> --- /dev/null
> +++ b/drivers/mmc/host/sdhci-st.c
> @@ -0,0 +1,176 @@
> +/*
> + * Support for SDHCI on STMicroelectronics SoCs
> + *
> + * Copyright (C) 2014 STMicroelectronics Ltd
> + * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> + * Contributors: Peter Griffin <peter.griffin@linaro.org>
> + *
> + * Based on sdhci-cns3xxx.c
> + *
> + * 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/of.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/mmc/host.h>
> +
> +#include "sdhci-pltfm.h"
> +
> +static u32 sdhci_st_readl(struct sdhci_host *host, int reg)
> +{
> +       u32 ret;
> +
> +       switch (reg) {
> +       case SDHCI_CAPABILITIES:
> +               ret = readl_relaxed(host->ioaddr + reg);
> +               /* Support 3.3V and 1.8V */
> +               ret &= ~SDHCI_CAN_VDD_300;
> +               break;
> +       default:
> +               ret = readl_relaxed(host->ioaddr + reg);
> +       }
> +       return ret;
> +}
> +
> +static const struct sdhci_ops sdhci_st_ops = {
> +       .get_max_clock = sdhci_pltfm_clk_get_max_clock,
> +       .set_clock = sdhci_set_clock,
> +       .set_bus_width = sdhci_set_bus_width,
> +       .read_l = sdhci_st_readl,
> +       .reset = sdhci_reset,
> +};
> +
> +static const struct sdhci_pltfm_data sdhci_st_pdata = {
> +       .ops = &sdhci_st_ops,
> +       .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
> +           SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
> +};
> +
> +
> +static int sdhci_st_probe(struct platform_device *pdev)
> +{
> +       struct sdhci_host *host;
> +       struct sdhci_pltfm_host *pltfm_host;
> +       struct clk *clk;
> +       int ret = 0;
> +       u16 host_version;
> +
> +       clk =  devm_clk_get(&pdev->dev, "mmc");
> +       if (IS_ERR(clk)) {
> +               dev_err(&pdev->dev, "Peripheral clk not found\n");
> +               return PTR_ERR(clk);
> +       }
> +
> +       host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
> +       if (IS_ERR(host)) {
> +               dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
> +               return PTR_ERR(host);
> +       }
> +
> +       ret = mmc_of_parse(host->mmc);
> +
> +       if (ret) {
> +               dev_err(&pdev->dev, "Failed mmc_of_parse\n");
> +               return ret;
> +       }
> +
> +       clk_prepare_enable(clk);
> +
> +       pltfm_host = sdhci_priv(host);
> +       pltfm_host->clk = clk;
> +
> +       ret = sdhci_add_host(host);
> +       if (ret) {
> +               dev_err(&pdev->dev, "Failed sdhci_add_host\n");
> +               goto err_out;
> +       }
> +
> +       platform_set_drvdata(pdev, host);
> +
> +       host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
> +
> +       dev_info(&pdev->dev, "SDHCI ST Initialised: Host Version: 0x%x Vendor Version 0x%x\n",
> +               ((host_version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT),
> +               ((host_version & SDHCI_VENDOR_VER_MASK) >>
> +               SDHCI_VENDOR_VER_SHIFT));
> +
> +       return 0;
> +
> +err_out:
> +       clk_disable_unprepare(clk);
> +       sdhci_pltfm_free(pdev);
> +
> +       return ret;
> +}
> +
> +static int sdhci_st_remove(struct platform_device *pdev)
> +{
> +       struct sdhci_host *host = platform_get_drvdata(pdev);
> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> +       clk_disable_unprepare(pltfm_host->clk);
> +
> +       return sdhci_pltfm_unregister(pdev);
> +}
> +
> +#ifdef CONFIG_PM_SLEEP
> +static int sdhci_st_suspend(struct device *dev)
> +{
> +       struct sdhci_host *host = dev_get_drvdata(dev);
> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       int ret = sdhci_suspend_host(host);
> +
> +       if (ret)
> +               goto out;
> +
> +       clk_disable_unprepare(pltfm_host->clk);
> +out:
> +       return ret;
> +}
> +
> +static int sdhci_st_resume(struct device *dev)
> +{
> +       struct sdhci_host *host = dev_get_drvdata(dev);
> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> +       clk_prepare_enable(pltfm_host->clk);
> +
> +       return sdhci_resume_host(host);
> +}
> +#endif
> +
> +static SIMPLE_DEV_PM_OPS(sdhci_st_pmops, sdhci_st_suspend, sdhci_st_resume);
> +
> +static const struct of_device_id st_sdhci_match[] = {
> +       { .compatible = "st,sdhci" },
> +       {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, st_sdhci_match);
> +
> +static struct platform_driver sdhci_st_driver = {
> +       .probe = sdhci_st_probe,
> +       .remove = sdhci_st_remove,
> +       .driver = {
> +                  .name = "sdhci-st",
> +                  .pm = &sdhci_st_pmops,
> +                  .of_match_table = of_match_ptr(st_sdhci_match),
> +                 },
> +};
> +
> +module_platform_driver(sdhci_st_driver);
> +
> +MODULE_DESCRIPTION("SDHCI driver for STMicroelectronics SoCs");
> +MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:st-sdhci");
> --
> 1.9.1
>

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

* [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
  2014-07-09 15:07 ` [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation Peter Griffin
@ 2014-07-10  7:13   ` Ulf Hansson
  0 siblings, 0 replies; 17+ messages in thread
From: Ulf Hansson @ 2014-07-10  7:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 9 July 2014 17:07, Peter Griffin <peter.griffin@linaro.org> wrote:
> This patch adds the device tree binding documentation for the ST
> SDHCI driver. It documents the differences between the core properties
> described by mmc.txt and the properties used by the sdhci-st driver.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Acked-by: Maxime Coquelin <maxime.coquelin@st.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  Documentation/devicetree/bindings/mmc/sdhci-st.txt | 33 ++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> new file mode 100644
> index 0000000..7527db4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt
> @@ -0,0 +1,33 @@
> +* STMicroelectronics sdhci-st MMC/SD controller
> +
> +This file documents the differences between the core properties in
> +Documentation/devicetree/bindings/mmc/mmc.txt and the properties
> +used by the sdhci-st driver.
> +
> +Required properties:
> +- compatible :  Must be "st,sdhci"
> +- clock-names : Should be "mmc"
> +                See: Documentation/devicetree/bindings/resource-names.txt
> +- clocks :      Phandle of the clock used by the sdhci controler
> +                See: Documentation/devicetree/bindings/clock/clock-bindings.txt
> +
> +Optional properties:
> +- non-removable: non-removable slot
> +                 See: Documentation/devicetree/bindings/mmc/mmc.txt
> +- bus-width: Number of data lines
> +                 See: Documentation/devicetree/bindings/mmc/mmc.txt
> +
> +Example:
> +
> +mmc0: sdhci at fe81e000 {
> +       compatible      = "st,sdhci";
> +       status          = "disabled";
> +       reg             = <0xfe81e000 0x1000>;
> +       interrupts      = <GIC_SPI 127 IRQ_TYPE_NONE>;
> +       interrupt-names = "mmcirq";
> +       pinctrl-names   = "default";
> +       pinctrl-0       = <&pinctrl_mmc0>;
> +       clock-names     = "mmc";
> +       clocks          = <&clk_s_a1_ls 1>;
> +       bus-width       = <8>
> +};
> --
> 1.9.1
>

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

* [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs
  2014-07-09 15:51 ` [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Maxime Coquelin
@ 2014-07-10 12:51   ` Ulf Hansson
  2014-07-10 12:57     ` Maxime Coquelin
  0 siblings, 1 reply; 17+ messages in thread
From: Ulf Hansson @ 2014-07-10 12:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 9 July 2014 17:51, Maxime Coquelin <maxime.coquelin@st.com> wrote:
>
>
> On 07/09/2014 05:07 PM, Peter Griffin wrote:
>>
>> This series adds a SDHCI platform driver for ST SoCs, along with
>> the additional device tree bindings and configuration to enable
>> the controller to work properly.
>>
>> Initially it supports the stih416 and stih415 SoCs, and has
>> been tested on a stih416-b2020 board.
>>
>> regards,
>>
>> Peter.
>>
>> Changes since v1
>> - Whitespace cleanups
>> - Use readl_relaxed io accessor
>> - Add update to MAINTAINERS
>> - Remove reset controller code from platform driver
>> - Remove #ifdef around sleep ops
>> - Use sdhci_pltfm_clk_get_max_clock lib function
>> - Pass bus-width etc through board device tree node
>> - Remove unncessary header
>> - Remove / change some debug messages
>> - Remove final break from switch case
>>
>> Changes since v2
>> - Update CC list with alkml and lkml lists
>>
>> Changes since v3
>> - Rebased on v3.16-rc4
>> - Use sdhci_set_bus_width lib function for set_bus_width
>> - Remove sdhci_st_8bit_width function
>> - Use sdhci_set_clock lib function for set_clock
>>
>> Peter Griffin (10):
>>    mmc: sdhci-st: Intial support for ST SDHCI controller
>>    mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
>>    ARM: STi: DT: Add sdhci pins for stih416
>>    ARM: STi: DT: Add sdhci controller for stih416
>>    ARM: STi: DT: Add sdhci pin configuration for stih415
>>    ARM: STi: DT: Add sdhci controller for stih415
>>    ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs
>>    ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.
>>    ARM: update multi_v7_defconfig for STI
>>    MAINTAINERS: Add sdhci-st file to ARCH/STI architecture
>>
>>   Documentation/devicetree/bindings/mmc/sdhci-st.txt |  33 ++++
>>   MAINTAINERS                                        |   1 +
>>   arch/arm/boot/dts/stih415-pinctrl.dtsi             |  21 +++
>>   arch/arm/boot/dts/stih415.dtsi                     |  12 ++
>>   arch/arm/boot/dts/stih416-b2020.dts                |   8 +
>>   arch/arm/boot/dts/stih416-b2020e.dts               |   6 +
>>   arch/arm/boot/dts/stih416-pinctrl.dtsi             |  39 +++++
>>   arch/arm/boot/dts/stih416.dtsi                     |  24 +++
>>   arch/arm/boot/dts/stih41x-b2020.dtsi               |   4 +
>>   arch/arm/boot/dts/stih41x-b2020x.dtsi              |   4 +
>>   arch/arm/configs/multi_v7_defconfig                |   1 +
>>   drivers/mmc/host/Kconfig                           |  12 ++
>>   drivers/mmc/host/Makefile                          |   1 +
>>   drivers/mmc/host/sdhci-st.c                        | 176
>> +++++++++++++++++++++
>>   14 files changed, 342 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
>>   create mode 100644 drivers/mmc/host/sdhci-st.c
>>
>
> Thanks Peter.
>
> DT patches queued to git://git.stlinux.com/devel/kernel/linux-sti.git
> sti-dt-for-v3.17-1

What about patch9 and 10? Did you take them as well?

You may add my ack for them, for whatever it's worth.

Kind regards
Uffe

>
> Regards,
> Maxime

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

* [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs
  2014-07-10 12:51   ` Ulf Hansson
@ 2014-07-10 12:57     ` Maxime Coquelin
  0 siblings, 0 replies; 17+ messages in thread
From: Maxime Coquelin @ 2014-07-10 12:57 UTC (permalink / raw)
  To: linux-arm-kernel



On 07/10/2014 02:51 PM, Ulf Hansson wrote:
> On 9 July 2014 17:51, Maxime Coquelin <maxime.coquelin@st.com> wrote:
>>
>>
>> On 07/09/2014 05:07 PM, Peter Griffin wrote:
>>>
>>> This series adds a SDHCI platform driver for ST SoCs, along with
>>> the additional device tree bindings and configuration to enable
>>> the controller to work properly.
>>>
>>> Initially it supports the stih416 and stih415 SoCs, and has
>>> been tested on a stih416-b2020 board.
>>>
>>> regards,
>>>
>>> Peter.
>>>
>>> Changes since v1
>>> - Whitespace cleanups
>>> - Use readl_relaxed io accessor
>>> - Add update to MAINTAINERS
>>> - Remove reset controller code from platform driver
>>> - Remove #ifdef around sleep ops
>>> - Use sdhci_pltfm_clk_get_max_clock lib function
>>> - Pass bus-width etc through board device tree node
>>> - Remove unncessary header
>>> - Remove / change some debug messages
>>> - Remove final break from switch case
>>>
>>> Changes since v2
>>> - Update CC list with alkml and lkml lists
>>>
>>> Changes since v3
>>> - Rebased on v3.16-rc4
>>> - Use sdhci_set_bus_width lib function for set_bus_width
>>> - Remove sdhci_st_8bit_width function
>>> - Use sdhci_set_clock lib function for set_clock
>>>
>>> Peter Griffin (10):
>>>     mmc: sdhci-st: Intial support for ST SDHCI controller
>>>     mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.
>>>     ARM: STi: DT: Add sdhci pins for stih416
>>>     ARM: STi: DT: Add sdhci controller for stih416
>>>     ARM: STi: DT: Add sdhci pin configuration for stih415
>>>     ARM: STi: DT: Add sdhci controller for stih415
>>>     ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs
>>>     ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.
>>>     ARM: update multi_v7_defconfig for STI
>>>     MAINTAINERS: Add sdhci-st file to ARCH/STI architecture
>>>
>>>    Documentation/devicetree/bindings/mmc/sdhci-st.txt |  33 ++++
>>>    MAINTAINERS                                        |   1 +
>>>    arch/arm/boot/dts/stih415-pinctrl.dtsi             |  21 +++
>>>    arch/arm/boot/dts/stih415.dtsi                     |  12 ++
>>>    arch/arm/boot/dts/stih416-b2020.dts                |   8 +
>>>    arch/arm/boot/dts/stih416-b2020e.dts               |   6 +
>>>    arch/arm/boot/dts/stih416-pinctrl.dtsi             |  39 +++++
>>>    arch/arm/boot/dts/stih416.dtsi                     |  24 +++
>>>    arch/arm/boot/dts/stih41x-b2020.dtsi               |   4 +
>>>    arch/arm/boot/dts/stih41x-b2020x.dtsi              |   4 +
>>>    arch/arm/configs/multi_v7_defconfig                |   1 +
>>>    drivers/mmc/host/Kconfig                           |  12 ++
>>>    drivers/mmc/host/Makefile                          |   1 +
>>>    drivers/mmc/host/sdhci-st.c                        | 176
>>> +++++++++++++++++++++
>>>    14 files changed, 342 insertions(+)
>>>    create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
>>>    create mode 100644 drivers/mmc/host/sdhci-st.c
>>>
>>
>> Thanks Peter.
>>
>> DT patches queued to git://git.stlinux.com/devel/kernel/linux-sti.git
>> sti-dt-for-v3.17-1
>
> What about patch9 and 10? Did you take them as well?
>
> You may add my ack for them, for whatever it's worth.

Yes I will take them too.

Regards,
Maxime

>
> Kind regards
> Uffe
>
>>
>> Regards,
>> Maxime

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

* [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI
  2014-07-09 15:07 ` [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI Peter Griffin
@ 2014-07-21  9:49   ` Maxime Coquelin
  0 siblings, 0 replies; 17+ messages in thread
From: Maxime Coquelin @ 2014-07-21  9:49 UTC (permalink / raw)
  To: linux-arm-kernel



On 07/09/2014 05:07 PM, Peter Griffin wrote:
> This patch enables SDHCI STI platform driver.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
>   arch/arm/configs/multi_v7_defconfig | 1 +
>   1 file changed, 1 insertion(+)
>
Added to my queue for v3.17.

Thanks,
Maxime

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

end of thread, other threads:[~2014-07-21  9:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 15:07 [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Peter Griffin
2014-07-09 15:07 ` [PATCH v4 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller Peter Griffin
2014-07-10  7:12   ` Ulf Hansson
2014-07-09 15:07 ` [PATCH v4 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation Peter Griffin
2014-07-10  7:13   ` Ulf Hansson
2014-07-09 15:07 ` [PATCH v4 03/10] ARM: STi: DT: Add sdhci pins for stih416 Peter Griffin
2014-07-09 15:07 ` [PATCH v4 04/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
2014-07-09 15:07 ` [PATCH v4 05/10] ARM: STi: DT: Add sdhci pin configuration for stih415 Peter Griffin
2014-07-09 15:07 ` [PATCH v4 06/10] ARM: STi: DT: Add sdhci controller " Peter Griffin
2014-07-09 15:07 ` [PATCH v4 07/10] ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs Peter Griffin
2014-07-09 15:07 ` [PATCH v4 08/10] ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards Peter Griffin
2014-07-09 15:07 ` [PATCH v4 09/10] ARM: update multi_v7_defconfig for STI Peter Griffin
2014-07-21  9:49   ` Maxime Coquelin
2014-07-09 15:07 ` [PATCH v4 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture Peter Griffin
2014-07-09 15:51 ` [PATCH v4 00/10] Add SDHCI support for ST Microelectronics SoCs Maxime Coquelin
2014-07-10 12:51   ` Ulf Hansson
2014-07-10 12:57     ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).