2019-05-27 09:55:01 +03:00
// SPDX-License-Identifier: GPL-2.0-or-later
2009-12-18 02:27:20 +03:00
/*
* drivers / mmc / host / sdhci - of - hlwd . c
*
* Nintendo Wii Secure Digital Host Controller Interface .
* Copyright ( C ) 2009 The GameCube Linux Team
* Copyright ( C ) 2009 Albert Herranz
*
* Based on sdhci - of - esdhc . c
*
* Copyright ( c ) 2007 Freescale Semiconductor , Inc .
* Copyright ( c ) 2009 MontaVista Software , Inc .
*
* Authors : Xiaobo Xie < X . Xie @ freescale . com >
* Anton Vorontsov < avorontsov @ ru . mvista . com >
*/
# include <linux/delay.h>
2011-07-03 23:15:51 +04:00
# include <linux/module.h>
2009-12-18 02:27:20 +03:00
# include <linux/mmc/host.h>
2011-05-27 19:48:14 +04:00
# include "sdhci-pltfm.h"
2009-12-18 02:27:20 +03:00
/*
* Ops and quirks for the Nintendo Wii SDHCI controllers .
*/
/*
* We need a small delay after each write , or things go horribly wrong .
*/
# define SDHCI_HLWD_WRITE_DELAY 5 /* usecs */
static void sdhci_hlwd_writel ( struct sdhci_host * host , u32 val , int reg )
{
sdhci_be32bs_writel ( host , val , reg ) ;
udelay ( SDHCI_HLWD_WRITE_DELAY ) ;
}
static void sdhci_hlwd_writew ( struct sdhci_host * host , u16 val , int reg )
{
sdhci_be32bs_writew ( host , val , reg ) ;
udelay ( SDHCI_HLWD_WRITE_DELAY ) ;
}
static void sdhci_hlwd_writeb ( struct sdhci_host * host , u8 val , int reg )
{
sdhci_be32bs_writeb ( host , val , reg ) ;
udelay ( SDHCI_HLWD_WRITE_DELAY ) ;
}
2013-03-13 22:26:05 +04:00
static const struct sdhci_ops sdhci_hlwd_ops = {
2011-07-21 01:13:36 +04:00
. read_l = sdhci_be32bs_readl ,
. read_w = sdhci_be32bs_readw ,
. read_b = sdhci_be32bs_readb ,
. write_l = sdhci_hlwd_writel ,
. write_w = sdhci_hlwd_writew ,
. write_b = sdhci_hlwd_writeb ,
2014-04-25 15:58:55 +04:00
. set_clock = sdhci_set_clock ,
2014-04-25 15:57:07 +04:00
. set_bus_width = sdhci_set_bus_width ,
2014-04-25 15:57:12 +04:00
. reset = sdhci_reset ,
2014-04-25 15:59:26 +04:00
. set_uhs_signaling = sdhci_set_uhs_signaling ,
2011-07-21 01:13:36 +04:00
} ;
2013-03-13 22:26:03 +04:00
static const struct sdhci_pltfm_data sdhci_hlwd_pdata = {
2009-12-18 02:27:20 +03:00
. quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
SDHCI_QUIRK_32BIT_DMA_SIZE ,
2011-07-21 01:13:36 +04:00
. ops = & sdhci_hlwd_ops ,
2009-12-18 02:27:20 +03:00
} ;
2011-05-27 19:48:14 +04:00
2012-11-19 22:23:06 +04:00
static int sdhci_hlwd_probe ( struct platform_device * pdev )
2011-05-27 19:48:14 +04:00
{
2013-05-30 00:50:05 +04:00
return sdhci_pltfm_register ( pdev , & sdhci_hlwd_pdata , 0 ) ;
2011-05-27 19:48:14 +04:00
}
static const struct of_device_id sdhci_hlwd_of_match [ ] = {
{ . compatible = " nintendo,hollywood-sdhci " } ,
{ }
} ;
MODULE_DEVICE_TABLE ( of , sdhci_hlwd_of_match ) ;
static struct platform_driver sdhci_hlwd_driver = {
. driver = {
. name = " sdhci-hlwd " ,
2020-09-04 02:24:36 +03:00
. probe_type = PROBE_PREFER_ASYNCHRONOUS ,
2011-05-27 19:48:14 +04:00
. of_match_table = sdhci_hlwd_of_match ,
2016-07-27 14:07:21 +03:00
. pm = & sdhci_pltfm_pmops ,
2011-05-27 19:48:14 +04:00
} ,
. probe = sdhci_hlwd_probe ,
2015-02-27 10:47:31 +03:00
. remove = sdhci_pltfm_unregister ,
2011-05-27 19:48:14 +04:00
} ;
2011-11-26 08:55:43 +04:00
module_platform_driver ( sdhci_hlwd_driver ) ;
2011-05-27 19:48:14 +04:00
MODULE_DESCRIPTION ( " Nintendo Wii SDHCI OF driver " ) ;
MODULE_AUTHOR ( " The GameCube Linux Team, Albert Herranz " ) ;
MODULE_LICENSE ( " GPL v2 " ) ;