Linux Audio

Check our new training course

Loading...
v6.2
 1// SPDX-License-Identifier: GPL-2.0-or-later
 2/*
 3 * drivers/mmc/host/sdhci-of-hlwd.c
 4 *
 5 * Nintendo Wii Secure Digital Host Controller Interface.
 6 * Copyright (C) 2009 The GameCube Linux Team
 7 * Copyright (C) 2009 Albert Herranz
 8 *
 9 * Based on sdhci-of-esdhc.c
10 *
11 * Copyright (c) 2007 Freescale Semiconductor, Inc.
12 * Copyright (c) 2009 MontaVista Software, Inc.
13 *
14 * Authors: Xiaobo Xie <X.Xie@freescale.com>
15 *	    Anton Vorontsov <avorontsov@ru.mvista.com>
 
 
 
 
 
16 */
17
18#include <linux/delay.h>
19#include <linux/module.h>
20#include <linux/mmc/host.h>
21#include "sdhci-pltfm.h"
22
23/*
24 * Ops and quirks for the Nintendo Wii SDHCI controllers.
25 */
26
27/*
28 * We need a small delay after each write, or things go horribly wrong.
29 */
30#define SDHCI_HLWD_WRITE_DELAY	5 /* usecs */
31
32static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg)
33{
34	sdhci_be32bs_writel(host, val, reg);
35	udelay(SDHCI_HLWD_WRITE_DELAY);
36}
37
38static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg)
39{
40	sdhci_be32bs_writew(host, val, reg);
41	udelay(SDHCI_HLWD_WRITE_DELAY);
42}
43
44static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)
45{
46	sdhci_be32bs_writeb(host, val, reg);
47	udelay(SDHCI_HLWD_WRITE_DELAY);
48}
49
50static 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,
59	.reset = sdhci_reset,
60	.set_uhs_signaling = sdhci_set_uhs_signaling,
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 const struct of_device_id sdhci_hlwd_of_match[] = {
75	{ .compatible = "nintendo,hollywood-sdhci" },
76	{ }
77};
78MODULE_DEVICE_TABLE(of, sdhci_hlwd_of_match);
79
80static struct platform_driver sdhci_hlwd_driver = {
81	.driver = {
82		.name = "sdhci-hlwd",
83		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
84		.of_match_table = sdhci_hlwd_of_match,
85		.pm = &sdhci_pltfm_pmops,
86	},
87	.probe = sdhci_hlwd_probe,
88	.remove = sdhci_pltfm_unregister,
 
 
 
 
89};
90
91module_platform_driver(sdhci_hlwd_driver);
 
 
 
 
 
 
 
 
 
 
92
93MODULE_DESCRIPTION("Nintendo Wii SDHCI OF driver");
94MODULE_AUTHOR("The GameCube Linux Team, Albert Herranz");
95MODULE_LICENSE("GPL v2");
v3.1
 
  1/*
  2 * drivers/mmc/host/sdhci-of-hlwd.c
  3 *
  4 * Nintendo Wii Secure Digital Host Controller Interface.
  5 * Copyright (C) 2009 The GameCube Linux Team
  6 * Copyright (C) 2009 Albert Herranz
  7 *
  8 * Based on sdhci-of-esdhc.c
  9 *
 10 * Copyright (c) 2007 Freescale Semiconductor, Inc.
 11 * Copyright (c) 2009 MontaVista Software, Inc.
 12 *
 13 * Authors: Xiaobo Xie <X.Xie@freescale.com>
 14 *	    Anton Vorontsov <avorontsov@ru.mvista.com>
 15 *
 16 * This program is free software; you can redistribute it and/or modify
 17 * it under the terms of the GNU General Public License as published by
 18 * the Free Software Foundation; either version 2 of the License, or (at
 19 * your option) any later version.
 20 */
 21
 22#include <linux/delay.h>
 
 23#include <linux/mmc/host.h>
 24#include "sdhci-pltfm.h"
 25
 26/*
 27 * Ops and quirks for the Nintendo Wii SDHCI controllers.
 28 */
 29
 30/*
 31 * We need a small delay after each write, or things go horribly wrong.
 32 */
 33#define SDHCI_HLWD_WRITE_DELAY	5 /* usecs */
 34
 35static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg)
 36{
 37	sdhci_be32bs_writel(host, val, reg);
 38	udelay(SDHCI_HLWD_WRITE_DELAY);
 39}
 40
 41static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg)
 42{
 43	sdhci_be32bs_writew(host, val, reg);
 44	udelay(SDHCI_HLWD_WRITE_DELAY);
 45}
 46
 47static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)
 48{
 49	sdhci_be32bs_writeb(host, val, reg);
 50	udelay(SDHCI_HLWD_WRITE_DELAY);
 51}
 52
 53static struct sdhci_ops sdhci_hlwd_ops = {
 54	.read_l = sdhci_be32bs_readl,
 55	.read_w = sdhci_be32bs_readw,
 56	.read_b = sdhci_be32bs_readb,
 57	.write_l = sdhci_hlwd_writel,
 58	.write_w = sdhci_hlwd_writew,
 59	.write_b = sdhci_hlwd_writeb,
 
 
 
 
 60};
 61
 62static struct sdhci_pltfm_data sdhci_hlwd_pdata = {
 63	.quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
 64		  SDHCI_QUIRK_32BIT_DMA_SIZE,
 65	.ops = &sdhci_hlwd_ops,
 66};
 67
 68static int __devinit sdhci_hlwd_probe(struct platform_device *pdev)
 69{
 70	return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata);
 71}
 72
 73static int __devexit sdhci_hlwd_remove(struct platform_device *pdev)
 74{
 75	return sdhci_pltfm_unregister(pdev);
 76}
 77
 78static const struct of_device_id sdhci_hlwd_of_match[] = {
 79	{ .compatible = "nintendo,hollywood-sdhci" },
 80	{ }
 81};
 82MODULE_DEVICE_TABLE(of, sdhci_hlwd_of_match);
 83
 84static struct platform_driver sdhci_hlwd_driver = {
 85	.driver = {
 86		.name = "sdhci-hlwd",
 87		.owner = THIS_MODULE,
 88		.of_match_table = sdhci_hlwd_of_match,
 
 89	},
 90	.probe = sdhci_hlwd_probe,
 91	.remove = __devexit_p(sdhci_hlwd_remove),
 92#ifdef CONFIG_PM
 93	.suspend = sdhci_pltfm_suspend,
 94	.resume = sdhci_pltfm_resume,
 95#endif
 96};
 97
 98static int __init sdhci_hlwd_init(void)
 99{
100	return platform_driver_register(&sdhci_hlwd_driver);
101}
102module_init(sdhci_hlwd_init);
103
104static void __exit sdhci_hlwd_exit(void)
105{
106	platform_driver_unregister(&sdhci_hlwd_driver);
107}
108module_exit(sdhci_hlwd_exit);
109
110MODULE_DESCRIPTION("Nintendo Wii SDHCI OF driver");
111MODULE_AUTHOR("The GameCube Linux Team, Albert Herranz");
112MODULE_LICENSE("GPL v2");