[U-Boot] [PATCH 2/2] Armada100: Add SD card support for Marvell gplugD

Pantelis Antoniou panto at antoniou-consulting.com
Tue Sep 24 10:05:08 CEST 2013


Hi Ajay,

On Sep 24, 2013, at 11:02 AM, Ajay Bhargav wrote:

> This patch adds support for SD card interface (MMC1 and MMC2) for
> Marvell gplugD.
> 
> Signed-off-by: Ajay Bhargav <ajay.bhargav at einfochips.com>
> ---
> arch/arm/include/asm/arch-armada100/cpu.h |  1 +
> arch/arm/include/asm/arch-armada100/mfp.h | 17 ++++++++++++++
> board/Marvell/gplugd/gplugd.c             | 39 +++++++++++++++++++++++++++++++
> include/configs/gplugd.h                  |  9 +++++++
> 4 files changed, 66 insertions(+)
> 
> diff --git a/arch/arm/include/asm/arch-armada100/cpu.h b/arch/arm/include/asm/arch-armada100/cpu.h
> index c1f190d..8c5091e 100644
> --- a/arch/arm/include/asm/arch-armada100/cpu.h
> +++ b/arch/arm/include/asm/arch-armada100/cpu.h
> @@ -158,5 +158,6 @@ struct armd1cpu_registers {
>  */
> u32 armd1_sdram_base(int);
> u32 armd1_sdram_size(int);
> +int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks);
> 
> #endif /* _ARMADA100CPU_H */
> diff --git a/arch/arm/include/asm/arch-armada100/mfp.h b/arch/arm/include/asm/arch-armada100/mfp.h
> index b918239..202332b 100644
> --- a/arch/arm/include/asm/arch-armada100/mfp.h
> +++ b/arch/arm/include/asm/arch-armada100/mfp.h
> @@ -73,6 +73,23 @@
> #define MFP110_SSP2_CS		(MFP_REG(0x1B8) | MFP_AF0 | MFP_DRIVE_MEDIUM)
> #define MFP111_SSP2_CLK		(MFP_REG(0x1BC) | MFP_AF4 | MFP_DRIVE_MEDIUM)
> 
> +/* MMC 1 */
> +#define MFP040_MMC1_D1		(MFP_REG(0x00C) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP041_MMC1_D0		(MFP_REG(0x010) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP043_MMC1_CLK		(MFP_REG(0x018) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP049_MMC1_CMD		(MFP_REG(0x030) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP051_MMC1_D3		(MFP_REG(0x038) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP052_MMC1_D2		(MFP_REG(0x03C) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +#define MFP053_MMC1_CD		(MFP_REG(0x040) | MFP_AF1 | MFP_DRIVE_MEDIUM)
> +
> +/* MMC2 */
> +#define MFP028_MMC2_CMD		(MFP_REG(0x0BC) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +#define MFP029_MMC2_CLK		(MFP_REG(0x0C0) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +#define MFP030_MMC2_D0		(MFP_REG(0x0C4) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +#define MFP031_MMC2_D1		(MFP_REG(0x0C8) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +#define MFP032_MMC2_D2		(MFP_REG(0x0CC) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +#define MFP033_MMC2_D3		(MFP_REG(0x0D0) | MFP_AF6 | MFP_DRIVE_MEDIUM)
> +
> /* More macros can be defined here... */
> 
> #define MFP_PIN_MAX	117
> diff --git a/board/Marvell/gplugd/gplugd.c b/board/Marvell/gplugd/gplugd.c
> index 0e8ebcc..954d97e 100644
> --- a/board/Marvell/gplugd/gplugd.c
> +++ b/board/Marvell/gplugd/gplugd.c
> @@ -19,6 +19,7 @@
> #include <asm/arch/armada100.h>
> #include <asm/gpio.h>
> #include <miiphy.h>
> +#include <sdhci.h>
> 
> #ifdef CONFIG_ARMADA100_FEC
> #include <net.h>
> @@ -63,6 +64,23 @@ int board_early_init_f(void)
> 		MFP110_SSP2_CS,
> 		MFP111_SSP2_CLK,
> 
> +		/* MMC1 */
> +		MFP040_MMC1_D1,
> +		MFP041_MMC1_D0,
> +		MFP043_MMC1_CLK,
> +		MFP049_MMC1_CMD,
> +		MFP051_MMC1_D3,
> +		MFP052_MMC1_D2,
> +		MFP053_MMC1_CD,
> +
> +		/* MMC2 */
> +		MFP028_MMC2_CMD,
> +		MFP029_MMC2_CLK,
> +		MFP030_MMC2_D0,
> +		MFP031_MMC2_D1,
> +		MFP032_MMC2_D2,
> +		MFP033_MMC2_D3,
> +
> 		MFP_EOC		/*End of configuration*/
> 	};
> 	/* configure MFP's */
> @@ -90,6 +108,27 @@ int board_init(void)
> 	return 0;
> }
> 
> +int board_mmc_init(bd_t *bd)
> +{
> +	struct armd1apmu_registers *apmu_regs =
> +		(struct armd1apmu_registers *)ARMD1_APMU_BASE;
> +
> +	setbits_le32(&apmu_regs->sd1crc, SD1_SD2_AXI_RESET | SD1_RESET);
> +	udelay(10);
> +	setbits_le32(&apmu_regs->sd1crc, SD1_CLK_EN | SD1_SD2_AXICLK_EN);
> +
> +	setbits_le32(&apmu_regs->sd2crc, SD2_RESET);
> +	udelay(10);
> +	setbits_le32(&apmu_regs->sd2crc, SD2_CLK_EN);
> +
> +	mv_sdh_init(ARMD1_SD1_BASE, 0, 0,
> +			SDHCI_QUIRK_REG32_RW | SDHCI_QUIRK_BROKEN_R1B);
> +
> +	mv_sdh_init(ARMD1_SD2_BASE, 0, 0,
> +			SDHCI_QUIRK_REG32_RW | SDHCI_QUIRK_BROKEN_R1B);
> +	return 0;
> +}
> +
> #ifdef CONFIG_ARMADA100_FEC
> int board_eth_init(bd_t *bis)
> {
> diff --git a/include/configs/gplugd.h b/include/configs/gplugd.h
> index 404c56a..a4e6c49 100644
> --- a/include/configs/gplugd.h
> +++ b/include/configs/gplugd.h
> @@ -95,6 +95,15 @@
> #define CONFIG_CMD_SF
> #define CONFIG_SPI_FLASH_ATMEL
> 
> +#define CONFIG_MV_SDHCI
> +#define CONFIG_SDHCI
> +#define CONFIG_CMD_MMC
> +#define CONFIG_MMC
> +#define CONFIG_GENERIC_MMC
> +#define CONFIG_DOS_PARTITION
> +#define CONFIG_MMC_SDMA
> +#define CONFIG_MMC_SDHCI_IO_ACCESSORS
> +
> /*
>  * mv-common.h should be defined after CMD configs since it used them
>  * to enable certain macros
> -- 
> 1.8.3.rc3
> 

Acked-by: Pantelis Antoniou <panto at antoniou-consulting.com>

> *************************************************************************************************************************************************************
> eInfochips Business Disclaimer : This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email.
> *************************************************************************************************************************************************************
> 
> 
> ---------------------------------------------------------------------------------------------
> Notice: 
> This message has been scanned by Trend Micro Mail Security scanner and is believed to be clean
> ---------------------------------------------------------------------------------------------



More information about the U-Boot mailing list