summaryrefslogtreecommitdiffstats
path: root/target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2007-05-26 15:36:22 +0000
committerImre Kaloz <kaloz@openwrt.org>2007-05-26 15:36:22 +0000
commit8f83153369a227fe0531a8cbcdb53d76fba45756 (patch)
tree62e5584d5283eaaf46223779364e352ef34330c9 /target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c
parentb62d62a3c401de0140f029918730d8bf40cf395f (diff)
downloadmaster-31e0f0ae-8f83153369a227fe0531a8cbcdb53d76fba45756.tar.gz
master-31e0f0ae-8f83153369a227fe0531a8cbcdb53d76fba45756.tar.bz2
master-31e0f0ae-8f83153369a227fe0531a8cbcdb53d76fba45756.zip
fix magicbox, convert mtd mapping to platform_device, add support for combined flash layout
SVN-Revision: 7336
Diffstat (limited to 'target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c')
-rw-r--r--target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c b/target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c
index 470fbc4e08..e65319bc61 100644
--- a/target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c
+++ b/target/linux/magicbox-2.6/files/arch/ppc/platforms/4xx/magicbox.c
@@ -24,6 +24,9 @@
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
#include <asm/system.h>
#include <asm/pci-bridge.h>
@@ -214,6 +217,50 @@ bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
#endif /* DEBUG */
}
+static struct resource magicbox_flash_resource = {
+ .start = 0xffc00000,
+ .end = 0xffffffffULL,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct mtd_partition magicbox_flash_parts[] = {
+ {
+ .name = "linux",
+ .offset = 0x0,
+ .size = 0x3c0000,
+ },
+ {
+ .name = "rootfs",
+ .offset = 0x100000,
+ .size = 0x2c0000,
+ }
+};
+
+static struct physmap_flash_data magicbox_flash_data = {
+ .width = 2,
+ .parts = magicbox_flash_parts,
+ .nr_parts = ARRAY_SIZE(magicbox_flash_parts),
+};
+
+static struct platform_device magicbox_flash_device = {
+ .name = "physmap-flash",
+ .id = 0,
+ .dev = {
+ .platform_data = &magicbox_flash_data,
+ },
+ .num_resources = 1,
+ .resource = &magicbox_flash_resource,
+};
+
+static int magicbox_setup_flash(void)
+{
+ platform_device_register(&magicbox_flash_device);
+
+ return 0;
+};
+
+arch_initcall (magicbox_setup_flash);
+
void __init
magicbox_setup_arch(void)
{