[U-Boot] [PATCH 0/3] add mmc support for pantheon platform

This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Lei Wen (3): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
arch/arm/include/asm/arch-pantheon/config.h | 17 ++++++++++++ arch/arm/include/asm/arch-pantheon/cpu.h | 1 + arch/arm/include/asm/arch-pantheon/mfp.h | 12 ++++++++ board/Marvell/dkb/dkb.c | 37 +++++++++++++++++++++++++++ drivers/mmc/mv_sdhci.c | 33 ++++++++++++++++++++++++ include/configs/dkb.h | 1 + 6 files changed, 101 insertions(+), 0 deletions(-)

Signed-off-by: Lei Wen leiwen@marvell.com --- arch/arm/include/asm/arch-pantheon/config.h | 17 +++++++++++++++++ arch/arm/include/asm/arch-pantheon/cpu.h | 1 + arch/arm/include/asm/arch-pantheon/mfp.h | 12 ++++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/arch-pantheon/config.h b/arch/arm/include/asm/arch-pantheon/config.h index 5658592..31ba13d 100644 --- a/arch/arm/include/asm/arch-pantheon/config.h +++ b/arch/arm/include/asm/arch-pantheon/config.h @@ -45,4 +45,21 @@ #define CONFIG_SYS_I2C_SLAVE 0xfe #endif
+/* + * MMC definition + */ +#ifdef CONFIG_CMD_MMC +#define CONFIG_CMD_FAT 1 +#define CONFIG_MMC 1 +#define CONFIG_GENERIC_MMC 1 +#define CONFIG_SDHCI 1 +#define CONFIG_MMC_SDHCI_IO_ACCESSORS 1 +#define CONFIG_MMC_SDMA 1 +#define CONFIG_MV_SDHCI 1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_EFI_PARTITION 1 +#define CONFIG_SYS_MMC_NUM 2 +#define CONFIG_SYS_MMC_BASE {0xD4280000, 0xd4281000} +#endif + #endif /* _PANTHEON_CONFIG_H */ diff --git a/arch/arm/include/asm/arch-pantheon/cpu.h b/arch/arm/include/asm/arch-pantheon/cpu.h index 60955c5..8f39320 100644 --- a/arch/arm/include/asm/arch-pantheon/cpu.h +++ b/arch/arm/include/asm/arch-pantheon/cpu.h @@ -77,5 +77,6 @@ struct panthcpu_registers { */ u32 panth_sdram_base(int); u32 panth_sdram_size(int); +int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks);
#endif /* _PANTHEON_CPU_H */ diff --git a/arch/arm/include/asm/arch-pantheon/mfp.h b/arch/arm/include/asm/arch-pantheon/mfp.h index e939196..b868ab8 100644 --- a/arch/arm/include/asm/arch-pantheon/mfp.h +++ b/arch/arm/include/asm/arch-pantheon/mfp.h @@ -38,6 +38,18 @@ #define MFP54_CI2C_SDA (MFP_REG(0x1b4) | MFP_AF2 | MFP_DRIVE_MEDIUM)
/* More macros can be defined here... */ +#define MFP_MMC1_DAT7 (MFP_REG(0x84) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT6 (MFP_REG(0x88) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT5 (MFP_REG(0x8c) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT4 (MFP_REG(0x90) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT3 (MFP_REG(0x94) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT2 (MFP_REG(0x98) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT1 (MFP_REG(0x9c) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT0 (MFP_REG(0xa0) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CMD (MFP_REG(0xa4) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CLK (MFP_REG(0xa8) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CD (MFP_REG(0xac) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_WP (MFP_REG(0xb0) | MFP_AF0 | MFP_DRIVE_MEDIUM)
#define MFP_PIN_MAX 117 #endif

