1 --- a/arch/m68k/include/asm/atomic_mm.h
2 +++ b/arch/m68k/include/asm/atomic_mm.h
5 static inline void atomic_add(int i, atomic_t *v)
7 +#ifndef CONFIG_COLDFIRE
8 __asm__ __volatile__("addl %1,%0" : "+m" (*v) : "id" (i));
10 + __asm__ __volatile__("addl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
14 static inline void atomic_sub(int i, atomic_t *v)
16 +#ifndef CONFIG_COLDFIRE
17 __asm__ __volatile__("subl %1,%0" : "+m" (*v) : "id" (i));
19 + __asm__ __volatile__("subl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
23 static inline void atomic_inc(atomic_t *v)
24 @@ -45,6 +53,14 @@ static inline int atomic_dec_and_test(at
28 +static __inline__ int atomic_dec_and_test_lt(volatile atomic_t *v)
31 + __asm__ __volatile__("subql #1,%1; slt %0" : "=d" (c), "=m" (*v)
36 static inline int atomic_inc_and_test(atomic_t *v)
39 @@ -155,7 +171,12 @@ static inline int atomic_sub_and_test(in
40 static inline int atomic_add_negative(int i, atomic_t *v)
43 +#ifndef CONFIG_COLDFIRE
44 __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "+m" (*v): "g" (i));
46 + __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "=m" (*v)
47 + : "d" (i) , "m" (*v));
52 --- a/arch/m68k/include/asm/bitops_mm.h
53 +++ b/arch/m68k/include/asm/bitops_mm.h
58 +#ifdef CONFIG_COLDFIRE
59 +#include <asm/cf_bitops.h>
62 #ifndef _LINUX_BITOPS_H
63 #error only <linux/bitops.h> can be included directly
65 @@ -461,4 +465,6 @@ static inline int ext2_find_next_bit(con
67 #endif /* __KERNEL__ */
69 +#endif /* CONFIG_COLDFIRE */
71 #endif /* _M68K_BITOPS_H */
72 --- a/arch/m68k/include/asm/bootinfo.h
73 +++ b/arch/m68k/include/asm/bootinfo.h
75 #define _M68K_BOOTINFO_H
82 + * bd_info structure from uboot1.3.2/arch/m68k/include/asm/u-boot.h
86 + unsigned long bi_memstart; /* start of DRAM memory */
87 + unsigned long bi_memsize; /* size of DRAM memory in bytes */
88 + unsigned long bi_flashstart; /* start of FLASH memory */
89 + unsigned long bi_flashsize; /* size of FLASH memory */
90 + unsigned long bi_flashoffset; /* reserved area for startup monitor */
91 + unsigned long bi_sramstart; /* start of SRAM memory */
92 + unsigned long bi_sramsize; /* size of SRAM memory */
93 + unsigned long bi_mbar_base; /* base of internal registers */
94 + unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
95 + unsigned long bi_boot_params; /* where this board expects params */
96 + unsigned long bi_ip_addr; /* IP Address */
97 + unsigned char bi_enet0addr[6]; /* Ethernet 0 mac address */
98 + unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
99 + unsigned long bi_intfreq; /* Internal Freq, in MHz */
100 + unsigned long bi_busfreq; /* Bus Freq, in MHz */
101 +#ifdef UBOOT_EXTRA_CLOCK
102 + unsigned long bi_inpfreq; /* input Freq in MHz */
103 + unsigned long bi_vcofreq; /* vco Freq in MHz */
104 + unsigned long bi_flbfreq; /* Flexbus Freq in MHz */
106 + unsigned long bi_baudrate; /* Console Baudrate */
107 + unsigned char bi_enet1addr[6]; /* eth1 mac address */
108 + unsigned char bi_enet2addr[6]; /* eth2 mac address */
109 + unsigned char bi_enet3addr[6]; /* eth3 mac address */
112 +struct uboot_record {
113 + struct bd_info *bdi;
114 + unsigned long initrd_start;
115 + unsigned long initrd_end;
116 + unsigned long cmd_line_start;
117 + unsigned long cmd_line_stop;
120 +#endif /* __ASSEMBLY__ */
124 * Bootinfo definitions
126 --- a/arch/m68k/include/asm/cacheflush_mm.h
127 +++ b/arch/m68k/include/asm/cacheflush_mm.h
130 #define FLUSH_I_AND_D (0x00000808)
131 #define FLUSH_I (0x00000008)
132 +#ifdef CONFIG_COLDFIRE
133 +#include <asm/cf_cacheflush.h>
134 +#else /* !CONFIG_COLDFIRE */
137 * Cache handling functions
138 @@ -153,4 +156,5 @@ static inline void copy_from_user_page(s
139 memcpy(dst, src, len);
142 +#endif /* !CONFIG_COLDFIRE */
143 #endif /* _M68K_CACHEFLUSH_H */
144 --- a/arch/m68k/include/asm/checksum_mm.h
145 +++ b/arch/m68k/include/asm/checksum_mm.h
146 @@ -34,6 +34,7 @@ extern __wsum csum_partial_copy_nocheck(
150 +#ifndef CONFIG_COLDFIRE /* CF has own copy in arch/m68k/lib/checksum.c */
152 * This is a version of ip_compute_csum() optimized for IP headers,
153 * which always checksum on 4 octet boundaries.
154 @@ -59,6 +60,9 @@ static inline __sum16 ip_fast_csum(const
156 return (__force __sum16)~sum;
159 +extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
163 * Fold a partial checksum
164 @@ -67,6 +71,11 @@ static inline __sum16 ip_fast_csum(const
165 static inline __sum16 csum_fold(__wsum sum)
167 unsigned int tmp = (__force u32)sum;
168 +#ifdef CONFIG_COLDFIRE
169 + tmp = (tmp & 0xffff) + (tmp >> 16);
170 + tmp = (tmp & 0xffff) + (tmp >> 16);
171 + return (__force __sum16) ~tmp;
173 __asm__("swap %1\n\t"
176 @@ -74,6 +83,7 @@ static inline __sum16 csum_fold(__wsum s
177 : "=&d" (sum), "=&d" (tmp)
178 : "0" (sum), "1" (tmp));
179 return (__force __sum16)~sum;
184 --- a/arch/m68k/include/asm/coldfire.h
185 +++ b/arch/m68k/include/asm/coldfire.h
188 * (C) Copyright 1999-2006, Greg Ungerer (gerg@snapgear.com)
189 * (C) Copyright 2000, Lineo (www.lineo.com)
191 + * Shrek Wu b16972@freescale.com
192 + * Copyright Freescale Semiconductor, Inc. 2009
195 /****************************************************************************/
197 * here. Also the peripheral clock (bus clock) divide ratio is set
198 * at config time too.
202 #ifdef CONFIG_CLOCK_SET
203 #define MCF_CLK CONFIG_CLOCK_FREQ
204 #define MCF_BUSCLK (CONFIG_CLOCK_FREQ / CONFIG_CLOCK_DIV)
206 #error "Don't know what your ColdFire CPU clock frequency is??"
211 +#define MCF_CLK CONFIG_MCFCLK
212 +#define MCF_BUSCLK (CONFIG_MCFCLK/2)
215 +#if defined(CONFIG_M520x)
216 +#define MCF_IPSBAR 0xFC000000
218 +#define MCF_IPSBAR 0x40000000
221 +#if defined(CONFIG_M5445X)
222 +#define MCF_MBAR 0x0
224 + * Even though RAMBAR1 macro should be in the 0x8xxxxxxx range,
225 + * here set the CONFIG_SDRAM_BASE value to it to use
226 + * SDRAM memory, not SRAM memory.
228 +#define MCF_RAMBAR1 (CONFIG_SDRAM_BASE)
229 +#elif defined(CONFIG_M547X_8X)
230 +#define MCF_MBAR 0xF0000000
231 +#define MCF_MMUBAR 0xF1000000
232 +#define MCF_RAMBAR0 0xF3000000
233 +#define MCF_RAMBAR1 0xF3001000
236 * Define the processor support peripherals base address.
237 * This is generally setup by the boards start up code.
239 #define MCF_MBAR 0x10000000
240 #define MCF_MBAR2 0x80000000
241 -#if defined(CONFIG_M520x)
242 -#define MCF_IPSBAR 0xFC000000
244 -#define MCF_IPSBAR 0x40000000
251 +#else /* __ASSEMBLY__ */
252 +#define REG32(x) ((volatile unsigned long *)(x))
253 +#define REG16(x) ((volatile unsigned short *)(x))
254 +#define REG08(x) ((volatile unsigned char *)(x))
256 +#define MCF_REG32(x) *(volatile unsigned long *)(MCF_MBAR+(x))
257 +#define MCF_REG16(x) *(volatile unsigned short *)(MCF_MBAR+(x))
258 +#define MCF_REG08(x) *(volatile unsigned char *)(MCF_MBAR+(x))
260 +void cacr_set(unsigned long);
261 +unsigned long cacr_get(void);
263 +#define coldfire_enable_irq0(irq) MCF_INTC0_CIMR = (irq);
265 +#define coldfire_enable_irq1(irq) MCF_INTC1_CIMR = (irq);
267 +#define coldfire_disable_irq0(irq) MCF_INTC0_SIMR = (irq);
269 +#define coldfire_disable_irq1(irq) MCF_INTC1_SIMR = (irq);
271 +#define getiprh() MCF_INTC0_IPRH
273 +#endif /* __ASSEMBLY__ */
276 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
277 defined(CONFIG_M520x)
279 --- a/arch/m68k/include/asm/delay_mm.h
280 +++ b/arch/m68k/include/asm/delay_mm.h
283 static inline void __delay(unsigned long loops)
285 +#if defined(CONFIG_COLDFIRE)
286 + /* The coldfire runs this loop at significantly different speeds
287 + * depending upon long word alignment or not. We'll pad it to
288 + * long word alignment which is the faster version.
289 + * The 0x4a8e is of course a 'tstl %fp' instruction. This is better
290 + * than using a NOP (0x4e71) instruction because it executes in one
291 + * cycle not three and doesn't allow for an arbitary delay waiting
292 + * for bus cycles to finish. Also fp/a6 isn't likely to cause a
293 + * stall waiting for the register to become valid if such is added
294 + * to the coldfire at some stage.
296 + __asm__ __volatile__ (".balignw 4, 0x4a8e\n\t"
297 + "1: subql #1, %0\n\t"
299 + : "=d" (loops) : "0" (loops));
301 __asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
302 : "=d" (loops) : "0" (loops));
306 extern void __bad_udelay(void);
307 @@ -26,12 +43,17 @@ extern void __bad_udelay(void);
309 static inline void __const_udelay(unsigned long xloops)
311 +#if defined(CONFIG_COLDFIRE)
313 + __delay(((((unsigned long long) xloops * loops_per_jiffy))>>32)*HZ);
317 __asm__ ("mulul %2,%0:%1"
318 : "=d" (xloops), "=d" (tmp)
319 : "d" (xloops), "1" (loops_per_jiffy));
320 __delay(xloops * HZ);
324 static inline void __udelay(unsigned long usecs)
325 @@ -46,12 +68,16 @@ static inline void __udelay(unsigned lon
326 static inline unsigned long muldiv(unsigned long a, unsigned long b,
329 +#if defined(CONFIG_COLDFIRE)
330 + return (long)(((unsigned long long)a * b)/c);
334 __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
335 : "=d" (tmp), "=d" (a)
336 : "d" (b), "d" (c), "1" (a));
341 #endif /* defined(_M68K_DELAY_H) */
342 --- a/arch/m68k/include/asm/div64.h
343 +++ b/arch/m68k/include/asm/div64.h
345 #ifndef _M68K_DIV64_H
346 #define _M68K_DIV64_H
349 +#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
351 #include <linux/types.h>
353 --- a/arch/m68k/include/asm/dma_mm.h
354 +++ b/arch/m68k/include/asm/dma_mm.h
357 /* it's useless on the m68k, but unfortunately needed by the new
358 bootmem allocator (but this should do it for this) */
359 +/*#ifdef CONFIG_COLDFIRE*/
360 +#if defined(CONFIG_M5445X) || defined(CONFIG_M547X_8X)
361 +#define MAX_DMA_ADDRESS 0xefffffff
363 #define MAX_DMA_ADDRESS PAGE_OFFSET
366 +#ifndef CONFIG_COLDFIRE
367 #define MAX_DMA_CHANNELS 8
369 extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
370 extern void free_dma(unsigned int dmanr); /* release it again */
372 +#else /* not (defined(CONFIG_MCF5474) || defined(CONFIG_MCF5484)
373 + || defined(CONFIG_MCF5475) || defined(CONFIG_MCF5485)) */
374 +/************************************************
375 + * Multichannel DMA definitions *
376 + ************************************************/
377 +#ifdef CONFIG_MCD_DMA
378 +#include <asm/MCD_dma.h>
379 +#include <asm/m5485dma.h>
383 +#define MAX_DMA_CHANNELS NCHANNELS
385 + * identifiers for each initiator/requestor
387 +#define DMA_ALWAYS (0)
388 +#define DMA_DSPI_RX (1)
389 +#define DMA_DSPI_TX (2)
390 +#define DMA_DREQ0 (3)
391 +#define DMA_PSC0_RX (4)
392 +#define DMA_PSC0_TX (5)
393 +#define DMA_USBEP0 (6)
394 +#define DMA_USBEP1 (7)
395 +#define DMA_USBEP2 (8)
396 +#define DMA_USBEP3 (9)
397 +#define DMA_PCI_TX (10)
398 +#define DMA_PCI_RX (11)
399 +#define DMA_PSC1_RX (12)
400 +#define DMA_PSC1_TX (13)
401 +#define DMA_I2C_RX (14)
402 +#define DMA_I2C_TX (15)
403 +#define DMA_FEC0_RX (16)
404 +#define DMA_FEC0_TX (17)
405 +#define DMA_FEC1_RX (18)
406 +#define DMA_FEC1_TX (19)
407 +#define DMA_DREQ1 (20)
408 +#define DMA_CTM0 (21)
409 +#define DMA_CTM1 (22)
410 +#define DMA_CTM2 (23)
411 +#define DMA_CTM3 (24)
412 +#define DMA_CTM4 (25)
413 +#define DMA_CTM5 (26)
414 +#define DMA_CTM6 (27)
415 +#define DMA_CTM7 (28)
416 +#define DMA_USBEP4 (29)
417 +#define DMA_USBEP5 (30)
418 +#define DMA_USBEP6 (31)
419 +#define DMA_PSC2_RX (32)
420 +#define DMA_PSC2_TX (33)
421 +#define DMA_PSC3_RX (34)
422 +#define DMA_PSC3_TX (35)
423 +#define DMA_FEC_RX(x) ((x == 0) ? DMA_FEC0_RX : DMA_FEC1_RX)
424 +#define DMA_FEC_TX(x) ((x == 0) ? DMA_FEC0_TX : DMA_FEC1_TX)
426 +int dma_set_initiator(int);
427 +unsigned int dma_get_initiator(int);
428 +void dma_remove_initiator(int);
429 +int dma_set_channel(int);
430 +int dma_get_channel(int);
431 +void dma_remove_channel(int);
432 +int dma_set_channel_fec(int requestor);
433 +int dma_connect(int channel, int address);
434 +int dma_disconnect(int channel);
435 +void dma_remove_channel_by_number(int channel);
437 +#endif /* CONFIG_MCD_DMA */
439 +extern spinlock_t dma_spin_lock;
441 +static __inline__ unsigned long claim_dma_lock(void)
443 + unsigned long flags;
444 + spin_lock_irqsave(&dma_spin_lock, flags);
448 +static __inline__ void release_dma_lock(unsigned long flags)
450 + spin_unlock_irqrestore(&dma_spin_lock, flags);
455 + * Linux standard DMA stuff
458 +int request_dma(unsigned int channel, const char * device_id);
459 +void free_dma(unsigned int channel);
460 +void enable_dma(unsigned int channel);
461 +void disable_dma(unsigned int channel);
462 +int dma_channel_active(unsigned int channel);
463 +void set_dma_sg(unsigned int channel, struct scatterlist *sg, int nr_sg);
464 +void set_dma_page(unsigned int channel, char pagenr);
465 +void set_dma_addr(unsigned int channel, unsigned long physaddr);
466 +void set_dma_count(unsigned int channel, unsigned long count);
467 +void set_dma_mode(unsigned int channel, unsigned int mode);
468 +void set_dma_speed(unsigned int channel, int cycle_ns);
469 +int get_dma_residue(unsigned int channel);
471 +#define clear_dma_ff(channel)
476 +extern int isa_dma_bridge_buggy;
478 #define isa_dma_bridge_buggy (0)
481 #endif /* _M68K_DMA_H */
482 --- a/arch/m68k/include/asm/elf.h
483 +++ b/arch/m68k/include/asm/elf.h
485 #define R_68K_JMP_SLOT 21
486 #define R_68K_RELATIVE 22
488 +/* TLS static relocations */
489 +#define R_68K_TLS_GD32 25
490 +#define R_68K_TLS_GD16 26
491 +#define R_68K_TLS_GD8 27
492 +#define R_68K_TLS_LDM32 28
493 +#define R_68K_TLS_LDM16 29
494 +#define R_68K_TLS_LDM8 30
495 +#define R_68K_TLS_LDO32 31
496 +#define R_68K_TLS_LDO16 32
497 +#define R_68K_TLS_LDO8 33
498 +#define R_68K_TLS_IE32 34
499 +#define R_68K_TLS_IE16 35
500 +#define R_68K_TLS_IE8 36
501 +#define R_68K_TLS_LE32 37
502 +#define R_68K_TLS_LE16 38
503 +#define R_68K_TLS_LE8 39
504 +/* TLS dynamic relocations */
505 +#define R_68K_TLS_DTPMOD32 40
506 +#define R_68K_TLS_DTPREL32 41
507 +#define R_68K_TLS_TPREL32 42
509 typedef unsigned long elf_greg_t;
511 #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
512 @@ -60,7 +81,7 @@ typedef struct user_m68kfp_struct elf_fp
513 #define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
515 #define USE_ELF_CORE_DUMP
517 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
518 #define ELF_EXEC_PAGESIZE 4096
520 #define ELF_EXEC_PAGESIZE 8192
521 @@ -71,8 +92,10 @@ typedef struct user_m68kfp_struct elf_fp
522 the loader. We need to make sure that it is out of the way of the program
523 that it will "exec", and that there is sufficient room for the brk. */
526 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
527 #define ELF_ET_DYN_BASE 0xD0000000UL
528 +#elif defined(CONFIG_COLDFIRE)
529 +#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x10000000)
531 #define ELF_ET_DYN_BASE 0x0D800000UL
533 @@ -116,4 +139,35 @@ typedef struct user_m68kfp_struct elf_fp
535 #define SET_PERSONALITY(ex) set_personality(PER_LINUX)
541 +extern unsigned int vdso_enabled;
543 +#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
544 +#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
546 +#define VDSO_AUX_ENT \
547 + if (vdso_enabled) \
548 + NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);
550 +/* additional pages */
551 +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
553 +struct linux_binprm;
554 +extern int arch_setup_additional_pages(struct linux_binprm *bprm,
555 + int executable_stack);
558 +/* no VDSO_AUX_ENT */
559 +#define VDSO_AUX_ENT
562 +#define ARCH_DLINFO \
569 --- a/arch/m68k/include/asm/io_mm.h
570 +++ b/arch/m68k/include/asm/io_mm.h
572 * - added skeleton for GG-II and Amiga PCMCIA
573 * 2/3/01 RZ: - moved a few more defs into raw_io.h
575 - * inX/outX should not be used by any driver unless it does
576 - * ISA access. Other drivers should use function defined in raw_io.h
577 + * inX/outX/readX/writeX should not be used by any driver unless it does
578 + * ISA or PCI access. Other drivers should use function defined in raw_io.h
579 * or define its own macros on top of these.
581 - * inX(),outX() are for ISA I/O
582 + * inX(),outX() are for PCI and ISA I/O
583 + * readX(),writeX() are for PCI memory
584 * isa_readX(),isa_writeX() are for ISA memory
586 + * moved mem{cpy,set}_*io inside CONFIG_PCI
592 +#ifdef CONFIG_COLDFIRE
593 +#include <asm/cf_io.h>
598 #include <linux/compiler.h>
599 @@ -88,20 +95,20 @@ extern unsigned long gg2_isa_base;
603 -#define ISA_TYPE_Q40 (1)
604 -#define ISA_TYPE_GG2 (2)
605 -#define ISA_TYPE_AG (3)
610 #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
611 -#define ISA_TYPE ISA_TYPE_Q40
612 +#define ISA_TYPE Q40_ISA
615 #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
616 -#define ISA_TYPE ISA_TYPE_AG
617 +#define ISA_TYPE AG_ISA
620 #if defined(CONFIG_GG2) && !defined(MULTI_ISA)
621 -#define ISA_TYPE ISA_TYPE_GG2
622 +#define ISA_TYPE GG2_ISA
626 @@ -123,13 +130,13 @@ static inline u8 __iomem *isa_itb(unsign
630 - case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_IO_B(addr);
631 + case Q40_ISA: return (u8 __iomem *)Q40_ISA_IO_B(addr);
634 - case ISA_TYPE_GG2: return (u8 __iomem *)GG2_ISA_IO_B(addr);
635 + case GG2_ISA: return (u8 __iomem *)GG2_ISA_IO_B(addr);
637 #ifdef CONFIG_AMIGA_PCMCIA
638 - case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
639 + case AG_ISA: return (u8 __iomem *)AG_ISA_IO_B(addr);
641 default: return NULL; /* avoid warnings, just in case */
643 @@ -139,13 +146,13 @@ static inline u16 __iomem *isa_itw(unsig
647 - case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_IO_W(addr);
648 + case Q40_ISA: return (u16 __iomem *)Q40_ISA_IO_W(addr);
651 - case ISA_TYPE_GG2: return (u16 __iomem *)GG2_ISA_IO_W(addr);
652 + case GG2_ISA: return (u16 __iomem *)GG2_ISA_IO_W(addr);
654 #ifdef CONFIG_AMIGA_PCMCIA
655 - case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
656 + case AG_ISA: return (u16 __iomem *)AG_ISA_IO_W(addr);
658 default: return NULL; /* avoid warnings, just in case */
660 @@ -155,7 +162,7 @@ static inline u32 __iomem *isa_itl(unsig
663 #ifdef CONFIG_AMIGA_PCMCIA
664 - case ISA_TYPE_AG: return (u32 __iomem *)AG_ISA_IO_W(addr);
665 + case AG_ISA: return (u32 __iomem *)AG_ISA_IO_W(addr);
667 default: return 0; /* avoid warnings, just in case */
669 @@ -165,13 +172,13 @@ static inline u8 __iomem *isa_mtb(unsign
673 - case ISA_TYPE_Q40: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
674 + case Q40_ISA: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
677 - case ISA_TYPE_GG2: return (u8 __iomem *)GG2_ISA_MEM_B(addr);
678 + case GG2_ISA: return (u8 __iomem *)GG2_ISA_MEM_B(addr);
680 #ifdef CONFIG_AMIGA_PCMCIA
681 - case ISA_TYPE_AG: return (u8 __iomem *)addr;
682 + case AG_ISA: return (u8 __iomem *)addr;
684 default: return NULL; /* avoid warnings, just in case */
686 @@ -181,13 +188,13 @@ static inline u16 __iomem *isa_mtw(unsig
690 - case ISA_TYPE_Q40: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
691 + case Q40_ISA: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
694 - case ISA_TYPE_GG2: return (u16 __iomem *)GG2_ISA_MEM_W(addr);
695 + case GG2_ISA: return (u16 __iomem *)GG2_ISA_MEM_W(addr);
697 #ifdef CONFIG_AMIGA_PCMCIA
698 - case ISA_TYPE_AG: return (u16 __iomem *)addr;
699 + case AG_ISA: return (u16 __iomem *)addr;
701 default: return NULL; /* avoid warnings, just in case */
703 @@ -201,30 +208,29 @@ static inline u16 __iomem *isa_mtw(unsig
704 #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val)))
705 #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val)))
707 -#define isa_readb(p) in_8(isa_mtb((unsigned long)(p)))
708 -#define isa_readw(p) \
709 - (ISA_SEX ? in_be16(isa_mtw((unsigned long)(p))) \
710 - : in_le16(isa_mtw((unsigned long)(p))))
711 -#define isa_writeb(val,p) out_8(isa_mtb((unsigned long)(p)),(val))
712 -#define isa_writew(val,p) \
713 - (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \
714 - : out_le16(isa_mtw((unsigned long)(p)),(val)))
716 +#define isa_readb(p) in_8(isa_mtb(p))
717 +#define isa_readw(p) (ISA_SEX ? in_be16(isa_mtw(p)) : in_le16(isa_mtw(p)))
718 +#define isa_writeb(val,p) out_8(isa_mtb(p),(val))
719 +#define isa_writew(val,p) (ISA_SEX ? out_be16(isa_mtw(p),(val)) : out_le16(isa_mtw(p),(val)))
720 static inline void isa_delay(void)
724 + switch (ISA_TYPE) {
726 - case ISA_TYPE_Q40: isa_outb(0,0x80); break;
732 - case ISA_TYPE_GG2: break;
736 #ifdef CONFIG_AMIGA_PCMCIA
737 - case ISA_TYPE_AG: break;
741 - default: break; /* avoid warnings */
744 + break; /* avoid warnings */
748 #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;})
749 @@ -253,7 +259,10 @@ static inline void isa_delay(void)
750 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \
751 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
753 +#endif /* CONFIG_ISA */
756 +#if defined(CONFIG_ISA) && !defined(CONFIG_PCI)
758 #define inb_p isa_inb_p
759 #define outb isa_outb
760 @@ -276,9 +285,80 @@ static inline void isa_delay(void)
761 #define readw isa_readw
762 #define writeb isa_writeb
763 #define writew isa_writew
764 +#endif /* CONFIG_ISA */
766 +#if defined(CONFIG_PCI)
768 +#define readl(addr) in_le32(addr)
769 +#define writel(val, addr) out_le32((addr), (val))
771 +/* those can be defined for both ISA and PCI - it won't work though */
772 +#define readb(addr) in_8(addr)
773 +#define readw(addr) in_le16(addr)
774 +#define writeb(val, addr) out_8((addr), (val))
775 +#define writew(val, addr) out_le16((addr), (val))
777 +#define readb_relaxed(addr) readb(addr)
778 +#define readw_relaxed(addr) readw(addr)
779 +#define readl_relaxed(addr) readl(addr)
782 +#define inb(port) in_8(port)
783 +#define outb(val, port) out_8((port), (val))
784 +#define inw(port) in_le16(port)
785 +#define outw(val, port) out_le16((port), (val))
786 +#define inl(port) in_le32(port)
787 +#define outl(val, port) out_le32((port), (val))
788 +#define insb(port, buf, nr) \
789 + raw_insb((u8 *)(port), (u8 *)(buf), (nr))
790 +#define outsb(port, buf, nr) \
791 + raw_outsb((u8 *)(port), (u8 *)(buf), (nr))
792 +#define insw(port, buf, nr) \
793 + raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr))
794 +#define outsw(port, buf, nr) \
795 + raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr))
796 +#define insl(port, buf, nr) \
797 + raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
798 +#define outsl(port, buf, nr) \
799 + raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
801 +#define __raw_readb readb
802 +#define __raw_readw readw
803 +#define __raw_readl readl
804 +#define __raw_writeb writeb
805 +#define __raw_writew writew
806 +#define __raw_writel writel
808 -#else /* CONFIG_ISA */
811 + * kernel with both ISA and PCI compiled in, those have
812 + * conflicting defs for in/out. Simply consider port < 1024
813 + * ISA and everything else PCI. read,write not defined
816 +#define inb(port) ((port) < 1024 ? isa_inb(port) : in_8(port))
817 +#define inb_p(port) ((port) < 1024 ? isa_inb_p(port) : in_8(port))
818 +#define inw(port) ((port) < 1024 ? isa_inw(port) : in_le16(port))
819 +#define inw_p(port) ((port) < 1024 ? isa_inw_p(port) : in_le16(port))
820 +#define inl(port) ((port) < 1024 ? isa_inl(port) : in_le32(port))
821 +#define inl_p(port) ((port) < 1024 ? isa_inl_p(port) : in_le32(port))
823 +#define outb(val, port) (((port) < 1024) ? isa_outb((val), (port))
824 + : out_8((port), (val)))
825 +#define outb_p(val, port) (((port) < 1024) ? isa_outb_p((val), (port))
826 + : out_8((port), (val)))
827 +#define outw(val, port) (((port) < 1024) ? isa_outw((val), (port))
828 + : out_le16((port), (val)))
829 +#define outw_p(val, port) (((port) < 1024) ? isa_outw_p((val), (port))
830 + : out_le16((port), (val)))
831 +#define outl(val, port) (((port) < 1024) ? isa_outl((val), (port))
832 + : out_le32((port), (val)))
833 +#define outl_p(val, port) (((port) < 1024) ? isa_outl_p((val), (port))
834 + : out_le32((port), (val)))
836 +#endif /* CONFIG_PCI */
838 +#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI)
840 * We need to define dummy functions for GENERIC_IOMAP support.
842 @@ -305,11 +385,11 @@ static inline void isa_delay(void)
843 #define writeb(val,addr) out_8((addr),(val))
844 #define readw(addr) in_le16(addr)
845 #define writew(val,addr) out_le16((addr),(val))
847 -#endif /* CONFIG_ISA */
850 +#if !defined(CONFIG_PCI)
851 #define readl(addr) in_le32(addr)
852 #define writel(val,addr) out_le32((addr),(val))
857 @@ -345,10 +425,10 @@ static inline void memcpy_toio(volatile
858 __builtin_memcpy((void __force *) dst, src, count);
862 -#define IO_SPACE_LIMIT 0xffff
864 +#if defined(CONFIG_SUN3)
865 #define IO_SPACE_LIMIT 0x0fffffff
867 +#define IO_SPACE_LIMIT 0xffff
870 #endif /* __KERNEL__ */
871 @@ -366,4 +446,5 @@ static inline void memcpy_toio(volatile
873 #define xlate_dev_kmem_ptr(p) p
875 +#endif /* CONFIG_COLDFIRE */
877 --- a/arch/m68k/include/asm/irq_mm.h
878 +++ b/arch/m68k/include/asm/irq_mm.h
880 * Currently the Atari has 72 and the Amiga 24, but if both are
881 * supported in the kernel it is better to make room for 72.
883 -#if defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
884 +#if defined(CONFIG_COLDFIRE)
885 +#define SYS_IRQS 256
886 +#define NR_IRQS SYS_IRQS
887 +#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
889 #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
891 --- a/arch/m68k/include/asm/machdep_mm.h
892 +++ b/arch/m68k/include/asm/machdep_mm.h
893 @@ -32,4 +32,11 @@ extern void (*mach_heartbeat) (int);
894 extern void (*mach_l2_flush) (int);
895 extern void (*mach_beep) (unsigned int, unsigned int);
897 +#ifdef CONFIG_COLDFIRE
898 +extern void __init config_coldfire(void);
899 +extern void __init mmu_context_init(void);
900 +extern irq_handler_t mach_default_handler;
901 +extern void (*mach_tick)(void);
904 #endif /* _M68K_MACHDEP_H */
905 --- a/arch/m68k/include/asm/mcfsim.h
906 +++ b/arch/m68k/include/asm/mcfsim.h
908 #include <asm/m5407sim.h>
911 +#if defined(CONFIG_COLDFIRE)
912 +#include <asm/coldfire.h>
915 +#if defined(CONFIG_M5445X)
916 +#include <asm/mcf5445x_intc.h>
917 +#include <asm/mcf5445x_gpio.h>
918 +#include <asm/mcf5445x_ccm.h>
919 +#include <asm/mcf5445x_eport.h>
920 +#include <asm/mcf5445x_fbcs.h>
921 +#include <asm/mcf5445x_xbs.h>
922 +#include <asm/mcf5445x_dtim.h>
923 +#include <asm/mcf5445x_rtc.h>
924 +#include <asm/mcf5445x_scm.h>
925 +#elif defined(CONFIG_M547X_8X)
926 +#include <asm/m5485sim.h>
927 +#include <asm/m5485gpio.h>
928 +#include <asm/m5485gpt.h>
932 * Define the base address of the SIM within the MBAR address space.
933 --- a/arch/m68k/include/asm/mmu_context.h
934 +++ b/arch/m68k/include/asm/mmu_context.h
935 @@ -8,7 +8,7 @@ static inline void enter_lazy_tlb(struct
940 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
942 #include <asm/setup.h>
943 #include <asm/page.h>
944 @@ -103,7 +103,7 @@ static inline void activate_mm(struct mm
945 switch_mm_0460(next_mm);
948 -#else /* CONFIG_SUN3 */
949 +#elif defined(CONFIG_SUN3)
950 #include <asm/sun3mmu.h>
951 #include <linux/sched.h>
953 @@ -151,7 +151,179 @@ static inline void activate_mm(struct mm
954 activate_context(next_mm);
957 +#else /* CONFIG_COLDFIRE */
959 +#include <asm/coldfire.h>
960 +#include <asm/atomic.h>
961 +#include <asm/bitops.h>
962 +#include <asm/mmu.h>
964 +#define NO_CONTEXT 256
965 +#define LAST_CONTEXT 255
966 +#define FIRST_CONTEXT 1
969 +#define cpu_context(mm) ((mm)->context.id)
971 +#define cpu_context(mm) ((mm)->context)
975 +extern void set_context(unsigned long context, pgd_t *pgd);
977 +extern void set_context(mm_context_t context, pgd_t *pgd);
979 +extern unsigned long context_map[];
981 +extern unsigned long next_mmu_context;
983 +extern mm_context_t next_mmu_context;
987 +extern atomic_t nr_free_contexts;
988 +extern struct mm_struct *context_mm[LAST_CONTEXT+1];
989 +extern void steal_context(void);
991 +static inline void get_mmu_context(struct mm_struct *mm)
999 + if (cpu_context(mm) != NO_CONTEXT)
1001 + while (atomic_dec_and_test_lt(&nr_free_contexts)) {
1002 + atomic_inc(&nr_free_contexts);
1005 + ctx = next_mmu_context;
1006 + while (test_and_set_bit(ctx, context_map)) {
1007 + ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
1008 + if (ctx > LAST_CONTEXT)
1011 + next_mmu_context = (ctx + 1) & LAST_CONTEXT;
1012 + cpu_context(mm) = ctx;
1013 + context_mm[ctx] = mm;
1017 + * Set up the context for a new address space.
1019 +#define init_new_context(tsk, mm) ((cpu_context(mm) = NO_CONTEXT), 0)
1020 +/* #define init_new_context(tsk, mm) (((mm)->context = NO_CONTEXT), 0) */
1023 + * We're finished using the context for an address space.
1025 +static inline void destroy_context(struct mm_struct *mm)
1027 + if (cpu_context(mm) != NO_CONTEXT) {
1028 + clear_bit(cpu_context(mm), context_map);
1029 + cpu_context(mm) = NO_CONTEXT;
1030 + atomic_inc(&nr_free_contexts);
1034 +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
1035 + struct task_struct *tsk)
1037 + get_mmu_context(tsk->mm);
1038 + set_context(cpu_context(tsk->mm), next->pgd);
1042 + * After we have set current->mm to a new value, this activates
1043 + * the context for the new mm so we see the new mappings.
1045 +static inline void activate_mm(struct mm_struct *active_mm,
1046 + struct mm_struct *mm)
1048 + get_mmu_context(mm);
1049 + set_context(cpu_context(mm), mm->pgd);
1052 +#define deactivate_mm(tsk, mm) do { } while (0)
1054 +extern void mmu_context_init(void);
1055 +#if defined(CONFIG_M547X_8X)
1056 +#define prepare_arch_switch(next) load_ksp_mmu(next)
1058 +static inline void load_ksp_mmu(struct task_struct *task)
1061 + struct mm_struct *mm;
1066 + unsigned long mmuar;
1068 + local_irq_save(flags);
1069 + mmuar = task->thread.ksp;
1071 + /* Search for a valid TLB entry, if one is found, don't remap */
1073 + *MMUOR = MMUOR_STLB | MMUOR_ADR;
1074 + if ((*MMUSR) & MMUSR_HIT)
1077 + if (mmuar >= PAGE_OFFSET) {
1080 + printk(KERN_INFO "load_ksp_mmu: non-kernel"
1081 + " mm found: 0x%08x\n", (unsigned int) task->mm);
1088 + pgd = pgd_offset(mm, mmuar);
1089 + if (pgd_none(*pgd))
1092 + pmd = pmd_offset(pgd, mmuar);
1093 + if (pmd_none(*pmd))
1096 + pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar)
1097 + : pte_offset_map(pmd, mmuar);
1098 + if (pte_none(*pte) || !pte_present(*pte))
1101 + set_pte(pte, pte_mkyoung(*pte));
1102 + asid = cpu_context(mm) & 0xff;
1103 + if (!pte_dirty(*pte) && mmuar <= PAGE_OFFSET)
1104 + set_pte(pte, pte_wrprotect(*pte));
1106 + *MMUTR = (mmuar & PAGE_MASK) | (asid << CF_ASID_MMU_SHIFT)
1107 + | (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK)
1108 + >> CF_PAGE_MMUTR_SHIFT)
1111 + *MMUDR = (pte_val(*pte) & PAGE_MASK)
1112 + | ((pte->pte) & CF_PAGE_MMUDR_MASK)
1113 + | MMUDR_SZ8K | MMUDR_X;
1115 + *MMUOR = MMUOR_ACC | MMUOR_UAA;
1121 + printk(KERN_ERR "ksp load failed: mm=0x%08x ksp=0x%08x\n",
1122 + (unsigned int) mm, (unsigned int) mmuar);
1124 + local_irq_restore(flags);
1126 +#endif /* CONFIG_M547X_8X */
1128 +#endif /* CONFIG_COLDFIRE */
1130 #else /* !CONFIG_MMU */
1132 static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
1133 --- a/arch/m68k/include/asm/page_mm.h
1134 +++ b/arch/m68k/include/asm/page_mm.h
1136 #ifndef _M68K_PAGE_H
1137 #define _M68K_PAGE_H
1139 +/*#if defined(CONFIG_COLDFIRE)*/
1140 +#if defined(CONFIG_M5445X) || defined(CONFIG_M547X_8X)
1141 +#include <asm/cf_page.h>
1144 #include <linux/const.h>
1146 /* PAGE_SHIFT determines the page size */
1147 -#ifndef CONFIG_SUN3
1148 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1149 #define PAGE_SHIFT (12)
1151 #define PAGE_SHIFT (13)
1152 @@ -113,10 +118,31 @@ typedef struct page *pgtable_t;
1154 extern unsigned long m68k_memoffset;
1156 -#ifndef CONFIG_SUN3
1157 +#if !defined(CONFIG_SUN3)
1159 #define WANT_PAGE_VIRTUAL
1161 +#if defined(CONFIG_COLDFIRE)
1162 +static inline unsigned long ___pa(void *vaddr)
1164 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1165 + return (((unsigned long)vaddr & 0x0fffffff) + CONFIG_SDRAM_BASE);
1167 + return (unsigned long)vaddr;
1170 +#define __pa(vaddr) ___pa((void *)(vaddr))
1172 +static inline void *__va(unsigned long paddr)
1174 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1175 + return (void *)((paddr & 0x0fffffff) + PAGE_OFFSET);
1177 + return (void *)paddr;
1182 static inline unsigned long ___pa(void *vaddr)
1184 unsigned long paddr;
1185 @@ -138,6 +164,7 @@ static inline void *__va(unsigned long p
1186 : "0" (paddr), "i" (m68k_fixup_memoffset));
1191 #else /* !CONFIG_SUN3 */
1192 /* This #define is a horrible hack to suppress lots of warnings. --m */
1193 @@ -169,6 +196,8 @@ static inline void *__va(unsigned long x
1194 * memory node, but we have no highmem, so that works for now.
1195 * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots
1196 * of the shifts unnecessary.
1198 + * PFNs are used to map physical pages. So PFN[0] maps to the base phys addr.
1200 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
1201 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
1202 @@ -225,4 +254,10 @@ static inline __attribute_const__ int __
1204 #include <asm-generic/getorder.h>
1208 +#define __HAVE_ARCH_GATE_AREA
1211 +#endif /* !CONFIG_COLDFIRE */
1212 #endif /* _M68K_PAGE_H */
1213 --- a/arch/m68k/include/asm/page_offset.h
1214 +++ b/arch/m68k/include/asm/page_offset.h
1216 /* This handles the memory map.. */
1219 -#ifndef CONFIG_SUN3
1220 -#define PAGE_OFFSET_RAW 0x00000000
1222 +#if defined(CONFIG_SUN3)
1223 #define PAGE_OFFSET_RAW 0x0E000000
1224 +#elif defined(CONFIG_M5445X) || defined(CONFIG_M547X_8X)
1225 +#define PHYS_OFFSET CONFIG_SDRAM_BASE
1226 +#define PAGE_OFFSET_RAW (PHYS_OFFSET)
1228 +#define PAGE_OFFSET_RAW 0x00000000
1231 #define PAGE_OFFSET_RAW CONFIG_RAMBASE
1232 --- a/arch/m68k/include/asm/pgalloc.h
1233 +++ b/arch/m68k/include/asm/pgalloc.h
1237 #include <asm/virtconvert.h>
1239 +#if defined (CONFIG_SUN3)
1240 #include <asm/sun3_pgalloc.h>
1241 +#elif defined(CONFIG_COLDFIRE)
1242 +#include <asm/cf_pgalloc.h>
1244 #include <asm/motorola_pgalloc.h>
1246 --- a/arch/m68k/include/asm/pgtable_mm.h
1247 +++ b/arch/m68k/include/asm/pgtable_mm.h
1249 /* PGDIR_SHIFT determines what a third-level page table entry can map */
1251 #define PGDIR_SHIFT 17
1252 +#elif defined(CONFIG_COLDFIRE)
1253 +#define PGDIR_SHIFT 22
1255 #define PGDIR_SHIFT 25
1258 #define PTRS_PER_PTE 16
1259 #define PTRS_PER_PMD 1
1260 #define PTRS_PER_PGD 2048
1261 +#elif defined(CONFIG_COLDFIRE)
1262 +#define PTRS_PER_PTE 512
1263 +#define PTRS_PER_PMD 1
1264 +#define PTRS_PER_PGD 1024
1266 #define PTRS_PER_PTE 1024
1267 #define PTRS_PER_PMD 8
1270 #define KMAP_START 0x0DC00000
1271 #define KMAP_END 0x0E000000
1272 +#elif defined(CONFIG_COLDFIRE)
1273 +#define VMALLOC_START 0xc0000000
1274 +#define VMALLOC_END 0xcfffffff
1275 +#define KMAP_START (VMALLOC_END + 1)
1276 +#define KMAP_END 0xe8000000
1278 #define KMAP_START 0xd0000000
1279 #define KMAP_END 0xf0000000
1281 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
1282 * area for the same reason. ;)
1284 +#if !defined(CONFIG_COLDFIRE)
1285 #define VMALLOC_OFFSET (8*1024*1024)
1286 #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
1287 #define VMALLOC_END KMAP_START
1290 extern unsigned long vmalloc_end;
1291 #define VMALLOC_START 0x0f800000
1292 @@ -130,6 +143,8 @@ static inline void update_mmu_cache(stru
1295 #include <asm/sun3_pgtable.h>
1296 +#elif defined(CONFIG_COLDFIRE)
1297 +#include <asm/cf_pgtable.h>
1299 #include <asm/motorola_pgtable.h>
1301 @@ -138,6 +153,9 @@ static inline void update_mmu_cache(stru
1303 * Macro to mark a page protection value as "uncacheable".
1305 +#ifdef CONFIG_COLDFIRE
1306 +# define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | CF_PAGE_NOCACHE))
1307 +#else /* CONFIG_COLDFIRE */
1308 #ifdef SUN3_PAGE_NOCACHE
1309 # define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE
1311 @@ -152,6 +170,7 @@ static inline void update_mmu_cache(stru
1312 ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \
1315 +#endif /* CONFIG_COLDFIRE */
1316 #include <asm-generic/pgtable.h>
1317 #endif /* !__ASSEMBLY__ */
1319 --- a/arch/m68k/include/asm/processor_mm.h
1320 +++ b/arch/m68k/include/asm/processor_mm.h
1322 * include/asm-m68k/processor.h
1324 * Copyright (C) 1995 Hamish Macdonald
1325 + * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
1328 #ifndef __ASM_M68K_PROCESSOR_H
1329 @@ -22,24 +23,38 @@ static inline unsigned long rdusp(void)
1333 +#ifndef CONFIG_COLDFIRE
1334 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
1336 + __asm__ __volatile__("movel %/usp,%0" : "=a" (usp));
1341 static inline void wrusp(unsigned long usp)
1343 +#ifndef CONFIG_COLDFIRE
1344 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
1346 + __asm__ __volatile__("movel %0,%/usp" : : "a" (usp));
1351 * User space process size: 3.75GB. This is hardcoded into a few places,
1352 * so don't change it unless you know what you are doing.
1354 -#ifndef CONFIG_SUN3
1355 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1356 #define TASK_SIZE (0xF0000000UL)
1357 +#elif defined(CONFIG_COLDFIRE)
1358 +#define TASK_SIZE (0xC0000000UL)
1359 +#else /* CONFIG_SUN3 */
1360 +#ifdef __ASSEMBLY__
1361 +#define TASK_SIZE (0x0E000000)
1363 #define TASK_SIZE (0x0E000000UL)
1368 #define STACK_TOP TASK_SIZE
1369 @@ -49,9 +64,11 @@ static inline void wrusp(unsigned long u
1370 /* This decides where the kernel will search for a free chunk of vm
1371 * space during mmap's.
1373 -#ifndef CONFIG_SUN3
1374 -#define TASK_UNMAPPED_BASE 0xC0000000UL
1376 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1377 +#define TASK_UNMAPPED_BASE 0xC0000000UL
1378 +#elif defined(CONFIG_COLDFIRE)
1379 +#define TASK_UNMAPPED_BASE 0x60000000UL
1380 +#else /* CONFIG_SUN3 */
1381 #define TASK_UNMAPPED_BASE 0x0A000000UL
1383 #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
1384 @@ -60,7 +77,11 @@ struct thread_struct {
1385 unsigned long ksp; /* kernel stack pointer */
1386 unsigned long usp; /* user stack pointer */
1387 unsigned short sr; /* saved status register */
1388 +#ifndef CONFIG_COLDFIRE
1389 unsigned short fs; /* saved fs (sfc, dfc) */
1393 unsigned long crp[2]; /* cpu root pointer */
1394 unsigned long esp0; /* points to SR of stack frame */
1395 unsigned long faddr; /* info about last fault */
1396 @@ -81,6 +102,7 @@ struct thread_struct {
1398 * Do necessary setup to start up a newly executed thread.
1400 +#ifndef CONFIG_COLDFIRE
1401 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
1404 @@ -91,6 +113,23 @@ static inline void start_thread(struct p
1405 regs->sr &= ~0x2000;
1410 + * Do necessary setup to start up a newly executed thread.
1412 + * pass the data segment into user programs if it exists,
1413 + * it can't hurt anything as far as I can tell
1415 +#define start_thread(_regs, _pc, _usp) \
1417 + set_fs(USER_DS); /* reads from user space */ \
1418 + (_regs)->pc = (_pc); \
1419 + if (current->mm) \
1420 + (_regs)->d5 = current->mm->start_data; \
1421 + (_regs)->sr &= ~0x2000; \
1426 /* Forward declaration, a strange C thing */
1428 --- a/arch/m68k/include/asm/ptrace.h
1429 +++ b/arch/m68k/include/asm/ptrace.h
1430 @@ -39,10 +39,21 @@ struct pt_regs {
1433 #ifdef CONFIG_COLDFIRE
1435 unsigned format : 4; /* frame format specifier */
1436 unsigned vector : 12; /* vector offset */
1441 + unsigned long mmuar;
1442 + unsigned long mmusr;
1443 + unsigned format : 4; /* frame format specifier */
1445 + unsigned vector: 8;
1447 + unsigned short sr;
1452 @@ -71,6 +82,8 @@ struct switch_stack {
1453 #define PTRACE_GETFPREGS 14
1454 #define PTRACE_SETFPREGS 15
1456 +#define PTRACE_GET_THREAD_AREA 25
1461 --- a/arch/m68k/include/asm/raw_io.h
1462 +++ b/arch/m68k/include/asm/raw_io.h
1467 +#ifdef CONFIG_COLDFIRE
1468 +#include <asm/cf_raw_io.h>
1473 #include <asm/types.h>
1474 @@ -60,6 +64,9 @@ extern void __iounmap(void *addr, unsign
1475 #define __raw_writew(val,addr) out_be16((addr),(val))
1476 #define __raw_writel(val,addr) out_be32((addr),(val))
1478 +#define swap_inw(port) in_le16((port))
1479 +#define swap_outw(val,port) out_le16((port),(val))
1481 static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
1484 @@ -344,4 +351,6 @@ static inline void raw_outsw_swapw(volat
1486 #endif /* __KERNEL__ */
1488 +#endif /* CONFIG_COLDFIRE */
1490 #endif /* _RAW_IO_H */
1491 --- a/arch/m68k/include/asm/segment.h
1492 +++ b/arch/m68k/include/asm/segment.h
1493 @@ -29,6 +29,7 @@ typedef struct {
1494 * Get/set the SFC/DFC registers for MOVES instructions
1497 +#ifndef CONFIG_COLDFIRE
1498 static inline mm_segment_t get_fs(void)
1501 @@ -56,6 +57,15 @@ static inline void set_fs(mm_segment_t v
1505 +#else /* CONFIG_COLDFIRE */
1507 +#include <asm/current.h>
1508 +#define get_fs() (current->thread.fs)
1509 +#define set_fs(val) (current->thread.fs = (val))
1510 +#define get_ds() (KERNEL_DS)
1512 +#endif /* CONFIG_COLDFIRE */
1514 #define segment_eq(a,b) ((a).seg == (b).seg)
1516 #endif /* __ASSEMBLY__ */
1517 --- a/arch/m68k/include/asm/setup.h
1518 +++ b/arch/m68k/include/asm/setup.h
1520 ** asm/setup.h -- Definition of the Linux/m68k setup information
1522 ** Copyright 1992 by Greg Harp
1523 + * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
1525 ** This file is subject to the terms and conditions of the GNU General Public
1526 ** License. See the file COPYING in the main directory of this archive
1528 #define MACH_HP300 9
1530 #define MACH_SUN3X 11
1531 +#define MACH_CFMMU 12
1533 #define COMMAND_LINE_SIZE 256
1535 @@ -189,6 +191,14 @@ extern unsigned long m68k_machtype;
1536 # define MACH_TYPE (MACH_SUN3X)
1539 +#if !defined(CONFIG_COLDFIRE)
1540 +# define MACH_IS_COLDFIRE (0)
1542 +# define CONFIG_COLDFIRE_ONLY
1543 +# define MACH_IS_COLDFIRE (1)
1544 +# define MACH_TYPE (MACH_CFMMU)
1548 # define MACH_TYPE (m68k_machtype)
1550 @@ -211,23 +221,31 @@ extern unsigned long m68k_machtype;
1551 #define CPUB_68030 1
1552 #define CPUB_68040 2
1553 #define CPUB_68060 3
1554 +#define CPUB_CFV4E 4
1556 #define CPU_68020 (1<<CPUB_68020)
1557 #define CPU_68030 (1<<CPUB_68030)
1558 #define CPU_68040 (1<<CPUB_68040)
1559 #define CPU_68060 (1<<CPUB_68060)
1560 +#define CPU_CFV4E (1<<CPUB_CFV4E)
1562 #define FPUB_68881 0
1563 #define FPUB_68882 1
1564 #define FPUB_68040 2 /* Internal FPU */
1565 #define FPUB_68060 3 /* Internal FPU */
1566 #define FPUB_SUNFPA 4 /* Sun-3 FPA */
1567 +#define FPUB_CFV4E 5
1569 #define FPU_68881 (1<<FPUB_68881)
1570 #define FPU_68882 (1<<FPUB_68882)
1571 #define FPU_68040 (1<<FPUB_68040)
1572 #define FPU_68060 (1<<FPUB_68060)
1573 #define FPU_SUNFPA (1<<FPUB_SUNFPA)
1574 +#ifdef CONFIG_M547X_8X
1575 +#define FPU_CFV4E (1<<FPUB_CFV4E)
1577 +#define FPU_CFV4E 0
1580 #define MMUB_68851 0
1581 #define MMUB_68030 1 /* Internal MMU */
1582 @@ -235,6 +253,7 @@ extern unsigned long m68k_machtype;
1583 #define MMUB_68060 3 /* Internal MMU */
1584 #define MMUB_APOLLO 4 /* Custom Apollo */
1585 #define MMUB_SUN3 5 /* Custom Sun-3 */
1586 +#define MMUB_CFV4E 6
1588 #define MMU_68851 (1<<MMUB_68851)
1589 #define MMU_68030 (1<<MMUB_68030)
1590 @@ -242,6 +261,7 @@ extern unsigned long m68k_machtype;
1591 #define MMU_68060 (1<<MMUB_68060)
1592 #define MMU_SUN3 (1<<MMUB_SUN3)
1593 #define MMU_APOLLO (1<<MMUB_APOLLO)
1594 +#define MMU_CFV4E (1<<MMUB_CFV4E)
1598 @@ -341,6 +361,14 @@ extern int m68k_is040or060;
1602 +#if !defined(CONFIG_CFV4E)
1603 +# define CPU_IS_COLDFIRE (0)
1605 +# define CPU_IS_COLDFIRE (m68k_cputype & CPU_CFV4E)
1606 +# define CPU_IS_CFV4E (m68k_cputype & CPU_CFV4E)
1607 +# define MMU_IS_CFV4E (m68k_mmutype & MMU_CFV4E)
1610 #define CPU_TYPE (m68k_cputype)
1612 #ifdef CONFIG_M68KFPU_EMU
1613 @@ -371,6 +399,14 @@ extern int m68k_realnum_memory; /* real
1614 extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
1617 +#ifdef CONFIG_CFV4E
1618 +#define QCHIP_RESTORE_DIRECTIVE ".chip 547x"
1619 +#define CHIP_RESTORE_DIRECTIVE .chip 547x
1621 +#define QCHIP_RESTORE_DIRECTIVE ".chip 68k"
1622 +#define CHIP_RESTORE_DIRECTIVE .chip 68k
1625 #endif /* __KERNEL__ */
1627 #endif /* _M68K_SETUP_H */
1628 --- a/arch/m68k/include/asm/sigcontext.h
1629 +++ b/arch/m68k/include/asm/sigcontext.h
1630 @@ -15,9 +15,15 @@ struct sigcontext {
1631 unsigned long sc_pc;
1632 unsigned short sc_formatvec;
1634 +# ifdef __mcoldfire__
1635 + unsigned long sc_fpregs[2][2]; /* room for two fp registers */
1636 + unsigned long sc_fpcntl[3];
1637 + unsigned char sc_fpstate[16+6*8];
1639 unsigned long sc_fpregs[2*3]; /* room for two fp registers */
1640 unsigned long sc_fpcntl[3];
1641 unsigned char sc_fpstate[216];
1646 --- a/arch/m68k/include/asm/siginfo.h
1647 +++ b/arch/m68k/include/asm/siginfo.h
1648 @@ -29,7 +29,8 @@ typedef struct siginfo {
1650 timer_t _tid; /* timer id */
1651 int _overrun; /* overrun count */
1652 - char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
1653 + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)
1654 + + sizeof(__kernel_uid_t)];
1655 sigval_t _sigval; /* same as below */
1656 int _sys_private; /* not to be passed to user */
1658 @@ -38,18 +39,18 @@ typedef struct siginfo {
1660 __kernel_pid_t _pid; /* sender's pid */
1661 __kernel_uid_t _uid; /* backwards compatibility */
1663 __kernel_uid32_t _uid32; /* sender's uid */
1669 __kernel_pid_t _pid; /* which child */
1670 __kernel_uid_t _uid; /* backwards compatibility */
1671 - int _status; /* exit code */
1672 + __kernel_uid32_t _uid32; /* sender's uid */
1675 - __kernel_uid32_t _uid32; /* sender's uid */
1676 + int _status; /* exit code */
1679 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
1680 --- a/arch/m68k/include/asm/signal.h
1681 +++ b/arch/m68k/include/asm/signal.h
1682 @@ -150,7 +150,8 @@ typedef struct sigaltstack {
1684 #include <asm/sigcontext.h>
1686 -#ifndef __uClinux__
1687 +//#ifndef __uClinux__
1688 +#ifndef CONFIG_COLDFIRE /*FIXME Jason*/
1689 #define __HAVE_ARCH_SIG_BITOPS
1691 static inline void sigaddset(sigset_t *set, int _sig)
1692 @@ -201,7 +202,6 @@ static inline int sigfindinword(unsigned
1695 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
1699 #undef __HAVE_ARCH_SIG_BITOPS
1700 --- a/arch/m68k/include/asm/string_mm.h
1701 +++ b/arch/m68k/include/asm/string_mm.h
1702 @@ -93,6 +93,7 @@ static inline char *strchr(const char *s
1703 return (char *)s - 1;
1706 +#ifndef CONFIG_COLDFIRE
1707 #define __HAVE_ARCH_STRCMP
1708 static inline int strcmp(const char *cs, const char *ct)
1710 @@ -110,6 +111,7 @@ static inline int strcmp(const char *cs,
1711 : "+a" (cs), "+a" (ct), "=d" (res));
1716 #define __HAVE_ARCH_MEMSET
1717 extern void *memset(void *, int, __kernel_size_t);
1718 --- a/arch/m68k/include/asm/swab.h
1719 +++ b/arch/m68k/include/asm/swab.h
1721 #include <linux/types.h>
1722 #include <linux/compiler.h>
1724 -#define __SWAB_64_THRU_32__
1725 +/*#define __SWAB_64_THRU_32__
1727 #if defined (__mcfisaaplus__) || defined (__mcfisac__)
1728 static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
1729 @@ -23,5 +23,29 @@ static inline __attribute_const__ __u32
1731 #define __arch_swab32 __arch_swab32
1734 +#if defined(__GNUC__)
1735 +#if defined(__mcfisaaplus__) || defined(__mcfisac__)
1736 +static inline __attribute_const__ __u32 ___arch__swab32(__u32 val)
1738 + __asm__ ("byterev %0" : "=d" (val) : "0" (val));
1741 +#define __arch__swab32(x) ___arch__swab32(x)
1742 +#elif !defined(__mcoldfire__)
1743 +static inline __attribute_const__ __u32 ___arch__swab32(__u32 val)
1745 + __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
1748 +#define __arch__swab32(x) ___arch__swab32(x)
1753 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
1754 +# define __BYTEORDER_HAS_U64__
1755 +# define __SWAB_64_THRU_32__
1758 #endif /* _M68K_SWAB_H */
1759 --- a/arch/m68k/include/asm/system_mm.h
1760 +++ b/arch/m68k/include/asm/system_mm.h
1762 #include <linux/kernel.h>
1763 #include <asm/segment.h>
1764 #include <asm/entry.h>
1765 +#include <asm/cfcache.h>
1769 +#ifdef CONFIG_COLDFIRE
1770 +#define FLUSH_BC (0x00040000)
1772 +#define finish_arch_switch(prev) do { \
1773 + unsigned long tmpreg; \
1774 + asm volatile ( "move.l %2,%0\n" \
1776 + "movec %0,%%cacr" \
1777 + : "=&d" (tmpreg) \
1778 + : "id" (FLUSH_BC), "m" (shadow_cacr)); \
1784 * switch_to(n) should switch tasks to task ptr, first checking that
1785 * ptr isn't the current task, in which case it does nothing. This
1786 @@ -63,16 +78,25 @@ asmlinkage void resume(void);
1787 #define smp_read_barrier_depends() ((void)0)
1789 /* interrupt control.. */
1791 -#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
1793 #include <linux/hardirq.h>
1794 +#ifndef CONFIG_COLDFIRE
1795 #define local_irq_enable() ({ \
1796 if (MACH_IS_Q40 || !hardirq_count()) \
1797 asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
1800 #define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory")
1801 +#else /* CONFIG_COLDFIRE */
1802 +#define local_irq_enable() \
1803 + asm volatile ("move.w %%sr, %%d0\n\t" \
1804 + "andil #0xf8ff,%%d0\n\t" \
1805 + "move.w %%d0, %%sr\n" \
1806 + : : : "cc", "d0", "memory")
1807 +#define local_irq_disable() \
1808 + asm volatile ("move %/sr,%%d0\n\t" \
1809 + "ori.l #0x0700,%%d0\n\t" \
1810 + "move %%d0,%/sr\n" \
1811 + : : : "cc", "%d0", "memory")
1813 #define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
1814 #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
1816 --- a/arch/m68k/include/asm/thread_info_mm.h
1817 +++ b/arch/m68k/include/asm/thread_info_mm.h
1818 @@ -10,6 +10,7 @@ struct thread_info {
1819 struct exec_domain *exec_domain; /* execution domain */
1820 int preempt_count; /* 0 => preemptable, <0 => BUG */
1821 __u32 cpu; /* should always be 0 on m68k */
1822 + unsigned long tp_value;
1823 struct restart_block restart_block;
1826 --- a/arch/m68k/include/asm/tlbflush.h
1827 +++ b/arch/m68k/include/asm/tlbflush.h
1829 #define _M68K_TLBFLUSH_H
1832 -#ifndef CONFIG_SUN3
1833 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1835 #include <asm/current.h>
1837 @@ -92,7 +92,12 @@ static inline void flush_tlb_kernel_rang
1842 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1843 + unsigned long start, unsigned long end)
1847 +#elif defined(CONFIG_SUN3)
1850 /* Reserved PMEGs. */
1851 @@ -214,6 +219,15 @@ static inline void flush_tlb_kernel_page
1852 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG);
1855 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1856 + unsigned long start, unsigned long end)
1860 +#else /* CONFIG_COLDFIRE */
1862 +#include <asm/cf_tlbflush.h>
1866 #else /* !CONFIG_MMU */
1867 --- a/arch/m68k/include/asm/uaccess_mm.h
1868 +++ b/arch/m68k/include/asm/uaccess_mm.h
1870 #ifndef __M68K_UACCESS_H
1871 #define __M68K_UACCESS_H
1873 +#ifdef CONFIG_COLDFIRE
1874 +#include <asm/cf_uaccess.h>
1877 * User space memory access functions
1879 @@ -371,4 +374,5 @@ unsigned long __clear_user(void __user *
1881 #define strlen_user(str) strnlen_user(str, 32767)
1883 +#endif /* CONFIG_COLDFIRE */
1884 #endif /* _M68K_UACCESS_H */
1885 --- a/arch/m68k/include/asm/ucontext.h
1886 +++ b/arch/m68k/include/asm/ucontext.h
1887 @@ -7,7 +7,11 @@ typedef greg_t gregset_t[NGREG];
1889 typedef struct fpregset {
1891 +#ifdef __mcoldfire__
1892 + int f_fpregs[8][2];
1899 --- a/arch/m68k/include/asm/unistd.h
1900 +++ b/arch/m68k/include/asm/unistd.h
1901 @@ -336,10 +336,14 @@
1902 #define __NR_pwritev 330
1903 #define __NR_rt_tgsigqueueinfo 331
1904 #define __NR_perf_counter_open 332
1905 +#define __NR_read_tp 333
1906 +#define __NR_write_tp 334
1907 +#define __NR_atomic_cmpxchg_32 335
1908 +#define __NR_atomic_barrier 336
1912 -#define NR_syscalls 333
1913 +#define NR_syscalls 337
1915 #define __ARCH_WANT_IPC_PARSE_VERSION
1916 #define __ARCH_WANT_OLD_READDIR
1917 --- a/arch/m68k/include/asm/virtconvert.h
1918 +++ b/arch/m68k/include/asm/virtconvert.h
1920 #ifndef __VIRT_CONVERT__
1921 #define __VIRT_CONVERT__
1923 +#ifdef CONFIG_COLDFIRE
1924 +#include <asm/cf_virtconvert.h>
1928 * Macros used for converting between virtual and physical mappings.
1930 @@ -46,3 +50,4 @@ static inline void *phys_to_virt(unsigne
1935 --- a/arch/m68k/Kconfig
1936 +++ b/arch/m68k/Kconfig
1937 @@ -12,6 +12,14 @@ config MMU
1941 +config GENERIC_TIME
1942 + bool "Enable generic timer"
1945 +config GENERIC_CLOCKEVENTS
1946 + bool "Enable generic clockevents"
1949 config RWSEM_GENERIC_SPINLOCK
1952 @@ -37,7 +45,7 @@ config GENERIC_CALIBRATE_DELAY
1959 config GENERIC_IOMAP
1961 @@ -49,7 +57,7 @@ config ARCH_MAY_HAVE_PC_FDC
1966 + def_bool !(M5445X || M547X_8X)
1970 @@ -107,6 +115,35 @@ config PCMCIA
1971 To compile this driver as modules, choose M here: the
1972 modules will be called pcmcia_core and ds.
1975 + bool "ColdFire V4e support"
1979 + Say Y if you want to build a kernel to run on one of the ColdFire
1984 + depends on COLDFIRE
1985 + select MMU_CFV4E if MMU
1989 + bool "ColdFire V4e FPU support"
1992 + This enables support for CFV4E FPU feature.
1995 + bool "ColdFire MCD DMA support"
1996 + depends on M547X_8X
1999 + This enables support for the ColdFire 547x/548x family
2000 + multichannel DMA support. Many drivers need it.
2001 + If you want it, say Y
2004 bool "Amiga support"
2005 select MMU_MOTOROLA if MMU
2006 @@ -124,6 +161,16 @@ config ATARI
2007 this kernel on an Atari, say Y here and browse the material
2008 available in <file:Documentation/m68k>; otherwise say N.
2011 + bool "PCI bus support"
2012 + depends on M54455 || M547X_8X
2015 + Find out whether you have a PCI motherboard. PCI is the name of a
2016 + bus system, i.e. the way the CPU talks to the other stuff inside
2017 + your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
2018 + VESA. If you have PCI, say Y, otherwise N.
2021 bool "Macintosh support"
2022 select MMU_MOTOROLA if MMU
2023 @@ -278,6 +325,118 @@ config M68060
2024 If you anticipate running this kernel on a computer with a MC68060
2025 processor, say Y. Otherwise, say N.
2028 + bool "MCF5445x support"
2029 + depends on COLDFIRE
2030 + select GENERIC_TIME
2031 + select USB_EHCI_FSL
2032 + select HAVE_FSL_USB_DR
2034 + This option will add support for the MCF544x processor with mmu.
2058 +config HAVE_FSL_USB_DR
2063 + bool "MCF547x/MCF548x support"
2064 + depends on COLDFIRE
2066 + This option will add support for the MCF547x/MCF548x processor with mmu.
2070 + depends on M547X_8X
2075 + depends on M547X_8X
2080 + depends on M547X_8X
2125 + default 240000000 if M54451EVB
2126 + default 266666666 if M54455EVB
2127 + default 266000000 if M547X
2128 + default 200000000 if M548X
2130 + Coldfire System clock.
2132 +config MCF_USER_HALT
2133 + bool "Coldfire User Halt Enable"
2134 + depends on M5445X || M547X_8X
2137 + Enables the HALT instruction in User Mode.
2142 @@ -285,6 +444,70 @@ config MMU_SUN3
2144 depends on MMU && !MMU_MOTOROLA
2151 + depends on COLDFIRE
2152 + default 0x40000000 if M5445X
2153 + default 0x00000000 if M547X_8X
2157 + depends on COLDFIRE
2158 + default 0x08000000 if M54451EVB
2159 + default 0x10000000 if M54455EVB
2160 + default 0x04000000 if M547X_8X
2162 +config NOR_FLASH_BASE
2163 + hex "NOR Flash Base Address"
2164 + depends on COLDFIRE
2165 + default 0x00000000 if M54451EVB
2166 + default 0x00000000 if M54455EVB
2167 + default 0xE0000000 if M547X_8X
2171 + depends on COLDFIRE
2172 + default 0xef000000
2176 + depends on COLDFIRE
2177 + default 0x1000000 if M5445X
2178 + default 0x800000 if M547X_8X
2181 + bool "SRAM allocation APIs support on mcfv4 platform"
2182 + depends on COLDFIRE && M5445X
2184 + select GENERIC_ALLOCATOR
2188 + depends on COLDFIRE && SRAM
2189 + default 0x8ff00000 if M5445X
2193 + depends on COLDFIRE && SRAM
2194 + default 0x8000 if M5445X
2196 +config SRAM_ALLOC_GRANULARITY
2199 + default 0x200 if M5445X
2202 + bool "Support VDSO page"
2206 + This will enable support for the kernel mapping a vDSO page
2207 + in process space, and subsequently handing down the entry point
2208 + to the libc through the ELF auxiliary vector.
2211 bool "Math emulation support (EXPERIMENTAL)"
2212 depends on EXPERIMENTAL
2213 @@ -451,6 +674,14 @@ config ZONE_DMA
2214 source "drivers/pci/Kconfig"
2216 source "drivers/zorro/Kconfig"
2219 +menu "Power management options"
2222 + bool "Power Management support"
2224 + Support processor power management modes
2228 @@ -589,7 +820,7 @@ config DN_SERIAL
2230 config SERIAL_CONSOLE
2231 bool "Support for serial port console"
2232 - depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
2233 + depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO || COLDFIRE) && (ATARI_MFPSER=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL || SERIAL_COLDFIRE)
2235 If you say Y here, it will be possible to use a serial port as the
2236 system console (the system console is the device which receives all
2237 @@ -612,6 +843,8 @@ config SERIAL_CONSOLE
2241 +source "kernel/time/Kconfig"
2245 source "arch/m68k/Kconfig.debug"
2246 --- a/arch/m68k/kernel/asm-offsets.c
2247 +++ b/arch/m68k/kernel/asm-offsets.c
2249 * This program is used to generate definitions needed by
2250 * assembly language modules.
2252 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2253 + * Jason Jin Jason.Jin@freescale.com
2254 + * Shrek Wu B16972@freescale.com
2255 + * Add Codlfire support
2257 * We use the technique used in the OSF Mach kernel code:
2258 * generate asm statements containing #defines,
2259 * compile this file to assembler, and then extract the
2260 @@ -56,8 +61,15 @@ int main(void)
2261 DEFINE(PT_A2, offsetof(struct pt_regs, a2));
2262 DEFINE(PT_PC, offsetof(struct pt_regs, pc));
2263 DEFINE(PT_SR, offsetof(struct pt_regs, sr));
2264 +#ifdef CONFIG_COLDFIRE
2265 + /* Need to get the context out of struct mm for ASID setting */
2266 + DEFINE(MM_CONTEXT, offsetof(struct mm_struct, context));
2267 + /* Coldfire exception frame has vector *before* pc */
2268 + DEFINE(PT_VECTOR, offsetof(struct pt_regs, pc) - 4);
2270 /* bitfields are a bit difficult */
2271 DEFINE(PT_VECTOR, offsetof(struct pt_regs, pc) + 4);
2274 /* offsets into the irq_handler struct */
2275 DEFINE(IRQ_HANDLER, offsetof(struct irq_node, handler));
2276 --- a/arch/m68k/kernel/dma.c
2277 +++ b/arch/m68k/kernel/dma.c
2280 + * Copyright Freescale Semiconductor, Inc. 2008, 2009
2281 + * Jason Jin Jason.Jin@freescale.com
2282 + * Shrek Wu B16972@freescale.com
2283 * This file is subject to the terms and conditions of the GNU General Public
2284 * License. See the file COPYING in the main directory of this archive
2287 #include <linux/kernel.h>
2288 #include <linux/scatterlist.h>
2289 #include <linux/vmalloc.h>
2291 +#include <linux/pci.h>
2292 #include <asm/pgalloc.h>
2294 void *dma_alloc_coherent(struct device *dev, size_t size,
2295 dma_addr_t *handle, gfp_t flag)
2297 +#if defined(CONFIG_M5445X) | defined(CONFIG_M547X_8X)
2299 + * On the M5445x platform the memory allocated with GFP_DMA
2300 + * is guaranteed to be DMA'able.
2304 + size = PAGE_ALIGN(size);
2305 + addr = kmalloc(size, GFP_DMA);
2306 + *handle = virt_to_phys(addr);
2309 struct page *page, **map;
2312 @@ -55,6 +70,7 @@ void *dma_alloc_coherent(struct device *
2318 EXPORT_SYMBOL(dma_alloc_coherent);
2320 @@ -62,7 +78,11 @@ void dma_free_coherent(struct device *de
2321 void *addr, dma_addr_t handle)
2323 pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
2324 +#if defined(CONFIG_M5445X) | defined(CONFIG_M547X_8X)
2330 EXPORT_SYMBOL(dma_free_coherent);
2332 @@ -88,9 +108,16 @@ void dma_sync_sg_for_device(struct devic
2333 enum dma_data_direction dir)
2336 +#ifdef CONFIG_COLDFIRE
2337 + struct scatterlist *_sg;
2339 + for_each_sg(sg, _sg, nents, i)
2340 + dma_sync_single_for_device(dev, _sg->dma_address,
2341 + _sg->length, dir);
2343 for (i = 0; i < nents; sg++, i++)
2344 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
2347 EXPORT_SYMBOL(dma_sync_sg_for_device);
2349 @@ -119,10 +146,19 @@ int dma_map_sg(struct device *dev, struc
2350 enum dma_data_direction dir)
2354 +#ifdef CONFIG_COLDFIRE
2355 + struct scatterlist *_sg;
2357 +#ifndef CONFIG_COLDFIRE
2358 for (i = 0; i < nents; sg++, i++) {
2359 sg->dma_address = sg_phys(sg);
2360 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
2362 + for_each_sg(sg, _sg, nents, i) {
2363 + _sg->dma_address = sg_phys(_sg);
2364 + dma_sync_single_for_device(dev, _sg->dma_address,
2365 + _sg->length, dir);
2370 --- a/arch/m68k/kernel/Makefile
2371 +++ b/arch/m68k/kernel/Makefile
2373 # Makefile for the linux kernel.
2379 + extra-y := sun3-head.o vmlinux.lds
2380 + obj-y := entry.o signal.o ints.o time.o
2382 - extra-y := sun3-head.o
2383 +ifndef CONFIG_COLDFIRE
2384 + extra-y := head.o vmlinux.lds
2385 + obj-y := entry.o signal.o traps.o ints.o time.o
2386 +else # CONFIG_COLDFIRE
2387 + extra-y := vmlinux.lds
2388 + ifdef CONFIG_M547X_8X
2389 + obj-$(CONFIG_PCI) += bios32_mcf548x.o
2393 -extra-y += vmlinux.lds
2395 -obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
2396 - sys_m68k.o time.o setup.o m68k_ksyms.o devres.o
2397 +obj-y += process.o ptrace.o module.o \
2398 + sys_m68k.o setup.o m68k_ksyms.o devres.o# semaphore.o
2400 devres-y = ../../../kernel/irq/devres.o
2402 obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
2404 +EXTRA_AFLAGS := -traditional
2405 --- a/arch/m68k/kernel/process.c
2406 +++ b/arch/m68k/kernel/process.c
2408 * Copyright (C) 1995 Hamish Macdonald
2410 * 68060 fixes by Jesper Skov
2412 + * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
2413 + * Kurt.Mahan@freescale.com
2414 + * Jason Jin Jason.Jin@freescale.com
2415 + * Shrek Wu B16972@freescale.com
2419 @@ -186,12 +191,21 @@ EXPORT_SYMBOL(kernel_thread);
2420 void flush_thread(void)
2422 unsigned long zero = 0;
2423 +#if !defined(CONFIG_COLDFIRE)
2425 current->thread.fs = __USER_DS;
2427 asm volatile (".chip 68k/68881\n\t"
2429 ".chip 68k" : : "a" (&zero));
2432 + current->thread.fs = USER_DS;
2433 +#if defined(CONFIG_FPU)
2435 + asm volatile ("frestore %0@\n\t" : : "a" (&zero));
2441 @@ -251,10 +265,15 @@ int copy_thread(unsigned long clone_flag
2443 p->thread.usp = usp;
2444 p->thread.ksp = (unsigned long)childstack;
2446 + if (clone_flags & CLONE_SETTLS)
2447 + task_thread_info(p)->tp_value = regs->d5;
2450 * Must save the current SFC/DFC value, NOT the value when
2451 * the parent was last descheduled - RGH 10-08-96
2453 +#if !defined(CONFIG_COLDFIRE)
2454 p->thread.fs = get_fs().seg;
2457 @@ -266,9 +285,34 @@ int copy_thread(unsigned long clone_flag
2458 "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
2459 : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0])
2462 + p->thread.fs = get_fs();
2464 +#if defined(CONFIG_FPU)
2465 + if (!FPU_IS_EMU) {
2466 + /* Copy the current fpu state */
2467 + asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0])
2470 + if (p->thread.fpstate[0]) {
2471 + asm volatile ("fmovemd %/fp0-%/fp7,%0"
2472 + : : "m" (p->thread.fp[0])
2474 + asm volatile ("fmovel %/fpiar,%0"
2475 + : : "m" (p->thread.fpcntl[0])
2477 + asm volatile ("fmovel %/fpcr,%0"
2478 + : : "m" (p->thread.fpcntl[1])
2480 + asm volatile ("fmovel %/fpsr,%0"
2481 + : : "m" (p->thread.fpcntl[2])
2484 /* Restore the state in case the fpu was busy */
2485 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
2492 @@ -277,7 +321,9 @@ int copy_thread(unsigned long clone_flag
2494 int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
2496 +#if !defined(CONFIG_COLDFIRE) || defined(CONFIG_FPU)
2502 @@ -294,6 +340,7 @@ int dump_fpu (struct pt_regs *regs, stru
2505 /* First dump the fpu context to avoid protocol violation. */
2506 +#if !defined(CONFIG_COLDFIRE)
2507 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
2508 if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
2510 @@ -304,6 +351,25 @@ int dump_fpu (struct pt_regs *regs, stru
2511 asm volatile ("fmovemx %/fp0-%/fp7,%0"
2512 :: "m" (fpu->fpregs[0])
2514 +#elif defined(CONFIG_FPU)
2515 + asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
2516 + if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
2519 + asm volatile ("fmovel %/fpiar,%0"
2520 + : : "m" (fpu->fpcntl[0])
2522 + asm volatile ("fmovel %/fpcr,%0"
2523 + : : "m" (fpu->fpcntl[1])
2525 + asm volatile ("fmovel %/fpsr,%0"
2526 + : : "m" (fpu->fpcntl[2])
2528 + asm volatile ("fmovemd %/fp0-%/fp7,%0"
2529 + : : "m" (fpu->fpregs[0])
2535 EXPORT_SYMBOL(dump_fpu);
2536 --- a/arch/m68k/kernel/ptrace.c
2537 +++ b/arch/m68k/kernel/ptrace.c
2538 @@ -265,6 +265,11 @@ long arch_ptrace(struct task_struct *chi
2542 + case PTRACE_GET_THREAD_AREA:
2543 + ret = put_user(task_thread_info(child)->tp_value,
2544 + (unsigned long __user *) data);
2548 ret = ptrace_request(child, request, addr, data);
2550 --- a/arch/m68k/kernel/setup.c
2551 +++ b/arch/m68k/kernel/setup.c
2553 * linux/arch/m68k/kernel/setup.c
2555 * Copyright (C) 1995 Hamish Macdonald
2556 + * Copyright Freescale Semiconductor, Inc. 2008, 2009
2557 + * Jason Jin Jason.Jin@freescale.com
2558 + * Shrek Wu B16972@freescale.com
2562 @@ -75,13 +78,24 @@ EXPORT_SYMBOL(m68k_memory);
2564 struct mem_info m68k_ramdisk;
2566 +#if !defined(CONFIG_COLDFIRE)
2567 static char m68k_command_line[CL_SIZE];
2569 +char m68k_command_line[CL_SIZE];
2570 +unsigned long uboot_info_stk;
2571 +EXPORT_SYMBOL(uboot_info_stk);
2574 void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
2575 /* machine dependent irq functions */
2576 void (*mach_init_IRQ) (void) __initdata = NULL;
2577 void (*mach_get_model) (char *model);
2578 void (*mach_get_hardware_list) (struct seq_file *m);
2580 +#ifdef CONFIG_COLDFIRE
2581 +void (*mach_tick)(void);
2584 /* machine dependent timer functions */
2585 unsigned long (*mach_gettimeoffset) (void);
2586 int (*mach_hwclk) (int, struct rtc_time*);
2587 @@ -137,13 +151,17 @@ extern void config_hp300(void);
2588 extern void config_q40(void);
2589 extern void config_sun3x(void);
2591 +#ifdef CONFIG_COLDFIRE
2592 +void coldfire_sort_memrec(void);
2595 #define MASK_256K 0xfffc0000
2597 extern void paging_init(void);
2599 static void __init m68k_parse_bootinfo(const struct bi_record *record)
2601 - while (record->tag != BI_LAST) {
2602 + while ((record->tag != BI_LAST)) {
2604 const unsigned long *data = record->data;
2606 @@ -203,6 +221,10 @@ static void __init m68k_parse_bootinfo(c
2610 +#ifdef CONFIG_COLDFIRE
2611 + coldfire_sort_memrec();
2614 m68k_realnum_memory = m68k_num_memory;
2615 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
2616 if (m68k_num_memory > 1) {
2617 @@ -215,8 +237,11 @@ static void __init m68k_parse_bootinfo(c
2619 void __init setup_arch(char **cmdline_p)
2623 +#if !defined(CONFIG_SUN3)
2627 /* The bootinfo is located right after the kernel bss */
2628 m68k_parse_bootinfo((const struct bi_record *)_end);
2630 @@ -230,9 +255,10 @@ void __init setup_arch(char **cmdline_p)
2631 * We should really do our own FPU check at startup.
2632 * [what do we do with buggy 68LC040s? if we have problems
2633 * with them, we should add a test to check_bugs() below] */
2634 -#ifndef CONFIG_M68KFPU_EMU_ONLY
2635 +#if !defined(CONFIG_M68KFPU_EMU_ONLY) && defined(CONFIG_FPU)
2636 /* clear the fpu if we have one */
2637 - if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
2638 + if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|
2640 volatile int zero = 0;
2641 asm volatile ("frestore %0" : : "m" (zero));
2643 @@ -320,13 +346,18 @@ void __init setup_arch(char **cmdline_p)
2647 +#ifdef CONFIG_COLDFIRE
2649 + config_coldfire();
2653 panic("No configuration setup");
2658 -#ifndef CONFIG_SUN3
2659 +#if !defined(CONFIG_SUN3)
2660 for (i = 1; i < m68k_num_memory; i++)
2661 free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
2662 m68k_memory[i].size);
2663 @@ -353,6 +384,10 @@ void __init setup_arch(char **cmdline_p)
2665 #endif /* !CONFIG_SUN3 */
2667 +#ifdef CONFIG_COLDFIRE
2668 + mmu_context_init();
2671 /* set ISA defs early as possible */
2672 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
2674 @@ -383,6 +418,7 @@ static int show_cpuinfo(struct seq_file
2675 #define LOOP_CYCLES_68030 (8)
2676 #define LOOP_CYCLES_68040 (3)
2677 #define LOOP_CYCLES_68060 (1)
2678 +#define LOOP_CYCLES_COLDFIRE (2)
2682 @@ -396,6 +432,9 @@ static int show_cpuinfo(struct seq_file
2683 } else if (CPU_IS_060) {
2685 clockfactor = LOOP_CYCLES_68060;
2686 + } else if (CPU_IS_CFV4E) {
2687 + cpu = "ColdFire V4e";
2688 + clockfactor = LOOP_CYCLES_COLDFIRE;
2692 @@ -414,6 +453,8 @@ static int show_cpuinfo(struct seq_file
2694 else if (m68k_fputype & FPU_SUNFPA)
2696 + else if (m68k_fputype & FPU_CFV4E)
2697 + fpu = "ColdFire V4e";
2701 @@ -430,6 +471,8 @@ static int show_cpuinfo(struct seq_file
2703 else if (m68k_mmutype & MMU_APOLLO)
2705 + else if (m68k_mmutype & MMU_CFV4E)
2710 @@ -512,7 +555,7 @@ module_init(proc_hardware_init);
2712 void check_bugs(void)
2714 -#ifndef CONFIG_M68KFPU_EMU
2715 +#if !defined(CONFIG_M68KFPU_EMU) && !defined(CONFIG_M5445X)
2716 if (m68k_fputype == 0) {
2717 printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
2718 "WHICH IS REQUIRED BY LINUX/M68K ***\n");
2719 --- a/arch/m68k/kernel/sys_m68k.c
2720 +++ b/arch/m68k/kernel/sys_m68k.c
2723 * linux/arch/m68k/kernel/sys_m68k.c
2724 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2725 + * Jason Jin Jason.Jin@freescale.com
2726 + * Shrek Wu B16972@freescale.com
2728 * This file contains various random system calls that
2729 * have a non-standard calling sequence on the Linux/m68k
2731 #include <asm/traps.h>
2732 #include <asm/page.h>
2733 #include <asm/unistd.h>
2734 +#include <linux/elf.h>
2735 +#include <asm/tlb.h>
2736 +#ifdef CONFIG_COLDFIRE
2737 +#include <asm/cacheflush.h>
2740 +asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
2741 + unsigned long error_code);
2743 /* common code for old and new mmaps */
2744 static inline long do_mmap2(
2745 @@ -240,6 +251,7 @@ asmlinkage int sys_ipc (uint call, int f
2749 +#ifndef CONFIG_COLDFIRE
2750 /* Convert virtual (user) address VADDR to physical address PADDR */
2751 #define virt_to_phys_040(vaddr) \
2753 @@ -563,6 +575,7 @@ cache_flush_060 (unsigned long addr, int
2757 +#endif /* CONFIG_COLDFIRE */
2759 /* sys_cacheflush -- flush (part of) the processor cache. */
2761 @@ -595,6 +608,7 @@ sys_cacheflush (unsigned long addr, int
2765 +#ifndef CONFIG_COLDFIRE
2766 if (CPU_IS_020_OR_030) {
2767 if (scope == FLUSH_SCOPE_LINE && len < 256) {
2769 @@ -639,6 +653,16 @@ sys_cacheflush (unsigned long addr, int
2770 ret = cache_flush_060 (addr, scope, cache, len);
2773 +#else /* CONFIG_COLDFIRE */
2774 + if ((cache & FLUSH_CACHE_INSN) && (cache & FLUSH_CACHE_DATA))
2776 + else if (cache & FLUSH_CACHE_INSN)
2782 +#endif /* CONFIG_COLDFIRE */
2786 @@ -663,3 +687,79 @@ int kernel_execve(const char *filename,
2787 : "d" (__a), "d" (__b), "d" (__c));
2791 +asmlinkage unsigned long
2794 + return current_thread_info()->tp_value;
2798 +sys_write_tp(unsigned long tp)
2800 + current_thread_info()->tp_value = tp;
2804 +/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
2807 +sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
2808 + unsigned long __user *mem)
2810 + /* This was borrowed from ARM's implementation. */
2812 + struct mm_struct *mm = current->mm;
2813 + pgd_t *pgd; pmd_t *pmd; pte_t *pte;
2815 + unsigned long mem_value;
2817 + down_read(&mm->mmap_sem);
2818 + pgd = pgd_offset(mm, (unsigned long)mem);
2819 + if (!pgd_present(*pgd))
2821 + pmd = pmd_offset(pgd, (unsigned long)mem);
2822 + if (!pmd_present(*pmd))
2824 + pte = pte_offset_map_lock(mm, pmd, (unsigned long)mem, &ptl);
2825 + if (!pte_present(*pte) || !pte_dirty(*pte)) {
2826 + pte_unmap_unlock(pte, ptl);
2831 + if (mem_value == oldval)
2834 + pte_unmap_unlock(pte, ptl);
2835 + up_read(&mm->mmap_sem);
2839 + up_read(&mm->mmap_sem);
2840 + /* This is not necessarily a bad access, we can get here if
2841 + a memory we're trying to write to should be copied-on-write.
2842 + Make the kernel do the necessary page stuff, then re-iterate.
2843 + Simulate a write access fault to do that. */
2845 + /* The first argument of the function corresponds to
2846 + D1, which is the first field of struct pt_regs. */
2847 + struct pt_regs *fp = (struct pt_regs *)&newval;
2849 + /* '3' is an RMW flag. */
2850 + if (do_page_fault(fp, (unsigned long)mem, 3))
2851 + /* If the do_page_fault() failed, we don't
2852 + have anything meaningful to return.
2853 + There should be a SIGSEGV pending for
2855 + return 0xdeadbeef;
2861 +sys_atomic_barrier(void)
2863 + /* no code needed for uniprocs */
2866 --- a/arch/m68k/kernel/time.c
2867 +++ b/arch/m68k/kernel/time.c
2869 * linux/arch/m68k/kernel/time.c
2871 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
2872 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2873 + * Jason Jin Jason.Jin@freescale.com
2874 + * Shrek Wu B16972@freescale.com
2876 * This file contains the m68k-specific time handling details.
2877 * Most of the stuff is located in the machine specific files.
2878 @@ -41,6 +44,11 @@ static inline int set_rtc_mmss(unsigned
2880 static irqreturn_t timer_interrupt(int irq, void *dummy)
2882 +#ifdef CONFIG_COLDFIRE
2883 + /* kick hardware timer if necessary */
2889 update_process_times(user_mode(get_irq_regs()));
2890 --- a/arch/m68k/kernel/vmlinux.lds.S
2891 +++ b/arch/m68k/kernel/vmlinux.lds.S
2895 - text PT_LOAD FILEHDR PHDRS FLAGS (7);
2896 + headers PT_PHDR PHDRS ;
2897 + text PT_LOAD FILEHDR PHDRS FLAGS (5);
2898 data PT_LOAD FLAGS (7);
2901 #include "vmlinux-sun3.lds"
2902 +#elif CONFIG_COLDFIRE
2903 +#include "vmlinux-cf.lds"
2905 #include "vmlinux-std.lds"
2907 --- a/arch/m68k/lib/checksum.c
2908 +++ b/arch/m68k/lib/checksum.c
2910 * 1998/8/31 Andreas Schwab:
2911 * Zero out rest of buffer on exception in
2912 * csum_partial_copy_from_user.
2914 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2915 + * Jason Jin Jason.Jin@freescale.com
2916 + * Shrek Wu B16972@freescale.com
2919 #include <linux/module.h>
2921 * computes a partial checksum, e.g. for TCP/UDP fragments
2924 +#ifdef CONFIG_COLDFIRE
2926 +static inline unsigned short from32to16(unsigned long x)
2928 + /* add up 16-bit and 16-bit for 16+c bit */
2929 + x = (x & 0xffff) + (x >> 16);
2930 + /* add up carry.. */
2931 + x = (x & 0xffff) + (x >> 16);
2935 +static unsigned long do_csum(const unsigned char *buff, int len)
2938 + unsigned long result = 0;
2942 + odd = 1 & (unsigned long) buff;
2948 + count = len >> 1; /* nr of 16-bit words.. */
2950 + if (2 & (unsigned long) buff) {
2951 + result += *(unsigned short *) buff;
2956 + count >>= 1; /* nr of 32-bit words.. */
2958 + unsigned long carry = 0;
2960 + unsigned long w = *(unsigned long *) buff;
2965 + carry = (w > result);
2968 + result = (result & 0xffff) + (result >> 16);
2971 + result += *(unsigned short *) buff;
2976 + result += (*buff << 8);
2977 + result = from32to16(result);
2979 + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
2985 + * This is a version of ip_compute_csum() optimized for IP headers,
2986 + * which always checksum on 4 octet boundaries.
2988 +__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
2990 + return ~do_csum(iph, ihl*4);
2992 +EXPORT_SYMBOL(ip_fast_csum);
2995 + * computes the checksum of a memory block at buff, length len,
2996 + * and adds in "sum" (32-bit)
2998 + * returns a 32-bit number suitable for feeding into itself
2999 + * or csum_tcpudp_magic
3001 + * this function must be called with even lengths, except
3002 + * for the last fragment, which may be odd
3004 + * it's best to have buff aligned on a 32-bit boundary
3006 __wsum csum_partial(const void *buff, int len, __wsum sum)
3008 + unsigned int result = do_csum(buff, len);
3010 + /* add in old sum, and carry.. */
3016 +EXPORT_SYMBOL(csum_partial);
3019 + * copy from fs while checksumming, otherwise like csum_partial
3023 +csum_partial_copy_from_user(const void __user *src, void *dst, int len,
3024 + __wsum sum, int *csum_err)
3026 + if (csum_err) *csum_err = 0;
3027 + memcpy(dst, src, len);
3028 + return csum_partial(dst, len, sum);
3030 +EXPORT_SYMBOL(csum_partial_copy_from_user);
3033 + * copy from ds while checksumming, otherwise like csum_partial
3037 +csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
3039 + memcpy(dst, src, len);
3040 + return csum_partial(dst, len, sum);
3042 +EXPORT_SYMBOL(csum_partial_copy_nocheck);
3044 +#else /* !CONFIG_COLDFIRE */
3047 +csum_partial(const unsigned char *buff, int len, unsigned int sum)
3049 unsigned long tmp1, tmp2;
3051 * Experiments with ethernet and slip connections show that buff
3052 @@ -423,3 +550,4 @@ csum_partial_copy_nocheck(const void *sr
3055 EXPORT_SYMBOL(csum_partial_copy_nocheck);
3056 +#endif /* CONFIG_COLDFIRE */
3057 --- a/arch/m68k/lib/muldi3.c
3058 +++ b/arch/m68k/lib/muldi3.c
3060 /* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
3061 gcc-2.7.2.3/longlong.h which is: */
3062 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3063 + Copyright Freescale Semiconductor, Inc. 2008-2009
3064 + Jason Jin Jason.Jin@freescale.com
3065 + Shrek Wu B16972@freescale.com
3067 This file is part of GNU CC.
3069 @@ -21,12 +24,22 @@ Boston, MA 02111-1307, USA. */
3071 #define BITS_PER_UNIT 8
3073 +#ifdef CONFIG_COLDFIRE
3074 +#define umul_ppmm(w1, w0, u, v) \
3076 + unsigned long long x; \
3077 + x = (unsigned long long)u * v; \
3078 + w0 = (unsigned long)(x & 0x00000000ffffffff); \
3079 + w1 = (unsigned long)(x & 0xffffffff00000000) >> 32; \
3081 +#else /* CONFIG_COLDFIRE */
3082 #define umul_ppmm(w1, w0, u, v) \
3083 __asm__ ("mulu%.l %3,%1:%0" \
3084 : "=d" ((USItype)(w0)), \
3085 "=d" ((USItype)(w1)) \
3086 : "%0" ((USItype)(u)), \
3087 "dmi" ((USItype)(v)))
3088 +#endif /* CONFIG_COLDFIRE */
3090 #define __umulsidi3(u, v) \
3092 --- a/arch/m68k/lib/string.c
3093 +++ b/arch/m68k/lib/string.c
3096 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3097 + * * Jason Jin Jason.Jin@freescale.com
3098 + * Shrek Wu B16972@freescale.com
3100 * This file is subject to the terms and conditions of the GNU General Public
3101 * License. See the file COPYING in the main directory of this archive
3103 @@ -21,6 +25,7 @@ char *strcat(char *dest, const char *src
3105 EXPORT_SYMBOL(strcat);
3107 +#ifndef CONFIG_COLDFIRE
3108 void *memset(void *s, int c, size_t count)
3111 @@ -149,6 +154,69 @@ void *memcpy(void *to, const void *from,
3113 EXPORT_SYMBOL(memcpy);
3115 +#else /* CONFIG_COLDFIRE */
3117 +void *memset(void *s, int c, size_t count)
3120 + void *originalTo = s;
3122 + for (x = 0; x < count; x++)
3123 + *(unsigned char *)s++ = (unsigned char)c;
3125 + return originalTo;
3127 +EXPORT_SYMBOL(memset);
3129 +void *memcpy(void *to, const void *from, size_t n)
3136 + if ((long) to & 1) {
3138 + const char *cfrom = from;
3139 + *cto++ = *cfrom++;
3144 + if (n > 2 && (long) to & 2) {
3146 + const short *sfrom = from;
3147 + *sto++ = *sfrom++;
3155 + const long *lfrom = from;
3156 + for (; temp; temp--)
3157 + *lto++ = *lfrom++;
3163 + const short *sfrom = from;
3164 + *sto++ = *sfrom++;
3170 + const char *cfrom = from;
3175 +EXPORT_SYMBOL(memcpy);
3176 +#endif /* CONFIG_COLDFIRE */
3178 void *memmove(void *dest, const void *src, size_t n)
3181 --- a/arch/m68k/lib/uaccess.c
3182 +++ b/arch/m68k/lib/uaccess.c
3185 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3186 + * Jason Jin Jason.Jin@freescale.com
3187 + * Shrek Wu B16972@freescale.com
3189 * This file is subject to the terms and conditions of the GNU General Public
3190 * License. See the file COPYING in the main directory of this archive
3194 #include <linux/module.h>
3195 +#ifndef CONFIG_COLDFIRE
3196 #include <asm/uaccess.h>
3198 unsigned long __generic_copy_from_user(void *to, const void __user *from,
3199 @@ -220,3 +225,244 @@ unsigned long __clear_user(void __user *
3202 EXPORT_SYMBOL(__clear_user);
3204 +#else /* CONFIG_COLDFIRE */
3206 +#include <asm/cf_uaccess.h>
3208 +unsigned long __generic_copy_from_user(void *to, const void *from,
3211 + unsigned long tmp;
3212 + __asm__ __volatile__
3215 + "1: movel (%1)+,%3\n"
3216 + " movel %3,(%0)+\n"
3219 + "2: movel %4,%2\n"
3222 + "3: movew (%1)+,%3\n"
3223 + " movew %3,(%0)+\n"
3226 + "5: moveb (%1)+,%3\n"
3227 + " moveb %3,(%0)+\n"
3229 + ".section .fixup,\"ax\"\n"
3231 + "7: movel %2,%%d0\n"
3233 + " subql #1,%%d0\n"
3242 + "8: addql #2,%2\n"
3247 + "9: addql #1,%2\n"
3251 + ".section __ex_table,\"a\"\n"
3257 + : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
3258 + : "d"(n & 3), "0"(to), "1"(from), "2"(n/4)
3259 + : "d0", "memory");
3262 +EXPORT_SYMBOL(__generic_copy_from_user);
3265 +unsigned long __generic_copy_to_user(void *to, const void *from,
3268 + unsigned long tmp;
3269 + __asm__ __volatile__
3272 + "1: movel (%1)+,%3\n"
3273 + "22:movel %3,(%0)+\n"
3274 + "2: subql #1,%2\n"
3276 + "3: movel %4,%2\n"
3279 + " movew (%1)+,%3\n"
3280 + "24:movew %3,(%0)+\n"
3283 + " moveb (%1)+,%3\n"
3284 + "25:moveb %3,(%0)+\n"
3286 + ".section .fixup,\"ax\"\n"
3288 + "60:addql #1,%2\n"
3292 + "7: addql #2,%2\n"
3294 + "8: addql #1,%2\n"
3297 + ".section __ex_table,\"a\"\n"
3308 + : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
3309 + : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4)
3313 +EXPORT_SYMBOL(__generic_copy_to_user);
3316 + * Copy a null terminated string from userspace.
3319 +long strncpy_from_user(char *dst, const char *src, long count)
3321 + long res = -EFAULT;
3322 + if (!(access_ok(VERIFY_READ, src, 1))) /* --tym-- */
3324 + if (count == 0) return count;
3325 + __asm__ __volatile__
3326 + ("1: moveb (%2)+,%%d0\n"
3327 + "12:moveb %%d0,(%1)+\n"
3333 + ".section .fixup,\"ax\"\n"
3335 + "4: movel %4,%0\n"
3338 + ".section __ex_table,\"a\"\n"
3343 + : "=d"(res), "=a"(dst), "=a"(src), "=d"(count)
3344 + : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count)
3345 + : "d0", "memory");
3348 +EXPORT_SYMBOL(strncpy_from_user);
3351 + * Return the size of a string (including the ending 0)
3353 + * Return 0 on exception, a value greater than N if too long
3355 +long strnlen_user(const char *src, long n)
3357 + long res = -EFAULT;
3358 + if (!(access_ok(VERIFY_READ, src, 1))) /* --tym-- */
3362 + __asm__ __volatile__
3366 + "2: moveb (%1)+,%%d0\n"
3377 + ".section .fixup,\"ax\"\n"
3379 + "6: moveq %3,%0\n"
3382 + ".section __ex_table,\"a\"\n"
3387 + : "=d"(res), "=a"(src), "=d"(n)
3388 + : "i"(0), "0"(res), "1"(src), "2"(n)
3392 +EXPORT_SYMBOL(strnlen_user);
3399 +unsigned long __clear_user(void *to, unsigned long n)
3401 + __asm__ __volatile__
3404 + "1: movel %3,(%0)+\n"
3405 + "2: subql #1,%1\n"
3407 + "3: movel %2,%1\n"
3410 + "24:movew %3,(%0)+\n"
3413 + "25:moveb %3,(%0)+\n"
3415 + ".section .fixup,\"ax\"\n"
3417 + "61:addql #1,%1\n"
3421 + "7: addql #2,%1\n"
3423 + "8: addql #1,%1\n"
3426 + ".section __ex_table,\"a\"\n"
3436 + : "=a"(to), "=d"(n)
3437 + : "r"(n & 3), "d"(0), "0"(to), "1"(n/4));
3440 +EXPORT_SYMBOL(__clear_user);
3442 +#endif /* CONFIG_COLDFIRE */
3444 --- a/arch/m68k/Makefile
3445 +++ b/arch/m68k/Makefile
3450 +# Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3452 # This file is included by the global makefile so that you can add your own
3453 # architecture-specific flags and dependencies. Remember to do have actions
3454 # for "archclean" and "archdep" for cleaning up and making dependencies for
3456 # License. See the file "COPYING" in the main directory of this archive
3459 -# Copyright (C) 1994 by Hamish Macdonald
3462 -KBUILD_DEFCONFIG := multi_defconfig
3463 +KBUILD_DEFCONFIG := amiga_defconfig#multi_defconfig
3465 # override top level makefile
3466 +ifndef CONFIG_COLDFIRE
3469 LDFLAGS := -m m68kelf
3470 LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
3471 ifneq ($(SUBARCH),$(ARCH))
3472 @@ -30,12 +32,18 @@ ifdef CONFIG_SUN3
3473 LDFLAGS_vmlinux = -N
3476 +ifdef CONFIG_COLDFIRE
3477 +OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S
3478 +# LDFLAGS_vmlinux = --verbose
3481 CHECKFLAGS += -D__mc68000__
3483 # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
3484 KBUILD_CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
3486 # enable processor switch if compiled only for a single cpu
3487 +ifndef CONFIG_COLDFIRE
3488 ifndef CONFIG_M68020
3489 ifndef CONFIG_M68030
3491 @@ -49,6 +57,17 @@ endif
3497 +ifdef CONFIG_M5445X
3498 +KBUILD_CFLAGS += -march=isac -mcpu=54455 -msoft-float -g
3499 +KBUILD_AFLAGS += -march=isac -mcpu=54455 -msoft-float
3502 +ifdef CONFIG_M547X_8X
3503 +KBUILD_CFLAGS += -mcfv4e -g
3504 +KBUILD_AFLAGS += -mcfv4e
3508 # If configured for kgdb support, include debugging infos and keep the
3509 @@ -57,8 +76,12 @@ KBUILD_CFLAGS := $(subst -fomit-frame-po
3513 +ifndef CONFIG_COLDFIRE
3514 head-y := arch/m68k/kernel/head.o
3516 +head-y := arch/m68k/coldfire/common/head.o
3519 head-y := arch/m68k/kernel/sun3-head.o
3522 @@ -79,7 +102,20 @@ core-$(CONFIG_SUN3) += arch/m68k/sun3/
3523 core-$(CONFIG_M68040) += arch/m68k/fpsp040/
3524 core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
3525 core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/
3526 +core-$(CONFIG_COLDFIRE) += arch/m68k/coldfire/
3528 +ifdef CONFIG_COLDFIRE
3529 +boot := arch/m68k/boot
3533 +zImage zImage.srec uImage uImage.srec vmlinux.srec: vmlinux
3534 + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
3537 + $(Q)$(MAKE) $(clean)=$(boot)
3543 @@ -117,6 +153,7 @@ endif
3546 rm -f vmlinux.gz vmlinux.bz2
3550 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
3551 --- a/arch/m68k/mm/cache.c
3552 +++ b/arch/m68k/mm/cache.c
3554 * Instruction cache handling
3556 * Copyright (C) 1995 Hamish Macdonald
3557 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3558 + * Jason Jin Jason.Jin@freescale.com
3559 + * Shrek Wu B16972@freescale.com
3562 #include <linux/module.h>
3563 #include <asm/pgalloc.h>
3564 #include <asm/traps.h>
3566 +#ifdef CONFIG_COLDFIRE
3567 +#include <asm/cfcache.h>
3568 +#endif /* CONFIG_COLDFIRE */
3570 +#ifndef CONFIG_COLDFIRE
3571 static unsigned long virt_to_phys_slow(unsigned long vaddr)
3574 @@ -69,11 +76,18 @@ static unsigned long virt_to_phys_slow(u
3578 +#endif /* CONFIG_COLDFIRE */
3581 /* Push n pages at kernel virtual address and clear the icache */
3582 /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
3583 void flush_icache_range(unsigned long address, unsigned long endaddr)
3585 +#ifdef CONFIG_COLDFIRE
3586 +// JKM -- hack until new cpushl stuff is in
3587 +// cf_icache_flush_range(address, endaddr);
3589 +#else /* !CONFIG_COLDFIRE */
3591 if (CPU_IS_040_OR_060) {
3592 address &= PAGE_MASK;
3593 @@ -94,9 +108,11 @@ void flush_icache_range(unsigned long ad
3597 +#endif /* CONFIG_COLDFIRE */
3599 EXPORT_SYMBOL(flush_icache_range);
3601 +#ifndef CONFIG_COLDFIRE
3602 void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
3603 unsigned long addr, int len)
3605 @@ -115,4 +131,5 @@ void flush_icache_user_range(struct vm_a
3609 +#endif /* CONFIG_COLDFIRE */
3611 --- a/arch/m68k/mm/hwtest.c
3612 +++ b/arch/m68k/mm/hwtest.c
3614 * them here complete with the comments from the original atari
3616 * -- PMM <pmaydell@chiark.greenend.org.uk>, 05/1998
3618 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3619 + * Jason Jin Jason.Jin@freescale.com
3620 + * Shrek Wu B16972@freescale.com
3623 /* This function tests for the presence of an address, specially a
3626 #include <linux/module.h>
3628 +#ifndef CONFIG_COLDFIRE
3629 int hwreg_present( volatile void *regp )
3632 @@ -82,4 +87,5 @@ int hwreg_write( volatile void *regp, un
3635 EXPORT_SYMBOL(hwreg_write);
3638 --- a/arch/m68k/mm/init.c
3639 +++ b/arch/m68k/mm/init.c
3641 * linux/arch/m68k/mm/init.c
3643 * Copyright (C) 1995 Hamish Macdonald
3644 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3645 + * Jason Jin Jason.Jin@freescale.com
3646 + * Shrek Wu B16972@freescale.com
3648 * Contains common initialization routines, specific init code moved
3649 * to motorola.c and sun3mmu.c
3651 #include <asm/sections.h>
3652 #include <asm/tlb.h>
3655 +int vdso_init(void);
3658 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
3660 pg_data_t pg_data_map[MAX_NUMNODES];
3661 @@ -88,7 +95,6 @@ void __init mem_init(void)
3663 atari_stram_mem_init_hook();
3666 /* this will put all memory onto the freelists */
3667 totalram_pages = num_physpages = 0;
3668 for_each_online_pgdat(pgdat) {
3669 @@ -112,7 +118,7 @@ void __init mem_init(void)
3673 -#ifndef CONFIG_SUN3
3674 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
3675 /* insert pointer tables allocated so far into the tablelist */
3676 init_pointer_table((unsigned long)kernel_pg_dir);
3677 for (i = 0; i < PTRS_PER_PGD; i++) {
3678 @@ -131,6 +137,11 @@ void __init mem_init(void)
3679 codepages << (PAGE_SHIFT-10),
3680 datapages << (PAGE_SHIFT-10),
3681 initpages << (PAGE_SHIFT-10));
3684 + /* init the vdso page */
3689 #ifdef CONFIG_BLK_DEV_INITRD
3690 --- a/arch/m68k/mm/kmap.c
3691 +++ b/arch/m68k/mm/kmap.c
3693 * linux/arch/m68k/mm/kmap.c
3695 * Copyright (C) 1997 Roman Hodek
3696 + * Copyright Freescale Semiconductor, Inc. 2008, 2009
3697 + * Jason Jin Jason.Jin@freescale.com
3698 + * Shrek Wu B16972@freescale.com
3700 * 10/01/99 cleaned up the code and changing to the same interface
3701 * used by other architectures /Roman Zippel
3706 +#ifndef CONFIG_COLDFIRE
3707 #define PTRTREESIZE (256*1024)
3709 +#define PTRTREESIZE PAGE_SIZE
3713 * For 040/060 we can use the virtual memory area like other architectures,
3714 @@ -50,7 +57,11 @@ static inline void free_io_area(void *ad
3718 +#ifdef CONFIG_COLDFIRE
3719 +#define IO_SIZE PAGE_SIZE
3721 #define IO_SIZE (256*1024)
3724 static struct vm_struct *iolist;
3726 @@ -127,8 +138,41 @@ void __iomem *__ioremap(unsigned long ph
3730 +#ifdef CONFIG_M5445X
3731 + if (physaddr >= 0xf0000000) {
3733 + * On the M5445x processors an ACR is setup to map
3734 + * the 0xF0000000 range into kernel memory as
3737 + return (void __iomem *)physaddr;
3739 + if ((physaddr >= KMAP_START) && (physaddr <= KMAP_END)) {
3740 + /* if physaddr belongs to virtual address range for ioremap,
3741 + * then return physaddr because it has been ioremapped
3743 + return (void __iomem *)physaddr;
3746 +#ifdef CONFIG_M547X_8X
3747 + if (physaddr >= 0xf0000000) {
3749 + * On the M547x/M548x processors an ACR is setup to map
3750 + * the 0xF0000000 range into kernel memory as
3753 + return (void __iomem *)physaddr;
3756 + if ((physaddr >= 0xd0000000) && (physaddr + size < 0xd800ffff)) {
3757 + printk(KERN_ERR "ioremap:PCI 0x%lx,0x%lx(%d)"
3758 + " - PCI area hit\n", physaddr, size, cacheflag);
3759 + return (void *)physaddr;
3763 - printk("ioremap: 0x%lx,0x%lx(%d) - ", physaddr, size, cacheflag);
3764 + printk(KERN_ERR "ioremap: paddr=0x%lx,size=0x%lx(%d) - ",
3765 + physaddr, size, cacheflag);
3768 * Mappings have to be aligned
3769 @@ -147,7 +191,8 @@ void __iomem *__ioremap(unsigned long ph
3770 virtaddr = (unsigned long)area->addr;
3771 retaddr = virtaddr + offset;
3773 - printk("0x%lx,0x%lx,0x%lx", physaddr, virtaddr, retaddr);
3774 + printk(KERN_ERR " paddr=0x%lx,vaddr=0x%lx,retaddr=0x%lx",
3775 + physaddr, virtaddr, retaddr);
3779 @@ -172,7 +217,12 @@ void __iomem *__ioremap(unsigned long ph
3783 +#ifndef CONFIG_COLDFIRE
3784 physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
3786 + physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY | \
3789 switch (cacheflag) {
3790 case IOMAP_NOCACHE_SER:
3791 case IOMAP_NOCACHE_NONSER:
3792 @@ -252,6 +302,13 @@ void __iounmap(void *addr, unsigned long
3796 +#ifdef CONFIG_M547X_8X
3797 + if ((addr >= (void *)0xd0000000)
3798 + && (addr + size < (void *)0xd800ffff)) {
3799 + printk(KERN_ERR "%s: PCI address\n", __func__);
3803 while ((long)size > 0) {
3804 pgd_dir = pgd_offset_k(virtaddr);
3805 if (pgd_bad(*pgd_dir)) {
3806 --- a/arch/m68k/mm/Makefile
3807 +++ b/arch/m68k/mm/Makefile
3808 @@ -6,3 +6,5 @@ obj-y := cache.o init.o fault.o hwtest.
3810 obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o
3811 obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o
3812 +obj-$(CONFIG_MMU_CFV4E) += cf-mmu.o kmap.o memory.o
3813 +obj-$(CONFIG_SRAM) += cf-sram.o
3814 --- a/arch/m68k/mm/memory.c
3815 +++ b/arch/m68k/mm/memory.c
3817 * linux/arch/m68k/mm/memory.c
3819 * Copyright (C) 1995 Hamish Macdonald
3820 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3821 + * Jason Jin Jason.Jin@freescale.com
3822 + * Shrek Wu B16972@freescale.com
3826 #include <linux/module.h>
3827 @@ -127,6 +131,7 @@ int free_pointer_table (pmd_t *ptable)
3831 +#ifndef CONFIG_COLDFIRE
3832 /* invalidate page in both caches */
3833 static inline void clear040(unsigned long paddr)
3835 @@ -173,6 +178,7 @@ static inline void pushcl040(unsigned lo
3837 local_irq_restore(flags);
3839 +#endif /* CONFIG_COLDFIRE */
3842 * 040: Hit every page containing an address in the range paddr..paddr+len-1.
3843 @@ -203,6 +209,11 @@ static inline void pushcl040(unsigned lo
3845 void cache_clear (unsigned long paddr, int len)
3847 +#ifdef CONFIG_COLDFIRE
3848 +// JKM -- revise to use proper caching
3849 +// cf_cache_clear(paddr, len);
3852 if (CPU_IS_040_OR_060) {
3855 @@ -237,6 +248,7 @@ void cache_clear (unsigned long paddr, i
3859 +#endif /* CONFIG_COLDFIRE */
3861 EXPORT_SYMBOL(cache_clear);
3863 @@ -250,6 +262,11 @@ EXPORT_SYMBOL(cache_clear);
3865 void cache_push (unsigned long paddr, int len)
3867 +#ifdef CONFIG_COLDFIRE
3868 +// JKM -- revise to use proper caching
3869 +// cf_cache_push(paddr, len);
3872 if (CPU_IS_040_OR_060) {
3873 int tmp = PAGE_SIZE;
3875 @@ -290,6 +307,7 @@ void cache_push (unsigned long paddr, in
3879 +#endif /* CONFIG_COLDFIRE */
3881 EXPORT_SYMBOL(cache_push);
3883 --- a/fs/namespace.c
3884 +++ b/fs/namespace.c
3887 * (C) Copyright Al Viro 2000, 2001
3888 * Released under GPL v2.
3889 + * (c) Copyright Freescale Semiconductor, Inc. 2008, 2009
3890 + * Change to align on page size for coldfire
3891 + * Jason Jin Jason.Jin@freescale.com
3892 + * Shrek Wu B16972@freescale.com
3894 * Based on code from fs/super.c, copyright Linus Torvalds and others.
3895 * Heavily rewritten.
3896 @@ -1858,7 +1862,11 @@ int copy_mount_options(const void __user
3897 /* copy_from_user cannot cross TASK_SIZE ! */
3898 size = TASK_SIZE - (unsigned long)data;
3899 if (size > PAGE_SIZE)
3900 +#ifndef CONFIG_COLDFIRE
3903 + size = PAGE_SIZE - ((unsigned long)data & ~PAGE_MASK);
3906 i = size - exact_copy_from_user((void *)page, data, size);
3908 --- a/include/linux/fsl_devices.h
3909 +++ b/include/linux/fsl_devices.h
3912 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
3914 - * Copyright 2004 Freescale Semiconductor, Inc
3915 + * Copyright 2004-2008 Freescale Semiconductor, Inc
3917 * This program is free software; you can redistribute it and/or modify it
3918 * under the terms of the GNU General Public License as published by the
3920 #define _FSL_DEVICE_H_
3922 #include <linux/types.h>
3923 +#include <linux/interrupt.h>
3926 * Some conventions on how we handle peripherals on Freescale chips
3927 @@ -58,11 +59,42 @@ enum fsl_usb2_phy_modes {
3928 FSL_USB2_PHY_SERIAL,
3931 +struct platform_device;
3932 struct fsl_usb2_platform_data {
3933 /* board specific information */
3934 enum fsl_usb2_operating_modes operating_mode;
3935 enum fsl_usb2_phy_modes phy_mode;
3936 unsigned int port_enables;
3938 + char *name; /* pretty print */
3939 + int (*platform_init) (struct platform_device *);
3940 + void (*platform_uninit) (struct fsl_usb2_platform_data *);
3941 + void __iomem *regs; /* ioremap'd register base */
3942 + u32 xcvr_type; /* PORTSC_PTS_* */
3943 + char *transceiver; /* transceiver name */
3944 + unsigned power_budget; /* for hcd->power_budget */
3945 + struct platform_device *pdev;
3946 + struct fsl_xcvr_ops *xcvr_ops;
3947 + int (*gpio_usb_active) (void);
3948 + void (*gpio_usb_inactive) (void);
3949 + unsigned big_endian_mmio : 1;
3950 + unsigned big_endian_desc : 1;
3951 + unsigned es : 1; /* need USBMODE:ES */
3952 + unsigned have_sysif_regs : 1;
3953 + unsigned le_setup_buf : 1;
3954 + unsigned suspended : 1;
3955 + unsigned already_suspended : 1;
3957 + /* register save area for suspend/resume */
3960 + u32 pm_intr_enable;
3961 + u32 pm_frame_index;
3963 + u32 pm_frame_list;
3964 + u32 pm_async_next;
3965 + u32 pm_configured_flag;
3969 /* Flags in fsl_usb2_mph_platform_data */
3970 @@ -92,4 +124,30 @@ struct mpc8xx_pcmcia_ops {
3972 int fsl_deep_sleep(void);
3974 +struct fsl_ata_platform_data {
3975 +#ifdef CONFIG_FSL_PATA_USE_DMA
3976 + int udma_mask; /* UDMA modes h/w can handle */
3977 + int fifo_alarm; /* value for fifo_alarm reg */
3978 + int max_sg; /* longest sglist h/w can handle */
3980 + int (*init)(struct platform_device *pdev);
3981 + void (*exit)(void);
3982 + int (*get_clk_rate)(void);
3985 +struct coldfire_fec_platform_data {
3987 + unsigned int *fec_hw;
3988 + void (*request_intrs)(struct net_device *dev,
3989 + irqreturn_t (*)(int, void *),
3990 + void *irq_privatedata);
3991 + void (*set_mii)(struct net_device *dev);
3992 + void (*get_mac)(struct net_device *dev);
3993 + void (*enable_phy_intr)(void);
3994 + void (*disable_phy_intr)(void);
3995 + void (*phy_ack_intr)(void);
3996 + void (*localhw_setup)(void);
3997 + void (*uncache)(unsigned long addr);
3998 + void (*platform_flush_cache)(void);
4000 #endif /* _FSL_DEVICE_H_ */