* [PATCH 1/2] MN10300: Add platform MTD support for the ASB2303 board
@ 2007-11-16 13:41 David Howells
2007-11-16 13:41 ` [PATCH 2/2] MN10300: Fix MTD JEDEC probe so that the ASB2303 bootprom can be detected David Howells
0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2007-11-16 13:41 UTC (permalink / raw)
To: torvalds, akpm, dwmw2; +Cc: linux-kernel, linux-am33-list, dhowells
Add platform MTD support for the ASB2303 board.
Signed-off-by: David Howells <dhowells@redhat.com>
---
arch/mn10300/configs/asb2303_defconfig | 5 +-
arch/mn10300/unit-asb2303/Makefile | 2 -
arch/mn10300/unit-asb2303/flash.c | 100 ++++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+), 2 deletions(-)
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig
index 0189a05..ca9876a 100644
--- a/arch/mn10300/configs/asb2303_defconfig
+++ b/arch/mn10300/configs/asb2303_defconfig
@@ -282,7 +282,10 @@ CONFIG_MTD_CFI_UTIL=y
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x8000000
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
# CONFIG_MTD_PLATRAM is not set
#
diff --git a/arch/mn10300/unit-asb2303/Makefile b/arch/mn10300/unit-asb2303/Makefile
index 03e579f..38a5bb4 100644
--- a/arch/mn10300/unit-asb2303/Makefile
+++ b/arch/mn10300/unit-asb2303/Makefile
@@ -3,4 +3,4 @@
# Makefile for the ASB2303 board
#
###############################################################################
-obj-y := unit-init.o smc91111.o leds.o
+obj-y := unit-init.o smc91111.o flash.o leds.o
diff --git a/arch/mn10300/unit-asb2303/flash.c b/arch/mn10300/unit-asb2303/flash.c
new file mode 100644
index 0000000..17fe083
--- /dev/null
+++ b/arch/mn10300/unit-asb2303/flash.c
@@ -0,0 +1,100 @@
+/* Handle mapping of the flash on the ASB2303 board
+ *
+ * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#define ASB2303_PROM_ADDR 0xA0000000 /* Boot PROM */
+#define ASB2303_PROM_SIZE (2 * 1024 * 1024)
+#define ASB2303_FLASH_ADDR 0xA4000000 /* System Flash */
+#define ASB2303_FLASH_SIZE (32 * 1024 * 1024)
+#define ASB2303_CONFIG_ADDR 0xA6000000 /* System Config EEPROM */
+#define ASB2303_CONFIG_SIZE (8 * 1024)
+
+/*
+ * default MTD partition table for both main flash devices, expected to be
+ * overridden by RedBoot
+ */
+static struct mtd_partition asb2303_partitions[] = {
+ {
+ .name = "Bootloader",
+ .size = 0x00040000,
+ .offset = 0,
+ .mask_flags = MTD_CAP_ROM /* force read-only */
+ }, {
+ .name = "Kernel",
+ .size = 0x00400000,
+ .offset = 0x00040000,
+ }, {
+ .name = "Filesystem",
+ .size = MTDPART_SIZ_FULL,
+ .offset = 0x00440000
+ }
+};
+
+/*
+ * the ASB2303 Boot PROM definition
+ */
+static struct physmap_flash_data asb2303_bootprom_data = {
+ .width = 2,
+ .nr_parts = 1,
+ .parts = asb2303_partitions,
+};
+
+static struct resource asb2303_bootprom_resource = {
+ .start = ASB2303_PROM_ADDR,
+ .end = ASB2303_PROM_ADDR + ASB2303_PROM_SIZE,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device asb2303_bootprom = {
+ .name = "physmap-flash",
+ .id = 0,
+ .dev.platform_data = &asb2303_bootprom_data,
+ .num_resources = 1,
+ .resource = &asb2303_bootprom_resource,
+};
+
+/*
+ * the ASB2303 System Flash definition
+ */
+static struct physmap_flash_data asb2303_sysflash_data = {
+ .width = 4,
+ .nr_parts = 1,
+ .parts = asb2303_partitions,
+};
+
+static struct resource asb2303_sysflash_resource = {
+ .start = ASB2303_FLASH_ADDR,
+ .end = ASB2303_FLASH_ADDR + ASB2303_FLASH_SIZE,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device asb2303_sysflash = {
+ .name = "physmap-flash",
+ .id = 1,
+ .dev.platform_data = &asb2303_sysflash_data,
+ .num_resources = 1,
+ .resource = &asb2303_sysflash_resource,
+};
+
+/*
+ * register the ASB2303 flashes
+ */
+static int __init asb2303_mtd_init(void)
+{
+ platform_device_register(&asb2303_bootprom);
+ platform_device_register(&asb2303_sysflash);
+ return 0;
+}
+
+module_init(asb2303_mtd_init);
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] MN10300: Fix MTD JEDEC probe so that the ASB2303 bootprom can be detected
2007-11-16 13:41 [PATCH 1/2] MN10300: Add platform MTD support for the ASB2303 board David Howells
@ 2007-11-16 13:41 ` David Howells
2007-11-16 16:11 ` David Howells
0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2007-11-16 13:41 UTC (permalink / raw)
To: torvalds, akpm, dwmw2; +Cc: linux-kernel, linux-am33-list, dhowells
Fix MTD JEDEC probe so that the ASB2303 bootprom can be accessed. This is
presumably required because the bootprom is normally write-protected and so
the normal flash probes don't work as they require the ability to write to the
flash to send it commands.
In the condition of the excluded if-statement, uaddr is 1.
Signed-off-by: David Howells <dhowells@redhat.com>
---
drivers/mtd/chips/jedec_probe.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
index a67b23b..734674d 100644
--- a/drivers/mtd/chips/jedec_probe.c
+++ b/drivers/mtd/chips/jedec_probe.c
@@ -1868,11 +1868,18 @@ static inline __u8 finfo_uaddr(const struct amd_flash_info *finfo, int device_ty
uaddr = finfo->uaddr[uaddr_idx];
+ /* the MN10300 ASB2303 board doesn't detect its bootprom if this test
+ * is allowed to take place, presumably because the flash is
+ * write-protected and so cannot be commanded for the purposes of
+ * probing
+ */
+#ifndef CONFIG_MN10300_UNIT_ASB2303
if (uaddr != MTD_UADDR_NOT_SUPPORTED ) {
/* ASSERT("The unlock addresses for non-8-bit mode
are bollocks. We don't really need an array."); */
uaddr = finfo->uaddr[0];
}
+#endif
uaddr_done:
return uaddr;
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] MN10300: Fix MTD JEDEC probe so that the ASB2303 bootprom can be detected
2007-11-16 13:41 ` [PATCH 2/2] MN10300: Fix MTD JEDEC probe so that the ASB2303 bootprom can be detected David Howells
@ 2007-11-16 16:11 ` David Howells
[not found] ` <20071116163645.GA7855@fluff.org.uk>
0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2007-11-16 16:11 UTC (permalink / raw)
Cc: dhowells, torvalds, akpm, dwmw2, linux-kernel, linux-am33-list
David Howells <dhowells@redhat.com> wrote:
> Fix MTD JEDEC probe so that the ASB2303 bootprom can be accessed. This is
> presumably required because the bootprom is normally write-protected and so
> the normal flash probes don't work as they require the ability to write to the
> flash to send it commands.
Actually, on re-checking the documentation, this particular board doesn't
appear to have a write-enable for the flash, but rather an access-enable
(which is obviously installed). Furthermore, the probe does seem to manage to
work out that the chip is an MBM29LV800TA, so write is apparently possible.
So the problem appears to be something other than what I thought.
Without the patch, the kernel log shows:
| physmap platform flash device: 00200001 at a0000000
| physmap-flash physmap-flash.0: map_probe failed
| physmap platform flash device: 02000001 at a4000000
| physmap-flash.1: Found 4 x16 devices at 0x0 in 32-bit bank
| Amd/Fujitsu Extended Query Table at 0x0040
| physmap-flash.1: Swapping erase regions for broken CFI table.
| number of CFI chips: 1
| cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
| cmdlinepart partition parsing not available
| Searching for RedBoot partition table in physmap-flash.1 at offset 0xfc0000
| 4 RedBoot partitions found on MTD device physmap-flash.1
| Creating 4 MTD partitions on "physmap-flash.1":
| 0x00000000-0x00040000 : "RedBoot"
| mtd: Giving out device 0 to RedBoot
| 0x00040000-0x00fc0000 : "unallocated"
| mtd: Giving out device 1 to unallocated
| 0x00fc0000-0x00fff000 : "FIS directory"
| mtd: partition "FIS directory" doesn't end on an erase block -- force read-only
| mtd: Giving out device 2 to FIS directory
| 0x00fff000-0x01000000 : "RedBoot config"
| mtd: partition "RedBoot config" doesn't start on an erase block boundary -- force read-only
| mtd: Giving out device 3 to RedBoot config
|
With the patch, it shows:
| physmap platform flash device: 00200001 at a0000000
| CFI: Found no physmap-flash.0 device at location zero
| MTD: ASB2303: uaddr=1
(Note I added a printk to display uaddr if it reached this point.)
| Found: Fujitsu MBM29LV800TA
| MTD: ASB2303: uaddr=1
| physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
| physmap-flash.0: Found an alias at 0x100000 for the chip at 0x0
| number of JEDEC chips: 1
| cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
| cmdlinepart partition parsing not available
| Searching for RedBoot partition table in physmap-flash.0 at offset 0xf0000
| 4 RedBoot partitions found on MTD device physmap-flash.0
| Creating 4 MTD partitions on "physmap-flash.0":
| 0x00000000-0x00040000 : "RedBoot"
| mtd: Giving out device 0 to RedBoot
| 0x00040000-0x000f0000 : "unallocated"
| mtd: Giving out device 1 to unallocated
| 0x000f0000-0x000ff000 : "FIS directory"
| mtd: partition "FIS directory" doesn't end on an erase block -- force read-only
| mtd: Giving out device 2 to FIS directory
| 0x000ff000-0x00100000 : "RedBoot config"
| mtd: partition "RedBoot config" doesn't start on an erase block boundary -- force read-only
| mtd: Giving out device 3 to RedBoot config
| physmap platform flash device: 02000001 at a4000000
| physmap-flash.1: Found 4 x16 devices at 0x0 in 32-bit bank
| physmap-flash.1: Found an alias at 0x1000000 for the chip at 0x0
| Amd/Fujitsu Extended Query Table at 0x0040
| physmap-flash.1: Swapping erase regions for broken CFI table.
| number of CFI chips: 1
| cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
| cmdlinepart partition parsing not available
| Searching for RedBoot partition table in physmap-flash.1 at offset 0xfc0000
| 4 RedBoot partitions found on MTD device physmap-flash.1
| Creating 4 MTD partitions on "physmap-flash.1":
| 0x00000000-0x00040000 : "RedBoot"
| mtd: Giving out device 4 to RedBoot
| 0x00040000-0x00fc0000 : "unallocated"
| mtd: Giving out device 5 to unallocated
| 0x00fc0000-0x00fff000 : "FIS directory"
| mtd: partition "FIS directory" doesn't end on an erase block -- force read-only
| mtd: Giving out device 6 to FIS directory
| 0x00fff000-0x01000000 : "RedBoot config"
| mtd: partition "RedBoot config" doesn't start on an erase block boundary -- force read-only
| mtd: Giving out device 7 to RedBoot config
David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-16 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16 13:41 [PATCH 1/2] MN10300: Add platform MTD support for the ASB2303 board David Howells
2007-11-16 13:41 ` [PATCH 2/2] MN10300: Fix MTD JEDEC probe so that the ASB2303 bootprom can be detected David Howells
2007-11-16 16:11 ` David Howells
[not found] ` <20071116163645.GA7855@fluff.org.uk>
2007-11-16 17:15 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox