linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: expose PB1176 ROM in debugfs
@ 2010-07-07 12:05 Linus Walleij
  2010-07-18 19:47 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2010-07-07 12:05 UTC (permalink / raw)
  To: linux-arm-kernel

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so
that it can be copied out and disassembled with some
objcopy+objdump massage for example. I used this to find out how
the ROM handled the CharLCD.

Signed-off-by: Linus Walleij <triad@df.lth.se>
---
 arch/arm/mach-realview/include/mach/board-pb1176.h |    1 +
 arch/arm/mach-realview/realview_pb1176.c           |   31 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 2f5ccb2..9f627d4 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -69,6 +69,7 @@
 
 #define REALVIEW_DC1176_GIC_CPU_BASE		0x10120000 /* GIC CPU interface, on devchip */
 #define REALVIEW_DC1176_GIC_DIST_BASE		0x10121000 /* GIC distributor, on devchip */
+#define REALVIEW_DC1176_ROM_BASE		0x10200000 /* 16KiB NRAM preudo-ROM, on devchip */
 #define REALVIEW_PB1176_GIC_CPU_BASE		0x10040000 /* GIC CPU interface, on FPGA */
 #define REALVIEW_PB1176_GIC_DIST_BASE		0x10041000 /* GIC distributor, on FPGA */
 #define REALVIEW_PB1176_L220_BASE		0x10110000 /* L220 registers */
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 099a1f1..cfdfd75 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -26,6 +26,7 @@
 #include <linux/amba/pl061.h>
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
+#include <linux/debugfs.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -323,6 +324,36 @@ static void realview_pb1176_fixup(struct machine_desc *mdesc,
 	meminfo->nr_banks = 1;
 }
 
