mtd/drivers/mtd/maps pxa2xx-flash.c, NONE, 1.1 Kconfig, 1.61, 1.62 Makefile.common, 1.34, 1.35 lubbock-flash.c, 1.21, NONE mainstone-flash.c, 1.4, NONE

tpoynor at infradead.org tpoynor at infradead.org
Mon Nov 7 16:47:51 EST 2005


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv1850/drivers/mtd/maps

Modified Files:
	Kconfig Makefile.common 
Added Files:
	pxa2xx-flash.c 
Removed Files:
	lubbock-flash.c mainstone-flash.c 
Log Message:
[MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver

Replace Lubbock and Mainstone board drivers with common PXA2xx driver,
convert to platform driver (corresponding platform device changes merged
to kernel.org for 2.6.15), add power management callbacks.

Signed-off-by: Todd Poynor <tpoynor at mvista.com>


--- NEW FILE pxa2xx-flash.c ---
/*
 * $Id:  $
 *
 * Map driver for the Intel XScale PXA2xx developer platforms.
 *
 * Author:	Nicolas Pitre
 * Copyright:	(C) 2001 MontaVista Software Inc.
 *
 * 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/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>

#include <asm/io.h>
#include <asm/hardware.h>

#include <asm/mach/flash.h>

static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from,
				      ssize_t len)
{
	consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
}

struct pxa2xx_flash_info {
	struct mtd_partition	*parts;
	int			nr_parts;
	struct mtd_info		*mtd;
	struct map_info		map;
};


static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };


static int __init pxa2xx_flash_probe(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct flash_platform_data *flash = pdev->dev.platform_data;
	struct pxa2xx_flash_info *info;
	struct mtd_partition *parts;
	struct resource *res;
	int ret = 0;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res)
		return -ENODEV;

	info = kmalloc(sizeof(struct pxa2xx_flash_info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	memset(info, 0, sizeof(struct pxa2xx_flash_info));
	info->map.name = (char *) flash->name;
	info->map.bankwidth = flash->width;
	info->map.phys = res->start;
	info->map.size = res->end - res->start + 1;
	info->parts = flash->parts;
	info->nr_parts = flash->nr_parts;

	info->map.virt = ioremap(info->map.phys, info->map.size);
	if (!info->map.virt) {
		printk(KERN_WARNING "Failed to ioremap %s\n",
		       info->map.name);
		return -ENOMEM;
	}
	info->map.cached =
		ioremap_cached(info->map.phys, info->map.size);
	if (!info->map.cached)
		printk(KERN_WARNING "Failed to ioremap cached %s\n",
		       info->map.name);
	info->map.inval_cache = pxa2xx_map_inval_cache;
	simple_map_init(&info->map);

	printk(KERN_NOTICE
	       "Probing %s at physical address 0x%08lx"
	       " (%d-bit bankwidth)\n",
	       info->map.name, info->map.phys, info->map.bankwidth * 8);

	info->mtd = do_map_probe(flash->map_name, &info->map);

	if (!info->mtd) {
		iounmap((void *)info->map.virt);
		if (info->map.cached)
			iounmap(info->map.cached);
		return -EIO;
	}
	info->mtd->owner = THIS_MODULE;

#ifdef CONFIG_MTD_PARTITIONS
	ret = parse_mtd_partitions(info->mtd, probes, &parts, 0);

	if (ret > 0) {
		info->nr_parts = ret;
		info->parts = parts;
	}
#endif

	if (info->nr_parts) {
		add_mtd_partitions(info->mtd, info->parts,
				   info->nr_parts);
	} else {
		printk("Registering %s as whole device\n",
		       info->map.name);
		add_mtd_device(info->mtd);
	}

	dev_set_drvdata(dev, info);
	return 0;
}

static int __exit pxa2xx_flash_remove(struct device *dev)
{
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);

	dev_set_drvdata(dev, NULL);

#ifdef CONFIG_MTD_PARTITIONS
	if (info->nr_parts)
		del_mtd_partitions(info->mtd);
	else
#endif
		del_mtd_device(info->mtd);

	map_destroy(info->mtd);
	iounmap(info->map.virt);
	if (info->map.cached)
		iounmap(info->map.cached);
	kfree(info->parts);
	kfree(info);
	return 0;
}

#ifdef CONFIG_PM
static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state)
{
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);
	int ret = 0;

	if (info->mtd && info->mtd->suspend)
		ret = info->mtd->suspend(info->mtd);
	return ret;
}

static int pxa2xx_flash_resume(struct device *dev)
{
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);

	if (info->mtd && info->mtd->resume)
		info->mtd->resume(info->mtd);
	return 0;
}
static void pxa2xx_flash_shutdown(struct device *dev)
{
	struct pxa2xx_flash_info *info = dev_get_drvdata(dev);

	if (info && info->mtd->suspend(info->mtd) == 0)
		info->mtd->resume(info->mtd);
}
#else
#define pxa2xx_flash_suspend NULL
#define pxa2xx_flash_resume NULL
#define pxa2xx_flash_shutdown NULL
#endif

static struct device_driver pxa2xx_flash_driver = {
	.name		= "pxa2xx-flash",
	.bus		= &platform_bus_type,
	.probe		= pxa2xx_flash_probe,
	.remove		= __exit_p(pxa2xx_flash_remove),
	.suspend	= pxa2xx_flash_suspend,
	.resume		= pxa2xx_flash_resume,
	.shutdown	= pxa2xx_flash_shutdown,
};

static int __init init_pxa2xx_flash(void)
{
	return driver_register(&pxa2xx_flash_driver);
}

static void __exit cleanup_pxa2xx_flash(void)
{
	driver_unregister(&pxa2xx_flash_driver);
}

module_init(init_pxa2xx_flash);
module_exit(cleanup_pxa2xx_flash);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nicolas Pitre <nico at cam.org>");
MODULE_DESCRIPTION("MTD map driver for Intel XScale PXA2xx");

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- Kconfig	7 Nov 2005 11:14:26 -0000	1.61
+++ Kconfig	7 Nov 2005 21:47:48 -0000	1.62
@@ -208,20 +208,13 @@
 	  More info at
 	  <http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>.
 
-config MTD_LUBBOCK
-	tristate "CFI Flash device mapped on Intel Lubbock XScale eval board"
-	depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS
-	help
-	  This provides a driver for the on-board flash of the Intel
-	  'Lubbock' XScale evaluation board.
-
-config MTD_MAINSTONE
-	tristate "CFI Flash device mapped on Intel Mainstone XScale eval board"
-	depends on MACH_MAINSTONE && MTD_CFI_INTELEXT
+config MTD_PXA2XX
+	tristate "CFI Flash device mapped on Intel XScale PXA2xx eval board"
+	depends on (ARCH_LUBBOCK || MACH_MAINSTONE) && MTD_CFI_INTELEXT
 	select MTD_PARTITIONS
 	help
 	  This provides a driver for the on-board flash of the Intel
-	  'Mainstone PXA27x evaluation board.
+	  'Lubbock' and 'Mainstone' XScale PXA2xx evaluation boards.
 
 config MTD_OCTAGON
 	tristate "JEDEC Flash device mapped on Octagon 5066 SBC"

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile.common,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- Makefile.common	7 Nov 2005 11:14:26 -0000	1.34
+++ Makefile.common	7 Nov 2005 21:47:48 -0000	1.35
@@ -21,8 +21,7 @@
 obj-$(CONFIG_MTD_AMD76XROM)	+= amd76xrom.o
 obj-$(CONFIG_MTD_ICHXROM)	+= ichxrom.o
 obj-$(CONFIG_MTD_TSUNAMI)	+= tsunami_flash.o
-obj-$(CONFIG_MTD_LUBBOCK)	+= lubbock-flash.o
-obj-$(CONFIG_MTD_MAINSTONE)	+= mainstone-flash.o
+obj-$(CONFIG_MTD_PXA2XX)	+= pxa2xx-flash.o
 obj-$(CONFIG_MTD_MBX860)	+= mbx860.o
 obj-$(CONFIG_MTD_CEIVA)		+= ceiva.o
 obj-$(CONFIG_MTD_OCTAGON)	+= octagon-5066.o

--- lubbock-flash.c DELETED ---

--- mainstone-flash.c DELETED ---





More information about the linux-mtd-cvs mailing list