From 62722036410b7887a04cf6705effb3122fb9b549 Mon Sep 17 00:00:00 2001 From: Łukasz Majewski Date: Mon, 12 Mar 2012 22:07:18 +0000 Subject: mmc:fix: Set mmc width according to MMC host capabilities This patch sets the MMC width according to the MMC host capabilities. It turned out, that there are some targets (e.g. GONI), which are able to read data from SPI only at 4 bit mode. This patch restricts the width number according to the MMC host. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Andy Fleming --- include/mmc.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/mmc.h b/include/mmc.h index f52df70ad4..ee16349f83 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -47,6 +47,9 @@ #define MMC_MODE_SPI 0x400 #define MMC_MODE_HC 0x800 +#define MMC_MODE_MASK_WIDTH_BITS (MMC_MODE_4BIT | MMC_MODE_8BIT) +#define MMC_MODE_WIDTH_BITS_SHIFT 8 + #define SD_DATA_4BIT 0x00040000 #define IS_SD(x) (x->version & SD_VERSION_SD) -- cgit From ffdea5dab902b522f8744234184ffa11a4e275c2 Mon Sep 17 00:00:00 2001 From: Andreas Bießmann Date: Mon, 19 Mar 2012 23:13:18 +0000 Subject: include/mmc.h: remove struct mmc_csd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The outdated struct mmc_csd was only used by old atmel_mci driver which was removed in c9abb4260c30fbfd51bb2cd551e7426e2ae15b66. Signed-off-by: Andreas Bießmann cc: Andy Fleming --- include/mmc.h | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'include') diff --git a/include/mmc.h b/include/mmc.h index ee16349f83..2305986546 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -208,56 +208,6 @@ struct mmc_cid { char pnm[7]; }; -/* - * WARNING! - * - * This structure is used by atmel_mci.c only. - * It works for the AVR32 architecture but NOT - * for ARM/AT91 architectures. - * Its use is highly depreciated. - * After the atmel_mci.c driver for AVR32 has - * been replaced this structure will be removed. - */ -struct mmc_csd -{ - u8 csd_structure:2, - spec_vers:4, - rsvd1:2; - u8 taac; - u8 nsac; - u8 tran_speed; - u16 ccc:12, - read_bl_len:4; - u64 read_bl_partial:1, - write_blk_misalign:1, - read_blk_misalign:1, - dsr_imp:1, - rsvd2:2, - c_size:12, - vdd_r_curr_min:3, - vdd_r_curr_max:3, - vdd_w_curr_min:3, - vdd_w_curr_max:3, - c_size_mult:3, - sector_size:5, - erase_grp_size:5, - wp_grp_size:5, - wp_grp_enable:1, - default_ecc:2, - r2w_factor:3, - write_bl_len:4, - write_bl_partial:1, - rsvd3:5; - u8 file_format_grp:1, - copy:1, - perm_write_protect:1, - tmp_write_protect:1, - file_format:2, - ecc:2; - u8 crc:7; - u8 one:1; -}; - struct mmc_cmd { ushort cmdidx; uint resp_type; -- cgit From 7a5b80297bc6cef0c10e5f57ac0450678dc7bc5e Mon Sep 17 00:00:00 2001 From: Dirk Behme Date: Mon, 26 Mar 2012 03:13:05 +0000 Subject: mmc: fsl_esdhc: Poll until card is not busy anymore This patch imports parts of two patches from the Freescale U-Boot with the following commit messages: ENGR00156405 ESDHC: Add workaround for auto-clock gate errata ENGcm03648 http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/commit/drivers/mmc/imx_esdhc.c?h=imx_v2009.08_12.01.01&id=e436525a70fe47623d346bc7d9f08f12ff8ad787 The errata, not applicable to USDHC, causes ESDHC to shut off clock to the card when auto-clock gating is enabled for commands with busy signalling and no data phase. The card might require the clock to exit the busy state, so the workaround is to disable the auto-clock gate bits in SYSCTL register for such commands. The workaround also entails polling on DAT0 bit in the PRSSTAT register to learn when busy state is complete. Auto-clock gating is re-enabled at the end of busy state. ENGR00156670-1 ESDHC/USDHC: Remove delay before each cmd and some bug fixes http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/commit/drivers/mmc/imx_esdhc.c?h=imx_v2009.08_12.01.01&id=a77c6fec8596891be96b2cdbc742c9824844b92a Removed delay of 10 ms before each command. There should not be a need to have this delay after the ENGR00156405 patch that polls until card is not busy anymore before proceeding to next cmd. This patch imports the polling part of both patches. The auto-clock gating code don't apply for i.MX6 as implemented in these two patches. SYSCTL_RSTA was defined twice. Remove one definition. Signed-off-by: Dirk Behme CC: Andy Fleming CC: Fabio Estevam CC: Stefano Babic --- include/fsl_esdhc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h index 8418bf7f47..0e265584bd 100644 --- a/include/fsl_esdhc.h +++ b/include/fsl_esdhc.h @@ -34,12 +34,13 @@ #define SYSCTL_INITA 0x08000000 #define SYSCTL_TIMEOUT_MASK 0x000f0000 #define SYSCTL_CLOCK_MASK 0x0000fff0 -#define SYSCTL_RSTA 0x01000000 #define SYSCTL_CKEN 0x00000008 #define SYSCTL_PEREN 0x00000004 #define SYSCTL_HCKEN 0x00000002 #define SYSCTL_IPGEN 0x00000001 #define SYSCTL_RSTA 0x01000000 +#define SYSCTL_RSTC 0x02000000 +#define SYSCTL_RSTD 0x04000000 #define IRQSTAT 0x0002e030 #define IRQSTAT_DMAE (0x10000000) @@ -85,6 +86,7 @@ #define IRQSTATEN_CC (0x00000001) #define PRSSTAT 0x0002e024 +#define PRSSTAT_DAT0 (0x01000000) #define PRSSTAT_CLSL (0x00800000) #define PRSSTAT_WPSPL (0x00080000) #define PRSSTAT_CDPL (0x00040000) -- cgit From 3a6383207be3f71b39004e64464a6e99290b16fa Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 23 Apr 2012 02:36:25 +0000 Subject: mmc: sdhci: add the quirk for broken r1b response When response type is R1b, mask value is added the SDHCI_INT_DAT_END. but in while(), didn't check that flag. So sdhci controller didn't work fine. CMD6 didn't always complete. So add the quirks for broken r1b response and add the timeout value to prevent the infinite loop. Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Acked-by: Lei Wen --- include/sdhci.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sdhci.h b/include/sdhci.h index 800f9d9c07..a2415ba8fc 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -216,6 +216,7 @@ */ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) #define SDHCI_QUIRK_REG32_RW (1 << 1) +#define SDHCI_QUIRK_BROKEN_R1B (1 << 2) /* to make gcc happy */ struct sdhci_host; -- cgit From 236bfecff8091356d81e79da3281b9e4af967468 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 23 Apr 2012 02:36:26 +0000 Subject: mmc: add the quirk to use the sdhci for samsung-soc To support the Samsung-SoC, added the basically functions. Samsung-SoC didn't used the SDHCI_CTRL_HISPD. And added set_control_reg callback for s3c64xx. Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Acked-by: Lei Wen --- include/sdhci.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/sdhci.h b/include/sdhci.h index a2415ba8fc..9d37183243 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -217,6 +217,8 @@ #define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 0) #define SDHCI_QUIRK_REG32_RW (1 << 1) #define SDHCI_QUIRK_BROKEN_R1B (1 << 2) +#define SDHCI_QUIRK_NO_HISPD_BIT (1 << 3) +#define SDHCI_QUIRK_BROKEN_VOLTAGE (1 << 4) /* to make gcc happy */ struct sdhci_host; @@ -241,10 +243,14 @@ struct sdhci_host { char *name; void *ioaddr; unsigned int quirks; + unsigned int host_caps; unsigned int version; unsigned int clock; struct mmc *mmc; const struct sdhci_ops *ops; + + void (*set_control_reg)(struct sdhci_host *host); + uint voltages; }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS -- cgit From 7d2d58b4e63a8307f713e6b17fdb9b2413548574 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 23 Apr 2012 02:36:29 +0000 Subject: ARM: SAMSUNG: support sdhci controller To support sdhci controller, remove the CONFIG_S5P_MMC.. Instead, use the CONFIG_S5P_SDHCI/CONFIG_SDHCI. Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Acked-by: Lei Wen Acked-by: Minkyu Kang --- include/configs/origen.h | 7 ++++--- include/configs/s5p_goni.h | 7 ++++--- include/configs/s5pc210_universal.h | 7 ++++--- include/configs/smdk5250.h | 3 ++- include/configs/smdkv310.h | 7 ++++--- include/configs/trats.h | 3 ++- 6 files changed, 20 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/configs/origen.h b/include/configs/origen.h index 8ede82575c..367f991848 100644 --- a/include/configs/origen.h +++ b/include/configs/origen.h @@ -69,9 +69,10 @@ #define EXYNOS4_DEFAULT_UART_OFFSET 0x020000 /* SD/MMC configuration */ -#define CONFIG_GENERIC_MMC 1 -#define CONFIG_MMC 1 -#define CONFIG_S5P_MMC 1 +#define CONFIG_GENERIC_MMC +#define CONFIG_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI /* PWM */ #define CONFIG_PWM 1 diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h index 56b5547fd2..e133a17259 100644 --- a/include/configs/s5p_goni.h +++ b/include/configs/s5p_goni.h @@ -63,9 +63,10 @@ #define CONFIG_BAUDRATE 115200 /* MMC */ -#define CONFIG_GENERIC_MMC 1 -#define CONFIG_MMC 1 -#define CONFIG_S5P_MMC 1 +#define CONFIG_GENERIC_MMC +#define CONFIG_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI /* PWM */ #define CONFIG_PWM 1 diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h index 13012756ab..00db374182 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h @@ -66,9 +66,10 @@ #define CONFIG_BAUDRATE 115200 /* MMC */ -#define CONFIG_GENERIC_MMC 1 -#define CONFIG_MMC 1 -#define CONFIG_S5P_MMC 1 +#define CONFIG_GENERIC_MMC +#define CONFIG_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI /* PWM */ #define CONFIG_PWM 1 diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h index 9659f9ebd9..0f63040d25 100644 --- a/include/configs/smdk5250.h +++ b/include/configs/smdk5250.h @@ -78,7 +78,8 @@ /* SD/MMC configuration */ #define CONFIG_GENERIC_MMC #define CONFIG_MMC -#define CONFIG_S5P_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI #define CONFIG_BOARD_EARLY_INIT_F diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h index 93c25da1cf..702134bda3 100644 --- a/include/configs/smdkv310.h +++ b/include/configs/smdkv310.h @@ -68,9 +68,10 @@ #define EXYNOS4_DEFAULT_UART_OFFSET 0x010000 /* SD/MMC configuration */ -#define CONFIG_GENERIC_MMC 1 -#define CONFIG_MMC 1 -#define CONFIG_S5P_MMC 1 +#define CONFIG_GENERIC_MMC +#define CONFIG_MMC +#define CONFIG_SDHCI +#define CONFIG_S5P_SDHCI /* PWM */ #define CONFIG_PWM 1 diff --git a/include/configs/trats.h b/include/configs/trats.h index 10f11d9579..71b939396e 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -74,7 +74,8 @@ /* MMC */ #define CONFIG_GENERIC_MMC #define CONFIG_MMC -#define CONFIG_S5P_MMC +#define CONFIG_S5P_SDHCI +#define CONFIG_SDHCI /* PWM */ #define CONFIG_PWM -- cgit