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