Skip to contentSkip to conversation

mmc: sdhci-msm: Add support for MSM chipsets

PATCH Superseded Georgi Djakov 2 participants 5 messages Sep 27, 2013 – Oct 6, 2013

Subsystems (4)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v6 cover mmc: sdhci-msm: Add support for MSM chipsets

This patchset adds support of the Secure Digital Host Controller Interface compliant controller found in Qualcomm MSM chipsets. It has been tested on a APQ8074 Dragonboard.

Changes from v5:
- Driver is split into multiple patches
- Do not initialize variables that are assigned later in code
- Remove some useless comments
- Use shorter variable names
- Change pr_err() to dev_err()
- Optimized sdhci_msm_setup_vreg()
- Some code alignment fixes
- Improved DT values sanity check
- Added dev_dbg print for sdhci controller version in probe()
- Added usleep_range() after SW reset - it can take some time
- Added SDHCI_QUIRK_SINGLE_POWER_WRITE - power handled by PMIC
- Renamed DT property vdd-io to vddio

Changes from v4:
- Simplified sdhci_msm_vreg_disable() and sdhci_msm_set_vdd_io_vol()
- Use devm_ioremap_resource() instead of devm_ioremap()
- Converted IS_ERR_OR_NULL to IS_ERR
- Disable regulators in sdhci_msm_remove()
- Check for DT node at the beginning in sdhci_msm_probe()
- Removed more redundant code
- Changes in some error messages
- Minor fixes

Changes from v3:
- Allocate memory for all required structs at once
- Added termination entry in sdhci_msm_dt_match[]
- Fixed a missing sdhci_pltfm_free() in probe()
- Removed redundant of_match_ptr
- Removed the unneeded function sdhci_msm_vreg_reset()

Changes from v2:
- Added DT bindings for clocks
- Moved voltage regulators data to platform data
- Removed unneeded includes
- Removed obsolete and wrapper functions
- Removed error checking where unnecessary
- Removed redundant _clk suffix from clock names
- Just return instead of goto where possible
- Minor fixes

Changes from v1:
- GPIO references are replaced by pinctrl
- DT parsing is done mostly by mmc_of_parse()
- Use of_match_device() for DT matching
- A few minor changes

Georgi Djakov (2):
mmc: sdhci-msm: Initial SDHCI MSM driver documentation
mmc: sdhci-msm: Initial support for MSM chipsets

 .../devicetree/bindings/mmc/sdhci-msm.txt          |   70 +++
 drivers/mmc/host/Kconfig                           |   13 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/sdhci-msm.c                       |  644 ++++++++++++++++++++
 4 files changed, 728 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-msm.txt
 create mode 100644 drivers/mmc/host/sdhci-msm.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v6 1/2 mmc: sdhci-msm: Initial SDHCI MSM driver documentation

This patch adds documentation for Qualcomm SDHCI MSM driver. It contains the differences between the core properties in mmc.txt and the properties used by the sdhci-msm driver.

---
 .../devicetree/bindings/mmc/sdhci-msm.txt          |   70 ++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-msm.txt
Documentation/devicetree/bindings/mmc/sdhci-msm.txt new file +70 -0
new file mode 100644
index 0000000..81dd221
@@ -0,0 +1,70 @@
+* Qualcomm SDHCI controller (sdhci-msm)
+
+This file documents differences between the core properties in mmc.txt
+and the properties used by the sdhci-msm driver.
+
+Required properties:
+- compatible: should contain "qcom,sdhci-msm"
+- reg: should contain SDHC, SD Core register map
+- reg-names: indicates various resources passed to driver (via reg proptery) by name
+	"reg-names" examples are "hc_mem" and "core_mem"
+- interrupts: should contain SDHC interrupts
+- interrupt-names: indicates interrupts passed to driver (via interrupts property) by name
+	"interrupt-names" examples are "hc_irq" and "pwr_irq"
+- vdd-supply: phandle to the regulator for the vdd (flash core voltage) supply.
+- vddio-supply: phandle to the regulator for the vdd-io (i/o voltage) supply.
+- pinctrl-names: Should contain only one value - "default".
+- pinctrl-0: Should specify pin control groups used for this controller.
+- clocks: A list of phandle + clock-specifier pairs for the clocks listed in clock-names
+- clock-names: Should contain the following:
+	"iface" - Main peripheral bus clock (PCLK/HCLK - AHB Bus clock) (required)
+	"core"	- SDC MMC clock (MCLK) (required)
+	"bus"	- SDCC bus voter clock (optional)
+
+Optional properties:
+- qcom,bus-speed-mode: specifies the supported bus speed modes by host
+	The supported bus speed modes are :
+	"HS200_1p8v" - indicates that host can support HS200 at 1.8v
+	"HS200_1p2v" - indicates that host can support HS200 at 1.2v
+	"DDR_1p8v" - indicates that host can support DDR mode at 1.8v
+	"DDR_1p2v" - indicates that host can support DDR mode at 1.2v
+
+- qcom,{vdd,vddio}-always-on - specifies whether the supply should be kept "on" always.
+- qcom,{vdd,vddio}-lpm-sup - specifies whether the supply can be kept in low power mode.
+- qcom,{vdd,vddio}-voltage-level - specifies voltage levels for the supply.
+	Should be specified in pairs (min, max), units uV.
+- qcom,{vdd,vddio}-current-level - specifies load levels for the supply in lpm
+	or high power mode (hpm). Should be specified in pairs (lpm, hpm), units uA.
+
+Example:
+
+	aliases {
+		sdhc1 = &sdhc_1;
+	};
+
+	sdhc_1: qcom,sdhc@f9824900 {
+		compatible = "qcom,sdhci-msm";
+		reg = <0xf9824900 0x11c>, <0xf9824000 0x800>;
+		reg-names = "hc_mem", "core_mem";
+		interrupts = <0 123 0>, <0 138 0>;
+		interrupt-names = "hc_irq", "pwr_irq";
+		bus-width = <4>;
+		non-removable;
+
+		vdd-supply = <&pm8941_l21>;
+		vddio-supply = <&pm8941_l13>;
+		qcom,vdd-voltage-level = <2950000 2950000>;
+		qcom,vdd-current-level = <9000 800000>;
+		qcom,vddio-always-on;
+		qcom,vddio-lpm-sup;
+		qcom,vddio-voltage-level = <1800000 2950000>;
+		qcom,vddio-current-level = <6 22000>;
+		qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
+
+		pinctrl-names = "default"
+		pinctrl-0 = <&sdc1_clk &sdc1_cmd &sdc1_data>;
+
+		clocks = <&iface>, <&core>, <&bus>;
+		clock-names = "iface", "core", "bus";
+
+	};
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v6 2/2 mmc: sdhci-msm: Initial support for MSM chipsets

