blob: 4940ccb35725edd0c7ec40995b230ee4d411a6fc [file] [log] [blame]
Kuo-Jung Suadebb982013-11-25 10:51:41 +08001/*
2 * (C) Copyright 2013 Faraday Technology
3 * Kuo-Jung Su <dantesu@faraday-tech.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <malloc.h>
10#include <sdhci.h>
11
12#ifndef CONFIG_FTSDC021_CLOCK
13#define CONFIG_FTSDC021_CLOCK clk_get_rate("MMC")
14#endif
15
16int ftsdc021_sdhci_init(u32 regbase)
17{
18 struct sdhci_host *host = NULL;
19 uint32_t freq = CONFIG_FTSDC021_CLOCK;
20
21 host = calloc(1, sizeof(struct sdhci_host));
22 if (!host) {
23 puts("sdh_host malloc fail!\n");
Jaehoon Chung2cb5d672016-09-26 08:10:02 +090024 return -ENOMEM;
Kuo-Jung Suadebb982013-11-25 10:51:41 +080025 }
26
27 host->name = "FTSDC021";
28 host->ioaddr = (void __iomem *)regbase;
29 host->quirks = 0;
Stefan Herbrechtsmeier6d0e34b2017-01-17 15:58:48 +010030 host->max_clk = freq;
31 add_sdhci(host, 0, 0);
Kuo-Jung Suadebb982013-11-25 10:51:41 +080032
33 return 0;
34}