Re: [U-Boot] [PATCH 4/5] mmc: uniphier-sd: Add support for quirks

2017-08-20 Thread Masahiro Yamada
2017-08-21 0:11 GMT+09:00 Marek Vasut :
> Check if the OF match has any associated data and if so, use those
> data as the controller quirks, otherwise fallback to the old method
> of reading the controller version register to figure out the quirks.
> This allows us to supply controller quirks on controllers which ie.
> do not have version register.
>
> Signed-off-by: Marek Vasut 
> Cc: Masahiro Yamada 
> Cc: Jaehoon Chung 

Thanks!

Acked-by: Masahiro Yamada 


-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/5] mmc: uniphier-sd: Add support for quirks

2017-08-20 Thread Marek Vasut
Check if the OF match has any associated data and if so, use those
data as the controller quirks, otherwise fallback to the old method
of reading the controller version register to figure out the quirks.
This allows us to supply controller quirks on controllers which ie.
do not have version register.

Signed-off-by: Marek Vasut 
Cc: Masahiro Yamada 
Cc: Jaehoon Chung 
---
 drivers/mmc/uniphier-sd.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 0b594a0c90..77a6d60c5c 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -752,6 +752,7 @@ static int uniphier_sd_probe(struct udevice *dev)
struct uniphier_sd_plat *plat = dev_get_platdata(dev);
struct uniphier_sd_priv *priv = dev_get_priv(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   const u32 quirks = dev_get_driver_data(dev);
fdt_addr_t base;
struct clk clk;
int ret;
@@ -803,18 +804,22 @@ static int uniphier_sd_probe(struct udevice *dev)
return -EINVAL;
}
 
+   if (quirks) {
+   priv->caps = quirks;
+   } else {
+   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
+   UNIPHIER_SD_VERSION_IP;
+   dev_dbg(dev, "version %x\n", priv->version);
+   if (priv->version >= 0x10) {
+   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
+   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
+   }
+   }
+
if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
 NULL))
priv->caps |= UNIPHIER_SD_CAP_NONREMOVABLE;
 
-   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
-   UNIPHIER_SD_VERSION_IP;
-   dev_dbg(dev, "version %x\n", priv->version);
-   if (priv->version >= 0x10) {
-   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
-   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
-   }
-
uniphier_sd_host_init(priv);
 
plat->cfg.voltages = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34;
@@ -829,7 +834,7 @@ static int uniphier_sd_probe(struct udevice *dev)
 }
 
 static const struct udevice_id uniphier_sd_match[] = {
-   { .compatible = "socionext,uniphier-sdhc" },
+   { .compatible = "socionext,uniphier-sdhc", .data = 0 },
{ /* sentinel */ }
 };
 
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/5] mmc: uniphier-sd: Add support for quirks

2017-08-07 Thread Marek Vasut
Check if the OF match has any associated data and if so, use those
data as the controller quirks, otherwise fallback to the old method
of reading the controller version register to figure out the quirks.
This allows us to supply controller quirks on controllers which ie.
do not have version register.

Signed-off-by: Marek Vasut 
Cc: Masahiro Yamada 
Cc: Jaehoon Chung 
---
 drivers/mmc/uniphier-sd.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 12b2f1f38f..4d0c032f92 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -752,6 +752,7 @@ static int uniphier_sd_probe(struct udevice *dev)
struct uniphier_sd_plat *plat = dev_get_platdata(dev);
struct uniphier_sd_priv *priv = dev_get_priv(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   const u32 quirks = dev_get_driver_data(dev);
fdt_addr_t base;
struct clk clk;
int ret;
@@ -803,18 +804,22 @@ static int uniphier_sd_probe(struct udevice *dev)
return -EINVAL;
}
 
+   if (quirks) {
+   priv->caps = quirks;
+   } else {
+   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
+   UNIPHIER_SD_VERSION_IP;
+   dev_dbg(dev, "version %x\n", priv->version);
+   if (priv->version >= 0x10) {
+   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
+   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
+   }
+   }
+
if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
 NULL))
priv->caps |= UNIPHIER_SD_CAP_NONREMOVABLE;
 
-   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
-   UNIPHIER_SD_VERSION_IP;
-   dev_dbg(dev, "version %x\n", priv->version);
-   if (priv->version >= 0x10) {
-   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
-   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
-   }
-
uniphier_sd_host_init(priv);
 
plat->cfg.voltages = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34;
@@ -829,7 +834,7 @@ static int uniphier_sd_probe(struct udevice *dev)
 }
 
 static const struct udevice_id uniphier_sd_match[] = {
-   { .compatible = "socionext,uniphier-sdhc" },
+   { .compatible = "socionext,uniphier-sdhc", .data = 0 },
{ /* sentinel */ }
 };
 
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/5] mmc: uniphier-sd: Add support for quirks

2017-07-21 Thread Marek Vasut
Check if the OF match has any associated data and if so, use those
data as the controller quirks, otherwise fallback to the old method
of reading the controller version register to figure out the quirks.
This allows us to supply controller quirks on controllers which ie.
do not have version register.

Signed-off-by: Marek Vasut 
Cc: Masahiro Yamada 
Cc: Jaehoon Chung 
---
 drivers/mmc/uniphier-sd.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 07436f6ef6..c22c64cdfb 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -751,6 +751,7 @@ static int uniphier_sd_probe(struct udevice *dev)
struct uniphier_sd_plat *plat = dev_get_platdata(dev);
struct uniphier_sd_priv *priv = dev_get_priv(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   const u32 quirks = dev_get_driver_data(dev);
fdt_addr_t base;
struct clk clk;
int ret;
@@ -802,18 +803,22 @@ static int uniphier_sd_probe(struct udevice *dev)
return -EINVAL;
}
 
+   if (quirks) {
+   priv->caps = quirks;
+   } else {
+   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
+   UNIPHIER_SD_VERSION_IP;
+   dev_dbg(dev, "version %x\n", priv->version);
+   if (priv->version >= 0x10) {
+   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
+   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
+   }
+   }
+
if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
 NULL))
priv->caps |= UNIPHIER_SD_CAP_NONREMOVABLE;
 
-   priv->version = uniphier_sd_readl(priv, UNIPHIER_SD_VERSION) &
-   UNIPHIER_SD_VERSION_IP;
-   dev_dbg(dev, "version %x\n", priv->version);
-   if (priv->version >= 0x10) {
-   priv->caps |= UNIPHIER_SD_CAP_DMA_INTERNAL;
-   priv->caps |= UNIPHIER_SD_CAP_DIV1024;
-   }
-
uniphier_sd_host_init(priv);
 
plat->cfg.voltages = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34;
@@ -828,7 +833,7 @@ static int uniphier_sd_probe(struct udevice *dev)
 }
 
 static const struct udevice_id uniphier_sd_match[] = {
-   { .compatible = "socionext,uniphier-sdhc" },
+   { .compatible = "socionext,uniphier-sdhc", .data = 0 },
{ /* sentinel */ }
 };
 
-- 
2.11.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot