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> 2388b47679SPaul Gortmaker #include <linux/module.h> 241144ab5dSAlbert Herranz #include <linux/mmc/host.h> 2538576af1SShawn Guo #include "sdhci-pltfm.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 54e307148fSShawn 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, 61e307148fSShawn Guo }; 62e307148fSShawn Guo 63*1db5eebfSLars-Peter Clausen static const struct sdhci_pltfm_data sdhci_hlwd_pdata = { 64e307148fSShawn Guo .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | 65e307148fSShawn Guo SDHCI_QUIRK_32BIT_DMA_SIZE, 66e307148fSShawn Guo .ops = &sdhci_hlwd_ops, 671144ab5dSAlbert Herranz }; 6838576af1SShawn Guo 69c3be1efdSBill Pemberton static int sdhci_hlwd_probe(struct platform_device *pdev) 7038576af1SShawn Guo { 7138576af1SShawn Guo return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata); 7238576af1SShawn Guo } 7338576af1SShawn Guo 746e0ee714SBill Pemberton static int sdhci_hlwd_remove(struct platform_device *pdev) 7538576af1SShawn Guo { 7638576af1SShawn Guo return sdhci_pltfm_unregister(pdev); 7738576af1SShawn Guo } 7838576af1SShawn Guo 7938576af1SShawn Guo static const struct of_device_id sdhci_hlwd_of_match[] = { 8038576af1SShawn Guo { .compatible = "nintendo,hollywood-sdhci" }, 8138576af1SShawn Guo { } 8238576af1SShawn Guo }; 8338576af1SShawn Guo MODULE_DEVICE_TABLE(of, sdhci_hlwd_of_match); 8438576af1SShawn Guo 8538576af1SShawn Guo static struct platform_driver sdhci_hlwd_driver = { 8638576af1SShawn Guo .driver = { 8738576af1SShawn Guo .name = "sdhci-hlwd", 8838576af1SShawn Guo .owner = THIS_MODULE, 8938576af1SShawn Guo .of_match_table = sdhci_hlwd_of_match, 9029495aa0SManuel Lauss .pm = SDHCI_PLTFM_PMOPS, 9138576af1SShawn Guo }, 9238576af1SShawn Guo .probe = sdhci_hlwd_probe, 930433c143SBill Pemberton .remove = sdhci_hlwd_remove, 9438576af1SShawn Guo }; 9538576af1SShawn Guo 96d1f81a64SAxel Lin module_platform_driver(sdhci_hlwd_driver); 9738576af1SShawn Guo 9838576af1SShawn Guo MODULE_DESCRIPTION("Nintendo Wii SDHCI OF driver"); 9938576af1SShawn Guo MODULE_AUTHOR("The GameCube Linux Team, Albert Herranz"); 10038576af1SShawn Guo MODULE_LICENSE("GPL v2"); 101