1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <linux/delay.h>
23#include <linux/module.h>
24#include <linux/mmc/host.h>
25#include "sdhci-pltfm.h"
26
27
28
29
30
31
32
33
34#define SDHCI_HLWD_WRITE_DELAY 5
35
36static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg)
37{
38 sdhci_be32bs_writel(host, val, reg);
39 udelay(SDHCI_HLWD_WRITE_DELAY);
40}
41
42static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg)
43{
44 sdhci_be32bs_writew(host, val, reg);
45 udelay(SDHCI_HLWD_WRITE_DELAY);
46}
47
48static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)
49{
50 sdhci_be32bs_writeb(host, val, reg);
51 udelay(SDHCI_HLWD_WRITE_DELAY);
52}
53
54static const struct sdhci_ops sdhci_hlwd_ops = {
55 .read_l = sdhci_be32bs_readl,
56 .read_w = sdhci_be32bs_readw,
57 .read_b = sdhci_be32bs_readb,
58 .write_l = sdhci_hlwd_writel,
59 .write_w = sdhci_hlwd_writew,
60 .write_b = sdhci_hlwd_writeb,
61};
62
63static 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,
67};
68
69static int sdhci_hlwd_probe(struct platform_device *pdev)
70{
71 return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata, 0);
72}
73
74static int sdhci_hlwd_remove(struct platform_device *pdev)
75{
76 return sdhci_pltfm_unregister(pdev);
77}
78
79static const struct of_device_id sdhci_hlwd_of_match[] = {
80 { .compatible = "nintendo,hollywood-sdhci" },
81 { }
82};
83MODULE_DEVICE_TABLE(of, sdhci_hlwd_of_match);
84
85static struct platform_driver sdhci_hlwd_driver = {
86 .driver = {
87 .name = "sdhci-hlwd",
88 .owner = THIS_MODULE,
89 .of_match_table = sdhci_hlwd_of_match,
90 .pm = SDHCI_PLTFM_PMOPS,
91 },
92 .probe = sdhci_hlwd_probe,
93 .remove = sdhci_hlwd_remove,
94};
95
96module_platform_driver(sdhci_hlwd_driver);
97
98MODULE_DESCRIPTION("Nintendo Wii SDHCI OF driver");
99MODULE_AUTHOR("The GameCube Linux Team, Albert Herranz");
100MODULE_LICENSE("GPL v2");
101