In reply to Georgi Djakov

This platform driver adds the initial support of Secure Digital Host Controller Interface compliant controller found in Qualcomm MSM chipsets.

CC Asutosh Das <[email protected]>
CC Venkat Gopalakrishnan <[email protected]>
CC Sahitya Tummala <[email protected]>
CC Subhash Jadavani <[email protected]>
---
 drivers/mmc/host/Kconfig     |   13 +
 drivers/mmc/host/Makefile    |    1 +
 drivers/mmc/host/sdhci-msm.c |  644 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 658 insertions(+)
 create mode 100644 drivers/mmc/host/sdhci-msm.c
drivers/mmc/host/Kconfig +13 -0
index 8a4c066..2b31471 100644
@@ -322,6 +322,19 @@ config MMC_ATMELMCI
 
 	  If unsure, say N.
 
+config MMC_SDHCI_MSM
+	tristate "Qualcomm SDHCI Controller Support"
+	depends on ARCH_MSM
+	depends on MMC_SDHCI_PLTFM
+	help
+	  This selects the Secure Digital Host Controller Interface (SDHCI)
+	  support present in MSM SOCs from Qualcomm. The controller
+	  supports SD/MMC/SDIO devices.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_MSM
 	tristate "Qualcomm SDCC Controller Support"
 	depends on MMC && ARCH_MSM
drivers/mmc/host/Makefile +1 -0
index d422e21..efd6e6a 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_ESDHC)	+= sdhci-of-esdhc.o
 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
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/sdhci-msm.c new file +644 -0

644 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH v6 2/2] mmc: sdhci-msm: Initial support for MSM chipsets

Hi Georgi,

Thanks for working on this, unfortunately it seems like I need to port the rpm regulators to be able to test this.
But I did find that...

Quoted 4 lines · Georgi Djakov

...

drivers/mmc/host/sdhci-msm.c new file +3 -0
+static irqreturn_t sdhci_msm_pwr_irq(int irq, void *data)
+{
+       struct sdhci_msm_host *msm_host = (struct sdhci_msm_host *)data;

drivers/mmc/host/sdhci-msm.c

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c new file +7 -0
...
+static int sdhci_msm_probe(struct platform_device *pdev)
+{
+       struct sdhci_host *host;
+       struct sdhci_msm_host *msm_host;
...
+       ret = devm_request_threaded_irq(&pdev->dev, msm_host->pwr_irq, NULL,
+                                       sdhci_msm_pwr_irq, IRQF_ONESHOT,
+                                       dev_name(&pdev->dev), host);
...

...sdhci_msm_pwr_irq() expects the data pointer to be msm_host, not sdhci_host, so right now I only get a panic. So I suspect you mean msm_host as the last param here.

Regards,
Bjorn

#4 lore raw

Re: [PATCH v6 2/2] mmc: sdhci-msm: Initial support for MSM chipsets

Hi Bjorn,

Quoted 6 lines

Hi Georgi,

Thanks for working on this, unfortunately it seems like I need to port the rpm regulators to be able to test this.
But I did find that...

Yes, the regulators support is still missing upstream. Until then, a basic testing can be done by bypassing the regulators init part in order to use the power on defaults for regulators and maybe also clocks.

Quoted 12 lines · Georgi Djakov
Quoted 11 lines

...

drivers/mmc/host/sdhci-msm.c new file +8 -0
+static irqreturn_t sdhci_msm_pwr_irq(int irq, void *data)
+{
+       struct sdhci_msm_host *msm_host = (struct sdhci_msm_host *)data;
...
+static int sdhci_msm_probe(struct platform_device *pdev)
+{
+       struct sdhci_host *host;
+       struct sdhci_msm_host *msm_host;
...
+       ret = devm_request_threaded_irq(&pdev->dev, msm_host->pwr_irq,
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c line 560

Quoted 4 lines

NULL,

drivers/mmc/host/sdhci-msm.c new file +2 -0
+                                       sdhci_msm_pwr_irq, IRQF_ONESHOT,
+                                       dev_name(&pdev->dev), host);
...

...sdhci_msm_pwr_irq() expects the data pointer to be msm_host, not sdhci_host, so right now I only get a panic. So I suspect you mean msm_host as the last param here.

Yes, you are right, I have also noticed this and it is fixed in the next version which i will be posting in the next few days. Thanks!

BR,
Georgi