Vipin Kumar | 23b0042 | 2012-12-05 20:44:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2012 |
| 3 | * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Vipin Kumar | 23b0042 | 2012-12-05 20:44:09 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <malloc.h> |
| 10 | #include <sdhci.h> |
| 11 | |
| 12 | int 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 | } |