Signed-off-by: Lei Wen leiwen@marvell.com --- board/Marvell/dkb/dkb.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/dkb.h | 1 + 2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/board/Marvell/dkb/dkb.c b/board/Marvell/dkb/dkb.c index 00f73e7..e2dd55c 100644 --- a/board/Marvell/dkb/dkb.c +++ b/board/Marvell/dkb/dkb.c @@ -24,8 +24,12 @@
#include <common.h> #include <mvmfp.h> +#include <i2c.h> #include <asm/arch/mfp.h> #include <asm/arch/cpu.h> +#ifdef CONFIG_GENERIC_MMC +#include <sdhci.h> +#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -40,6 +44,20 @@ int board_early_init_f(void) MFP53_CI2C_SCL, MFP54_CI2C_SDA,
+ /* MMC1 */ + MFP_MMC1_DAT7, + MFP_MMC1_DAT6, + MFP_MMC1_DAT5, + MFP_MMC1_DAT4, + MFP_MMC1_DAT3, + MFP_MMC1_DAT2, + MFP_MMC1_DAT1, + MFP_MMC1_DAT0, + MFP_MMC1_CMD, + MFP_MMC1_CLK, + MFP_MMC1_CD, + MFP_MMC1_WP, + MFP_EOC /*End of configureation*/ }; /* configure MFP's */ @@ -56,3 +74,22 @@ int board_init(void) gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100; return 0; } + +#ifdef CONFIG_GENERIC_MMC +int board_mmc_init(bd_t *bd) +{ + ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE; + u8 i, data; + data = 0xd; + i2c_write(0x34, 0x28, 1, &data, 1); + + for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) { + if (mv_sdh_init(mmc_base_address[i], 0, 0, + SDHCI_QUIRK_32BIT_DMA_ADDR)) + return 1; + } + *(unsigned int *)0xd4282854 = 0x1b; + *(unsigned int *)0xd42828e0 = 0x1b; + return 0; +} +#endif diff --git a/include/configs/dkb.h b/include/configs/dkb.h index 3d27c58..fb02d92 100644 --- a/include/configs/dkb.h +++ b/include/configs/dkb.h @@ -47,6 +47,7 @@ #define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ #include <config_cmd_default.h> #define CONFIG_CMD_I2C +#define CONFIG_CMD_MMC #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS /*

On Monday, October 03, 2011 11:02:24 AM Lei Wen wrote:
Signed-off-by: Lei Wen leiwen@marvell.com
board/Marvell/dkb/dkb.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/dkb.h | 1 + 2 files changed, 38 insertions(+), 0 deletions(-)
Dear Lei Wen,
[...]
@@ -56,3 +74,22 @@ int board_init(void) gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100; return 0; }
+#ifdef CONFIG_GENERIC_MMC +int board_mmc_init(bd_t *bd) +{
- ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
- u8 i, data;
- data = 0xd;
Magic value ?
- i2c_write(0x34, 0x28, 1, &data, 1);
More magic values ?
- for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
if (mv_sdh_init(mmc_base_address[i], 0, 0,
SDHCI_QUIRK_32BIT_DMA_ADDR))
return 1;
- }
- *(unsigned int *)0xd4282854 = 0x1b;
- *(unsigned int *)0xd42828e0 = 0x1b;
Magic value and not using writel() ?
- return 0;
+} +#endif diff --git a/include/configs/dkb.h b/include/configs/dkb.h index 3d27c58..fb02d92 100644 --- a/include/configs/dkb.h +++ b/include/configs/dkb.h @@ -47,6 +47,7 @@ #define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ #include <config_cmd_default.h> #define CONFIG_CMD_I2C +#define CONFIG_CMD_MMC #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS /*
This should be in a separate patch maybe ?
Cheers

Hi Marek,
On Mon, Oct 3, 2011 at 6:44 PM, Marek Vasut marek.vasut@gmail.com wrote:
On Monday, October 03, 2011 11:02:24 AM Lei Wen wrote:
Signed-off-by: Lei Wen leiwen@marvell.com
board/Marvell/dkb/dkb.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/dkb.h | 1 + 2 files changed, 38 insertions(+), 0 deletions(-)
Dear Lei Wen,
[...]
@@ -56,3 +74,22 @@ int board_init(void) gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100; return 0; }
+#ifdef CONFIG_GENERIC_MMC +int board_mmc_init(bd_t *bd) +{
- ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
- u8 i, data;
- data = 0xd;
Magic value ?
- i2c_write(0x34, 0x28, 1, &data, 1);
More magic values ?
The magic number stand for the pmic chip address and its corresponding register address. Since we don't want to add a complex pmic driver here... How about just define those magic number with macro?
- for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
- if (mv_sdh_init(mmc_base_address[i], 0, 0,
- SDHCI_QUIRK_32BIT_DMA_ADDR))
- return 1;
- }
- *(unsigned int *)0xd4282854 = 0x1b;
- *(unsigned int *)0xd42828e0 = 0x1b;
Magic value and not using writel() ?
Opps, this should move to the cpu_init as a part of apmu clock enabling.
- return 0;
+} +#endif diff --git a/include/configs/dkb.h b/include/configs/dkb.h index 3d27c58..fb02d92 100644 --- a/include/configs/dkb.h +++ b/include/configs/dkb.h @@ -47,6 +47,7 @@ #define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ #include <config_cmd_default.h> #define CONFIG_CMD_I2C +#define CONFIG_CMD_MMC #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS /*
This should be in a separate patch maybe ?
Ok, would do in the next patch.
Thanks, Lei

