generic: ar8216: use the generic get_port_link implementation
[openwrt.git] / target / linux / coldfire / patches-2.6.31 / 001-coldfire_support.patch
1 --- a/arch/m68k/include/asm/atomic_mm.h
2 +++ b/arch/m68k/include/asm/atomic_mm.h
3 @@ -20,12 +20,20 @@
4
5 static inline void atomic_add(int i, atomic_t *v)
6 {
7 +#ifndef CONFIG_COLDFIRE
8 __asm__ __volatile__("addl %1,%0" : "+m" (*v) : "id" (i));
9 +#else
10 + __asm__ __volatile__("addl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
11 +#endif
12 }
13
14 static inline void atomic_sub(int i, atomic_t *v)
15 {
16 +#ifndef CONFIG_COLDFIRE
17 __asm__ __volatile__("subl %1,%0" : "+m" (*v) : "id" (i));
18 +#else
19 + __asm__ __volatile__("subl %1,%0" : "=m" (*v) : "d" (i), "m" (*v));
20 +#endif
21 }
22
23 static inline void atomic_inc(atomic_t *v)
24 @@ -45,6 +53,14 @@ static inline int atomic_dec_and_test(at
25 return c != 0;
26 }
27
28 +static __inline__ int atomic_dec_and_test_lt(volatile atomic_t *v)
29 +{
30 + char c;
31 + __asm__ __volatile__("subql #1,%1; slt %0" : "=d" (c), "=m" (*v)
32 + : "m" (*v));
33 + return c != 0 ;
34 +}
35 +
36 static inline int atomic_inc_and_test(atomic_t *v)
37 {
38 char c;
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)
41 {
42 char c;
43 +#ifndef CONFIG_COLDFIRE
44 __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "+m" (*v): "g" (i));
45 +#else
46 + __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "=m" (*v)
47 + : "d" (i) , "m" (*v));
48 +#endif
49 return c != 0;
50 }
51
52 --- a/arch/m68k/include/asm/bitops_mm.h
53 +++ b/arch/m68k/include/asm/bitops_mm.h
54 @@ -8,6 +8,10 @@
55 * for more details.
56 */
57
58 +#ifdef CONFIG_COLDFIRE
59 +#include <asm/cf_bitops.h>
60 +#else
61 +
62 #ifndef _LINUX_BITOPS_H
63 #error only <linux/bitops.h> can be included directly
64 #endif
65 @@ -461,4 +465,6 @@ static inline int ext2_find_next_bit(con
66
67 #endif /* __KERNEL__ */
68
69 +#endif /* CONFIG_COLDFIRE */
70 +
71 #endif /* _M68K_BITOPS_H */
72 --- a/arch/m68k/include/asm/bootinfo.h
73 +++ b/arch/m68k/include/asm/bootinfo.h
74 @@ -25,6 +25,51 @@
75 #define _M68K_BOOTINFO_H
76
77
78 +#ifndef __ASSEMBLY__
79 +/*
80 + * UBoot Support
81 + *
82 + * bd_info structure from uboot1.3.2/arch/m68k/include/asm/u-boot.h
83 + */
84 +
85 +struct bd_info {
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 */
105 +#endif
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 */
110 +};
111 +
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;
118 +};
119 +
120 +#endif /* __ASSEMBLY__ */
121 +
122 +
123 /*
124 * Bootinfo definitions
125 *
126 --- a/arch/m68k/include/asm/cacheflush_mm.h
127 +++ b/arch/m68k/include/asm/cacheflush_mm.h
128 @@ -6,6 +6,9 @@
129 /* cache code */
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 */
135
136 /*
137 * Cache handling functions
138 @@ -153,4 +156,5 @@ static inline void copy_from_user_page(s
139 memcpy(dst, src, len);
140 }
141
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(
147 void *dst, int len,
148 __wsum sum);
149
150 +#ifndef CONFIG_COLDFIRE /* CF has own copy in arch/m68k/lib/checksum.c */
151 /*
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
155 : "memory");
156 return (__force __sum16)~sum;
157 }
158 +#else
159 +extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
160 +#endif
161
162 /*
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)
166 {
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;
172 +#else
173 __asm__("swap %1\n\t"
174 "addw %1, %0\n\t"
175 "clrw %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;
180 +#endif
181 }
182
183
184 --- a/arch/m68k/include/asm/coldfire.h
185 +++ b/arch/m68k/include/asm/coldfire.h
186 @@ -5,6 +5,9 @@
187 *
188 * (C) Copyright 1999-2006, Greg Ungerer (gerg@snapgear.com)
189 * (C) Copyright 2000, Lineo (www.lineo.com)
190 + *
191 + * Shrek Wu b16972@freescale.com
192 + * Copyright Freescale Semiconductor, Inc. 2009
193 */
194
195 /****************************************************************************/
196 @@ -19,25 +22,78 @@
197 * here. Also the peripheral clock (bus clock) divide ratio is set
198 * at config time too.
199 */
200 +/*FIXME Jason*/
201 +#if 0
202 #ifdef CONFIG_CLOCK_SET
203 #define MCF_CLK CONFIG_CLOCK_FREQ
204 #define MCF_BUSCLK (CONFIG_CLOCK_FREQ / CONFIG_CLOCK_DIV)
205 #else
206 #error "Don't know what your ColdFire CPU clock frequency is??"
207 #endif
208 +#endif
209 +
210 +
211 +#define MCF_CLK CONFIG_MCFCLK
212 +#define MCF_BUSCLK (CONFIG_MCFCLK/2)
213 +
214 +
215 +#if defined(CONFIG_M520x)
216 +#define MCF_IPSBAR 0xFC000000
217 +#else
218 +#define MCF_IPSBAR 0x40000000
219 +#endif
220
221 +#if defined(CONFIG_M5445X)
222 +#define MCF_MBAR 0x0
223 +/*
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.
227 + */
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
234 +#else
235 /*
236 * Define the processor support peripherals base address.
237 * This is generally setup by the boards start up code.
238 */
239 #define MCF_MBAR 0x10000000
240 #define MCF_MBAR2 0x80000000
241 -#if defined(CONFIG_M520x)
242 -#define MCF_IPSBAR 0xFC000000
243 -#else
244 -#define MCF_IPSBAR 0x40000000
245 #endif
246
247 +#ifdef __ASSEMBLY__
248 +#define REG32
249 +#define REG16
250 +#define REG08
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))
255 +
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))
259 +
260 +void cacr_set(unsigned long);
261 +unsigned long cacr_get(void);
262 +
263 +#define coldfire_enable_irq0(irq) MCF_INTC0_CIMR = (irq);
264 +
265 +#define coldfire_enable_irq1(irq) MCF_INTC1_CIMR = (irq);
266 +
267 +#define coldfire_disable_irq0(irq) MCF_INTC0_SIMR = (irq);
268 +
269 +#define coldfire_disable_irq1(irq) MCF_INTC1_SIMR = (irq);
270 +
271 +#define getiprh() MCF_INTC0_IPRH
272 +
273 +#endif /* __ASSEMBLY__ */
274 +
275 +
276 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
277 defined(CONFIG_M520x)
278 #undef MCF_MBAR
279 --- a/arch/m68k/include/asm/delay_mm.h
280 +++ b/arch/m68k/include/asm/delay_mm.h
281 @@ -11,8 +11,25 @@
282
283 static inline void __delay(unsigned long loops)
284 {
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.
295 + */
296 + __asm__ __volatile__ (".balignw 4, 0x4a8e\n\t"
297 + "1: subql #1, %0\n\t"
298 + "jcc 1b"
299 + : "=d" (loops) : "0" (loops));
300 +#else
301 __asm__ __volatile__ ("1: subql #1,%0; jcc 1b"
302 : "=d" (loops) : "0" (loops));
303 +#endif
304 }
305
306 extern void __bad_udelay(void);
307 @@ -26,12 +43,17 @@ extern void __bad_udelay(void);
308 */
309 static inline void __const_udelay(unsigned long xloops)
310 {
311 +#if defined(CONFIG_COLDFIRE)
312 +
313 + __delay(((((unsigned long long) xloops * loops_per_jiffy))>>32)*HZ);
314 +#else
315 unsigned long tmp;
316
317 __asm__ ("mulul %2,%0:%1"
318 : "=d" (xloops), "=d" (tmp)
319 : "d" (xloops), "1" (loops_per_jiffy));
320 __delay(xloops * HZ);
321 +#endif
322 }
323
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,
327 unsigned long c)
328 {
329 +#if defined(CONFIG_COLDFIRE)
330 + return (long)(((unsigned long long)a * b)/c);
331 +#else
332 unsigned long tmp;
333
334 __asm__ ("mulul %2,%0:%1; divul %3,%0:%1"
335 : "=d" (tmp), "=d" (a)
336 : "d" (b), "d" (c), "1" (a));
337 return a;
338 +#endif
339 }
340
341 #endif /* defined(_M68K_DELAY_H) */
342 --- a/arch/m68k/include/asm/div64.h
343 +++ b/arch/m68k/include/asm/div64.h
344 @@ -1,7 +1,7 @@
345 #ifndef _M68K_DIV64_H
346 #define _M68K_DIV64_H
347
348 -#ifdef CONFIG_MMU
349 +#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
350
351 #include <linux/types.h>
352
353 --- a/arch/m68k/include/asm/dma_mm.h
354 +++ b/arch/m68k/include/asm/dma_mm.h
355 @@ -4,13 +4,126 @@
356
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
362 +#else
363 #define MAX_DMA_ADDRESS PAGE_OFFSET
364 +#endif
365
366 +#ifndef CONFIG_COLDFIRE
367 #define MAX_DMA_CHANNELS 8
368
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 */
371
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>
380 +
381 +struct scatterlist;
382 +
383 +#define MAX_DMA_CHANNELS NCHANNELS
384 +/*
385 + * identifiers for each initiator/requestor
386 + */
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)
425 +
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);
436 +int dma_init(void);
437 +#endif /* CONFIG_MCD_DMA */
438 +
439 +extern spinlock_t dma_spin_lock;
440 +
441 +static __inline__ unsigned long claim_dma_lock(void)
442 +{
443 + unsigned long flags;
444 + spin_lock_irqsave(&dma_spin_lock, flags);
445 + return flags;
446 +}
447 +
448 +static __inline__ void release_dma_lock(unsigned long flags)
449 +{
450 + spin_unlock_irqrestore(&dma_spin_lock, flags);
451 +}
452 +
453 +
454 +/*
455 + * Linux standard DMA stuff
456 + */
457 +#if 0
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);
470 +#endif
471 +#define clear_dma_ff(channel)
472 +
473 +#endif
474 +
475 +#ifdef CONFIG_PCI
476 +extern int isa_dma_bridge_buggy;
477 +#else
478 #define isa_dma_bridge_buggy (0)
479 +#endif
480
481 #endif /* _M68K_DMA_H */
482 --- a/arch/m68k/include/asm/elf.h
483 +++ b/arch/m68k/include/asm/elf.h
484 @@ -35,6 +35,27 @@
485 #define R_68K_JMP_SLOT 21
486 #define R_68K_RELATIVE 22
487
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
508 +
509 typedef unsigned long elf_greg_t;
510
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
514
515 #define USE_ELF_CORE_DUMP
516 -#ifndef CONFIG_SUN3
517 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
518 #define ELF_EXEC_PAGESIZE 4096
519 #else
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. */
524
525 -#ifndef CONFIG_SUN3
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)
530 #else
531 #define ELF_ET_DYN_BASE 0x0D800000UL
532 #endif
533 @@ -116,4 +139,35 @@ typedef struct user_m68kfp_struct elf_fp
534
535 #define SET_PERSONALITY(ex) set_personality(PER_LINUX)
536
537 +/*
538 + * VDSO
539 + */
540 +#ifdef CONFIG_VDSO
541 +extern unsigned int vdso_enabled;
542 +
543 +#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
544 +#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
545 +
546 +#define VDSO_AUX_ENT \
547 + if (vdso_enabled) \
548 + NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);
549 +
550 +/* additional pages */
551 +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
552 +
553 +struct linux_binprm;
554 +extern int arch_setup_additional_pages(struct linux_binprm *bprm,
555 + int executable_stack);
556 +
557 +#else
558 +/* no VDSO_AUX_ENT */
559 +#define VDSO_AUX_ENT
560 +#endif
561 +
562 +#define ARCH_DLINFO \
563 +do { \
564 + /* vdso entry */ \
565 + VDSO_AUX_ENT; \
566 +} while (0);
567 +
568 #endif
569 --- a/arch/m68k/include/asm/io_mm.h
570 +++ b/arch/m68k/include/asm/io_mm.h
571 @@ -7,17 +7,24 @@
572 * - added skeleton for GG-II and Amiga PCMCIA
573 * 2/3/01 RZ: - moved a few more defs into raw_io.h
574 *
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.
580 *
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
585 + *
586 + * moved mem{cpy,set}_*io inside CONFIG_PCI
587 */
588
589 #ifndef _IO_H
590 #define _IO_H
591
592 +#ifdef CONFIG_COLDFIRE
593 +#include <asm/cf_io.h>
594 +#else
595 +
596 #ifdef __KERNEL__
597
598 #include <linux/compiler.h>
599 @@ -88,20 +95,20 @@ extern unsigned long gg2_isa_base;
600 #undef MULTI_ISA
601 #endif
602
603 -#define ISA_TYPE_Q40 (1)
604 -#define ISA_TYPE_GG2 (2)
605 -#define ISA_TYPE_AG (3)
606 +#define Q40_ISA (1)
607 +#define GG2_ISA (2)
608 +#define AG_ISA (3)
609
610 #if defined(CONFIG_Q40) && !defined(MULTI_ISA)
611 -#define ISA_TYPE ISA_TYPE_Q40
612 +#define ISA_TYPE Q40_ISA
613 #define ISA_SEX 0
614 #endif
615 #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
616 -#define ISA_TYPE ISA_TYPE_AG
617 +#define ISA_TYPE AG_ISA
618 #define ISA_SEX 1
619 #endif
620 #if defined(CONFIG_GG2) && !defined(MULTI_ISA)
621 -#define ISA_TYPE ISA_TYPE_GG2
622 +#define ISA_TYPE GG2_ISA
623 #define ISA_SEX 0
624 #endif
625
626 @@ -123,13 +130,13 @@ static inline u8 __iomem *isa_itb(unsign
627 switch(ISA_TYPE)
628 {
629 #ifdef CONFIG_Q40
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);
632 #endif
633 #ifdef CONFIG_GG2
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);
636 #endif
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);
640 #endif
641 default: return NULL; /* avoid warnings, just in case */
642 }
643 @@ -139,13 +146,13 @@ static inline u16 __iomem *isa_itw(unsig
644 switch(ISA_TYPE)
645 {
646 #ifdef CONFIG_Q40
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);
649 #endif
650 #ifdef CONFIG_GG2
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);
653 #endif
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);
657 #endif
658 default: return NULL; /* avoid warnings, just in case */
659 }
660 @@ -155,7 +162,7 @@ static inline u32 __iomem *isa_itl(unsig
661 switch(ISA_TYPE)
662 {
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);
666 #endif
667 default: return 0; /* avoid warnings, just in case */
668 }
669 @@ -165,13 +172,13 @@ static inline u8 __iomem *isa_mtb(unsign
670 switch(ISA_TYPE)
671 {
672 #ifdef CONFIG_Q40
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);
675 #endif
676 #ifdef CONFIG_GG2
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);
679 #endif
680 #ifdef CONFIG_AMIGA_PCMCIA
681 - case ISA_TYPE_AG: return (u8 __iomem *)addr;
682 + case AG_ISA: return (u8 __iomem *)addr;
683 #endif
684 default: return NULL; /* avoid warnings, just in case */
685 }
686 @@ -181,13 +188,13 @@ static inline u16 __iomem *isa_mtw(unsig
687 switch(ISA_TYPE)
688 {
689 #ifdef CONFIG_Q40
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);
692 #endif
693 #ifdef CONFIG_GG2
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);
696 #endif
697 #ifdef CONFIG_AMIGA_PCMCIA
698 - case ISA_TYPE_AG: return (u16 __iomem *)addr;
699 + case AG_ISA: return (u16 __iomem *)addr;
700 #endif
701 default: return NULL; /* avoid warnings, just in case */
702 }
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)))
706
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)))
715 -
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)
721 {
722 - switch(ISA_TYPE)
723 - {
724 + switch (ISA_TYPE) {
725 #ifdef CONFIG_Q40
726 - case ISA_TYPE_Q40: isa_outb(0,0x80); break;
727 + case Q40_ISA:
728 + isa_outb(0, 0x80);
729 + break;
730 #endif
731 #ifdef CONFIG_GG2
732 - case ISA_TYPE_GG2: break;
733 + case GG2_ISA:
734 + break;
735 #endif
736 #ifdef CONFIG_AMIGA_PCMCIA
737 - case ISA_TYPE_AG: break;
738 + case AG_ISA:
739 + break;
740 #endif
741 - default: break; /* avoid warnings */
742 - }
743 + default:
744 + break; /* avoid warnings */
745 + }
746 }
747
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))
752
753 +#endif /* CONFIG_ISA */
754
755 +
756 +#if defined(CONFIG_ISA) && !defined(CONFIG_PCI)
757 #define inb isa_inb
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 */
765 +
766 +#if defined(CONFIG_PCI)
767 +
768 +#define readl(addr) in_le32(addr)
769 +#define writel(val, addr) out_le32((addr), (val))
770 +
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))
776 +
777 +#define readb_relaxed(addr) readb(addr)
778 +#define readw_relaxed(addr) readw(addr)
779 +#define readl_relaxed(addr) readl(addr)
780 +
781 +#ifndef CONFIG_ISA
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)
800 +
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
807
808 -#else /* CONFIG_ISA */
809 +#else
810 +/*
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
814 + * in this case
815 + */
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))
822 +
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)))
835 +#endif
836 +#endif /* CONFIG_PCI */
837
838 +#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI)
839 /*
840 * We need to define dummy functions for GENERIC_IOMAP support.
841 */
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))
846 -
847 -#endif /* CONFIG_ISA */
848 -
849 +#endif
850 +#if !defined(CONFIG_PCI)
851 #define readl(addr) in_le32(addr)
852 #define writel(val,addr) out_le32((addr),(val))
853 +#endif
854
855 #define mmiowb()
856
857 @@ -345,10 +425,10 @@ static inline void memcpy_toio(volatile
858 __builtin_memcpy((void __force *) dst, src, count);
859 }
860
861 -#ifndef CONFIG_SUN3
862 -#define IO_SPACE_LIMIT 0xffff
863 -#else
864 +#if defined(CONFIG_SUN3)
865 #define IO_SPACE_LIMIT 0x0fffffff
866 +#else
867 +#define IO_SPACE_LIMIT 0xffff
868 #endif
869
870 #endif /* __KERNEL__ */
871 @@ -366,4 +446,5 @@ static inline void memcpy_toio(volatile
872 */
873 #define xlate_dev_kmem_ptr(p) p
874
875 +#endif /* CONFIG_COLDFIRE */
876 #endif /* _IO_H */
877 --- a/arch/m68k/include/asm/irq_mm.h
878 +++ b/arch/m68k/include/asm/irq_mm.h
879 @@ -12,7 +12,10 @@
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.
882 */
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)
888 #define NR_IRQS 200
889 #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC)
890 #define NR_IRQS 72
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);
896
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);
902 +#endif
903 +
904 #endif /* _M68K_MACHDEP_H */
905 --- a/arch/m68k/include/asm/mcfsim.h
906 +++ b/arch/m68k/include/asm/mcfsim.h
907 @@ -39,6 +39,25 @@
908 #include <asm/m5407sim.h>
909 #endif
910
911 +#if defined(CONFIG_COLDFIRE)
912 +#include <asm/coldfire.h>
913 +#endif
914 +
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>
929 +#endif
930
931 /*
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
936 }
937
938 #ifdef CONFIG_MMU
939 -#ifndef CONFIG_SUN3
940 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
941
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);
946 }
947
948 -#else /* CONFIG_SUN3 */
949 +#elif defined(CONFIG_SUN3)
950 #include <asm/sun3mmu.h>
951 #include <linux/sched.h>
952
953 @@ -151,7 +151,179 @@ static inline void activate_mm(struct mm
954 activate_context(next_mm);
955 }
956
957 +#else /* CONFIG_COLDFIRE */
958 +
959 +#include <asm/coldfire.h>
960 +#include <asm/atomic.h>
961 +#include <asm/bitops.h>
962 +#include <asm/mmu.h>
963 +
964 +#define NO_CONTEXT 256
965 +#define LAST_CONTEXT 255
966 +#define FIRST_CONTEXT 1
967 +
968 +#ifdef CONFIG_VDSO
969 +#define cpu_context(mm) ((mm)->context.id)
970 +#else
971 +#define cpu_context(mm) ((mm)->context)
972 +#endif
973 +
974 +#ifdef CONFIG_VDSO
975 +extern void set_context(unsigned long context, pgd_t *pgd);
976 +#else
977 +extern void set_context(mm_context_t context, pgd_t *pgd);
978 +#endif
979 +extern unsigned long context_map[];
980 +#ifdef CONFIG_VDSO
981 +extern unsigned long next_mmu_context;
982 +#else
983 +extern mm_context_t next_mmu_context;
984 +#endif
985 +
986 +
987 +extern atomic_t nr_free_contexts;
988 +extern struct mm_struct *context_mm[LAST_CONTEXT+1];
989 +extern void steal_context(void);
990 +
991 +static inline void get_mmu_context(struct mm_struct *mm)
992 +{
993 +#ifdef CONFIG_VDSO
994 + unsigned long ctx;
995 +#else
996 + mm_context_t ctx;
997 #endif
998 +
999 + if (cpu_context(mm) != NO_CONTEXT)
1000 + return;
1001 + while (atomic_dec_and_test_lt(&nr_free_contexts)) {
1002 + atomic_inc(&nr_free_contexts);
1003 + steal_context();
1004 + }
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)
1009 + ctx = 0;
1010 + }
1011 + next_mmu_context = (ctx + 1) & LAST_CONTEXT;
1012 + cpu_context(mm) = ctx;
1013 + context_mm[ctx] = mm;
1014 +}
1015 +
1016 +/*
1017 + * Set up the context for a new address space.
1018 + */
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) */
1021 +
1022 +/*
1023 + * We're finished using the context for an address space.
1024 + */
1025 +static inline void destroy_context(struct mm_struct *mm)
1026 +{
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);
1031 + }
1032 +}
1033 +
1034 +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
1035 + struct task_struct *tsk)
1036 +{
1037 + get_mmu_context(tsk->mm);
1038 + set_context(cpu_context(tsk->mm), next->pgd);
1039 +}
1040 +
1041 +/*
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.
1044 + */
1045 +static inline void activate_mm(struct mm_struct *active_mm,
1046 + struct mm_struct *mm)
1047 +{
1048 + get_mmu_context(mm);
1049 + set_context(cpu_context(mm), mm->pgd);
1050 +}
1051 +
1052 +#define deactivate_mm(tsk, mm) do { } while (0)
1053 +
1054 +extern void mmu_context_init(void);
1055 +#if defined(CONFIG_M547X_8X)
1056 +#define prepare_arch_switch(next) load_ksp_mmu(next)
1057 +
1058 +static inline void load_ksp_mmu(struct task_struct *task)
1059 +{
1060 + int flags;
1061 + struct mm_struct *mm;
1062 + int asid;
1063 + pgd_t *pgd;
1064 + pmd_t *pmd;
1065 + pte_t *pte;
1066 + unsigned long mmuar;
1067 +
1068 + local_irq_save(flags);
1069 + mmuar = task->thread.ksp;
1070 +
1071 + /* Search for a valid TLB entry, if one is found, don't remap */
1072 + *MMUAR = mmuar;
1073 + *MMUOR = MMUOR_STLB | MMUOR_ADR;
1074 + if ((*MMUSR) & MMUSR_HIT)
1075 + goto end;
1076 +
1077 + if (mmuar >= PAGE_OFFSET) {
1078 + mm = &init_mm;
1079 + } else {
1080 + printk(KERN_INFO "load_ksp_mmu: non-kernel"
1081 + " mm found: 0x%08x\n", (unsigned int) task->mm);
1082 + mm = task->mm;
1083 + }
1084 +
1085 + if (!mm)
1086 + goto bug;
1087 +
1088 + pgd = pgd_offset(mm, mmuar);
1089 + if (pgd_none(*pgd))
1090 + goto bug;
1091 +
1092 + pmd = pmd_offset(pgd, mmuar);
1093 + if (pmd_none(*pmd))
1094 + goto bug;
1095 +
1096 + pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar)
1097 + : pte_offset_map(pmd, mmuar);
1098 + if (pte_none(*pte) || !pte_present(*pte))
1099 + goto bug;
1100 +
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));
1105 +
1106 + *MMUTR = (mmuar & PAGE_MASK) | (asid << CF_ASID_MMU_SHIFT)
1107 + | (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK)
1108 + >> CF_PAGE_MMUTR_SHIFT)
1109 + | MMUTR_V;
1110 +
1111 + *MMUDR = (pte_val(*pte) & PAGE_MASK)
1112 + | ((pte->pte) & CF_PAGE_MMUDR_MASK)
1113 + | MMUDR_SZ8K | MMUDR_X;
1114 +
1115 + *MMUOR = MMUOR_ACC | MMUOR_UAA;
1116 + asm ("nop");
1117 +
1118 + goto end;
1119 +
1120 +bug:
1121 + printk(KERN_ERR "ksp load failed: mm=0x%08x ksp=0x%08x\n",
1122 + (unsigned int) mm, (unsigned int) mmuar);
1123 +end:
1124 + local_irq_restore(flags);
1125 +}
1126 +#endif /* CONFIG_M547X_8X */
1127 +
1128 +#endif /* CONFIG_COLDFIRE */
1129 +
1130 #else /* !CONFIG_MMU */
1131
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
1135 @@ -1,10 +1,15 @@
1136 #ifndef _M68K_PAGE_H
1137 #define _M68K_PAGE_H
1138
1139 +/*#if defined(CONFIG_COLDFIRE)*/
1140 +#if defined(CONFIG_M5445X) || defined(CONFIG_M547X_8X)
1141 +#include <asm/cf_page.h>
1142 +#else
1143 +
1144 #include <linux/const.h>
1145
1146 /* PAGE_SHIFT determines the page size */
1147 -#ifndef CONFIG_SUN3
1148 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1149 #define PAGE_SHIFT (12)
1150 #else
1151 #define PAGE_SHIFT (13)
1152 @@ -113,10 +118,31 @@ typedef struct page *pgtable_t;
1153
1154 extern unsigned long m68k_memoffset;
1155
1156 -#ifndef CONFIG_SUN3
1157 +#if !defined(CONFIG_SUN3)
1158
1159 #define WANT_PAGE_VIRTUAL
1160
1161 +#if defined(CONFIG_COLDFIRE)
1162 +static inline unsigned long ___pa(void *vaddr)
1163 +{
1164 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1165 + return (((unsigned long)vaddr & 0x0fffffff) + CONFIG_SDRAM_BASE);
1166 +#else
1167 + return (unsigned long)vaddr;
1168 +#endif
1169 +}
1170 +#define __pa(vaddr) ___pa((void *)(vaddr))
1171 +
1172 +static inline void *__va(unsigned long paddr)
1173 +{
1174 +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
1175 + return (void *)((paddr & 0x0fffffff) + PAGE_OFFSET);
1176 +#else
1177 + return (void *)paddr;
1178 +#endif
1179 +}
1180 +
1181 +#else
1182 static inline unsigned long ___pa(void *vaddr)
1183 {
1184 unsigned long paddr;
1185 @@ -138,6 +164,7 @@ static inline void *__va(unsigned long p
1186 : "0" (paddr), "i" (m68k_fixup_memoffset));
1187 return vaddr;
1188 }
1189 +#endif
1190
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.
1197 + *
1198 + * PFNs are used to map physical pages. So PFN[0] maps to the base phys addr.
1199 */
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 __
1203
1204 #include <asm-generic/getorder.h>
1205
1206 +#ifdef CONFIG_VDSO
1207 +/* vDSO support */
1208 +#define __HAVE_ARCH_GATE_AREA
1209 +#endif
1210 +
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
1215 @@ -1,10 +1,13 @@
1216 /* This handles the memory map.. */
1217
1218 #ifdef CONFIG_MMU
1219 -#ifndef CONFIG_SUN3
1220 -#define PAGE_OFFSET_RAW 0x00000000
1221 -#else
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)
1227 +#else
1228 +#define PAGE_OFFSET_RAW 0x00000000
1229 #endif
1230 #else
1231 #define PAGE_OFFSET_RAW CONFIG_RAMBASE
1232 --- a/arch/m68k/include/asm/pgalloc.h
1233 +++ b/arch/m68k/include/asm/pgalloc.h
1234 @@ -7,8 +7,10 @@
1235
1236 #ifdef CONFIG_MMU
1237 #include <asm/virtconvert.h>
1238 -#ifdef CONFIG_SUN3
1239 +#if defined (CONFIG_SUN3)
1240 #include <asm/sun3_pgalloc.h>
1241 +#elif defined(CONFIG_COLDFIRE)
1242 +#include <asm/cf_pgalloc.h>
1243 #else
1244 #include <asm/motorola_pgalloc.h>
1245 #endif
1246 --- a/arch/m68k/include/asm/pgtable_mm.h
1247 +++ b/arch/m68k/include/asm/pgtable_mm.h
1248 @@ -40,6 +40,8 @@
1249 /* PGDIR_SHIFT determines what a third-level page table entry can map */
1250 #ifdef CONFIG_SUN3
1251 #define PGDIR_SHIFT 17
1252 +#elif defined(CONFIG_COLDFIRE)
1253 +#define PGDIR_SHIFT 22
1254 #else
1255 #define PGDIR_SHIFT 25
1256 #endif
1257 @@ -54,6 +56,10 @@
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
1265 #else
1266 #define PTRS_PER_PTE 1024
1267 #define PTRS_PER_PMD 8
1268 @@ -66,6 +72,11 @@
1269 #ifdef CONFIG_SUN3
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
1277 #else
1278 #define KMAP_START 0xd0000000
1279 #define KMAP_END 0xf0000000
1280 @@ -79,9 +90,11 @@
1281 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
1282 * area for the same reason. ;)
1283 */
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
1288 +#endif
1289 #else
1290 extern unsigned long vmalloc_end;
1291 #define VMALLOC_START 0x0f800000
1292 @@ -130,6 +143,8 @@ static inline void update_mmu_cache(stru
1293
1294 #ifdef CONFIG_SUN3
1295 #include <asm/sun3_pgtable.h>
1296 +#elif defined(CONFIG_COLDFIRE)
1297 +#include <asm/cf_pgtable.h>
1298 #else
1299 #include <asm/motorola_pgtable.h>
1300 #endif
1301 @@ -138,6 +153,9 @@ static inline void update_mmu_cache(stru
1302 /*
1303 * Macro to mark a page protection value as "uncacheable".
1304 */
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
1310 #else
1311 @@ -152,6 +170,7 @@ static inline void update_mmu_cache(stru
1312 ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \
1313 : (prot)))
1314
1315 +#endif /* CONFIG_COLDFIRE */
1316 #include <asm-generic/pgtable.h>
1317 #endif /* !__ASSEMBLY__ */
1318
1319 --- a/arch/m68k/include/asm/processor_mm.h
1320 +++ b/arch/m68k/include/asm/processor_mm.h
1321 @@ -2,6 +2,7 @@
1322 * include/asm-m68k/processor.h
1323 *
1324 * Copyright (C) 1995 Hamish Macdonald
1325 + * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
1326 */
1327
1328 #ifndef __ASM_M68K_PROCESSOR_H
1329 @@ -22,24 +23,38 @@ static inline unsigned long rdusp(void)
1330 {
1331 unsigned long usp;
1332
1333 +#ifndef CONFIG_COLDFIRE
1334 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
1335 +#else
1336 + __asm__ __volatile__("movel %/usp,%0" : "=a" (usp));
1337 +#endif
1338 return usp;
1339 }
1340
1341 static inline void wrusp(unsigned long usp)
1342 {
1343 +#ifndef CONFIG_COLDFIRE
1344 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
1345 +#else
1346 + __asm__ __volatile__("movel %0,%/usp" : : "a" (usp));
1347 +#endif
1348 }
1349
1350 /*
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.
1353 */
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)
1362 #else
1363 #define TASK_SIZE (0x0E000000UL)
1364 #endif
1365 +#endif
1366
1367 #ifdef __KERNEL__
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.
1372 */
1373 -#ifndef CONFIG_SUN3
1374 -#define TASK_UNMAPPED_BASE 0xC0000000UL
1375 -#else
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
1382 #endif
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) */
1390 +#else
1391 + mm_segment_t fs;
1392 +#endif
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 {
1397 /*
1398 * Do necessary setup to start up a newly executed thread.
1399 */
1400 +#ifndef CONFIG_COLDFIRE
1401 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
1402 unsigned long usp)
1403 {
1404 @@ -91,6 +113,23 @@ static inline void start_thread(struct p
1405 regs->sr &= ~0x2000;
1406 wrusp(usp);
1407 }
1408 +#else
1409 +/*
1410 + * Do necessary setup to start up a newly executed thread.
1411 + *
1412 + * pass the data segment into user programs if it exists,
1413 + * it can't hurt anything as far as I can tell
1414 + */
1415 +#define start_thread(_regs, _pc, _usp) \
1416 +do { \
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; \
1422 + wrusp(_usp); \
1423 +} while (0)
1424 +#endif
1425
1426 /* Forward declaration, a strange C thing */
1427 struct task_struct;
1428 --- a/arch/m68k/include/asm/ptrace.h
1429 +++ b/arch/m68k/include/asm/ptrace.h
1430 @@ -39,10 +39,21 @@ struct pt_regs {
1431 long orig_d0;
1432 long stkadj;
1433 #ifdef CONFIG_COLDFIRE
1434 +#if 0
1435 unsigned format : 4; /* frame format specifier */
1436 unsigned vector : 12; /* vector offset */
1437 unsigned short sr;
1438 unsigned long pc;
1439 +#endif
1440 +/*FROM BSP*/
1441 + unsigned long mmuar;
1442 + unsigned long mmusr;
1443 + unsigned format : 4; /* frame format specifier */
1444 + unsigned fs2 : 2;
1445 + unsigned vector: 8;
1446 + unsigned fs1 : 2;
1447 + unsigned short sr;
1448 + unsigned long pc;
1449 #else
1450 unsigned short sr;
1451 unsigned long pc;
1452 @@ -71,6 +82,8 @@ struct switch_stack {
1453 #define PTRACE_GETFPREGS 14
1454 #define PTRACE_SETFPREGS 15
1455
1456 +#define PTRACE_GET_THREAD_AREA 25
1457 +
1458 #ifdef __KERNEL__
1459
1460 #ifndef PS_S
1461 --- a/arch/m68k/include/asm/raw_io.h
1462 +++ b/arch/m68k/include/asm/raw_io.h
1463 @@ -8,6 +8,10 @@
1464 #ifndef _RAW_IO_H
1465 #define _RAW_IO_H
1466
1467 +#ifdef CONFIG_COLDFIRE
1468 +#include <asm/cf_raw_io.h>
1469 +#else
1470 +
1471 #ifdef __KERNEL__
1472
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))
1477
1478 +#define swap_inw(port) in_le16((port))
1479 +#define swap_outw(val,port) out_le16((port),(val))
1480 +
1481 static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
1482 {
1483 unsigned int i;
1484 @@ -344,4 +351,6 @@ static inline void raw_outsw_swapw(volat
1485
1486 #endif /* __KERNEL__ */
1487
1488 +#endif /* CONFIG_COLDFIRE */
1489 +
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
1495 */
1496
1497 +#ifndef CONFIG_COLDFIRE
1498 static inline mm_segment_t get_fs(void)
1499 {
1500 #ifdef CONFIG_MMU
1501 @@ -56,6 +57,15 @@ static inline void set_fs(mm_segment_t v
1502 #endif
1503 }
1504
1505 +#else /* CONFIG_COLDFIRE */
1506 +
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)
1511 +
1512 +#endif /* CONFIG_COLDFIRE */
1513 +
1514 #define segment_eq(a,b) ((a).seg == (b).seg)
1515
1516 #endif /* __ASSEMBLY__ */
1517 --- a/arch/m68k/include/asm/setup.h
1518 +++ b/arch/m68k/include/asm/setup.h
1519 @@ -2,6 +2,7 @@
1520 ** asm/setup.h -- Definition of the Linux/m68k setup information
1521 **
1522 ** Copyright 1992 by Greg Harp
1523 + * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
1524 **
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
1527 @@ -40,6 +41,7 @@
1528 #define MACH_HP300 9
1529 #define MACH_Q40 10
1530 #define MACH_SUN3X 11
1531 +#define MACH_CFMMU 12
1532
1533 #define COMMAND_LINE_SIZE 256
1534
1535 @@ -189,6 +191,14 @@ extern unsigned long m68k_machtype;
1536 # define MACH_TYPE (MACH_SUN3X)
1537 #endif
1538
1539 +#if !defined(CONFIG_COLDFIRE)
1540 +# define MACH_IS_COLDFIRE (0)
1541 +#else
1542 +# define CONFIG_COLDFIRE_ONLY
1543 +# define MACH_IS_COLDFIRE (1)
1544 +# define MACH_TYPE (MACH_CFMMU)
1545 +#endif
1546 +
1547 #ifndef MACH_TYPE
1548 # define MACH_TYPE (m68k_machtype)
1549 #endif
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
1555
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)
1561
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
1568
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)
1576 +#else
1577 +#define FPU_CFV4E 0
1578 +#endif
1579
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
1587
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)
1595
1596 #ifdef __KERNEL__
1597
1598 @@ -341,6 +361,14 @@ extern int m68k_is040or060;
1599 # endif
1600 #endif
1601
1602 +#if !defined(CONFIG_CFV4E)
1603 +# define CPU_IS_COLDFIRE (0)
1604 +#else
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)
1608 +#endif
1609 +
1610 #define CPU_TYPE (m68k_cputype)
1611
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 */
1615 #endif
1616
1617 +#ifdef CONFIG_CFV4E
1618 +#define QCHIP_RESTORE_DIRECTIVE ".chip 547x"
1619 +#define CHIP_RESTORE_DIRECTIVE .chip 547x
1620 +#else
1621 +#define QCHIP_RESTORE_DIRECTIVE ".chip 68k"
1622 +#define CHIP_RESTORE_DIRECTIVE .chip 68k
1623 +#endif
1624 +
1625 #endif /* __KERNEL__ */
1626
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;
1633 #ifndef __uClinux__
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];
1638 +# else
1639 unsigned long sc_fpregs[2*3]; /* room for two fp registers */
1640 unsigned long sc_fpcntl[3];
1641 unsigned char sc_fpstate[216];
1642 +# endif
1643 #endif
1644 };
1645
1646 --- a/arch/m68k/include/asm/siginfo.h
1647 +++ b/arch/m68k/include/asm/siginfo.h
1648 @@ -29,7 +29,8 @@ typedef struct siginfo {
1649 struct {
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 */
1657 } _timer;
1658 @@ -38,18 +39,18 @@ typedef struct siginfo {
1659 struct {
1660 __kernel_pid_t _pid; /* sender's pid */
1661 __kernel_uid_t _uid; /* backwards compatibility */
1662 - sigval_t _sigval;
1663 __kernel_uid32_t _uid32; /* sender's uid */
1664 + sigval_t _sigval;
1665 } _rt;
1666
1667 /* SIGCHLD */
1668 struct {
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 */
1673 clock_t _utime;
1674 clock_t _stime;
1675 - __kernel_uid32_t _uid32; /* sender's uid */
1676 + int _status; /* exit code */
1677 } _sigchld;
1678
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 {
1683 #ifdef __KERNEL__
1684 #include <asm/sigcontext.h>
1685
1686 -#ifndef __uClinux__
1687 +//#ifndef __uClinux__
1688 +#ifndef CONFIG_COLDFIRE /*FIXME Jason*/
1689 #define __HAVE_ARCH_SIG_BITOPS
1690
1691 static inline void sigaddset(sigset_t *set, int _sig)
1692 @@ -201,7 +202,6 @@ static inline int sigfindinword(unsigned
1693
1694 struct pt_regs;
1695 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
1696 -
1697 #else
1698
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;
1704 }
1705
1706 +#ifndef CONFIG_COLDFIRE
1707 #define __HAVE_ARCH_STRCMP
1708 static inline int strcmp(const char *cs, const char *ct)
1709 {
1710 @@ -110,6 +111,7 @@ static inline int strcmp(const char *cs,
1711 : "+a" (cs), "+a" (ct), "=d" (res));
1712 return res;
1713 }
1714 +#endif
1715
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
1720 @@ -4,7 +4,7 @@
1721 #include <linux/types.h>
1722 #include <linux/compiler.h>
1723
1724 -#define __SWAB_64_THRU_32__
1725 +/*#define __SWAB_64_THRU_32__
1726
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
1730 }
1731 #define __arch_swab32 __arch_swab32
1732 #endif
1733 +*/
1734 +#if defined(__GNUC__)
1735 +#if defined(__mcfisaaplus__) || defined(__mcfisac__)
1736 +static inline __attribute_const__ __u32 ___arch__swab32(__u32 val)
1737 +{
1738 + __asm__ ("byterev %0" : "=d" (val) : "0" (val));
1739 + return val;
1740 +}
1741 +#define __arch__swab32(x) ___arch__swab32(x)
1742 +#elif !defined(__mcoldfire__)
1743 +static inline __attribute_const__ __u32 ___arch__swab32(__u32 val)
1744 +{
1745 + __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val));
1746 + return val;
1747 +}
1748 +#define __arch__swab32(x) ___arch__swab32(x)
1749 +
1750 +#endif
1751 +#endif
1752 +
1753 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
1754 +# define __BYTEORDER_HAS_U64__
1755 +# define __SWAB_64_THRU_32__
1756 +#endif
1757
1758 #endif /* _M68K_SWAB_H */
1759 --- a/arch/m68k/include/asm/system_mm.h
1760 +++ b/arch/m68k/include/asm/system_mm.h
1761 @@ -5,9 +5,24 @@
1762 #include <linux/kernel.h>
1763 #include <asm/segment.h>
1764 #include <asm/entry.h>
1765 +#include <asm/cfcache.h>
1766
1767 #ifdef __KERNEL__
1768
1769 +#ifdef CONFIG_COLDFIRE
1770 +#define FLUSH_BC (0x00040000)
1771 +
1772 +#define finish_arch_switch(prev) do { \
1773 + unsigned long tmpreg; \
1774 + asm volatile ( "move.l %2,%0\n" \
1775 + "orl %1,%0\n" \
1776 + "movec %0,%%cacr" \
1777 + : "=&d" (tmpreg) \
1778 + : "id" (FLUSH_BC), "m" (shadow_cacr)); \
1779 + } while(0)
1780 +
1781 +#endif
1782 +
1783 /*
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)
1788
1789 /* interrupt control.. */
1790 -#if 0
1791 -#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
1792 -#else
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"); \
1798 })
1799 -#endif
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")
1812 +#endif
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")
1815
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;
1824 };
1825
1826 --- a/arch/m68k/include/asm/tlbflush.h
1827 +++ b/arch/m68k/include/asm/tlbflush.h
1828 @@ -2,7 +2,7 @@
1829 #define _M68K_TLBFLUSH_H
1830
1831 #ifdef CONFIG_MMU
1832 -#ifndef CONFIG_SUN3
1833 +#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
1834
1835 #include <asm/current.h>
1836
1837 @@ -92,7 +92,12 @@ static inline void flush_tlb_kernel_rang
1838 flush_tlb_all();
1839 }
1840
1841 -#else
1842 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1843 + unsigned long start, unsigned long end)
1844 +{
1845 +}
1846 +
1847 +#elif defined(CONFIG_SUN3)
1848
1849
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);
1853 }
1854
1855 +static inline void flush_tlb_pgtables(struct mm_struct *mm,
1856 + unsigned long start, unsigned long end)
1857 +{
1858 +}
1859 +
1860 +#else /* CONFIG_COLDFIRE */
1861 +
1862 +#include <asm/cf_tlbflush.h>
1863 +
1864 #endif
1865
1866 #else /* !CONFIG_MMU */
1867 --- a/arch/m68k/include/asm/uaccess_mm.h
1868 +++ b/arch/m68k/include/asm/uaccess_mm.h
1869 @@ -1,6 +1,9 @@
1870 #ifndef __M68K_UACCESS_H
1871 #define __M68K_UACCESS_H
1872
1873 +#ifdef CONFIG_COLDFIRE
1874 +#include <asm/cf_uaccess.h>
1875 +#else
1876 /*
1877 * User space memory access functions
1878 */
1879 @@ -371,4 +374,5 @@ unsigned long __clear_user(void __user *
1880
1881 #define strlen_user(str) strnlen_user(str, 32767)
1882
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];
1888
1889 typedef struct fpregset {
1890 int f_fpcntl[3];
1891 +#ifdef __mcoldfire__
1892 + int f_fpregs[8][2];
1893 +#else
1894 int f_fpregs[8*3];
1895 +#endif
1896 } fpregset_t;
1897
1898 struct mcontext {
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
1909
1910 #ifdef __KERNEL__
1911
1912 -#define NR_syscalls 333
1913 +#define NR_syscalls 337
1914
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
1919 @@ -1,6 +1,10 @@
1920 #ifndef __VIRT_CONVERT__
1921 #define __VIRT_CONVERT__
1922
1923 +#ifdef CONFIG_COLDFIRE
1924 +#include <asm/cf_virtconvert.h>
1925 +#else
1926 +
1927 /*
1928 * Macros used for converting between virtual and physical mappings.
1929 */
1930 @@ -46,3 +50,4 @@ static inline void *phys_to_virt(unsigne
1931
1932 #endif
1933 #endif
1934 +#endif
1935 --- a/arch/m68k/Kconfig
1936 +++ b/arch/m68k/Kconfig
1937 @@ -12,6 +12,14 @@ config MMU
1938 bool
1939 default y
1940
1941 +config GENERIC_TIME
1942 + bool "Enable generic timer"
1943 + default n
1944 +
1945 +config GENERIC_CLOCKEVENTS
1946 + bool "Enable generic clockevents"
1947 + default n
1948 +
1949 config RWSEM_GENERIC_SPINLOCK
1950 bool
1951 default y
1952 @@ -37,7 +45,7 @@ config GENERIC_CALIBRATE_DELAY
1953
1954 config TIME_LOW_RES
1955 bool
1956 - default y
1957 + default n
1958
1959 config GENERIC_IOMAP
1960 bool
1961 @@ -49,7 +57,7 @@ config ARCH_MAY_HAVE_PC_FDC
1962 default y
1963
1964 config NO_IOPORT
1965 - def_bool y
1966 + def_bool !(M5445X || M547X_8X)
1967
1968 config NO_DMA
1969 def_bool SUN3
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.
1973
1974 +config COLDFIRE
1975 + bool "ColdFire V4e support"
1976 + default y
1977 + select CFV4E
1978 + help
1979 + Say Y if you want to build a kernel to run on one of the ColdFire
1980 + V4e boards.
1981 +
1982 +config CFV4E
1983 + bool
1984 + depends on COLDFIRE
1985 + select MMU_CFV4E if MMU
1986 + default y
1987 +
1988 +config FPU
1989 + bool "ColdFire V4e FPU support"
1990 + default n
1991 + help
1992 + This enables support for CFV4E FPU feature.
1993 +
1994 +config MCD_DMA
1995 + bool "ColdFire MCD DMA support"
1996 + depends on M547X_8X
1997 + default y
1998 + help
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
2002 +
2003 config AMIGA
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.
2009
2010 +config PCI
2011 + bool "PCI bus support"
2012 + depends on M54455 || M547X_8X
2013 + default n
2014 + help
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.
2019 +
2020 config MAC
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.
2026
2027 +config M5445X
2028 + bool "MCF5445x support"
2029 + depends on COLDFIRE
2030 + select GENERIC_TIME
2031 + select USB_EHCI_FSL
2032 + select HAVE_FSL_USB_DR
2033 + help
2034 + This option will add support for the MCF544x processor with mmu.
2035 +
2036 +config M54451
2037 + bool
2038 + depends on M5445X
2039 + default n
2040 +
2041 +config M54455
2042 + bool
2043 + depends on M5445X
2044 + default n
2045 +
2046 +choice
2047 + prompt "Model"
2048 + depends on M5445X
2049 + default M54451EVB
2050 + config M54451EVB
2051 + bool "M54451EVB"
2052 + select M54451
2053 + config M54455EVB
2054 + bool "M54455EVB"
2055 + select M54455
2056 +endchoice
2057 +
2058 +config HAVE_FSL_USB_DR
2059 + bool
2060 + default n
2061 +
2062 +config M547X_8X
2063 + bool "MCF547x/MCF548x support"
2064 + depends on COLDFIRE
2065 + help
2066 + This option will add support for the MCF547x/MCF548x processor with mmu.
2067 +
2068 +config M547X
2069 + bool
2070 + depends on M547X_8X
2071 + default n
2072 +
2073 +config M548X
2074 + bool
2075 + depends on M547X_8X
2076 + default n
2077 +
2078 +choice
2079 + prompt "Model"
2080 + depends on M547X_8X
2081 + default M5485CFE
2082 +
2083 +config M5475AFE
2084 + bool "MCF5475AFE"
2085 + select M547X
2086 +config M5475BFE
2087 + bool "MCF5475BFE"
2088 + select M547X
2089 +config M5475CFE
2090 + bool "MCF5475CFE"
2091 + select M547X
2092 +config M5475DFE
2093 + bool "MCF5475DFE"
2094 + select M547X
2095 +config M5475EFE
2096 + bool "MCF5475EFE"
2097 + select M547X
2098 +config M5475FFE
2099 + bool "MCF5475FFE"
2100 + select M547X
2101 +config M5485AFE
2102 + bool "MCF5485AFE"
2103 + select M548X
2104 +config M5485BFE
2105 + bool "MCF5485BFE"
2106 + select M548X
2107 +config M5485CFE
2108 + bool "MCF5485CFE"
2109 + select M548X
2110 +config M5485DFE
2111 + bool "MCF5485DFE"
2112 + select M548X
2113 +config M5485EFE
2114 + bool "MCF5485EFE"
2115 + select M548X
2116 +config M5485FFE
2117 + bool "MCF5485FFE"
2118 + select M548X
2119 +
2120 +endchoice
2121 +
2122 +
2123 +config MCFCLK
2124 + int
2125 + default 240000000 if M54451EVB
2126 + default 266666666 if M54455EVB
2127 + default 266000000 if M547X
2128 + default 200000000 if M548X
2129 + help
2130 + Coldfire System clock.
2131 +
2132 +config MCF_USER_HALT
2133 + bool "Coldfire User Halt Enable"
2134 + depends on M5445X || M547X_8X
2135 + default n
2136 + help
2137 + Enables the HALT instruction in User Mode.
2138 +
2139 config MMU_MOTOROLA
2140 bool
2141
2142 @@ -285,6 +444,70 @@ config MMU_SUN3
2143 bool
2144 depends on MMU && !MMU_MOTOROLA
2145
2146 +config MMU_CFV4E
2147 + bool
2148 +
2149 +config SDRAM_BASE
2150 + hex
2151 + depends on COLDFIRE
2152 + default 0x40000000 if M5445X
2153 + default 0x00000000 if M547X_8X
2154 +
2155 +config SDRAM_SIZE
2156 + hex
2157 + depends on COLDFIRE
2158 + default 0x08000000 if M54451EVB
2159 + default 0x10000000 if M54455EVB
2160 + default 0x04000000 if M547X_8X
2161 +
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
2168 +
2169 +config DMA_BASE
2170 + hex
2171 + depends on COLDFIRE
2172 + default 0xef000000
2173 +
2174 +config DMA_SIZE
2175 + hex
2176 + depends on COLDFIRE
2177 + default 0x1000000 if M5445X
2178 + default 0x800000 if M547X_8X
2179 +
2180 +config SRAM
2181 + bool "SRAM allocation APIs support on mcfv4 platform"
2182 + depends on COLDFIRE && M5445X
2183 + default y
2184 + select GENERIC_ALLOCATOR
2185 +
2186 +config SRAM_BASE
2187 + hex
2188 + depends on COLDFIRE && SRAM
2189 + default 0x8ff00000 if M5445X
2190 +
2191 +config SRAM_SIZE
2192 + hex
2193 + depends on COLDFIRE && SRAM
2194 + default 0x8000 if M5445X
2195 +
2196 +config SRAM_ALLOC_GRANULARITY
2197 + hex
2198 + depends on SRAM
2199 + default 0x200 if M5445X
2200 +
2201 +config VDSO
2202 + bool "Support VDSO page"
2203 + depends on MMU
2204 + default n
2205 + help
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.
2209 +
2210 config M68KFPU_EMU
2211 bool "Math emulation support (EXPERIMENTAL)"
2212 depends on EXPERIMENTAL
2213 @@ -451,6 +674,14 @@ config ZONE_DMA
2214 source "drivers/pci/Kconfig"
2215
2216 source "drivers/zorro/Kconfig"
2217 +endmenu
2218 +
2219 +menu "Power management options"
2220 +
2221 +config PM
2222 + bool "Power Management support"
2223 + help
2224 + Support processor power management modes
2225
2226 endmenu
2227
2228 @@ -589,7 +820,7 @@ config DN_SERIAL
2229
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)
2234 ---help---
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
2238
2239 endmenu
2240
2241 +source "kernel/time/Kconfig"
2242 +
2243 source "fs/Kconfig"
2244
2245 source "arch/m68k/Kconfig.debug"
2246 --- a/arch/m68k/kernel/asm-offsets.c
2247 +++ b/arch/m68k/kernel/asm-offsets.c
2248 @@ -2,6 +2,11 @@
2249 * This program is used to generate definitions needed by
2250 * assembly language modules.
2251 *
2252 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2253 + * Jason Jin Jason.Jin@freescale.com
2254 + * Shrek Wu B16972@freescale.com
2255 + * Add Codlfire support
2256 + *
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);
2269 +#else
2270 /* bitfields are a bit difficult */
2271 DEFINE(PT_VECTOR, offsetof(struct pt_regs, pc) + 4);
2272 +#endif
2273
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
2278 @@ -1,4 +1,7 @@
2279 /*
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
2285 * for more details.
2286 @@ -11,12 +14,24 @@
2287 #include <linux/kernel.h>
2288 #include <linux/scatterlist.h>
2289 #include <linux/vmalloc.h>
2290 -
2291 +#include <linux/pci.h>
2292 #include <asm/pgalloc.h>
2293
2294 void *dma_alloc_coherent(struct device *dev, size_t size,
2295 dma_addr_t *handle, gfp_t flag)
2296 {
2297 +#if defined(CONFIG_M5445X) | defined(CONFIG_M547X_8X)
2298 + /*
2299 + * On the M5445x platform the memory allocated with GFP_DMA
2300 + * is guaranteed to be DMA'able.
2301 + */
2302 + void *addr;
2303 +
2304 + size = PAGE_ALIGN(size);
2305 + addr = kmalloc(size, GFP_DMA);
2306 + *handle = virt_to_phys(addr);
2307 + return addr;
2308 +#else
2309 struct page *page, **map;
2310 pgprot_t pgprot;
2311 void *addr;
2312 @@ -55,6 +70,7 @@ void *dma_alloc_coherent(struct device *
2313 kfree(map);
2314
2315 return addr;
2316 +#endif
2317 }
2318 EXPORT_SYMBOL(dma_alloc_coherent);
2319
2320 @@ -62,7 +78,11 @@ void dma_free_coherent(struct device *de
2321 void *addr, dma_addr_t handle)
2322 {
2323 pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
2324 +#if defined(CONFIG_M5445X) | defined(CONFIG_M547X_8X)
2325 + kfree(addr);
2326 +#else
2327 vfree(addr);
2328 +#endif
2329 }
2330 EXPORT_SYMBOL(dma_free_coherent);
2331
2332 @@ -88,9 +108,16 @@ void dma_sync_sg_for_device(struct devic
2333 enum dma_data_direction dir)
2334 {
2335 int i;
2336 +#ifdef CONFIG_COLDFIRE
2337 + struct scatterlist *_sg;
2338
2339 + for_each_sg(sg, _sg, nents, i)
2340 + dma_sync_single_for_device(dev, _sg->dma_address,
2341 + _sg->length, dir);
2342 +#else
2343 for (i = 0; i < nents; sg++, i++)
2344 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
2345 +#endif
2346 }
2347 EXPORT_SYMBOL(dma_sync_sg_for_device);
2348
2349 @@ -119,10 +146,19 @@ int dma_map_sg(struct device *dev, struc
2350 enum dma_data_direction dir)
2351 {
2352 int i;
2353 -
2354 +#ifdef CONFIG_COLDFIRE
2355 + struct scatterlist *_sg;
2356 +#endif
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);
2361 +#else
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);
2366 +#endif
2367 }
2368 return nents;
2369 }
2370 --- a/arch/m68k/kernel/Makefile
2371 +++ b/arch/m68k/kernel/Makefile
2372 @@ -2,16 +2,26 @@
2373 # Makefile for the linux kernel.
2374 #
2375
2376 -ifndef CONFIG_SUN3
2377 - extra-y := head.o
2378 +ifdef CONFIG_SUN3
2379 + extra-y := sun3-head.o vmlinux.lds
2380 + obj-y := entry.o signal.o ints.o time.o
2381 else
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
2390 + endif
2391 +endif
2392 endif
2393 -extra-y += vmlinux.lds
2394
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
2399
2400 devres-y = ../../../kernel/irq/devres.o
2401
2402 obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
2403 +
2404 +EXTRA_AFLAGS := -traditional
2405 --- a/arch/m68k/kernel/process.c
2406 +++ b/arch/m68k/kernel/process.c
2407 @@ -4,6 +4,11 @@
2408 * Copyright (C) 1995 Hamish Macdonald
2409 *
2410 * 68060 fixes by Jesper Skov
2411 + *
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
2416 */
2417
2418 /*
2419 @@ -186,12 +191,21 @@ EXPORT_SYMBOL(kernel_thread);
2420 void flush_thread(void)
2421 {
2422 unsigned long zero = 0;
2423 +#if !defined(CONFIG_COLDFIRE)
2424 set_fs(USER_DS);
2425 current->thread.fs = __USER_DS;
2426 if (!FPU_IS_EMU)
2427 asm volatile (".chip 68k/68881\n\t"
2428 "frestore %0@\n\t"
2429 ".chip 68k" : : "a" (&zero));
2430 +#else
2431 + set_fs(USER_DS);
2432 + current->thread.fs = USER_DS;
2433 +#if defined(CONFIG_FPU)
2434 + if (!FPU_IS_EMU)
2435 + asm volatile ("frestore %0@\n\t" : : "a" (&zero));
2436 +#endif
2437 +#endif
2438 }
2439
2440 /*
2441 @@ -251,10 +265,15 @@ int copy_thread(unsigned long clone_flag
2442
2443 p->thread.usp = usp;
2444 p->thread.ksp = (unsigned long)childstack;
2445 +
2446 + if (clone_flags & CLONE_SETTLS)
2447 + task_thread_info(p)->tp_value = regs->d5;
2448 +
2449 /*
2450 * Must save the current SFC/DFC value, NOT the value when
2451 * the parent was last descheduled - RGH 10-08-96
2452 */
2453 +#if !defined(CONFIG_COLDFIRE)
2454 p->thread.fs = get_fs().seg;
2455
2456 if (!FPU_IS_EMU) {
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])
2460 : "memory");
2461 +#else
2462 + p->thread.fs = get_fs();
2463 +
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])
2468 + : "memory");
2469 +
2470 + if (p->thread.fpstate[0]) {
2471 + asm volatile ("fmovemd %/fp0-%/fp7,%0"
2472 + : : "m" (p->thread.fp[0])
2473 + : "memory");
2474 + asm volatile ("fmovel %/fpiar,%0"
2475 + : : "m" (p->thread.fpcntl[0])
2476 + : "memory");
2477 + asm volatile ("fmovel %/fpcr,%0"
2478 + : : "m" (p->thread.fpcntl[1])
2479 + : "memory");
2480 + asm volatile ("fmovel %/fpsr,%0"
2481 + : : "m" (p->thread.fpcntl[2])
2482 + : "memory");
2483 + }
2484 /* Restore the state in case the fpu was busy */
2485 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
2486 }
2487 +#endif
2488 +#endif
2489
2490 return 0;
2491 }
2492 @@ -277,7 +321,9 @@ int copy_thread(unsigned long clone_flag
2493
2494 int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
2495 {
2496 +#if !defined(CONFIG_COLDFIRE) || defined(CONFIG_FPU)
2497 char fpustate[216];
2498 +#endif
2499
2500 if (FPU_IS_EMU) {
2501 int i;
2502 @@ -294,6 +340,7 @@ int dump_fpu (struct pt_regs *regs, stru
2503 }
2504
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])
2509 return 0;
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])
2513 : "memory");
2514 +#elif defined(CONFIG_FPU)
2515 + asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
2516 + if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2])
2517 + return 0;
2518 +
2519 + asm volatile ("fmovel %/fpiar,%0"
2520 + : : "m" (fpu->fpcntl[0])
2521 + : "memory");
2522 + asm volatile ("fmovel %/fpcr,%0"
2523 + : : "m" (fpu->fpcntl[1])
2524 + : "memory");
2525 + asm volatile ("fmovel %/fpsr,%0"
2526 + : : "m" (fpu->fpcntl[2])
2527 + : "memory");
2528 + asm volatile ("fmovemd %/fp0-%/fp7,%0"
2529 + : : "m" (fpu->fpregs[0])
2530 + : "memory");
2531 +#endif
2532 +
2533 return 1;
2534 }
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
2539 ret = -EFAULT;
2540 break;
2541
2542 + case PTRACE_GET_THREAD_AREA:
2543 + ret = put_user(task_thread_info(child)->tp_value,
2544 + (unsigned long __user *) data);
2545 + break;
2546 +
2547 default:
2548 ret = ptrace_request(child, request, addr, data);
2549 break;
2550 --- a/arch/m68k/kernel/setup.c
2551 +++ b/arch/m68k/kernel/setup.c
2552 @@ -2,6 +2,9 @@
2553 * linux/arch/m68k/kernel/setup.c
2554 *
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
2559 */
2560
2561 /*
2562 @@ -75,13 +78,24 @@ EXPORT_SYMBOL(m68k_memory);
2563
2564 struct mem_info m68k_ramdisk;
2565
2566 +#if !defined(CONFIG_COLDFIRE)
2567 static char m68k_command_line[CL_SIZE];
2568 +#else
2569 +char m68k_command_line[CL_SIZE];
2570 +unsigned long uboot_info_stk;
2571 +EXPORT_SYMBOL(uboot_info_stk);
2572 +#endif
2573
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);
2579 +
2580 +#ifdef CONFIG_COLDFIRE
2581 +void (*mach_tick)(void);
2582 +#endif
2583 +
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);
2590
2591 +#ifdef CONFIG_COLDFIRE
2592 +void coldfire_sort_memrec(void);
2593 +#endif
2594 +
2595 #define MASK_256K 0xfffc0000
2596
2597 extern void paging_init(void);
2598
2599 static void __init m68k_parse_bootinfo(const struct bi_record *record)
2600 {
2601 - while (record->tag != BI_LAST) {
2602 + while ((record->tag != BI_LAST)) {
2603 int unknown = 0;
2604 const unsigned long *data = record->data;
2605
2606 @@ -203,6 +221,10 @@ static void __init m68k_parse_bootinfo(c
2607 record->size);
2608 }
2609
2610 +#ifdef CONFIG_COLDFIRE
2611 + coldfire_sort_memrec();
2612 +#endif
2613 +
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
2618
2619 void __init setup_arch(char **cmdline_p)
2620 {
2621 - int i;
2622
2623 +#if !defined(CONFIG_SUN3)
2624 + int i;
2625 +#endif
2626 +
2627 /* The bootinfo is located right after the kernel bss */
2628 m68k_parse_bootinfo((const struct bi_record *)_end);
2629
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|
2639 + FPU_CFV4E)) {
2640 volatile int zero = 0;
2641 asm volatile ("frestore %0" : : "m" (zero));
2642 }
2643 @@ -320,13 +346,18 @@ void __init setup_arch(char **cmdline_p)
2644 config_sun3x();
2645 break;
2646 #endif
2647 +#ifdef CONFIG_COLDFIRE
2648 + case MACH_CFMMU:
2649 + config_coldfire();
2650 + break;
2651 +#endif
2652 default:
2653 panic("No configuration setup");
2654 }
2655
2656 paging_init();
2657
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)
2664
2665 #endif /* !CONFIG_SUN3 */
2666
2667 +#ifdef CONFIG_COLDFIRE
2668 + mmu_context_init();
2669 +#endif
2670 +
2671 /* set ISA defs early as possible */
2672 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
2673 if (MACH_IS_Q40) {
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)
2679
2680 if (CPU_IS_020) {
2681 cpu = "68020";
2682 @@ -396,6 +432,9 @@ static int show_cpuinfo(struct seq_file
2683 } else if (CPU_IS_060) {
2684 cpu = "68060";
2685 clockfactor = LOOP_CYCLES_68060;
2686 + } else if (CPU_IS_CFV4E) {
2687 + cpu = "ColdFire V4e";
2688 + clockfactor = LOOP_CYCLES_COLDFIRE;
2689 } else {
2690 cpu = "680x0";
2691 clockfactor = 0;
2692 @@ -414,6 +453,8 @@ static int show_cpuinfo(struct seq_file
2693 fpu = "68060";
2694 else if (m68k_fputype & FPU_SUNFPA)
2695 fpu = "Sun FPA";
2696 + else if (m68k_fputype & FPU_CFV4E)
2697 + fpu = "ColdFire V4e";
2698 else
2699 fpu = "none";
2700 #endif
2701 @@ -430,6 +471,8 @@ static int show_cpuinfo(struct seq_file
2702 mmu = "Sun-3";
2703 else if (m68k_mmutype & MMU_APOLLO)
2704 mmu = "Apollo";
2705 + else if (m68k_mmutype & MMU_CFV4E)
2706 + mmu = "ColdFire";
2707 else
2708 mmu = "unknown";
2709
2710 @@ -512,7 +555,7 @@ module_init(proc_hardware_init);
2711
2712 void check_bugs(void)
2713 {
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
2721 @@ -1,5 +1,8 @@
2722 /*
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
2727 *
2728 * This file contains various random system calls that
2729 * have a non-standard calling sequence on the Linux/m68k
2730 @@ -29,6 +32,14 @@
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>
2738 +#endif
2739 +
2740 +asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
2741 + unsigned long error_code);
2742
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
2746 return -EINVAL;
2747 }
2748
2749 +#ifndef CONFIG_COLDFIRE
2750 /* Convert virtual (user) address VADDR to physical address PADDR */
2751 #define virt_to_phys_040(vaddr) \
2752 ({ \
2753 @@ -563,6 +575,7 @@ cache_flush_060 (unsigned long addr, int
2754 }
2755 return 0;
2756 }
2757 +#endif /* CONFIG_COLDFIRE */
2758
2759 /* sys_cacheflush -- flush (part of) the processor cache. */
2760 asmlinkage int
2761 @@ -595,6 +608,7 @@ sys_cacheflush (unsigned long addr, int
2762 goto out;
2763 }
2764
2765 +#ifndef CONFIG_COLDFIRE
2766 if (CPU_IS_020_OR_030) {
2767 if (scope == FLUSH_SCOPE_LINE && len < 256) {
2768 unsigned long cacr;
2769 @@ -639,6 +653,16 @@ sys_cacheflush (unsigned long addr, int
2770 ret = cache_flush_060 (addr, scope, cache, len);
2771 }
2772 }
2773 +#else /* CONFIG_COLDFIRE */
2774 + if ((cache & FLUSH_CACHE_INSN) && (cache & FLUSH_CACHE_DATA))
2775 + flush_bcache();
2776 + else if (cache & FLUSH_CACHE_INSN)
2777 + flush_icache();
2778 + else
2779 + flush_dcache();
2780 +
2781 + ret = 0;
2782 +#endif /* CONFIG_COLDFIRE */
2783 out:
2784 unlock_kernel();
2785 return ret;
2786 @@ -663,3 +687,79 @@ int kernel_execve(const char *filename,
2787 : "d" (__a), "d" (__b), "d" (__c));
2788 return __res;
2789 }
2790 +
2791 +asmlinkage unsigned long
2792 +sys_read_tp(void)
2793 +{
2794 + return current_thread_info()->tp_value;
2795 +}
2796 +
2797 +asmlinkage int
2798 +sys_write_tp(unsigned long tp)
2799 +{
2800 + current_thread_info()->tp_value = tp;
2801 + return 0;
2802 +}
2803 +
2804 +/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
2805 + D1 (newval). */
2806 +asmlinkage int
2807 +sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
2808 + unsigned long __user *mem)
2809 +{
2810 + /* This was borrowed from ARM's implementation. */
2811 + for (;;) {
2812 + struct mm_struct *mm = current->mm;
2813 + pgd_t *pgd; pmd_t *pmd; pte_t *pte;
2814 + spinlock_t *ptl;
2815 + unsigned long mem_value;
2816 +
2817 + down_read(&mm->mmap_sem);
2818 + pgd = pgd_offset(mm, (unsigned long)mem);
2819 + if (!pgd_present(*pgd))
2820 + goto bad_access;
2821 + pmd = pmd_offset(pgd, (unsigned long)mem);
2822 + if (!pmd_present(*pmd))
2823 + goto bad_access;
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);
2827 + goto bad_access;
2828 + }
2829 +
2830 + mem_value = *mem;
2831 + if (mem_value == oldval)
2832 + *mem = newval;
2833 +
2834 + pte_unmap_unlock(pte, ptl);
2835 + up_read(&mm->mmap_sem);
2836 + return mem_value;
2837 +
2838 +bad_access:
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. */
2844 + {
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;
2848 +
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
2854 + the process. */
2855 + return 0xdeadbeef;
2856 + }
2857 + }
2858 +}
2859 +
2860 +asmlinkage int
2861 +sys_atomic_barrier(void)
2862 +{
2863 + /* no code needed for uniprocs */
2864 + return 0;
2865 +}
2866 --- a/arch/m68k/kernel/time.c
2867 +++ b/arch/m68k/kernel/time.c
2868 @@ -2,6 +2,9 @@
2869 * linux/arch/m68k/kernel/time.c
2870 *
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
2875 *
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
2879 */
2880 static irqreturn_t timer_interrupt(int irq, void *dummy)
2881 {
2882 +#ifdef CONFIG_COLDFIRE
2883 + /* kick hardware timer if necessary */
2884 + if (mach_tick)
2885 + mach_tick();
2886 +#endif
2887 do_timer(1);
2888 #ifndef CONFIG_SMP
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
2892 @@ -1,10 +1,13 @@
2893 PHDRS
2894 {
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);
2899 }
2900 #ifdef CONFIG_SUN3
2901 #include "vmlinux-sun3.lds"
2902 +#elif CONFIG_COLDFIRE
2903 +#include "vmlinux-cf.lds"
2904 #else
2905 #include "vmlinux-std.lds"
2906 #endif
2907 --- a/arch/m68k/lib/checksum.c
2908 +++ b/arch/m68k/lib/checksum.c
2909 @@ -30,6 +30,10 @@
2910 * 1998/8/31 Andreas Schwab:
2911 * Zero out rest of buffer on exception in
2912 * csum_partial_copy_from_user.
2913 + *
2914 + * Copyright Freescale Semiconductor, Inc. 2008-2009
2915 + * Jason Jin Jason.Jin@freescale.com
2916 + * Shrek Wu B16972@freescale.com
2917 */
2918
2919 #include <linux/module.h>
2920 @@ -39,8 +43,131 @@
2921 * computes a partial checksum, e.g. for TCP/UDP fragments
2922 */
2923
2924 +#ifdef CONFIG_COLDFIRE
2925 +
2926 +static inline unsigned short from32to16(unsigned long x)
2927 +{
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);
2932 + return x;
2933 +}
2934 +
2935 +static unsigned long do_csum(const unsigned char *buff, int len)
2936 +{
2937 + int odd, count;
2938 + unsigned long result = 0;
2939 +
2940 + if (len <= 0)
2941 + goto out;
2942 + odd = 1 & (unsigned long) buff;
2943 + if (odd) {
2944 + result = *buff;
2945 + len--;
2946 + buff++;
2947 + }
2948 + count = len >> 1; /* nr of 16-bit words.. */
2949 + if (count) {
2950 + if (2 & (unsigned long) buff) {
2951 + result += *(unsigned short *) buff;
2952 + count--;
2953 + len -= 2;
2954 + buff += 2;
2955 + }
2956 + count >>= 1; /* nr of 32-bit words.. */
2957 + if (count) {
2958 + unsigned long carry = 0;
2959 + do {
2960 + unsigned long w = *(unsigned long *) buff;
2961 + count--;
2962 + buff += 4;
2963 + result += carry;
2964 + result += w;
2965 + carry = (w > result);
2966 + } while (count);
2967 + result += carry;
2968 + result = (result & 0xffff) + (result >> 16);
2969 + }
2970 + if (len & 2) {
2971 + result += *(unsigned short *) buff;
2972 + buff += 2;
2973 + }
2974 + }
2975 + if (len & 1)
2976 + result += (*buff << 8);
2977 + result = from32to16(result);
2978 + if (odd)
2979 + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
2980 +out:
2981 + return result;
2982 +}
2983 +
2984 +/*
2985 + * This is a version of ip_compute_csum() optimized for IP headers,
2986 + * which always checksum on 4 octet boundaries.
2987 + */
2988 +__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
2989 +{
2990 + return ~do_csum(iph, ihl*4);
2991 +}
2992 +EXPORT_SYMBOL(ip_fast_csum);
2993 +
2994 +/*
2995 + * computes the checksum of a memory block at buff, length len,
2996 + * and adds in "sum" (32-bit)
2997 + *
2998 + * returns a 32-bit number suitable for feeding into itself
2999 + * or csum_tcpudp_magic
3000 + *
3001 + * this function must be called with even lengths, except
3002 + * for the last fragment, which may be odd
3003 + *
3004 + * it's best to have buff aligned on a 32-bit boundary
3005 + */
3006 __wsum csum_partial(const void *buff, int len, __wsum sum)
3007 {
3008 + unsigned int result = do_csum(buff, len);
3009 +
3010 + /* add in old sum, and carry.. */
3011 + result += sum;
3012 + if (sum > result)
3013 + result += 1;
3014 + return result;
3015 +}
3016 +EXPORT_SYMBOL(csum_partial);
3017 +
3018 +/*
3019 + * copy from fs while checksumming, otherwise like csum_partial
3020 + */
3021 +
3022 +__wsum
3023 +csum_partial_copy_from_user(const void __user *src, void *dst, int len,
3024 + __wsum sum, int *csum_err)
3025 +{
3026 + if (csum_err) *csum_err = 0;
3027 + memcpy(dst, src, len);
3028 + return csum_partial(dst, len, sum);
3029 +}
3030 +EXPORT_SYMBOL(csum_partial_copy_from_user);
3031 +
3032 +/*
3033 + * copy from ds while checksumming, otherwise like csum_partial
3034 + */
3035 +
3036 +__wsum
3037 +csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
3038 +{
3039 + memcpy(dst, src, len);
3040 + return csum_partial(dst, len, sum);
3041 +}
3042 +EXPORT_SYMBOL(csum_partial_copy_nocheck);
3043 +
3044 +#else /* !CONFIG_COLDFIRE */
3045 +
3046 +unsigned int
3047 +csum_partial(const unsigned char *buff, int len, unsigned int sum)
3048 +{
3049 unsigned long tmp1, tmp2;
3050 /*
3051 * Experiments with ethernet and slip connections show that buff
3052 @@ -423,3 +550,4 @@ csum_partial_copy_nocheck(const void *sr
3053 return(sum);
3054 }
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
3059 @@ -1,6 +1,9 @@
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
3066
3067 This file is part of GNU CC.
3068
3069 @@ -21,12 +24,22 @@ Boston, MA 02111-1307, USA. */
3070
3071 #define BITS_PER_UNIT 8
3072
3073 +#ifdef CONFIG_COLDFIRE
3074 +#define umul_ppmm(w1, w0, u, v) \
3075 + do { \
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; \
3080 + } while (0)
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 */
3089
3090 #define __umulsidi3(u, v) \
3091 ({DIunion __w; \
3092 --- a/arch/m68k/lib/string.c
3093 +++ b/arch/m68k/lib/string.c
3094 @@ -1,4 +1,8 @@
3095 /*
3096 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3097 + * * Jason Jin Jason.Jin@freescale.com
3098 + * Shrek Wu B16972@freescale.com
3099 + *
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
3102 * for more details.
3103 @@ -21,6 +25,7 @@ char *strcat(char *dest, const char *src
3104 }
3105 EXPORT_SYMBOL(strcat);
3106
3107 +#ifndef CONFIG_COLDFIRE
3108 void *memset(void *s, int c, size_t count)
3109 {
3110 void *xs = s;
3111 @@ -149,6 +154,69 @@ void *memcpy(void *to, const void *from,
3112 }
3113 EXPORT_SYMBOL(memcpy);
3114
3115 +#else /* CONFIG_COLDFIRE */
3116 +
3117 +void *memset(void *s, int c, size_t count)
3118 +{
3119 + unsigned long x;
3120 + void *originalTo = s;
3121 +
3122 + for (x = 0; x < count; x++)
3123 + *(unsigned char *)s++ = (unsigned char)c;
3124 +
3125 + return originalTo;
3126 +}
3127 +EXPORT_SYMBOL(memset);
3128 +
3129 +void *memcpy(void *to, const void *from, size_t n)
3130 +{
3131 + void *xto = to;
3132 + size_t temp;
3133 +
3134 + if (!n)
3135 + return xto;
3136 + if ((long) to & 1) {
3137 + char *cto = to;
3138 + const char *cfrom = from;
3139 + *cto++ = *cfrom++;
3140 + to = cto;
3141 + from = cfrom;
3142 + n--;
3143 + }
3144 + if (n > 2 && (long) to & 2) {
3145 + short *sto = to;
3146 + const short *sfrom = from;
3147 + *sto++ = *sfrom++;
3148 + to = sto;
3149 + from = sfrom;
3150 + n -= 2;
3151 + }
3152 + temp = n >> 2;
3153 + if (temp) {
3154 + long *lto = to;
3155 + const long *lfrom = from;
3156 + for (; temp; temp--)
3157 + *lto++ = *lfrom++;
3158 + to = lto;
3159 + from = lfrom;
3160 + }
3161 + if (n & 2) {
3162 + short *sto = to;
3163 + const short *sfrom = from;
3164 + *sto++ = *sfrom++;
3165 + to = sto;
3166 + from = sfrom;
3167 + }
3168 + if (n & 1) {
3169 + char *cto = to;
3170 + const char *cfrom = from;
3171 + *cto = *cfrom;
3172 + }
3173 + return xto;
3174 +}
3175 +EXPORT_SYMBOL(memcpy);
3176 +#endif /* CONFIG_COLDFIRE */
3177 +
3178 void *memmove(void *dest, const void *src, size_t n)
3179 {
3180 void *xdest = dest;
3181 --- a/arch/m68k/lib/uaccess.c
3182 +++ b/arch/m68k/lib/uaccess.c
3183 @@ -1,10 +1,15 @@
3184 /*
3185 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3186 + * Jason Jin Jason.Jin@freescale.com
3187 + * Shrek Wu B16972@freescale.com
3188 + *
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
3191 * for more details.
3192 */
3193
3194 #include <linux/module.h>
3195 +#ifndef CONFIG_COLDFIRE
3196 #include <asm/uaccess.h>
3197
3198 unsigned long __generic_copy_from_user(void *to, const void __user *from,
3199 @@ -220,3 +225,244 @@ unsigned long __clear_user(void __user *
3200 return res;
3201 }
3202 EXPORT_SYMBOL(__clear_user);
3203 +
3204 +#else /* CONFIG_COLDFIRE */
3205 +
3206 +#include <asm/cf_uaccess.h>
3207 +
3208 +unsigned long __generic_copy_from_user(void *to, const void *from,
3209 + unsigned long n)
3210 +{
3211 + unsigned long tmp;
3212 + __asm__ __volatile__
3213 + (" tstl %2\n"
3214 + " jeq 2f\n"
3215 + "1: movel (%1)+,%3\n"
3216 + " movel %3,(%0)+\n"
3217 + " subql #1,%2\n"
3218 + " jne 1b\n"
3219 + "2: movel %4,%2\n"
3220 + " bclr #1,%2\n"
3221 + " jeq 4f\n"
3222 + "3: movew (%1)+,%3\n"
3223 + " movew %3,(%0)+\n"
3224 + "4: bclr #0,%2\n"
3225 + " jeq 6f\n"
3226 + "5: moveb (%1)+,%3\n"
3227 + " moveb %3,(%0)+\n"
3228 + "6:\n"
3229 + ".section .fixup,\"ax\"\n"
3230 + " .even\n"
3231 + "7: movel %2,%%d0\n"
3232 + "71:clrl (%0)+\n"
3233 + " subql #1,%%d0\n"
3234 + " jne 71b\n"
3235 + " lsll #2,%2\n"
3236 + " addl %4,%2\n"
3237 + " btst #1,%4\n"
3238 + " jne 81f\n"
3239 + " btst #0,%4\n"
3240 + " jne 91f\n"
3241 + " jra 6b\n"
3242 + "8: addql #2,%2\n"
3243 + "81:clrw (%0)+\n"
3244 + " btst #0,%4\n"
3245 + " jne 91f\n"
3246 + " jra 6b\n"
3247 + "9: addql #1,%2\n"
3248 + "91:clrb (%0)+\n"
3249 + " jra 6b\n"
3250 + ".previous\n"
3251 + ".section __ex_table,\"a\"\n"
3252 + " .align 4\n"
3253 + " .long 1b,7b\n"
3254 + " .long 3b,8b\n"
3255 + " .long 5b,9b\n"
3256 + ".previous"
3257 + : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
3258 + : "d"(n & 3), "0"(to), "1"(from), "2"(n/4)
3259 + : "d0", "memory");
3260 + return n;
3261 +}
3262 +EXPORT_SYMBOL(__generic_copy_from_user);
3263 +
3264 +
3265 +unsigned long __generic_copy_to_user(void *to, const void *from,
3266 + unsigned long n)
3267 +{
3268 + unsigned long tmp;
3269 + __asm__ __volatile__
3270 + (" tstl %2\n"
3271 + " jeq 3f\n"
3272 + "1: movel (%1)+,%3\n"
3273 + "22:movel %3,(%0)+\n"
3274 + "2: subql #1,%2\n"
3275 + " jne 1b\n"
3276 + "3: movel %4,%2\n"
3277 + " bclr #1,%2\n"
3278 + " jeq 4f\n"
3279 + " movew (%1)+,%3\n"
3280 + "24:movew %3,(%0)+\n"
3281 + "4: bclr #0,%2\n"
3282 + " jeq 5f\n"
3283 + " moveb (%1)+,%3\n"
3284 + "25:moveb %3,(%0)+\n"
3285 + "5:\n"
3286 + ".section .fixup,\"ax\"\n"
3287 + " .even\n"
3288 + "60:addql #1,%2\n"
3289 + "6: lsll #2,%2\n"
3290 + " addl %4,%2\n"
3291 + " jra 5b\n"
3292 + "7: addql #2,%2\n"
3293 + " jra 5b\n"
3294 + "8: addql #1,%2\n"
3295 + " jra 5b\n"
3296 + ".previous\n"
3297 + ".section __ex_table,\"a\"\n"
3298 + " .align 4\n"
3299 + " .long 1b,60b\n"
3300 + " .long 22b,6b\n"
3301 + " .long 2b,6b\n"
3302 + " .long 24b,7b\n"
3303 + " .long 3b,60b\n"
3304 + " .long 4b,7b\n"
3305 + " .long 25b,8b\n"
3306 + " .long 5b,8b\n"
3307 + ".previous"
3308 + : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp)
3309 + : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4)
3310 + : "memory");
3311 + return n;
3312 +}
3313 +EXPORT_SYMBOL(__generic_copy_to_user);
3314 +
3315 +/*
3316 + * Copy a null terminated string from userspace.
3317 + */
3318 +
3319 +long strncpy_from_user(char *dst, const char *src, long count)
3320 +{
3321 + long res = -EFAULT;
3322 + if (!(access_ok(VERIFY_READ, src, 1))) /* --tym-- */
3323 + return res;
3324 + if (count == 0) return count;
3325 + __asm__ __volatile__
3326 + ("1: moveb (%2)+,%%d0\n"
3327 + "12:moveb %%d0,(%1)+\n"
3328 + " jeq 2f\n"
3329 + " subql #1,%3\n"
3330 + " jne 1b\n"
3331 + "2: subl %3,%0\n"
3332 + "3:\n"
3333 + ".section .fixup,\"ax\"\n"
3334 + " .even\n"
3335 + "4: movel %4,%0\n"
3336 + " jra 3b\n"
3337 + ".previous\n"
3338 + ".section __ex_table,\"a\"\n"
3339 + " .align 4\n"
3340 + " .long 1b,4b\n"
3341 + " .long 12b,4b\n"
3342 + ".previous"
3343 + : "=d"(res), "=a"(dst), "=a"(src), "=d"(count)
3344 + : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count)
3345 + : "d0", "memory");
3346 + return res;
3347 +}
3348 +EXPORT_SYMBOL(strncpy_from_user);
3349 +
3350 +/*
3351 + * Return the size of a string (including the ending 0)
3352 + *
3353 + * Return 0 on exception, a value greater than N if too long
3354 + */
3355 +long strnlen_user(const char *src, long n)
3356 +{
3357 + long res = -EFAULT;
3358 + if (!(access_ok(VERIFY_READ, src, 1))) /* --tym-- */
3359 + return res;
3360 +
3361 + res = -(long)src;
3362 + __asm__ __volatile__
3363 + ("1:\n"
3364 + " tstl %2\n"
3365 + " jeq 3f\n"
3366 + "2: moveb (%1)+,%%d0\n"
3367 + "22:\n"
3368 + " subql #1,%2\n"
3369 + " tstb %%d0\n"
3370 + " jne 1b\n"
3371 + " jra 4f\n"
3372 + "3:\n"
3373 + " addql #1,%0\n"
3374 + "4:\n"
3375 + " addl %1,%0\n"
3376 + "5:\n"
3377 + ".section .fixup,\"ax\"\n"
3378 + " .even\n"
3379 + "6: moveq %3,%0\n"
3380 + " jra 5b\n"
3381 + ".previous\n"
3382 + ".section __ex_table,\"a\"\n"
3383 + " .align 4\n"
3384 + " .long 2b,6b\n"
3385 + " .long 22b,6b\n"
3386 + ".previous"
3387 + : "=d"(res), "=a"(src), "=d"(n)
3388 + : "i"(0), "0"(res), "1"(src), "2"(n)
3389 + : "d0");
3390 + return res;
3391 +}
3392 +EXPORT_SYMBOL(strnlen_user);
3393 +
3394 +
3395 +/*
3396 + * Zero Userspace
3397 + */
3398 +
3399 +unsigned long __clear_user(void *to, unsigned long n)
3400 +{
3401 + __asm__ __volatile__
3402 + (" tstl %1\n"
3403 + " jeq 3f\n"
3404 + "1: movel %3,(%0)+\n"
3405 + "2: subql #1,%1\n"
3406 + " jne 1b\n"
3407 + "3: movel %2,%1\n"
3408 + " bclr #1,%1\n"
3409 + " jeq 4f\n"
3410 + "24:movew %3,(%0)+\n"
3411 + "4: bclr #0,%1\n"
3412 + " jeq 5f\n"
3413 + "25:moveb %3,(%0)+\n"
3414 + "5:\n"
3415 + ".section .fixup,\"ax\"\n"
3416 + " .even\n"
3417 + "61:addql #1,%1\n"
3418 + "6: lsll #2,%1\n"
3419 + " addl %2,%1\n"
3420 + " jra 5b\n"
3421 + "7: addql #2,%1\n"
3422 + " jra 5b\n"
3423 + "8: addql #1,%1\n"
3424 + " jra 5b\n"
3425 + ".previous\n"
3426 + ".section __ex_table,\"a\"\n"
3427 + " .align 4\n"
3428 + " .long 1b,61b\n"
3429 + " .long 2b,6b\n"
3430 + " .long 3b,61b\n"
3431 + " .long 24b,7b\n"
3432 + " .long 4b,7b\n"
3433 + " .long 25b,8b\n"
3434 + " .long 5b,8b\n"
3435 + ".previous"
3436 + : "=a"(to), "=d"(n)
3437 + : "r"(n & 3), "d"(0), "0"(to), "1"(n/4));
3438 + return n;
3439 +}
3440 +EXPORT_SYMBOL(__clear_user);
3441 +
3442 +#endif /* CONFIG_COLDFIRE */
3443 +
3444 --- a/arch/m68k/Makefile
3445 +++ b/arch/m68k/Makefile
3446 @@ -1,6 +1,8 @@
3447 #
3448 # m68k/Makefile
3449 #
3450 +# Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3451 +#
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
3455 @@ -10,13 +12,13 @@
3456 # License. See the file "COPYING" in the main directory of this archive
3457 # for more details.
3458 #
3459 -# Copyright (C) 1994 by Hamish Macdonald
3460 -#
3461
3462 -KBUILD_DEFCONFIG := multi_defconfig
3463 +KBUILD_DEFCONFIG := amiga_defconfig#multi_defconfig
3464
3465 # override top level makefile
3466 +ifndef CONFIG_COLDFIRE
3467 AS += -m68020
3468 +endif
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
3474 endif
3475
3476 +ifdef CONFIG_COLDFIRE
3477 +OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S
3478 +# LDFLAGS_vmlinux = --verbose
3479 +endif
3480 +
3481 CHECKFLAGS += -D__mc68000__
3482
3483 # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
3484 KBUILD_CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
3485
3486 # enable processor switch if compiled only for a single cpu
3487 +ifndef CONFIG_COLDFIRE
3488 ifndef CONFIG_M68020
3489 ifndef CONFIG_M68030
3490
3491 @@ -49,6 +57,17 @@ endif
3492
3493 endif
3494 endif
3495 +endif
3496 +
3497 +ifdef CONFIG_M5445X
3498 +KBUILD_CFLAGS += -march=isac -mcpu=54455 -msoft-float -g
3499 +KBUILD_AFLAGS += -march=isac -mcpu=54455 -msoft-float
3500 +endif
3501 +
3502 +ifdef CONFIG_M547X_8X
3503 +KBUILD_CFLAGS += -mcfv4e -g
3504 +KBUILD_AFLAGS += -mcfv4e
3505 +endif
3506
3507 ifdef CONFIG_KGDB
3508 # If configured for kgdb support, include debugging infos and keep the
3509 @@ -57,8 +76,12 @@ KBUILD_CFLAGS := $(subst -fomit-frame-po
3510 endif
3511
3512 ifndef CONFIG_SUN3
3513 +ifndef CONFIG_COLDFIRE
3514 head-y := arch/m68k/kernel/head.o
3515 else
3516 +head-y := arch/m68k/coldfire/common/head.o
3517 +endif
3518 +else
3519 head-y := arch/m68k/kernel/sun3-head.o
3520 endif
3521
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/
3527 +
3528 +ifdef CONFIG_COLDFIRE
3529 +boot := arch/m68k/boot
3530 +
3531 +all: uImage
3532 +
3533 +zImage zImage.srec uImage uImage.srec vmlinux.srec: vmlinux
3534 + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
3535
3536 +archclean:
3537 + $(Q)$(MAKE) $(clean)=$(boot)
3538 +
3539 +else
3540 all: zImage
3541
3542 lilo: vmlinux
3543 @@ -117,6 +153,7 @@ endif
3544
3545 archclean:
3546 rm -f vmlinux.gz vmlinux.bz2
3547 +endif
3548
3549 install:
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
3553 @@ -4,13 +4,20 @@
3554 * Instruction cache handling
3555 *
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
3560 */
3561
3562 #include <linux/module.h>
3563 #include <asm/pgalloc.h>
3564 #include <asm/traps.h>
3565
3566 +#ifdef CONFIG_COLDFIRE
3567 +#include <asm/cfcache.h>
3568 +#endif /* CONFIG_COLDFIRE */
3569
3570 +#ifndef CONFIG_COLDFIRE
3571 static unsigned long virt_to_phys_slow(unsigned long vaddr)
3572 {
3573 if (CPU_IS_060) {
3574 @@ -69,11 +76,18 @@ static unsigned long virt_to_phys_slow(u
3575 }
3576 return 0;
3577 }
3578 +#endif /* CONFIG_COLDFIRE */
3579 +
3580
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)
3584 {
3585 +#ifdef CONFIG_COLDFIRE
3586 +// JKM -- hack until new cpushl stuff is in
3587 +// cf_icache_flush_range(address, endaddr);
3588 + flush_icache();
3589 +#else /* !CONFIG_COLDFIRE */
3590
3591 if (CPU_IS_040_OR_060) {
3592 address &= PAGE_MASK;
3593 @@ -94,9 +108,11 @@ void flush_icache_range(unsigned long ad
3594 : "=&d" (tmp)
3595 : "di" (FLUSH_I));
3596 }
3597 +#endif /* CONFIG_COLDFIRE */
3598 }
3599 EXPORT_SYMBOL(flush_icache_range);
3600
3601 +#ifndef CONFIG_COLDFIRE
3602 void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
3603 unsigned long addr, int len)
3604 {
3605 @@ -115,4 +131,5 @@ void flush_icache_user_range(struct vm_a
3606 : "di" (FLUSH_I));
3607 }
3608 }
3609 +#endif /* CONFIG_COLDFIRE */
3610
3611 --- a/arch/m68k/mm/hwtest.c
3612 +++ b/arch/m68k/mm/hwtest.c
3613 @@ -12,6 +12,10 @@
3614 * them here complete with the comments from the original atari
3615 * config.c...
3616 * -- PMM <pmaydell@chiark.greenend.org.uk>, 05/1998
3617 + *
3618 + * Copyright Freescale Semiconductor, Inc. 2008-2009
3619 + * Jason Jin Jason.Jin@freescale.com
3620 + * Shrek Wu B16972@freescale.com
3621 */
3622
3623 /* This function tests for the presence of an address, specially a
3624 @@ -25,6 +29,7 @@
3625
3626 #include <linux/module.h>
3627
3628 +#ifndef CONFIG_COLDFIRE
3629 int hwreg_present( volatile void *regp )
3630 {
3631 int ret = 0;
3632 @@ -82,4 +87,5 @@ int hwreg_write( volatile void *regp, un
3633 return( ret );
3634 }
3635 EXPORT_SYMBOL(hwreg_write);
3636 +#endif
3637
3638 --- a/arch/m68k/mm/init.c
3639 +++ b/arch/m68k/mm/init.c
3640 @@ -2,6 +2,9 @@
3641 * linux/arch/m68k/mm/init.c
3642 *
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
3647 *
3648 * Contains common initialization routines, specific init code moved
3649 * to motorola.c and sun3mmu.c
3650 @@ -31,6 +34,10 @@
3651 #include <asm/sections.h>
3652 #include <asm/tlb.h>
3653
3654 +#ifdef CONFIG_VDSO
3655 +int vdso_init(void);
3656 +#endif
3657 +
3658 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
3659
3660 pg_data_t pg_data_map[MAX_NUMNODES];
3661 @@ -88,7 +95,6 @@ void __init mem_init(void)
3662 if (MACH_IS_ATARI)
3663 atari_stram_mem_init_hook();
3664 #endif
3665 -
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)
3670 }
3671 }
3672
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));
3682 +
3683 +#ifdef CONFIG_VDSO
3684 + /* init the vdso page */
3685 + vdso_init();
3686 +#endif
3687 }
3688
3689 #ifdef CONFIG_BLK_DEV_INITRD
3690 --- a/arch/m68k/mm/kmap.c
3691 +++ b/arch/m68k/mm/kmap.c
3692 @@ -2,6 +2,9 @@
3693 * linux/arch/m68k/mm/kmap.c
3694 *
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
3699 *
3700 * 10/01/99 cleaned up the code and changing to the same interface
3701 * used by other architectures /Roman Zippel
3702 @@ -24,7 +27,11 @@
3703
3704 #undef DEBUG
3705
3706 +#ifndef CONFIG_COLDFIRE
3707 #define PTRTREESIZE (256*1024)
3708 +#else
3709 +#define PTRTREESIZE PAGE_SIZE
3710 +#endif
3711
3712 /*
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
3715
3716 #else
3717
3718 +#ifdef CONFIG_COLDFIRE
3719 +#define IO_SIZE PAGE_SIZE
3720 +#else
3721 #define IO_SIZE (256*1024)
3722 +#endif
3723
3724 static struct vm_struct *iolist;
3725
3726 @@ -127,8 +138,41 @@ void __iomem *__ioremap(unsigned long ph
3727 }
3728 #endif
3729
3730 +#ifdef CONFIG_M5445X
3731 + if (physaddr >= 0xf0000000) {
3732 + /*
3733 + * On the M5445x processors an ACR is setup to map
3734 + * the 0xF0000000 range into kernel memory as
3735 + * non-cacheable.
3736 + */
3737 + return (void __iomem *)physaddr;
3738 + }
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
3742 + */
3743 + return (void __iomem *)physaddr;
3744 + }
3745 +#endif
3746 +#ifdef CONFIG_M547X_8X
3747 + if (physaddr >= 0xf0000000) {
3748 + /*
3749 + * On the M547x/M548x processors an ACR is setup to map
3750 + * the 0xF0000000 range into kernel memory as
3751 + * non-cacheable.
3752 + */
3753 + return (void __iomem *)physaddr;
3754 + }
3755 +
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;
3760 + }
3761 +#endif
3762 #ifdef DEBUG
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);
3766 #endif
3767 /*
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;
3772 #ifdef DEBUG
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);
3776 #endif
3777
3778 /*
3779 @@ -172,7 +217,12 @@ void __iomem *__ioremap(unsigned long ph
3780 break;
3781 }
3782 } else {
3783 +#ifndef CONFIG_COLDFIRE
3784 physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
3785 +#else
3786 + physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY | \
3787 + _PAGE_READWRITE);
3788 +#endif
3789 switch (cacheflag) {
3790 case IOMAP_NOCACHE_SER:
3791 case IOMAP_NOCACHE_NONSER:
3792 @@ -252,6 +302,13 @@ void __iounmap(void *addr, unsigned long
3793 pmd_t *pmd_dir;
3794 pte_t *pte_dir;
3795
3796 +#ifdef CONFIG_M547X_8X
3797 + if ((addr >= (void *)0xd0000000)
3798 + && (addr + size < (void *)0xd800ffff)) {
3799 + printk(KERN_ERR "%s: PCI address\n", __func__);
3800 + return;
3801 + }
3802 +#endif
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.
3809
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
3816 @@ -2,6 +2,10 @@
3817 * linux/arch/m68k/mm/memory.c
3818 *
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
3823 + *
3824 */
3825
3826 #include <linux/module.h>
3827 @@ -127,6 +131,7 @@ int free_pointer_table (pmd_t *ptable)
3828 return 0;
3829 }
3830
3831 +#ifndef CONFIG_COLDFIRE
3832 /* invalidate page in both caches */
3833 static inline void clear040(unsigned long paddr)
3834 {
3835 @@ -173,6 +178,7 @@ static inline void pushcl040(unsigned lo
3836 clear040(paddr);
3837 local_irq_restore(flags);
3838 }
3839 +#endif /* CONFIG_COLDFIRE */
3840
3841 /*
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
3844
3845 void cache_clear (unsigned long paddr, int len)
3846 {
3847 +#ifdef CONFIG_COLDFIRE
3848 +// JKM -- revise to use proper caching
3849 +// cf_cache_clear(paddr, len);
3850 + flush_bcache();
3851 +#else
3852 if (CPU_IS_040_OR_060) {
3853 int tmp;
3854
3855 @@ -237,6 +248,7 @@ void cache_clear (unsigned long paddr, i
3856 if(mach_l2_flush)
3857 mach_l2_flush(0);
3858 #endif
3859 +#endif /* CONFIG_COLDFIRE */
3860 }
3861 EXPORT_SYMBOL(cache_clear);
3862
3863 @@ -250,6 +262,11 @@ EXPORT_SYMBOL(cache_clear);
3864
3865 void cache_push (unsigned long paddr, int len)
3866 {
3867 +#ifdef CONFIG_COLDFIRE
3868 +// JKM -- revise to use proper caching
3869 +// cf_cache_push(paddr, len);
3870 + flush_bcache();
3871 +#else
3872 if (CPU_IS_040_OR_060) {
3873 int tmp = PAGE_SIZE;
3874
3875 @@ -290,6 +307,7 @@ void cache_push (unsigned long paddr, in
3876 if(mach_l2_flush)
3877 mach_l2_flush(1);
3878 #endif
3879 +#endif /* CONFIG_COLDFIRE */
3880 }
3881 EXPORT_SYMBOL(cache_push);
3882
3883 --- a/fs/namespace.c
3884 +++ b/fs/namespace.c
3885 @@ -3,6 +3,10 @@
3886 *
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
3893 *
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
3901 size = PAGE_SIZE;
3902 +#else
3903 + size = PAGE_SIZE - ((unsigned long)data & ~PAGE_MASK);
3904 +#endif
3905
3906 i = size - exact_copy_from_user((void *)page, data, size);
3907 if (!i) {
3908 --- a/include/linux/fsl_devices.h
3909 +++ b/include/linux/fsl_devices.h
3910 @@ -6,7 +6,7 @@
3911 *
3912 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
3913 *
3914 - * Copyright 2004 Freescale Semiconductor, Inc
3915 + * Copyright 2004-2008 Freescale Semiconductor, Inc
3916 *
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
3919 @@ -18,6 +18,7 @@
3920 #define _FSL_DEVICE_H_
3921
3922 #include <linux/types.h>
3923 +#include <linux/interrupt.h>
3924
3925 /*
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,
3929 };
3930
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;
3937 +
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;
3956 +
3957 + /* register save area for suspend/resume */
3958 + u32 pm_command;
3959 + u32 pm_status;
3960 + u32 pm_intr_enable;
3961 + u32 pm_frame_index;
3962 + u32 pm_segment;
3963 + u32 pm_frame_list;
3964 + u32 pm_async_next;
3965 + u32 pm_configured_flag;
3966 + u32 pm_portsc;
3967 };
3968
3969 /* Flags in fsl_usb2_mph_platform_data */
3970 @@ -92,4 +124,30 @@ struct mpc8xx_pcmcia_ops {
3971 */
3972 int fsl_deep_sleep(void);
3973
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 */
3979 +#endif
3980 + int (*init)(struct platform_device *pdev);
3981 + void (*exit)(void);
3982 + int (*get_clk_rate)(void);
3983 +};
3984 +
3985 +struct coldfire_fec_platform_data {
3986 + int hash_table;
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);
3999 +};
4000 #endif /* _FSL_DEVICE_H_ */
This page took 0.209401 seconds and 5 git commands to generate.