blob: aaea044f5a720e3c3a80ab4e846c322d76db069e [file] [log] [blame]
Albert Herranz1144ab52009-12-17 15:27:20 -08001/*
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>
Paul Gortmakera4df3ae2011-07-03 15:15:51 -040023#include <linux/module.h>
Albert Herranz1144ab52009-12-17 15:27:20 -080024#include <linux/mmc/host.h>
25#include "sdhci-of.h"
26#include "sdhci.h"
27
28/*
29 * Ops and quirks for the Nintendo Wii SDHCI controllers.
30 */
31
32/*
33 * We need a small delay after each write, or things go horribly wrong.
34 */
35#define SDHCI_HLWD_WRITE_DELAY 5 /* usecs */
36
37static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg)
38{
39 sdhci_be32bs_writel(host, val, reg);
40 udelay(SDHCI_HLWD_WRITE_DELAY);
41}
42
43static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg)
44{
45 sdhci_be32bs_writew(host, val, reg);
46 udelay(SDHCI_HLWD_WRITE_DELAY);
47}
48
49static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)
50{
51 sdhci_be32bs_writeb(host, val, reg);
52 udelay(SDHCI_HLWD_WRITE_DELAY);
53}
54
55struct sdhci_of_data sdhci_hlwd = {
56 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
57 SDHCI_QUIRK_32BIT_DMA_SIZE,
58 .ops = {
Matt Flemingdc297c92010-05-26 14:42:03 -070059 .read_l = sdhci_be32bs_readl,
60 .read_w = sdhci_be32bs_readw,
61 .read_b = sdhci_be32bs_readb,
62 .write_l = sdhci_hlwd_writel,
63 .write_w = sdhci_hlwd_writew,
64 .write_b = sdhci_hlwd_writeb,
Albert Herranz1144ab52009-12-17 15:27:20 -080065 },
66};