xref: /rk3399_rockchip-uboot/drivers/mmc/zynq_sdhci.c (revision 293eb33fcb95e2b2bae71edf97b0ca3bdd6ba98d)
1*293eb33fSMichal Simek /*
2*293eb33fSMichal Simek  * (C) Copyright 2013 Inc.
3*293eb33fSMichal Simek  *
4*293eb33fSMichal Simek  * Xilinx Zynq SD Host Controller Interface
5*293eb33fSMichal Simek  *
6*293eb33fSMichal Simek  * This program is free software; you can redistribute it and/or modify it under
7*293eb33fSMichal Simek  * the terms of the GNU General Public License version 2 as published by the
8*293eb33fSMichal Simek  * Free Software Foundation; either version 2 of the License, or (at your
9*293eb33fSMichal Simek  * option) any later version.
10*293eb33fSMichal Simek  *
11*293eb33fSMichal Simek  * You should have received a copy of the GNU General Public License along with
12*293eb33fSMichal Simek  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
13*293eb33fSMichal Simek  * Place, Suite 330, Boston, MA  02111-1307  USA
14*293eb33fSMichal Simek  */
15*293eb33fSMichal Simek 
16*293eb33fSMichal Simek #include <common.h>
17*293eb33fSMichal Simek #include <malloc.h>
18*293eb33fSMichal Simek #include <sdhci.h>
19*293eb33fSMichal Simek #include <asm/arch/sys_proto.h>
20*293eb33fSMichal Simek 
21*293eb33fSMichal Simek int zynq_sdhci_init(u32 regbase)
22*293eb33fSMichal Simek {
23*293eb33fSMichal Simek 	struct sdhci_host *host = NULL;
24*293eb33fSMichal Simek 
25*293eb33fSMichal Simek 	host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
26*293eb33fSMichal Simek 	if (!host) {
27*293eb33fSMichal Simek 		printf("zynq_sdhci_init: sdhci_host malloc fail\n");
28*293eb33fSMichal Simek 		return 1;
29*293eb33fSMichal Simek 	}
30*293eb33fSMichal Simek 
31*293eb33fSMichal Simek 	host->name = "zynq_sdhci";
32*293eb33fSMichal Simek 	host->ioaddr = (void *)regbase;
33*293eb33fSMichal Simek 	host->quirks = SDHCI_QUIRK_NO_CD | SDHCI_QUIRK_WAIT_SEND_CMD;
34*293eb33fSMichal Simek 	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
35*293eb33fSMichal Simek 
36*293eb33fSMichal Simek 	host->host_caps = MMC_MODE_HC;
37*293eb33fSMichal Simek 
38*293eb33fSMichal Simek 	add_sdhci(host, 52000000, 52000000 >> 9);
39*293eb33fSMichal Simek 	return 0;
40*293eb33fSMichal Simek }
41