1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * drivers/mmc/host/sdhci-of-hlwd.c
5 * Nintendo Wii Secure Digital Host Controller Interface.
6 * Copyright (C) 2009 The GameCube Linux Team
7 * Copyright (C) 2009 Albert Herranz
9 * Based on sdhci-of-esdhc.c
11 * Copyright (c) 2007 Freescale Semiconductor, Inc.
12 * Copyright (c) 2009 MontaVista Software, Inc.
14 * Authors: Xiaobo Xie <X.Xie@freescale.com>
15 * Anton Vorontsov <avorontsov@ru.mvista.com>
18 #include <linux/delay.h>
19 #include <linux/module.h>
20 #include <linux/mmc/host.h>
21 #include "sdhci-pltfm.h"
24 * Ops and quirks for the Nintendo Wii SDHCI controllers.
28 * We need a small delay after each write, or things go horribly wrong.
30 #define SDHCI_HLWD_WRITE_DELAY 5 /* usecs */
32 static void sdhci_hlwd_writel(struct sdhci_host
*host
, u32 val
, int reg
)
34 sdhci_be32bs_writel(host
, val
, reg
);
35 udelay(SDHCI_HLWD_WRITE_DELAY
);
38 static void sdhci_hlwd_writew(struct sdhci_host
*host
, u16 val
, int reg
)
40 sdhci_be32bs_writew(host
, val
, reg
);
41 udelay(SDHCI_HLWD_WRITE_DELAY
);
44 static void sdhci_hlwd_writeb(struct sdhci_host
*host
, u8 val
, int reg
)
46 sdhci_be32bs_writeb(host
, val
, reg
);
47 udelay(SDHCI_HLWD_WRITE_DELAY
);
50 static const struct sdhci_ops sdhci_hlwd_ops
= {
51 .read_l
= sdhci_be32bs_readl
,
52 .read_w
= sdhci_be32bs_readw
,
53 .read_b
= sdhci_be32bs_readb
,
54 .write_l
= sdhci_hlwd_writel
,
55 .write_w
= sdhci_hlwd_writew
,
56 .write_b
= sdhci_hlwd_writeb
,
57 .set_clock
= sdhci_set_clock
,
58 .set_bus_width
= sdhci_set_bus_width
,
60 .set_uhs_signaling
= sdhci_set_uhs_signaling
,
63 static const struct sdhci_pltfm_data sdhci_hlwd_pdata
= {
64 .quirks
= SDHCI_QUIRK_32BIT_DMA_ADDR
|
65 SDHCI_QUIRK_32BIT_DMA_SIZE
,
66 .ops
= &sdhci_hlwd_ops
,
69 static int sdhci_hlwd_probe(struct platform_device
*pdev
)
71 return sdhci_pltfm_register(pdev
, &sdhci_hlwd_pdata
, 0);
74 static const struct of_device_id sdhci_hlwd_of_match
[] = {
75 { .compatible
= "nintendo,hollywood-sdhci" },
78 MODULE_DEVICE_TABLE(of
, sdhci_hlwd_of_match
);
80 static struct platform_driver sdhci_hlwd_driver
= {
83 .of_match_table
= sdhci_hlwd_of_match
,
84 .pm
= &sdhci_pltfm_pmops
,
86 .probe
= sdhci_hlwd_probe
,
87 .remove
= sdhci_pltfm_unregister
,
90 module_platform_driver(sdhci_hlwd_driver
);
92 MODULE_DESCRIPTION("Nintendo Wii SDHCI OF driver");
93 MODULE_AUTHOR("The GameCube Linux Team, Albert Herranz");
94 MODULE_LICENSE("GPL v2");