Release 4.11 drivers/mtd/maps/rbtx4939-flash.c
/*
* rbtx4939-flash (based on physmap.c)
*
* This is a simplified physmap driver with map_init callback function.
*
* 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.
*
* Copyright (C) 2009 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <asm/txx9/rbtx4939.h>
struct rbtx4939_flash_info {
struct mtd_info *mtd;
struct map_info map;
};
static int rbtx4939_flash_remove(struct platform_device *dev)
{
struct rbtx4939_flash_info *info;
info = platform_get_drvdata(dev);
if (!info)
return 0;
if (info->mtd) {
mtd_device_unregister(info->mtd);
map_destroy(info->mtd);
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Atsushi Nemoto | 55 | 98.21% | 1 | 50.00% |
Jamie Iles | 1 | 1.79% | 1 | 50.00% |
Total | 56 | 100.00% | 2 | 100.00% |
static const char * const rom_probe_types[] = {
"cfi_probe", "jedec_probe", NULL };
static int rbtx4939_flash_probe(struct platform_device *dev)
{
struct rbtx4939_flash_data *pdata;
struct rbtx4939_flash_info *info;
struct resource *res;
const char * const *probe_type;
int err = 0;
unsigned long size;
pdata = dev_get_platdata(&dev->dev);
if (!pdata)
return -ENODEV;
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
platform_set_drvdata(dev, info);
size = resource_size(res);
pr_notice("rbtx4939 platform flash device: %pR\n", res);
if (!devm_request_mem_region(&dev->dev, res->start, size,
dev_name(&dev->dev)))
return -EBUSY;
info->map.name = dev_name(&dev->dev);
info->map.phys = res->start;
info->map.size = size;
info->map.bankwidth = pdata->width;
info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size);
if (!info->map.virt)
return -EBUSY;
if (pdata->map_init)
(*pdata->map_init)(&info->map);
else
simple_map_init(&info->map);
probe_type = rom_probe_types;
for (; !info->mtd && *probe_type; probe_type++)
info->mtd = do_map_probe(*probe_type, &info->map);
if (!info->mtd) {
dev_err(&dev->dev, "map_probe failed\n");
err = -ENXIO;
goto err_out;
}
info->mtd->dev.parent = &dev->dev;
err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts,
pdata->nr_parts);
if (err)
goto err_out;
return 0;
err_out:
rbtx4939_flash_remove(dev);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Atsushi Nemoto | 354 | 93.90% | 1 | 12.50% |
Dmitry Baryshkov | 9 | 2.39% | 2 | 25.00% |
Frans Klaver | 7 | 1.86% | 1 | 12.50% |
Jingoo Han | 4 | 1.06% | 1 | 12.50% |
Artem B. Bityutskiy | 2 | 0.53% | 2 | 25.00% |
Brian Norris | 1 | 0.27% | 1 | 12.50% |
Total | 377 | 100.00% | 8 | 100.00% |
#ifdef CONFIG_PM
static void rbtx4939_flash_shutdown(struct platform_device *dev)
{
struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
if (mtd_suspend(info->mtd) == 0)
mtd_resume(info->mtd);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Atsushi Nemoto | 37 | 94.87% | 1 | 33.33% |
Artem B. Bityutskiy | 2 | 5.13% | 2 | 66.67% |
Total | 39 | 100.00% | 3 | 100.00% |
#else
#define rbtx4939_flash_shutdown NULL
#endif
static struct platform_driver rbtx4939_flash_driver = {
.probe = rbtx4939_flash_probe,
.remove = rbtx4939_flash_remove,
.shutdown = rbtx4939_flash_shutdown,
.driver = {
.name = "rbtx4939-flash",
},
};
module_platform_driver(rbtx4939_flash_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RBTX4939 MTD map driver");
MODULE_ALIAS("platform:rbtx4939-flash");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Atsushi Nemoto | 567 | 95.13% | 1 | 8.33% |
Dmitry Baryshkov | 9 | 1.51% | 2 | 16.67% |
Frans Klaver | 7 | 1.17% | 1 | 8.33% |
Artem B. Bityutskiy | 5 | 0.84% | 4 | 33.33% |
Jingoo Han | 4 | 0.67% | 1 | 8.33% |
Axel Lin | 2 | 0.34% | 1 | 8.33% |
Brian Norris | 1 | 0.17% | 1 | 8.33% |
Jamie Iles | 1 | 0.17% | 1 | 8.33% |
Total | 596 | 100.00% | 12 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.