Release 4.16 drivers/mmc/host/tmio_mmc.c
/*
* Driver for the MMC / SD / SDIO cell found in:
*
* TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
*
* Copyright (C) 2017 Renesas Electronics Corporation
* Copyright (C) 2017 Horms Solutions, Simon Horman
* 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.
*/
#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 |
Guennadi Liakhovetski | 48 | 77.42% | 2 | 50.00% |
Ulf Hansson | 14 | 22.58% | 2 | 50.00% |
Total | 62 | 100.00% | 4 | 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 |
Philipp Zabel | 18 | 26.47% | 2 | 22.22% |
Ian Molton | 18 | 26.47% | 1 | 11.11% |
Ulf Hansson | 14 | 20.59% | 2 | 22.22% |
Guennadi Liakhovetski | 14 | 20.59% | 2 | 22.22% |
Andres Salomon | 4 | 5.88% | 2 | 22.22% |
Total | 68 | 100.00% | 9 | 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, pdata);
if (IS_ERR(host)) {
ret = PTR_ERR(host);
goto cell_disable;
}
/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
host->bus_shift = resource_size(res) >> 10;
host->mmc->f_max = pdata->hclk;
host->mmc->f_min = pdata->hclk / 512;
ret = tmio_mmc_host_probe(host);
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 | 78 | 23.93% | 2 | 11.76% |
Magnus Damm | 73 | 22.39% | 3 | 17.65% |
Ian Molton | 65 | 19.94% | 3 | 17.65% |
Kuninori Morimoto | 63 | 19.33% | 4 | 23.53% |
Masahiro Yamada | 36 | 11.04% | 2 | 11.76% |
Arnd Hannemann | 7 | 2.15% | 2 | 11.76% |
Samuel Ortiz | 4 | 1.23% | 1 | 5.88% |
Total | 326 | 100.00% | 17 | 100.00% |
static int tmio_mmc_remove(struct platform_device *pdev)
{
const struct mfd_cell *cell = mfd_get_cell(pdev);
struct tmio_mmc_host *host = platform_get_drvdata(pdev);
tmio_mmc_host_remove(host);
if (cell->disable)
cell->disable(pdev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Magnus Damm | 26 | 49.06% | 3 | 37.50% |
Ian Molton | 18 | 33.96% | 1 | 12.50% |
Andres Salomon | 4 | 7.55% | 2 | 25.00% |
Guennadi Liakhovetski | 3 | 5.66% | 1 | 12.50% |
Masahiro Yamada | 2 | 3.77% | 1 | 12.50% |
Total | 53 | 100.00% | 8 | 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 | 164 | 26.41% | 3 | 9.68% |
Guennadi Liakhovetski | 159 | 25.60% | 4 | 12.90% |
Magnus Damm | 99 | 15.94% | 4 | 12.90% |
Kuninori Morimoto | 63 | 10.14% | 4 | 12.90% |
Ulf Hansson | 55 | 8.86% | 3 | 9.68% |
Masahiro Yamada | 38 | 6.12% | 3 | 9.68% |
Philipp Zabel | 18 | 2.90% | 2 | 6.45% |
Arnd Hannemann | 9 | 1.45% | 2 | 6.45% |
Andres Salomon | 8 | 1.29% | 2 | 6.45% |
Samuel Ortiz | 4 | 0.64% | 1 | 3.23% |
Axel Lin | 2 | 0.32% | 1 | 3.23% |
Simon Horman | 1 | 0.16% | 1 | 3.23% |
Rafael J. Wysocki | 1 | 0.16% | 1 | 3.23% |
Total | 621 | 100.00% | 31 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.