Skip to contentSkip to conversation

mmc: Add OMAP SDHCI driver

PATCH Applied Kishon Vijay Abraham I 5 participants 8 messages Sep 6, 2017 – Sep 22, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover mmc: Add OMAP SDHCI driver

This is the first step in deprecating omap_hsmmc driver completely and moving to sdhci-omap driver which uses the sdhci library.

This patch that adds a new SDHCI quirk "MMC_RSP_136" has already been merged and hence removed it in this revision.

Apart from the quirk, sdhci-omap has it's own callbacks
to set_clock (clock divider programming is different from generic sdhci) , set_power, set_bus_width, set_bus_mode and platform_send_init_74_clocks. These callback functions are implemented based on omap_hsmmc driver. Since sdhci-omap driver requires pbias regulator fixes to be present, I've sent them as part of this series.

The sdhci-omap driver supports only the high speed mode and UHS/HS200 mode will be added in a later series.

It has been tested only in boards having DRA7 SoCs like dra7-evm, dra72-evm, am571x-idk, am572x-idk, am57xx-evm. (Tested only eMMC and SD. SDIO support will be added later). The plan is to fully convert DRA7 SoC to use SDHCI driver and then convert other legacy platforms to use SDHCI.

For sdhci-omap to be functional, the following tag should be merged (There are no compilation dependencies).
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
tags/regulator-pbias-variants

However the above regulator tag will impact omap_hsmmc driver. so [1] should be merged before everything else is merged.

[1] -> https://lkml.org/lkml/2017/8/31/300

The patch to add config and dts changes to use sdhci-omap will be sent separately.

Next Steps:
*) Add UHS support to sdhci-omap
*) Add SDIO support
*) Add support for older TI platforms

Changes from v3:
*) removed omap_hsmmc and pbias-regulator patches from the series *) Fixed dt-binding documentation (remove '0x' in node name) *) stop clock if MMC core sends '0' in frequency

Changes from v2:
*) Rebased on git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git next *) Included a couple of patches from Ravikumar to fix pbias-regulator driver
to support max-voltage of 3.3V. This is required for sdhci-omap driver.
*) Create sdhci-omap as a new driver with MMC generic bindings and hence doesn't
have bindings like ti,dual-volt added for omap-hsmmc. (Instead of ti,dual-volt, sdhci-omap driver uses the supported regulator voltage to set controller IO voltage capabilities).
When omap-hsmmc driver is deprecated, support for these properties will be added to sdhci-omap.
*) Fixed minor comments from Adrian).

Changes from v1:
*) Remove the quirks and instead use sdhci_omap specific callbacks for
set_power, set_busmode etc.
*) Add a patch from Adrian to tidy reading 136-bit responses

I've also pushed the entire series along with dependent dt patches @
https://github.com/kishon/linux-wip.git sdhci_v3 (in case someone wants to test)

Kishon Vijay Abraham I (3):
dt-bindings: sdhci-omap: Add bindings for the sdhci-omap controller
mmc: sdhci-omap: Add OMAP SDHCI driver
MAINTAINERS: Add TI OMAP SDHCI Maintainer

 .../devicetree/bindings/mmc/sdhci-omap.txt         |  16 +
 MAINTAINERS                                        |   6 +
 drivers/mmc/host/Kconfig                           |  12 +
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-omap.c                      | 607 +++++++++++++++++++++
 5 files changed, 642 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-omap.txt
 create mode 100644 drivers/mmc/host/sdhci-omap.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/3 dt-bindings: sdhci-omap: Add bindings for the sdhci-omap controller

Add binding for the TI's sdhci-omap controller.

---
 Documentation/devicetree/bindings/mmc/sdhci-omap.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-omap.txt
