mmc: sdhci-msm: Add support for Qualcomm chipsets
Subsystems (4)
v8 cover mmc: sdhci-msm: Add support for Qualcomm chipsets
This patchset adds basic support of the Secure Digital Host Controller Interface compliant controller found in Qualcomm chipsets.
Tested with eMMC and various micro SD cards on APQ8074 Dragonboard.
Changes from v7:
- Added call to sdhci_get_of_property().
- Refactored sdhci_msm_dt_parse_vreg_info().
- Fixed possible ERR_PTR() dereferencing.
- Updated DT binding documentation.
- Removed lpm and currents from DT.
- Removed bus-speed-mode from DT.
- Updated and moved the sanity checks.
- Various typo and coding style fixes.
- Added platform_execute_tunning implementation.
Changes from v6:
- Fixed wrong pointer in sdhci_msm_pwr_irq().
- Added platform_execute_tuning() callback as the MSM SDHC does not support tuning as in SDHC 3.0 spec and will need custom implementation in order to support SDR104, HS200 and HS400.
- Removed the always-on devicetree property - if the regulator is configured as always-on, it will not be disabled anyway.
- Removed devm_pinctrl_get_select_default() - the default pins are already set from the device core.
- Removed wrapper function sdhci_msm_set_vdd_io_vol() and enum vdd_io_level and now calling regulator_set_voltage() directly.
- Converted #defines to use BIT() macro.
- Added IS_ERR(vreg->reg) check at the beginning of sdhci_msm_vreg functions.
- Do not print errors when regulators init return -EPROBE_DEFER as the deffered init is not an actual error.
- Handle each power irq status bit separately in sdhci_msm_pwr_irq().
- Ensure that any pending power irq is acknowledged before enabling it, otherwise the irq handler will be fired prematurely.
- Minor changes.
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
Georgi Djakov (3):
mmc: sdhci-msm: Qualcomm SDHCI binding documentation
mmc: sdhci-msm: Initial support for Qualcomm chipsets
mmc: sdhci-msm: Add platform_execute_tunning implementation
.../devicetree/bindings/mmc/sdhci-msm.txt | 83 ++ drivers/mmc/host/Kconfig | 13 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-msm.c | 938 ++++++++++++++++++++ 4 files changed, 1035 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
PATCH v8 1/3 mmc: sdhci-msm: Qualcomm SDHCI binding documentation
This patch adds the device-tree binding documentation for Qualcomm SDHCI 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 | 83 ++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-msm.txt
Documentation/devicetree/bindings/mmc/sdhci-msm.txt new file +83 -0
@@ -0,0 +1,83 @@ +* 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: Base address and length of the register set listed in reg-names. +- reg-names: Should contain the following: + "hc_mem" - Host controller register map + "core_mem" - SD Core register map +- interrupts: Should contain an interrupt-specifiers for the interrupts listed in interrupt-names. +- interrupt-names: Should contain the following: + "hc_irq" - Host controller interrupt + "pwr_irq" - PMIC interrupt +- vdd-supply: Phandle to the regulator for the vdd (core voltage) supply. +- vdd-io-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,vdd-voltage-min - Specifies the minimum core voltage supported by the device in microvolts. +- qcom,vdd-voltage-max - Specifies the maximum core voltage supported by the device in microvolts. +- qcom,vdd-io-voltage-min - Specifies the minimum i/o voltage supported by the device in microvolts. +- qcom,vdd-io-voltage-max - Specifies the maximum i/o voltage supported by the device in microvolts. + +Example: + + sdhc_1: sdhci@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 = <8>; + non-removable; + + vdd-supply = <&pm8941_l20>; + vdd-io-supply = <&pm8941_s3>; + + qcom,vdd-voltage-min = <2950000>; + qcom,vdd-voltage-max = <2950000>; + qcom,vdd-io-voltage-min = <1800000>; + qcom,vdd-io-voltage-max = <1800000>; + + pinctrl-names = "default"; + pinctrl-0 = <&sdc1_clk &sdc1_cmd &sdc1_data>; + + clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>; + clock-names = "core", "iface"; + }; + + sdhc_2: sdhci@f98a4900 { + compatible = "qcom,sdhci-msm"; + reg = <0xf98a4900 0x11c>, <0xf98a4000 0x800>; + reg-names = "hc_mem", "core_mem"; + interrupts = <0 1 2>; + #interrupt-cells = <1>; + interrupt-map = <0 &intc 0 125 0 + 1 &intc 0 221 0>; + interrupt-names = "hc_irq", "pwr_irq"; + bus-width = <4>; + + vdd-supply = <&pm8941_l21>; + vdd-io-supply = <&pm8941_l13>; + + qcom,vdd-voltage-min = <2950000>; + qcom,vdd-voltage-max = <2950000>; + qcom,vdd-io-voltage-min = <1800000>; + qcom,vdd-io-voltage-max = <2950000>; + + pinctrl-names = "default"; + pinctrl-0 = <&sdc2_clk &sdc2_cmd &sdc2_data>; + + clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>; + clock-names = "core", "iface"; + };
Signature · 1 line
1.7.9.5
PATCH v8 2/3 mmc: sdhci-msm: Initial support for Qualcomm chipsets
In reply to Georgi DjakovThis platform driver adds the initial support of Secure Digital Host Controller Interface compliant controller found in Qualcomm chipsets.
--- drivers/mmc/host/Kconfig | 13 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-msm.c | 531 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 545 insertions(+) create mode 100644 drivers/mmc/host/sdhci-msm.c
drivers/mmc/host/Kconfig +13 -0
@@ -334,6 +334,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_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
drivers/mmc/host/Makefile +1 -0
@@ -64,6 +64,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 +531 -0
531 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v8 3/3 mmc: sdhci-msm: Add platform_execute_tunning implementation
In reply to Georgi DjakovThis patch adds implementation for platform specific tuning in order to support HS200 bus speed mode on Qualcomm SDHCI controller.
--- drivers/mmc/host/sdhci-msm.c | 417 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 412 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-msm.c +412 -5
@@ -19,6 +19,8 @@#include <linux/of_device.h> #include <linux/regulator/consumer.h> #include <linux/delay.h> +#include <linux/mmc/mmc.h> +#include <linux/slab.h> #include "sdhci-pltfm.h"
@@ -44,7 +46,40 @@#define CORE_PWRCTL_IO_FAIL BIT(3)#define INT_MASK 0xf +#define MAX_PHASES 16 + +#define CORE_DLL_LOCK BIT(7) +#define CORE_DLL_EN BIT(16) +#define CORE_CDR_EN BIT(17) +#define CORE_CK_OUT_EN BIT(18) +#define CORE_CDR_EXT_EN BIT(19) +#define CORE_DLL_PDN BIT(29) +#define CORE_DLL_RST BIT(30) +#define CORE_DLL_CONFIG 0x100 +#define CORE_DLL_TEST_CTL 0x104 +#define CORE_DLL_STATUS 0x108 + +#define CORE_VENDOR_SPEC 0x10c +#define CORE_CLK_PWRSAVE BIT(1) +#define CORE_IO_PAD_PWR_SWITCH BIT(16) + +static const u32 tuning_block_64[] = { +0x00ff0fff ,0xccc3ccff ,0xffcc3cc3 ,0xeffefffe , +0xddffdfff ,0xfbfffbff ,0xff7fffbf ,0xefbdf777 , +0xf0fff0ff ,0x3cccfc0f ,0xcfcc33cc ,0xeeffefff , +0xfdfffdff ,0xffbfffdf ,0xfff7ffbb ,0xde7b7ff7 +}; +static const u32 tuning_block_128[] = { +0xff00ffff ,0x0000ffff ,0xccccffff ,0xcccc33cc , +0xcc3333cc ,0xffffcccc ,0xffffeeff ,0xffeeeeff , +0xffddffff ,0xddddffff ,0xbbffffff ,0xbbffffff , +0xffffffbb ,0xffffff77 ,0x77ff7777 ,0xffeeddbb , +0x00ffffff ,0x00ffffff ,0xccffff00 ,0xcc33cccc , +0x3333cccc ,0xffcccccc ,0xffeeffff ,0xeeeeffff , +0xddffffff ,0xddffffff ,0xffffffdd ,0xffffffbb , +0xffffbbbb ,0xffff77ff ,0xff7777ff ,0xeeddbb77 +};/* This structure keeps information per regulator */ struct sdhci_msm_reg_data {
@@ -75,17 +110,389 @@ struct sdhci_msm_host { };/* MSM platform specific tuning */ -int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +static inline int msm_dll_poll_ck_out_en (struct sdhci_host *host,u8 poll) +{ +u32 wait_cnt =50 ; +u8 ck_out_en =0 ; +struct mmc_host *mmc = host->mmc; + +/* poll for CK_OUT_EN bit. max. poll time = 50us */ + ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + +while (ck_out_en != poll) { +if (--wait_cnt ==0 ) { +dev_err (mmc_dev (mmc),"%s: CK_OUT_EN bit is not %d\n" , +mmc_hostname (mmc), poll); +return -ETIMEDOUT ; + } +udelay (1 ); + + ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + } + +return 0 ; +} + +static int msm_config_cm_dll_phase (struct sdhci_host *host,u8 phase) +{ +int rc =0 ; +u8 grey_coded_phase_table[] = { +0x0 ,0x1 ,0x3 ,0x2 ,0x6 ,0x7 ,0x5 ,0x4 , +0xc ,0xd ,0xf ,0xe ,0xa ,0xb ,0x9 ,0x8 + }; +unsigned long flags; +u32 config; +struct mmc_host *mmc = host->mmc; + +spin_lock_irqsave (&host->lock, flags); + + config =readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ); + config &= ~(CORE_CDR_EN |CORE_CK_OUT_EN ); + config |= (CORE_CDR_EXT_EN |CORE_DLL_EN ); +writel_relaxed (config, host->ioaddr +CORE_DLL_CONFIG ); + +/* Wait until CK_OUT_EN bit of DLL_CONFIG register becomes '0' */ + rc =msm_dll_poll_ck_out_en (host,0 ); +if (rc) + goto err_out; + +/* +* Write the selected DLL clock output phase (0 ... 15) +* to CDR_SELEXT bit field of DLL_CONFIG register. +*/ +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(0xF <<20 )) + | (grey_coded_phase_table[phase] <<20 )), + host->ioaddr +CORE_DLL_CONFIG ); + +/* Set CK_OUT_EN bit of DLL_CONFIG register to 1. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_CK_OUT_EN ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Wait until CK_OUT_EN bit of DLL_CONFIG register becomes '1' */ + rc =msm_dll_poll_ck_out_en (host,1 ); +if (rc) + goto err_out; + + config =readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ); + config |=CORE_CDR_EN ; + config &= ~CORE_CDR_EXT_EN ; +writel_relaxed (config, host->ioaddr +CORE_DLL_CONFIG ); + goto out; + +err_out: +dev_err (mmc_dev (mmc),"%s: Failed to set DLL phase: %d\n" , +mmc_hostname (mmc), phase); +out: +spin_unlock_irqrestore (&host->lock, flags); +return rc; +} + +/* +* Find out the greatest range of consecuitive selected +* DLL clock output phases that can be used as sampling +* setting for SD3.0 UHS-I card read operation (in SDR104 +* timing mode) or for eMMC4.5 card read operation (in HS200 +* timing mode). +* Select the 3/4 of the range and configure the DLL with the +* selected DLL clock output phase. +*/ + +static int msm_find_most_appropriate_phase (struct sdhci_host *host, +u8 *phase_table,u8 total_phases) +{ +int ret; +u8 ranges[MAX_PHASES ][MAX_PHASES ] = { {0 }, {0 } }; +u8 phases_per_row[MAX_PHASES ] = {0 }; +int row_index =0 , col_index =0 , selected_row_index =0 , curr_max =0 ; +int i, cnt, phase_0_raw_index =0 , phase_15_raw_index =0 ; +bool phase_0_found = false, phase_15_found = false; +struct mmc_host *mmc = host->mmc; + +if (!total_phases || (total_phases >MAX_PHASES )) { +dev_err (mmc_dev (mmc),"%s: invalid argument: total_phases=%d\n" , +mmc_hostname (mmc), total_phases); +return -EINVAL ; + } + +for (cnt =0 ; cnt < total_phases; cnt++) { + ranges[row_index][col_index] = phase_table[cnt]; + phases_per_row[row_index] +=1 ; + col_index++; + +if ((cnt +1 ) == total_phases) { +continue ; +/* check if next phase in phase_table is consecutive or not */ + }else if ((phase_table[cnt] +1 ) != phase_table[cnt +1 ]) { + row_index++; + col_index =0 ; + } + } + +if (row_index >=MAX_PHASES ) +return -EINVAL ; + +/* Check if phase-0 is present in first valid window? */ +if (!ranges[0 ][0 ]) { + phase_0_found = true; + phase_0_raw_index =0 ; +/* Check if cycle exist between 2 valid windows */ +for (cnt =1 ; cnt <= row_index; cnt++) { +if (phases_per_row[cnt]) { +for (i =0 ; i < phases_per_row[cnt]; i++) { +if (ranges[cnt][i] ==15 ) { + phase_15_found = true; + phase_15_raw_index = cnt; +break ; + } + } + } + } + } + +/* If 2 valid windows form cycle then merge them as single window */ +if (phase_0_found && phase_15_found) { +/* number of phases in raw where phase 0 is present */ +u8 phases_0 = phases_per_row[phase_0_raw_index]; +/* number of phases in raw where phase 15 is present */ +u8 phases_15 = phases_per_row[phase_15_raw_index]; + +if (phases_0 + phases_15 >=MAX_PHASES ) +/* +* If there are more than 1 phase windows then total +* number of phases in both the windows should not be +* more than or equal to MAX_PHASES. +*/ +return -EINVAL ; + +/* Merge 2 cyclic windows */ + i = phases_15; +for (cnt =0 ; cnt < phases_0; cnt++) { + ranges[phase_15_raw_index][i] = + ranges[phase_0_raw_index][cnt]; +if (++i >=MAX_PHASES ) +break ; + } + + phases_per_row[phase_0_raw_index] =0 ; + phases_per_row[phase_15_raw_index] = phases_15 + phases_0; + } + +for (cnt =0 ; cnt <= row_index; cnt++) { +if (phases_per_row[cnt] > curr_max) { + curr_max = phases_per_row[cnt]; + selected_row_index = cnt; + } + } + + i = ((curr_max *3 ) /4 ); +if (i) + i--; + + ret = (int )ranges[selected_row_index][i]; + +if (ret >=MAX_PHASES ) { + ret = -EINVAL ; +dev_err (mmc_dev (mmc),"%s: invalid phase selected=%d\n" , +mmc_hostname (mmc), ret); + } + +return ret; +} + +static inline void msm_cm_dll_set_freq (struct sdhci_host *host) +{ +u32 mclk_freq =0 ; + +/* Program the MCLK value to MCLK_FREQ bit field */ +if (host->clock <=112000000 ) + mclk_freq =0 ; +else if (host->clock <=125000000 ) + mclk_freq =1 ; +else if (host->clock <=137000000 ) + mclk_freq =2 ; +else if (host->clock <=150000000 ) + mclk_freq =3 ; +else if (host->clock <=162000000 ) + mclk_freq =4 ; +else if (host->clock <=175000000 ) + mclk_freq =5 ; +else if (host->clock <=187000000 ) + mclk_freq =6 ; +else if (host->clock <=200000000 ) + mclk_freq =7 ; + +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(7 <<24 )) | (mclk_freq <<24 )), + host->ioaddr +CORE_DLL_CONFIG ); +} + +/* Initialize the DLL (Programmable Delay Line ) */ +static int msm_init_cm_dll (struct sdhci_host *host) { +struct mmc_host *mmc = host->mmc; +int wait_cnt =50 ; +unsigned long flags; + +spin_lock_irqsave (&host->lock, flags); +/* -* Tuning is required for SDR104, HS200 and HS400 cards and if the clock -* frequency greater than 100MHz in those modes. The standard tuning -* procedure should not be executed, but a custom implementation will be -* added here instead. +* Make sure that clock is always enabled when DLL +* tuning is in progress. Keeping PWRSAVE ON may +* turn off the clock. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_VENDOR_SPEC ) + & ~CORE_CLK_PWRSAVE ), host->ioaddr +CORE_VENDOR_SPEC ); + +/* Write 1 to DLL_RST bit of DLL_CONFIG register */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_DLL_RST ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Write 1 to DLL_PDN bit of DLL_CONFIG register */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_DLL_PDN ), host->ioaddr +CORE_DLL_CONFIG ); +msm_cm_dll_set_freq (host); + +/* Write 0 to DLL_RST bit of DLL_CONFIG register */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~CORE_DLL_RST ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Write 0 to DLL_PDN bit of DLL_CONFIG register */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~CORE_DLL_PDN ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Set DLL_EN bit to 1. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_DLL_EN ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Set CK_OUT_EN bit to 1. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_CK_OUT_EN ), host->ioaddr +CORE_DLL_CONFIG ); + +/* Wait until DLL_LOCK bit of DLL_STATUS register becomes '1' */ +while (!(readl_relaxed (host->ioaddr +CORE_DLL_STATUS ) & +CORE_DLL_LOCK )) { +/* max. wait for 50us sec for LOCK bit to be set */ +if (--wait_cnt ==0 ) { +dev_err (mmc_dev (mmc),"%s: DLL failed to LOCK\n" , +mmc_hostname (mmc)); +spin_unlock_irqrestore (&host->lock, flags); +return -ETIMEDOUT ; + } +/* wait for 1us before polling again */ +udelay (1 ); + } + +spin_unlock_irqrestore (&host->lock, flags);return 0 ; } +int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +{ +int tuning_seq_cnt =3 ; +u8 phase, *data_buf, tuned_phases[16 ], tuned_phase_cnt =0 ; +const u32 *tuning_block_pattern = tuning_block_64; +int size =sizeof (tuning_block_64);/* Pattern size in bytes */ +int rc; +struct mmc_host *mmc = host->mmc; +struct mmc_ios ios = host->mmc->ios; + +/* +* Tuning is required for SDR104, HS200 and HS400 cards and +* if clock frequency is greater than 100MHz in these modes. +*/ +if (host->clock <=100 *1000 *1000 || + !((ios.timing ==MMC_TIMING_MMC_HS200 ) || + (ios.timing ==MMC_TIMING_UHS_SDR104 ))) +return 0 ; + +if ((opcode ==MMC_SEND_TUNING_BLOCK_HS200 ) && + (mmc->ios.bus_width ==MMC_BUS_WIDTH_8 )) { + tuning_block_pattern = tuning_block_128; + size =sizeof (tuning_block_128); + } + + data_buf =kmalloc (size,GFP_KERNEL ); +if (!data_buf) +return -ENOMEM ; + +retry: +/* first of all reset the tuning block */ + rc =msm_init_cm_dll (host); +if (rc) + goto out; + + phase =0 ; +do { +struct mmc_command cmd = {0 }; +struct mmc_data data = {0 }; +struct mmc_request mrq = { + .cmd = &cmd, + .data = &data + }; +struct scatterlist sg; + +/* set the phase in delay line hw block */ + rc =msm_config_cm_dll_phase (host, phase); +if (rc) + goto out; + + cmd.opcode = opcode; + cmd.flags =MMC_RSP_R1 |MMC_CMD_ADTC ; + + data.blksz = size; + data.blocks =1 ; + data.flags =MMC_DATA_READ ; + data.timeout_ns =1000 *1000 *1000 ;/* 1 sec */ + + data.sg = &sg; + data.sg_len =1 ; +sg_init_one (&sg, data_buf,sizeof (data_buf)); +memset (data_buf,0 ,sizeof (data_buf)); +mmc_wait_for_req (mmc, &mrq); + +if (!cmd.error && !data.error && + !memcmp (data_buf, tuning_block_pattern,sizeof (data_buf))) { +/* tuning is successful at this tuning point */ + tuned_phases[tuned_phase_cnt++] = phase; +dev_dbg (mmc_dev (mmc),"%s: found good phase = %d\n" , +mmc_hostname (mmc), phase); + } + }while (++phase <16 ); + +if (tuned_phase_cnt) { + rc =msm_find_most_appropriate_phase (host, tuned_phases, + tuned_phase_cnt); +if (rc <0 ) + goto out; +else + phase = (u8 ) rc; + +/* +* Finally set the selected phase in delay +* line hw block. +*/ + rc =msm_config_cm_dll_phase (host, phase); +if (rc) + goto out; +dev_dbg (mmc_dev (mmc),"%s: setting the tuning phase to %d\n" , +mmc_hostname (mmc), phase); + }else { +if (--tuning_seq_cnt) + goto retry; +/* tuning failed */ +dev_dbg (mmc_dev (mmc),"%s: no tuning point found\n" , +mmc_hostname (mmc)); + rc = -EIO ; + } + +out: +kfree (data_buf); +return rc; +} +#define MAX_PROP_SIZE 32static int sdhci_msm_dt_parse_vreg_info (struct device *dev,struct sdhci_msm_reg_data *vreg,const char *vreg_name)
Signature · 1 line
1.7.9.5
Re: [PATCH v8 3/3] mmc: sdhci-msm: Add platform_execute_tunning implementation
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 116
Quoted 9 lines · Georgi Djakov
drivers/mmc/host/sdhci-msm.c +4
-1@@ -75,17 +110,389 @@ struct sdhci_msm_host { };/* MSM platform specific tuning */ -int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +static inline int msm_dll_poll_ck_out_en (struct sdhci_host *host,u8 poll) +{ +u32 wait_cnt =50 ; +u8 ck_out_en =0 ;
Looks like a useless assignment.
Quoted 14 lines
drivers/mmc/host/sdhci-msm.c +14
-0+struct mmc_host *mmc = host->mmc; + +/* poll for CK_OUT_EN bit. max. poll time = 50us */ + ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + +while (ck_out_en != poll) { +if (--wait_cnt ==0 ) { +dev_err (mmc_dev (mmc),"%s: CK_OUT_EN bit is not %d\n" , +mmc_hostname (mmc), poll); +return -ETIMEDOUT ; + } +udelay (1 ); +
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 140
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+ ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + } + +return 0 ; +} + +static int msm_config_cm_dll_phase (struct sdhci_host *host,u8 phase) +{ +int rc =0 ;
Looks like a useless assignment.
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 144
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4
-0+u8 grey_coded_phase_table[] = { +0x0 ,0x1 ,0x3 ,0x2 ,0x6 ,0x7 ,0x5 ,0x4 , +0xc ,0xd ,0xf ,0xe ,0xa ,0xb ,0x9 ,0x8 + };
This could be static const?
Quoted 14 lines
drivers/mmc/host/sdhci-msm.c +14
-0+unsigned long flags; +u32 config; +struct mmc_host *mmc = host->mmc; + +spin_lock_irqsave (&host->lock, flags); + + config =readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ); + config &= ~(CORE_CDR_EN |CORE_CK_OUT_EN ); + config |= (CORE_CDR_EXT_EN |CORE_DLL_EN ); +writel_relaxed (config, host->ioaddr +CORE_DLL_CONFIG ); + +/* Wait until CK_OUT_EN bit of DLL_CONFIG register becomes '0' */ + rc =msm_dll_poll_ck_out_en (host,0 ); +if (rc)
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 168
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+ goto err_out; + +/* +* Write the selected DLL clock output phase (0 ... 15) +* to CDR_SELEXT bit field of DLL_CONFIG register. +*/ +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(0xF <<20 )) + | (grey_coded_phase_table[phase] <<20 )), + host->ioaddr +CORE_DLL_CONFIG );
Wow this is complicated. Can we please break this up into multiple lines? What does 0xf << 20 mean?
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5
-0+ +/* Set CK_OUT_EN bit of DLL_CONFIG register to 1. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_CK_OUT_EN ), host->ioaddr +CORE_DLL_CONFIG ); +
[...]
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5
-0+} + +static int msm_find_most_appropriate_phase (struct sdhci_host *host, +u8 *phase_table,u8 total_phases) +{
[...]
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 290
Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +9
-0+ +for (cnt =0 ; cnt <= row_index; cnt++) { +if (phases_per_row[cnt] > curr_max) { + curr_max = phases_per_row[cnt]; + selected_row_index = cnt; + } + } + + i = ((curr_max *3 ) /4 );
Unnecessary extra parentheses here.
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 294
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4
-0+if (i) + i--; + + ret = (int )ranges[selected_row_index][i];
Is this cast necessary?
Quoted 21 lines
drivers/mmc/host/sdhci-msm.c +21
-0+ +if (ret >=MAX_PHASES ) { + ret = -EINVAL ; +dev_err (mmc_dev (mmc),"%s: invalid phase selected=%d\n" , +mmc_hostname (mmc), ret); + } + +return ret; +} + +static inline void msm_cm_dll_set_freq (struct sdhci_host *host) +{ +u32 mclk_freq =0 ; + +/* Program the MCLK value to MCLK_FREQ bit field */ +if (host->clock <=112000000 ) + mclk_freq =0 ; +else if (host->clock <=125000000 ) + mclk_freq =1 ; +else if (host->clock <=137000000 ) + mclk_freq =2 ;
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 325
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+else if (host->clock <=150000000 ) + mclk_freq =3 ; +else if (host->clock <=162000000 ) + mclk_freq =4 ; +else if (host->clock <=175000000 ) + mclk_freq =5 ; +else if (host->clock <=187000000 ) + mclk_freq =6 ; +else if (host->clock <=200000000 ) + mclk_freq =7 ;
This could be a case statement but I'm not sure it's any clearer. At least the range is specified.
switch (host->clock) {
case 0 ... 112000000:
mclk_freq = 0;
break;
case 112000001 ... 125000000:
mclk_freq = 1;
break;
...drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 329
Quoted 4 lines
drivers/mmc/host/sdhci-msm.c +4
-0+ +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(7 <<24 )) | (mclk_freq <<24 )), + host->ioaddr +CORE_DLL_CONFIG );
This is also complicated. Can you split this up into multiple lines?
Quoted 2 lines
drivers/mmc/host/sdhci-msm.c +2
-0+int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +{
[...]
Quoted 11 lines
drivers/mmc/host/sdhci-msm.c +11
-0+ do { + struct mmc_command cmd = { 0 }; + struct mmc_data data = { 0 }; + struct mmc_request mrq = { + .cmd = &cmd, + .data = &data + }; + struct scatterlist sg; + + /* set the phase in delay line hw block */ + rc = msm_config_cm_dll_phase(host, phase);
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 448
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+if (rc) + goto out; + + cmd.opcode = opcode; + cmd.flags =MMC_RSP_R1 |MMC_CMD_ADTC ; + + data.blksz = size; + data.blocks =1 ; + data.flags =MMC_DATA_READ ; + data.timeout_ns =1000 *1000 *1000 ;/* 1 sec */
NSEC_PER_SEC?
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5
-0+ + data.sg = &sg; + data.sg_len =1 ; +sg_init_one (&sg, data_buf,sizeof (data_buf)); +memset (data_buf,0 ,sizeof (data_buf));
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 463
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+mmc_wait_for_req (mmc, &mrq); + +if (!cmd.error && !data.error && + !memcmp (data_buf, tuning_block_pattern,sizeof (data_buf))) { +/* tuning is successful at this tuning point */ + tuned_phases[tuned_phase_cnt++] = phase; +dev_dbg (mmc_dev (mmc),"%s: found good phase = %d\n" , +mmc_hostname (mmc), phase); + } + }while (++phase <16 );
++phase < ARRAY_SIZE(tuned_phases) ?
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 471
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c +8
-0+ +if (tuned_phase_cnt) { + rc =msm_find_most_appropriate_phase (host, tuned_phases, + tuned_phase_cnt); +if (rc <0 ) + goto out; +else + phase = (u8 ) rc;
Unnecessary cast?
Quoted 27 lines
drivers/mmc/host/sdhci-msm.c +24
-0+ +/* +* Finally set the selected phase in delay +* line hw block. +*/ + rc =msm_config_cm_dll_phase (host, phase); +if (rc) + goto out; +dev_dbg (mmc_dev (mmc),"%s: setting the tuning phase to %d\n" , +mmc_hostname (mmc), phase); + }else { +if (--tuning_seq_cnt) + goto retry; +/* tuning failed */ +dev_dbg (mmc_dev (mmc),"%s: no tuning point found\n" , +mmc_hostname (mmc)); + rc = -EIO ; + } + +out: +kfree (data_buf); +return rc; +} +#define MAX_PROP_SIZE 32static int sdhci_msm_dt_parse_vreg_info (struct device *dev,struct sdhci_msm_reg_data *vreg,const char *vreg_name)
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v8 3/3] mmc: sdhci-msm: Add platform_execute_tunning implementation
Hi Stephen,
Quoted 4 lines · Stephen Boyd
Quoted 3 lines · Georgi Djakov
(quoted diff) +0
-0@@ -75,17 +110,389 @@ struct sdhci_msm_host { };
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 116
Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +4
-1/* MSM platform specific tuning */ -int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +static inline int msm_dll_poll_ck_out_en (struct sdhci_host *host,u8 poll) +{ +u32 wait_cnt =50 ; +u8 ck_out_en =0 ;Looks like a useless assignment.
Yes, thanks!
Quoted 19 lines
Quoted 19 lines
drivers/mmc/host/sdhci-msm.c +18
-0+struct mmc_host *mmc = host->mmc; + +/* poll for CK_OUT_EN bit. max. poll time = 50us */ + ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + +while (ck_out_en != poll) { +if (--wait_cnt ==0 ) { +dev_err (mmc_dev (mmc),"%s: CK_OUT_EN bit is not %d\n" , +mmc_hostname (mmc), poll); +return -ETIMEDOUT ; + } +udelay (1 ); + + ck_out_en = !!(readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) & +CORE_CK_OUT_EN ); + } +
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 140
Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +6
-0+return 0 ; +} + +static int msm_config_cm_dll_phase (struct sdhci_host *host,u8 phase) +{ +int rc =0 ;Looks like a useless assignment.
Ok.
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 144
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +4
-0+u8 grey_coded_phase_table[] = { +0x0 ,0x1 ,0x3 ,0x2 ,0x6 ,0x7 ,0x5 ,0x4 , +0xc ,0xd ,0xf ,0xe ,0xa ,0xb ,0x9 ,0x8 + };This could be static const?
Yes, indeed!
Quoted 20 lines
Quoted 20 lines
drivers/mmc/host/sdhci-msm.c +19
-0+unsigned long flags; +u32 config; +struct mmc_host *mmc = host->mmc; + +spin_lock_irqsave (&host->lock, flags); + + config =readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ); + config &= ~(CORE_CDR_EN |CORE_CK_OUT_EN ); + config |= (CORE_CDR_EXT_EN |CORE_DLL_EN ); +writel_relaxed (config, host->ioaddr +CORE_DLL_CONFIG ); + +/* Wait until CK_OUT_EN bit of DLL_CONFIG register becomes '0' */ + rc =msm_dll_poll_ck_out_en (host,0 ); +if (rc) + goto err_out; + +/* +* Write the selected DLL clock output phase (0 ... 15) +* to CDR_SELEXT bit field of DLL_CONFIG register.
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 168
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5
-0+*/ +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(0xF <<20 )) + | (grey_coded_phase_table[phase] <<20 )), + host->ioaddr +CORE_DLL_CONFIG );Wow this is complicated. Can we please break this up into multiple lines? What does
0xf<< 20 mean?
Yes, sure! I will simplify it! Only bits 23:20 are used.
Quoted 13 lines
Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +5
-0+ +/* Set CK_OUT_EN bit of DLL_CONFIG register to 1. */ +writel_relaxed ((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + |CORE_CK_OUT_EN ), host->ioaddr +CORE_DLL_CONFIG ); +[...]
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5
-0+} + +static int msm_find_most_appropriate_phase (struct sdhci_host *host, +u8 *phase_table,u8 total_phases) +{[...]
Quoted 11 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 290
Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +9
-0+ +for (cnt =0 ; cnt <= row_index; cnt++) { +if (phases_per_row[cnt] > curr_max) { + curr_max = phases_per_row[cnt]; + selected_row_index = cnt; + } + } + + i = ((curr_max *3 ) /4 );Unnecessary extra parentheses here.
Thanks!
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 294
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +4
-0+if (i) + i--; + + ret = (int )ranges[selected_row_index][i];Is this cast necessary?
Not necessary. Will fix it!
Quoted 36 lines
Quoted 22 lines
drivers/mmc/host/sdhci-msm.c +21
-0+ +if (ret >=MAX_PHASES ) { + ret = -EINVAL ; +dev_err (mmc_dev (mmc),"%s: invalid phase selected=%d\n" , +mmc_hostname (mmc), ret); + } + +return ret; +} + +static inline void msm_cm_dll_set_freq (struct sdhci_host *host) +{ +u32 mclk_freq =0 ; + +/* Program the MCLK value to MCLK_FREQ bit field */ +if (host->clock <=112000000 ) + mclk_freq =0 ; +else if (host->clock <=125000000 ) + mclk_freq =1 ; +else if (host->clock <=137000000 ) + mclk_freq =2 ;drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 325
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10
-0+else if (host->clock <=150000000 ) + mclk_freq =3 ; +else if (host->clock <=162000000 ) + mclk_freq =4 ; +else if (host->clock <=175000000 ) + mclk_freq =5 ; +else if (host->clock <=187000000 ) + mclk_freq =6 ; +else if (host->clock <=200000000 ) + mclk_freq =7 ;This could be a case statement but I'm not sure it's any clearer. At least the range is specified.
Quoted 8 lines
switch (host->clock) {
case 0 ... 112000000:
mclk_freq = 0;
break;
case 112000001 ... 125000000:
mclk_freq = 1;
break;
...It seems to be shorter with the ifs, so i prefer to keep it this way.
Quoted 7 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 329
Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +4
-0+ +writel_relaxed (((readl_relaxed (host->ioaddr +CORE_DLL_CONFIG ) + & ~(7 <<24 )) | (mclk_freq <<24 )), + host->ioaddr +CORE_DLL_CONFIG );This is also complicated. Can you split this up into multiple lines?
Yes, sure!
Quoted 19 lines
Quoted 3 lines
drivers/mmc/host/sdhci-msm.c +2
-0+int sdhci_msm_execute_tuning (struct sdhci_host *host,u32 opcode) +{[...]
Quoted 15 lines
drivers/mmc/host/sdhci-msm.c +15
-0+ do { + struct mmc_command cmd = { 0 }; + struct mmc_data data = { 0 }; + struct mmc_request mrq = { + .cmd = &cmd, + .data = &data + }; + struct scatterlist sg; + + /* set the phase in delay line hw block */ + rc = msm_config_cm_dll_phase(host, phase); + if (rc) + goto out; + + cmd.opcode = opcode;
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 448
Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +6
-0+ cmd.flags =MMC_RSP_R1 |MMC_CMD_ADTC ; + + data.blksz = size; + data.blocks =1 ; + data.flags =MMC_DATA_READ ; + data.timeout_ns =1000 *1000 *1000 ;/* 1 sec */
NSEC_PER_SEC?
Thanks!
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +9
-0+ + data.sg = &sg; + data.sg_len =1 ; +sg_init_one (&sg, data_buf,sizeof (data_buf)); +memset (data_buf,0 ,sizeof (data_buf)); +mmc_wait_for_req (mmc, &mrq); + +if (!cmd.error && !data.error && + !memcmp (data_buf, tuning_block_pattern,sizeof (data_buf))) {
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 463
Quoted 6 lines
drivers/mmc/host/sdhci-msm.c +6
-0+/* tuning is successful at this tuning point */ + tuned_phases[tuned_phase_cnt++] = phase; +dev_dbg (mmc_dev (mmc),"%s: found good phase = %d\n" , +mmc_hostname (mmc), phase); + } + }while (++phase <16 );++phase <
ARRAY_SIZE(tuned_phases)?
Thanks!
Quoted 11 lines
drivers/mmc/host/sdhci-msm.c struct sdhci_msm_host { · line 471
Quoted 9 lines
drivers/mmc/host/sdhci-msm.c +8
-0+ +if (tuned_phase_cnt) { + rc =msm_find_most_appropriate_phase (host, tuned_phases, + tuned_phase_cnt); +if (rc <0 ) + goto out; +else + phase = (u8 ) rc;Unnecessary cast?
Yes, thank you for the review!
BR,
Georgi
Hi Georgi,
Quoted 4 lines · Georgi Djakov
This patchset adds basic support of the Secure Digital Host Controller Interface compliant controller found in Qualcomm chipsets.
Tested with eMMC and various micro SD cards on APQ8074 Dragonboard.
[...]
Quoted 7 lines
.../devicetree/bindings/mmc/sdhci-msm.txt | 83 ++ drivers/mmc/host/Kconfig | 13 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-msm.c | 938 ++++++++++++++++++++ 4 files changed, 1035 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-msm.txt create mode 100644 drivers/mmc/host/sdhci-msm.c
You must have added entries to the Dragonboard device tree source to test these changes. Why not include them with this patchset? Is there a stand-alone patch that I've overlooked?
Thanks,
Christopher
Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation.
Hi Christopher,
Quoted 18 lines · Christopher Covington
Hi Georgi,
Quoted 4 lines · Georgi Djakov
This patchset adds basic support of the Secure Digital Host Controller Interface compliant controller found in Qualcomm chipsets.
Tested with eMMC and various micro SD cards on APQ8074 Dragonboard.
[...]
Quoted 7 lines
.../devicetree/bindings/mmc/sdhci-msm.txt | 83 ++ drivers/mmc/host/Kconfig | 13 + drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-msm.c | 938 ++++++++++++++++++++ 4 files changed, 1035 insertions(+)create mode 100644
Documentation/devicetree/bindings/mmc/sdhci-msm.txtcreate mode 100644drivers/mmc/host/sdhci-msm.c
Quoted 4 lines
You must have added entries to the Dragonboard device tree source to test these changes. Why not include them with this patchset? Is there a stand-alone patch that I've overlooked?
There have been recently many changes to the devicetree files and in order to avoid possible conflicts i have not added DT nodes yet. But I'll consider adding them, and maybe enable it in the defconfig too. Thanks for your suggestion.
To get it working, take a look at the binding example or just use the following:
sdhci1@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 = <8>;
non-removable;
clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>;
clock-names = "core", "iface";
};sdhci2@f98a4900 {
compatible = "qcom,sdhci-msm";
reg = <0xf98a4900 0x11c>, <0xf98a4000 0x800>;
reg-names = "hc_mem", "core_mem";
interrupts = <0 125 0>, <0 221 0>;
interrupt-names = "hc_irq", "pwr_irq";
bus-width = <4>;
clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>;
clock-names = "core", "iface";
};Thanks,
Georgi