From ad884c697e50f33652b5c0b2783d24f38f93399c Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Wed, 1 Aug 2012 09:23:56 +0200
Subject: fix bootup

---
 target/linux/config/Config.in.systems     |  4 ++++
 target/linux/patches/3.5/brcm.patch       |  5 +++--
 target/linux/patches/3.5/mtd-rootfs.patch | 26 ++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/patches/3.5/mtd-rootfs.patch

diff --git a/target/linux/config/Config.in.systems b/target/linux/config/Config.in.systems
index 248958bbd..2b5540011 100644
--- a/target/linux/config/Config.in.systems
+++ b/target/linux/config/Config.in.systems
@@ -19,6 +19,7 @@ config ADK_KERNEL_AR7
 	boolean
 
 config ADK_KERNEL_BCM47XX
+	select ADK_KERNEL_BCM47XX_SSB
 	boolean
 
 config ADK_KERNEL_ATHEROS_AR71XX
@@ -59,6 +60,9 @@ config ADK_KERNEL_ARCH_AT91SAM9G20
 config ADK_KERNEL_MACH_ACMENETUSFOXG20
 	boolean
 
+config ADK_KERNEL_BCM47XX_SSB
+	boolean
+
 # endianesss and ABI
 config ADK_KERNEL_AEABI
 	boolean
diff --git a/target/linux/patches/3.5/brcm.patch b/target/linux/patches/3.5/brcm.patch
index d66cd0506..a94b2302d 100644
--- a/target/linux/patches/3.5/brcm.patch
+++ b/target/linux/patches/3.5/brcm.patch
@@ -10,7 +10,7 @@ diff -Nur linux-3.5.orig//arch/mips/bcm47xx/Makefile linux-3.5/arch/mips/bcm47xx
 +obj-y 				+= gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o platform.o
 diff -Nur linux-3.5.orig//arch/mips/bcm47xx/platform.c linux-3.5/arch/mips/bcm47xx/platform.c
 --- linux-3.5.orig//arch/mips/bcm47xx/platform.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.5/arch/mips/bcm47xx/platform.c	2012-07-31 11:00:54.000000000 +0200
++++ linux-3.5/arch/mips/bcm47xx/platform.c	2012-07-31 23:56:35.000000000 +0200
 @@ -0,0 +1,146 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
@@ -105,7 +105,7 @@ diff -Nur linux-3.5.orig//arch/mips/bcm47xx/platform.c linux-3.5/arch/mips/bcm47
 +{
 +	u32 flash_size;
 +	size_t left, posn;
-+	struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
++	struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
 +	struct bcm47xx_trx_header *trx_hdr;
 +
 +	trx_hdr = (void *)KSEG1ADDR(mcore->flash_window + BCM47XX_OVERRIDE_CFESIZE);
@@ -158,6 +158,7 @@ diff -Nur linux-3.5.orig//arch/mips/bcm47xx/platform.c linux-3.5/arch/mips/bcm47
 +}
 +
 +device_initcall(bcm47xx_register_devices);
+Binary files linux-3.5.orig//arch/mips/bcm47xx/.wgt634u.c.swp and linux-3.5/arch/mips/bcm47xx/.wgt634u.c.swp differ
 diff -Nur linux-3.5.orig//arch/mips/boot/compressed/decompress.c linux-3.5/arch/mips/boot/compressed/decompress.c
 --- linux-3.5.orig//arch/mips/boot/compressed/decompress.c	2012-07-21 22:58:29.000000000 +0200
 +++ linux-3.5/arch/mips/boot/compressed/decompress.c	2012-07-31 11:00:54.000000000 +0200
diff --git a/target/linux/patches/3.5/mtd-rootfs.patch b/target/linux/patches/3.5/mtd-rootfs.patch
new file mode 100644
index 000000000..775d5fc80
--- /dev/null
+++ b/target/linux/patches/3.5/mtd-rootfs.patch
@@ -0,0 +1,26 @@
+diff -Nur linux-3.5.orig//drivers/mtd/mtdpart.c linux-3.5/drivers/mtd/mtdpart.c
+--- linux-3.5.orig//drivers/mtd/mtdpart.c	2012-07-21 22:58:29.000000000 +0200
++++ linux-3.5/drivers/mtd/mtdpart.c	2012-07-31 23:59:07.000000000 +0200
+@@ -30,6 +30,7 @@
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/err.h>
++#include <linux/root_dev.h>
+ 
+ #include "mtdcore.h"
+ 
+@@ -637,6 +638,14 @@
+ 		if (IS_ERR(slave))
+ 			return PTR_ERR(slave);
+ 
++		if (strcmp(parts[i].name, "rootfs") == 0) {
++			if (ROOT_DEV == 0) {
++				printk(KERN_NOTICE "mtd: partition \"rootfs\" "
++					"set to be root filesystem\n");
++					ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, i);
++			}
++		}
++
+ 		mutex_lock(&mtd_partitions_mutex);
+ 		list_add(&slave->list, &mtd_partitions);
+ 		mutex_unlock(&mtd_partitions_mutex);
-- 
cgit v1.2.3