summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2007-05-20 21:33:57 +0000
committerImre Kaloz <kaloz@openwrt.org>2007-05-20 21:33:57 +0000
commit2bc1a04f6777dc0a0d36a462d8d62426fb0f34fa (patch)
tree653b184866cfa00750ac10f2f0073a5e55652f23
parent52766d28516d73862c3430b5fb7ec8a44ea0e090 (diff)
downloadmtk-20170518-2bc1a04f6777dc0a0d36a462d8d62426fb0f34fa.zip
mtk-20170518-2bc1a04f6777dc0a0d36a462d8d62426fb0f34fa.tar.gz
mtk-20170518-2bc1a04f6777dc0a0d36a462d8d62426fb0f34fa.tar.bz2
commandline mtd partition parsing is ugly, convert aruba to platform_device
SVN-Revision: 7294
-rw-r--r--target/linux/aruba-2.6/config/default4
-rw-r--r--target/linux/aruba-2.6/files/arch/mips/aruba/prom.c4
-rw-r--r--target/linux/aruba-2.6/files/arch/mips/aruba/setup.c53
3 files changed, 56 insertions, 5 deletions
diff --git a/target/linux/aruba-2.6/config/default b/target/linux/aruba-2.6/config/default
index 6ff30a9..a15c734 100644
--- a/target/linux/aruba-2.6/config/default
+++ b/target/linux/aruba-2.6/config/default
@@ -118,7 +118,7 @@ CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_CHAR=y
-CONFIG_MTD_CMDLINE_PARTS=y
+# CONFIG_MTD_CMDLINE_PARTS is not set
CONFIG_MTD_COMPLEX_MAPPINGS=y
# CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_DEBUG is not set
@@ -143,7 +143,7 @@ CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_PHRAM is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_BANKWIDTH=1
-CONFIG_MTD_PHYSMAP_LEN=0x400000
+CONFIG_MTD_PHYSMAP_LEN=0
CONFIG_MTD_PHYSMAP_START=0x1fc00000
# CONFIG_MTD_PLATRAM is not set
# CONFIG_MTD_PMC551 is not set
diff --git a/target/linux/aruba-2.6/files/arch/mips/aruba/prom.c b/target/linux/aruba-2.6/files/arch/mips/aruba/prom.c
index b70a0e7..5cd4ca0 100644
--- a/target/linux/aruba-2.6/files/arch/mips/aruba/prom.c
+++ b/target/linux/aruba-2.6/files/arch/mips/aruba/prom.c
@@ -57,9 +57,7 @@ unsigned int arch_has_pci=0;
/* Kernel Boot parameters */
static unsigned char bootparm[] =
- "init=/etc/preinit noinitrd "
- "mtdparts=physmap-flash.0:3520k@0x080000(kernel),2752k@0x140000(rootfs),8k@0x3f8000(NVRAM) "
- "console=ttyS0,9600 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 ";
+ "root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,9600 init=/etc/preinit";
extern unsigned long mips_machgroup;
extern unsigned long mips_machtype;
diff --git a/target/linux/aruba-2.6/files/arch/mips/aruba/setup.c b/target/linux/aruba-2.6/files/arch/mips/aruba/setup.c
index 7e8413f..4d438ad 100644
--- a/target/linux/aruba-2.6/files/arch/mips/aruba/setup.c
+++ b/target/linux/aruba-2.6/files/arch/mips/aruba/setup.c
@@ -50,6 +50,9 @@
#include <asm/addrspace.h> /* for KSEG1ADDR() */
#include <asm/idt-boards/rc32434/rc32434.h>
#include <linux/pm.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
extern char *__init prom_getcmdline(void);
@@ -84,8 +87,58 @@ static void aruba_machine_halt(void)
}
extern char * getenv(char *e);
+
extern void unlock_ap60_70_flash(void);
+static struct resource aruba_flash_resource = {
+ .start = 0x1fc00000,
+ .end = 0x1fffffffULL,
+ .flags = IORESOURCE_MEM,
+};
+
+static struct mtd_partition aruba_flash_parts[] = {
+ {
+ .name = "kernel",
+ .offset = 0x80000,
+ .size = 0x370000,
+ },
+ {
+ .name = "rootfs",
+ .offset = 0x140000,
+ .size = 0x2B0000,
+ },
+ {
+ .name = "NVRAM",
+ .offset = 0x3f8000,
+ .size = 0x2000,
+ }
+};
+
+static struct physmap_flash_data aruba_flash_data = {
+ .width = 1,
+ .parts = aruba_flash_parts,
+ .nr_parts = ARRAY_SIZE(aruba_flash_parts),
+};
+
+static struct platform_device aruba_flash_device = {
+ .name = "physmap-flash",
+ .id = 0,
+ .dev = {
+ .platform_data = &aruba_flash_data,
+ },
+ .num_resources = 1,
+ .resource = &aruba_flash_resource,
+};
+
+static int aruba_setup_flash(void)
+{
+ platform_device_register(&aruba_flash_device);
+
+ return 0;
+};
+
+arch_initcall (aruba_setup_flash);
+
void __init plat_mem_setup(void)
{
board_time_init = aruba_time_init;