Loading Documentation/devicetree/bindings/mmc/sdhci-msm.txt +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,10 @@ In the following, <supply> can be vdd (flash core voltage) or vdd-io (I/O voltag - qcom,wakeup-on-idle: if configured, the mmcqd thread will call set_wake_up_idle(), thereby voting for it to be called on idle CPUs. - nvmem-cells: specifies the handle to represent the SoC revision. usually it is defined by qfprom device node. - nvmem-cell-names: specifies the given nvmem cell name as defined in qfprom node. Example: Loading arch/arm64/boot/dts/qcom/sdm670.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -2365,6 +2365,8 @@ qcom,ddr-config = <0xC3040873>; qcom,nonremovable; nvmem-cells = <&minor_rev>; nvmem-cell-names = "minor_rev"; status = "disabled"; }; Loading drivers/mmc/host/sdhci-msm.c +74 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * drivers/mmc/host/sdhci-msm.c - Qualcomm Technologies, Inc. MSM SDHCI Platform * driver source file * * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -39,6 +39,7 @@ #include <linux/iopoll.h> #include <linux/msm-bus.h> #include <linux/pm_runtime.h> #include <linux/nvmem-consumer.h> #include <trace/events/mmc.h> #include "sdhci-msm.h" Loading Loading @@ -1885,6 +1886,65 @@ static void sdhci_msm_pm_qos_parse(struct device *dev, } } #ifdef CONFIG_NVMEM /* Parse qfprom data for deciding on errata work-arounds */ static long qfprom_read(struct device *dev, const char *name) { struct nvmem_cell *cell; ssize_t len = 0; u32 *buf, val = 0; long err = 0; cell = nvmem_cell_get(dev, name); if (IS_ERR(cell)) { err = PTR_ERR(cell); dev_err(dev, "failed opening nvmem cell err : %ld\n", err); /* If entry does not exist, then that is not an error */ if (err == -ENOENT) err = 0; return err; } buf = (u32 *)nvmem_cell_read(cell, &len); if (IS_ERR(buf) || !len) { dev_err(dev, "Failed reading nvmem cell, err: %u, bytes fetched: %zd\n", *buf, len); if (!IS_ERR(buf)) { kfree(buf); err = -EINVAL; } else { err = PTR_ERR(buf); } } else { val = *buf; kfree(buf); } nvmem_cell_put(cell); return err ? err : (long) val; } /* Reads the SoC version */ static int sdhci_msm_get_socrev(struct device *dev, struct sdhci_msm_host *msm_host) { msm_host->soc_min_rev = qfprom_read(dev, "minor_rev"); if (msm_host->soc_min_rev < 0) dev_err(dev, "failed getting soc_min_rev, err : %d\n", msm_host->soc_min_rev); return msm_host->soc_min_rev; } #else /* Reads the SoC version */ static int sdhci_msm_get_socrev(struct device *dev, struct sdhci_msm_host *msm_host) { return 0; } #endif /* Parse platform data */ static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, Loading Loading @@ -2062,6 +2122,13 @@ struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, if (!of_property_read_u32(np, "qcom,ddr-config", &pdata->ddr_config)) pdata->rclk_wa = true; /* * rclk_wa is not required if soc version is mentioned and * is not base version. */ if (msm_host->soc_min_rev != 0) pdata->rclk_wa = false; return pdata; out: return NULL; Loading Loading @@ -4530,6 +4597,12 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc = host->mmc; msm_host->pdev = pdev; ret = sdhci_msm_get_socrev(&pdev->dev, msm_host); if (ret == -EPROBE_DEFER) { dev_err(&pdev->dev, "SoC version rd: fail: defer for now\n"); goto pltfm_free; } /* get the ice device vops if present */ ret = sdhci_msm_ice_get_dev(host); if (ret == -EPROBE_DEFER) { Loading drivers/mmc/host/sdhci-msm.h +2 −1 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -255,6 +255,7 @@ struct sdhci_msm_host { bool core_3_0v_support; bool pltfm_init_done; struct sdhci_msm_regs_restore regs_restore; int soc_min_rev; }; extern char *saved_command_line; Loading Loading
Documentation/devicetree/bindings/mmc/sdhci-msm.txt +4 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,10 @@ In the following, <supply> can be vdd (flash core voltage) or vdd-io (I/O voltag - qcom,wakeup-on-idle: if configured, the mmcqd thread will call set_wake_up_idle(), thereby voting for it to be called on idle CPUs. - nvmem-cells: specifies the handle to represent the SoC revision. usually it is defined by qfprom device node. - nvmem-cell-names: specifies the given nvmem cell name as defined in qfprom node. Example: Loading
arch/arm64/boot/dts/qcom/sdm670.dtsi +2 −0 Original line number Diff line number Diff line Loading @@ -2365,6 +2365,8 @@ qcom,ddr-config = <0xC3040873>; qcom,nonremovable; nvmem-cells = <&minor_rev>; nvmem-cell-names = "minor_rev"; status = "disabled"; }; Loading
drivers/mmc/host/sdhci-msm.c +74 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * drivers/mmc/host/sdhci-msm.c - Qualcomm Technologies, Inc. MSM SDHCI Platform * driver source file * * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -39,6 +39,7 @@ #include <linux/iopoll.h> #include <linux/msm-bus.h> #include <linux/pm_runtime.h> #include <linux/nvmem-consumer.h> #include <trace/events/mmc.h> #include "sdhci-msm.h" Loading Loading @@ -1885,6 +1886,65 @@ static void sdhci_msm_pm_qos_parse(struct device *dev, } } #ifdef CONFIG_NVMEM /* Parse qfprom data for deciding on errata work-arounds */ static long qfprom_read(struct device *dev, const char *name) { struct nvmem_cell *cell; ssize_t len = 0; u32 *buf, val = 0; long err = 0; cell = nvmem_cell_get(dev, name); if (IS_ERR(cell)) { err = PTR_ERR(cell); dev_err(dev, "failed opening nvmem cell err : %ld\n", err); /* If entry does not exist, then that is not an error */ if (err == -ENOENT) err = 0; return err; } buf = (u32 *)nvmem_cell_read(cell, &len); if (IS_ERR(buf) || !len) { dev_err(dev, "Failed reading nvmem cell, err: %u, bytes fetched: %zd\n", *buf, len); if (!IS_ERR(buf)) { kfree(buf); err = -EINVAL; } else { err = PTR_ERR(buf); } } else { val = *buf; kfree(buf); } nvmem_cell_put(cell); return err ? err : (long) val; } /* Reads the SoC version */ static int sdhci_msm_get_socrev(struct device *dev, struct sdhci_msm_host *msm_host) { msm_host->soc_min_rev = qfprom_read(dev, "minor_rev"); if (msm_host->soc_min_rev < 0) dev_err(dev, "failed getting soc_min_rev, err : %d\n", msm_host->soc_min_rev); return msm_host->soc_min_rev; } #else /* Reads the SoC version */ static int sdhci_msm_get_socrev(struct device *dev, struct sdhci_msm_host *msm_host) { return 0; } #endif /* Parse platform data */ static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, Loading Loading @@ -2062,6 +2122,13 @@ struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, if (!of_property_read_u32(np, "qcom,ddr-config", &pdata->ddr_config)) pdata->rclk_wa = true; /* * rclk_wa is not required if soc version is mentioned and * is not base version. */ if (msm_host->soc_min_rev != 0) pdata->rclk_wa = false; return pdata; out: return NULL; Loading Loading @@ -4530,6 +4597,12 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc = host->mmc; msm_host->pdev = pdev; ret = sdhci_msm_get_socrev(&pdev->dev, msm_host); if (ret == -EPROBE_DEFER) { dev_err(&pdev->dev, "SoC version rd: fail: defer for now\n"); goto pltfm_free; } /* get the ice device vops if present */ ret = sdhci_msm_ice_get_dev(host); if (ret == -EPROBE_DEFER) { Loading
drivers/mmc/host/sdhci-msm.h +2 −1 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -255,6 +255,7 @@ struct sdhci_msm_host { bool core_3_0v_support; bool pltfm_init_done; struct sdhci_msm_regs_restore regs_restore; int soc_min_rev; }; extern char *saved_command_line; Loading