Marvell 88SV331xV5 platform's sdhci host control is not very standard with the spec in the 8bit handling. It need to set its private register to switch to the 8bit mode which is not included in the standard sdhci registers.
This patch mainly hacks the writeb method, and set its private register if it find the driver is going to switch to the 8bit mode.
Signed-off-by: Lei Wen leiwen@marvell.com --- drivers/mmc/mv_sdhci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index 9e59951..f92caeb 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -2,6 +2,33 @@ #include <malloc.h> #include <sdhci.h>
+#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS +static struct sdhci_ops mv_ops; + +#if defined(CONFIG_SHEEVA_88SV331xV5) +#define SD_CE_ATA_2 0xEA +#define MMC_CARD 0x1000 +#define MMC_WIDTH 0x0100 +static inline void mv_sdhci_writeb(struct sdhci_host *host, u8 val, int reg) +{ + struct mmc *mmc = host->mmc; + u32 ata = (u32)host->ioaddr + SD_CE_ATA_2; + + if (!IS_SD(mmc) && reg == SDHCI_HOST_CONTROL) { + if (mmc->bus_width == 8) + writew(readw(ata) | (MMC_CARD | MMC_WIDTH), ata); + else + writew(readw(ata) & ~(MMC_CARD | MMC_WIDTH), ata); + } + + writeb(val, host->ioaddr + reg); +} + +#else +#define mv_sdhci_writeb NULL +#endif /* CONFIG_SHEEVA_88SV331xV5 */ +#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ + static char *MVSDH_NAME = "mv_sdh"; int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks) { @@ -15,6 +42,12 @@ int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks) host->name = MVSDH_NAME; host->ioaddr = (void *)regbase; host->quirks = quirks; +#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS + memset(&mv_ops, 0, sizeof(struct sdhci_ops)); + if (mv_sdhci_writeb != NULL) + mv_ops.write_b = mv_sdhci_writeb; + host->ops = &mv_ops; +#endif host->version = sdhci_readw(host, SDHCI_HOST_VERSION); add_sdhci(host, max_clk, min_clk); return 0;

This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
arch/arm/cpu/arm926ejs/pantheon/cpu.c | 11 ++++++ arch/arm/include/asm/arch-pantheon/config.h | 18 ++++++++++ arch/arm/include/asm/arch-pantheon/cpu.h | 12 +++++++ arch/arm/include/asm/arch-pantheon/mfp.h | 12 +++++++ arch/arm/include/asm/arch-pantheon/pantheon.h | 7 ++++ board/Marvell/dkb/dkb.c | 43 +++++++++++++++++++++++++ drivers/mmc/mv_sdhci.c | 33 +++++++++++++++++++ include/configs/dkb.h | 1 + 8 files changed, 137 insertions(+), 0 deletions(-)

Hi Lei Wen,
Le 04/10/2011 08:33, Lei Wen a écrit :
This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
This causes a lot of build errors on dkb with ELDK42:
Configuring for dkb board... In file included from mv_sdhci.c:3: /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want /home/uboot/src/u-boot-arm/include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writel': /home/uboot/src/u-boot-arm/include/sdhci.h:247: warning: passing argument 1 of 'host->ops->write_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writew': /home/uboot/src/u-boot-arm/include/sdhci.h:255: warning: passing argument 1 of 'host->ops->write_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writeb': /home/uboot/src/u-boot-arm/include/sdhci.h:263: warning: passing argument 1 of 'host->ops->write_b' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readl': /home/uboot/src/u-boot-arm/include/sdhci.h:271: warning: passing argument 1 of 'host->ops->read_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readw': /home/uboot/src/u-boot-arm/include/sdhci.h:279: warning: passing argument 1 of 'host->ops->read_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readb': /home/uboot/src/u-boot-arm/include/sdhci.h:287: warning: passing argument 1 of 'host->ops->read_b' from incompatible pointer type mv_sdhci.c: In function 'mv_sdhci_writeb': mv_sdhci.c:14: error: 'struct sdhci_host' has no member named 'mmc' mv_sdhci.c:17: warning: implicit declaration of function 'IS_SD' mv_sdhci.c:18: error: dereferencing pointer to incomplete type mv_sdhci.c: In function 'mv_sdh_init': mv_sdhci.c:48: warning: assignment from incompatible pointer type
Amicalement,

