blob: 6ca96a2d06ac5fb7113679ded3b79693f739ea0d [file] [log] [blame]
Vipin Kumar23b00422012-12-05 20:44:09 +00001/*
2 * (C) Copyright 2012
3 * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Vipin Kumar23b00422012-12-05 20:44:09 +00006 */
7
8#include <common.h>
9#include <malloc.h>
10#include <sdhci.h>
11
12int spear_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
13{
14 struct sdhci_host *host = NULL;
15 host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
16 if (!host) {
17 printf("sdhci host malloc fail!\n");
18 return 1;
19 }
20
21 host->name = "sdhci";
22 host->ioaddr = (void *)regbase;
23 host->quirks = quirks;
24
25 if (quirks & SDHCI_QUIRK_REG32_RW)
26 host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
27 else
28 host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
29
30 add_sdhci(host, max_clk, min_clk);
31 return 0;
32}