11144ab5dSAlbert Herranz /* 21144ab5dSAlbert Herranz * drivers/mmc/host/sdhci-of-hlwd.c 31144ab5dSAlbert Herranz * 41144ab5dSAlbert Herranz * Nintendo Wii Secure Digital Host Controller Interface. 51144ab5dSAlbert Herranz * Copyright (C) 2009 The GameCube Linux Team 61144ab5dSAlbert Herranz * Copyright (C) 2009 Albert Herranz 71144ab5dSAlbert Herranz * 81144ab5dSAlbert Herranz * Based on sdhci-of-esdhc.c 91144ab5dSAlbert Herranz * 101144ab5dSAlbert Herranz * Copyright (c) 2007 Freescale Semiconductor, Inc. 111144ab5dSAlbert Herranz * Copyright (c) 2009 MontaVista Software, Inc. 121144ab5dSAlbert Herranz * 131144ab5dSAlbert Herranz * Authors: Xiaobo Xie <X.Xie@freescale.com> 141144ab5dSAlbert Herranz * Anton Vorontsov <avorontsov@ru.mvista.com> 151144ab5dSAlbert Herranz * 161144ab5dSAlbert Herranz * This program is free software; you can redistribute it and/or modify 171144ab5dSAlbert Herranz * it under the terms of the GNU General Public License as published by 181144ab5dSAlbert Herranz * the Free Software Foundation; either version 2 of the License, or (at 191144ab5dSAlbert Herranz * your option) any later version. 201144ab5dSAlbert Herranz */ 211144ab5dSAlbert Herranz 221144ab5dSAlbert Herranz #include <linux/delay.h> 231144ab5dSAlbert Herranz #include <linux/mmc/host.h> 241144ab5dSAlbert Herranz #include "sdhci-of.h" 251144ab5dSAlbert Herranz #include "sdhci.h" 261144ab5dSAlbert Herranz 271144ab5dSAlbert Herranz /* 281144ab5dSAlbert Herranz * Ops and quirks for the Nintendo Wii SDHCI controllers. 291144ab5dSAlbert Herranz */ 301144ab5dSAlbert Herranz 311144ab5dSAlbert Herranz /* 321144ab5dSAlbert Herranz * We need a small delay after each write, or things go horribly wrong. 331144ab5dSAlbert Herranz */ 341144ab5dSAlbert Herranz #define SDHCI_HLWD_WRITE_DELAY 5 /* usecs */ 351144ab5dSAlbert Herranz 361144ab5dSAlbert Herranz static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg) 371144ab5dSAlbert Herranz { 381144ab5dSAlbert Herranz sdhci_be32bs_writel(host, val, reg); 391144ab5dSAlbert Herranz udelay(SDHCI_HLWD_WRITE_DELAY); 401144ab5dSAlbert Herranz } 411144ab5dSAlbert Herranz 421144ab5dSAlbert Herranz static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg) 431144ab5dSAlbert Herranz { 441144ab5dSAlbert Herranz sdhci_be32bs_writew(host, val, reg); 451144ab5dSAlbert Herranz udelay(SDHCI_HLWD_WRITE_DELAY); 461144ab5dSAlbert Herranz } 471144ab5dSAlbert Herranz 481144ab5dSAlbert Herranz static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg) 491144ab5dSAlbert Herranz { 501144ab5dSAlbert Herranz sdhci_be32bs_writeb(host, val, reg); 511144ab5dSAlbert Herranz udelay(SDHCI_HLWD_WRITE_DELAY); 521144ab5dSAlbert Herranz } 531144ab5dSAlbert Herranz 54*e307148fSShawn Guo static struct sdhci_ops sdhci_hlwd_ops = { 55dc297c92SMatt Fleming .read_l = sdhci_be32bs_readl, 56dc297c92SMatt Fleming .read_w = sdhci_be32bs_readw, 57dc297c92SMatt Fleming .read_b = sdhci_be32bs_readb, 58dc297c92SMatt Fleming .write_l = sdhci_hlwd_writel, 59dc297c92SMatt Fleming .write_w = sdhci_hlwd_writew, 60dc297c92SMatt Fleming .write_b = sdhci_hlwd_writeb, 61*e307148fSShawn Guo }; 62*e307148fSShawn Guo 63*e307148fSShawn Guo struct sdhci_pltfm_data sdhci_hlwd_pdata = { 64*e307148fSShawn Guo .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | 65*e307148fSShawn Guo SDHCI_QUIRK_32BIT_DMA_SIZE, 66*e307148fSShawn Guo .ops = &sdhci_hlwd_ops, 671144ab5dSAlbert Herranz }; 68