2 * Copyright (C) 2018 Marek Vasut <marek.vasut@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/compat.h>
13 #include <linux/dma-direction.h>
15 #include <linux/sizes.h>
16 #include <power/regulator.h>
17 #include <asm/unaligned.h>
19 #include "matsushita-common.h"
21 static const struct dm_mmc_ops renesas_sdhi_ops = {
22 .send_cmd = matsu_sd_send_cmd,
23 .set_ios = matsu_sd_set_ios,
24 .get_cd = matsu_sd_get_cd,
27 static const struct udevice_id renesas_sdhi_match[] = {
28 { .compatible = "renesas,sdhi-r8a7790", .data = 0 },
29 { .compatible = "renesas,sdhi-r8a7791", .data = 0 },
30 { .compatible = "renesas,sdhi-r8a7792", .data = 0 },
31 { .compatible = "renesas,sdhi-r8a7793", .data = 0 },
32 { .compatible = "renesas,sdhi-r8a7794", .data = 0 },
33 { .compatible = "renesas,sdhi-r8a7795", .data = MATSU_SD_CAP_64BIT },
34 { .compatible = "renesas,sdhi-r8a7796", .data = MATSU_SD_CAP_64BIT },
35 { .compatible = "renesas,sdhi-r8a77965", .data = MATSU_SD_CAP_64BIT },
36 { .compatible = "renesas,sdhi-r8a77970", .data = MATSU_SD_CAP_64BIT },
37 { .compatible = "renesas,sdhi-r8a77995", .data = MATSU_SD_CAP_64BIT },
41 static int renesas_sdhi_probe(struct udevice *dev)
43 u32 quirks = dev_get_driver_data(dev);
44 struct fdt_resource reg_res;
45 DECLARE_GLOBAL_DATA_PTR;
48 ret = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
51 dev_err(dev, "\"reg\" resource not found, ret=%i\n", ret);
55 if (quirks == 0 && fdt_resource_size(®_res) == 0x100)
56 quirks = MATSU_SD_CAP_16BIT;
58 return matsu_sd_probe(dev, quirks);
61 U_BOOT_DRIVER(renesas_sdhi) = {
62 .name = "renesas-sdhi",
64 .of_match = renesas_sdhi_match,
65 .bind = matsu_sd_bind,
66 .probe = renesas_sdhi_probe,
67 .priv_auto_alloc_size = sizeof(struct matsu_sd_priv),
68 .platdata_auto_alloc_size = sizeof(struct matsu_sd_plat),
69 .ops = &renesas_sdhi_ops,