Documentation/devicetree/bindings/mmc/sdhci-omap.txt new file +16 -0
new file mode 100644
index 000000000000..51775a372c06
@@ -0,0 +1,16 @@
+* TI OMAP SDHCI Controller
+
+Refer to mmc.txt for standard MMC bindings.
+
+Required properties:
+- compatible: Should be "ti,dra7-sdhci" for DRA7 and DRA72 controllers
+- ti,hwmods: Must be "mmc<n>", <n> is controller instance starting 1
+
+Example:
+	mmc1: mmc at 4809c000 {
+		compatible = "ti,dra7-sdhci";
+		reg = <0x4809c000 0x400>;
+		ti,hwmods = "mmc1";
+		bus-width = <4>;
+		vmmc-supply = <&vmmc>; /* phandle to regulator node */
+	};
Signature · 1 line
2.11.0
maintainer Acked-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: sdhci-omap: Add bindings for the sdhci-omap controller

Quoted 7 lines · Kishon Vijay Abraham I

Add binding for the TI's sdhci-omap controller.

---
 Documentation/devicetree/bindings/mmc/sdhci-omap.txt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-omap.txt
#3 lore raw

PATCH v3 2/3 mmc: sdhci-omap: Add OMAP SDHCI driver

In reply to Kishon Vijay Abraham I

Create a new sdhci-omap driver to configure the eMMC/SD/SDIO controller in TI's OMAP SoCs making use of the SDHCI core library. For OMAP specific configurations, populate sdhci_ops with OMAP specific callbacks and use SDHCI quirks.
Enable only high speed mode for both SD and eMMC here and add other UHS mode support later.

---
 drivers/mmc/host/Kconfig      |  12 +
 drivers/mmc/host/Makefile     |   1 +
 drivers/mmc/host/sdhci-omap.c | 607 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 620 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-omap.c
drivers/mmc/host/Kconfig +12 -0
index 02179ed2a40d..03178c42efbb 100644
@@ -899,3 +899,15 @@ config MMC_SDHCI_XENON
 	  This selects Marvell Xenon eMMC/SD/SDIO SDHCI.
 	  If you have a controller with this interface, say Y or M here.
 	  If unsure, say N.
+
+config MMC_SDHCI_OMAP
+	tristate "TI SDHCI Controller Support"
+	depends on MMC_SDHCI_PLTFM && OF
+	help
+	  This selects the Secure Digital Host Controller Interface (SDHCI)
+	  support present in TI's DRA7 SOCs. The controller supports
+	  SD/MMC/SDIO devices.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
drivers/mmc/host/Makefile +1 -0
index 303f5cd46cd9..2b5a8133948d 100644
@@ -89,6 +89,7 @@ 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
+obj-$(CONFIG_MMC_SDHCI_OMAP)		+= sdhci-omap.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/sdhci-omap.c new file +607 -0

607 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer Acked-by on v3 2/3
#4 lore raw

Re: [PATCH v3 2/3] mmc: sdhci-omap: Add OMAP SDHCI driver

Quoted 8 lines · Kishon Vijay Abraham I

Create a new sdhci-omap driver to configure the eMMC/SD/SDIO controller in TI's OMAP SoCs making use of the SDHCI core library. For OMAP specific configurations, populate sdhci_ops with OMAP specific callbacks and use SDHCI quirks.
Enable only high speed mode for both SD and eMMC here and add other UHS mode support later.

#5 lore raw

PATCH v3 3/3 MAINTAINERS: Add TI OMAP SDHCI Maintainer

In reply to Kishon Vijay Abraham I

Add Maintainer for the TI OMAP SDHCI driver.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 1c3feffb1c1c..e52af3b87404 100644
@@ -11776,6 +11776,12 @@ L:	linux-mmc at vger.kernel.org
 S:	Maintained
 F:	drivers/mmc/host/sdhci-spear.c
 
+SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) TI OMAP DRIVER
+M:	Kishon Vijay Abraham I <[email protected]>
+L:	linux-mmc at vger.kernel.org
+S:	Maintained
+F:	drivers/mmc/host/sdhci-omap.c
+
 SECURE ENCRYPTING DEVICE (SED) OPAL DRIVER
 M:	Scott Bauer <[email protected]>
 M:	Jonathan Derrick <[email protected]>
