From: Hirokazu Takata <takata@linux-m32r.org>

This patch is for updating m32r's MMU-less support.

	* arch/m32r/boot/compressed/Makefile: 
	Use m32r-elf-gcc for MMU-less targets; change ELF object format
	from elf32-m32r-linux to elf32-m32r for !CONFIG_MMU.

	* arch/m32r/boot/compressed/head.S: Set up cache for M32102 chip.
	* arch/m32r/boot/setup.S: ditto.

	* arch/m32r/kernel/module.c: Module support for !CONFIG_MMU.

Signed-off-by: Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/m32r/boot/compressed/Makefile |    5 +++++
 25-akpm/arch/m32r/boot/compressed/head.S   |    5 +++++
 25-akpm/arch/m32r/boot/setup.S             |    5 +++++
 25-akpm/arch/m32r/kernel/module.c          |    6 ++++++
 25-akpm/arch/m32r/mm/fault-nommu.c         |    1 +
 5 files changed, 22 insertions(+)

diff -puN arch/m32r/boot/compressed/head.S~m32r-update-mmu-less-support-3 arch/m32r/boot/compressed/head.S
--- 25/arch/m32r/boot/compressed/head.S~m32r-update-mmu-less-support-3	2005-03-23 18:33:51.000000000 -0800
+++ 25-akpm/arch/m32r/boot/compressed/head.S	2005-03-23 18:33:51.000000000 -0800
@@ -138,6 +138,11 @@ startup:
 	ldi	r0, -1
 	ldi	r1, 0xd0	; invalidate i-cache, copy back d-cache
 	stb	r1, @r0
+#elif defined(CONFIG_CHIP_M32102)
+	/* Cache flush */
+	ldi	r0, -2
+	ldi	r1, 0x0100	; invalidate
+	stb	r1, @r0
 #else
 #error "put your cache flush function, please"
 #endif
diff -puN arch/m32r/boot/compressed/Makefile~m32r-update-mmu-less-support-3 arch/m32r/boot/compressed/Makefile
--- 25/arch/m32r/boot/compressed/Makefile~m32r-update-mmu-less-support-3	2005-03-23 18:33:51.000000000 -0800
+++ 25-akpm/arch/m32r/boot/compressed/Makefile	2005-03-23 18:33:51.000000000 -0800
@@ -30,7 +30,12 @@ $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bi
 
 CFLAGS_misc.o += -fpic
 
+ifdef CONFIG_MMU
 LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r-linux -T
+else
+LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r -T
+endif
+
 OBJCOPYFLAGS += -R .empty_zero_page
 
 $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
diff -puN arch/m32r/boot/setup.S~m32r-update-mmu-less-support-3 arch/m32r/boot/setup.S
--- 25/arch/m32r/boot/setup.S~m32r-update-mmu-less-support-3	2005-03-23 18:33:51.000000000 -0800
+++ 25-akpm/arch/m32r/boot/setup.S	2005-03-23 18:33:51.000000000 -0800
@@ -75,6 +75,11 @@ ENTRY(boot)
 	ldi	r1, #0x73		; cache on (with invalidation)
 ;	ldi	r1, #0x00		; cache off
 	st	r1, @r0
+#elif defined(CONFIG_CHIP_M32102)
+	ldi	r0, #-4              ;LDIMM	(r0, M32R_MCCR)
+	ldi	r1, #0x101		; cache on (with invalidation)
+;	ldi	r1, #0x00		; cache off
+	st	r1, @r0
 #else
 #error unknown chip configuration
 #endif
diff -puN arch/m32r/kernel/module.c~m32r-update-mmu-less-support-3 arch/m32r/kernel/module.c
--- 25/arch/m32r/kernel/module.c~m32r-update-mmu-less-support-3	2005-03-23 18:33:51.000000000 -0800
+++ 25-akpm/arch/m32r/kernel/module.c	2005-03-23 18:33:51.000000000 -0800
@@ -14,6 +14,8 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
+
+#include <linux/config.h>
 #include <linux/moduleloader.h>
 #include <linux/elf.h>
 #include <linux/vmalloc.h>
@@ -31,7 +33,11 @@ void *module_alloc(unsigned long size)
 {
 	if (size == 0)
 		return NULL;
+#ifdef CONFIG_MMU
 	return vmalloc_exec(size);
+#else
+	return vmalloc(size);
+#endif
 }
 
 
diff -puN arch/m32r/mm/fault-nommu.c~m32r-update-mmu-less-support-3 arch/m32r/mm/fault-nommu.c
--- 25/arch/m32r/mm/fault-nommu.c~m32r-update-mmu-less-support-3	2005-03-23 18:33:51.000000000 -0800
+++ 25-akpm/arch/m32r/mm/fault-nommu.c	2005-03-23 18:33:51.000000000 -0800
@@ -23,6 +23,7 @@
 #include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/vt_kern.h>              /* For unblank_screen() */
 
 #include <asm/m32r.h>
 #include <asm/system.h>
_