@@ -188,8 +188,11 @@ static int armflash_probe(struct platform_device *dev)
subdev->plat = plat;
err = armflash_subdev_probe(subdev, res);
- if (err)
+ if (err) {
+ kfree(subdev->name);
+ subdev->name = NULL;
break;
+ }
}
info->nr_subdev = i;
> In fact, do we still need a separate platform device and driver for ARM
> systems? What does it provide that the physmap driver does (and can)
> not?
(I cc'ed Russell as well since he wrote the integrator-flash driver and
may have comments)
I gave physmap a quick try on RealView boards and it seems to work fine
with the patch below. The only difference is the AFS partition parsing
probes string, though this is no longer used on ARM Ltd platforms (some
old ones still use it).
I'll test it a bit more and, if there are no other comments, I'll push a
patch to convert the ARM Ltd platforms to physmap (but that's for the
next merging window as I don't think I have time to test it well enough
now).
RealView: Convert the platform code to use the physmap flash driver
From: Catalin Marinas <catalin.marinas@arm.com>
This platform was still using the integrator-flash driver but this
pretty much duplicates the physmap one.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm/mach-realview/core.c | 31 ++++---------------------------
1 files changed, 4 insertions(+), 27 deletions(-)
@@ -30,6 +30,7 @@
#include <linux/io.h>
#include <linux/smsc911x.h>
#include <linux/ata_platform.h>
+#include <linux/mtd/physmap.h>
#include <asm/clkdev.h>
#include <asm/system.h>
@@ -41,7 +42,6 @@
#include <asm/hardware/icst307.h>
#include <asm/mach/arch.h>
-#include <asm/mach/flash.h>
#include <asm/mach/irq.h>
#include <asm/mach/map.h>
#include <asm/mach/mmc.h>
@@ -76,27 +76,7 @@ unsigned long long sched_clock(void)
#define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
-static int realview_flash_init(void)
-{
- u32 val;
-
- val = __raw_readl(REALVIEW_FLASHCTRL);
- val &= ~REALVIEW_FLASHPROG_FLVPPEN;
- __raw_writel(val, REALVIEW_FLASHCTRL);
-
- return 0;
-}
-
-static void realview_flash_exit(void)
-{
- u32 val;
-
- val = __raw_readl(REALVIEW_FLASHCTRL);
- val &= ~REALVIEW_FLASHPROG_FLVPPEN;
- __raw_writel(val, REALVIEW_FLASHCTRL);
-}
-
-static void realview_flash_set_vpp(int on)
+static void realview_flash_set_vpp(struct map_info *map, int on)
{
u32 val;
@@ -108,16 +88,13 @@ static void realview_flash_set_vpp(int on)
__raw_writel(val, REALVIEW_FLASHCTRL);
}
-static struct flash_platform_data realview_flash_data = {
- .map_name = "cfi_probe",
+static struct physmap_flash_data realview_flash_data = {
.width = 4,
- .init = realview_flash_init,
- .exit = realview_flash_exit,
.set_vpp = realview_flash_set_vpp,
};
struct platform_device realview_flash_device = {
- .name = "armflash",
+ .name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &realview_flash_data,