All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg
@ 2016-09-23 10:14 Jaehoon Chung
  2016-09-23 10:14 ` [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number Jaehoon Chung
  2016-09-27  0:33 ` [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Simon Glass
  0 siblings, 2 replies; 6+ messages in thread
From: Jaehoon Chung @ 2016-09-23 10:14 UTC (permalink / raw)
  To: u-boot

"host->version" isn't a SoC specific value.
It doesn't need to get in each SoC drivers.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/atmel_sdhci.c   | 1 -
 drivers/mmc/bcm2835_sdhci.c | 1 -
 drivers/mmc/kona_sdhci.c    | 5 -----
 drivers/mmc/msm_sdhci.c     | 3 ---
 drivers/mmc/mv_sdhci.c      | 4 ----
 drivers/mmc/s5p_sdhci.c     | 1 -
 drivers/mmc/sdhci.c         | 6 +++++-
 drivers/mmc/spear_sdhci.c   | 5 -----
 drivers/mmc/zynq_sdhci.c    | 2 --
 9 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c
index dd6bd33..c197b09 100644
--- a/drivers/mmc/atmel_sdhci.c
+++ b/drivers/mmc/atmel_sdhci.c
@@ -29,7 +29,6 @@ int atmel_sdhci_init(void *regbase, u32 id)
 	host->name = "atmel_sdhci";
 	host->ioaddr = regbase;
 	host->quirks = 0;
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 	max_clk = at91_get_periph_generated_clk(id);
 	if (!max_clk) {
 		printf("%s: Failed to get the proper clock\n", __func__);
diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
index 680b754..c1d8700 100644
--- a/drivers/mmc/bcm2835_sdhci.c
+++ b/drivers/mmc/bcm2835_sdhci.c
@@ -184,7 +184,6 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq)
 	host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 	host->ops = &bcm2835_ops;
 
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 	add_sdhci(host, emmc_freq, MIN_FREQ);
 
 	return 0;
diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c
index 3653d00..0c4f30e 100644
--- a/drivers/mmc/kona_sdhci.c
+++ b/drivers/mmc/kona_sdhci.c
@@ -127,11 +127,6 @@ int kona_sdhci_init(int dev_index, u32 min_clk, u32 quirks)
 		return -EINVAL;
 	}
 
-	if (quirks & SDHCI_QUIRK_REG32_RW)
-		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-	else
-		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
 	add_sdhci(host, max_clk, min_clk);
 	return ret;
 }
diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index 8d4399e..90e90bc 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -140,9 +140,6 @@ static int msm_sdc_probe(struct udevice *dev)
 		writel(caps, host->ioaddr + SDHCI_VENDOR_SPEC_CAPABILITIES0);
 	}
 
-	/* Set host controller version */
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
 	ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
 	host->mmc = &plat->mmc;
 	if (ret)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index 82c695f..ca5f872 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -88,9 +88,5 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
 		sdhci_mvebu_mbus_config((void __iomem *)regbase);
 	}
 
-	if (quirks & SDHCI_QUIRK_REG32_RW)
-		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-	else
-		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 	return add_sdhci(host, max_clk, min_clk);
 }
diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 3bace21..7827b28 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -71,7 +71,6 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
 		SDHCI_QUIRK_32BIT_DMA_ADDR |
 		SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_USE_WIDE8;
 	host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 
 	host->set_control_reg = &s5p_sdhci_set_control_reg;
 	host->set_clock = set_mmc_clk;
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 504f2d2..7fc11c0 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -524,7 +524,11 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 		return -EINVAL;
 	}
 #endif
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+	if (host->quirks & SDHCI_QUIRK_REG32_RW)
+		host->version =
+			sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
+	else
+		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 
 	cfg->name = host->name;
 #ifndef CONFIG_DM_MMC_OPS
diff --git a/drivers/mmc/spear_sdhci.c b/drivers/mmc/spear_sdhci.c
index 6ca96a2..06179cd 100644
--- a/drivers/mmc/spear_sdhci.c
+++ b/drivers/mmc/spear_sdhci.c
@@ -22,11 +22,6 @@ int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
 	host->ioaddr = (void *)regbase;
 	host->quirks = quirks;
 
