uboot/drivers/mmc/spear_sdhci.c
<<
>>
Prefs
   1/*
   2 * (C) Copyright 2012
   3 * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
   4 *
   5 * SPDX-License-Identifier:     GPL-2.0+
   6 */
   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}
  33