+#ifdef CONFIG_DEBUG_FS
+/*
+ * This exposes the PB1176 DevChip ROM as a simple file in debugfs
+ * The reference manual states that this is actually a pseudo-ROM
+ * programmed in NVRAM.
+ */
+static struct debugfs_blob_wrapper devchip_rom_blob;
+
+static int __init pb1176_export_rom(void)
+{
+	void __iomem *virtbase;
+	struct dentry *d;
+
+	virtbase = ioremap(REALVIEW_DC1176_ROM_BASE, SZ_16K);
+	if (!virtbase)
+		return -EIO;
+	devchip_rom_blob.data = virtbase;
+	devchip_rom_blob.size = SZ_16K;
+	d = debugfs_create_blob("pb1176-DevChip-ROM",
+				S_IFREG | S_IRUSR,
+				NULL, &devchip_rom_blob);
+	if (!d)
+		return -EIO;
+
+	return 0;
+}
+
+device_initcall(pb1176_export_rom);
+#endif
+
 static void __init realview_pb1176_init(void)
 {
 	int i;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ARM: expose PB1176 ROM in debugfs
  2010-07-07 12:05 [PATCH] ARM: expose PB1176 ROM in debugfs Linus Walleij
@ 2010-07-18 19:47 ` Russell King - ARM Linux
  2010-07-18 20:39   ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2010-07-18 19:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 07, 2010 at 02:05:39PM +0200, Linus Walleij wrote:
> This exposes the PB1176 ROM as a simple 16KiB file in debugfs so
> that it can be copied out and disassembled with some
> objcopy+objdump massage for example. I used this to find out how
> the ROM handled the CharLCD.

Would it be better to expose this through a mtd ROM mapping (map_rom) ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: expose PB1176 ROM in debugfs
  2010-07-18 19:47 ` Russell King - ARM Linux
@ 2010-07-18 20:39   ` Linus Walleij
  2010-09-03 21:38     ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2010-07-18 20:39 UTC (permalink / raw)
  To: linux-arm-kernel

2010/7/18 Russell King - ARM Linux <linux@arm.linux.org.uk>:

> On Wed, Jul 07, 2010 at 02:05:39PM +0200, Linus Walleij wrote:
>> This exposes the PB1176 ROM as a simple 16KiB file in debugfs so
>> that it can be copied out and disassembled with some
>> objcopy+objdump massage for example. I used this to find out how
>> the ROM handled the CharLCD.
>
> Would it be better to expose this through a mtd ROM mapping (map_rom) ?

This is more convenient I think.

I don't know the actual purpose of MTD ROM mappings, so
paging David on this.

It has the small upside of only getting compiled in if you select
CONFIG_DEBUG_FS, and getting a distinct name in debugfs
rather than /dev/mtdN.

Also I can now cp /debugfs/pb1176-ROM foo.bin
Is this possible with mtdblocks or do you have to dd if=... ?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: expose PB1176 ROM in debugfs
  2010-07-18 20:39   ` Linus Walleij
@ 2010-09-03 21:38     ` Linus Walleij
  2010-09-04  2:13       ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2010-09-03 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

Ping on this David, you have an opinion? debugfs ROM or
MTD ROM mapping?

Yours,
Linus Walleij

2010/7/18 Linus Walleij <linus.ml.walleij@gmail.com>:
> 2010/7/18 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>
>> On Wed, Jul 07, 2010 at 02:05:39PM +0200, Linus Walleij wrote:
>>> This exposes the PB1176 ROM as a simple 16KiB file in debugfs so
>>> that it can be copied out and disassembled with some
>>> objcopy+objdump massage for example. I used this to find out how
>>> the ROM handled the CharLCD.
>>
>> Would it be better to expose this through a mtd ROM mapping (map_rom) ?
>
> This is more convenient I think.
>
> I don't know the actual purpose of MTD ROM mappings, so
> paging David on this.
>
> It has the small upside of only getting compiled in if you select
> CONFIG_DEBUG_FS, and getting a distinct name in debugfs
> rather than /dev/mtdN.
>
> Also I can now cp /debugfs/pb1176-ROM foo.bin
> Is this possible with mtdblocks or do you have to dd if=... ?
>
> Yours,
> Linus Walleij
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ARM: expose PB1176 ROM in debugfs
  2010-09-03 21:38     ` Linus Walleij
@ 2010-09-04  2:13       ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2010-09-04  2:13 UTC (permalink / raw)
  To: linux-arm-kernel

Dne P? 3. z??? 2010 23:38:54 Linus Walleij napsal(a):
> Ping on this David, you have an opinion? debugfs ROM or
> MTD ROM mapping?

Hey, I'd be for having this exposed through mtd_rom too. Cheers
> 
> Yours,
> Linus Walleij
> 
> 2010/7/18 Linus Walleij <linus.ml.walleij@gmail.com>:
> > 2010/7/18 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >> On Wed, Jul 07, 2010 at 02:05:39PM +0200, Linus Walleij wrote:
> >>> This exposes the PB1176 ROM as a simple 16KiB file in debugfs so
> >>> that it can be copied out and disassembled with some
> >>> objcopy+objdump massage for example. I used this to find out how
> >>> the ROM handled the CharLCD.
> >> 
> >> Would it be better to expose this through a mtd ROM mapping (map_rom) ?
> > 
> > This is more convenient I think.
> > 
> > I don't know the actual purpose of MTD ROM mappings, so
> > paging David on this.
> > 
> > It has the small upside of only getting compiled in if you select
> > CONFIG_DEBUG_FS, and getting a distinct name in debugfs
> > rather than /dev/mtdN.
> > 
> > Also I can now cp /debugfs/pb1176-ROM foo.bin
> > Is this possible with mtdblocks or do you have to dd if=... ?
> > 
> > Yours,
> > Linus Walleij
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-04  2:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-07 12:05 [PATCH] ARM: expose PB1176 ROM in debugfs Linus Walleij
2010-07-18 19:47 ` Russell King - ARM Linux
2010-07-18 20:39   ` Linus Walleij
2010-09-03 21:38     ` Linus Walleij
2010-09-04  2:13       ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).