Release 4.9 drivers/mmc/host/tmio_mmc.c
  
  
/*
 * linux/drivers/mmc/host/tmio_mmc.c
 *
 * Copyright (C) 2007 Ian Molton
 * Copyright (C) 2004 Ian Molton
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Driver for the MMC / SD / SDIO cell found in:
 *
 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
 */
#include <linux/device.h>
#include <linux/mfd/core.h>
#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/scatterlist.h>
#include "tmio_mmc.h"
#ifdef CONFIG_PM_SLEEP
static int tmio_mmc_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	const struct mfd_cell *cell = mfd_get_cell(pdev);
	int ret;
	ret = pm_runtime_force_suspend(dev);
	/* Tell MFD core it can disable us now.*/
	if (!ret && cell->disable)
		cell->disable(pdev);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ian molton | ian molton | 23 | 37.10% | 1 | 10.00% | 
| guennadi liakhovetski | guennadi liakhovetski | 17 | 27.42% | 3 | 30.00% | 
| ulf hansson | ulf hansson | 14 | 22.58% | 2 | 20.00% | 
| andres salomon | andres salomon | 6 | 9.68% | 3 | 30.00% | 
| philipp zabel | philipp zabel | 2 | 3.23% | 1 | 10.00% | 
 | Total | 62 | 100.00% | 10 | 100.00% | 
static int tmio_mmc_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	const struct mfd_cell *cell = mfd_get_cell(pdev);
	int ret = 0;
	/* Tell the MFD core we are ready to be enabled */
	if (cell->resume)
		ret = cell->resume(pdev);
	if (!ret)
		ret = pm_runtime_force_resume(dev);
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| guennadi liakhovetski | guennadi liakhovetski | 30 | 44.12% | 2 | 33.33% | 
| philipp zabel | philipp zabel | 17 | 25.00% | 1 | 16.67% | 
| ulf hansson | ulf hansson | 14 | 20.59% | 2 | 33.33% | 
| ian molton | ian molton | 7 | 10.29% | 1 | 16.67% | 
 | Total | 68 | 100.00% | 6 | 100.00% | 
#endif
static int tmio_mmc_probe(struct platform_device *pdev)
{
	const struct mfd_cell *cell = mfd_get_cell(pdev);
	struct tmio_mmc_data *pdata;
	struct tmio_mmc_host *host;
	struct resource *res;
	int ret = -EINVAL, irq;
	if (pdev->num_resources != 2)
		goto out;
	pdata = pdev->dev.platform_data;
	if (!pdata || !pdata->hclk)
		goto out;
	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		ret = irq;
		goto out;
	}
	/* Tell the MFD core we are ready to be enabled */
	if (cell->enable) {
		ret = cell->enable(pdev);
		if (ret)
			goto out;
	}
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		ret = -EINVAL;
		goto cell_disable;
	}
	pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
	host = tmio_mmc_host_alloc(pdev);
	if (!host)
		goto cell_disable;
	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
	host->bus_shift = resource_size(res) >> 10;
	ret = tmio_mmc_host_probe(host, pdata);
	if (ret)
		goto host_free;
	ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq,
				IRQF_TRIGGER_FALLING,
				dev_name(&pdev->dev), host);
	if (ret)
		goto host_remove;
	pr_info("%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc),
		(unsigned long)host->ctl, irq);
	return 0;
host_remove:
	tmio_mmc_host_remove(host);
host_free:
	tmio_mmc_host_free(host);
cell_disable:
	if (cell->disable)
		cell->disable(pdev);
out:
	return ret;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| guennadi liakhovetski | guennadi liakhovetski | 79 | 26.96% | 2 | 13.33% | 
| magnus damm | magnus damm | 73 | 24.91% | 3 | 20.00% | 
| ian molton | ian molton | 65 | 22.18% | 3 | 20.00% | 
| kuninori morimoto | kuninori morimoto | 64 | 21.84% | 4 | 26.67% | 
| arnd hannemann | arnd hannemann | 8 | 2.73% | 2 | 13.33% | 
| samuel ortiz | samuel ortiz | 4 | 1.37% | 1 | 6.67% | 
 | Total | 293 | 100.00% | 15 | 100.00% | 
static int tmio_mmc_remove(struct platform_device *pdev)
{
	const struct mfd_cell *cell = mfd_get_cell(pdev);
	struct mmc_host *mmc = platform_get_drvdata(pdev);
	if (mmc) {
		struct tmio_mmc_host *host = mmc_priv(mmc);
		tmio_mmc_host_remove(host);
		if (cell->disable)
			cell->disable(pdev);
	}
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ian molton | ian molton | 33 | 47.83% | 1 | 14.29% | 
| magnus damm | magnus damm | 27 | 39.13% | 3 | 42.86% | 
| guennadi liakhovetski | guennadi liakhovetski | 5 | 7.25% | 1 | 14.29% | 
| andres salomon | andres salomon | 4 | 5.80% | 2 | 28.57% | 
 | Total | 69 | 100.00% | 7 | 100.00% | 
/* ------------------- device registration ----------------------- */
static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
			tmio_mmc_host_runtime_resume,
			NULL)
};
static struct platform_driver tmio_mmc_driver = {
	.driver = {
		.name = "tmio-mmc",
		.pm = &tmio_mmc_dev_pm_ops,
        },
	.probe = tmio_mmc_probe,
	.remove = tmio_mmc_remove,
};
module_platform_driver(tmio_mmc_driver);
MODULE_DESCRIPTION("Toshiba TMIO SD/MMC driver");
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:tmio-mmc");
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ian molton | ian molton | 193 | 31.95% | 3 | 10.71% | 
| guennadi liakhovetski | guennadi liakhovetski | 146 | 24.17% | 4 | 14.29% | 
| magnus damm | magnus damm | 100 | 16.56% | 4 | 14.29% | 
| kuninori morimoto | kuninori morimoto | 64 | 10.60% | 4 | 14.29% | 
| ulf hansson | ulf hansson | 55 | 9.11% | 3 | 10.71% | 
| philipp zabel | philipp zabel | 19 | 3.15% | 2 | 7.14% | 
| andres salomon | andres salomon | 10 | 1.66% | 3 | 10.71% | 
| arnd hannemann | arnd hannemann | 10 | 1.66% | 2 | 7.14% | 
| samuel ortiz | samuel ortiz | 4 | 0.66% | 1 | 3.57% | 
| axel lin | axel lin | 2 | 0.33% | 1 | 3.57% | 
| rafael j. wysocki | rafael j. wysocki | 1 | 0.17% | 1 | 3.57% | 
 | Total | 604 | 100.00% | 28 | 100.00% |