From: Albert H. <he...@us...> - 2009-10-25 18:50:42
|
Update of /cvsroot/gc-linux/linux/drivers/mmc/host In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31074/drivers/mmc/host Added Files: Kconfig Makefile sdhci-mipc.c Log Message: Merge gc-linux-v2.6.30. --- NEW FILE: sdhci-mipc.c --- /* * drivers/mmc/host/sdhci-mipc.c * * Nintendo Wii Secure Digital Host Controller Interface via 'mini' IPC (mipc). * Copyright (C) 2009 The GameCube Linux Team * Copyright (C) 2009 Albert Herranz * * Based on sdhci-of.c * * Copyright (c) 2007 Freescale Semiconductor, Inc. * Copyright (c) 2009 MontaVista Software, Inc. * * Authors: Xiaobo Xie <X....@fr...> * Anton Vorontsov <avo...@ru...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. */ #include <linux/module.h> #include <linux/init.h> #include <linux/io.h> #include <linux/interrupt.h> #include <linux/of.h> #include <linux/of_platform.h> #include <linux/mmc/host.h> #include <asm/starlet.h> #include <asm/starlet-mini.h> #include "sdhci.h" #define DRV_MODULE_NAME "sdhci-mipc" #define DRV_DESCRIPTION "Secure Digital Host Controller Interface via 'mini'" #define DRV_AUTHOR "Albert Herranz" static char sdhci_mipc_driver_version[] = "0.1i"; #define drv_printk(level, format, arg...) \ printk(level DRV_MODULE_NAME ": " format , ## arg) #define DBG(fmt, arg...) drv_printk(KERN_DEBUG, "%s: " fmt, \ __func__, ## arg) struct sdhci_mipc_data { unsigned int quirks; struct sdhci_ops ops; }; struct sdhci_mipc_host { u16 xfer_mode_shadow; }; static u32 sdhci_mipc_readl(struct sdhci_host *host, int reg) { return mipc_in_be32(host->ioaddr + reg); } static u16 sdhci_mipc_readw(struct sdhci_host *host, int reg) { return mipc_in_be16(host->ioaddr + (reg ^ 0x2)); } static u8 sdhci_mipc_readb(struct sdhci_host *host, int reg) { return mipc_in_8(host->ioaddr + (reg ^ 0x3)); } static void sdhci_mipc_writel(struct sdhci_host *host, u32 val, int reg) { mipc_out_be32(host->ioaddr + reg, val); udelay(5); } static void sdhci_mipc_writew(struct sdhci_host *host, u16 val, int reg) { struct sdhci_mipc_host *mipc_host = sdhci_priv(host); int base = reg & ~0x3; int shift = (reg & 0x2) * 8; switch (reg) { case SDHCI_TRANSFER_MODE: /* * Postpone this write, we must do it together with a * command write that is down below. */ mipc_host->xfer_mode_shadow = val; return; case SDHCI_COMMAND: sdhci_mipc_writel(host, val << 16 | mipc_host->xfer_mode_shadow, SDHCI_TRANSFER_MODE); return; } mipc_clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift); udelay(5); } static void sdhci_mipc_writeb(struct sdhci_host *host, u8 val, int reg) { int base = reg & ~0x3; int shift = (reg & 0x3) * 8; mipc_clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift); udelay(5); } static struct sdhci_mipc_data sdhci_mipc = { .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE, .ops = { .readl = sdhci_mipc_readl, .readw = sdhci_mipc_readw, .readb = sdhci_mipc_readb, .writel = sdhci_mipc_writel, .writew = sdhci_mipc_writew, .writeb = sdhci_mipc_writeb, }, }; #ifdef CONFIG_PM static int sdhci_mipc_suspend(struct of_device *ofdev, pm_message_t state) { struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); return mmc_suspend_host(host->mmc, state); } static int sdhci_mipc_resume(struct of_device *ofdev) { struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); return mmc_resume_host(host->mmc); } #else #define sdhci_mipc_suspend NULL #define sdhci_mipc_resume NULL #endif static int __devinit sdhci_mipc_probe(struct of_device *ofdev, const struct of_device_id *match) { struct device_node *np = ofdev->node; struct sdhci_mipc_data *sdhci_mipc_data = match->data; struct sdhci_host *host; struct sdhci_mipc_host *mipc_host; struct resource res; int error; if (starlet_get_ipc_flavour() != STARLET_IPC_MINI) { error = -ENODEV; goto out; } if (!of_device_is_available(np)) { error = -ENODEV; goto out; } host = sdhci_alloc_host(&ofdev->dev, sizeof(*mipc_host)); if (!host) { DBG("unable to allocate sdhci_host\n"); error = -ENODEV; goto out; } dev_set_drvdata(&ofdev->dev, host); error = of_address_to_resource(np, 0, &res); if (error) { DBG("of_address_to_resource failed (%d)\n", error); goto err_no_address; } host->ioaddr = mipc_ioremap(res.start, resource_size(&res)); if (!host->ioaddr) { DBG("ioremap failed\n"); error = -EINVAL; goto err_ioremap; } host->irq = irq_of_parse_and_map(np, 0); if (!host->irq) { DBG("irq_of_parse_and_map failed\n"); error = -EINVAL; goto err_no_irq; } host->hw_name = dev_name(&ofdev->dev); if (sdhci_mipc_data) { host->quirks = sdhci_mipc_data->quirks; host->ops = &sdhci_mipc_data->ops; } error = sdhci_add_host(host); if (error) { DBG("sdhci_add_host failed\n"); goto err_add_host; } return 0; err_add_host: irq_dispose_mapping(host->irq); err_no_irq: mipc_iounmap(host->ioaddr); err_ioremap: err_no_address: sdhci_free_host(host); out: return error; } static int __devexit sdhci_mipc_remove(struct of_device *ofdev) { struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); sdhci_remove_host(host, 0); irq_dispose_mapping(host->irq); mipc_iounmap(host->ioaddr); sdhci_free_host(host); return 0; } static const struct of_device_id sdhci_mipc_match[] = { { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_mipc, }, {}, }; MODULE_DEVICE_TABLE(of, sdhci_mipc_match); static struct of_platform_driver sdhci_mipc_driver = { .driver.name = DRV_MODULE_NAME, .match_table = sdhci_mipc_match, .probe = sdhci_mipc_probe, .remove = __devexit_p(sdhci_mipc_remove), .suspend = sdhci_mipc_suspend, .resume = sdhci_mipc_resume, }; static int __init sdhci_mipc_init(void) { drv_printk(KERN_INFO, "%s - version %s\n", DRV_DESCRIPTION, sdhci_mipc_driver_version); return of_register_platform_driver(&sdhci_mipc_driver); } module_init(sdhci_mipc_init); static void __exit sdhci_mipc_exit(void) { of_unregister_platform_driver(&sdhci_mipc_driver); } module_exit(sdhci_mipc_exit); MODULE_AUTHOR(DRV_AUTHOR); MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_LICENSE("GPL"); --- NEW FILE: Makefile --- # # Makefile for MMC/SD host controller drivers # ifeq ($(CONFIG_MMC_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif obj-$(CONFIG_MMC_ARMMMCI) += mmci.o obj-$(CONFIG_MMC_PXA) += pxamci.o obj-$(CONFIG_MMC_IMX) += imxmmc.o obj-$(CONFIG_MMC_MXC) += mxcmmc.o obj-$(CONFIG_MMC_SDHCI) += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o obj-$(CONFIG_MMC_RICOH_MMC) += ricoh_mmc.o obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o obj-$(CONFIG_MMC_SDHCI_MIPC) += sdhci-mipc.o obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o obj-$(CONFIG_MMC_OMAP) += omap.o obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o obj-$(CONFIG_MMC_AT91) += at91_mci.o obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o obj-$(CONFIG_MMC_SPI) += mmc_spi.o ifeq ($(CONFIG_OF),y) obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o endif obj-$(CONFIG_MMC_S3C) += s3cmci.o obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o --- NEW FILE: Kconfig --- # # MMC/SD host controller drivers # comment "MMC/SD/SDIO Host Controller Drivers" config MMC_ARMMMCI tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA help This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card Interface (PL180 and PL181) support. If you have an ARM(R) platform with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_PXA tristate "Intel PXA25x/26x/27x Multimedia Card Interface support" depends on ARCH_PXA help This selects the Intel(R) PXA(R) Multimedia card Interface. If you have a PXA(R) platform with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_SDHCI tristate "Secure Digital Host Controller Interface support" depends on HAS_DMA help This selects the generic Secure Digital Host Controller Interface. It is used by manufacturers such as Texas Instruments(R), Ricoh(R) and Toshiba(R). Most controllers found in laptops are of this type. If you have a controller with this interface, say Y or M here. You also need to enable an appropriate bus interface. If unsure, say N. config MMC_SDHCI_IO_ACCESSORS bool depends on MMC_SDHCI help This is silent Kconfig symbol that is selected by the drivers that need to overwrite SDHCI IO memory accessors. config MMC_SDHCI_PCI tristate "SDHCI support on PCI bus" depends on MMC_SDHCI && PCI help This selects the PCI Secure Digital Host Controller Interface. Most controllers found today are PCI devices. If you have a controller with this interface, say Y or M here. If unsure, say N. config MMC_RICOH_MMC tristate "Ricoh MMC Controller Disabler (EXPERIMENTAL)" depends on MMC_SDHCI_PCI help This selects the disabler for the Ricoh MMC Controller. This proprietary controller is unnecessary because the SDHCI driver supports MMC cards on the SD controller, but if it is not disabled, it will steal the MMC cards away - rendering them useless. It is safe to select this driver even if you don't have a Ricoh based card reader. To compile this driver as a module, choose M here: the module will be called ricoh_mmc. If unsure, say Y. config MMC_SDHCI_OF tristate "SDHCI support on OpenFirmware platforms" depends on MMC_SDHCI && PPC_OF select MMC_SDHCI_IO_ACCESSORS help This selects the OF support for Secure Digital Host Controller Interfaces. So far, only the Freescale eSDHC controller is known to exist on OF platforms. If unsure, say N. config MMC_SDHCI_MIPC tristate "Nintendo Wii SDHCI support via 'mini'" depends on MMC_SDHCI && STARLET_MINI select MMC_SDHCI_IO_ACCESSORS help This selects the Nintendo Wii Secure Digital Host Controller Interface. The SDHC hardware is accessed via the 'mini' firmware replacement for Starlet. If unsure, say N. config MMC_OMAP tristate "TI OMAP Multimedia Card Interface support" depends on ARCH_OMAP select TPS65010 if MACH_OMAP_H2 help This selects the TI OMAP Multimedia card Interface. If you have an OMAP board with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_OMAP_HS tristate "TI OMAP High Speed Multimedia Card Interface support" depends on ARCH_OMAP2430 || ARCH_OMAP3 help This selects the TI OMAP High Speed Multimedia card Interface. If you have an OMAP2430 or OMAP3 board with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_WBSD tristate "Winbond W83L51xD SD/MMC Card Interface support" depends on ISA_DMA_API help This selects the Winbond(R) W83L51xD Secure digital and Multimedia card Interface. If you have a machine with a integrated W83L518D or W83L519D SD/MMC card reader, say Y or M here. If unsure, say N. config MMC_AU1X tristate "Alchemy AU1XX0 MMC Card Interface support" depends on SOC_AU1200 help This selects the AMD Alchemy(R) Multimedia card interface. If you have a Alchemy platform with a MMC slot, say Y or M here. If unsure, say N. config MMC_AT91 tristate "AT91 SD/MMC Card Interface support" depends on ARCH_AT91 help This selects the AT91 MCI controller. If unsure, say N. config MMC_ATMELMCI tristate "Atmel Multimedia Card Interface support" depends on AVR32 help This selects the Atmel Multimedia Card Interface driver. If you have an AT32 (AVR32) platform with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_ATMELMCI_DMA bool "Atmel MCI DMA support (EXPERIMENTAL)" depends on MMC_ATMELMCI && DMA_ENGINE && EXPERIMENTAL help Say Y here to have the Atmel MCI driver use a DMA engine to do data transfers and thus increase the throughput and reduce the CPU utilization. Note that this is highly experimental and may cause the driver to lock up. If unsure, say N. config MMC_IMX tristate "Motorola i.MX Multimedia Card Interface support" depends on ARCH_IMX help This selects the Motorola i.MX Multimedia card Interface. If you have a i.MX platform with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_MXC tristate "Freescale i.MX2/3 Multimedia Card Interface support" depends on ARCH_MXC help This selects the Freescale i.MX2/3 Multimedia card Interface. If you have a i.MX platform with a Multimedia Card slot, say Y or M here. If unsure, say N. config MMC_TIFM_SD tristate "TI Flash Media MMC/SD Interface support (EXPERIMENTAL)" depends on EXPERIMENTAL && PCI select TIFM_CORE help Say Y here if you want to be able to access MMC/SD cards with the Texas Instruments(R) Flash Media card reader, found in many laptops. This option 'selects' (turns on, enables) 'TIFM_CORE', but you probably also need appropriate card reader host adapter, such as 'Misc devices: TI Flash Media PCI74xx/PCI76xx host adapter support (TIFM_7XX1)'. To compile this driver as a module, choose M here: the module will be called tifm_sd. config MMC_MVSDIO tristate "Marvell MMC/SD/SDIO host driver" depends on PLAT_ORION ---help--- This selects the Marvell SDIO host driver. SDIO may currently be found on the Kirkwood 88F6281 and 88F6192 SoC controllers. To compile this driver as a module, choose M here: the module will be called mvsdio. config MMC_SPI tristate "MMC/SD/SDIO over SPI" depends on SPI_MASTER && !HIGHMEM && HAS_DMA select CRC7 select CRC_ITU_T help Some systems access MMC/SD/SDIO cards using a SPI controller instead of using a "native" MMC/SD/SDIO controller. This has a disadvantage of being relatively high overhead, but a compensating advantage of working on many systems without dedicated MMC/SD/SDIO controllers. If unsure, or if your system has no SPI master driver, say N. config MMC_S3C tristate "Samsung S3C SD/MMC Card Interface support" depends on ARCH_S3C2410 help This selects a driver for the MCI interface found in Samsung's S3C2410, S3C2412, S3C2440, S3C2442 CPUs. If you have a board based on one of those and a MMC/SD slot, say Y or M here. If unsure, say N. config MMC_SDRICOH_CS tristate "MMC/SD driver for Ricoh Bay1Controllers (EXPERIMENTAL)" depends on EXPERIMENTAL && PCI && PCMCIA help Say Y here if your Notebook reports a Ricoh Bay1Controller PCMCIA card whenever you insert a MMC or SD card into the card slot. To compile this driver as a module, choose M here: the module will be called sdricoh_cs. config MMC_TMIO tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support" depends on MFD_TMIO help This provides support for the SD/MMC cell found in TC6393XB, T7L66XB and also ipaq ASIC3 |