chestnut.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /*
  2. * arch/ppc/platforms/chestnut.c
  3. *
  4. * Board setup routines for IBM Chestnut
  5. *
  6. * Author: <source@mvista.com>
  7. *
  8. * <2004> (c) MontaVista Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. #include <linux/config.h>
  14. #include <linux/stddef.h>
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/errno.h>
  18. #include <linux/reboot.h>
  19. #include <linux/kdev_t.h>
  20. #include <linux/major.h>
  21. #include <linux/blkdev.h>
  22. #include <linux/console.h>
  23. #include <linux/root_dev.h>
  24. #include <linux/initrd.h>
  25. #include <linux/delay.h>
  26. #include <linux/seq_file.h>
  27. #include <linux/ide.h>
  28. #include <linux/serial.h>
  29. #include <linux/serial_core.h>
  30. #include <linux/mtd/physmap.h>
  31. #include <asm/system.h>
  32. #include <asm/pgtable.h>
  33. #include <asm/page.h>
  34. #include <asm/time.h>
  35. #include <asm/dma.h>
  36. #include <asm/io.h>
  37. #include <linux/irq.h>
  38. #include <asm/hw_irq.h>
  39. #include <asm/machdep.h>
  40. #include <asm/kgdb.h>
  41. #include <asm/bootinfo.h>
  42. #include <asm/mv64x60.h>
  43. #include <platforms/chestnut.h>
  44. static void __iomem *sram_base; /* Virtual addr of Internal SRAM */
  45. static void __iomem *cpld_base; /* Virtual addr of CPLD Regs */
  46. static mv64x60_handle_t bh;
  47. extern void gen550_progress(char *, unsigned short);
  48. extern void gen550_init(int, struct uart_port *);
  49. extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh);
  50. #define BIT(x) (1<<x)
  51. #define CHESTNUT_PRESERVE_MASK (BIT(MV64x60_CPU2DEV_0_WIN) | \
  52. BIT(MV64x60_CPU2DEV_1_WIN) | \
  53. BIT(MV64x60_CPU2DEV_2_WIN) | \
  54. BIT(MV64x60_CPU2DEV_3_WIN) | \
  55. BIT(MV64x60_CPU2BOOT_WIN))
  56. /**************************************************************************
  57. * FUNCTION: chestnut_calibrate_decr
  58. *
  59. * DESCRIPTION: initialize decrementer interrupt frequency (used as system
  60. * timer)
  61. *
  62. ****/
  63. static void __init
  64. chestnut_calibrate_decr(void)
  65. {
  66. ulong freq;
  67. freq = CHESTNUT_BUS_SPEED / 4;
  68. printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
  69. freq/1000000, freq%1000000);
  70. tb_ticks_per_jiffy = freq / HZ;
  71. tb_to_us = mulhwu_scale_factor(freq, 1000000);
  72. }
  73. static int
  74. chestnut_show_cpuinfo(struct seq_file *m)
  75. {
  76. seq_printf(m, "vendor\t\t: IBM\n");
  77. seq_printf(m, "machine\t\t: 750FX/GX Eval Board (Chestnut/Buckeye)\n");
  78. return 0;
  79. }
  80. /**************************************************************************
  81. * FUNCTION: chestnut_find_end_of_memory
  82. *
  83. * DESCRIPTION: ppc_md memory size callback
  84. *
  85. ****/
  86. unsigned long __init
  87. chestnut_find_end_of_memory(void)
  88. {
  89. static int mem_size = 0;
  90. if (mem_size == 0) {
  91. mem_size = mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
  92. MV64x60_TYPE_MV64460);
  93. }
  94. return mem_size;
  95. }
  96. #if defined(CONFIG_SERIAL_8250)
  97. static void __init
  98. chestnut_early_serial_map(void)
  99. {
  100. struct uart_port port;
  101. /* Setup serial port access */
  102. memset(&port, 0, sizeof(port));
  103. port.uartclk = BASE_BAUD * 16;
  104. port.irq = UART0_INT;
  105. port.flags = STD_COM_FLAGS | UPF_IOREMAP;
  106. port.iotype = SERIAL_IO_MEM;
  107. port.mapbase = CHESTNUT_UART0_IO_BASE;
  108. port.regshift = 0;
  109. if (early_serial_setup(&port) != 0)
  110. printk("Early serial init of port 0 failed\n");
  111. /* Assume early_serial_setup() doesn't modify serial_req */
  112. port.line = 1;
  113. port.irq = UART1_INT;
  114. port.mapbase = CHESTNUT_UART1_IO_BASE;
  115. if (early_serial_setup(&port) != 0)
  116. printk("Early serial init of port 1 failed\n");
  117. }
  118. #endif
  119. /**************************************************************************
  120. * FUNCTION: chestnut_map_irq
  121. *
  122. * DESCRIPTION: 0 return since PCI IRQs not needed
  123. *
  124. ****/
  125. static int __init
  126. chestnut_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  127. {
  128. static char pci_irq_table[][4] = {
  129. {CHESTNUT_PCI_SLOT0_IRQ, CHESTNUT_PCI_SLOT0_IRQ,
  130. CHESTNUT_PCI_SLOT0_IRQ, CHESTNUT_PCI_SLOT0_IRQ},
  131. {CHESTNUT_PCI_SLOT1_IRQ, CHESTNUT_PCI_SLOT1_IRQ,
  132. CHESTNUT_PCI_SLOT1_IRQ, CHESTNUT_PCI_SLOT1_IRQ},
  133. {CHESTNUT_PCI_SLOT2_IRQ, CHESTNUT_PCI_SLOT2_IRQ,
  134. CHESTNUT_PCI_SLOT2_IRQ, CHESTNUT_PCI_SLOT2_IRQ},
  135. {CHESTNUT_PCI_SLOT3_IRQ, CHESTNUT_PCI_SLOT3_IRQ,
  136. CHESTNUT_PCI_SLOT3_IRQ, CHESTNUT_PCI_SLOT3_IRQ},
  137. };
  138. const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
  139. return PCI_IRQ_TABLE_LOOKUP;
  140. }
  141. /**************************************************************************
  142. * FUNCTION: chestnut_setup_bridge
  143. *
  144. * DESCRIPTION: initalize board-specific settings on the MV64360
  145. *
  146. ****/
  147. static void __init
  148. chestnut_setup_bridge(void)
  149. {
  150. struct mv64x60_setup_info si;
  151. int i;
  152. if ( ppc_md.progress )
  153. ppc_md.progress("chestnut_setup_bridge: enter", 0);
  154. memset(&si, 0, sizeof(si));
  155. si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
  156. /* setup only PCI bus 0 (bus 1 not used) */
  157. si.pci_0.enable_bus = 1;
  158. si.pci_0.pci_io.cpu_base = CHESTNUT_PCI0_IO_PROC_ADDR;
  159. si.pci_0.pci_io.pci_base_hi = 0;
  160. si.pci_0.pci_io.pci_base_lo = CHESTNUT_PCI0_IO_PCI_ADDR;
  161. si.pci_0.pci_io.size = CHESTNUT_PCI0_IO_SIZE;
  162. si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE; /* no swapping */
  163. si.pci_0.pci_mem[0].cpu_base = CHESTNUT_PCI0_MEM_PROC_ADDR;
  164. si.pci_0.pci_mem[0].pci_base_hi = CHESTNUT_PCI0_MEM_PCI_HI_ADDR;
  165. si.pci_0.pci_mem[0].pci_base_lo = CHESTNUT_PCI0_MEM_PCI_LO_ADDR;
  166. si.pci_0.pci_mem[0].size = CHESTNUT_PCI0_MEM_SIZE;
  167. si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE; /* no swapping */
  168. si.pci_0.pci_cmd_bits = 0;
  169. si.pci_0.latency_timer = 0x80;
  170. for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
  171. #if defined(CONFIG_NOT_COHERENT_CACHE)
  172. si.cpu_prot_options[i] = 0;
  173. si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
  174. si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
  175. si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
  176. si.pci_1.acc_cntl_options[i] =
  177. MV64360_PCI_ACC_CNTL_SNOOP_NONE |
  178. MV64360_PCI_ACC_CNTL_SWAP_NONE |
  179. MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
  180. MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
  181. #else
  182. si.cpu_prot_options[i] = 0;
  183. si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE; /* errata */
  184. si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE; /* errata */
  185. si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE; /* errata */
  186. si.pci_1.acc_cntl_options[i] =
  187. MV64360_PCI_ACC_CNTL_SNOOP_WB |
  188. MV64360_PCI_ACC_CNTL_SWAP_NONE |
  189. MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
  190. MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
  191. #endif
  192. }
  193. /* Lookup host bridge - on CPU 0 - no SMP support */
  194. if (mv64x60_init(&bh, &si)) {
  195. printk("\n\nPCI Bridge initialization failed!\n");
  196. }
  197. pci_dram_offset = 0;
  198. ppc_md.pci_swizzle = common_swizzle;
  199. ppc_md.pci_map_irq = chestnut_map_irq;
  200. ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
  201. mv64x60_set_bus(&bh, 0, 0);
  202. bh.hose_a->first_busno = 0;
  203. bh.hose_a->last_busno = 0xff;
  204. bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
  205. }
  206. void __init
  207. chestnut_setup_peripherals(void)
  208. {
  209. mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
  210. CHESTNUT_BOOT_8BIT_BASE, CHESTNUT_BOOT_8BIT_SIZE, 0);
  211. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
  212. mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
  213. CHESTNUT_32BIT_BASE, CHESTNUT_32BIT_SIZE, 0);
  214. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
  215. mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
  216. CHESTNUT_CPLD_BASE, CHESTNUT_CPLD_SIZE, 0);
  217. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
  218. cpld_base = ioremap(CHESTNUT_CPLD_BASE, CHESTNUT_CPLD_SIZE);
  219. mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
  220. CHESTNUT_UART_BASE, CHESTNUT_UART_SIZE, 0);
  221. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
  222. mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
  223. CHESTNUT_FRAM_BASE, CHESTNUT_FRAM_SIZE, 0);
  224. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
  225. mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
  226. CHESTNUT_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE, 0);
  227. bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
  228. #ifdef CONFIG_NOT_COHERENT_CACHE
  229. mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b0);
  230. #else
  231. mv64x60_write(&bh, MV64360_SRAM_CONFIG, 0x001600b2);
  232. #endif
  233. sram_base = ioremap(CHESTNUT_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE);
  234. memset(sram_base, 0, MV64360_SRAM_SIZE);
  235. /*
  236. * Configure MPP pins for PCI DMA
  237. *
  238. * PCI Slot GNT pin REQ pin
  239. * 0 MPP16 MPP17
  240. * 1 MPP18 MPP19
  241. * 2 MPP20 MPP21
  242. * 3 MPP22 MPP23
  243. */
  244. mv64x60_write(&bh, MV64x60_MPP_CNTL_2,
  245. (0x1 << 0) | /* MPPSel16 PCI0_GNT[0] */
  246. (0x1 << 4) | /* MPPSel17 PCI0_REQ[0] */
  247. (0x1 << 8) | /* MPPSel18 PCI0_GNT[1] */
  248. (0x1 << 12) | /* MPPSel19 PCI0_REQ[1] */
  249. (0x1 << 16) | /* MPPSel20 PCI0_GNT[2] */
  250. (0x1 << 20) | /* MPPSel21 PCI0_REQ[2] */
  251. (0x1 << 24) | /* MPPSel22 PCI0_GNT[3] */
  252. (0x1 << 28)); /* MPPSel23 PCI0_REQ[3] */
  253. /*
  254. * Set unused MPP pins for output, as per schematic note
  255. *
  256. * Unused Pins: MPP01, MPP02, MPP04, MPP05, MPP06
  257. * MPP09, MPP10, MPP13, MPP14, MPP15
  258. */
  259. mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_0,
  260. (0xf << 4) | /* MPPSel01 GPIO[1] */
  261. (0xf << 8) | /* MPPSel02 GPIO[2] */
  262. (0xf << 16) | /* MPPSel04 GPIO[4] */
  263. (0xf << 20) | /* MPPSel05 GPIO[5] */
  264. (0xf << 24)); /* MPPSel06 GPIO[6] */
  265. mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_1,
  266. (0xf << 4) | /* MPPSel09 GPIO[9] */
  267. (0xf << 8) | /* MPPSel10 GPIO[10] */
  268. (0xf << 20) | /* MPPSel13 GPIO[13] */
  269. (0xf << 24) | /* MPPSel14 GPIO[14] */
  270. (0xf << 28)); /* MPPSel15 GPIO[15] */
  271. mv64x60_set_bits(&bh, MV64x60_GPP_IO_CNTL, /* Output */
  272. BIT(1) | BIT(2) | BIT(4) | BIT(5) | BIT(6) |
  273. BIT(9) | BIT(10) | BIT(13) | BIT(14) | BIT(15));
  274. /*
  275. * Configure the following MPP pins to indicate a level
  276. * triggered interrupt
  277. *
  278. * MPP24 - Board Reset (just map the MPP & GPP for chestnut_reset)
  279. * MPP25 - UART A (high)
  280. * MPP26 - UART B (high)
  281. * MPP28 - PCI Slot 3 (low)
  282. * MPP29 - PCI Slot 2 (low)
  283. * MPP30 - PCI Slot 1 (low)
  284. * MPP31 - PCI Slot 0 (low)
  285. */
  286. mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_3,
  287. BIT(3) | BIT(2) | BIT(1) | BIT(0) | /* MPP 24 */
  288. BIT(7) | BIT(6) | BIT(5) | BIT(4) | /* MPP 25 */
  289. BIT(11) | BIT(10) | BIT(9) | BIT(8) | /* MPP 26 */
  290. BIT(19) | BIT(18) | BIT(17) | BIT(16) | /* MPP 28 */
  291. BIT(23) | BIT(22) | BIT(21) | BIT(20) | /* MPP 29 */
  292. BIT(27) | BIT(26) | BIT(25) | BIT(24) | /* MPP 30 */
  293. BIT(31) | BIT(30) | BIT(29) | BIT(28)); /* MPP 31 */
  294. /*
  295. * Define GPP 25 (high), 26 (high), 28 (low), 29 (low), 30 (low),
  296. * 31 (low) interrupt polarity input signal and level triggered
  297. */
  298. mv64x60_clr_bits(&bh, MV64x60_GPP_LEVEL_CNTL, BIT(25) | BIT(26));
  299. mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL,
  300. BIT(28) | BIT(29) | BIT(30) | BIT(31));
  301. mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL,
  302. BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
  303. BIT(31));
  304. /* Config GPP interrupt controller to respond to level trigger */
  305. mv64x60_set_bits(&bh, MV64360_COMM_ARBITER_CNTL, BIT(10));
  306. /*
  307. * Dismiss and then enable interrupt on GPP interrupt cause for CPU #0
  308. */
  309. mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE,
  310. ~(BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
  311. BIT(31)));
  312. mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK,
  313. BIT(25) | BIT(26) | BIT(28) | BIT(29) | BIT(30) |
  314. BIT(31));
  315. /*
  316. * Dismiss and then enable interrupt on CPU #0 high cause register
  317. * BIT27 summarizes GPP interrupts 24-31
  318. */
  319. mv64x60_set_bits(&bh, MV64360_IC_CPU0_INTR_MASK_HI, BIT(27));
  320. if (ppc_md.progress)
  321. ppc_md.progress("chestnut_setup_bridge: exit", 0);
  322. }
  323. /**************************************************************************
  324. * FUNCTION: chestnut_setup_arch
  325. *
  326. * DESCRIPTION: ppc_md machine configuration callback
  327. *
  328. ****/
  329. static void __init
  330. chestnut_setup_arch(void)
  331. {
  332. if (ppc_md.progress)
  333. ppc_md.progress("chestnut_setup_arch: enter", 0);
  334. /* init to some ~sane value until calibrate_delay() runs */
  335. loops_per_jiffy = 50000000 / HZ;
  336. /* if the time base value is greater than bus freq/4 (the TB and
  337. * decrementer tick rate) + signed integer rollover value, we
  338. * can spend a fair amount of time waiting for the rollover to
  339. * happen. To get around this, initialize the time base register
  340. * to a "safe" value.
  341. */
  342. set_tb(0, 0);
  343. #ifdef CONFIG_BLK_DEV_INITRD
  344. if (initrd_start)
  345. ROOT_DEV = Root_RAM0;
  346. else
  347. #endif
  348. #ifdef CONFIG_ROOT_NFS
  349. ROOT_DEV = Root_NFS;
  350. #else
  351. ROOT_DEV = Root_SDA2;
  352. #endif
  353. /*
  354. * Set up the L2CR register.
  355. */
  356. _set_L2CR(_get_L2CR() | L2CR_L2E);
  357. chestnut_setup_bridge();
  358. chestnut_setup_peripherals();
  359. #ifdef CONFIG_DUMMY_CONSOLE
  360. conswitchp = &dummy_con;
  361. #endif
  362. #if defined(CONFIG_SERIAL_8250)
  363. chestnut_early_serial_map();
  364. #endif
  365. /* Identify the system */
  366. printk(KERN_INFO "System Identification: IBM 750FX/GX Eval Board\n");
  367. printk(KERN_INFO "IBM 750FX/GX port (C) 2004 MontaVista Software, Inc."
  368. " (source@mvista.com)\n");
  369. if (ppc_md.progress)
  370. ppc_md.progress("chestnut_setup_arch: exit", 0);
  371. }
  372. #ifdef CONFIG_MTD_PHYSMAP
  373. static struct mtd_partition ptbl;
  374. static int __init
  375. chestnut_setup_mtd(void)
  376. {
  377. memset(&ptbl, 0, sizeof(ptbl));
  378. ptbl.name = "User FS";
  379. ptbl.size = CHESTNUT_32BIT_SIZE;
  380. physmap_map.size = CHESTNUT_32BIT_SIZE;
  381. physmap_set_partitions(&ptbl, 1);
  382. return 0;
  383. }
  384. arch_initcall(chestnut_setup_mtd);
  385. #endif
  386. /**************************************************************************
  387. * FUNCTION: chestnut_restart
  388. *
  389. * DESCRIPTION: ppc_md machine reset callback
  390. * reset the board via the CPLD command register
  391. *
  392. ****/
  393. static void
  394. chestnut_restart(char *cmd)
  395. {
  396. volatile ulong i = 10000000;
  397. local_irq_disable();
  398. /*
  399. * Set CPLD Reg 3 bit 0 to 1 to allow MPP signals on reset to work
  400. *
  401. * MPP24 - board reset
  402. */
  403. writeb(0x1, cpld_base + 3);
  404. /* GPP pin tied to MPP earlier */
  405. mv64x60_set_bits(&bh, MV64x60_GPP_VALUE_SET, BIT(24));
  406. while (i-- > 0);
  407. panic("restart failed\n");
  408. }
  409. static void
  410. chestnut_halt(void)
  411. {
  412. local_irq_disable();
  413. for (;;);
  414. /* NOTREACHED */
  415. }
  416. static void
  417. chestnut_power_off(void)
  418. {
  419. chestnut_halt();
  420. /* NOTREACHED */
  421. }
  422. /**************************************************************************
  423. * FUNCTION: chestnut_map_io
  424. *
  425. * DESCRIPTION: configure fixed memory-mapped IO
  426. *
  427. ****/
  428. static void __init
  429. chestnut_map_io(void)
  430. {
  431. #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
  432. io_block_mapping(CHESTNUT_UART_BASE, CHESTNUT_UART_BASE, 0x100000,
  433. _PAGE_IO);
  434. #endif
  435. }
  436. /**************************************************************************
  437. * FUNCTION: chestnut_set_bat
  438. *
  439. * DESCRIPTION: configures a (temporary) bat mapping for early access to
  440. * device I/O
  441. *
  442. ****/
  443. static __inline__ void
  444. chestnut_set_bat(void)
  445. {
  446. mb();
  447. mtspr(SPRN_DBAT3U, 0xf0001ffe);
  448. mtspr(SPRN_DBAT3L, 0xf000002a);
  449. mb();
  450. }
  451. /**************************************************************************
  452. * FUNCTION: platform_init
  453. *
  454. * DESCRIPTION: main entry point for configuring board-specific machine
  455. * callbacks
  456. *
  457. ****/
  458. void __init
  459. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  460. unsigned long r6, unsigned long r7)
  461. {
  462. parse_bootinfo(find_bootinfo());
  463. /* Copy the kernel command line arguments to a safe place. */
  464. if (r6) {
  465. *(char *) (r7 + KERNELBASE) = 0;
  466. strcpy(cmd_line, (char *) (r6 + KERNELBASE));
  467. }
  468. isa_mem_base = 0;
  469. ppc_md.setup_arch = chestnut_setup_arch;
  470. ppc_md.show_cpuinfo = chestnut_show_cpuinfo;
  471. ppc_md.irq_canonicalize = NULL;
  472. ppc_md.init_IRQ = mv64360_init_irq;
  473. ppc_md.get_irq = mv64360_get_irq;
  474. ppc_md.init = NULL;
  475. ppc_md.find_end_of_memory = chestnut_find_end_of_memory;
  476. ppc_md.setup_io_mappings = chestnut_map_io;
  477. ppc_md.restart = chestnut_restart;
  478. ppc_md.power_off = chestnut_power_off;
  479. ppc_md.halt = chestnut_halt;
  480. ppc_md.time_init = NULL;
  481. ppc_md.set_rtc_time = NULL;
  482. ppc_md.get_rtc_time = NULL;
  483. ppc_md.calibrate_decr = chestnut_calibrate_decr;
  484. ppc_md.nvram_read_val = NULL;
  485. ppc_md.nvram_write_val = NULL;
  486. ppc_md.heartbeat = NULL;
  487. bh.p_base = CONFIG_MV64X60_NEW_BASE;
  488. chestnut_set_bat();
  489. #if defined(CONFIG_SERIAL_TEXT_DEBUG)
  490. ppc_md.progress = gen550_progress;
  491. #endif
  492. #if defined(CONFIG_KGDB)
  493. ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;
  494. #endif
  495. if (ppc_md.progress)
  496. ppc_md.progress("chestnut_init(): exit", 0);
  497. }