2014-06-04 16:30:59

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 00/10] Add SDHCI support for ST Microelectronics SoCs

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

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-revE.dts | 6 +
arch/arm/boot/dts/stih416-b2020.dts | 8 +
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 | 201 +++++++++++++++++++++
14 files changed, 367 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-st.txt
create mode 100644 drivers/mmc/host/sdhci-st.c

--
1.9.1


2014-06-04 16:31:14

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.

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 <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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@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

2014-06-04 16:31:28

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 07/10] ARM: STi: DT: Enable mmc0 for both stih415 and stih416 SoCs

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 <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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@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@fe81e000 {
+ status = "okay";
+ };
+
spifsm: spifsm@fe902000 {
#address-cells = <1>;
#size-cells = <1>;
--
1.9.1

2014-06-04 16:31:23

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 06/10] ARM: STi: DT: Add sdhci controller for stih415

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

Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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 d6f254f..c81dce4 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@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

2014-06-04 16:31:33

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 09/10] ARM: update multi_v7_defconfig for STI

This patch enables SDHCI STI platform driver.

Signed-off-by: Peter Griffin <[email protected]>
---
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 d4e8a47..48951fc 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -277,6 +277,7 @@ CONFIG_MMC_SDHCI_TEGRA=y
CONFIG_MMC_SDHCI_DOVE=y
CONFIG_MMC_SDHCI_SPEAR=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

2014-06-04 16:31:50

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture

Signed-off-by: Peter Griffin <[email protected]>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6dc67b1..19dc265 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1306,6 +1306,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 <[email protected]>
--
1.9.1

2014-06-04 16:32:08

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 08/10] ARM: STi: DT: Enable second sdhci controller for stih416 b2020 boards.

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

Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
arch/arm/boot/dts/stih416-b2020-revE.dts | 6 ++++++
arch/arm/boot/dts/stih416-b2020.dts | 8 ++++++++
2 files changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/stih416-b2020-revE.dts b/arch/arm/boot/dts/stih416-b2020-revE.dts
index ba0fa2c..68dfdaf 100644
--- a/arch/arm/boot/dts/stih416-b2020-revE.dts
+++ b/arch/arm/boot/dts/stih416-b2020-revE.dts
@@ -31,5 +31,11 @@
ethernet1: dwmac@fef08000 {
snps,reset-gpio = <&PIO0 7>;
};
+
+ mmc1: sdhci@fe81f000 {
+ status = "okay";
+ bus-width = <8>;
+ non-removable;
+ };
};
};
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@fe81f000 {
+ status = "okay";
+ bus-width = <8>;
+ non-removable;
+ };
+ };
};
--
1.9.1

2014-06-04 16:31:20

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 04/10] ARM: STi: DT: Add sdhci controller for stih416

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

Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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 06473c5..6473287 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@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@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

2014-06-04 16:33:07

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 05/10] ARM: STi: DT: Add sdhci pin configuration for stih415

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

Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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 caeac7e..eee2373 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

2014-06-04 16:33:29

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 03/10] ARM: STi: DT: Add sdhci pins for stih416

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

Signed-off-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
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 6252188..dad1f24 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

2014-06-04 16:31:11

by Peter Griffin

