2 * Support of SDHCI for Microchip PIC32 SoC.
4 * Copyright (C) 2015 Microchip Technology Inc.
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/errno.h>
14 #include <mach/pic32.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 static int pic32_sdhci_probe(struct udevice *dev)
20 struct sdhci_host *host = dev_get_priv(dev);
21 const void *fdt = gd->fdt_blob;
27 addr = fdtdec_get_addr_size(fdt, dev->of_offset, "reg", &size);
28 if (addr == FDT_ADDR_T_NONE)
31 host->ioaddr = ioremap(addr, size);
32 host->name = dev->name;
33 host->quirks = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_NO_CD;
34 host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
37 ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
38 "clock-freq-min-max", f_min_max, 2);
40 printf("sdhci: clock-freq-min-max not found\n");
44 return add_sdhci(host, f_min_max[1], f_min_max[0]);
47 static const struct udevice_id pic32_sdhci_ids[] = {
48 { .compatible = "microchip,pic32mzda-sdhci" },
52 U_BOOT_DRIVER(pic32_sdhci_drv) = {
53 .name = "pic32_sdhci",
55 .of_match = pic32_sdhci_ids,
56 .probe = pic32_sdhci_probe,
57 .priv_auto_alloc_size = sizeof(struct sdhci_host),