1 From 13fc0abf4b5da6f18dea15fd31697655615a79fc Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Wed, 12 Mar 2008 15:39:03 -0600
4 Subject: [PATCH] Move kernel to physical sdram base address.
6 Work based on the patches from Systec GMBH. Also DMA support,
7 uBoot integration, FEC fixes, and assorted cleanups.
9 Uber patch needs to be split up.
11 LTIBName: mcfv4e-kern-to-phys
12 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
14 arch/m68k/coldfire/config.c | 102 ++-----
15 arch/m68k/coldfire/dma.c | 7 +-
16 arch/m68k/coldfire/entry.S | 10 +
17 arch/m68k/coldfire/head.S | 53 +++-
18 arch/m68k/coldfire/mcf5445x-devices.c | 2 +
19 arch/m68k/coldfire/mcf5445x-pci.c | 3 +
20 arch/m68k/coldfire/signal.c | 3 +
21 arch/m68k/configs/m5485evb_defconfig | 79 +++++-
22 arch/m68k/mm/cache.c | 4 +-
23 arch/m68k/mm/cf-mmu.c | 28 ++-
24 arch/m68k/mm/memory.c | 8 +-
25 drivers/net/fec/fec.c | 20 +-
26 include/asm-m68k/bootinfo.h | 59 +++-
27 include/asm-m68k/cf_cacheflush.h | 547 +++++++++++----------------------
28 include/asm-m68k/cf_pgalloc.h | 5 +-
29 include/asm-m68k/cf_pgtable.h | 2 +-
30 include/asm-m68k/cfcache.h | 6 +
31 include/asm-m68k/page.h | 8 +
32 include/asm-m68k/page_offset.h | 25 +-
33 19 files changed, 446 insertions(+), 525 deletions(-)
35 --- a/arch/m68k/coldfire/config.c
36 +++ b/arch/m68k/coldfire/config.c
38 #include <asm/coldfire.h>
39 #include <asm/cfcache.h>
40 #include <asm/cacheflush.h>
41 -#include <asm/bootinfo.h>
43 #include <asm/cfmmu.h>
44 #include <asm/setup.h>
47 #include <asm/mcfsim.h>
50 +#if defined(CONFIG_M54455)
51 +#define UBOOT_EXTRA_CLOCKS
52 +#elif defined(CONFIG_M547X_8X)
55 +#include <asm/bootinfo.h>
58 #include <asm/mcf5445x_intc.h>
59 #include <asm/mcf5445x_sdramc.h>
60 #include <asm/mcf5445x_fbcs.h>
62 #include <asm/mcf5445x_xbs.h>
66 -#include <linux/pfn.h>
69 extern int get_irq_list(struct seq_file *p, void *v);
70 extern char _text, _end;
71 extern char _etext, _edata, __init_begin, __init_end;
72 @@ -58,6 +60,10 @@ extern unsigned long availmem;
73 static int irq_enable[NR_IRQS];
74 unsigned long num_pages;
76 +/* ethernet mac addresses from uboot */
77 +unsigned char uboot_enet0[6];
78 +unsigned char uboot_enet1[6];
80 void coldfire_sort_memrec(void)
83 @@ -87,6 +93,9 @@ void coldfire_sort_memrec(void)
90 int __init uboot_commandline(char *bootargs)
92 int len = 0, cmd_line_len;
93 @@ -101,12 +110,17 @@ int __init uboot_commandline(char *boota
96 /* Add offset to get post-remapped kernel memory location */
97 - uboot_info.bd_info = (*(u32 *)(uboot_info_stk)) + offset;
98 + uboot_info.bdi = (struct bd_info *)((*(u32 *)(uboot_info_stk)) + offset);
99 uboot_info.initrd_start = (*(u32 *)(uboot_info_stk+4)) + offset;
100 uboot_info.initrd_end = (*(u32 *)(uboot_info_stk+8)) + offset;
101 uboot_info.cmd_line_start = (*(u32 *)(uboot_info_stk+12)) + offset;
102 uboot_info.cmd_line_stop = (*(u32 *)(uboot_info_stk+16)) + offset;
104 + /* copy over mac addresses */
105 + memcpy(uboot_enet0, uboot_info.bdi->bi_enet0addr, 6);
106 + memcpy(uboot_enet1, uboot_info.bdi->bi_enet1addr, 6);
108 + /* copy command line */
109 cmd_line_len = uboot_info.cmd_line_stop - uboot_info.cmd_line_start;
110 if ((cmd_line_len > 0) && (cmd_line_len < CL_SIZE-1))
111 len = (int)strncpy(bootargs, (char *)uboot_info.cmd_line_start,\
112 @@ -121,7 +135,7 @@ int __init uboot_commandline(char *boota
113 #if defined(CONFIG_M54455)
114 #define DEFAULT_COMMAND_LINE "root=/dev/mtdblock1 rw rootfstype=jffs2 ip=none mtdparts=physmap-flash.0:5M(kernel)ro,-(jffs2)"
115 #elif defined(CONFIG_M547X_8X)
116 -#define DEFAULT_COMMAND_LINE "debug root=/dev/nfs nfsroot=172.27.155.1:/tftpboot/rigo/rootfs/ ip=172.27.155.85:172.27.155.1"
117 +#define DEFAULT_COMMAND_LINE "debug root=/dev/nfs rw nfsroot=172.27.155.1:/tftpboot/rigo/rootfs/ ip=172.27.155.85:172.27.155.1"
119 asmlinkage void __init cf_early_init(void)
121 @@ -142,7 +156,6 @@ asmlinkage void __init cf_early_init(voi
122 MCF_INTC1_IMRL = 0xFFFFFFFF;
123 MCF_INTC1_IMRH = 0xFFFFFFFF;
124 #elif defined(CONFIG_M547X_8X)
126 MCF_IMRL = 0xFFFFFFFF;
127 MCF_IMRH = 0xFFFFFFFF;
129 @@ -170,7 +183,6 @@ asmlinkage void __init cf_early_init(voi
130 MCF_XBS_PRS_M6(MCF_XBS_PRI_1) |
131 MCF_XBS_PRS_M7(MCF_XBS_PRI_7));
135 m68k_machtype = MACH_CFMMU;
136 m68k_fputype = FPU_CFV4E;
137 @@ -181,7 +193,6 @@ asmlinkage void __init cf_early_init(voi
138 m68k_memory[m68k_num_memory].addr = CONFIG_SDRAM_BASE;
139 m68k_memory[m68k_num_memory++].size = CONFIG_SDRAM_SIZE;
141 -#if defined(CONFIG_M54455)
142 if (!uboot_commandline(m68k_command_line)) {
143 #if defined(CONFIG_BOOTPARAM)
144 strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE-1);
145 @@ -189,11 +200,6 @@ asmlinkage void __init cf_early_init(voi
146 strcpy(m68k_command_line, DEFAULT_COMMAND_LINE);
150 -/* JKM -- hack until mappings get resolved */
151 - strcpy(m68k_command_line, DEFAULT_COMMAND_LINE);
155 #if defined(CONFIG_BLK_DEV_INITRD)
156 /* add initrd image */
157 @@ -372,75 +378,11 @@ void coldfire_reboot(void)
161 -/* int coldfire_hwclk(int i, struct rtc_time *t)
163 - printk ("Real time clock needs porting.\n");
167 static void coldfire_get_model(char *model)
169 sprintf(model, "Version 4 ColdFire");
172 -/* JKM -- Why do we need these? */
173 -void coldfire_enable_irq(unsigned int vec)
175 - unsigned long flags;
179 - if (((int)vec < 0) || (vec > 63)) {
180 - printk(KERN_WARNING "enable_irq %d failed\n", vec);
184 - local_irq_save(flags);
186 -#if defined(CONFIG_M54455)
188 - MCF_INTC0_IMRL &= ~(1 << vec);
190 - MCF_INTC0_IMRH &= ~(1 << (vec - 32));
191 -#elif defined(CONFIG_M547X_8X)
193 - MCF_IMRL &= ~(1 << vec);
195 - MCF_IMRH &= ~(1 << (vec - 32));
197 - local_irq_restore(flags);
200 -/* JKM -- Why do we need these? */
201 -void coldfire_disable_irq(unsigned int vec)
203 - unsigned long flags;
207 - if (((int)vec < 0) || (vec > 63)) {
208 - printk(KERN_WARNING "disable_irq %d failed\n", vec);
212 - local_irq_save(flags);
213 - if (--irq_enable[vec] == 0) {
214 -#if defined(CONFIG_M54455)
216 - MCF_INTC0_IMRL |= (1 << vec);
218 - MCF_INTC0_IMRH |= (1 << (vec - 32));
219 -#elif defined(CONFIG_M547X_8X)
221 - MCF_IMRL |= (1 << vec);
223 - MCF_IMRH |= (1 << (vec - 32));
227 - local_irq_restore(flags);
231 coldfire_bootmem_alloc(unsigned long memory_start, unsigned long memory_end)
233 --- a/arch/m68k/coldfire/dma.c
234 +++ b/arch/m68k/coldfire/dma.c
235 @@ -516,13 +516,8 @@ dma_init()
236 MCF_DMA_DIPR = 0xFFFFFFFF;
238 MCF_ICR(ISC_DMA) = ILP_DMA;
241 - enable_irq( 64 + ISC_DMA );
245 - MCD_initDma((dmaRegs *) (MCF_MBAR + 0x8000),
246 + result = MCD_initDma((dmaRegs *) (MCF_MBAR + 0x8000),
247 (void *) SYS_SRAM_DMA_START, MCD_RELOC_TASKS);
248 if (result != MCD_OK) {
249 printk("Cannot perform DMA initialization\n");
250 --- a/arch/m68k/coldfire/entry.S
251 +++ b/arch/m68k/coldfire/entry.S
253 * Kurt Mahan kmahan@freescale.com
254 * Copyright Freescale Semiconductor, Inc. 2007
256 + * Modify irq status in buserr -- (c) Copyright 2008, SYSTEM electronic Gmbh
260 * arch/m68knommu/platform/5307/entry.S &
261 @@ -77,7 +79,15 @@ sw_usp:
265 +#ifdef CONFIG_COLDFIRE_FOO
266 + movew #0x2700,%sr /* lock interrupts */
269 +#ifdef CONFIG_COLDFIRE_FOO
270 + movew PT_SR(%sp),%d3 /* get original %sr */
271 + oril #0x2000,%d3 /* set supervisor mode in it */
272 + movew %d3,%sr /* recover irq state */
275 movel %sp,%sp@- /* stack frame pointer argument */
277 --- a/arch/m68k/coldfire/head.S
278 +++ b/arch/m68k/coldfire/head.S
280 * Matt Waddel Matt.Waddel@freescale.com
281 * Kurt Mahan kmahan@freescale.com
282 * Copyright Freescale Semiconductor, Inc. 2007, 2008
283 + * Phys kernel mapping Copyright Daniel Krueger, SYSTEC electornic GmbH 2008
285 * This program is free software; you can redistribute it and/or modify
286 * it under the terms of the GNU General Public License as published by
288 #define __FINIT .previous
291 -/* JKM -- REVISE DOCS FOR RIGO */
292 +/* JKM -- REVISE DOCS FOR RIGO and PHYS MAPPING */
294 * Setup ACR mappings to provide the following memory map:
297 * None currently (mapped via TLBs)
300 +#if CONFIG_SDRAM_BASE != PAGE_BASE
301 #if defined(CONFIG_M54455)
303 #define ACR0_DEFAULT #0xA00FA048 /* ACR0 default value */
305 +#define ACR0_DEFAULT #0x400FA028 /* ACR0 default value */
306 #define ACR1_DEFAULT #0xF00FA040 /* ACR1 default value */
308 #define ACR2_DEFAULT #0x00000000 /* ACR2 default value */
310 +#define ACR2_DEFAULT #0x400FA028 /* ACR2 default value */
311 #define ACR3_DEFAULT #0x00000000 /* ACR3 default value */
312 /* ACR mapping for FPGA (maps 0) */
313 #define ACR0_FPGA #0x000FA048 /* ACR0 enable FPGA */
315 #define ACR3_DEFAULT #0x00000000 /* ACR3 default value */
319 +#if defined(CONFIG_M54455)
320 +#elif defined(CONFIG_M547X_8X)
321 +#define ACR0_DEFAULT #0xE000C040 /* ACR0 default value */
322 +#define ACR1_DEFAULT #0x000FA008 /* ACR1 default value */
323 +#define ACR2_DEFAULT #0x00000000 /* ACR2 default value */
324 +#define ACR3_DEFAULT #0x000FA008 /* ACR3 default value */
329 /* Several macros to make the writing of subroutines easier:
330 * - func_start marks the beginning of the routine which setups the frame
331 @@ -153,6 +171,7 @@ func_define putn,1
335 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
337 mmu_map - creates a new TLB entry
339 @@ -222,6 +241,7 @@ func_define putn,1
340 movew \temp_data_reg, (MMUOR)
342 .endm /* mmu_unmap */
343 +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
346 .section ".text.head","ax"
347 @@ -235,7 +255,11 @@ ENTRY(_stext)
349 .long BOOTINFOV_MAGIC
351 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
352 1: jmp __start-(0xc0000000-CONFIG_SDRAM_BASE)
357 .equ kernel_pg_dir,_stext
359 @@ -244,24 +268,13 @@ ENTRY(_start)
364 -/* JKM -- make sure Rigo handles UBOOT */
365 /* Save the location of u-boot info - cmd line, bd_info, etc. */
366 movel %a7,%a4 /* Don't use %a4 before cf_early_init */
367 -/* JKM -- fix to use CONFIG_SDRAM_BASE) */
368 -#if defined(CONFIG_M54455)
369 - addl #0x80000004,%a4 /* 0x80000004= 1 stack push + high mem offset */
370 -#elif defined(CONFIG_M547X_8X)
371 - addl #0xc0000004,%a4 /* 0x80000004= 1 stack push + high mem offset */
373 + addl #0x00000004,%a4 /* offset past top */
374 + addl #(PAGE_OFFSET-CONFIG_SDRAM_BASE),%a4 /* high mem offset */
376 -/* JKM -- fix this to work off of CONFIG_SDRAM_BASE */
377 /* Setup initial stack pointer */
378 -#if defined(CONFIG_M54455)
379 - movel #0x40001000,%sp
380 -#elif defined(CONFIG_M547X_8X)
381 - movel #0x00001000,%sp
383 + movel #CONFIG_SDRAM_BASE+0x1000,%sp
387 @@ -297,16 +310,21 @@ ENTRY(__start)
389 movel ACR0_DEFAULT, %d0 /* ACR0 (DATA) setup */
392 movel ACR1_DEFAULT, %d0 /* ACR1 (DATA) setup */
395 movel ACR2_DEFAULT, %d0 /* ACR2 (CODE) setup */
398 movel ACR3_DEFAULT, %d0 /* ACR3 (CODE) setup */
402 /* If you change the memory size to another value make a matching
403 change in paging_init(cf-mmu.c) to zones_size[]. */
405 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
406 #if defined(CONFIG_M54455)
407 /* Map 256MB as code */
408 mmu_map (PAGE_OFFSET+0*0x1000000), (PHYS_OFFSET+0*0x1000000), \
409 @@ -511,6 +529,7 @@ ENTRY(__start)
410 MMUTR_SG, MMUDR_SZ1M, MMUDR_DCB, MMUDR_SP, MMUDR_R, \
413 +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
416 movel #(MMUCR_EN),%a0
417 @@ -531,6 +550,7 @@ ENTRY(__running_high)
420 /* Unmap unity mappings */
421 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
422 #if defined(CONFIG_M54455)
423 mmu_unmap (PHYS_OFFSET+0*0x1000000), MMUOR_ITLB, %d0
424 mmu_unmap (PHYS_OFFSET+0*0x1000000), 0, %d0
425 @@ -544,6 +564,7 @@ ENTRY(__running_high)
426 mmu_unmap (PHYS_OFFSET+2*0x1000000), 0, %d0
427 mmu_unmap (PHYS_OFFSET+3*0x1000000), 0, %d0
429 +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
431 /* Setup initial stack pointer */
433 @@ -574,6 +595,7 @@ func_return set_context
434 * Map in 0x00000000 -> 0x0fffffff and then do the write.
441 @@ -585,6 +607,7 @@ set_fpga:
449 --- a/arch/m68k/coldfire/mcf5445x-devices.c
450 +++ b/arch/m68k/coldfire/mcf5445x-devices.c
451 @@ -127,7 +127,9 @@ static inline void mcf5445x_init_pata(vo
452 static int __init mcf5445x_init_devices(void)
454 printk(KERN_INFO "MCF5445x INIT_DEVICES\n");
456 mcf5445x_init_pata();
461 --- a/arch/m68k/coldfire/mcf5445x-pci.c
462 +++ b/arch/m68k/coldfire/mcf5445x-pci.c
463 @@ -236,6 +236,8 @@ mcf5445x_pci_arb_interrupt(int irq, void
465 init_mcf5445x_pci(void)
470 * Initialize the PCI core
472 @@ -331,6 +333,7 @@ init_mcf5445x_pci(void)
473 raw_pci_ops = &mcf5445x_pci_ops;
480 --- a/arch/m68k/coldfire/signal.c
481 +++ b/arch/m68k/coldfire/signal.c
482 @@ -608,7 +608,10 @@ static inline int rt_setup_ucontext(stru
484 static inline void push_cache(unsigned long vaddr)
487 +// JKM -- need to add into the old cpushl cache stuff
488 cf_cache_push(__pa(vaddr), 8);
492 static inline void __user *
493 --- a/arch/m68k/configs/m5485evb_defconfig
494 +++ b/arch/m68k/configs/m5485evb_defconfig
497 # Automatically generated make config: don't edit
498 # Linux kernel version: 2.6.24
499 -# Thu Feb 21 00:19:01 2008
500 +# Wed Mar 5 16:05:25 2008
504 @@ -103,6 +103,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
505 # CONFIG_SUN3 is not set
509 # CONFIG_AMIGA is not set
510 # CONFIG_ATARI is not set
511 # CONFIG_MAC is not set
512 @@ -135,7 +136,7 @@ CONFIG_M5485CFE=y
513 # CONFIG_M5485DFE is not set
514 # CONFIG_M5485EFE is not set
515 # CONFIG_M5485FFE is not set
516 -CONFIG_MCFCLK=50000000
517 +CONFIG_MCFCLK=200000000
518 # CONFIG_MCF_USER_HALT is not set
520 CONFIG_SDRAM_BASE=0x00000000
521 @@ -279,7 +280,73 @@ CONFIG_FW_LOADER=y
522 # CONFIG_DEBUG_DEVRES is not set
523 # CONFIG_SYS_HYPERVISOR is not set
524 # CONFIG_CONNECTOR is not set
525 -# CONFIG_MTD is not set
527 +# CONFIG_MTD_DEBUG is not set
528 +# CONFIG_MTD_CONCAT is not set
529 +CONFIG_MTD_PARTITIONS=y
530 +# CONFIG_MTD_REDBOOT_PARTS is not set
531 +CONFIG_MTD_CMDLINE_PARTS=y
534 +# User Modules And Translation Layers
536 +# CONFIG_MTD_CHAR is not set
537 +CONFIG_MTD_BLKDEVS=y
539 +# CONFIG_FTL is not set
540 +# CONFIG_NFTL is not set
541 +# CONFIG_INFTL is not set
542 +# CONFIG_RFD_FTL is not set
543 +# CONFIG_SSFDC is not set
544 +# CONFIG_MTD_OOPS is not set
547 +# RAM/ROM/Flash chip drivers
549 +# CONFIG_MTD_CFI is not set
550 +# CONFIG_MTD_JEDECPROBE is not set
551 +CONFIG_MTD_MAP_BANK_WIDTH_1=y
552 +CONFIG_MTD_MAP_BANK_WIDTH_2=y
553 +CONFIG_MTD_MAP_BANK_WIDTH_4=y
554 +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
555 +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
556 +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
559 +# CONFIG_MTD_CFI_I4 is not set
560 +# CONFIG_MTD_CFI_I8 is not set
563 +# CONFIG_MTD_ABSENT is not set
566 +# Mapping drivers for chip access
568 +# CONFIG_MTD_COMPLEX_MAPPINGS is not set
569 +# CONFIG_MTD_PHYSMAP is not set
570 +# CONFIG_MTD_PLATRAM is not set
573 +# Self-contained MTD device drivers
575 +# CONFIG_MTD_SLRAM is not set
576 +# CONFIG_MTD_PHRAM is not set
577 +# CONFIG_MTD_MTDRAM is not set
578 +# CONFIG_MTD_BLOCK2MTD is not set
581 +# Disk-On-Chip Device Drivers
583 +# CONFIG_MTD_DOC2000 is not set
584 +# CONFIG_MTD_DOC2001 is not set
585 +# CONFIG_MTD_DOC2001PLUS is not set
586 +# CONFIG_MTD_NAND is not set
587 +# CONFIG_MTD_ONENAND is not set
590 +# UBI - Unsorted block images
592 +# CONFIG_MTD_UBI is not set
593 # CONFIG_PARPORT is not set
595 # CONFIG_BLK_DEV_COW_COMMON is not set
596 @@ -347,6 +414,9 @@ CONFIG_NETDEVICES=y
597 # CONFIG_PHYLIB is not set
598 CONFIG_NET_ETHERNET=y
601 +CONFIG_FEC_548x_AUTO_NEGOTIATION=y
602 +# CONFIG_FEC_548x_ENABLE_FEC2 is not set
603 # CONFIG_IBM_NEW_EMAC_ZMII is not set
604 # CONFIG_IBM_NEW_EMAC_RGMII is not set
605 # CONFIG_IBM_NEW_EMAC_TAH is not set
606 @@ -530,7 +600,7 @@ CONFIG_FS_MBCACHE=y
607 # CONFIG_GFS2_FS is not set
608 # CONFIG_OCFS2_FS is not set
610 -# CONFIG_ROMFS_FS is not set
612 # CONFIG_INOTIFY is not set
613 # CONFIG_QUOTA is not set
615 @@ -578,6 +648,7 @@ CONFIG_TMPFS=y
616 # CONFIG_BEFS_FS is not set
617 # CONFIG_BFS_FS is not set
618 # CONFIG_EFS_FS is not set
619 +# CONFIG_JFFS2_FS is not set
620 # CONFIG_CRAMFS is not set
621 # CONFIG_VXFS_FS is not set
622 # CONFIG_HPFS_FS is not set
623 --- a/arch/m68k/mm/cache.c
624 +++ b/arch/m68k/mm/cache.c
625 @@ -81,7 +81,9 @@ static unsigned long virt_to_phys_slow(u
626 void flush_icache_range(unsigned long address, unsigned long endaddr)
628 #ifdef CONFIG_COLDFIRE
629 - cf_icache_flush_range(address, endaddr);
630 +// JKM -- hack until new cpushl stuff is in
631 +// cf_icache_flush_range(address, endaddr);
633 #else /* !CONFIG_COLDFIRE */
635 if (CPU_IS_040_OR_060) {
636 --- a/arch/m68k/mm/cf-mmu.c
637 +++ b/arch/m68k/mm/cf-mmu.c
639 #include <asm/coldfire.h>
640 #include <asm/tlbflush.h>
642 +#if PAGE_OFFSET == CONFIG_SDRAM_BASE
643 +#define KERNRAM(x) ((x >= PAGE_OFFSET) && (x < (PAGE_OFFSET + CONFIG_SDRAM_SIZE)))
645 +#define KERNRAM(x) (x >= PAGE_OFFSET)
648 mm_context_t next_mmu_context;
649 unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
651 @@ -53,10 +59,16 @@ extern char __init_begin, __init_end;
653 void free_initmem(void)
657 unsigned long start = (unsigned long)&__init_begin;
658 unsigned long end = (unsigned long)&__init_end;
661 + * JKM -- revisit -- the latest round of vmlinux.lds changes has caused
662 + * a little grief with how init areas are handled. With the new toolchain
663 + * release I'll fix this.
665 printk(KERN_INFO "free_initmem: __init_begin = 0x%lx __init_end = 0x%lx\n", start, end);
667 addr = (unsigned long)&__init_begin;
668 @@ -67,6 +79,7 @@ void free_initmem(void)
675 /* Coldfire paging_init derived from sun3 */
676 @@ -149,8 +162,8 @@ int cf_tlb_miss(struct pt_regs *regs, in
677 mmuar = ( dtlb ) ? regs->mmuar
678 : regs->pc + (extension_word * sizeof(long));
680 - mm = (!user_mode(regs) && (mmuar >= PAGE_OFFSET)) ? &init_mm
682 + mm = (!user_mode(regs) && KERNRAM(mmuar)) ? &init_mm : current->mm;
685 local_irq_restore(flags);
687 @@ -167,9 +180,9 @@ int cf_tlb_miss(struct pt_regs *regs, in
688 local_irq_restore(flags);
692 - pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar)
693 - : pte_offset_map(pmd, mmuar);
695 + pte = (KERNRAM(mmuar)) ? pte_offset_kernel(pmd, mmuar)
696 + : pte_offset_map(pmd, mmuar);
697 if (pte_none(*pte) || !pte_present(*pte)) {
698 local_irq_restore(flags);
700 @@ -185,7 +198,7 @@ int cf_tlb_miss(struct pt_regs *regs, in
702 set_pte(pte, pte_mkyoung(*pte));
703 asid = mm->context & 0xff;
704 - if (!pte_dirty(*pte) && mmuar<=PAGE_OFFSET)
705 + if (!pte_dirty(*pte) && !KERNRAM(mmuar))
706 set_pte(pte, pte_wrprotect(*pte));
708 *MMUTR = (mmuar & PAGE_MASK) | (asid << CF_ASID_MMU_SHIFT)
709 @@ -201,7 +214,8 @@ int cf_tlb_miss(struct pt_regs *regs, in
711 *MMUOR = MMUOR_ITLB | MMUOR_ACC | MMUOR_UAA;
716 /*printk("cf_tlb_miss: va=%lx, pa=%lx\n", (mmuar & PAGE_MASK),
717 (pte_val(*pte) & PAGE_MASK));*/
718 local_irq_restore(flags);
719 --- a/arch/m68k/mm/memory.c
720 +++ b/arch/m68k/mm/memory.c
721 @@ -206,7 +206,9 @@ static inline void pushcl040(unsigned lo
722 void cache_clear (unsigned long paddr, int len)
724 #ifdef CONFIG_COLDFIRE
725 - cf_cache_clear(paddr, len);
726 +// JKM -- revise to use proper caching
727 +// cf_cache_clear(paddr, len);
730 if (CPU_IS_040_OR_060) {
732 @@ -257,7 +259,9 @@ EXPORT_SYMBOL(cache_clear);
733 void cache_push (unsigned long paddr, int len)
735 #ifdef CONFIG_COLDFIRE
736 - cf_cache_push(paddr, len);
737 +// JKM -- revise to use proper caching
738 +// cf_cache_push(paddr, len);
741 if (CPU_IS_040_OR_060) {
743 --- a/drivers/net/fec/fec.c
744 +++ b/drivers/net/fec/fec.c
745 @@ -99,6 +99,9 @@ unsigned char fec_mac_addr_fec0[6] = { 0
746 unsigned char fec_mac_addr_fec1[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x51 }; // Default address of FEC1
749 +extern unsigned char uboot_enet0[];
750 +extern unsigned char uboot_enet1[];
753 int fec_str_to_mac( char *str_mac, unsigned char* addr);
754 int __init fec_mac_setup0 (char *s);
755 @@ -175,6 +178,12 @@ printk(KERN_INFO "FEI: index=%d\n", inde
756 printk(KERN_INFO "FEI: txdesc=0x%p rxdesc=0x%p\n", fp->fecpriv_txdesc, fp->fecpriv_rxdesc);
759 + if (uboot_enet0[0] || uboot_enet0[1] || uboot_enet0[2] ||
760 + uboot_enet0[3] || uboot_enet0[4] || uboot_enet0[5]) {
761 + /* use uboot enet 0 addr */
762 + memcpy(fec_mac_addr_fec0, uboot_enet0, 6);
765 fp->fecpriv_mac_addr = fec_mac_addr_fec0;
768 @@ -211,6 +220,11 @@ printk(KERN_INFO "FEI: txdesc=0x%p rxde
769 fp->fecpriv_rxdesc = (void*)FEC_RX_DESC_FEC1;
772 + if (uboot_enet1[0] || uboot_enet1[1] || uboot_enet1[2] ||
773 + uboot_enet1[3] || uboot_enet1[4] || uboot_enet1[5]) {
774 + /* use uboot enet 1 addr */
775 + memcpy(fec_mac_addr_fec1, uboot_enet1, 6);
777 fp->fecpriv_mac_addr = fec_mac_addr_fec1;
780 @@ -762,7 +776,6 @@ int fec_tx(struct sk_buff *skb, struct n
781 void *data, *data_aligned;
784 -printk(KERN_INFO "fec_tx\n");
785 data = kmalloc(skb->len + 15, GFP_DMA | GFP_ATOMIC);
788 @@ -820,7 +833,6 @@ void fec_tx_timeout(struct net_device *d
789 struct fec_priv *fp = netdev_priv(dev);
790 unsigned long base_addr = (unsigned long) dev->base_addr;
792 -printk(KERN_INFO "fec_tx_timeout\n");
793 spin_lock_irq(&fp->fecpriv_lock);
794 MCD_killDma(fp->fecpriv_fec_tx_channel);
795 for (i = 0; i < FEC_TX_BUF_NUMBER; i++)
796 @@ -941,7 +953,6 @@ void fec_interrupt_fec_tx_handler(struct
798 struct fec_priv *fp = netdev_priv(dev);
800 -printk(KERN_INFO "fectxint\n");
801 //Release the socket buffer
802 if(fp->fecpriv_txbuf[fp->fecpriv_current_tx])
804 @@ -977,7 +988,6 @@ void fec_interrupt_fec_rx_handler(struct
805 struct fec_priv *fp = netdev_priv(dev);
808 -printk(KERN_INFO "fecrxint\n");
809 fp->fecpriv_rxflag = 1;
811 // Some buffers can be missed
812 @@ -1070,7 +1080,6 @@ irqreturn_t fec_interrupt_handler(int ir
813 unsigned long base_addr = (unsigned long) dev->base_addr;
814 unsigned long events;
816 -printk(KERN_INFO "fecerrint\n");
817 // Read and clear the events
818 events = FEC_EIR(base_addr) & FEC_EIMR(base_addr);
820 @@ -1157,7 +1166,6 @@ void fec_interrupt_fec_reinit(unsigned l
821 struct fec_priv *fp = netdev_priv(dev);
822 unsigned long base_addr = (unsigned long) dev->base_addr;
824 -printk(KERN_INFO "fecreinit\n");
825 // Initialize reception descriptors and start DMA for the reception
826 for (i = 0; i < FEC_RX_BUF_NUMBER; i++)
828 --- a/include/asm-m68k/bootinfo.h
829 +++ b/include/asm-m68k/bootinfo.h
831 ** Redesign of the boot information structure; renamed to bootinfo.h again
832 ** 27/11/96 Geert Uytterhoeven:
833 ** Backwards compatibility with bootinfo interface version 1.0
834 +** 12/03/08 Kurt Mahan
835 +** Copy the bd_info structure from uboot1.3.2/include/asm-m68k/u-boot.h
836 +** into this file. The original author is Wolfgang Denk,
837 +** DENX Software Engineering, wd@denx.de.
840 #ifndef _M68K_BOOTINFO_H
841 #define _M68K_BOOTINFO_H
843 +#ifndef __ASSEMBLY__
847 + * bd_info structure from uboot1.3.2/include/asm-m68k/u-boot.h
850 + unsigned long bi_memstart; /* start of DRAM memory */
851 + unsigned long bi_memsize; /* size of DRAM memory in bytes */
852 + unsigned long bi_flashstart; /* start of FLASH memory */
853 + unsigned long bi_flashsize; /* size of FLASH memory */
854 + unsigned long bi_flashoffset; /* reserved area for startup monitor */
855 + unsigned long bi_sramstart; /* start of SRAM memory */
856 + unsigned long bi_sramsize; /* size of SRAM memory */
857 + unsigned long bi_mbar_base; /* base of internal registers */
858 + unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
859 + unsigned long bi_boot_params; /* where this board expects params */
860 + unsigned long bi_ip_addr; /* IP Address */
861 + unsigned char bi_enet0addr[6]; /* Ethernet 0 mac address */
862 + unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
863 + unsigned long bi_intfreq; /* Internal Freq, in MHz */
864 + unsigned long bi_busfreq; /* Bus Freq, in MHz */
866 + unsigned long bi_pcifreq; /* pci Freq in MHz */
868 +#ifdef UBOOT_EXTRA_CLOCK
869 + unsigned long bi_inpfreq; /* input Freq in MHz */
870 + unsigned long bi_vcofreq; /* vco Freq in MHz */
871 + unsigned long bi_flbfreq; /* Flexbus Freq in MHz */
873 + unsigned long bi_baudrate; /* Console Baudrate */
874 + unsigned char bi_enet1addr[6]; /* eth1 mac address */
875 + unsigned char bi_enet2addr[6]; /* eth2 mac address */
876 + unsigned char bi_enet3addr[6]; /* eth3 mac address */
879 +struct uboot_record {
880 + struct bd_info *bdi;
881 + unsigned long initrd_start;
882 + unsigned long initrd_end;
883 + unsigned long cmd_line_start;
884 + unsigned long cmd_line_stop;
886 +#endif /* __ASSEMBLY__ */
889 * Bootinfo definitions
890 @@ -49,17 +97,6 @@ struct bi_record {
891 #endif /* __ASSEMBLY__ */
894 -#ifndef __ASSEMBLY__
896 -struct uboot_record {
897 - unsigned long bd_info;
898 - unsigned long initrd_start;
899 - unsigned long initrd_end;
900 - unsigned long cmd_line_start;
901 - unsigned long cmd_line_stop;
904 -#endif /* __ASSEMBLY__ */
908 --- a/include/asm-m68k/cf_cacheflush.h
909 +++ b/include/asm-m68k/cf_cacheflush.h
912 - * include/asm-m68k/cf_cacheflush.h - Coldfire Cache
914 - * Based on include/asm-m68k/cacheflush.h
916 - * Coldfire pieces by:
917 - * Kurt Mahan kmahan@freescale.com
919 - * Copyright Freescale Semiconductor, Inc. 2007
921 - * This program is free software; you can redistribute it and/or modify it
922 - * under the terms of the GNU General Public License as published by the
923 - * Free Software Foundation; either version 2 of the License, or (at your
924 - * option) any later version.
926 #ifndef M68K_CF_CACHEFLUSH_H
927 #define M68K_CF_CACHEFLUSH_H
929 #include <asm/cfcache.h>
932 - * Coldfire Cache Model
934 - * The Coldfire processors use a Harvard architecture cache configured
935 - * as four-way set associative. The cache does not implement bus snooping
936 - * so cache coherency with other masters must be maintained in software.
938 - * The cache is managed via the CPUSHL instruction in conjunction with
939 - * bits set in the CACR (cache control register). Currently the code
940 - * uses the CPUSHL enhancement which adds the ability to
941 - * invalidate/clear/push a cacheline by physical address. This feature
942 - * is designated in the Hardware Configuration Register [D1-CPES].
945 - * DPI[28] cpushl invalidate disable for d-cache
946 - * IDPI[12] cpushl invalidate disable for i-cache
947 - * SPA[14] cpushl search by physical address
948 - * IVO[20] cpushl invalidate only
950 - * Random Terminology:
951 - * * invalidate = reset the cache line's valid bit
952 - * * push = generate a line-sized store of the data if its contents are marked
953 - * as modifed (the modified flag is cleared after the store)
954 - * * clear = push + invalidate
958 - * flush_icache - Flush all of the instruction cache
960 -static inline void flush_icache(void)
962 - asm volatile("nop\n"
963 - "moveq%.l #0,%%d0\n"
964 - "moveq%.l #0,%%d1\n"
965 - "move%.l %%d0,%%a0\n"
967 - "cpushl %%ic,(%%a0)\n"
968 - "add%.l #0x0010,%%a0\n"
969 - "addq%.l #1,%%d1\n"
970 - "cmpi%.l %0,%%d1\n"
972 - "moveq%.l #0,%%d1\n"
973 - "addq%.l #1,%%d0\n"
974 - "move%.l %%d0,%%a0\n"
975 - "cmpi%.l #4,%%d0\n"
977 - : : "i" (CACHE_SETS)
978 - : "a0", "d0", "d1");
982 - * flush_dcache - Flush all of the data cache
984 -static inline void flush_dcache(void)
986 - asm volatile("nop\n"
987 - "moveq%.l #0,%%d0\n"
988 - "moveq%.l #0,%%d1\n"
989 - "move%.l %%d0,%%a0\n"
991 - "cpushl %%dc,(%%a0)\n"
992 - "add%.l #0x0010,%%a0\n"
993 - "addq%.l #1,%%d1\n"
994 - "cmpi%.l %0,%%d1\n"
996 - "moveq%.l #0,%%d1\n"
997 - "addq%.l #1,%%d0\n"
998 - "move%.l %%d0,%%a0\n"
999 - "cmpi%.l #4,%%d0\n"
1001 - : : "i" (CACHE_SETS)
1002 - : "a0", "d0", "d1");
1006 - * flush_bcache - Flush all of both caches
1007 + * Cache handling functions
1009 -static inline void flush_bcache(void)
1011 - asm volatile("nop\n"
1012 - "moveq%.l #0,%%d0\n"
1013 - "moveq%.l #0,%%d1\n"
1014 - "move%.l %%d0,%%a0\n"
1016 - "cpushl %%bc,(%%a0)\n"
1017 - "add%.l #0x0010,%%a0\n"
1018 - "addq%.l #1,%%d1\n"
1019 - "cmpi%.l %0,%%d1\n"
1021 - "moveq%.l #0,%%d1\n"
1022 - "addq%.l #1,%%d0\n"
1023 - "move%.l %%d0,%%a0\n"
1024 - "cmpi%.l #4,%%d0\n"
1026 - : : "i" (CACHE_SETS)
1027 - : "a0", "d0", "d1");
1031 - * cf_cache_clear - invalidate cache
1032 - * @paddr: starting physical address
1033 - * @len: number of bytes
1035 - * Invalidate cache lines starting at paddr for len bytes.
1036 - * Those lines are not pushed.
1038 -static inline void cf_cache_clear(unsigned long paddr, int len)
1040 - /* number of lines */
1041 - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
1045 - /* align on set boundary */
1046 - paddr &= 0xfffffff0;
1048 - asm volatile("nop\n"
1049 - "move%.l %2,%%d0\n"
1051 - "movec %%d0,%%cacr\n"
1052 - "move%.l %0,%%a0\n"
1053 - "move%.l %1,%%d0\n"
1055 - "cpushl %%bc,(%%a0)\n"
1056 - "lea 0x10(%%a0),%%a0\n"
1057 - "subq%.l #1,%%d0\n"
1059 - "movec %2,%%cacr\n"
1060 - : : "a" (paddr), "r" (len),
1061 - "r" (shadow_cacr),
1062 - "i" (CF_CACR_SPA+CF_CACR_IVO)
1067 - * cf_cache_push - Push dirty cache out with no invalidate
1068 - * @paddr: starting physical address
1069 - * @len: number of bytes
1071 - * Push the any dirty lines starting at paddr for len bytes.
1072 - * Those lines are not invalidated.
1074 -static inline void cf_cache_push(unsigned long paddr, int len)
1076 - /* number of lines */
1077 - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
1081 - /* align on set boundary */
1082 - paddr &= 0xfffffff0;
1084 - asm volatile("nop\n"
1085 - "move%.l %2,%%d0\n"
1087 - "movec %%d0,%%cacr\n"
1088 - "move%.l %0,%%a0\n"
1089 - "move%.l %1,%%d0\n"
1091 - "cpushl %%bc,(%%a0)\n"
1092 - "lea 0x10(%%a0),%%a0\n"
1093 - "subq%.l #1,%%d0\n"
1095 - "movec %2,%%cacr\n"
1096 - : : "a" (paddr), "r" (len),
1097 - "r" (shadow_cacr),
1098 - "i" (CF_CACR_SPA+CF_CACR_DPI+CF_CACR_IDPI)
1101 +#define flush_icache() \
1103 + unsigned long set; \
1104 + unsigned long start_set; \
1105 + unsigned long end_set; \
1108 + end_set = (unsigned long)LAST_DCACHE_ADDR; \
1110 + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
1111 + asm volatile("cpushl %%ic,(%0)\n" \
1112 + "\taddq%.l #1,%0\n" \
1113 + "\tcpushl %%ic,(%0)\n" \
1114 + "\taddq%.l #1,%0\n" \
1115 + "\tcpushl %%ic,(%0)\n" \
1116 + "\taddq%.l #1,%0\n" \
1117 + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set)); \
1121 +#define flush_dcache() \
1123 + unsigned long set; \
1124 + unsigned long start_set; \
1125 + unsigned long end_set; \
1128 + end_set = (unsigned long)LAST_DCACHE_ADDR; \
1130 + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
1131 + asm volatile("cpushl %%dc,(%0)\n" \
1132 + "\taddq%.l #1,%0\n" \
1133 + "\tcpushl %%dc,(%0)\n" \
1134 + "\taddq%.l #1,%0\n" \
1135 + "\tcpushl %%dc,(%0)\n" \
1136 + "\taddq%.l #1,%0\n" \
1137 + "\tcpushl %%dc,(%0)" : "=a" (set) : "a" (set)); \
1141 +#define flush_bcache() \
1143 + unsigned long set; \
1144 + unsigned long start_set; \
1145 + unsigned long end_set; \
1148 + end_set = (unsigned long)LAST_DCACHE_ADDR; \
1150 + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
1151 + asm volatile("cpushl %%bc,(%0)\n" \
1152 + "\taddq%.l #1,%0\n" \
1153 + "\tcpushl %%bc,(%0)\n" \
1154 + "\taddq%.l #1,%0\n" \
1155 + "\tcpushl %%bc,(%0)\n" \
1156 + "\taddq%.l #1,%0\n" \
1157 + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set)); \
1162 - * cf_cache_flush - Push dirty cache out and invalidate
1163 - * @paddr: starting physical address
1164 - * @len: number of bytes
1166 - * Push the any dirty lines starting at paddr for len bytes and
1167 - * invalidate those lines.
1169 + * invalidate the cache for the specified memory range.
1170 + * It starts at the physical address specified for
1171 + * the given number of bytes.
1173 -static inline void cf_cache_flush(unsigned long paddr, int len)
1175 - /* number of lines */
1176 - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
1180 - /* align on set boundary */
1181 - paddr &= 0xfffffff0;
1183 - asm volatile("nop\n"
1184 - "move%.l %2,%%d0\n"
1186 - "movec %%d0,%%cacr\n"
1187 - "move%.l %0,%%a0\n"
1188 - "move%.l %1,%%d0\n"
1190 - "cpushl %%bc,(%%a0)\n"
1191 - "lea 0x10(%%a0),%%a0\n"
1192 - "subq%.l #1,%%d0\n"
1194 - "movec %2,%%cacr\n"
1195 - : : "a" (paddr), "r" (len),
1196 - "r" (shadow_cacr),
1202 - * cf_cache_flush_range - Push dirty data/inst cache in range out and invalidate
1203 - * @vstart - starting virtual address
1204 - * @vend: ending virtual address
1206 - * Push the any dirty data/instr lines starting at paddr for len bytes and
1207 - * invalidate those lines.
1208 +extern void cache_clear(unsigned long paddr, int len);
1210 + * push any dirty cache in the specified memory range.
1211 + * It starts at the physical address specified for
1212 + * the given number of bytes.
1214 -static inline void cf_cache_flush_range(unsigned long vstart, unsigned long vend)
1218 - /* align on set boundary */
1219 - vstart &= 0xfffffff0;
1220 - vend = PAGE_ALIGN((vend + (CACHE_LINE_SIZE-1))) & 0xfffffff0;
1221 - len = vend - vstart;
1224 - vstart = __pa(vstart);
1225 - vend = vstart + len;
1227 - asm volatile("nop\n"
1228 - "move%.l %2,%%d0\n"
1230 - "movec %%d0,%%cacr\n"
1231 - "move%.l %0,%%a0\n"
1232 - "move%.l %1,%%a1\n"
1234 - "cpushl %%bc,(%%a0)\n"
1235 - "lea 0x10(%%a0),%%a0\n"
1236 - "cmpa%.l %%a0,%%a1\n"
1238 - "movec %2,%%cacr\n"
1240 - : "a" (vstart), "a" (vend),
1241 - "r" (shadow_cacr),
1243 - : "a0", "a1", "d0");
1245 +extern void cache_push(unsigned long paddr, int len);
1248 - * cf_dcache_flush_range - Push dirty data cache in range out and invalidate
1249 - * @vstart - starting virtual address
1250 - * @vend: ending virtual address
1252 - * Push the any dirty data lines starting at paddr for len bytes and
1253 - * invalidate those lines.
1255 + * push and invalidate pages in the specified user virtual
1258 -static inline void cf_dcache_flush_range(unsigned long vstart, unsigned long vend)
1260 - /* align on set boundary */
1261 - vstart &= 0xfffffff0;
1262 - vend = (vend + (CACHE_LINE_SIZE-1)) & 0xfffffff0;
1264 - asm volatile("nop\n"
1265 - "move%.l %2,%%d0\n"
1267 - "movec %%d0,%%cacr\n"
1268 - "move%.l %0,%%a0\n"
1269 - "move%.l %1,%%a1\n"
1271 - "cpushl %%dc,(%%a0)\n"
1272 - "lea 0x10(%%a0),%%a0\n"
1273 - "cmpa%.l %%a0,%%a1\n"
1275 - "movec %2,%%cacr\n"
1277 - : "a" (__pa(vstart)), "a" (__pa(vend)),
1278 - "r" (shadow_cacr),
1280 - : "a0", "a1", "d0");
1282 +extern void cache_push_v(unsigned long vaddr, int len);
1285 - * cf_icache_flush_range - Push dirty inst cache in range out and invalidate
1286 - * @vstart - starting virtual address
1287 - * @vend: ending virtual address
1289 - * Push the any dirty instr lines starting at paddr for len bytes and
1290 - * invalidate those lines. This should just be an invalidate since you
1291 - * shouldn't be able to have dirty instruction cache.
1293 -static inline void cf_icache_flush_range(unsigned long vstart, unsigned long vend)
1295 - /* align on set boundary */
1296 - vstart &= 0xfffffff0;
1297 - vend = (vend + (CACHE_LINE_SIZE-1)) & 0xfffffff0;
1299 - asm volatile("nop\n"
1300 - "move%.l %2,%%d0\n"
1302 - "movec %%d0,%%cacr\n"
1303 - "move%.l %0,%%a0\n"
1304 - "move%.l %1,%%a1\n"
1306 - "cpushl %%ic,(%%a0)\n"
1307 - "lea 0x10(%%a0),%%a0\n"
1308 - "cmpa%.l %%a0,%%a1\n"
1310 - "movec %2,%%cacr\n"
1312 - : "a" (__pa(vstart)), "a" (__pa(vend)),
1313 - "r" (shadow_cacr),
1315 - : "a0", "a1", "d0");
1317 +/* This is needed whenever the virtual mapping of the current
1318 + process changes. */
1321 * flush_cache_mm - Flush an mm_struct
1322 @@ -343,6 +100,8 @@ static inline void flush_cache_mm(struct
1324 #define flush_cache_dup_mm(mm) flush_cache_mm(mm)
1326 +#define flush_cache_all() flush_bcache()
1329 * flush_cache_range - Flush a cache range
1331 @@ -356,7 +115,8 @@ static inline void flush_cache_range(str
1332 unsigned long start, unsigned long end)
1334 if (vma->vm_mm == current->mm)
1335 - cf_cache_flush_range(start, end);
1337 +// cf_cache_flush_range(start, end);
1341 @@ -372,76 +132,113 @@ static inline void flush_cache_page(stru
1342 unsigned long vmaddr, unsigned long pfn)
1344 if (vma->vm_mm == current->mm)
1345 - cf_cache_flush_range(vmaddr, vmaddr+PAGE_SIZE);
1347 +// cf_cache_flush_range(vmaddr, vmaddr+PAGE_SIZE);
1351 - * __flush_page_to_ram - Push a page out of the cache
1352 - * @vaddr: Virtual address at start of page
1354 - * Push the page at kernel virtual address *vaddr* and clear
1357 -static inline void __flush_page_to_ram(void *vaddr)
1359 - asm volatile("nop\n"
1360 - "move%.l %2,%%d0\n"
1362 - "movec %%d0,%%cacr\n"
1363 - "move%.l %0,%%d0\n"
1364 - "and%.l #0xfffffff0,%%d0\n"
1365 - "move%.l %%d0,%%a0\n"
1366 - "move%.l %1,%%d0\n"
1368 - "cpushl %%bc,(%%a0)\n"
1369 - "lea 0x10(%%a0),%%a0\n"
1370 - "subq%.l #1,%%d0\n"
1372 - "movec %2,%%cacr\n"
1373 - : : "a" (__pa(vaddr)), "i" (PAGE_SIZE / CACHE_LINE_SIZE),
1374 - "r" (shadow_cacr), "i" (CF_CACR_SPA)
1376 +/* Push the page at kernel virtual address and clear the icache */
1377 +/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
1378 +#define flush_page_to_ram(page) __flush_page_to_ram((void *) page_address(page))
1379 +extern inline void __flush_page_to_ram(void *address)
1381 + unsigned long set;
1382 + unsigned long start_set;
1383 + unsigned long end_set;
1384 + unsigned long addr = (unsigned long) address;
1386 + addr &= ~(PAGE_SIZE - 1); /* round down to page start address */
1388 + start_set = addr & _ICACHE_SET_MASK;
1389 + end_set = (addr + PAGE_SIZE-1) & _ICACHE_SET_MASK;
1391 + if (start_set > end_set) {
1392 + /* from the begining to the lowest address */
1393 + for (set = 0; set <= end_set; set += (0x10 - 3)) {
1394 + asm volatile("cpushl %%bc,(%0)\n"
1395 + "\taddq%.l #1,%0\n"
1396 + "\tcpushl %%bc,(%0)\n"
1397 + "\taddq%.l #1,%0\n"
1398 + "\tcpushl %%bc,(%0)\n"
1399 + "\taddq%.l #1,%0\n"
1400 + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set));
1402 + /* next loop will finish the cache ie pass the hole */
1403 + end_set = LAST_ICACHE_ADDR;
1405 + for (set = start_set; set <= end_set; set += (0x10 - 3)) {
1406 + asm volatile("cpushl %%bc,(%0)\n"
1407 + "\taddq%.l #1,%0\n"
1408 + "\tcpushl %%bc,(%0)\n"
1409 + "\taddq%.l #1,%0\n"
1410 + "\tcpushl %%bc,(%0)\n"
1411 + "\taddq%.l #1,%0\n"
1412 + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set));
1416 +/* Use __flush_page_to_ram() for flush_dcache_page all values are same - MW */
1417 +#define flush_dcache_page(page) \
1418 + __flush_page_to_ram((void *) page_address(page))
1419 +#define flush_icache_page(vma,pg) \
1420 + __flush_page_to_ram((void *) page_address(pg))
1421 +#define flush_icache_user_range(adr,len) do { } while (0)
1423 +#define flush_icache_user_page(vma,page,addr,len) do { } while (0)
1425 +/* Push n pages at kernel virtual address and clear the icache */
1426 +/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
1427 +extern inline void flush_icache_range (unsigned long address,
1428 + unsigned long endaddr)
1430 + unsigned long set;
1431 + unsigned long start_set;
1432 + unsigned long end_set;
1434 + start_set = address & _ICACHE_SET_MASK;
1435 + end_set = endaddr & _ICACHE_SET_MASK;
1437 + if (start_set > end_set) {
1438 + /* from the begining to the lowest address */
1439 + for (set = 0; set <= end_set; set += (0x10 - 3)) {
1440 + asm volatile("cpushl %%ic,(%0)\n"
1441 + "\taddq%.l #1,%0\n"
1442 + "\tcpushl %%ic,(%0)\n"
1443 + "\taddq%.l #1,%0\n"
1444 + "\tcpushl %%ic,(%0)\n"
1445 + "\taddq%.l #1,%0\n"
1446 + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set));
1448 + /* next loop will finish the cache ie pass the hole */
1449 + end_set = LAST_ICACHE_ADDR;
1451 + for (set = start_set; set <= end_set; set += (0x10 - 3)) {
1452 + asm volatile("cpushl %%ic,(%0)\n"
1453 + "\taddq%.l #1,%0\n"
1454 + "\tcpushl %%ic,(%0)\n"
1455 + "\taddq%.l #1,%0\n"
1456 + "\tcpushl %%ic,(%0)\n"
1457 + "\taddq%.l #1,%0\n"
1458 + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set));
1463 - * Various defines for the kernel.
1466 -extern void cache_clear(unsigned long paddr, int len);
1467 -extern void cache_push(unsigned long paddr, int len);
1468 -extern void flush_icache_range(unsigned long address, unsigned long endaddr);
1470 -#define flush_cache_all() flush_bcache()
1471 -#define flush_cache_vmap(start, end) flush_bcache()
1472 -#define flush_cache_vunmap(start, end) flush_bcache()
1474 -#define flush_dcache_range(vstart, vend) cf_dcache_flush_range(vstart, vend)
1475 -#define flush_dcache_page(page) __flush_page_to_ram(page_address(page))
1476 -#define flush_dcache_mmap_lock(mapping) do { } while (0)
1477 -#define flush_dcache_mmap_unlock(mapping) do { } while (0)
1479 -#define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page))
1482 - * copy_to_user_page - Copy memory to user page
1484 static inline void copy_to_user_page(struct vm_area_struct *vma,
1485 struct page *page, unsigned long vaddr,
1486 void *dst, void *src, int len)
1488 memcpy(dst, src, len);
1489 - cf_cache_flush(page_to_phys(page), PAGE_SIZE);
1490 + flush_icache_user_page(vma, page, vaddr, len);
1494 - * copy_from_user_page - Copy memory from user page
1496 static inline void copy_from_user_page(struct vm_area_struct *vma,
1497 struct page *page, unsigned long vaddr,
1498 void *dst, void *src, int len)
1500 - cf_cache_flush(page_to_phys(page), PAGE_SIZE);
1501 memcpy(dst, src, len);
1504 +#define flush_cache_vmap(start, end) flush_cache_all()
1505 +#define flush_cache_vunmap(start, end) flush_cache_all()
1506 +#define flush_dcache_mmap_lock(mapping) do { } while (0)
1507 +#define flush_dcache_mmap_unlock(mapping) do { } while (0)
1509 #endif /* M68K_CF_CACHEFLUSH_H */
1510 --- a/include/asm-m68k/cf_pgalloc.h
1511 +++ b/include/asm-m68k/cf_pgalloc.h
1513 #ifndef M68K_CF_PGALLOC_H
1514 #define M68K_CF_PGALLOC_H
1516 -/* JKM -- added -- needed? */
1517 -#include <linux/highmem.h>
1519 #include <asm/coldfire.h>
1520 #include <asm/page.h>
1521 #include <asm/cf_tlbflush.h>
1522 -/* JKM -- added -- needed? */
1523 #include <asm/cf_cacheflush.h>
1525 extern inline void pte_free_kernel(pte_t *pte)
1526 @@ -41,6 +37,7 @@ extern inline pmd_t *pmd_alloc_kernel(pg
1528 #define pmd_populate(mm, pmd, page) (pmd_val(*pmd) = \
1529 (unsigned long)(page_address(page)))
1531 #define pmd_populate_kernel(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
1533 static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page)
1534 --- a/include/asm-m68k/cf_pgtable.h
1535 +++ b/include/asm-m68k/cf_pgtable.h
1536 @@ -341,7 +341,7 @@ static inline pte_t pgoff_to_pte(unsigne
1537 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
1538 #define __swp_entry_to_pte(x) (__pte((x).val))
1540 -#define pmd_page(pmd) virt_to_page(__pmd_page(pmd))
1541 +#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
1543 #define pte_offset_map(pmdp, address) ((pte_t *)__pmd_page(*pmdp) + \
1544 __pte_offset(address))
1545 --- a/include/asm-m68k/cfcache.h
1546 +++ b/include/asm-m68k/cfcache.h
1548 #define CACHE_SETS 0x0200 /* 512 sets */
1549 #define CACHE_WAYS 0x0004 /* 4 way */
1551 +/* in for the old cpushl caching code */
1552 +#define _DCACHE_SET_MASK ((DCACHE_SIZE/64-1)<<CACHE_WAYS)
1553 +#define _ICACHE_SET_MASK ((ICACHE_SIZE/64-1)<<CACHE_WAYS)
1554 +#define LAST_DCACHE_ADDR _DCACHE_SET_MASK
1555 +#define LAST_ICACHE_ADDR _ICACHE_SET_MASK
1557 #define CACHE_DISABLE_MODE (CF_CACR_DCINVA+ \
1560 --- a/include/asm-m68k/page.h
1561 +++ b/include/asm-m68k/page.h
1562 @@ -123,13 +123,21 @@ extern unsigned long m68k_memoffset;
1563 #if defined(CONFIG_COLDFIRE)
1564 static inline unsigned long ___pa(void *vaddr)
1566 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1567 return (((unsigned long)vaddr & 0x0fffffff) + CONFIG_SDRAM_BASE);
1569 + return (unsigned long)vaddr;
1572 #define __pa(vaddr) ___pa((void *)(vaddr))
1574 static inline void *__va(unsigned long paddr)
1576 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1577 return (void *)((paddr & 0x0fffffff) + PAGE_OFFSET);
1579 + return (void *)paddr;
1584 --- a/include/asm-m68k/page_offset.h
1585 +++ b/include/asm-m68k/page_offset.h
1588 + * Page and physical memory maps.
1590 +#if defined(CONFIG_SUN3)
1591 +#define PAGE_OFFSET_RAW 0x0E000000
1593 +#elif defined(CONFIG_M54455) || defined(CONFIG_M547X_8X)
1594 +#define PHYS_OFFSET CONFIG_SDRAM_BASE
1595 +#define PAGE_OFFSET_RAW (PHYS_OFFSET)
1596 +/* #define PAGE_OFFSET_RAW 0xC0000000 */
1598 -/* This handles the memory map.. */
1599 -#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1602 #define PAGE_OFFSET_RAW 0x00000000
1603 -#elif defined(CONFIG_SUN3)
1604 -#define PAGE_OFFSET_RAW 0x0E000000
1605 -#else /* CONFIG_COLDFIRE */
1606 -#if defined(CONFIG_M54455)
1607 -#define PAGE_OFFSET_RAW 0xC0000000
1608 -#define PHYS_OFFSET 0x40000000
1609 -#elif defined(CONFIG_M547X_8X)
1610 -#define PAGE_OFFSET_RAW 0xC0000000
1611 -#define PHYS_OFFSET 0x00000000