[permalink] [raw]
Subject: [PATCH v3 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller

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 <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Maxime Coquelin <[email protected]>
---
drivers/mmc/host/Kconfig | 12 +++
drivers/mmc/host/Makefile | 1 +
drivers/mmc/host/sdhci-st.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 214 insertions(+)
create mode 100644 drivers/mmc/host/sdhci-st.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 8aaf8c1..b62c40d 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -283,6 +283,18 @@ config MMC_SDHCI_BCM2835

If unsure, say N.

+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 0c8aa5e..6e0acf7 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -64,6 +64,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..f321472
--- /dev/null
+++ b/drivers/mmc/host/sdhci-st.c
@@ -0,0 +1,201 @@
+/*
+ * Support for SDHCI on STMicroelectronics SoCs
+ *
+ * Copyright (C) 2014 STMicroelectronics Ltd
+ * Author: Giuseppe Cavallaro <[email protected]>
+ *
+ * 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 int sdhci_st_8bit_width(struct sdhci_host *host, int width)
+{
+ u8 ctrl;
+
+ ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
+
+ switch (width) {
+ case MMC_BUS_WIDTH_8:
+ ctrl |= SDHCI_CTRL_8BITBUS;
+ ctrl &= ~SDHCI_CTRL_4BITBUS;
+ break;
+ case MMC_BUS_WIDTH_4:
+ ctrl |= SDHCI_CTRL_4BITBUS;
+ ctrl &= ~SDHCI_CTRL_8BITBUS;
+ break;
+ default:
+ ctrl &= ~(SDHCI_CTRL_8BITBUS | SDHCI_CTRL_4BITBUS);
+ }
+
+ sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+
+ return 0;
+}
+
+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,
+ .platform_bus_width = sdhci_st_8bit_width,
+ .read_l = sdhci_st_readl,
+};
+
+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);
+ int ret;
+
+ clk_disable_unprepare(pltfm_host->clk);
+
+ ret = sdhci_pltfm_unregister(pdev);
+
+ return ret;
+}
+
+#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",
+ .owner = THIS_MODULE,
+ .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 <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:st-sdhci");
--
1.9.1

2014-06-05 13:08:18

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v3 09/10] ARM: update multi_v7_defconfig for STI

> This patch enables SDHCI STI platform driver.
>
> Signed-off-by: Peter Griffin <[email protected]>
> ---
> arch/arm/configs/multi_v7_defconfig | 1 +
> 1 file changed, 1 insertion(+)

Acked-by: Lee Jones <[email protected]>

> diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
> index d4e8a47..48951fc 100644
> --- a/arch/arm/configs/multi_v7_defconfig
> +++ b/arch/arm/configs/multi_v7_defconfig
> @@ -277,6 +277,7 @@ CONFIG_MMC_SDHCI_TEGRA=y
> CONFIG_MMC_SDHCI_DOVE=y
> CONFIG_MMC_SDHCI_SPEAR=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

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-06-05 14:26:21

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture

> Signed-off-by: Peter Griffin <[email protected]>
> ---
> MAINTAINERS | 1 +
> 1 file changed, 1 insertion(+)

Acked-by: Lee Jones <[email protected]>

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6dc67b1..19dc265 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1306,6 +1306,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 <[email protected]>

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-06-23 10:54:21

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [PATCH v3 09/10] ARM: update multi_v7_defconfig for STI



On 06/04/2014 06:30 PM, Peter Griffin wrote:
> This patch enables SDHCI STI platform driver.
>
> Signed-off-by: Peter Griffin <[email protected]> ---
> arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1
> insertion(+)

Acked-by: Maxime Coquelin <[email protected]>

>
> diff --git a/arch/arm/configs/multi_v7_defconfig
> b/arch/arm/configs/multi_v7_defconfig index d4e8a47..48951fc
> 100644 --- a/arch/arm/configs/multi_v7_defconfig +++
> b/arch/arm/configs/multi_v7_defconfig @@ -277,6 +277,7 @@
> CONFIG_MMC_SDHCI_TEGRA=y CONFIG_MMC_SDHCI_DOVE=y
> CONFIG_MMC_SDHCI_SPEAR=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
>


Attachments:
signature.asc (836.00 B)
OpenPGP digital signature

2014-06-23 10:54:47

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture



On 06/04/2014 06:30 PM, Peter Griffin wrote:
> Signed-off-by: Peter Griffin <[email protected]>

Acked-by: Maxime Coquelin <[email protected]>

> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS index 6dc67b1..19dc265
> 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1306,6 +1306,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
> <[email protected]>
>


Attachments:
signature.asc (836.00 B)
OpenPGP digital signature

2014-07-09 12:18:41

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v3 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller

On 4 June 2014 18:30, Peter Griffin <[email protected]> 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 <[email protected]>
> Signed-off-by: Peter Griffin <[email protected]>
> Acked-by: Lee Jones <[email protected]>
> Acked-by: Maxime Coquelin <[email protected]>

Thanks! Applied for next.

Kind regards
Uffe

2014-07-09 12:19:41

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v3 02/10] mmc: sdhci-st: ST Microelectronics SDHCI binding documentation.

On 4 June 2014 18:30, Peter Griffin <[email protected]> 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 <[email protected]>
> Signed-off-by: Peter Griffin <[email protected]>
> Acked-by: Lee Jones <[email protected]>
> Acked-by: Maxime Coquelin <[email protected]>

Thanks! Applied for next.

Kind regards
Uffe

2014-07-09 12:59:41

by Peter Griffin

[permalink] [raw]
Subject: Re: [PATCH v3 01/10] mmc: sdhci-st: Intial support for ST SDHCI controller

Hi Ulf,

On Wed, 09 Jul 2014, Ulf Hansson wrote:

> On 4 June 2014 18:30, Peter Griffin <[email protected]> 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 <[email protected]>
> > Signed-off-by: Peter Griffin <[email protected]>
> > Acked-by: Lee Jones <[email protected]>
> > Acked-by: Maxime Coquelin <[email protected]>
>
> Thanks! Applied for next.

Can you drop this patch for the moment?

I was just rebasing the series for Maxime, and noticed this patch needs a few
fixups to cope with Russell Kings recent changes in sdhci.c.

regards,

Peter.

2014-07-22 12:14:45

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [STLinux Kernel] [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture

Hi Olof, Arnd, Kevin,

I am preparing two tags for v3.17 regarding STi platform.
One for DT, and one for defconfigs.

Except this one, I have no patches for ARM-SoC.
Can you take this patch directly?

Or should I send a pull request with this one only?

Regards,
Maxime

On 06/23/2014 12:54 PM, Maxime Coquelin wrote:
>
>
> On 06/04/2014 06:30 PM, Peter Griffin wrote:
>> Signed-off-by: Peter Griffin <[email protected]>
>
> Acked-by: Maxime Coquelin <[email protected]>
>
>> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS index 6dc67b1..19dc265
>> 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1306,6 +1306,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
>> <[email protected]>
>>
>
>
>
> _______________________________________________
> Kernel mailing list
> [email protected]
> http://www.stlinux.com/mailman/listinfo/kernel
>

2014-07-22 16:00:07

by Olof Johansson

[permalink] [raw]
Subject: Re: [STLinux Kernel] [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture

On Tue, Jul 22, 2014 at 5:13 AM, Maxime Coquelin <[email protected]> wrote:
> Hi Olof, Arnd, Kevin,
>
> I am preparing two tags for v3.17 regarding STi platform.
> One for DT, and one for defconfigs.
>
> Except this one, I have no patches for ARM-SoC.
> Can you take this patch directly?
>
> Or should I send a pull request with this one only?

We can apply directly. I'll do that in a moment here.


-Olof

2014-07-22 16:16:10

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [STLinux Kernel] [PATCH v3 10/10] MAINTAINERS: Add sdhci-st file to ARCH/STI architecture



On 07/22/2014 06:00 PM, Olof Johansson wrote:
> On Tue, Jul 22, 2014 at 5:13 AM, Maxime Coquelin <[email protected]> wrote:
>> Hi Olof, Arnd, Kevin,
>>
>> I am preparing two tags for v3.17 regarding STi platform.
>> One for DT, and one for defconfigs.
>>
>> Except this one, I have no patches for ARM-SoC.
>> Can you take this patch directly?
>>
>> Or should I send a pull request with this one only?
>
> We can apply directly. I'll do that in a moment here.

Thanks!
Maxime
>
>
> -Olof
>