Signature · 1 line
2.11.0
Applied
#7 lore raw
In reply to Kishon Vijay Abraham I
Quoted 22 lines · Kishon Vijay Abraham I

This is the first step in deprecating omap_hsmmc driver completely and moving to sdhci-omap driver which uses the sdhci library.

This patch that adds a new SDHCI quirk "MMC_RSP_136" has already been merged and hence removed it in this revision.

Apart from the quirk, sdhci-omap has it's own callbacks
to set_clock (clock divider programming is different from generic sdhci) , set_power, set_bus_width, set_bus_mode and platform_send_init_74_clocks. These callback functions are implemented based on omap_hsmmc driver. Since sdhci-omap driver requires pbias regulator fixes to be present, I've sent them as part of this series.

The sdhci-omap driver supports only the high speed mode and UHS/HS200 mode will be added in a later series.

It has been tested only in boards having DRA7 SoCs like dra7-evm, dra72-evm, am571x-idk, am572x-idk, am57xx-evm. (Tested only eMMC and SD. SDIO support will be added later). The plan is to fully convert DRA7 SoC to use SDHCI driver and then convert other legacy platforms to use SDHCI.

Quoted 4 lines

For sdhci-omap to be functional, the following tag should be merged (There are no compilation dependencies).
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
tags/regulator-pbias-variants

Tag pulled.

Quoted 5 lines

However the above regulator tag will impact omap_hsmmc driver. so [1] should be merged before everything else is merged.

[1] -> https://lkml.org/lkml/2017/8/31/300

Applied.

Quoted 49 lines

The patch to add config and dts changes to use sdhci-omap will be sent separately.

Next Steps:
*) Add UHS support to sdhci-omap
*) Add SDIO support
*) Add support for older TI platforms

Changes from v3:
*) removed omap_hsmmc and pbias-regulator patches from the series *) Fixed dt-binding documentation (remove '0x' in node name) *) stop clock if MMC core sends '0' in frequency

Changes from v2:
*) Rebased on git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git next *) Included a couple of patches from Ravikumar to fix pbias-regulator driver
to support max-voltage of 3.3V. This is required for sdhci-omap driver.
*) Create sdhci-omap as a new driver with MMC generic bindings and hence doesn't
have bindings like ti,dual-volt added for omap-hsmmc. (Instead of ti,dual-volt, sdhci-omap driver uses the supported regulator voltage to set controller IO voltage capabilities).
When omap-hsmmc driver is deprecated, support for these properties will be added to sdhci-omap.
*) Fixed minor comments from Adrian).

Changes from v1:
*) Remove the quirks and instead use sdhci_omap specific callbacks for
set_power, set_busmode etc.
*) Add a patch from Adrian to tidy reading 136-bit responses

I've also pushed the entire series along with dependent dt patches @
https://github.com/kishon/linux-wip.git sdhci_v3 (in case someone wants to test)

Kishon Vijay Abraham I (3):
dt-bindings: sdhci-omap: Add bindings for the sdhci-omap controller
mmc: sdhci-omap: Add OMAP SDHCI driver
MAINTAINERS: Add TI OMAP SDHCI Maintainer

 .../devicetree/bindings/mmc/sdhci-omap.txt         |  16 +
 MAINTAINERS                                        |   6 +
 drivers/mmc/host/Kconfig                           |  12 +
 drivers/mmc/host/Makefile                          |   1 +
 drivers/mmc/host/sdhci-omap.c                      | 607 +++++++++++++++++++++
 5 files changed, 642 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-omap.txt
 create mode 100644 drivers/mmc/host/sdhci-omap.c
Quoted 3 lines

--
2.11.0

Thanks, everything applied/pulled for next! Great work!

Kind regards
Uffe