Hi Albert,
On Tue, Oct 25, 2011 at 1:20 AM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Lei Wen,
Le 04/10/2011 08:33, Lei Wen a écrit :
This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
This causes a lot of build errors on dkb with ELDK42:
Configuring for dkb board... In file included from mv_sdhci.c:3: /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want /home/uboot/src/u-boot-arm/include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writel': /home/uboot/src/u-boot-arm/include/sdhci.h:247: warning: passing argument 1 of 'host->ops->write_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writew': /home/uboot/src/u-boot-arm/include/sdhci.h:255: warning: passing argument 1 of 'host->ops->write_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writeb': /home/uboot/src/u-boot-arm/include/sdhci.h:263: warning: passing argument 1 of 'host->ops->write_b' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readl': /home/uboot/src/u-boot-arm/include/sdhci.h:271: warning: passing argument 1 of 'host->ops->read_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readw': /home/uboot/src/u-boot-arm/include/sdhci.h:279: warning: passing argument 1 of 'host->ops->read_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readb': /home/uboot/src/u-boot-arm/include/sdhci.h:287: warning: passing argument 1 of 'host->ops->read_b' from incompatible pointer type mv_sdhci.c: In function 'mv_sdhci_writeb': mv_sdhci.c:14: error: 'struct sdhci_host' has no member named 'mmc' mv_sdhci.c:17: warning: implicit declaration of function 'IS_SD' mv_sdhci.c:18: error: dereferencing pointer to incomplete type mv_sdhci.c: In function 'mv_sdh_init': mv_sdhci.c:48: warning: assignment from incompatible pointer type
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
You could refer to: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/111621
Best regards, Lei

Hi Lei Wen,
Le 25/10/2011 03:21, Lei Wen a écrit :
Hi Albert,
On Tue, Oct 25, 2011 at 1:20 AM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Lei Wen,
Le 04/10/2011 08:33, Lei Wen a écrit :
This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
This causes a lot of build errors on dkb with ELDK42:
Configuring for dkb board... In file included from mv_sdhci.c:3: /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want /home/uboot/src/u-boot-arm/include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writel': /home/uboot/src/u-boot-arm/include/sdhci.h:247: warning: passing argument 1 of 'host->ops->write_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writew': /home/uboot/src/u-boot-arm/include/sdhci.h:255: warning: passing argument 1 of 'host->ops->write_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writeb': /home/uboot/src/u-boot-arm/include/sdhci.h:263: warning: passing argument 1 of 'host->ops->write_b' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readl': /home/uboot/src/u-boot-arm/include/sdhci.h:271: warning: passing argument 1 of 'host->ops->read_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readw': /home/uboot/src/u-boot-arm/include/sdhci.h:279: warning: passing argument 1 of 'host->ops->read_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readb': /home/uboot/src/u-boot-arm/include/sdhci.h:287: warning: passing argument 1 of 'host->ops->read_b' from incompatible pointer type mv_sdhci.c: In function 'mv_sdhci_writeb': mv_sdhci.c:14: error: 'struct sdhci_host' has no member named 'mmc' mv_sdhci.c:17: warning: implicit declaration of function 'IS_SD' mv_sdhci.c:18: error: dereferencing pointer to incomplete type mv_sdhci.c: In function 'mv_sdh_init': mv_sdhci.c:48: warning: assignment from incompatible pointer type
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
You could refer to: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/111621
Thanks for the pointer -- please next time indicate the dependency on any patch set not yet applied at the time.
Best regards, Lei
Amicalement,

Le 25/10/2011 08:15, Albert ARIBAUD a écrit :
Hi Lei Wen,
Le 25/10/2011 03:21, Lei Wen a écrit :
Hi Albert,
On Tue, Oct 25, 2011 at 1:20 AM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Lei Wen,
Le 04/10/2011 08:33, Lei Wen a écrit :
This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
This causes a lot of build errors on dkb with ELDK42:
Configuring for dkb board... In file included from mv_sdhci.c:3: /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want /home/uboot/src/u-boot-arm/include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writel': /home/uboot/src/u-boot-arm/include/sdhci.h:247: warning: passing argument 1 of 'host->ops->write_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writew': /home/uboot/src/u-boot-arm/include/sdhci.h:255: warning: passing argument 1 of 'host->ops->write_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writeb': /home/uboot/src/u-boot-arm/include/sdhci.h:263: warning: passing argument 1 of 'host->ops->write_b' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readl': /home/uboot/src/u-boot-arm/include/sdhci.h:271: warning: passing argument 1 of 'host->ops->read_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readw': /home/uboot/src/u-boot-arm/include/sdhci.h:279: warning: passing argument 1 of 'host->ops->read_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readb': /home/uboot/src/u-boot-arm/include/sdhci.h:287: warning: passing argument 1 of 'host->ops->read_b' from incompatible pointer type mv_sdhci.c: In function 'mv_sdhci_writeb': mv_sdhci.c:14: error: 'struct sdhci_host' has no member named 'mmc' mv_sdhci.c:17: warning: implicit declaration of function 'IS_SD' mv_sdhci.c:18: error: dereferencing pointer to incomplete type mv_sdhci.c: In function 'mv_sdh_init': mv_sdhci.c:48: warning: assignment from incompatible pointer type
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
You could refer to: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/111621
Thanks for the pointer -- please next time indicate the dependency on any patch set not yet applied at the time.
I've tried applying the patches in the link you refer to, then the patch series given here, but the latter does not apply properly above the former on top of u-boot-arm/master. Can you check this?
Best regards, Lei
Amicalement,

