Target specific DLL configuration for qcom SDHC
Subsystems (4)
cover Target specific DLL configuration for qcom SDHC
Sarthak Garg (6):
dt-bindings: mmc: Add information for DLL register properties
mmc: sdhci-msm: Update dll_config_3 as per HSR
mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
mmc: sdhci-msm: Read and use DLL Config property from device tree file
mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
mmc: sdhci-msm: dump vendor specific registers during error
Veerabhadrarao Badiganti (1):
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
.../devicetree/bindings/mmc/sdhci-msm.txt | 14 +++ drivers/mmc/host/sdhci-msm.c | 103 ++++++++++++++++++++- drivers/mmc/host/sdhci.c | 3 + drivers/mmc/host/sdhci.h | 1 + 4 files changed, 118 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/7 dt-bindings: mmc: Add information for DLL register properties
Add information regarding DLL register properties for getting target specific configurations. These DLL register settings may vary from target to target.
Also new compatible string value for sm8250 target.
--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +14 -0
@@ -17,6 +17,7 @@ Required properties: "qcom,msm8916-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8992-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8996-sdhci", "qcom,sdhci-msm-v4" + "qcom,sm8250-sdhci", "qcom,sdhci-msm-v5" "qcom,sdm845-sdhci", "qcom,sdhci-msm-v5" "qcom,qcs404-sdhci", "qcom,sdhci-msm-v5" "qcom,sc7180-sdhci", "qcom,sdhci-msm-v5";
@@ -46,6 +47,13 @@ Required properties: "cal" - reference clock for RCLK delay calibration (optional) "sleep" - sleep clock for RCLK delay calibration (optional) +- qcom,ddr-config: Certain chipsets and platforms require particular settings + for the DDR_CONFIG register. Use this field to specify the register + value as per the Hardware Programming Guide. + +- qcom,dll-config: Chipset and Platform specific value. Use this field to + specify the DLL_CONFIG register value as per Hardware Programming Guide. + Example: sdhc_1: sdhci@f9824900 {
@@ -63,6 +71,9 @@ Example: clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x000f642c>; + qcom,ddr-config = <0x80040868>; }; sdhc_2: sdhci@f98a4900 {
@@ -80,4 +91,7 @@ Example: clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x0007642c>; + qcom,ddr-config = <0x80040868>; };
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH V1 1/7] dt-bindings: mmc: Add information for DLL register properties
Quoted 24 lines · Sarthak Garg
Add information regarding DLL register properties for getting target specific configurations. These DLL register settings may vary from target to target.
Also new compatible string value for sm8250 target.
Signed-off-by Sarthak Garg <[email protected]>--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/sdhci-msm.txt +1
-0@@ -17,6 +17,7 @@ Required properties: "qcom,msm8916-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8992-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8996-sdhci", "qcom,sdhci-msm-v4" + "qcom,sm8250-sdhci", "qcom,sdhci-msm-v5" "qcom,sdm845-sdhci", "qcom,sdhci-msm-v5" "qcom,qcs404-sdhci", "qcom,sdhci-msm-v5" "qcom,sc7180-sdhci", "qcom,sdhci-msm-v5";
Documentation/devicetree/bindings/mmc/sdhci-msm.txt Required properties: · line 55
Quoted 9 lines
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +6
-0@@ -46,6 +47,13 @@ Required properties: "cal" - reference clock for RCLK delay calibration (optional) "sleep" - sleep clock for RCLK delay calibration (optional) +- qcom,ddr-config: Certain chipsets and platforms require particular settings + for the DDR_CONFIG register. Use this field to specify the register + value as per the Hardware Programming Guide. + +- qcom,dll-config: Chipset and Platform specific value. Use this field to + specify the DLL_CONFIG register value as per Hardware Programming Guide.
Board specific or SoC specific? If the latter, imply this from the compatible string.
Re: [PATCH V1 1/7] dt-bindings: mmc: Add information for DLL register properties
Quoted 29 lines · Rob Herring
Quoted 28 lines · Sarthak Garg
Add information regarding DLL register properties for getting target specific configurations. These DLL register settings may vary from target to target.
Also new compatible string value for sm8250 target.
Signed-off-by Sarthak Garg <[email protected]>--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/sdhci-msm.txt +1
-0@@ -17,6 +17,7 @@ Required properties: "qcom,msm8916-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8992-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8996-sdhci", "qcom,sdhci-msm-v4" + "qcom,sm8250-sdhci", "qcom,sdhci-msm-v5" "qcom,sdm845-sdhci", "qcom,sdhci-msm-v5" "qcom,qcs404-sdhci", "qcom,sdhci-msm-v5" "qcom,sc7180-sdhci", "qcom,sdhci-msm-v5";@@ -46,6 +47,13 @@ Required properties: "cal" - reference clock for RCLK delay calibration (optional) "sleep" - sleep clock for RCLK delay calibration (optional)
Quoted 12 lines
Quoted 9 lines
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +1
-0+- qcom,ddr-config: Certain chipsets and platforms require particularsettings
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +4
-0+ for the DDR_CONFIG register. Use this field to specify the register + value as per the Hardware Programming Guide. + +- qcom,dll-config: Chipset and Platform specific value. Use thisfield to
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +1
-0+ specify the DLL_CONFIG register value as per Hardware ProgrammingGuide.
Board specific or SoC specific? If the latter, imply this from the compatible string.
Reposting again as can't find my comment on the https://patchwork.kernel.org/ page. Whatever DLL settings are SOC specific are being taken care with the compatible string. That is the reason we introduced qcom,sm8250-sdhci string.
The above listed two configuration can change from board to board as-well.
Re: [PATCH V1 1/7] dt-bindings: mmc: Add information for DLL register properties
In reply to Sarthak GargQuoted 6 lines · Sarthak Garg
Add information regarding DLL register properties for getting target specific configurations. These DLL register settings may vary from target to target.
Also new compatible string value for sm8250 target.
As Rob indicated, it's a bit confusing to understand the bindings. I think the word "target" is what makes this confusing.
I would suggest splitting this patch into two pieces. One that adds the new compatible string for the new variant and another patch that adds the *board specific* dll bindings. That should clarify this.
Kind regards
Uffe
Quoted 53 lines
Signed-off-by Sarthak Garg <[email protected]>--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/sdhci-msm.txt +14
-1@@ -17,6 +17,7 @@ Required properties: "qcom,msm8916-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8992-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8996-sdhci", "qcom,sdhci-msm-v4" + "qcom,sm8250-sdhci", "qcom,sdhci-msm-v5" "qcom,sdm845-sdhci", "qcom,sdhci-msm-v5" "qcom,qcs404-sdhci", "qcom,sdhci-msm-v5" "qcom,sc7180-sdhci", "qcom,sdhci-msm-v5";@@ -46,6 +47,13 @@ Required properties: "cal" - reference clock for RCLK delay calibration (optional) "sleep" - sleep clock for RCLK delay calibration (optional) +- qcom,ddr-config: Certain chipsets and platforms require particular settings + for the DDR_CONFIG register. Use this field to specify the register + value as per the Hardware Programming Guide. + +- qcom,dll-config: Chipset and Platform specific value. Use this field to + specify the DLL_CONFIG register value as per Hardware Programming Guide. + Example: sdhc_1: sdhci@f9824900 {@@ -63,6 +71,9 @@ Example: clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x000f642c>; + qcom,ddr-config = <0x80040868>; }; sdhc_2: sdhci@f98a4900 {@@ -80,4 +91,7 @@ Example: clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x0007642c>; + qcom,ddr-config = <0x80040868>; }; --2.7.4
PATCH 2/7 mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
In reply to Sarthak GargFrom: Veerabhadrarao Badiganti <[email protected]>
With SDCC v5.1.0, additional setting needed for enabling DLL output. The dll-user-control register need to be configured during dll initialization for getting proper dll output.
Without this configuration, we don't get the DLL lock status properly. Also update the DLL register settings according to the SDCC Hardware Programming Guide.
--- drivers/mmc/host/sdhci-msm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/mmc/host/sdhci-msm.c +29 -0
@@ -57,6 +57,11 @@#define CORE_FLL_CYCLE_CNT BIT(18)#define CORE_DLL_CLOCK_DISABLE BIT(21) +#define DLL_USR_CTL_POR_VAL 0x10800 +#define ENABLE_DLL_LOCK_STATUS BIT(26) +#define FINE_TUNE_MODE_EN BIT(27) +#define BIAS_OK_SIGNAL BIT(29) +#define CORE_VENDOR_SPEC_POR_VAL 0xa9c#define CORE_CLK_PWRSAVE BIT(1)#define CORE_HC_MCLK_SEL_DFLT (2 << 8)
@@ -157,6 +162,7 @@ struct sdhci_msm_offset {u32 core_dll_config_3;u32 core_ddr_config_old;/* Applicable to sdcc minor ver < 0x49 */ u32 core_ddr_config; +u32 core_dll_usr_ctl;/* Present on SDCC5.1 onwards */ };static const struct sdhci_msm_offset sdhci_msm_v5_offset = {
@@ -186,6 +192,7 @@ static const struct sdhci_msm_offset sdhci_msm_v5_offset = { .core_dll_config_2 = 0x254, .core_dll_config_3 = 0x258, .core_ddr_config = 0x25c, + .core_dll_usr_ctl = 0x388, };static const struct sdhci_msm_offset sdhci_msm_mci_offset = {
@@ -231,6 +238,7 @@ struct sdhci_msm_variant_ops {struct sdhci_msm_variant_info {bool mci_removed;bool restore_dll_config; +bool uses_tassadar_dll;const struct sdhci_msm_variant_ops *var_ops;const struct sdhci_msm_offset *offset; };
@@ -263,6 +271,7 @@ struct sdhci_msm_host {bool use_cdr;u32 transfer_mode;bool updated_ddr_cfg; +bool uses_tassadar_dll; };static const struct sdhci_msm_offset *sdhci_priv_msm_offset (struct sdhci_host *host)
@@ -677,6 +686,17 @@ static int msm_init_cm_dll(struct sdhci_host *host) msm_offset->core_dll_config_2); } +/* +* Configure DLL user control register to enable DLL status. +* This setting is applicable to SDCC v5.1 onwards only. +*/ +if (msm_host->uses_tassadar_dll) { + config =DLL_USR_CTL_POR_VAL |FINE_TUNE_MODE_EN | +ENABLE_DLL_LOCK_STATUS |BIAS_OK_SIGNAL ; +writel_relaxed (config, host->ioaddr + + msm_offset->core_dll_usr_ctl); + } + config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config); config |=CORE_DLL_EN ;
@@ -1861,10 +1881,18 @@ static const struct sdhci_msm_variant_info sdm845_sdhci_var = { .offset = &sdhci_msm_v5_offset, }; +static const struct sdhci_msm_variant_info sm8250_sdhci_var = { + .mci_removed = true, + .uses_tassadar_dll = true, + .var_ops = &v5_var_ops, + .offset = &sdhci_msm_v5_offset, +}; +static const struct of_device_id sdhci_msm_dt_match[] = { {.compatible ="qcom,sdhci-msm-v4" , .data = &sdhci_msm_mci_var}, {.compatible ="qcom,sdhci-msm-v5" , .data = &sdhci_msm_v5_var}, {.compatible ="qcom,sdm845-sdhci" , .data = &sdm845_sdhci_var}, + {.compatible ="qcom,sm8250-sdhci" , .data = &sm8250_sdhci_var}, {}, };
@@ -1929,6 +1957,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->restore_dll_config = var_info->restore_dll_config; msm_host->var_ops = var_info->var_ops; msm_host->offset = var_info->offset; + msm_host->uses_tassadar_dll = var_info->uses_tassadar_dll; msm_offset = msm_host->offset;
Signature · 1 line
2.7.4
PATCH 3/7 mmc: sdhci-msm: Update dll_config_3 as per HSR
In reply to Sarthak GargUpdate dll_config_3 as per the host clock frequency as specified in the DLL Hardware Reference Guide.
--- drivers/mmc/host/sdhci-msm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mmc/host/sdhci-msm.c +13 -0
@@ -62,6 +62,9 @@#define FINE_TUNE_MODE_EN BIT(27)#define BIAS_OK_SIGNAL BIT(29) +#define DLL_CONFIG_3_LOW_FREQ_VAL 0x08 +#define DLL_CONFIG_3_HIGH_FREQ_VAL 0x10 +#define CORE_VENDOR_SPEC_POR_VAL 0xa9c#define CORE_CLK_PWRSAVE BIT(1)#define CORE_HC_MCLK_SEL_DFLT (2 << 8)
@@ -695,6 +698,16 @@ static int msm_init_cm_dll(struct sdhci_host *host)ENABLE_DLL_LOCK_STATUS |BIAS_OK_SIGNAL ;writel_relaxed (config, host->ioaddr + msm_offset->core_dll_usr_ctl); + + config =readl_relaxed (host->ioaddr + + msm_offset->core_dll_config_3); + config &= ~0xFF ; +if (msm_host->clk_rate <150000000 ) + config |=DLL_CONFIG_3_LOW_FREQ_VAL ; +else + config |=DLL_CONFIG_3_HIGH_FREQ_VAL ; +writel_relaxed (config, host->ioaddr + + msm_offset->core_dll_config_3); } config = readl_relaxed(host->ioaddr +
Signature · 1 line
2.7.4
PATCH 4/7 mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
In reply to Sarthak GargCertain platforms require different settings in the SDCC_HC_REG_DDR_CONFIG register. This setting can change from platform to platform. So the driver should check whether a particular platform require a different setting by reading the device tree file and use it.
--- drivers/mmc/host/sdhci-msm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-msm.c +16 -1
@@ -275,6 +275,7 @@ struct sdhci_msm_host {u32 transfer_mode;bool updated_ddr_cfg;bool uses_tassadar_dll; +u32 ddr_config; };static const struct sdhci_msm_offset *sdhci_priv_msm_offset (struct sdhci_host *host)
@@ -987,7 +988,7 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host) ddr_cfg_offset = msm_offset->core_ddr_config; else ddr_cfg_offset = msm_offset->core_ddr_config_old; -writel_relaxed (DDR_CONFIG_POR_VAL , host->ioaddr + ddr_cfg_offset); +writel_relaxed (msm_host->ddr_config, host->ioaddr + ddr_cfg_offset);if (mmc->ios.enhanced_strobe) { config = readl_relaxed(host->ioaddr +
@@ -1933,6 +1934,19 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = { .ops = &sdhci_msm_ops, }; +static inline void sdhci_msm_get_of_property (struct platform_device *pdev, +struct sdhci_host *host) +{ +struct device_node *node = pdev->dev.of_node; +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host); + +if (of_property_read_u32 (node,"qcom,ddr-config" , + &msm_host->ddr_config)) + msm_host->ddr_config =DDR_CONFIG_POR_VAL ; +} + +static int sdhci_msm_probe (struct platform_device *pdev) {struct sdhci_host *host;
@@ -1975,6 +1989,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_offset = msm_host->offset;sdhci_get_of_property (pdev); +sdhci_msm_get_of_property (pdev, host); msm_host->saved_tuning_phase =INVALID_TUNING_PHASE ;
Signature · 1 line
2.7.4
PATCH 5/7 mmc: sdhci-msm: Read and use DLL Config property from device tree file
In reply to Sarthak GargCertain platforms require different settings in the SDCC_HC_REG_DLL_CONFIG register. This setting can change from platform to platform. So the driver should check whether a particular platform require a different setting by reading the DT file and use it.
Also use msm_cm_dll_set_freq only when DLL not supplied.
--- drivers/mmc/host/sdhci-msm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-msm.c +11 -2
@@ -275,6 +275,7 @@ struct sdhci_msm_host {u32 transfer_mode;bool updated_ddr_cfg;bool uses_tassadar_dll; +u32 dll_config;u32 ddr_config; };
@@ -617,6 +618,9 @@ static int msm_init_cm_dll(struct sdhci_host *host) config &= ~CORE_CLK_PWRSAVE ;writel_relaxed (config, host->ioaddr + msm_offset->core_vendor_spec); + config = msm_host->dll_config; +writel_relaxed (config, host->ioaddr + msm_offset->core_dll_config); +if (msm_host->use_14lpp_dll_reset) { config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config);
@@ -642,7 +646,9 @@ static int msm_init_cm_dll(struct sdhci_host *host) config |=CORE_DLL_PDN ;writel_relaxed (config, host->ioaddr + msm_offset->core_dll_config); -msm_cm_dll_set_freq (host); + +if (!msm_host->dll_config) +msm_cm_dll_set_freq (host);if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL (msm_host->xo_clk)) {
@@ -682,7 +688,8 @@ static int msm_init_cm_dll(struct sdhci_host *host) msm_offset->core_dll_config);if (msm_host->use_14lpp_dll_reset) { -msm_cm_dll_set_freq (host); +if (!msm_host->dll_config) +msm_cm_dll_set_freq (host); config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config_2); config &= ~CORE_DLL_CLOCK_DISABLE ;
@@ -1944,6 +1951,8 @@ static inline void sdhci_msm_get_of_property(struct platform_device *pdev,if (of_property_read_u32 (node,"qcom,ddr-config" , &msm_host->ddr_config)) msm_host->ddr_config =DDR_CONFIG_POR_VAL ; + +of_property_read_u32 (node,"qcom,dll-config" , &msm_host->dll_config); }
Signature · 1 line
2.7.4
PATCH 6/7 mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
In reply to Sarthak GargIntroduce new sdhci ops to dump vendor specific registers in the sdhci_dumpregs during error.
--- drivers/mmc/host/sdhci.c | 3 +++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 4 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
@@ -111,6 +111,9 @@ void sdhci_dumpregs(struct sdhci_host *host) } } +if (host->ops->dump_vendor_regs) + host->ops->dump_vendor_regs (host); +SDHCI_DUMP ("============================================\n" ); }EXPORT_SYMBOL_GPL (sdhci_dumpregs);
drivers/mmc/host/sdhci.h +1 -0
@@ -650,6 +650,7 @@ struct sdhci_ops { dma_addr_t addr, int len, unsigned int cmd);void (*request_done)(struct sdhci_host *host,struct mmc_request *mrq); +void (*dump_vendor_regs)(struct sdhci_host *host); };#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
Signature · 1 line
2.7.4
PATCH 7/7 mmc: sdhci-msm: dump vendor specific registers during error
In reply to Sarthak GargImplement dump_vendor_registers host operation to print the vendor specific registers in addition to standard SDHC register during error conditions.
--- drivers/mmc/host/sdhci-msm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/mmc/host/sdhci-msm.c +31 -0
@@ -1874,6 +1874,36 @@ static void sdhci_msm_reset(struct sdhci_host *host, u8 mask)sdhci_reset (host, mask); } +#define DRIVER_NAME "sdhci_msm" +#define SDHCI_MSM_DUMP(f, x...) \ + pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x) + +void sdhci_msm_dump_vendor_regs (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host); +const struct sdhci_msm_offset *msm_offset = msm_host->offset; + +SDHCI_MSM_DUMP ("----------- VENDOR REGISTER DUMP -----------\n" ); + +SDHCI_MSM_DUMP ( +"DLL sts: 0x%08x | DLL cfg: 0x%08x | DLL cfg2: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_dll_status), +readl_relaxed (host->ioaddr + msm_offset->core_dll_config), +readl_relaxed (host->ioaddr + msm_offset->core_dll_config_2)); +SDHCI_MSM_DUMP ( +"DLL cfg3: 0x%08x | DLL usr ctl: 0x%08x | DDR cfg: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_dll_config_3), +readl_relaxed (host->ioaddr + msm_offset->core_dll_usr_ctl), +readl_relaxed (host->ioaddr + msm_offset->core_ddr_config)); +SDHCI_MSM_DUMP ( +"Vndr func: 0x%08x | Vndr func2 : 0x%08x Vndr func3: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_vendor_spec), +readl_relaxed (host->ioaddr + + msm_offset->core_vendor_spec_func2), +readl_relaxed (host->ioaddr + msm_offset->core_vendor_spec3)); +} +static const struct sdhci_msm_variant_ops mci_var_ops = { .msm_readl_relaxed = sdhci_msm_mci_variant_readl_relaxed, .msm_writel_relaxed = sdhci_msm_mci_variant_writel_relaxed,
@@ -1929,6 +1959,7 @@ static const struct sdhci_ops sdhci_msm_ops = { .write_w = sdhci_msm_writew, .write_b = sdhci_msm_writeb, .irq = sdhci_msm_cqe_irq, + .dump_vendor_regs = sdhci_msm_dump_vendor_regs, };static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 1 line
2.7.4
Quoted 10 lines · Sarthak Garg
Sarthak Garg (6):
dt-bindings: mmc: Add information for DLL register properties
mmc: sdhci-msm: Updatedll_config_3as per HSR
mmc: sdhci-msm: UpdateDDR_CONFIGas per device tree file
mmc: sdhci-msm: Read and use DLL Config property from device tree file
mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
mmc: sdhci-msm: dump vendor specific registers during errorVeerabhadrarao Badiganti (1):
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
For patches 2 to 7
Quoted 7 lines
.../devicetree/bindings/mmc/sdhci-msm.txt | 14 +++ drivers/mmc/host/sdhci-msm.c | 103 ++++++++++++++++++++- drivers/mmc/host/sdhci.c | 3 + drivers/mmc/host/sdhci.h | 1 + 4 files changed, 118 insertions(+), 3 deletions(-)
v2 cover Board specific DLL configuration for qcom SDHC
In reply to Sarthak GargChanges since V1:
-Splitting documentation change into two patches to
avoid confusion
-For the rest of patches retaining Andrians Ack.
Sarthak Garg (7):
dt-bindings: mmc: Add new compatible string for sm8250 target
dt-bindings: mmc: Add information for DLL register properties
mmc: sdhci-msm: Update dll_config_3 as per HSR
mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
mmc: sdhci-msm: Read and use DLL Config property from device tree file
mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
mmc: sdhci-msm: dump vendor specific registers during error
Veerabhadrarao Badiganti (1):
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
.../devicetree/bindings/mmc/sdhci-msm.txt | 14 +++ drivers/mmc/host/sdhci-msm.c | 103 ++++++++++++++++++++- drivers/mmc/host/sdhci.c | 3 + drivers/mmc/host/sdhci.h | 1 + 4 files changed, 118 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
v2 cover Board specific DLL configuration for qcom SDHC
In reply to Sarthak GargChanges since V1:
-Splitting documentation change into two patches to
avoid confusion
-For the rest of patches retaining Andrians Ack.
Sarthak Garg (7):
dt-bindings: mmc: Add new compatible string for sm8250 target
dt-bindings: mmc: Add information for DLL register properties
mmc: sdhci-msm: Update dll_config_3 as per HSR
mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
mmc: sdhci-msm: Read and use DLL Config property from device tree file
mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
mmc: sdhci-msm: dump vendor specific registers during error
Veerabhadrarao Badiganti (1):
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
.../devicetree/bindings/mmc/sdhci-msm.txt | 14 +++ drivers/mmc/host/sdhci-msm.c | 103 ++++++++++++++++++++- drivers/mmc/host/sdhci.c | 3 + drivers/mmc/host/sdhci.h | 1 + 4 files changed, 118 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/8 dt-bindings: mmc: Add new compatible string for sm8250 target
Add new compatible string for sm8250 target.
--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +1 -0
@@ -17,6 +17,7 @@ Required properties: "qcom,msm8916-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8992-sdhci", "qcom,sdhci-msm-v4" "qcom,msm8996-sdhci", "qcom,sdhci-msm-v4" + "qcom,sm8250-sdhci", "qcom,sdhci-msm-v5" "qcom,sdm845-sdhci", "qcom,sdhci-msm-v5" "qcom,qcs404-sdhci", "qcom,sdhci-msm-v5" "qcom,sc7180-sdhci", "qcom,sdhci-msm-v5";
Signature · 1 line
2.7.4
PATCH v2 2/8 dt-bindings: mmc: Add information for DLL register properties
In reply to Sarthak GargAdd information regarding DLL register properties for getting board specific configurations. These DLL register settings may vary from board to board.
--- Documentation/devicetree/bindings/mmc/sdhci-msm.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +13 -0
@@ -47,6 +47,13 @@ Required properties: "cal" - reference clock for RCLK delay calibration (optional) "sleep" - sleep clock for RCLK delay calibration (optional) +- qcom,ddr-config: Certain chipsets and platforms require particular settings + for the DDR_CONFIG register. Use this field to specify the register + value as per the Hardware Programming Guide. + +- qcom,dll-config: Chipset and Platform specific value. Use this field to + specify the DLL_CONFIG register value as per Hardware Programming Guide. + Example: sdhc_1: sdhci@f9824900 {
@@ -64,6 +71,9 @@ Example: clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x000f642c>; + qcom,ddr-config = <0x80040868>; }; sdhc_2: sdhci@f98a4900 {
@@ -81,4 +91,7 @@ Example: clocks = <&gcc GCC_SDCC2_APPS_CLK>, <&gcc GCC_SDCC2_AHB_CLK>; clock-names = "core", "iface"; + + qcom,dll-config = <0x0007642c>; + qcom,ddr-config = <0x80040868>; };
Signature · 1 line
2.7.4
PATCH v2 3/8 mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
In reply to Sarthak GargFrom: Veerabhadrarao Badiganti <[email protected]>
With SDCC v5.1.0, additional setting needed for enabling DLL output. The dll-user-control register need to be configured during dll initialization for getting proper dll output.
Without this configuration, we don't get the DLL lock status properly. Also update the DLL register settings according to the SDCC Hardware Programming Guide.
--- drivers/mmc/host/sdhci-msm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/mmc/host/sdhci-msm.c +29 -0
@@ -57,6 +57,11 @@#define CORE_FLL_CYCLE_CNT BIT(18)#define CORE_DLL_CLOCK_DISABLE BIT(21) +#define DLL_USR_CTL_POR_VAL 0x10800 +#define ENABLE_DLL_LOCK_STATUS BIT(26) +#define FINE_TUNE_MODE_EN BIT(27) +#define BIAS_OK_SIGNAL BIT(29) +#define CORE_VENDOR_SPEC_POR_VAL 0xa9c#define CORE_CLK_PWRSAVE BIT(1)#define CORE_HC_MCLK_SEL_DFLT (2 << 8)
@@ -157,6 +162,7 @@ struct sdhci_msm_offset {u32 core_dll_config_3;u32 core_ddr_config_old;/* Applicable to sdcc minor ver < 0x49 */ u32 core_ddr_config; +u32 core_dll_usr_ctl;/* Present on SDCC5.1 onwards */ };static const struct sdhci_msm_offset sdhci_msm_v5_offset = {
@@ -186,6 +192,7 @@ static const struct sdhci_msm_offset sdhci_msm_v5_offset = { .core_dll_config_2 = 0x254, .core_dll_config_3 = 0x258, .core_ddr_config = 0x25c, + .core_dll_usr_ctl = 0x388, };static const struct sdhci_msm_offset sdhci_msm_mci_offset = {
@@ -231,6 +238,7 @@ struct sdhci_msm_variant_ops {struct sdhci_msm_variant_info {bool mci_removed;bool restore_dll_config; +bool uses_tassadar_dll;const struct sdhci_msm_variant_ops *var_ops;const struct sdhci_msm_offset *offset; };
@@ -263,6 +271,7 @@ struct sdhci_msm_host {bool use_cdr;u32 transfer_mode;bool updated_ddr_cfg; +bool uses_tassadar_dll; };static const struct sdhci_msm_offset *sdhci_priv_msm_offset (struct sdhci_host *host)
@@ -677,6 +686,17 @@ static int msm_init_cm_dll(struct sdhci_host *host) msm_offset->core_dll_config_2); } +/* +* Configure DLL user control register to enable DLL status. +* This setting is applicable to SDCC v5.1 onwards only. +*/ +if (msm_host->uses_tassadar_dll) { + config =DLL_USR_CTL_POR_VAL |FINE_TUNE_MODE_EN | +ENABLE_DLL_LOCK_STATUS |BIAS_OK_SIGNAL ; +writel_relaxed (config, host->ioaddr + + msm_offset->core_dll_usr_ctl); + } + config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config); config |=CORE_DLL_EN ;
@@ -1861,10 +1881,18 @@ static const struct sdhci_msm_variant_info sdm845_sdhci_var = { .offset = &sdhci_msm_v5_offset, }; +static const struct sdhci_msm_variant_info sm8250_sdhci_var = { + .mci_removed = true, + .uses_tassadar_dll = true, + .var_ops = &v5_var_ops, + .offset = &sdhci_msm_v5_offset, +}; +static const struct of_device_id sdhci_msm_dt_match[] = { {.compatible ="qcom,sdhci-msm-v4" , .data = &sdhci_msm_mci_var}, {.compatible ="qcom,sdhci-msm-v5" , .data = &sdhci_msm_v5_var}, {.compatible ="qcom,sdm845-sdhci" , .data = &sdm845_sdhci_var}, + {.compatible ="qcom,sm8250-sdhci" , .data = &sm8250_sdhci_var}, {}, };
@@ -1930,6 +1958,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->restore_dll_config = var_info->restore_dll_config; msm_host->var_ops = var_info->var_ops; msm_host->offset = var_info->offset; + msm_host->uses_tassadar_dll = var_info->uses_tassadar_dll; msm_offset = msm_host->offset;
Signature · 1 line
2.7.4
PATCH v2 4/8 mmc: sdhci-msm: Update dll_config_3 as per HSR
In reply to Sarthak GargUpdate dll_config_3 as per the host clock frequency as specified in the DLL Hardware Reference Guide.
--- drivers/mmc/host/sdhci-msm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mmc/host/sdhci-msm.c +13 -0
@@ -62,6 +62,9 @@#define FINE_TUNE_MODE_EN BIT(27)#define BIAS_OK_SIGNAL BIT(29) +#define DLL_CONFIG_3_LOW_FREQ_VAL 0x08 +#define DLL_CONFIG_3_HIGH_FREQ_VAL 0x10 +#define CORE_VENDOR_SPEC_POR_VAL 0xa9c#define CORE_CLK_PWRSAVE BIT(1)#define CORE_HC_MCLK_SEL_DFLT (2 << 8)
@@ -695,6 +698,16 @@ static int msm_init_cm_dll(struct sdhci_host *host)ENABLE_DLL_LOCK_STATUS |BIAS_OK_SIGNAL ;writel_relaxed (config, host->ioaddr + msm_offset->core_dll_usr_ctl); + + config =readl_relaxed (host->ioaddr + + msm_offset->core_dll_config_3); + config &= ~0xFF ; +if (msm_host->clk_rate <150000000 ) + config |=DLL_CONFIG_3_LOW_FREQ_VAL ; +else + config |=DLL_CONFIG_3_HIGH_FREQ_VAL ; +writel_relaxed (config, host->ioaddr + + msm_offset->core_dll_config_3); } config = readl_relaxed(host->ioaddr +
Signature · 1 line
2.7.4
PATCH v2 5/8 mmc: sdhci-msm: Update DDR_CONFIG as per device tree file
In reply to Sarthak GargCertain platforms require different settings in the SDCC_HC_REG_DDR_CONFIG register. This setting can change from platform to platform. So the driver should check whether a particular platform require a different setting by reading the device tree file and use it.
--- drivers/mmc/host/sdhci-msm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-msm.c +16 -1
@@ -275,6 +275,7 @@ struct sdhci_msm_host {u32 transfer_mode;bool updated_ddr_cfg;bool uses_tassadar_dll; +u32 ddr_config; };static const struct sdhci_msm_offset *sdhci_priv_msm_offset (struct sdhci_host *host)
@@ -987,7 +988,7 @@ static int sdhci_msm_cm_dll_sdc4_calibration(struct sdhci_host *host) ddr_cfg_offset = msm_offset->core_ddr_config; else ddr_cfg_offset = msm_offset->core_ddr_config_old; -writel_relaxed (DDR_CONFIG_POR_VAL , host->ioaddr + ddr_cfg_offset); +writel_relaxed (msm_host->ddr_config, host->ioaddr + ddr_cfg_offset);if (mmc->ios.enhanced_strobe) { config = readl_relaxed(host->ioaddr +
@@ -1933,6 +1934,19 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = { .ops = &sdhci_msm_ops, }; +static inline void sdhci_msm_get_of_property (struct platform_device *pdev, +struct sdhci_host *host) +{ +struct device_node *node = pdev->dev.of_node; +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host); + +if (of_property_read_u32 (node,"qcom,ddr-config" , + &msm_host->ddr_config)) + msm_host->ddr_config =DDR_CONFIG_POR_VAL ; +} + +static int sdhci_msm_probe (struct platform_device *pdev) {struct sdhci_host *host;
@@ -1976,6 +1990,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_offset = msm_host->offset;sdhci_get_of_property (pdev); +sdhci_msm_get_of_property (pdev, host); msm_host->saved_tuning_phase =INVALID_TUNING_PHASE ;
Signature · 1 line
2.7.4
PATCH v2 6/8 mmc: sdhci-msm: Read and use DLL Config property from device tree file
In reply to Sarthak GargCertain platforms require different settings in the SDCC_HC_REG_DLL_CONFIG register. This setting can change from platform to platform. So the driver should check whether a particular platform require a different setting by reading the DT file and use it.
Also use msm_cm_dll_set_freq only when DLL not supplied.
--- drivers/mmc/host/sdhci-msm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-msm.c +11 -2
@@ -275,6 +275,7 @@ struct sdhci_msm_host {u32 transfer_mode;bool updated_ddr_cfg;bool uses_tassadar_dll; +u32 dll_config;u32 ddr_config; };
@@ -617,6 +618,9 @@ static int msm_init_cm_dll(struct sdhci_host *host) config &= ~CORE_CLK_PWRSAVE ;writel_relaxed (config, host->ioaddr + msm_offset->core_vendor_spec); + config = msm_host->dll_config; +writel_relaxed (config, host->ioaddr + msm_offset->core_dll_config); +if (msm_host->use_14lpp_dll_reset) { config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config);
@@ -642,7 +646,9 @@ static int msm_init_cm_dll(struct sdhci_host *host) config |=CORE_DLL_PDN ;writel_relaxed (config, host->ioaddr + msm_offset->core_dll_config); -msm_cm_dll_set_freq (host); + +if (!msm_host->dll_config) +msm_cm_dll_set_freq (host);if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL (msm_host->xo_clk)) {
@@ -682,7 +688,8 @@ static int msm_init_cm_dll(struct sdhci_host *host) msm_offset->core_dll_config);if (msm_host->use_14lpp_dll_reset) { -msm_cm_dll_set_freq (host); +if (!msm_host->dll_config) +msm_cm_dll_set_freq (host); config =readl_relaxed (host->ioaddr + msm_offset->core_dll_config_2); config &= ~CORE_DLL_CLOCK_DISABLE ;
@@ -1944,6 +1951,8 @@ static inline void sdhci_msm_get_of_property(struct platform_device *pdev,if (of_property_read_u32 (node,"qcom,ddr-config" , &msm_host->ddr_config)) msm_host->ddr_config =DDR_CONFIG_POR_VAL ; + +of_property_read_u32 (node,"qcom,dll-config" , &msm_host->dll_config); }
Signature · 1 line
2.7.4
PATCH v2 7/8 mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
In reply to Sarthak GargIntroduce new sdhci ops to dump vendor specific registers in the sdhci_dumpregs during error.
--- drivers/mmc/host/sdhci.c | 3 +++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 4 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
@@ -111,6 +111,9 @@ void sdhci_dumpregs(struct sdhci_host *host) } } +if (host->ops->dump_vendor_regs) + host->ops->dump_vendor_regs (host); +SDHCI_DUMP ("============================================\n" ); }EXPORT_SYMBOL_GPL (sdhci_dumpregs);
drivers/mmc/host/sdhci.h +1 -0
@@ -650,6 +650,7 @@ struct sdhci_ops { unsigned int length);void (*request_done)(struct sdhci_host *host,struct mmc_request *mrq); +void (*dump_vendor_regs)(struct sdhci_host *host); };#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
Signature · 1 line
2.7.4
PATCH v2 8/8 mmc: sdhci-msm: dump vendor specific registers during error
In reply to Sarthak GargImplement dump_vendor_registers host operation to print the vendor specific registers in addition to standard SDHC register during error conditions.
--- drivers/mmc/host/sdhci-msm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/mmc/host/sdhci-msm.c +31 -0
@@ -1874,6 +1874,36 @@ static void sdhci_msm_reset(struct sdhci_host *host, u8 mask)sdhci_reset (host, mask); } +#define DRIVER_NAME "sdhci_msm" +#define SDHCI_MSM_DUMP(f, x...) \ + pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x) + +void sdhci_msm_dump_vendor_regs (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host); +const struct sdhci_msm_offset *msm_offset = msm_host->offset; + +SDHCI_MSM_DUMP ("----------- VENDOR REGISTER DUMP -----------\n" ); + +SDHCI_MSM_DUMP ( +"DLL sts: 0x%08x | DLL cfg: 0x%08x | DLL cfg2: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_dll_status), +readl_relaxed (host->ioaddr + msm_offset->core_dll_config), +readl_relaxed (host->ioaddr + msm_offset->core_dll_config_2)); +SDHCI_MSM_DUMP ( +"DLL cfg3: 0x%08x | DLL usr ctl: 0x%08x | DDR cfg: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_dll_config_3), +readl_relaxed (host->ioaddr + msm_offset->core_dll_usr_ctl), +readl_relaxed (host->ioaddr + msm_offset->core_ddr_config)); +SDHCI_MSM_DUMP ( +"Vndr func: 0x%08x | Vndr func2 : 0x%08x Vndr func3: 0x%08x\n" , +readl_relaxed (host->ioaddr + msm_offset->core_vendor_spec), +readl_relaxed (host->ioaddr + + msm_offset->core_vendor_spec_func2), +readl_relaxed (host->ioaddr + msm_offset->core_vendor_spec3)); +} +static const struct sdhci_msm_variant_ops mci_var_ops = { .msm_readl_relaxed = sdhci_msm_mci_variant_readl_relaxed, .msm_writel_relaxed = sdhci_msm_mci_variant_writel_relaxed,
@@ -1929,6 +1959,7 @@ static const struct sdhci_ops sdhci_msm_ops = { .write_w = sdhci_msm_writew, .write_b = sdhci_msm_writeb, .irq = sdhci_msm_cqe_irq, + .dump_vendor_regs = sdhci_msm_dump_vendor_regs, };static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 1 line
2.7.4
Re: [PATCH V2 0/8] Board specific DLL configuration for qcom SDHC
In reply to Sarthak GargQuoted 18 lines · Sarthak Garg
Changes since V1:
-Splitting documentation change into two patches to
avoid confusion
-For the rest of patches retaining Andrians Ack.Sarthak Garg (7):
dt-bindings: mmc: Add new compatible string for sm8250 target
dt-bindings: mmc: Add information for DLL register properties
mmc: sdhci-msm: Updatedll_config_3as per HSR
mmc: sdhci-msm: UpdateDDR_CONFIGas per device tree file
mmc: sdhci-msm: Read and use DLL Config property from device tree file
mmc: sdhci-msm: Introduce new ops to dump vendor specific registers
mmc: sdhci-msm: dump vendor specific registers during errorVeerabhadrarao Badiganti (1):
mmc: host: sdhci-msm: Configure dll-user-control in dll init sequence
Quoted 9 lines
.../devicetree/bindings/mmc/sdhci-msm.txt | 14 +++ drivers/mmc/host/sdhci-msm.c | 103 ++++++++++++++++++++- drivers/mmc/host/sdhci.c | 3 + drivers/mmc/host/sdhci.h | 1 + 4 files changed, 118 insertions(+), 3 deletions(-)--
2.7.4
Applied for next, thanks!
Kind regards
Uffe