Skip to contentSkip to conversation

MTD: autcpu12-nvram: Fix compile breakage

PATCH RESEND Applied Alexander Shiyan 4 participants 7 messages Aug 15, 2012 – Aug 17, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 MTD: autcpu12-nvram: Fix compile breakage

Update driver autcpu12-nvram.c so it compiles. map_read32/map_write32 are no longer exist in the kernel so the driver is totally broken. Additionally, map_info name passed to simple_map_init is incorrect.

---
 drivers/mtd/maps/autcpu12-nvram.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
drivers/mtd/maps/autcpu12-nvram.c +11 -8
index e5bfd0e..0598d52 100644
@@ -43,7 +43,8 @@ struct map_info autcpu12_sram_map = {
 
 static int __init init_autcpu12_sram (void)
 {
-	int err, save0, save1;
+	map_word tmp, save0, save1;
+	int err;
 
 	autcpu12_sram_map.virt = ioremap(0x12000000, SZ_128K);
 	if (!autcpu12_sram_map.virt) {
@@ -51,7 +52,7 @@ static int __init init_autcpu12_sram (void)
 		err = -EIO;
 		goto out;
 	}
-	simple_map_init(&autcpu_sram_map);
+	simple_map_init(&autcpu12_sram_map);
 
 	/*
 	 * Check for 32K/128K
@@ -61,20 +62,22 @@ static int __init init_autcpu12_sram (void)
 	 * Read	and check result on ofs 0x0
 	 * Restore contents
 	 */
-	save0 = map_read32(&autcpu12_sram_map,0);
-	save1 = map_read32(&autcpu12_sram_map,0x10000);
-	map_write32(&autcpu12_sram_map,~save0,0x10000);
+	save0 = map_read(&autcpu12_sram_map, 0);
+	save1 = map_read(&autcpu12_sram_map, 0x10000);
+	tmp.x[0] = ~save0.x[0];
+	map_write(&autcpu12_sram_map, tmp, 0x10000);
 	/* if we find this pattern on 0x0, we have 32K size
 	 * restore contents and exit
 	 */
-	if ( map_read32(&autcpu12_sram_map,0) != save0) {
-		map_write32(&autcpu12_sram_map,save0,0x0);
+	tmp = map_read(&autcpu12_sram_map, 0);
+	if (!map_word_equal(&autcpu12_sram_map, tmp, save0)) {
+		map_write(&autcpu12_sram_map, save0, 0x0);
 		goto map;
 	}
 	/* We have a 128K found, restore 0x10000 and set size
 	 * to 128K
 	 */
-	map_write32(&autcpu12_sram_map,save1,0x10000);
+	map_write(&autcpu12_sram_map, save1, 0x10000);
 	autcpu12_sram_map.size = SZ_128K;
 
 map:
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH RESEND 2/2 MTD: autcpu12-nvram: Convert driver to platform_device

Because we can have a single kernel to support multiple machines, we need to make loading specific drivers for the target platform only. For this, driver is converted to the platform driver.

---
 arch/arm/mach-clps711x/autcpu12.c |   19 +++++
 drivers/mtd/maps/Kconfig          |    2 +-
 drivers/mtd/maps/autcpu12-nvram.c |  150 ++++++++++++++++++++-----------------
 3 files changed, 101 insertions(+), 70 deletions(-)
arch/arm/mach-clps711x/autcpu12.c +19 -0
index 3fb79a1..3287191 100644
@@ -23,6 +23,8 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <asm/sizes.h>
@@ -62,9 +64,26 @@ void __init autcpu12_map_io(void)
         iotable_init(autcpu12_io_desc, ARRAY_SIZE(autcpu12_io_desc));
 }
 
+static struct resource autcpu12_nvram_resource[] __initdata = {
+	DEFINE_RES_MEM_NAMED(AUTCPU12_PHYS_NVRAM, SZ_128K, "SRAM"),
+};
+
+static struct platform_device autcpu12_nvram_pdev __initdata = {
+	.name		= "autcpu12_nvram",
+	.id		= -1,
+	.resource	= autcpu12_nvram_resource,
+	.num_resources	= ARRAY_SIZE(autcpu12_nvram_resource),
+};
+
+static void __init autcpu12_init(void)
+{
+	platform_device_register(&autcpu12_nvram_pdev);
+}
+
 MACHINE_START(AUTCPU12, "autronix autcpu12")
 	/* Maintainer: Thomas Gleixner */
 	.atag_offset	= 0x20000,
+	.init_machine	= autcpu12_init,
 	.map_io		= autcpu12_map_io,
 	.init_irq	= clps711x_init_irq,
 	.timer		= &clps711x_timer,
drivers/mtd/maps/Kconfig +1 -1
index 5ba2458..283f922 100644
@@ -373,7 +373,7 @@ config MTD_FORTUNET
 	  have such a board, say 'Y'.
 
 config MTD_AUTCPU12
-	tristate "NV-RAM mapping AUTCPU12 board"
+	bool "NV-RAM mapping AUTCPU12 board"
 	depends on ARCH_AUTCPU12
 	help
 	  This enables access to the NV-RAM on autronix autcpu12 board.
drivers/mtd/maps/autcpu12-nvram.c +81 -69

192 lines not on this page · raw message

Signature · 1 line
1.7.8.6
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH RESEND 2/2] MTD: autcpu12-nvram: Convert driver to platform_device

Quoted 6 lines · Alexander Shiyan

Because we can have a single kernel to support multiple machines, we need to make loading specific drivers for the target platform only. For this, driver is converted to the platform driver.

Looks good. I can take both patches into arm-soc if necessary, otherwise I'm fine with them going through the mtd tree as well.

#3 lore raw
In reply to Alexander Shiyan
Quoted 5 lines · Alexander Shiyan

Update driver autcpu12-nvram.c so it compiles. map_read32/map_write32 are no longer exist in the kernel so the driver is totally broken. Additionally, map_info name passed to simple_map_init is incorrect.

Would you please send me a defconfig that I could use to compile-test this driver?

Also, does this need Cc: [email protected] ?

Thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#4 lore raw
Quoted 5 lines · On Fri, 17 Aug 2012 15:40:55 +0300 Artem Bityutskiy…
Quoted 3 lines

Update driver autcpu12-nvram.c so it compiles. map_read32/map_write32 are no longer exist in the kernel so the driver is totally broken. Additionally, map_info name passed to simple_map_init is incorrect.

Would you please send me a defconfig that I could use to compile-test this driver?

Have been sent.

Signature · 1 line
Alexander Shiyan <[email protected]>
#5 lore raw
In reply to Alexander Shiyan
Quoted 5 lines · Alexander Shiyan

Update driver autcpu12-nvram.c so it compiles. map_read32/map_write32 are no longer exist in the kernel so the driver is totally broken. Additionally, map_info name passed to simple_map_init is incorrect.

Pushed to l2-mtd.git, thanks!

I've also added "Cc: [email protected]", is this OK?

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#6 lore raw

Hello Artem.

Quoted 8 lines · On Fri, 17 Aug 2012 18:40:30 +0300 Artem Bityutskiy <[email protected]> wrote:
Quoted 4 lines

Update driver autcpu12-nvram.c so it compiles. map_read32/map_write32 are no longer exist in the kernel so the driver is totally broken. Additionally, map_info name passed to simple_map_init is incorrect.

Pushed to l2-mtd.git, thanks!

I've also added "Cc: [email protected]", is this OK?

If patch approved and goes to stable why not?
Thanks!

Signature · 1 line
Alexander Shiyan <[email protected]>