Hi Albert,
On Tue, Oct 25, 2011 at 2:25 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Le 25/10/2011 08:15, Albert ARIBAUD a écrit :
Hi Lei Wen,
Le 25/10/2011 03:21, Lei Wen a écrit :
Hi Albert,
On Tue, Oct 25, 2011 at 1:20 AM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hi Lei Wen,
Le 04/10/2011 08:33, Lei Wen a écrit :
This patch seris add the mmc support for the pantheon platform. Also give platform like dkb and aspenite a workaround when enabling the 8bit mode for accessing the mmc.
Changelog: V2: remove magic number, and replace it by macro definition and structure respectively. remove enable mmc function into seperated patch
Lei Wen (4): ARM: pantheon: add mmc definition Marvell: dkb: add mmc support dkb: make mmc command as default enabled mmc: mv_sdhci: fix 8bus width access for 88SV331xV5
This causes a lot of build errors on dkb with ELDK42:
Configuring for dkb board... In file included from mv_sdhci.c:3: /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:224: warning: its scope is only this definition or declaration, which is probably not what you want /home/uboot/src/u-boot-arm/include/sdhci.h:225: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:226: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:227: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:228: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h:229: warning: 'struct sdhci_host' declared inside parameter list /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writel': /home/uboot/src/u-boot-arm/include/sdhci.h:247: warning: passing argument 1 of 'host->ops->write_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writew': /home/uboot/src/u-boot-arm/include/sdhci.h:255: warning: passing argument 1 of 'host->ops->write_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_writeb': /home/uboot/src/u-boot-arm/include/sdhci.h:263: warning: passing argument 1 of 'host->ops->write_b' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readl': /home/uboot/src/u-boot-arm/include/sdhci.h:271: warning: passing argument 1 of 'host->ops->read_l' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readw': /home/uboot/src/u-boot-arm/include/sdhci.h:279: warning: passing argument 1 of 'host->ops->read_w' from incompatible pointer type /home/uboot/src/u-boot-arm/include/sdhci.h: In function 'sdhci_readb': /home/uboot/src/u-boot-arm/include/sdhci.h:287: warning: passing argument 1 of 'host->ops->read_b' from incompatible pointer type mv_sdhci.c: In function 'mv_sdhci_writeb': mv_sdhci.c:14: error: 'struct sdhci_host' has no member named 'mmc' mv_sdhci.c:17: warning: implicit declaration of function 'IS_SD' mv_sdhci.c:18: error: dereferencing pointer to incomplete type mv_sdhci.c: In function 'mv_sdh_init': mv_sdhci.c:48: warning: assignment from incompatible pointer type
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
You could refer to: http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/111621
Thanks for the pointer -- please next time indicate the dependency on any patch set not yet applied at the time.
I've tried applying the patches in the link you refer to, then the patch series given here, but the latter does not apply properly above the former on top of u-boot-arm/master. Can you check this?
Best regards, Lei
I try to rebase the V4 of sdhci fixing patch over latest u-boot-arm.git, and find there is no problem... Could you help check again?
Thanks, Lei

