chestnut.c 16 KB

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