046-mcfv4e_kern_to_phys.patch 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614
  1. From 13fc0abf4b5da6f18dea15fd31697655615a79fc Mon Sep 17 00:00:00 2001
  2. From: Kurt Mahan <[email protected]>
  3. Date: Wed, 12 Mar 2008 15:39:03 -0600
  4. Subject: [PATCH] Move kernel to physical sdram base address.
  5. Work based on the patches from Systec GMBH. Also DMA support,
  6. uBoot integration, FEC fixes, and assorted cleanups.
  7. Uber patch needs to be split up.
  8. LTIBName: mcfv4e-kern-to-phys
  9. Signed-off-by: Kurt Mahan <[email protected]>
  10. ---
  11. arch/m68k/coldfire/config.c | 102 ++-----
  12. arch/m68k/coldfire/dma.c | 7 +-
  13. arch/m68k/coldfire/entry.S | 10 +
  14. arch/m68k/coldfire/head.S | 53 +++-
  15. arch/m68k/coldfire/mcf5445x-devices.c | 2 +
  16. arch/m68k/coldfire/mcf5445x-pci.c | 3 +
  17. arch/m68k/coldfire/signal.c | 3 +
  18. arch/m68k/configs/m5485evb_defconfig | 79 +++++-
  19. arch/m68k/mm/cache.c | 4 +-
  20. arch/m68k/mm/cf-mmu.c | 28 ++-
  21. arch/m68k/mm/memory.c | 8 +-
  22. drivers/net/fec/fec.c | 20 +-
  23. include/asm-m68k/bootinfo.h | 59 +++-
  24. include/asm-m68k/cf_cacheflush.h | 547 +++++++++++----------------------
  25. include/asm-m68k/cf_pgalloc.h | 5 +-
  26. include/asm-m68k/cf_pgtable.h | 2 +-
  27. include/asm-m68k/cfcache.h | 6 +
  28. include/asm-m68k/page.h | 8 +
  29. include/asm-m68k/page_offset.h | 25 +-
  30. 19 files changed, 446 insertions(+), 525 deletions(-)
  31. --- a/arch/m68k/coldfire/config.c
  32. +++ b/arch/m68k/coldfire/config.c
  33. @@ -23,7 +23,6 @@
  34. #include <asm/coldfire.h>
  35. #include <asm/cfcache.h>
  36. #include <asm/cacheflush.h>
  37. -#include <asm/bootinfo.h>
  38. #include <asm/io.h>
  39. #include <asm/cfmmu.h>
  40. #include <asm/setup.h>
  41. @@ -36,7 +35,14 @@
  42. #include <asm/mcfsim.h>
  43. -#if 0
  44. +#if defined(CONFIG_M54455)
  45. +#define UBOOT_EXTRA_CLOCKS
  46. +#elif defined(CONFIG_M547X_8X)
  47. +#define UBOOT_PCI
  48. +#endif
  49. +#include <asm/bootinfo.h>
  50. +
  51. +#ifdef CONFIG_M54455
  52. #include <asm/mcf5445x_intc.h>
  53. #include <asm/mcf5445x_sdramc.h>
  54. #include <asm/mcf5445x_fbcs.h>
  55. @@ -44,10 +50,6 @@
  56. #include <asm/mcf5445x_xbs.h>
  57. #endif
  58. -/* JKM -- testing */
  59. -#include <linux/pfn.h>
  60. -/* JKM */
  61. -
  62. extern int get_irq_list(struct seq_file *p, void *v);
  63. extern char _text, _end;
  64. extern char _etext, _edata, __init_begin, __init_end;
  65. @@ -58,6 +60,10 @@ extern unsigned long availmem;
  66. static int irq_enable[NR_IRQS];
  67. unsigned long num_pages;
  68. +/* ethernet mac addresses from uboot */
  69. +unsigned char uboot_enet0[6];
  70. +unsigned char uboot_enet1[6];
  71. +
  72. void coldfire_sort_memrec(void)
  73. {
  74. int i, j;
  75. @@ -87,6 +93,9 @@ void coldfire_sort_memrec(void)
  76. }
  77. }
  78. +/*
  79. + * UBoot Handler
  80. + */
  81. int __init uboot_commandline(char *bootargs)
  82. {
  83. int len = 0, cmd_line_len;
  84. @@ -101,12 +110,17 @@ int __init uboot_commandline(char *boota
  85. return 0;
  86. /* Add offset to get post-remapped kernel memory location */
  87. - uboot_info.bd_info = (*(u32 *)(uboot_info_stk)) + offset;
  88. + uboot_info.bdi = (struct bd_info *)((*(u32 *)(uboot_info_stk)) + offset);
  89. uboot_info.initrd_start = (*(u32 *)(uboot_info_stk+4)) + offset;
  90. uboot_info.initrd_end = (*(u32 *)(uboot_info_stk+8)) + offset;
  91. uboot_info.cmd_line_start = (*(u32 *)(uboot_info_stk+12)) + offset;
  92. uboot_info.cmd_line_stop = (*(u32 *)(uboot_info_stk+16)) + offset;
  93. + /* copy over mac addresses */
  94. + memcpy(uboot_enet0, uboot_info.bdi->bi_enet0addr, 6);
  95. + memcpy(uboot_enet1, uboot_info.bdi->bi_enet1addr, 6);
  96. +
  97. + /* copy command line */
  98. cmd_line_len = uboot_info.cmd_line_stop - uboot_info.cmd_line_start;
  99. if ((cmd_line_len > 0) && (cmd_line_len < CL_SIZE-1))
  100. len = (int)strncpy(bootargs, (char *)uboot_info.cmd_line_start,\
  101. @@ -121,7 +135,7 @@ int __init uboot_commandline(char *boota
  102. #if defined(CONFIG_M54455)
  103. #define DEFAULT_COMMAND_LINE "root=/dev/mtdblock1 rw rootfstype=jffs2 ip=none mtdparts=physmap-flash.0:5M(kernel)ro,-(jffs2)"
  104. #elif defined(CONFIG_M547X_8X)
  105. -#define DEFAULT_COMMAND_LINE "debug root=/dev/nfs nfsroot=172.27.155.1:/tftpboot/rigo/rootfs/ ip=172.27.155.85:172.27.155.1"
  106. +#define DEFAULT_COMMAND_LINE "debug root=/dev/nfs rw nfsroot=172.27.155.1:/tftpboot/rigo/rootfs/ ip=172.27.155.85:172.27.155.1"
  107. #endif
  108. asmlinkage void __init cf_early_init(void)
  109. {
  110. @@ -142,7 +156,6 @@ asmlinkage void __init cf_early_init(voi
  111. MCF_INTC1_IMRL = 0xFFFFFFFF;
  112. MCF_INTC1_IMRH = 0xFFFFFFFF;
  113. #elif defined(CONFIG_M547X_8X)
  114. -/* JKM -- ?? */
  115. MCF_IMRL = 0xFFFFFFFF;
  116. MCF_IMRH = 0xFFFFFFFF;
  117. #endif
  118. @@ -170,7 +183,6 @@ asmlinkage void __init cf_early_init(voi
  119. MCF_XBS_PRS_M6(MCF_XBS_PRI_1) |
  120. MCF_XBS_PRS_M7(MCF_XBS_PRI_7));
  121. #endif
  122. -
  123. m68k_machtype = MACH_CFMMU;
  124. m68k_fputype = FPU_CFV4E;
  125. @@ -181,7 +193,6 @@ asmlinkage void __init cf_early_init(voi
  126. m68k_memory[m68k_num_memory].addr = CONFIG_SDRAM_BASE;
  127. m68k_memory[m68k_num_memory++].size = CONFIG_SDRAM_SIZE;
  128. -#if defined(CONFIG_M54455)
  129. if (!uboot_commandline(m68k_command_line)) {
  130. #if defined(CONFIG_BOOTPARAM)
  131. strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE-1);
  132. @@ -189,11 +200,6 @@ asmlinkage void __init cf_early_init(voi
  133. strcpy(m68k_command_line, DEFAULT_COMMAND_LINE);
  134. #endif
  135. }
  136. -#else
  137. -/* JKM -- hack until mappings get resolved */
  138. - strcpy(m68k_command_line, DEFAULT_COMMAND_LINE);
  139. -#endif
  140. -
  141. #if defined(CONFIG_BLK_DEV_INITRD)
  142. /* add initrd image */
  143. @@ -372,75 +378,11 @@ void coldfire_reboot(void)
  144. #endif
  145. }
  146. -/* int coldfire_hwclk(int i, struct rtc_time *t)
  147. -{
  148. - printk ("Real time clock needs porting.\n");
  149. - return 0;
  150. -}*/
  151. -
  152. static void coldfire_get_model(char *model)
  153. {
  154. sprintf(model, "Version 4 ColdFire");
  155. }
  156. -/* JKM -- Why do we need these? */
  157. -void coldfire_enable_irq(unsigned int vec)
  158. -{
  159. - unsigned long flags;
  160. -
  161. - vec -= 64;
  162. -
  163. - if (((int)vec < 0) || (vec > 63)) {
  164. - printk(KERN_WARNING "enable_irq %d failed\n", vec);
  165. - return;
  166. - }
  167. -
  168. - local_irq_save(flags);
  169. - irq_enable[vec]++;
  170. -#if defined(CONFIG_M54455)
  171. - if (vec < 32)
  172. - MCF_INTC0_IMRL &= ~(1 << vec);
  173. - else
  174. - MCF_INTC0_IMRH &= ~(1 << (vec - 32));
  175. -#elif defined(CONFIG_M547X_8X)
  176. - if (vec < 32)
  177. - MCF_IMRL &= ~(1 << vec);
  178. - else
  179. - MCF_IMRH &= ~(1 << (vec - 32));
  180. -#endif
  181. - local_irq_restore(flags);
  182. -}
  183. -
  184. -/* JKM -- Why do we need these? */
  185. -void coldfire_disable_irq(unsigned int vec)
  186. -{
  187. - unsigned long flags;
  188. -
  189. - vec -= 64;
  190. -
  191. - if (((int)vec < 0) || (vec > 63)) {
  192. - printk(KERN_WARNING "disable_irq %d failed\n", vec);
  193. - return;
  194. - }
  195. -
  196. - local_irq_save(flags);
  197. - if (--irq_enable[vec] == 0) {
  198. -#if defined(CONFIG_M54455)
  199. - if (vec < 32)
  200. - MCF_INTC0_IMRL |= (1 << vec);
  201. - else
  202. - MCF_INTC0_IMRH |= (1 << (vec - 32));
  203. -#elif defined(CONFIG_M547X_8X)
  204. - if (vec < 32)
  205. - MCF_IMRL |= (1 << vec);
  206. - else
  207. - MCF_IMRH |= (1 << (vec - 32));
  208. -#endif
  209. -
  210. - }
  211. - local_irq_restore(flags);
  212. -}
  213. -
  214. static void __init
  215. coldfire_bootmem_alloc(unsigned long memory_start, unsigned long memory_end)
  216. {
  217. --- a/arch/m68k/coldfire/dma.c
  218. +++ b/arch/m68k/coldfire/dma.c
  219. @@ -516,13 +516,8 @@ dma_init()
  220. MCF_DMA_DIPR = 0xFFFFFFFF;
  221. MCF_ICR(ISC_DMA) = ILP_DMA;
  222. -#if 0
  223. -// JKM
  224. - enable_irq( 64 + ISC_DMA );
  225. -#endif
  226. - result =
  227. - MCD_initDma((dmaRegs *) (MCF_MBAR + 0x8000),
  228. + result = MCD_initDma((dmaRegs *) (MCF_MBAR + 0x8000),
  229. (void *) SYS_SRAM_DMA_START, MCD_RELOC_TASKS);
  230. if (result != MCD_OK) {
  231. printk("Cannot perform DMA initialization\n");
  232. --- a/arch/m68k/coldfire/entry.S
  233. +++ b/arch/m68k/coldfire/entry.S
  234. @@ -10,6 +10,8 @@
  235. * Kurt Mahan [email protected]
  236. * Copyright Freescale Semiconductor, Inc. 2007
  237. *
  238. + * Modify irq status in buserr -- (c) Copyright 2008, SYSTEM electronic Gmbh
  239. + *
  240. * Based on:
  241. *
  242. * arch/m68knommu/platform/5307/entry.S &
  243. @@ -77,7 +79,15 @@ sw_usp:
  244. .globl inthandler
  245. ENTRY(buserr)
  246. +#ifdef CONFIG_COLDFIRE_FOO
  247. + movew #0x2700,%sr /* lock interrupts */
  248. +#endif
  249. SAVE_ALL_INT
  250. +#ifdef CONFIG_COLDFIRE_FOO
  251. + movew PT_SR(%sp),%d3 /* get original %sr */
  252. + oril #0x2000,%d3 /* set supervisor mode in it */
  253. + movew %d3,%sr /* recover irq state */
  254. +#endif
  255. GET_CURRENT(%d0)
  256. movel %sp,%sp@- /* stack frame pointer argument */
  257. jsr buserr_c
  258. --- a/arch/m68k/coldfire/head.S
  259. +++ b/arch/m68k/coldfire/head.S
  260. @@ -5,6 +5,7 @@
  261. * Matt Waddel [email protected]
  262. * Kurt Mahan [email protected]
  263. * Copyright Freescale Semiconductor, Inc. 2007, 2008
  264. + * Phys kernel mapping Copyright Daniel Krueger, SYSTEC electornic GmbH 2008
  265. *
  266. * This program is free software; you can redistribute it and/or modify
  267. * it under the terms of the GNU General Public License as published by
  268. @@ -52,7 +53,7 @@
  269. #define __FINIT .previous
  270. #endif
  271. -/* JKM -- REVISE DOCS FOR RIGO */
  272. +/* JKM -- REVISE DOCS FOR RIGO and PHYS MAPPING */
  273. /*
  274. * Setup ACR mappings to provide the following memory map:
  275. * Data
  276. @@ -62,10 +63,17 @@
  277. * None currently (mapped via TLBs)
  278. */
  279. +#if CONFIG_SDRAM_BASE != PAGE_BASE
  280. #if defined(CONFIG_M54455)
  281. +#if 0
  282. #define ACR0_DEFAULT #0xA00FA048 /* ACR0 default value */
  283. +#endif
  284. +#define ACR0_DEFAULT #0x400FA028 /* ACR0 default value */
  285. #define ACR1_DEFAULT #0xF00FA040 /* ACR1 default value */
  286. +#if 0
  287. #define ACR2_DEFAULT #0x00000000 /* ACR2 default value */
  288. +#endif
  289. +#define ACR2_DEFAULT #0x400FA028 /* ACR2 default value */
  290. #define ACR3_DEFAULT #0x00000000 /* ACR3 default value */
  291. /* ACR mapping for FPGA (maps 0) */
  292. #define ACR0_FPGA #0x000FA048 /* ACR0 enable FPGA */
  293. @@ -76,6 +84,16 @@
  294. #define ACR3_DEFAULT #0x00000000 /* ACR3 default value */
  295. #endif
  296. +#else
  297. +#if defined(CONFIG_M54455)
  298. +#elif defined(CONFIG_M547X_8X)
  299. +#define ACR0_DEFAULT #0xE000C040 /* ACR0 default value */
  300. +#define ACR1_DEFAULT #0x000FA008 /* ACR1 default value */
  301. +#define ACR2_DEFAULT #0x00000000 /* ACR2 default value */
  302. +#define ACR3_DEFAULT #0x000FA008 /* ACR3 default value */
  303. +#endif
  304. +#endif
  305. +
  306. /* Several macros to make the writing of subroutines easier:
  307. * - func_start marks the beginning of the routine which setups the frame
  308. @@ -153,6 +171,7 @@ func_define putn,1
  309. #endif
  310. .endm
  311. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  312. /*
  313. mmu_map - creates a new TLB entry
  314. @@ -222,6 +241,7 @@ func_define putn,1
  315. movew \temp_data_reg, (MMUOR)
  316. 1:
  317. .endm /* mmu_unmap */
  318. +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
  319. /* .text */
  320. .section ".text.head","ax"
  321. @@ -235,7 +255,11 @@ ENTRY(_stext)
  322. .long BOOTINFOV_MAGIC
  323. .long 0
  324. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  325. 1: jmp __start-(0xc0000000-CONFIG_SDRAM_BASE)
  326. +#else
  327. +1: jmp __start
  328. +#endif
  329. .equ kernel_pg_dir,_stext
  330. .equ .,_stext+0x1000
  331. @@ -244,24 +268,13 @@ ENTRY(_start)
  332. jra __start
  333. __INIT
  334. ENTRY(__start)
  335. -
  336. -/* JKM -- make sure Rigo handles UBOOT */
  337. /* Save the location of u-boot info - cmd line, bd_info, etc. */
  338. movel %a7,%a4 /* Don't use %a4 before cf_early_init */
  339. -/* JKM -- fix to use CONFIG_SDRAM_BASE) */
  340. -#if defined(CONFIG_M54455)
  341. - addl #0x80000004,%a4 /* 0x80000004= 1 stack push + high mem offset */
  342. -#elif defined(CONFIG_M547X_8X)
  343. - addl #0xc0000004,%a4 /* 0x80000004= 1 stack push + high mem offset */
  344. -#endif
  345. + addl #0x00000004,%a4 /* offset past top */
  346. + addl #(PAGE_OFFSET-CONFIG_SDRAM_BASE),%a4 /* high mem offset */
  347. -/* JKM -- fix this to work off of CONFIG_SDRAM_BASE */
  348. /* Setup initial stack pointer */
  349. -#if defined(CONFIG_M54455)
  350. - movel #0x40001000,%sp
  351. -#elif defined(CONFIG_M547X_8X)
  352. - movel #0x00001000,%sp
  353. -#endif
  354. + movel #CONFIG_SDRAM_BASE+0x1000,%sp
  355. /* Setup usp */
  356. subl %a0,%a0
  357. @@ -297,16 +310,21 @@ ENTRY(__start)
  358. /* setup ACRs */
  359. movel ACR0_DEFAULT, %d0 /* ACR0 (DATA) setup */
  360. movec %d0, %acr0
  361. + nop
  362. movel ACR1_DEFAULT, %d0 /* ACR1 (DATA) setup */
  363. movec %d0, %acr1
  364. + nop
  365. movel ACR2_DEFAULT, %d0 /* ACR2 (CODE) setup */
  366. movec %d0, %acr2
  367. + nop
  368. movel ACR3_DEFAULT, %d0 /* ACR3 (CODE) setup */
  369. movec %d0, %acr3
  370. + nop
  371. /* If you change the memory size to another value make a matching
  372. change in paging_init(cf-mmu.c) to zones_size[]. */
  373. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  374. #if defined(CONFIG_M54455)
  375. /* Map 256MB as code */
  376. mmu_map (PAGE_OFFSET+0*0x1000000), (PHYS_OFFSET+0*0x1000000), \
  377. @@ -511,6 +529,7 @@ ENTRY(__start)
  378. MMUTR_SG, MMUDR_SZ1M, MMUDR_DCB, MMUDR_SP, MMUDR_R, \
  379. MMUDR_W, 0, 0, %d0
  380. #endif
  381. +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
  382. /* Turn on MMU */
  383. movel #(MMUCR_EN),%a0
  384. @@ -531,6 +550,7 @@ ENTRY(__running_high)
  385. movel %a1,%a0@
  386. /* Unmap unity mappings */
  387. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  388. #if defined(CONFIG_M54455)
  389. mmu_unmap (PHYS_OFFSET+0*0x1000000), MMUOR_ITLB, %d0
  390. mmu_unmap (PHYS_OFFSET+0*0x1000000), 0, %d0
  391. @@ -544,6 +564,7 @@ ENTRY(__running_high)
  392. mmu_unmap (PHYS_OFFSET+2*0x1000000), 0, %d0
  393. mmu_unmap (PHYS_OFFSET+3*0x1000000), 0, %d0
  394. #endif
  395. +#endif /* CONFIG_SDRAM_BASE != PAGE_OFFSET */
  396. /* Setup initial stack pointer */
  397. lea init_task,%a2
  398. @@ -574,6 +595,7 @@ func_return set_context
  399. * Map in 0x00000000 -> 0x0fffffff and then do the write.
  400. */
  401. set_fpga:
  402. +#if 0
  403. movew %sr,%d1
  404. movew #0x2700,%sr
  405. movel ACR0_FPGA, %d0
  406. @@ -585,6 +607,7 @@ set_fpga:
  407. movec %d0, %acr0
  408. nop
  409. movew %d1,%sr
  410. +#endif
  411. rts
  412. #endif
  413. --- a/arch/m68k/coldfire/mcf5445x-devices.c
  414. +++ b/arch/m68k/coldfire/mcf5445x-devices.c
  415. @@ -127,7 +127,9 @@ static inline void mcf5445x_init_pata(vo
  416. static int __init mcf5445x_init_devices(void)
  417. {
  418. printk(KERN_INFO "MCF5445x INIT_DEVICES\n");
  419. +#if 0
  420. mcf5445x_init_pata();
  421. +#endif
  422. return 0;
  423. }
  424. --- a/arch/m68k/coldfire/mcf5445x-pci.c
  425. +++ b/arch/m68k/coldfire/mcf5445x-pci.c
  426. @@ -236,6 +236,8 @@ mcf5445x_pci_arb_interrupt(int irq, void
  427. int __init
  428. init_mcf5445x_pci(void)
  429. {
  430. + return 0;
  431. +#if 0
  432. /*
  433. * Initialize the PCI core
  434. */
  435. @@ -331,6 +333,7 @@ init_mcf5445x_pci(void)
  436. raw_pci_ops = &mcf5445x_pci_ops;
  437. return 0;
  438. +#endif
  439. }
  440. /*
  441. --- a/arch/m68k/coldfire/signal.c
  442. +++ b/arch/m68k/coldfire/signal.c
  443. @@ -608,7 +608,10 @@ static inline int rt_setup_ucontext(stru
  444. static inline void push_cache(unsigned long vaddr)
  445. {
  446. +#if 0
  447. +// JKM -- need to add into the old cpushl cache stuff
  448. cf_cache_push(__pa(vaddr), 8);
  449. +#endif
  450. }
  451. static inline void __user *
  452. --- a/arch/m68k/configs/m5485evb_defconfig
  453. +++ b/arch/m68k/configs/m5485evb_defconfig
  454. @@ -1,7 +1,7 @@
  455. #
  456. # Automatically generated make config: don't edit
  457. # Linux kernel version: 2.6.24
  458. -# Thu Feb 21 00:19:01 2008
  459. +# Wed Mar 5 16:05:25 2008
  460. #
  461. CONFIG_M68K=y
  462. CONFIG_MMU=y
  463. @@ -103,6 +103,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
  464. # CONFIG_SUN3 is not set
  465. CONFIG_COLDFIRE=y
  466. CONFIG_CFV4E=y
  467. +CONFIG_MCD_DMA=y
  468. # CONFIG_AMIGA is not set
  469. # CONFIG_ATARI is not set
  470. # CONFIG_MAC is not set
  471. @@ -135,7 +136,7 @@ CONFIG_M5485CFE=y
  472. # CONFIG_M5485DFE is not set
  473. # CONFIG_M5485EFE is not set
  474. # CONFIG_M5485FFE is not set
  475. -CONFIG_MCFCLK=50000000
  476. +CONFIG_MCFCLK=200000000
  477. # CONFIG_MCF_USER_HALT is not set
  478. CONFIG_MMU_CFV4E=y
  479. CONFIG_SDRAM_BASE=0x00000000
  480. @@ -279,7 +280,73 @@ CONFIG_FW_LOADER=y
  481. # CONFIG_DEBUG_DEVRES is not set
  482. # CONFIG_SYS_HYPERVISOR is not set
  483. # CONFIG_CONNECTOR is not set
  484. -# CONFIG_MTD is not set
  485. +CONFIG_MTD=y
  486. +# CONFIG_MTD_DEBUG is not set
  487. +# CONFIG_MTD_CONCAT is not set
  488. +CONFIG_MTD_PARTITIONS=y
  489. +# CONFIG_MTD_REDBOOT_PARTS is not set
  490. +CONFIG_MTD_CMDLINE_PARTS=y
  491. +
  492. +#
  493. +# User Modules And Translation Layers
  494. +#
  495. +# CONFIG_MTD_CHAR is not set
  496. +CONFIG_MTD_BLKDEVS=y
  497. +CONFIG_MTD_BLOCK=y
  498. +# CONFIG_FTL is not set
  499. +# CONFIG_NFTL is not set
  500. +# CONFIG_INFTL is not set
  501. +# CONFIG_RFD_FTL is not set
  502. +# CONFIG_SSFDC is not set
  503. +# CONFIG_MTD_OOPS is not set
  504. +
  505. +#
  506. +# RAM/ROM/Flash chip drivers
  507. +#
  508. +# CONFIG_MTD_CFI is not set
  509. +# CONFIG_MTD_JEDECPROBE is not set
  510. +CONFIG_MTD_MAP_BANK_WIDTH_1=y
  511. +CONFIG_MTD_MAP_BANK_WIDTH_2=y
  512. +CONFIG_MTD_MAP_BANK_WIDTH_4=y
  513. +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
  514. +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
  515. +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
  516. +CONFIG_MTD_CFI_I1=y
  517. +CONFIG_MTD_CFI_I2=y
  518. +# CONFIG_MTD_CFI_I4 is not set
  519. +# CONFIG_MTD_CFI_I8 is not set
  520. +CONFIG_MTD_RAM=y
  521. +CONFIG_MTD_ROM=y
  522. +# CONFIG_MTD_ABSENT is not set
  523. +
  524. +#
  525. +# Mapping drivers for chip access
  526. +#
  527. +# CONFIG_MTD_COMPLEX_MAPPINGS is not set
  528. +# CONFIG_MTD_PHYSMAP is not set
  529. +# CONFIG_MTD_PLATRAM is not set
  530. +
  531. +#
  532. +# Self-contained MTD device drivers
  533. +#
  534. +# CONFIG_MTD_SLRAM is not set
  535. +# CONFIG_MTD_PHRAM is not set
  536. +# CONFIG_MTD_MTDRAM is not set
  537. +# CONFIG_MTD_BLOCK2MTD is not set
  538. +
  539. +#
  540. +# Disk-On-Chip Device Drivers
  541. +#
  542. +# CONFIG_MTD_DOC2000 is not set
  543. +# CONFIG_MTD_DOC2001 is not set
  544. +# CONFIG_MTD_DOC2001PLUS is not set
  545. +# CONFIG_MTD_NAND is not set
  546. +# CONFIG_MTD_ONENAND is not set
  547. +
  548. +#
  549. +# UBI - Unsorted block images
  550. +#
  551. +# CONFIG_MTD_UBI is not set
  552. # CONFIG_PARPORT is not set
  553. CONFIG_BLK_DEV=y
  554. # CONFIG_BLK_DEV_COW_COMMON is not set
  555. @@ -347,6 +414,9 @@ CONFIG_NETDEVICES=y
  556. # CONFIG_PHYLIB is not set
  557. CONFIG_NET_ETHERNET=y
  558. CONFIG_MII=y
  559. +CONFIG_FEC_548x=y
  560. +CONFIG_FEC_548x_AUTO_NEGOTIATION=y
  561. +# CONFIG_FEC_548x_ENABLE_FEC2 is not set
  562. # CONFIG_IBM_NEW_EMAC_ZMII is not set
  563. # CONFIG_IBM_NEW_EMAC_RGMII is not set
  564. # CONFIG_IBM_NEW_EMAC_TAH is not set
  565. @@ -530,7 +600,7 @@ CONFIG_FS_MBCACHE=y
  566. # CONFIG_GFS2_FS is not set
  567. # CONFIG_OCFS2_FS is not set
  568. CONFIG_MINIX_FS=y
  569. -# CONFIG_ROMFS_FS is not set
  570. +CONFIG_ROMFS_FS=y
  571. # CONFIG_INOTIFY is not set
  572. # CONFIG_QUOTA is not set
  573. CONFIG_DNOTIFY=y
  574. @@ -578,6 +648,7 @@ CONFIG_TMPFS=y
  575. # CONFIG_BEFS_FS is not set
  576. # CONFIG_BFS_FS is not set
  577. # CONFIG_EFS_FS is not set
  578. +# CONFIG_JFFS2_FS is not set
  579. # CONFIG_CRAMFS is not set
  580. # CONFIG_VXFS_FS is not set
  581. # CONFIG_HPFS_FS is not set
  582. --- a/arch/m68k/mm/cache.c
  583. +++ b/arch/m68k/mm/cache.c
  584. @@ -81,7 +81,9 @@ static unsigned long virt_to_phys_slow(u
  585. void flush_icache_range(unsigned long address, unsigned long endaddr)
  586. {
  587. #ifdef CONFIG_COLDFIRE
  588. - cf_icache_flush_range(address, endaddr);
  589. +// JKM -- hack until new cpushl stuff is in
  590. +// cf_icache_flush_range(address, endaddr);
  591. + flush_icache();
  592. #else /* !CONFIG_COLDFIRE */
  593. if (CPU_IS_040_OR_060) {
  594. --- a/arch/m68k/mm/cf-mmu.c
  595. +++ b/arch/m68k/mm/cf-mmu.c
  596. @@ -35,6 +35,12 @@
  597. #include <asm/coldfire.h>
  598. #include <asm/tlbflush.h>
  599. +#if PAGE_OFFSET == CONFIG_SDRAM_BASE
  600. +#define KERNRAM(x) ((x >= PAGE_OFFSET) && (x < (PAGE_OFFSET + CONFIG_SDRAM_SIZE)))
  601. +#else
  602. +#define KERNRAM(x) (x >= PAGE_OFFSET)
  603. +#endif
  604. +
  605. mm_context_t next_mmu_context;
  606. unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
  607. @@ -53,10 +59,16 @@ extern char __init_begin, __init_end;
  608. void free_initmem(void)
  609. {
  610. +#if 0
  611. unsigned long addr;
  612. unsigned long start = (unsigned long)&__init_begin;
  613. unsigned long end = (unsigned long)&__init_end;
  614. +/*
  615. + * JKM -- revisit -- the latest round of vmlinux.lds changes has caused
  616. + * a little grief with how init areas are handled. With the new toolchain
  617. + * release I'll fix this.
  618. + */
  619. printk(KERN_INFO "free_initmem: __init_begin = 0x%lx __init_end = 0x%lx\n", start, end);
  620. addr = (unsigned long)&__init_begin;
  621. @@ -67,6 +79,7 @@ void free_initmem(void)
  622. free_page(addr);
  623. totalram_pages++;
  624. }
  625. +#endif
  626. }
  627. /* Coldfire paging_init derived from sun3 */
  628. @@ -149,8 +162,8 @@ int cf_tlb_miss(struct pt_regs *regs, in
  629. mmuar = ( dtlb ) ? regs->mmuar
  630. : regs->pc + (extension_word * sizeof(long));
  631. - mm = (!user_mode(regs) && (mmuar >= PAGE_OFFSET)) ? &init_mm
  632. - : current->mm;
  633. + mm = (!user_mode(regs) && KERNRAM(mmuar)) ? &init_mm : current->mm;
  634. +
  635. if (!mm) {
  636. local_irq_restore(flags);
  637. return (-1);
  638. @@ -167,9 +180,9 @@ int cf_tlb_miss(struct pt_regs *regs, in
  639. local_irq_restore(flags);
  640. return (-1);
  641. }
  642. -
  643. - pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar)
  644. - : pte_offset_map(pmd, mmuar);
  645. +
  646. + pte = (KERNRAM(mmuar)) ? pte_offset_kernel(pmd, mmuar)
  647. + : pte_offset_map(pmd, mmuar);
  648. if (pte_none(*pte) || !pte_present(*pte)) {
  649. local_irq_restore(flags);
  650. return (-1);
  651. @@ -185,7 +198,7 @@ int cf_tlb_miss(struct pt_regs *regs, in
  652. set_pte(pte, pte_mkyoung(*pte));
  653. asid = mm->context & 0xff;
  654. - if (!pte_dirty(*pte) && mmuar<=PAGE_OFFSET)
  655. + if (!pte_dirty(*pte) && !KERNRAM(mmuar))
  656. set_pte(pte, pte_wrprotect(*pte));
  657. *MMUTR = (mmuar & PAGE_MASK) | (asid << CF_ASID_MMU_SHIFT)
  658. @@ -201,7 +214,8 @@ int cf_tlb_miss(struct pt_regs *regs, in
  659. else
  660. *MMUOR = MMUOR_ITLB | MMUOR_ACC | MMUOR_UAA;
  661. - asm ("nop");
  662. + asm("nop");
  663. +
  664. /*printk("cf_tlb_miss: va=%lx, pa=%lx\n", (mmuar & PAGE_MASK),
  665. (pte_val(*pte) & PAGE_MASK));*/
  666. local_irq_restore(flags);
  667. --- a/arch/m68k/mm/memory.c
  668. +++ b/arch/m68k/mm/memory.c
  669. @@ -206,7 +206,9 @@ static inline void pushcl040(unsigned lo
  670. void cache_clear (unsigned long paddr, int len)
  671. {
  672. #ifdef CONFIG_COLDFIRE
  673. - cf_cache_clear(paddr, len);
  674. +// JKM -- revise to use proper caching
  675. +// cf_cache_clear(paddr, len);
  676. + flush_bcache();
  677. #else
  678. if (CPU_IS_040_OR_060) {
  679. int tmp;
  680. @@ -257,7 +259,9 @@ EXPORT_SYMBOL(cache_clear);
  681. void cache_push (unsigned long paddr, int len)
  682. {
  683. #ifdef CONFIG_COLDFIRE
  684. - cf_cache_push(paddr, len);
  685. +// JKM -- revise to use proper caching
  686. +// cf_cache_push(paddr, len);
  687. + flush_bcache();
  688. #else
  689. if (CPU_IS_040_OR_060) {
  690. int tmp = PAGE_SIZE;
  691. --- a/drivers/net/fec/fec.c
  692. +++ b/drivers/net/fec/fec.c
  693. @@ -99,6 +99,9 @@ unsigned char fec_mac_addr_fec0[6] = { 0
  694. unsigned char fec_mac_addr_fec1[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x51 }; // Default address of FEC1
  695. #endif
  696. +extern unsigned char uboot_enet0[];
  697. +extern unsigned char uboot_enet1[];
  698. +
  699. #ifndef MODULE
  700. int fec_str_to_mac( char *str_mac, unsigned char* addr);
  701. int __init fec_mac_setup0 (char *s);
  702. @@ -175,6 +178,12 @@ printk(KERN_INFO "FEI: index=%d\n", inde
  703. printk(KERN_INFO "FEI: txdesc=0x%p rxdesc=0x%p\n", fp->fecpriv_txdesc, fp->fecpriv_rxdesc);
  704. /* mac addr */
  705. + if (uboot_enet0[0] || uboot_enet0[1] || uboot_enet0[2] ||
  706. + uboot_enet0[3] || uboot_enet0[4] || uboot_enet0[5]) {
  707. + /* use uboot enet 0 addr */
  708. + memcpy(fec_mac_addr_fec0, uboot_enet0, 6);
  709. + }
  710. +
  711. fp->fecpriv_mac_addr = fec_mac_addr_fec0;
  712. }
  713. else {
  714. @@ -211,6 +220,11 @@ printk(KERN_INFO "FEI: txdesc=0x%p rxde
  715. fp->fecpriv_rxdesc = (void*)FEC_RX_DESC_FEC1;
  716. /* mac addr */
  717. + if (uboot_enet1[0] || uboot_enet1[1] || uboot_enet1[2] ||
  718. + uboot_enet1[3] || uboot_enet1[4] || uboot_enet1[5]) {
  719. + /* use uboot enet 1 addr */
  720. + memcpy(fec_mac_addr_fec1, uboot_enet1, 6);
  721. + }
  722. fp->fecpriv_mac_addr = fec_mac_addr_fec1;
  723. #endif
  724. }
  725. @@ -762,7 +776,6 @@ int fec_tx(struct sk_buff *skb, struct n
  726. void *data, *data_aligned;
  727. int offset;
  728. -printk(KERN_INFO "fec_tx\n");
  729. data = kmalloc(skb->len + 15, GFP_DMA | GFP_ATOMIC);
  730. if (!data)
  731. @@ -820,7 +833,6 @@ void fec_tx_timeout(struct net_device *d
  732. struct fec_priv *fp = netdev_priv(dev);
  733. unsigned long base_addr = (unsigned long) dev->base_addr;
  734. -printk(KERN_INFO "fec_tx_timeout\n");
  735. spin_lock_irq(&fp->fecpriv_lock);
  736. MCD_killDma(fp->fecpriv_fec_tx_channel);
  737. for (i = 0; i < FEC_TX_BUF_NUMBER; i++)
  738. @@ -941,7 +953,6 @@ void fec_interrupt_fec_tx_handler(struct
  739. {
  740. struct fec_priv *fp = netdev_priv(dev);
  741. -printk(KERN_INFO "fectxint\n");
  742. //Release the socket buffer
  743. if(fp->fecpriv_txbuf[fp->fecpriv_current_tx])
  744. {
  745. @@ -977,7 +988,6 @@ void fec_interrupt_fec_rx_handler(struct
  746. struct fec_priv *fp = netdev_priv(dev);
  747. struct sk_buff *skb;
  748. -printk(KERN_INFO "fecrxint\n");
  749. fp->fecpriv_rxflag = 1;
  750. /*
  751. // Some buffers can be missed
  752. @@ -1070,7 +1080,6 @@ irqreturn_t fec_interrupt_handler(int ir
  753. unsigned long base_addr = (unsigned long) dev->base_addr;
  754. unsigned long events;
  755. -printk(KERN_INFO "fecerrint\n");
  756. // Read and clear the events
  757. events = FEC_EIR(base_addr) & FEC_EIMR(base_addr);
  758. @@ -1157,7 +1166,6 @@ void fec_interrupt_fec_reinit(unsigned l
  759. struct fec_priv *fp = netdev_priv(dev);
  760. unsigned long base_addr = (unsigned long) dev->base_addr;
  761. -printk(KERN_INFO "fecreinit\n");
  762. // Initialize reception descriptors and start DMA for the reception
  763. for (i = 0; i < FEC_RX_BUF_NUMBER; i++)
  764. {
  765. --- a/include/asm-m68k/bootinfo.h
  766. +++ b/include/asm-m68k/bootinfo.h
  767. @@ -19,11 +19,59 @@
  768. ** Redesign of the boot information structure; renamed to bootinfo.h again
  769. ** 27/11/96 Geert Uytterhoeven:
  770. ** Backwards compatibility with bootinfo interface version 1.0
  771. +** 12/03/08 Kurt Mahan
  772. +** Copy the bd_info structure from uboot1.3.2/include/asm-m68k/u-boot.h
  773. +** into this file. The original author is Wolfgang Denk,
  774. +** DENX Software Engineering, [email protected].
  775. */
  776. #ifndef _M68K_BOOTINFO_H
  777. #define _M68K_BOOTINFO_H
  778. +#ifndef __ASSEMBLY__
  779. +/*
  780. + * UBoot Support
  781. + *
  782. + * bd_info structure from uboot1.3.2/include/asm-m68k/u-boot.h
  783. + */
  784. +struct bd_info {
  785. + unsigned long bi_memstart; /* start of DRAM memory */
  786. + unsigned long bi_memsize; /* size of DRAM memory in bytes */
  787. + unsigned long bi_flashstart; /* start of FLASH memory */
  788. + unsigned long bi_flashsize; /* size of FLASH memory */
  789. + unsigned long bi_flashoffset; /* reserved area for startup monitor */
  790. + unsigned long bi_sramstart; /* start of SRAM memory */
  791. + unsigned long bi_sramsize; /* size of SRAM memory */
  792. + unsigned long bi_mbar_base; /* base of internal registers */
  793. + unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
  794. + unsigned long bi_boot_params; /* where this board expects params */
  795. + unsigned long bi_ip_addr; /* IP Address */
  796. + unsigned char bi_enet0addr[6]; /* Ethernet 0 mac address */
  797. + unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
  798. + unsigned long bi_intfreq; /* Internal Freq, in MHz */
  799. + unsigned long bi_busfreq; /* Bus Freq, in MHz */
  800. +#ifdef UBOOT_PCI
  801. + unsigned long bi_pcifreq; /* pci Freq in MHz */
  802. +#endif
  803. +#ifdef UBOOT_EXTRA_CLOCK
  804. + unsigned long bi_inpfreq; /* input Freq in MHz */
  805. + unsigned long bi_vcofreq; /* vco Freq in MHz */
  806. + unsigned long bi_flbfreq; /* Flexbus Freq in MHz */
  807. +#endif
  808. + unsigned long bi_baudrate; /* Console Baudrate */
  809. + unsigned char bi_enet1addr[6]; /* eth1 mac address */
  810. + unsigned char bi_enet2addr[6]; /* eth2 mac address */
  811. + unsigned char bi_enet3addr[6]; /* eth3 mac address */
  812. +};
  813. +
  814. +struct uboot_record {
  815. + struct bd_info *bdi;
  816. + unsigned long initrd_start;
  817. + unsigned long initrd_end;
  818. + unsigned long cmd_line_start;
  819. + unsigned long cmd_line_stop;
  820. +};
  821. +#endif /* __ASSEMBLY__ */
  822. /*
  823. * Bootinfo definitions
  824. @@ -49,17 +97,6 @@ struct bi_record {
  825. #endif /* __ASSEMBLY__ */
  826. -#ifndef __ASSEMBLY__
  827. -
  828. -struct uboot_record {
  829. - unsigned long bd_info;
  830. - unsigned long initrd_start;
  831. - unsigned long initrd_end;
  832. - unsigned long cmd_line_start;
  833. - unsigned long cmd_line_stop;
  834. -};
  835. -
  836. -#endif /* __ASSEMBLY__ */
  837. /*
  838. --- a/include/asm-m68k/cf_cacheflush.h
  839. +++ b/include/asm-m68k/cf_cacheflush.h
  840. @@ -1,335 +1,92 @@
  841. -/*
  842. - * include/asm-m68k/cf_cacheflush.h - Coldfire Cache
  843. - *
  844. - * Based on include/asm-m68k/cacheflush.h
  845. - *
  846. - * Coldfire pieces by:
  847. - * Kurt Mahan [email protected]
  848. - *
  849. - * Copyright Freescale Semiconductor, Inc. 2007
  850. - *
  851. - * This program is free software; you can redistribute it and/or modify it
  852. - * under the terms of the GNU General Public License as published by the
  853. - * Free Software Foundation; either version 2 of the License, or (at your
  854. - * option) any later version.
  855. - */
  856. #ifndef M68K_CF_CACHEFLUSH_H
  857. #define M68K_CF_CACHEFLUSH_H
  858. #include <asm/cfcache.h>
  859. -
  860. /*
  861. - * Coldfire Cache Model
  862. - *
  863. - * The Coldfire processors use a Harvard architecture cache configured
  864. - * as four-way set associative. The cache does not implement bus snooping
  865. - * so cache coherency with other masters must be maintained in software.
  866. - *
  867. - * The cache is managed via the CPUSHL instruction in conjunction with
  868. - * bits set in the CACR (cache control register). Currently the code
  869. - * uses the CPUSHL enhancement which adds the ability to
  870. - * invalidate/clear/push a cacheline by physical address. This feature
  871. - * is designated in the Hardware Configuration Register [D1-CPES].
  872. - *
  873. - * CACR Bits:
  874. - * DPI[28] cpushl invalidate disable for d-cache
  875. - * IDPI[12] cpushl invalidate disable for i-cache
  876. - * SPA[14] cpushl search by physical address
  877. - * IVO[20] cpushl invalidate only
  878. - *
  879. - * Random Terminology:
  880. - * * invalidate = reset the cache line's valid bit
  881. - * * push = generate a line-sized store of the data if its contents are marked
  882. - * as modifed (the modified flag is cleared after the store)
  883. - * * clear = push + invalidate
  884. - */
  885. -
  886. -/**
  887. - * flush_icache - Flush all of the instruction cache
  888. - */
  889. -static inline void flush_icache(void)
  890. -{
  891. - asm volatile("nop\n"
  892. - "moveq%.l #0,%%d0\n"
  893. - "moveq%.l #0,%%d1\n"
  894. - "move%.l %%d0,%%a0\n"
  895. - "1:\n"
  896. - "cpushl %%ic,(%%a0)\n"
  897. - "add%.l #0x0010,%%a0\n"
  898. - "addq%.l #1,%%d1\n"
  899. - "cmpi%.l %0,%%d1\n"
  900. - "bne 1b\n"
  901. - "moveq%.l #0,%%d1\n"
  902. - "addq%.l #1,%%d0\n"
  903. - "move%.l %%d0,%%a0\n"
  904. - "cmpi%.l #4,%%d0\n"
  905. - "bne 1b\n"
  906. - : : "i" (CACHE_SETS)
  907. - : "a0", "d0", "d1");
  908. -}
  909. -
  910. -/**
  911. - * flush_dcache - Flush all of the data cache
  912. - */
  913. -static inline void flush_dcache(void)
  914. -{
  915. - asm volatile("nop\n"
  916. - "moveq%.l #0,%%d0\n"
  917. - "moveq%.l #0,%%d1\n"
  918. - "move%.l %%d0,%%a0\n"
  919. - "1:\n"
  920. - "cpushl %%dc,(%%a0)\n"
  921. - "add%.l #0x0010,%%a0\n"
  922. - "addq%.l #1,%%d1\n"
  923. - "cmpi%.l %0,%%d1\n"
  924. - "bne 1b\n"
  925. - "moveq%.l #0,%%d1\n"
  926. - "addq%.l #1,%%d0\n"
  927. - "move%.l %%d0,%%a0\n"
  928. - "cmpi%.l #4,%%d0\n"
  929. - "bne 1b\n"
  930. - : : "i" (CACHE_SETS)
  931. - : "a0", "d0", "d1");
  932. -}
  933. -
  934. -/**
  935. - * flush_bcache - Flush all of both caches
  936. + * Cache handling functions
  937. */
  938. -static inline void flush_bcache(void)
  939. -{
  940. - asm volatile("nop\n"
  941. - "moveq%.l #0,%%d0\n"
  942. - "moveq%.l #0,%%d1\n"
  943. - "move%.l %%d0,%%a0\n"
  944. - "1:\n"
  945. - "cpushl %%bc,(%%a0)\n"
  946. - "add%.l #0x0010,%%a0\n"
  947. - "addq%.l #1,%%d1\n"
  948. - "cmpi%.l %0,%%d1\n"
  949. - "bne 1b\n"
  950. - "moveq%.l #0,%%d1\n"
  951. - "addq%.l #1,%%d0\n"
  952. - "move%.l %%d0,%%a0\n"
  953. - "cmpi%.l #4,%%d0\n"
  954. - "bne 1b\n"
  955. - : : "i" (CACHE_SETS)
  956. - : "a0", "d0", "d1");
  957. -}
  958. -/**
  959. - * cf_cache_clear - invalidate cache
  960. - * @paddr: starting physical address
  961. - * @len: number of bytes
  962. - *
  963. - * Invalidate cache lines starting at paddr for len bytes.
  964. - * Those lines are not pushed.
  965. - */
  966. -static inline void cf_cache_clear(unsigned long paddr, int len)
  967. -{
  968. - /* number of lines */
  969. - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
  970. - if (len == 0)
  971. - return;
  972. -
  973. - /* align on set boundary */
  974. - paddr &= 0xfffffff0;
  975. -
  976. - asm volatile("nop\n"
  977. - "move%.l %2,%%d0\n"
  978. - "or%.l %3,%%d0\n"
  979. - "movec %%d0,%%cacr\n"
  980. - "move%.l %0,%%a0\n"
  981. - "move%.l %1,%%d0\n"
  982. - "1:\n"
  983. - "cpushl %%bc,(%%a0)\n"
  984. - "lea 0x10(%%a0),%%a0\n"
  985. - "subq%.l #1,%%d0\n"
  986. - "bne%.b 1b\n"
  987. - "movec %2,%%cacr\n"
  988. - : : "a" (paddr), "r" (len),
  989. - "r" (shadow_cacr),
  990. - "i" (CF_CACR_SPA+CF_CACR_IVO)
  991. - : "a0", "d0");
  992. -}
  993. -
  994. -/**
  995. - * cf_cache_push - Push dirty cache out with no invalidate
  996. - * @paddr: starting physical address
  997. - * @len: number of bytes
  998. - *
  999. - * Push the any dirty lines starting at paddr for len bytes.
  1000. - * Those lines are not invalidated.
  1001. - */
  1002. -static inline void cf_cache_push(unsigned long paddr, int len)
  1003. -{
  1004. - /* number of lines */
  1005. - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
  1006. - if (len == 0)
  1007. - return;
  1008. -
  1009. - /* align on set boundary */
  1010. - paddr &= 0xfffffff0;
  1011. -
  1012. - asm volatile("nop\n"
  1013. - "move%.l %2,%%d0\n"
  1014. - "or%.l %3,%%d0\n"
  1015. - "movec %%d0,%%cacr\n"
  1016. - "move%.l %0,%%a0\n"
  1017. - "move%.l %1,%%d0\n"
  1018. - "1:\n"
  1019. - "cpushl %%bc,(%%a0)\n"
  1020. - "lea 0x10(%%a0),%%a0\n"
  1021. - "subq%.l #1,%%d0\n"
  1022. - "bne.b 1b\n"
  1023. - "movec %2,%%cacr\n"
  1024. - : : "a" (paddr), "r" (len),
  1025. - "r" (shadow_cacr),
  1026. - "i" (CF_CACR_SPA+CF_CACR_DPI+CF_CACR_IDPI)
  1027. - : "a0", "d0");
  1028. -}
  1029. +#define flush_icache() \
  1030. +({ \
  1031. + unsigned long set; \
  1032. + unsigned long start_set; \
  1033. + unsigned long end_set; \
  1034. + \
  1035. + start_set = 0; \
  1036. + end_set = (unsigned long)LAST_DCACHE_ADDR; \
  1037. + \
  1038. + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
  1039. + asm volatile("cpushl %%ic,(%0)\n" \
  1040. + "\taddq%.l #1,%0\n" \
  1041. + "\tcpushl %%ic,(%0)\n" \
  1042. + "\taddq%.l #1,%0\n" \
  1043. + "\tcpushl %%ic,(%0)\n" \
  1044. + "\taddq%.l #1,%0\n" \
  1045. + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set)); \
  1046. + } \
  1047. +})
  1048. +
  1049. +#define flush_dcache() \
  1050. +({ \
  1051. + unsigned long set; \
  1052. + unsigned long start_set; \
  1053. + unsigned long end_set; \
  1054. + \
  1055. + start_set = 0; \
  1056. + end_set = (unsigned long)LAST_DCACHE_ADDR; \
  1057. + \
  1058. + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
  1059. + asm volatile("cpushl %%dc,(%0)\n" \
  1060. + "\taddq%.l #1,%0\n" \
  1061. + "\tcpushl %%dc,(%0)\n" \
  1062. + "\taddq%.l #1,%0\n" \
  1063. + "\tcpushl %%dc,(%0)\n" \
  1064. + "\taddq%.l #1,%0\n" \
  1065. + "\tcpushl %%dc,(%0)" : "=a" (set) : "a" (set)); \
  1066. + } \
  1067. +})
  1068. +
  1069. +#define flush_bcache() \
  1070. +({ \
  1071. + unsigned long set; \
  1072. + unsigned long start_set; \
  1073. + unsigned long end_set; \
  1074. + \
  1075. + start_set = 0; \
  1076. + end_set = (unsigned long)LAST_DCACHE_ADDR; \
  1077. + \
  1078. + for (set = start_set; set <= end_set; set += (0x10 - 3)) { \
  1079. + asm volatile("cpushl %%bc,(%0)\n" \
  1080. + "\taddq%.l #1,%0\n" \
  1081. + "\tcpushl %%bc,(%0)\n" \
  1082. + "\taddq%.l #1,%0\n" \
  1083. + "\tcpushl %%bc,(%0)\n" \
  1084. + "\taddq%.l #1,%0\n" \
  1085. + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set)); \
  1086. + } \
  1087. +})
  1088. -/**
  1089. - * cf_cache_flush - Push dirty cache out and invalidate
  1090. - * @paddr: starting physical address
  1091. - * @len: number of bytes
  1092. - *
  1093. - * Push the any dirty lines starting at paddr for len bytes and
  1094. - * invalidate those lines.
  1095. +/*
  1096. + * invalidate the cache for the specified memory range.
  1097. + * It starts at the physical address specified for
  1098. + * the given number of bytes.
  1099. */
  1100. -static inline void cf_cache_flush(unsigned long paddr, int len)
  1101. -{
  1102. - /* number of lines */
  1103. - len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
  1104. - if (len == 0)
  1105. - return;
  1106. -
  1107. - /* align on set boundary */
  1108. - paddr &= 0xfffffff0;
  1109. -
  1110. - asm volatile("nop\n"
  1111. - "move%.l %2,%%d0\n"
  1112. - "or%.l %3,%%d0\n"
  1113. - "movec %%d0,%%cacr\n"
  1114. - "move%.l %0,%%a0\n"
  1115. - "move%.l %1,%%d0\n"
  1116. - "1:\n"
  1117. - "cpushl %%bc,(%%a0)\n"
  1118. - "lea 0x10(%%a0),%%a0\n"
  1119. - "subq%.l #1,%%d0\n"
  1120. - "bne.b 1b\n"
  1121. - "movec %2,%%cacr\n"
  1122. - : : "a" (paddr), "r" (len),
  1123. - "r" (shadow_cacr),
  1124. - "i" (CF_CACR_SPA)
  1125. - : "a0", "d0");
  1126. -}
  1127. -
  1128. -/**
  1129. - * cf_cache_flush_range - Push dirty data/inst cache in range out and invalidate
  1130. - * @vstart - starting virtual address
  1131. - * @vend: ending virtual address
  1132. - *
  1133. - * Push the any dirty data/instr lines starting at paddr for len bytes and
  1134. - * invalidate those lines.
  1135. +extern void cache_clear(unsigned long paddr, int len);
  1136. +/*
  1137. + * push any dirty cache in the specified memory range.
  1138. + * It starts at the physical address specified for
  1139. + * the given number of bytes.
  1140. */
  1141. -static inline void cf_cache_flush_range(unsigned long vstart, unsigned long vend)
  1142. -{
  1143. - int len;
  1144. -
  1145. - /* align on set boundary */
  1146. - vstart &= 0xfffffff0;
  1147. - vend = PAGE_ALIGN((vend + (CACHE_LINE_SIZE-1))) & 0xfffffff0;
  1148. - len = vend - vstart;
  1149. - if (len == 0)
  1150. - return;
  1151. - vstart = __pa(vstart);
  1152. - vend = vstart + len;
  1153. -
  1154. - asm volatile("nop\n"
  1155. - "move%.l %2,%%d0\n"
  1156. - "or%.l %3,%%d0\n"
  1157. - "movec %%d0,%%cacr\n"
  1158. - "move%.l %0,%%a0\n"
  1159. - "move%.l %1,%%a1\n"
  1160. - "1:\n"
  1161. - "cpushl %%bc,(%%a0)\n"
  1162. - "lea 0x10(%%a0),%%a0\n"
  1163. - "cmpa%.l %%a0,%%a1\n"
  1164. - "bne.b 1b\n"
  1165. - "movec %2,%%cacr\n"
  1166. - : /* no return */
  1167. - : "a" (vstart), "a" (vend),
  1168. - "r" (shadow_cacr),
  1169. - "i" (CF_CACR_SPA)
  1170. - : "a0", "a1", "d0");
  1171. -}
  1172. +extern void cache_push(unsigned long paddr, int len);
  1173. -/**
  1174. - * cf_dcache_flush_range - Push dirty data cache in range out and invalidate
  1175. - * @vstart - starting virtual address
  1176. - * @vend: ending virtual address
  1177. - *
  1178. - * Push the any dirty data lines starting at paddr for len bytes and
  1179. - * invalidate those lines.
  1180. +/*
  1181. + * push and invalidate pages in the specified user virtual
  1182. + * memory range.
  1183. */
  1184. -static inline void cf_dcache_flush_range(unsigned long vstart, unsigned long vend)
  1185. -{
  1186. - /* align on set boundary */
  1187. - vstart &= 0xfffffff0;
  1188. - vend = (vend + (CACHE_LINE_SIZE-1)) & 0xfffffff0;
  1189. -
  1190. - asm volatile("nop\n"
  1191. - "move%.l %2,%%d0\n"
  1192. - "or%.l %3,%%d0\n"
  1193. - "movec %%d0,%%cacr\n"
  1194. - "move%.l %0,%%a0\n"
  1195. - "move%.l %1,%%a1\n"
  1196. - "1:\n"
  1197. - "cpushl %%dc,(%%a0)\n"
  1198. - "lea 0x10(%%a0),%%a0\n"
  1199. - "cmpa%.l %%a0,%%a1\n"
  1200. - "bne.b 1b\n"
  1201. - "movec %2,%%cacr\n"
  1202. - : /* no return */
  1203. - : "a" (__pa(vstart)), "a" (__pa(vend)),
  1204. - "r" (shadow_cacr),
  1205. - "i" (CF_CACR_SPA)
  1206. - : "a0", "a1", "d0");
  1207. -}
  1208. +extern void cache_push_v(unsigned long vaddr, int len);
  1209. -/**
  1210. - * cf_icache_flush_range - Push dirty inst cache in range out and invalidate
  1211. - * @vstart - starting virtual address
  1212. - * @vend: ending virtual address
  1213. - *
  1214. - * Push the any dirty instr lines starting at paddr for len bytes and
  1215. - * invalidate those lines. This should just be an invalidate since you
  1216. - * shouldn't be able to have dirty instruction cache.
  1217. - */
  1218. -static inline void cf_icache_flush_range(unsigned long vstart, unsigned long vend)
  1219. -{
  1220. - /* align on set boundary */
  1221. - vstart &= 0xfffffff0;
  1222. - vend = (vend + (CACHE_LINE_SIZE-1)) & 0xfffffff0;
  1223. -
  1224. - asm volatile("nop\n"
  1225. - "move%.l %2,%%d0\n"
  1226. - "or%.l %3,%%d0\n"
  1227. - "movec %%d0,%%cacr\n"
  1228. - "move%.l %0,%%a0\n"
  1229. - "move%.l %1,%%a1\n"
  1230. - "1:\n"
  1231. - "cpushl %%ic,(%%a0)\n"
  1232. - "lea 0x10(%%a0),%%a0\n"
  1233. - "cmpa%.l %%a0,%%a1\n"
  1234. - "bne.b 1b\n"
  1235. - "movec %2,%%cacr\n"
  1236. - : /* no return */
  1237. - : "a" (__pa(vstart)), "a" (__pa(vend)),
  1238. - "r" (shadow_cacr),
  1239. - "i" (CF_CACR_SPA)
  1240. - : "a0", "a1", "d0");
  1241. -}
  1242. +/* This is needed whenever the virtual mapping of the current
  1243. + process changes. */
  1244. /**
  1245. * flush_cache_mm - Flush an mm_struct
  1246. @@ -343,6 +100,8 @@ static inline void flush_cache_mm(struct
  1247. #define flush_cache_dup_mm(mm) flush_cache_mm(mm)
  1248. +#define flush_cache_all() flush_bcache()
  1249. +
  1250. /**
  1251. * flush_cache_range - Flush a cache range
  1252. * @vma: vma struct
  1253. @@ -356,7 +115,8 @@ static inline void flush_cache_range(str
  1254. unsigned long start, unsigned long end)
  1255. {
  1256. if (vma->vm_mm == current->mm)
  1257. - cf_cache_flush_range(start, end);
  1258. + flush_bcache();
  1259. +// cf_cache_flush_range(start, end);
  1260. }
  1261. /**
  1262. @@ -372,76 +132,113 @@ static inline void flush_cache_page(stru
  1263. unsigned long vmaddr, unsigned long pfn)
  1264. {
  1265. if (vma->vm_mm == current->mm)
  1266. - cf_cache_flush_range(vmaddr, vmaddr+PAGE_SIZE);
  1267. + flush_bcache();
  1268. +// cf_cache_flush_range(vmaddr, vmaddr+PAGE_SIZE);
  1269. }
  1270. -/**
  1271. - * __flush_page_to_ram - Push a page out of the cache
  1272. - * @vaddr: Virtual address at start of page
  1273. - *
  1274. - * Push the page at kernel virtual address *vaddr* and clear
  1275. - * the icache.
  1276. - */
  1277. -static inline void __flush_page_to_ram(void *vaddr)
  1278. -{
  1279. - asm volatile("nop\n"
  1280. - "move%.l %2,%%d0\n"
  1281. - "or%.l %3,%%d0\n"
  1282. - "movec %%d0,%%cacr\n"
  1283. - "move%.l %0,%%d0\n"
  1284. - "and%.l #0xfffffff0,%%d0\n"
  1285. - "move%.l %%d0,%%a0\n"
  1286. - "move%.l %1,%%d0\n"
  1287. - "1:\n"
  1288. - "cpushl %%bc,(%%a0)\n"
  1289. - "lea 0x10(%%a0),%%a0\n"
  1290. - "subq%.l #1,%%d0\n"
  1291. - "bne.b 1b\n"
  1292. - "movec %2,%%cacr\n"
  1293. - : : "a" (__pa(vaddr)), "i" (PAGE_SIZE / CACHE_LINE_SIZE),
  1294. - "r" (shadow_cacr), "i" (CF_CACR_SPA)
  1295. - : "a0", "d0");
  1296. +/* Push the page at kernel virtual address and clear the icache */
  1297. +/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
  1298. +#define flush_page_to_ram(page) __flush_page_to_ram((void *) page_address(page))
  1299. +extern inline void __flush_page_to_ram(void *address)
  1300. +{
  1301. + unsigned long set;
  1302. + unsigned long start_set;
  1303. + unsigned long end_set;
  1304. + unsigned long addr = (unsigned long) address;
  1305. +
  1306. + addr &= ~(PAGE_SIZE - 1); /* round down to page start address */
  1307. +
  1308. + start_set = addr & _ICACHE_SET_MASK;
  1309. + end_set = (addr + PAGE_SIZE-1) & _ICACHE_SET_MASK;
  1310. +
  1311. + if (start_set > end_set) {
  1312. + /* from the begining to the lowest address */
  1313. + for (set = 0; set <= end_set; set += (0x10 - 3)) {
  1314. + asm volatile("cpushl %%bc,(%0)\n"
  1315. + "\taddq%.l #1,%0\n"
  1316. + "\tcpushl %%bc,(%0)\n"
  1317. + "\taddq%.l #1,%0\n"
  1318. + "\tcpushl %%bc,(%0)\n"
  1319. + "\taddq%.l #1,%0\n"
  1320. + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set));
  1321. + }
  1322. + /* next loop will finish the cache ie pass the hole */
  1323. + end_set = LAST_ICACHE_ADDR;
  1324. + }
  1325. + for (set = start_set; set <= end_set; set += (0x10 - 3)) {
  1326. + asm volatile("cpushl %%bc,(%0)\n"
  1327. + "\taddq%.l #1,%0\n"
  1328. + "\tcpushl %%bc,(%0)\n"
  1329. + "\taddq%.l #1,%0\n"
  1330. + "\tcpushl %%bc,(%0)\n"
  1331. + "\taddq%.l #1,%0\n"
  1332. + "\tcpushl %%bc,(%0)" : "=a" (set) : "a" (set));
  1333. + }
  1334. +}
  1335. +
  1336. +/* Use __flush_page_to_ram() for flush_dcache_page all values are same - MW */
  1337. +#define flush_dcache_page(page) \
  1338. + __flush_page_to_ram((void *) page_address(page))
  1339. +#define flush_icache_page(vma,pg) \
  1340. + __flush_page_to_ram((void *) page_address(pg))
  1341. +#define flush_icache_user_range(adr,len) do { } while (0)
  1342. +/* NL */
  1343. +#define flush_icache_user_page(vma,page,addr,len) do { } while (0)
  1344. +
  1345. +/* Push n pages at kernel virtual address and clear the icache */
  1346. +/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
  1347. +extern inline void flush_icache_range (unsigned long address,
  1348. + unsigned long endaddr)
  1349. +{
  1350. + unsigned long set;
  1351. + unsigned long start_set;
  1352. + unsigned long end_set;
  1353. +
  1354. + start_set = address & _ICACHE_SET_MASK;
  1355. + end_set = endaddr & _ICACHE_SET_MASK;
  1356. +
  1357. + if (start_set > end_set) {
  1358. + /* from the begining to the lowest address */
  1359. + for (set = 0; set <= end_set; set += (0x10 - 3)) {
  1360. + asm volatile("cpushl %%ic,(%0)\n"
  1361. + "\taddq%.l #1,%0\n"
  1362. + "\tcpushl %%ic,(%0)\n"
  1363. + "\taddq%.l #1,%0\n"
  1364. + "\tcpushl %%ic,(%0)\n"
  1365. + "\taddq%.l #1,%0\n"
  1366. + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set));
  1367. + }
  1368. + /* next loop will finish the cache ie pass the hole */
  1369. + end_set = LAST_ICACHE_ADDR;
  1370. + }
  1371. + for (set = start_set; set <= end_set; set += (0x10 - 3)) {
  1372. + asm volatile("cpushl %%ic,(%0)\n"
  1373. + "\taddq%.l #1,%0\n"
  1374. + "\tcpushl %%ic,(%0)\n"
  1375. + "\taddq%.l #1,%0\n"
  1376. + "\tcpushl %%ic,(%0)\n"
  1377. + "\taddq%.l #1,%0\n"
  1378. + "\tcpushl %%ic,(%0)" : "=a" (set) : "a" (set));
  1379. + }
  1380. }
  1381. -/*
  1382. - * Various defines for the kernel.
  1383. - */
  1384. -
  1385. -extern void cache_clear(unsigned long paddr, int len);
  1386. -extern void cache_push(unsigned long paddr, int len);
  1387. -extern void flush_icache_range(unsigned long address, unsigned long endaddr);
  1388. -
  1389. -#define flush_cache_all() flush_bcache()
  1390. -#define flush_cache_vmap(start, end) flush_bcache()
  1391. -#define flush_cache_vunmap(start, end) flush_bcache()
  1392. -
  1393. -#define flush_dcache_range(vstart, vend) cf_dcache_flush_range(vstart, vend)
  1394. -#define flush_dcache_page(page) __flush_page_to_ram(page_address(page))
  1395. -#define flush_dcache_mmap_lock(mapping) do { } while (0)
  1396. -#define flush_dcache_mmap_unlock(mapping) do { } while (0)
  1397. -
  1398. -#define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page))
  1399. -
  1400. -/**
  1401. - * copy_to_user_page - Copy memory to user page
  1402. - */
  1403. static inline void copy_to_user_page(struct vm_area_struct *vma,
  1404. struct page *page, unsigned long vaddr,
  1405. void *dst, void *src, int len)
  1406. {
  1407. memcpy(dst, src, len);
  1408. - cf_cache_flush(page_to_phys(page), PAGE_SIZE);
  1409. + flush_icache_user_page(vma, page, vaddr, len);
  1410. }
  1411. -
  1412. -/**
  1413. - * copy_from_user_page - Copy memory from user page
  1414. - */
  1415. static inline void copy_from_user_page(struct vm_area_struct *vma,
  1416. struct page *page, unsigned long vaddr,
  1417. void *dst, void *src, int len)
  1418. {
  1419. - cf_cache_flush(page_to_phys(page), PAGE_SIZE);
  1420. memcpy(dst, src, len);
  1421. }
  1422. +#define flush_cache_vmap(start, end) flush_cache_all()
  1423. +#define flush_cache_vunmap(start, end) flush_cache_all()
  1424. +#define flush_dcache_mmap_lock(mapping) do { } while (0)
  1425. +#define flush_dcache_mmap_unlock(mapping) do { } while (0)
  1426. +
  1427. #endif /* M68K_CF_CACHEFLUSH_H */
  1428. --- a/include/asm-m68k/cf_pgalloc.h
  1429. +++ b/include/asm-m68k/cf_pgalloc.h
  1430. @@ -1,13 +1,9 @@
  1431. #ifndef M68K_CF_PGALLOC_H
  1432. #define M68K_CF_PGALLOC_H
  1433. -/* JKM -- added -- needed? */
  1434. -#include <linux/highmem.h>
  1435. -
  1436. #include <asm/coldfire.h>
  1437. #include <asm/page.h>
  1438. #include <asm/cf_tlbflush.h>
  1439. -/* JKM -- added -- needed? */
  1440. #include <asm/cf_cacheflush.h>
  1441. extern inline void pte_free_kernel(pte_t *pte)
  1442. @@ -41,6 +37,7 @@ extern inline pmd_t *pmd_alloc_kernel(pg
  1443. #define pmd_populate(mm, pmd, page) (pmd_val(*pmd) = \
  1444. (unsigned long)(page_address(page)))
  1445. +
  1446. #define pmd_populate_kernel(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
  1447. static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page)
  1448. --- a/include/asm-m68k/cf_pgtable.h
  1449. +++ b/include/asm-m68k/cf_pgtable.h
  1450. @@ -341,7 +341,7 @@ static inline pte_t pgoff_to_pte(unsigne
  1451. #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  1452. #define __swp_entry_to_pte(x) (__pte((x).val))
  1453. -#define pmd_page(pmd) virt_to_page(__pmd_page(pmd))
  1454. +#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
  1455. #define pte_offset_map(pmdp, address) ((pte_t *)__pmd_page(*pmdp) + \
  1456. __pte_offset(address))
  1457. --- a/include/asm-m68k/cfcache.h
  1458. +++ b/include/asm-m68k/cfcache.h
  1459. @@ -87,6 +87,12 @@
  1460. #define CACHE_SETS 0x0200 /* 512 sets */
  1461. #define CACHE_WAYS 0x0004 /* 4 way */
  1462. +/* in for the old cpushl caching code */
  1463. +#define _DCACHE_SET_MASK ((DCACHE_SIZE/64-1)<<CACHE_WAYS)
  1464. +#define _ICACHE_SET_MASK ((ICACHE_SIZE/64-1)<<CACHE_WAYS)
  1465. +#define LAST_DCACHE_ADDR _DCACHE_SET_MASK
  1466. +#define LAST_ICACHE_ADDR _ICACHE_SET_MASK
  1467. +
  1468. #define CACHE_DISABLE_MODE (CF_CACR_DCINVA+ \
  1469. CF_CACR_BCINVA+ \
  1470. CF_CACR_ICINVA)
  1471. --- a/include/asm-m68k/page.h
  1472. +++ b/include/asm-m68k/page.h
  1473. @@ -123,13 +123,21 @@ extern unsigned long m68k_memoffset;
  1474. #if defined(CONFIG_COLDFIRE)
  1475. static inline unsigned long ___pa(void *vaddr)
  1476. {
  1477. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  1478. return (((unsigned long)vaddr & 0x0fffffff) + CONFIG_SDRAM_BASE);
  1479. +#else
  1480. + return (unsigned long)vaddr;
  1481. +#endif
  1482. }
  1483. #define __pa(vaddr) ___pa((void *)(vaddr))
  1484. static inline void *__va(unsigned long paddr)
  1485. {
  1486. +#if CONFIG_SDRAM_BASE != PAGE_OFFSET
  1487. return (void *)((paddr & 0x0fffffff) + PAGE_OFFSET);
  1488. +#else
  1489. + return (void *)paddr;
  1490. +#endif
  1491. }
  1492. #else
  1493. --- a/include/asm-m68k/page_offset.h
  1494. +++ b/include/asm-m68k/page_offset.h
  1495. @@ -1,16 +1,15 @@
  1496. +/*
  1497. + * Page and physical memory maps.
  1498. + */
  1499. +#if defined(CONFIG_SUN3)
  1500. +#define PAGE_OFFSET_RAW 0x0E000000
  1501. +
  1502. +#elif defined(CONFIG_M54455) || defined(CONFIG_M547X_8X)
  1503. +#define PHYS_OFFSET CONFIG_SDRAM_BASE
  1504. +#define PAGE_OFFSET_RAW (PHYS_OFFSET)
  1505. +/* #define PAGE_OFFSET_RAW 0xC0000000 */
  1506. -/* This handles the memory map.. */
  1507. -#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
  1508. +#else
  1509. +/* default */
  1510. #define PAGE_OFFSET_RAW 0x00000000
  1511. -#elif defined(CONFIG_SUN3)
  1512. -#define PAGE_OFFSET_RAW 0x0E000000
  1513. -#else /* CONFIG_COLDFIRE */
  1514. -#if defined(CONFIG_M54455)
  1515. -#define PAGE_OFFSET_RAW 0xC0000000
  1516. -#define PHYS_OFFSET 0x40000000
  1517. -#elif defined(CONFIG_M547X_8X)
  1518. -#define PAGE_OFFSET_RAW 0xC0000000
  1519. -#define PHYS_OFFSET 0x00000000
  1520. #endif
  1521. -#endif
  1522. -