xref: /openbmc/u-boot/drivers/mmc/uniphier-sd.c (revision cb0b6b035a356e958bf964803e87539464f01bf2)
1a111bfbfSMasahiro Yamada /*
24e3d8406SMasahiro Yamada  * Copyright (C) 2016 Socionext Inc.
34e3d8406SMasahiro Yamada  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4a111bfbfSMasahiro Yamada  *
5a111bfbfSMasahiro Yamada  * SPDX-License-Identifier:	GPL-2.0+
6a111bfbfSMasahiro Yamada  */
7a111bfbfSMasahiro Yamada 
8a111bfbfSMasahiro Yamada #include <common.h>
9a111bfbfSMasahiro Yamada #include <clk.h>
10a111bfbfSMasahiro Yamada #include <fdtdec.h>
11a111bfbfSMasahiro Yamada #include <mmc.h>
129d922450SSimon Glass #include <dm.h>
13a111bfbfSMasahiro Yamada #include <linux/compat.h>
14b27af399SMasahiro Yamada #include <linux/dma-direction.h>
15a111bfbfSMasahiro Yamada #include <linux/io.h>
164f80501bSMasahiro Yamada #include <linux/sizes.h>
179f13021fSMarek Vasut #include <power/regulator.h>
18a111bfbfSMasahiro Yamada #include <asm/unaligned.h>
19a111bfbfSMasahiro Yamada 
20*cb0b6b03SMarek Vasut #include "tmio-common.h"
214eb00846SMasahiro Yamada 
224eb00846SMasahiro Yamada static const struct dm_mmc_ops uniphier_sd_ops = {
23*cb0b6b03SMarek Vasut 	.send_cmd = tmio_sd_send_cmd,
24*cb0b6b03SMarek Vasut 	.set_ios = tmio_sd_set_ios,
25*cb0b6b03SMarek Vasut 	.get_cd = tmio_sd_get_cd,
264eb00846SMasahiro Yamada };
274eb00846SMasahiro Yamada 
28a111bfbfSMasahiro Yamada static const struct udevice_id uniphier_sd_match[] = {
294b26d5e3SMarek Vasut 	{ .compatible = "socionext,uniphier-sdhc", .data = 0 },
30a111bfbfSMasahiro Yamada 	{ /* sentinel */ }
31a111bfbfSMasahiro Yamada };
32a111bfbfSMasahiro Yamada 
33c769e609SMarek Vasut static int uniphier_sd_probe(struct udevice *dev)
34c769e609SMarek Vasut {
35*cb0b6b03SMarek Vasut 	return tmio_sd_probe(dev, 0);
36c769e609SMarek Vasut }
37c769e609SMarek Vasut 
38a111bfbfSMasahiro Yamada U_BOOT_DRIVER(uniphier_mmc) = {
39a111bfbfSMasahiro Yamada 	.name = "uniphier-mmc",
40a111bfbfSMasahiro Yamada 	.id = UCLASS_MMC,
41a111bfbfSMasahiro Yamada 	.of_match = uniphier_sd_match,
42*cb0b6b03SMarek Vasut 	.bind = tmio_sd_bind,
43c769e609SMarek Vasut 	.probe = uniphier_sd_probe,
44*cb0b6b03SMarek Vasut 	.priv_auto_alloc_size = sizeof(struct tmio_sd_priv),
45*cb0b6b03SMarek Vasut 	.platdata_auto_alloc_size = sizeof(struct tmio_sd_plat),
463937404fSMasahiro Yamada 	.ops = &uniphier_sd_ops,
47a111bfbfSMasahiro Yamada };
48