Dear Lei Wen,
In message CALZhoSR_jco_Ps5DxM8vtPk9eXCqoCPM0FiBDRat0uRHhw9qog@mail.gmail.com you wrote:
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
Then please squash your patches and submit a new, bug free patch.
We don't add (knowingly) broken code and only fix it later.
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Tue, Oct 25, 2011 at 3:38 PM, Wolfgang Denk wd@denx.de wrote:
Dear Lei Wen,
In message CALZhoSR_jco_Ps5DxM8vtPk9eXCqoCPM0FiBDRat0uRHhw9qog@mail.gmail.com you wrote:
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
Then please squash your patches and submit a new, bug free patch.
We don't add (knowingly) broken code and only fix it later.
This patch seris itself is bug free indeed... But like Albert says, this one has a dependency with another, which means it should be applied with sequence...
So how about hold this patch till its dependency patch set got in?
Thanks, Lei

Dear Lei Wen,
In message CALZhoSQ42OfdTBV8pggNdhUgTTsVKVCPgyvQ0keSUJW+uQZT0Q@mail.gmail.com you wrote:
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
Then please squash your patches and submit a new, bug free patch.
We don't add (knowingly) broken code and only fix it later.
This patch seris itself is bug free indeed... But like Albert says, this one has a dependency with another, which means it should be applied with sequence...
No, this patch and the other one should be squashed.
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Wed, Oct 26, 2011 at 2:51 AM, Wolfgang Denk wd@denx.de wrote:
Dear Lei Wen,
In message CALZhoSQ42OfdTBV8pggNdhUgTTsVKVCPgyvQ0keSUJW+uQZT0Q@mail.gmail.com you wrote:
Actually, I have post another fixing series before this, so if it got be applied before this merged, the warning would be disappeared.
Then please squash your patches and submit a new, bug free patch.
We don't add (knowingly) broken code and only fix it later.
This patch seris itself is bug free indeed... But like Albert says, this one has a dependency with another, which means it should be applied with sequence...
No, this patch and the other one should be squashed.
Do you mean that I should merge this mmc adding patch and the sdhci fixing patch together as one patch?
Thanks, Lei

