ARM: 6904/1: MTD: Add integrator-flash feature to physmap
authorMarc Zyngier <Marc.Zyngier@arm.com>
Wed, 18 May 2011 09:51:48 +0000 (10:51 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 20 May 2011 21:26:53 +0000 (22:26 +0100)
In the process of moving platforms away from integrator-flash
(aka armflash), add to physmap the few features that make
armflash unique:

- optionnal probing for the AFS partition type
- init() and exit() methods, used by Integrator to control
  write access to the various onboard programmable components

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/mtd/maps/physmap.c
include/linux/mtd/physmap.h

index 7522df4f71f1d67c302a290de2dc77ac1b98d63c..49676b7a53a4e9e5fbfe08aa9c33c4ecda1466a0 100644 (file)
@@ -67,6 +67,10 @@ static int physmap_flash_remove(struct platform_device *dev)
                if (info->mtd[i] != NULL)
                        map_destroy(info->mtd[i]);
        }
+
+       if (physmap_data->exit)
+               physmap_data->exit(dev);
+
        return 0;
 }
 
@@ -77,7 +81,11 @@ static const char *rom_probe_types[] = {
                                        "map_rom",
                                        NULL };
 #ifdef CONFIG_MTD_PARTITIONS
-static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot",
+#ifdef CONFIG_MTD_AFS_PARTS
+                                         "afs",
+#endif
+                                         NULL };
 #endif
 
 static int physmap_flash_probe(struct platform_device *dev)
@@ -100,6 +108,12 @@ static int physmap_flash_probe(struct platform_device *dev)
                goto err_out;
        }
 
+       if (physmap_data->init) {
+               err = physmap_data->init(dev);
+               if (err)
+                       goto err_out;
+       }
+
        platform_set_drvdata(dev, info);
 
        for (i = 0; i < dev->num_resources; i++) {
index bcfd9f777454247d95dc077c510b6d8c87e863a9..d37cca05e62c8e90d7a42b424855639d994c4ac1 100644 (file)
@@ -22,6 +22,8 @@ struct map_info;
 
 struct physmap_flash_data {
        unsigned int            width;
+       int                     (*init)(struct platform_device *);
+       void                    (*exit)(struct platform_device *);
        void                    (*set_vpp)(struct map_info *, int);
        unsigned int            nr_parts;
        unsigned int            pfow_base;