diff mbox

[v3,2/5] mmc: sdhci-of-esdhc: get SVR from global utilities registers

Message ID 1448594417-22515-3-git-send-email-yangbo.lu@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

yangbo lu Nov. 27, 2015, 3:20 a.m. UTC
Most of silicon errata about the eSDHC need to be identified through
the SoC version/revision. This patch makes the driver get these
information from SVR(system version register) of global utilities
registers.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
---
Changes for v2:
	- Got SVR through iomap instead of dts
Changes for v3:
	- Managed GUTS through syscon instead of iomap in eSDHC driver
---
 drivers/mmc/host/sdhci-of-esdhc.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Scott Wood Dec. 8, 2015, 5:45 p.m. UTC | #1
On Fri, 2015-11-27 at 11:20 +0800, Yangbo Lu wrote:
> Most of silicon errata about the eSDHC need to be identified through
> the SoC version/revision. This patch makes the driver get these
> information from SVR(system version register) of global utilities
> registers.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
> ---
> Changes for v2:
> 	- Got SVR through iomap instead of dts
> Changes for v3:
> 	- Managed GUTS through syscon instead of iomap in eSDHC driver
> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of
> -esdhc.c
> index 83b1226..fce24b7 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -19,6 +19,9 @@
>  #include <linux/delay.h>
>  #include <linux/module.h>
>  #include <linux/mmc/host.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
> +#include <linux/fsl-svr.h>
>  #include "sdhci-pltfm.h"
>  #include "sdhci-esdhc.h"
>  
> @@ -28,6 +31,8 @@
>  struct sdhci_esdhc {
>  	u8 vendor_ver;
>  	u8 spec_ver;
> +	u32 soc_ver;
> +	u8 soc_rev;
>  };
>  
>  /**
> @@ -566,18 +571,28 @@ static void esdhc_init(struct platform_device *pdev,
> struct sdhci_host *host)
>  {
>  	struct sdhci_pltfm_host *pltfm_host;
>  	struct sdhci_esdhc *esdhc;
> +	struct regmap *guts_regmap;
> +	u32 svr;
>  	u16 host_ver;
>  
>  	pltfm_host = sdhci_priv(host);
>  	esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc),
>  			     GFP_KERNEL);
> +	pltfm_host->priv = esdhc;
> +
> +	guts_regmap = syscon_regmap_lookup_by_compatible("syscon");
> +	if (IS_ERR(guts_regmap)) {
> +		dev_err(&pdev->dev, "unable to find global utilities
> registers\n");
> +	} else {
> +		regmap_read(guts_regmap, SVR_OFFSET, &svr);
> +		esdhc->soc_ver = SVR_SOC_VER(svr);
> +		esdhc->soc_rev = SVR_REV(svr);
> +	}

As this patchset stands you're going to be spitting out that error message on
everything that isn't t4240...

-Scott

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 83b1226..fce24b7 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -19,6 +19,9 @@ 
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/mmc/host.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+#include <linux/fsl-svr.h>
 #include "sdhci-pltfm.h"
 #include "sdhci-esdhc.h"
 
@@ -28,6 +31,8 @@ 
 struct sdhci_esdhc {
 	u8 vendor_ver;
 	u8 spec_ver;
+	u32 soc_ver;
+	u8 soc_rev;
 };
 
 /**
@@ -566,18 +571,28 @@  static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_esdhc *esdhc;
+	struct regmap *guts_regmap;
+	u32 svr;
 	u16 host_ver;
 
 	pltfm_host = sdhci_priv(host);
 	esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc),
 			     GFP_KERNEL);
+	pltfm_host->priv = esdhc;
+
+	guts_regmap = syscon_regmap_lookup_by_compatible("syscon");
+	if (IS_ERR(guts_regmap)) {
+		dev_err(&pdev->dev, "unable to find global utilities registers\n");
+	} else {
+		regmap_read(guts_regmap, SVR_OFFSET, &svr);
+		esdhc->soc_ver = SVR_SOC_VER(svr);
+		esdhc->soc_rev = SVR_REV(svr);
+	}
 
 	host_ver = sdhci_readw(host, SDHCI_HOST_VERSION);
 	esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
 			     SDHCI_VENDOR_VER_SHIFT;
 	esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
-
-	pltfm_host->priv = esdhc;
 }
 
 static int sdhci_esdhc_probe(struct platform_device *pdev)