Signed-off-by: Lei Wen leiwen@marvell.com --- Changelog: V2: no change
arch/arm/cpu/arm926ejs/pantheon/cpu.c | 11 +++++++++++ arch/arm/include/asm/arch-pantheon/config.h | 18 ++++++++++++++++++ arch/arm/include/asm/arch-pantheon/cpu.h | 12 ++++++++++++ arch/arm/include/asm/arch-pantheon/mfp.h | 12 ++++++++++++ arch/arm/include/asm/arch-pantheon/pantheon.h | 7 +++++++ 5 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/pantheon/cpu.c b/arch/arm/cpu/arm926ejs/pantheon/cpu.c index efc9395..db9b348 100644 --- a/arch/arm/cpu/arm926ejs/pantheon/cpu.c +++ b/arch/arm/cpu/arm926ejs/pantheon/cpu.c @@ -42,6 +42,9 @@ int arch_cpu_init(void) struct panthmpmu_registers *mpmu = (struct panthmpmu_registers*) PANTHEON_MPMU_BASE;
+ struct panthapmu_registers *apmu = + (struct panthapmu_registers *) PANTHEON_APMU_BASE; + /* set SEL_MRVL_ID bit in PANTHEON_CPU_CONF register */ val = readl(&cpuregs->cpu_conf); val = val | SET_MRVL_ID; @@ -65,6 +68,14 @@ int arch_cpu_init(void) writel(APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi); #endif
+#ifdef CONFIG_MV_SDHCI + /* Enable mmc clock */ + writel(APMU_PERI_CLK | APMU_AXI_CLK | APMU_PERI_RST | APMU_AXI_RST, + &apmu->sd1); + writel(APMU_PERI_CLK | APMU_AXI_CLK | APMU_PERI_RST | APMU_AXI_RST, + &apmu->sd3); +#endif + icache_enable();
return 0; diff --git a/arch/arm/include/asm/arch-pantheon/config.h b/arch/arm/include/asm/arch-pantheon/config.h index fd23c97..d10583d 100644 --- a/arch/arm/include/asm/arch-pantheon/config.h +++ b/arch/arm/include/asm/arch-pantheon/config.h @@ -47,4 +47,22 @@ #define CONFIG_SYS_I2C_SLAVE 0xfe #endif
+/* + * MMC definition + */ +#ifdef CONFIG_CMD_MMC +#define CONFIG_CMD_FAT 1 +#define CONFIG_MMC 1 +#define CONFIG_GENERIC_MMC 1 +#define CONFIG_SDHCI 1 +#define CONFIG_MMC_SDHCI_IO_ACCESSORS 1 +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 0x1000 +#define CONFIG_MMC_SDMA 1 +#define CONFIG_MV_SDHCI 1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_EFI_PARTITION 1 +#define CONFIG_SYS_MMC_NUM 2 +#define CONFIG_SYS_MMC_BASE {0xD4280000, 0xd4281000} +#endif + #endif /* _PANTHEON_CONFIG_H */ diff --git a/arch/arm/include/asm/arch-pantheon/cpu.h b/arch/arm/include/asm/arch-pantheon/cpu.h index 60955c5..94e8371 100644 --- a/arch/arm/include/asm/arch-pantheon/cpu.h +++ b/arch/arm/include/asm/arch-pantheon/cpu.h @@ -43,6 +43,17 @@ struct panthmpmu_registers { };
/* + * Application Power Management (APMU) Registers + * Refer Register Datasheet 9.2 + */ +struct panthapmu_registers { + u8 pad0[0x0054]; + u32 sd1; /*0x0054*/ + u8 pad1[0x00e0 - 0x054 - 4]; + u32 sd3; /*0x00e0*/ +}; + +/* * APB Clock Reset/Control Registers * Refer Register Datasheet 6.14 */ @@ -77,5 +88,6 @@ struct panthcpu_registers { */ u32 panth_sdram_base(int); u32 panth_sdram_size(int); +int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks);
#endif /* _PANTHEON_CPU_H */ diff --git a/arch/arm/include/asm/arch-pantheon/mfp.h b/arch/arm/include/asm/arch-pantheon/mfp.h index e939196..b868ab8 100644 --- a/arch/arm/include/asm/arch-pantheon/mfp.h +++ b/arch/arm/include/asm/arch-pantheon/mfp.h @@ -38,6 +38,18 @@ #define MFP54_CI2C_SDA (MFP_REG(0x1b4) | MFP_AF2 | MFP_DRIVE_MEDIUM)
/* More macros can be defined here... */ +#define MFP_MMC1_DAT7 (MFP_REG(0x84) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT6 (MFP_REG(0x88) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT5 (MFP_REG(0x8c) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT4 (MFP_REG(0x90) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_DAT3 (MFP_REG(0x94) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT2 (MFP_REG(0x98) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT1 (MFP_REG(0x9c) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_DAT0 (MFP_REG(0xa0) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CMD (MFP_REG(0xa4) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CLK (MFP_REG(0xa8) | MFP_AF0 | MFP_DRIVE_FAST) +#define MFP_MMC1_CD (MFP_REG(0xac) | MFP_AF0 | MFP_DRIVE_MEDIUM) +#define MFP_MMC1_WP (MFP_REG(0xb0) | MFP_AF0 | MFP_DRIVE_MEDIUM)
#define MFP_PIN_MAX 117 #endif diff --git a/arch/arm/include/asm/arch-pantheon/pantheon.h b/arch/arm/include/asm/arch-pantheon/pantheon.h index c7fe646..d5e9ba0 100644 --- a/arch/arm/include/asm/arch-pantheon/pantheon.h +++ b/arch/arm/include/asm/arch-pantheon/pantheon.h @@ -32,6 +32,12 @@ /* Functional Clock Selection Mask */ #define APBC_FNCLKSEL(x) (((x) & 0xf) << 4)
+/* Common APMU register bit definitions */ +#define APMU_PERI_CLK (1<<4) /* Peripheral Clock Enable */ +#define APMU_AXI_CLK (1<<3) /* AXI Clock Enable*/ +#define APMU_PERI_RST (1<<1) /* Peripheral Reset */ +#define APMU_AXI_RST (1<<0) /* AXI Reset */ + /* Register Base Addresses */ #define PANTHEON_DRAM_BASE 0xB0000000 #define PANTHEON_TIMER_BASE 0xD4014000 @@ -42,6 +48,7 @@ #define PANTHEON_GPIO_BASE 0xD4019000 #define PANTHEON_MFPR_BASE 0xD401E000 #define PANTHEON_MPMU_BASE 0xD4050000 +#define PANTHEON_APMU_BASE 0xD4282800 #define PANTHEON_CPU_BASE 0xD4282C00
#endif /* _PANTHEON_H */