-	if (quirks & SDHCI_QUIRK_REG32_RW)
-		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
-	else
-		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
 	add_sdhci(host, max_clk, min_clk);
 	return 0;
 }
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 3815b94..299d820 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -36,8 +36,6 @@ static int arasan_sdhci_probe(struct udevice *dev)
 	host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
 #endif
 
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
-
 	ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ,
 			      CONFIG_ZYNQ_SDHCI_MIN_FREQ);
 	host->mmc = &plat->mmc;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number
  2016-09-23 10:14 [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Jaehoon Chung
@ 2016-09-23 10:14 ` Jaehoon Chung
  2016-09-23 10:26   ` Stefan Roese
  2016-09-27  0:33 ` [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2016-09-23 10:14 UTC (permalink / raw)
  To: u-boot

Use the generic error number instead of meaningless value.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/kona_sdhci.c |  6 +++---
 drivers/mmc/mv_sdhci.c   |  2 +-
 drivers/mmc/s5p_sdhci.c  |  8 ++++----
 drivers/mmc/sdhci.c      | 12 ++++++------
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c
index 0c4f30e..71c06b1 100644
--- a/drivers/mmc/kona_sdhci.c
+++ b/drivers/mmc/kona_sdhci.c
@@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
 
 	if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
 		printf("%s: sd host controller reset error\n", __func__);
-		return 1;
+		return -;
 	}
 
 	/* For kona a hardware reset before anything else. */
@@ -39,7 +39,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
 	do {
 		if (timeout == 0) {
 			printf("%s: reset timeout error\n", __func__);
-			return 1;
+			return -ETIMEDOUT;
 		}
 		timeout--;
 		udelay(100);
@@ -67,7 +67,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
 	while (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
 		if (timeout == 0) {
 			printf("%s: CARD DETECT timeout error\n", __func__);
-			return 1;
+			return -ETIMEDOUT;
 		}
 		timeout--;
 		udelay(100);
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index ca5f872..e388ad1 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -71,7 +71,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
 	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
 	if (!host) {
 		printf("sdh_host malloc fail!\n");
-		return 1;
+		return -ENOMEM;
 	}
 
 	host->name = MVSDH_NAME;
diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index 7827b28..8930097 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -86,7 +86,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width)
 	struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
 	if (!host) {
 		printf("sdhci__host allocation fail!\n");
-		return 1;
+		return -ENOMEM;
 	}
 	host->ioaddr = (void *)regbase;
 	host->index = index;
@@ -140,7 +140,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
 	dev_id = pinmux_decode_periph_id(blob, node);
 	if (dev_id < PERIPH_ID_SDMMC0 && dev_id > PERIPH_ID_SDMMC3) {
 		debug("MMC: Can't get device id\n");
-		return -1;
+		return -EINVAL;
 	}
 	host->index = dev_id - PERIPH_ID_SDMMC0;
 
@@ -148,7 +148,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
 	bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0);
 	if (bus_width <= 0) {
 		debug("MMC: Can't get bus-width\n");
-		return -1;
+		return -EINVAL;
 	}
 	host->bus_width = bus_width;
 
@@ -156,7 +156,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
 	base = fdtdec_get_addr(blob, node, "reg");
 	if (!base) {
 		debug("MMC: Can't get base address\n");
-		return -1;
+		return -EINVAL;
 	}
 	host->ioaddr = (void *)base;
 
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 7fc11c0..8df951f 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -87,7 +87,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
 		if (stat & SDHCI_INT_ERROR) {
 			printf("%s: Error detected in status(0x%X)!\n",
 			       __func__, stat);
-			return -1;
+			return -EIO;
 		}
 		if (stat & rdy) {
 			if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask))
@@ -110,7 +110,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data,
 			udelay(10);
 		else {
 			printf("%s: Transfer data timeout\n", __func__);
-			return -1;
+			return -ETIMEDOUT;
 		}
 	} while (!(stat & SDHCI_INT_DATA_END));
 	return 0;
@@ -303,7 +303,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 		if (timeout == 0) {
 			printf("%s: Timeout to wait cmd & data inhibit\n",
 			       __func__);
-			return -1;
+			return -EBUSY;
 		}
 
 		timeout--;
@@ -352,7 +352,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 		if (timeout == 0) {
 			printf("%s: Internal clock never stabilised.\n",
 			       __func__);
-			return -1;
+			return -EBUSY;
 		}
 		timeout--;
 		udelay(1000);
@@ -455,7 +455,7 @@ static int sdhci_init(struct mmc *mmc)
 		if (!aligned_buffer) {
 			printf("%s: Aligned buffer alloc failed!!!\n",
 			       __func__);
-			return -1;
+			return -ENOMEM;
 		}
 	}
 
@@ -601,7 +601,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
 	host->mmc = mmc_create(&host->cfg, host);
 	if (host->mmc == NULL) {
 		printf("%s: mmc create fail!\n", __func__);
-		return -1;
+		return -ENOMEM;
 	}
 
 	return 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number
  2016-09-23 10:14 ` [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number Jaehoon Chung
@ 2016-09-23 10:26   ` Stefan Roese
  2016-09-25 21:18     ` Jaehoon Chung
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Roese @ 2016-09-23 10:26 UTC (permalink / raw)
  To: u-boot

On 23.09.2016 12:14, Jaehoon Chung wrote:
> Use the generic error number instead of meaningless value.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/kona_sdhci.c |  6 +++---
>  drivers/mmc/mv_sdhci.c   |  2 +-
>  drivers/mmc/s5p_sdhci.c  |  8 ++++----
>  drivers/mmc/sdhci.c      | 12 ++++++------
>  4 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c
> index 0c4f30e..71c06b1 100644
> --- a/drivers/mmc/kona_sdhci.c
> +++ b/drivers/mmc/kona_sdhci.c
> @@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
>
>  	if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
>  		printf("%s: sd host controller reset error\n", __func__);
> -		return 1;
> +		return -;

You probably missed something here.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number
  2016-09-23 10:26   ` Stefan Roese
@ 2016-09-25 21:18     ` Jaehoon Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2016-09-25 21:18 UTC (permalink / raw)
  To: u-boot

Hi Stefen,

On 09/23/2016 07:26 PM, Stefan Roese wrote:
> On 23.09.2016 12:14, Jaehoon Chung wrote:
>> Use the generic error number instead of meaningless value.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/kona_sdhci.c |  6 +++---
>>  drivers/mmc/mv_sdhci.c   |  2 +-
>>  drivers/mmc/s5p_sdhci.c  |  8 ++++----
>>  drivers/mmc/sdhci.c      | 12 ++++++------
>>  4 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c
>> index 0c4f30e..71c06b1 100644
>> --- a/drivers/mmc/kona_sdhci.c
>> +++ b/drivers/mmc/kona_sdhci.c
>> @@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host)
>>
>>      if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) {
>>          printf("%s: sd host controller reset error\n", __func__);
>> -        return 1;
>> +        return -;
> 
> You probably missed something here.

Oh..Thanks! I will resend the patch..

Best Regards,
Jaehoon Chung

> 
> Thanks,
> Stefan
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg
  2016-09-23 10:14 [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Jaehoon Chung
  2016-09-23 10:14 ` [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number Jaehoon Chung
@ 2016-09-27  0:33 ` Simon Glass
  2016-10-10  6:34   ` Jaehoon Chung
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Glass @ 2016-09-27  0:33 UTC (permalink / raw)
  To: u-boot

On 23 September 2016 at 04:14, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> "host->version" isn't a SoC specific value.
> It doesn't need to get in each SoC drivers.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/atmel_sdhci.c   | 1 -
>  drivers/mmc/bcm2835_sdhci.c | 1 -
>  drivers/mmc/kona_sdhci.c    | 5 -----
>  drivers/mmc/msm_sdhci.c     | 3 ---
>  drivers/mmc/mv_sdhci.c      | 4 ----
>  drivers/mmc/s5p_sdhci.c     | 1 -
>  drivers/mmc/sdhci.c         | 6 +++++-
>  drivers/mmc/spear_sdhci.c   | 5 -----
>  drivers/mmc/zynq_sdhci.c    | 2 --
>  9 files changed, 5 insertions(+), 23 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg
  2016-09-27  0:33 ` [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Simon Glass
@ 2016-10-10  6:34   ` Jaehoon Chung
  0 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2016-10-10  6:34 UTC (permalink / raw)
  To: u-boot

On 09/27/2016 09:33 AM, Simon Glass wrote:
> On 23 September 2016 at 04:14, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> "host->version" isn't a SoC specific value.
>> It doesn't need to get in each SoC drivers.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>  drivers/mmc/atmel_sdhci.c   | 1 -
>>  drivers/mmc/bcm2835_sdhci.c | 1 -
>>  drivers/mmc/kona_sdhci.c    | 5 -----
>>  drivers/mmc/msm_sdhci.c     | 3 ---
>>  drivers/mmc/mv_sdhci.c      | 4 ----
>>  drivers/mmc/s5p_sdhci.c     | 1 -
>>  drivers/mmc/sdhci.c         | 6 +++++-
>>  drivers/mmc/spear_sdhci.c   | 5 -----
>>  drivers/mmc/zynq_sdhci.c    | 2 --
>>  9 files changed, 5 insertions(+), 23 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 

Applied on u-boot-mmc.

Best Regards,
Jaehoon Chung

> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-10  6:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 10:14 [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Jaehoon Chung
2016-09-23 10:14 ` [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number Jaehoon Chung
2016-09-23 10:26   ` Stefan Roese
2016-09-25 21:18     ` Jaehoon Chung
2016-09-27  0:33 ` [U-Boot] [PATCH 1/2] mmc: sdhci: use the host version value in sdhci_setup_cfg Simon Glass
2016-10-10  6:34   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.