mmc: Add support for Xilinx Zynq sdhci controller
Add support for SD, MMC and eMMC card on Xilinx Zynq. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@ti.com>
This commit is contained in:
parent
f97d7e8be9
commit
293eb33fcb
@ -29,6 +29,8 @@
|
||||
#define ZYNQ_SCUTIMER_BASEADDR 0xF8F00600
|
||||
#define ZYNQ_GEM_BASEADDR0 0xE000B000
|
||||
#define ZYNQ_GEM_BASEADDR1 0xE000C000
|
||||
#define ZYNQ_SDHCI_BASEADDR0 0xE0100000
|
||||
#define ZYNQ_SDHCI_BASEADDR1 0xE0101000
|
||||
|
||||
/* Reflect slcr offsets */
|
||||
struct slcr_regs {
|
||||
|
@ -28,4 +28,7 @@ extern void zynq_slcr_unlock(void);
|
||||
extern void zynq_slcr_cpu_reset(void);
|
||||
extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk);
|
||||
|
||||
/* Driver extern functions */
|
||||
extern int zynq_sdhci_init(u32 regbase);
|
||||
|
||||
#endif /* _SYS_PROTO_H_ */
|
||||
|
@ -54,6 +54,23 @@ int board_eth_init(bd_t *bis)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CMD_MMC
|
||||
int board_mmc_init(bd_t *bd)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#if defined(CONFIG_ZYNQ_SDHCI)
|
||||
# if defined(CONFIG_ZYNQ_SDHCI0)
|
||||
ret = zynq_sdhci_init(ZYNQ_SDHCI_BASEADDR0);
|
||||
# endif
|
||||
# if defined(CONFIG_ZYNQ_SDHCI1)
|
||||
ret |= zynq_sdhci_init(ZYNQ_SDHCI_BASEADDR1);
|
||||
# endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
||||
|
@ -49,6 +49,7 @@ COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
|
||||
COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
|
||||
COBJS-$(CONFIG_DWMMC) += dw_mmc.o
|
||||
COBJS-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o
|
||||
COBJS-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
|
||||
|
||||
COBJS := $(COBJS-y)
|
||||
SRCS := $(COBJS:.o=.c)
|
||||
|
40
drivers/mmc/zynq_sdhci.c
Normal file
40
drivers/mmc/zynq_sdhci.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* (C) Copyright 2013 Inc.
|
||||
*
|
||||
* Xilinx Zynq SD Host Controller Interface
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 2 as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <malloc.h>
|
||||
#include <sdhci.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
|
||||
int zynq_sdhci_init(u32 regbase)
|
||||
{
|
||||
struct sdhci_host *host = NULL;
|
||||
|
||||
host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
|
||||
if (!host) {
|
||||
printf("zynq_sdhci_init: sdhci_host malloc fail\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
host->name = "zynq_sdhci";
|
||||
host->ioaddr = (void *)regbase;
|
||||
host->quirks = SDHCI_QUIRK_NO_CD | SDHCI_QUIRK_WAIT_SEND_CMD;
|
||||
host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
|
||||
|
||||
host->host_caps = MMC_MODE_HC;
|
||||
|
||||
add_sdhci(host, 52000000, 52000000 >> 9);
|
||||
return 0;
|
||||
}
|
@ -56,6 +56,22 @@
|
||||
#define CONFIG_ZYNQ_GEM0
|
||||
#define CONFIG_ZYNQ_GEM_PHY_ADDR0 7
|
||||
|
||||
#define CONFIG_ZYNQ_SDHCI
|
||||
#define CONFIG_ZYNQ_SDHCI0
|
||||
|
||||
/* MMC */
|
||||
#if defined(CONFIG_ZYNQ_SDHCI0) || defined(CONFIG_ZYNQ_SDHCI1)
|
||||
# define CONFIG_MMC
|
||||
# define CONFIG_GENERIC_MMC
|
||||
# define CONFIG_SDHCI
|
||||
# define CONFIG_ZYNQ_SDHCI
|
||||
# define CONFIG_CMD_MMC
|
||||
# define CONFIG_CMD_FAT
|
||||
# define CONFIG_SUPPORT_VFAT
|
||||
# define CONFIG_CMD_EXT2
|
||||
# define CONFIG_DOS_PARTITION
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ZYNQ_DCC)
|
||||
# define CONFIG_ARM_DCC
|
||||
# define CONFIG_CPU_V6 /* Required by CONFIG_ARM_DCC */
|
||||
|
Loading…
Reference in New Issue
Block a user