Signed-off-by: Lei Wen leiwen@marvell.com --- Changelog: V2: remove magic number, and replace it by macro definition and structure respectively
board/Marvell/dkb/dkb.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/board/Marvell/dkb/dkb.c b/board/Marvell/dkb/dkb.c index 00f73e7..4a9abee 100644 --- a/board/Marvell/dkb/dkb.c +++ b/board/Marvell/dkb/dkb.c @@ -24,8 +24,12 @@
#include <common.h> #include <mvmfp.h> +#include <i2c.h> #include <asm/arch/mfp.h> #include <asm/arch/cpu.h> +#ifdef CONFIG_GENERIC_MMC +#include <sdhci.h> +#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -40,6 +44,20 @@ int board_early_init_f(void) MFP53_CI2C_SCL, MFP54_CI2C_SDA,
+ /* MMC1 */ + MFP_MMC1_DAT7, + MFP_MMC1_DAT6, + MFP_MMC1_DAT5, + MFP_MMC1_DAT4, + MFP_MMC1_DAT3, + MFP_MMC1_DAT2, + MFP_MMC1_DAT1, + MFP_MMC1_DAT0, + MFP_MMC1_CMD, + MFP_MMC1_CLK, + MFP_MMC1_CD, + MFP_MMC1_WP, + MFP_EOC /*End of configureation*/ }; /* configure MFP's */ @@ -56,3 +74,28 @@ int board_init(void) gd->bd->bi_boot_params = panth_sdram_base(0) + 0x100; return 0; } + +#ifdef CONFIG_GENERIC_MMC +#define I2C_SLAVE_ADDR 0x34 +#define LDO13_REG 0x28 +#define LDO_V30 0x6 +#define LDO_VOLTAGE(x) ((x & 0x7) << 1) +#define LDO_EN 0x1 +int board_mmc_init(bd_t *bd) +{ + ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE; + u8 i, data; + + /* set LDO 13 to 3.0v */ + data = LDO_VOLTAGE(LDO_V30) | LDO_EN; + i2c_write(I2C_SLAVE_ADDR, LDO13_REG, 1, &data, 1); + + for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) { + if (mv_sdh_init(mmc_base_address[i], 0, 0, + SDHCI_QUIRK_32BIT_DMA_ADDR)) + return 1; + } + + return 0; +} +#endif

Signed-off-by: Lei Wen leiwen@marvell.com --- Changelog: V2: remove enable mmc function into seperated patch
include/configs/dkb.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/dkb.h b/include/configs/dkb.h index 3d27c58..fb02d92 100644 --- a/include/configs/dkb.h +++ b/include/configs/dkb.h @@ -47,6 +47,7 @@ #define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ #include <config_cmd_default.h> #define CONFIG_CMD_I2C +#define CONFIG_CMD_MMC #undef CONFIG_CMD_NET #undef CONFIG_CMD_NFS /*

Marvell 88SV331xV5 platform's sdhci host control is not very standard with the spec in the 8bit handling. It need to set its private register to switch to the 8bit mode which is not included in the standard sdhci registers.
This patch mainly hacks the writeb method, and set its private register if it find the driver is going to switch to the 8bit mode.
Signed-off-by: Lei Wen leiwen@marvell.com --- Changelog: V2: no change
drivers/mmc/mv_sdhci.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index 9e59951..f92caeb 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -2,6 +2,33 @@ #include <malloc.h> #include <sdhci.h>
+#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS +static struct sdhci_ops mv_ops; + +#if defined(CONFIG_SHEEVA_88SV331xV5) +#define SD_CE_ATA_2 0xEA +#define MMC_CARD 0x1000 +#define MMC_WIDTH 0x0100 +static inline void mv_sdhci_writeb(struct sdhci_host *host, u8 val, int reg) +{ + struct mmc *mmc = host->mmc; + u32 ata = (u32)host->ioaddr + SD_CE_ATA_2; + + if (!IS_SD(mmc) && reg == SDHCI_HOST_CONTROL) { + if (mmc->bus_width == 8) + writew(readw(ata) | (MMC_CARD | MMC_WIDTH), ata); + else + writew(readw(ata) & ~(MMC_CARD | MMC_WIDTH), ata); + } + + writeb(val, host->ioaddr + reg); +} + +#else +#define mv_sdhci_writeb NULL +#endif /* CONFIG_SHEEVA_88SV331xV5 */ +#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ + static char *MVSDH_NAME = "mv_sdh"; int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks) { @@ -15,6 +42,12 @@ int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks) host->name = MVSDH_NAME; host->ioaddr = (void *)regbase; host->quirks = quirks; +#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS + memset(&mv_ops, 0, sizeof(struct sdhci_ops)); + if (mv_sdhci_writeb != NULL) + mv_ops.write_b = mv_sdhci_writeb; + host->ops = &mv_ops; +#endif host->version = sdhci_readw(host, SDHCI_HOST_VERSION); add_sdhci(host, max_clk, min_clk); return 0;
participants (5)
-
Albert ARIBAUD
-
Lei Wen
-
Lei Wen
-
Marek Vasut
-
Wolfgang Denk