mpc82xx_ads.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * MPC82xx_ads setup and early boot code plus other random bits.
  3. *
  4. * Author: Vitaly Bordug <vbordug@ru.mvista.com>
  5. * m82xx_restart fix by Wade Farnsworth <wfarnsworth@mvista.com>
  6. *
  7. * Copyright (c) 2006 MontaVista Software, Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  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/pci.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/kdev_t.h>
  22. #include <linux/major.h>
  23. #include <linux/console.h>
  24. #include <linux/delay.h>
  25. #include <linux/seq_file.h>
  26. #include <linux/root_dev.h>
  27. #include <linux/initrd.h>
  28. #include <linux/module.h>
  29. #include <linux/fsl_devices.h>
  30. #include <linux/fs_uart_pd.h>
  31. #include <asm/system.h>
  32. #include <asm/pgtable.h>
  33. #include <asm/page.h>
  34. #include <asm/atomic.h>
  35. #include <asm/time.h>
  36. #include <asm/io.h>
  37. #include <asm/machdep.h>
  38. #include <asm/bootinfo.h>
  39. #include <asm/pci-bridge.h>
  40. #include <asm/mpc8260.h>
  41. #include <asm/irq.h>
  42. #include <mm/mmu_decl.h>
  43. #include <asm/prom.h>
  44. #include <asm/cpm2.h>
  45. #include <asm/udbg.h>
  46. #include <asm/i8259.h>
  47. #include <linux/fs_enet_pd.h>
  48. #include <sysdev/fsl_soc.h>
  49. #include <../sysdev/cpm2_pic.h>
  50. #include "pq2ads_pd.h"
  51. #ifdef CONFIG_PCI
  52. static uint pci_clk_frq;
  53. static struct {
  54. unsigned long *pci_int_stat_reg;
  55. unsigned long *pci_int_mask_reg;
  56. } pci_regs;
  57. static unsigned long pci_int_base;
  58. static struct irq_host *pci_pic_host;
  59. static struct device_node *pci_pic_node;
  60. #endif
  61. static void __init mpc82xx_ads_pic_init(void)
  62. {
  63. struct device_node *np = of_find_compatible_node(NULL, "cpm-pic", "CPM2");
  64. struct resource r;
  65. cpm2_map_t *cpm_reg;
  66. if (np == NULL) {
  67. printk(KERN_ERR "PIC init: can not find cpm-pic node\n");
  68. return;
  69. }
  70. if (of_address_to_resource(np, 0, &r)) {
  71. printk(KERN_ERR "PIC init: invalid resource\n");
  72. of_node_put(np);
  73. return;
  74. }
  75. cpm2_pic_init(np);
  76. of_node_put(np);
  77. /* Initialize the default interrupt mapping priorities,
  78. * in case the boot rom changed something on us.
  79. */
  80. cpm_reg = (cpm2_map_t *) ioremap(get_immrbase(), sizeof(cpm2_map_t));
  81. cpm_reg->im_intctl.ic_siprr = 0x05309770;
  82. iounmap(cpm_reg);
  83. #ifdef CONFIG_PCI
  84. /* Initialize stuff for the 82xx CPLD IC and install demux */
  85. m82xx_pci_init_irq();
  86. #endif
  87. }
  88. static void init_fcc1_ioports(struct fs_platform_info *fpi)
  89. {
  90. struct io_port *io;
  91. u32 tempval;
  92. cpm2_map_t *immap = ioremap(get_immrbase(), sizeof(cpm2_map_t));
  93. struct device_node *np;
  94. struct resource r;
  95. u32 *bcsr;
  96. np = of_find_node_by_type(NULL, "memory");
  97. if (!np) {
  98. printk(KERN_INFO "No memory node in device tree\n");
  99. return;
  100. }
  101. if (of_address_to_resource(np, 1, &r)) {
  102. printk(KERN_INFO "No memory reg property [1] in devicetree\n");
  103. return;
  104. }
  105. of_node_put(np);
  106. bcsr = ioremap(r.start + 4, sizeof(u32));
  107. io = &immap->im_ioport;
  108. /* Enable the PHY */
  109. clrbits32(bcsr, BCSR1_FETHIEN);
  110. setbits32(bcsr, BCSR1_FETH_RST);
  111. /* FCC1 pins are on port A/C. */
  112. /* Configure port A and C pins for FCC1 Ethernet. */
  113. tempval = in_be32(&io->iop_pdira);
  114. tempval &= ~PA1_DIRA0;
  115. tempval |= PA1_DIRA1;
  116. out_be32(&io->iop_pdira, tempval);
  117. tempval = in_be32(&io->iop_psora);
  118. tempval &= ~PA1_PSORA0;
  119. tempval |= PA1_PSORA1;
  120. out_be32(&io->iop_psora, tempval);
  121. setbits32(&io->iop_ppara, PA1_DIRA0 | PA1_DIRA1);
  122. /* Alter clocks */
  123. tempval = PC_CLK(fpi->clk_tx - 8) | PC_CLK(fpi->clk_rx - 8);
  124. clrbits32(&io->iop_psorc, tempval);
  125. clrbits32(&io->iop_pdirc, tempval);
  126. setbits32(&io->iop_pparc, tempval);
  127. cpm2_clk_setup(CPM_CLK_FCC1, fpi->clk_rx, CPM_CLK_RX);
  128. cpm2_clk_setup(CPM_CLK_FCC1, fpi->clk_tx, CPM_CLK_TX);
  129. iounmap(bcsr);
  130. iounmap(immap);
  131. }
  132. static void init_fcc2_ioports(struct fs_platform_info *fpi)
  133. {
  134. cpm2_map_t *immap = ioremap(get_immrbase(), sizeof(cpm2_map_t));
  135. struct device_node *np;
  136. struct resource r;
  137. u32 *bcsr;
  138. struct io_port *io;
  139. u32 tempval;
  140. np = of_find_node_by_type(NULL, "memory");
  141. if (!np) {
  142. printk(KERN_INFO "No memory node in device tree\n");
  143. return;
  144. }
  145. if (of_address_to_resource(np, 1, &r)) {
  146. printk(KERN_INFO "No memory reg property [1] in devicetree\n");
  147. return;
  148. }
  149. of_node_put(np);
  150. io = &immap->im_ioport;
  151. bcsr = ioremap(r.start + 12, sizeof(u32));
  152. /* Enable the PHY */
  153. clrbits32(bcsr, BCSR3_FETHIEN2);
  154. setbits32(bcsr, BCSR3_FETH2_RST);
  155. /* FCC2 are port B/C. */
  156. /* Configure port A and C pins for FCC2 Ethernet. */
  157. tempval = in_be32(&io->iop_pdirb);
  158. tempval &= ~PB2_DIRB0;
  159. tempval |= PB2_DIRB1;
  160. out_be32(&io->iop_pdirb, tempval);
  161. tempval = in_be32(&io->iop_psorb);
  162. tempval &= ~PB2_PSORB0;
  163. tempval |= PB2_PSORB1;
  164. out_be32(&io->iop_psorb, tempval);
  165. setbits32(&io->iop_pparb, PB2_DIRB0 | PB2_DIRB1);
  166. tempval = PC_CLK(fpi->clk_tx - 8) | PC_CLK(fpi->clk_rx - 8);
  167. /* Alter clocks */
  168. clrbits32(&io->iop_psorc, tempval);
  169. clrbits32(&io->iop_pdirc, tempval);
  170. setbits32(&io->iop_pparc, tempval);
  171. cpm2_clk_setup(CPM_CLK_FCC2, fpi->clk_rx, CPM_CLK_RX);
  172. cpm2_clk_setup(CPM_CLK_FCC2, fpi->clk_tx, CPM_CLK_TX);
  173. iounmap(bcsr);
  174. iounmap(immap);
  175. }
  176. void init_fcc_ioports(struct fs_platform_info *fpi)
  177. {
  178. int fcc_no = fs_get_fcc_index(fpi->fs_no);
  179. switch (fcc_no) {
  180. case 0:
  181. init_fcc1_ioports(fpi);
  182. break;
  183. case 1:
  184. init_fcc2_ioports(fpi);
  185. break;
  186. default:
  187. printk(KERN_ERR "init_fcc_ioports: invalid FCC number\n");
  188. return;
  189. }
  190. }
  191. static void init_scc1_uart_ioports(struct fs_uart_platform_info *data)
  192. {
  193. cpm2_map_t *immap = ioremap(get_immrbase(), sizeof(cpm2_map_t));
  194. /* SCC1 is only on port D */
  195. setbits32(&immap->im_ioport.iop_ppard, 0x00000003);
  196. clrbits32(&immap->im_ioport.iop_psord, 0x00000001);
  197. setbits32(&immap->im_ioport.iop_psord, 0x00000002);
  198. clrbits32(&immap->im_ioport.iop_pdird, 0x00000001);
  199. setbits32(&immap->im_ioport.iop_pdird, 0x00000002);
  200. clrbits32(&immap->im_cpmux.cmx_scr, (0x00000007 << (4 - data->clk_tx)));
  201. clrbits32(&immap->im_cpmux.cmx_scr, (0x00000038 << (4 - data->clk_rx)));
  202. setbits32(&immap->im_cpmux.cmx_scr,
  203. ((data->clk_tx - 1) << (4 - data->clk_tx)));
  204. setbits32(&immap->im_cpmux.cmx_scr,
  205. ((data->clk_rx - 1) << (4 - data->clk_rx)));
  206. iounmap(immap);
  207. }
  208. static void init_scc4_uart_ioports(struct fs_uart_platform_info *data)
  209. {
  210. cpm2_map_t *immap = ioremap(get_immrbase(), sizeof(cpm2_map_t));
  211. setbits32(&immap->im_ioport.iop_ppard, 0x00000600);
  212. clrbits32(&immap->im_ioport.iop_psord, 0x00000600);
  213. clrbits32(&immap->im_ioport.iop_pdird, 0x00000200);
  214. setbits32(&immap->im_ioport.iop_pdird, 0x00000400);
  215. clrbits32(&immap->im_cpmux.cmx_scr, (0x00000007 << (4 - data->clk_tx)));
  216. clrbits32(&immap->im_cpmux.cmx_scr, (0x00000038 << (4 - data->clk_rx)));
  217. setbits32(&immap->im_cpmux.cmx_scr,
  218. ((data->clk_tx - 1) << (4 - data->clk_tx)));
  219. setbits32(&immap->im_cpmux.cmx_scr,
  220. ((data->clk_rx - 1) << (4 - data->clk_rx)));
  221. iounmap(immap);
  222. }
  223. void init_scc_ioports(struct fs_uart_platform_info *data)
  224. {
  225. int scc_no = fs_get_scc_index(data->fs_no);
  226. switch (scc_no) {
  227. case 0:
  228. init_scc1_uart_ioports(data);
  229. data->brg = data->clk_rx;
  230. break;
  231. case 3:
  232. init_scc4_uart_ioports(data);
  233. data->brg = data->clk_rx;
  234. break;
  235. default:
  236. printk(KERN_ERR "init_scc_ioports: invalid SCC number\n");
  237. return;
  238. }
  239. }
  240. void __init m82xx_board_setup(void)
  241. {
  242. cpm2_map_t *immap = ioremap(get_immrbase(), sizeof(cpm2_map_t));
  243. struct device_node *np;
  244. struct resource r;
  245. u32 *bcsr;
  246. np = of_find_node_by_type(NULL, "memory");
  247. if (!np) {
  248. printk(KERN_INFO "No memory node in device tree\n");
  249. return;
  250. }
  251. if (of_address_to_resource(np, 1, &r)) {
  252. printk(KERN_INFO "No memory reg property [1] in devicetree\n");
  253. return;
  254. }
  255. of_node_put(np);
  256. bcsr = ioremap(r.start + 4, sizeof(u32));
  257. /* Enable the 2nd UART port */
  258. clrbits32(bcsr, BCSR1_RS232_EN2);
  259. #ifdef CONFIG_SERIAL_CPM_SCC1
  260. clrbits32((u32 *) & immap->im_scc[0].scc_sccm,
  261. UART_SCCM_TX | UART_SCCM_RX);
  262. clrbits32((u32 *) & immap->im_scc[0].scc_gsmrl,
  263. SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  264. #endif
  265. #ifdef CONFIG_SERIAL_CPM_SCC2
  266. clrbits32((u32 *) & immap->im_scc[1].scc_sccm,
  267. UART_SCCM_TX | UART_SCCM_RX);
  268. clrbits32((u32 *) & immap->im_scc[1].scc_gsmrl,
  269. SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  270. #endif
  271. #ifdef CONFIG_SERIAL_CPM_SCC3
  272. clrbits32((u32 *) & immap->im_scc[2].scc_sccm,
  273. UART_SCCM_TX | UART_SCCM_RX);
  274. clrbits32((u32 *) & immap->im_scc[2].scc_gsmrl,
  275. SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  276. #endif
  277. #ifdef CONFIG_SERIAL_CPM_SCC4
  278. clrbits32((u32 *) & immap->im_scc[3].scc_sccm,
  279. UART_SCCM_TX | UART_SCCM_RX);
  280. clrbits32((u32 *) & immap->im_scc[3].scc_gsmrl,
  281. SCC_GSMRL_ENR | SCC_GSMRL_ENT);
  282. #endif
  283. iounmap(bcsr);
  284. iounmap(immap);
  285. }
  286. #ifdef CONFIG_PCI
  287. static void m82xx_pci_mask_irq(unsigned int irq)
  288. {
  289. int bit = irq - pci_int_base;
  290. *pci_regs.pci_int_mask_reg |= (1 << (31 - bit));
  291. return;
  292. }
  293. static void m82xx_pci_unmask_irq(unsigned int irq)
  294. {
  295. int bit = irq - pci_int_base;
  296. *pci_regs.pci_int_mask_reg &= ~(1 << (31 - bit));
  297. return;
  298. }
  299. static void m82xx_pci_mask_and_ack(unsigned int irq)
  300. {
  301. int bit = irq - pci_int_base;
  302. *pci_regs.pci_int_mask_reg |= (1 << (31 - bit));
  303. return;
  304. }
  305. static void m82xx_pci_end_irq(unsigned int irq)
  306. {
  307. int bit = irq - pci_int_base;
  308. *pci_regs.pci_int_mask_reg &= ~(1 << (31 - bit));
  309. return;
  310. }
  311. struct hw_interrupt_type m82xx_pci_ic = {
  312. .typename = "MPC82xx ADS PCI",
  313. .name = "MPC82xx ADS PCI",
  314. .enable = m82xx_pci_unmask_irq,
  315. .disable = m82xx_pci_mask_irq,
  316. .ack = m82xx_pci_mask_and_ack,
  317. .end = m82xx_pci_end_irq,
  318. .mask = m82xx_pci_mask_irq,
  319. .mask_ack = m82xx_pci_mask_and_ack,
  320. .unmask = m82xx_pci_unmask_irq,
  321. .eoi = m82xx_pci_end_irq,
  322. };
  323. static void
  324. m82xx_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
  325. {
  326. unsigned long stat, mask, pend;
  327. int bit;
  328. for (;;) {
  329. stat = *pci_regs.pci_int_stat_reg;
  330. mask = *pci_regs.pci_int_mask_reg;
  331. pend = stat & ~mask & 0xf0000000;
  332. if (!pend)
  333. break;
  334. for (bit = 0; pend != 0; ++bit, pend <<= 1) {
  335. if (pend & 0x80000000)
  336. __do_IRQ(pci_int_base + bit);
  337. }
  338. }
  339. }
  340. static int pci_pic_host_match(struct irq_host *h, struct device_node *node)
  341. {
  342. return node == pci_pic_node;
  343. }
  344. static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
  345. irq_hw_number_t hw)
  346. {
  347. get_irq_desc(virq)->status |= IRQ_LEVEL;
  348. set_irq_chip(virq, &m82xx_pci_ic);
  349. return 0;
  350. }
  351. static void pci_host_unmap(struct irq_host *h, unsigned int virq)
  352. {
  353. /* remove chip and handler */
  354. set_irq_chip(virq, NULL);
  355. }
  356. static struct irq_host_ops pci_pic_host_ops = {
  357. .match = pci_pic_host_match,
  358. .map = pci_pic_host_map,
  359. .unmap = pci_host_unmap,
  360. };
  361. void m82xx_pci_init_irq(void)
  362. {
  363. int irq;
  364. cpm2_map_t *immap;
  365. struct device_node *np;
  366. struct resource r;
  367. const u32 *regs;
  368. unsigned int size;
  369. const u32 *irq_map;
  370. int i;
  371. unsigned int irq_max, irq_min;
  372. if ((np = of_find_node_by_type(NULL, "soc")) == NULL) {
  373. printk(KERN_INFO "No SOC node in device tree\n");
  374. return;
  375. }
  376. memset(&r, 0, sizeof(r));
  377. if (of_address_to_resource(np, 0, &r)) {
  378. printk(KERN_INFO "No SOC reg property in device tree\n");
  379. return;
  380. }
  381. immap = ioremap(r.start, sizeof(*immap));
  382. of_node_put(np);
  383. /* install the demultiplexer for the PCI cascade interrupt */
  384. np = of_find_node_by_type(NULL, "pci");
  385. if (!np) {
  386. printk(KERN_INFO "No pci node on device tree\n");
  387. iounmap(immap);
  388. return;
  389. }
  390. irq_map = get_property(np, "interrupt-map", &size);
  391. if ((!irq_map) || (size <= 7)) {
  392. printk(KERN_INFO "No interrupt-map property of pci node\n");
  393. iounmap(immap);
  394. return;
  395. }
  396. size /= sizeof(irq_map[0]);
  397. for (i = 0, irq_max = 0, irq_min = 512; i < size; i += 7, irq_map += 7) {
  398. if (irq_map[5] < irq_min)
  399. irq_min = irq_map[5];
  400. if (irq_map[5] > irq_max)
  401. irq_max = irq_map[5];
  402. }
  403. pci_int_base = irq_min;
  404. irq = irq_of_parse_and_map(np, 0);
  405. set_irq_chained_handler(irq, m82xx_pci_irq_demux);
  406. of_node_put(np);
  407. np = of_find_node_by_type(NULL, "pci-pic");
  408. if (!np) {
  409. printk(KERN_INFO "No pci pic node on device tree\n");
  410. iounmap(immap);
  411. return;
  412. }
  413. pci_pic_node = of_node_get(np);
  414. /* PCI interrupt controller registers: status and mask */
  415. regs = get_property(np, "reg", &size);
  416. if ((!regs) || (size <= 2)) {
  417. printk(KERN_INFO "No reg property in pci pic node\n");
  418. iounmap(immap);
  419. return;
  420. }
  421. pci_regs.pci_int_stat_reg =
  422. ioremap(regs[0], sizeof(*pci_regs.pci_int_stat_reg));
  423. pci_regs.pci_int_mask_reg =
  424. ioremap(regs[1], sizeof(*pci_regs.pci_int_mask_reg));
  425. of_node_put(np);
  426. /* configure chip select for PCI interrupt controller */
  427. immap->im_memctl.memc_br3 = regs[0] | 0x00001801;
  428. immap->im_memctl.memc_or3 = 0xffff8010;
  429. /* make PCI IRQ level sensitive */
  430. immap->im_intctl.ic_siexr &= ~(1 << (14 - (irq - SIU_INT_IRQ1)));
  431. /* mask all PCI interrupts */
  432. *pci_regs.pci_int_mask_reg |= 0xfff00000;
  433. iounmap(immap);
  434. pci_pic_host =
  435. irq_alloc_host(IRQ_HOST_MAP_LINEAR, irq_max - irq_min + 1,
  436. &pci_pic_host_ops, irq_max + 1);
  437. return;
  438. }
  439. static int m82xx_pci_exclude_device(u_char bus, u_char devfn)
  440. {
  441. if (bus == 0 && PCI_SLOT(devfn) == 0)
  442. return PCIBIOS_DEVICE_NOT_FOUND;
  443. else
  444. return PCIBIOS_SUCCESSFUL;
  445. }
  446. static void
  447. __init mpc82xx_pcibios_fixup(void)
  448. {
  449. struct pci_dev *dev = NULL;
  450. for_each_pci_dev(dev) {
  451. pci_read_irq_line(dev);
  452. }
  453. }
  454. void __init add_bridge(struct device_node *np)
  455. {
  456. int len;
  457. struct pci_controller *hose;
  458. struct resource r;
  459. const int *bus_range;
  460. const void *ptr;
  461. memset(&r, 0, sizeof(r));
  462. if (of_address_to_resource(np, 0, &r)) {
  463. printk(KERN_INFO "No PCI reg property in device tree\n");
  464. return;
  465. }
  466. if (!(ptr = get_property(np, "clock-frequency", NULL))) {
  467. printk(KERN_INFO "No clock-frequency property in PCI node");
  468. return;
  469. }
  470. pci_clk_frq = *(uint *) ptr;
  471. of_node_put(np);
  472. bus_range = get_property(np, "bus-range", &len);
  473. if (bus_range == NULL || len < 2 * sizeof(int)) {
  474. printk(KERN_WARNING "Can't get bus-range for %s, assume"
  475. " bus 0\n", np->full_name);
  476. }
  477. pci_assign_all_buses = 1;
  478. hose = pcibios_alloc_controller();
  479. if (!hose)
  480. return;
  481. hose->arch_data = np;
  482. hose->set_cfg_type = 1;
  483. hose->first_busno = bus_range ? bus_range[0] : 0;
  484. hose->last_busno = bus_range ? bus_range[1] : 0xff;
  485. hose->bus_offset = 0;
  486. hose->set_cfg_type = 1;
  487. setup_indirect_pci(hose,
  488. r.start + offsetof(pci_cpm2_t, pci_cfg_addr),
  489. r.start + offsetof(pci_cpm2_t, pci_cfg_data));
  490. pci_process_bridge_OF_ranges(hose, np, 1);
  491. }
  492. #endif
  493. /*
  494. * Setup the architecture
  495. */
  496. static void __init mpc82xx_ads_setup_arch(void)
  497. {
  498. #ifdef CONFIG_PCI
  499. struct device_node *np;
  500. #endif
  501. if (ppc_md.progress)
  502. ppc_md.progress("mpc82xx_ads_setup_arch()", 0);
  503. cpm2_reset();
  504. /* Map I/O region to a 256MB BAT */
  505. m82xx_board_setup();
  506. #ifdef CONFIG_PCI
  507. ppc_md.pci_exclude_device = m82xx_pci_exclude_device;
  508. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  509. add_bridge(np);
  510. of_node_put(np);
  511. ppc_md.pci_map_irq = NULL;
  512. ppc_md.pcibios_fixup = mpc82xx_pcibios_fixup;
  513. ppc_md.pcibios_fixup_bus = NULL;
  514. #endif
  515. #ifdef CONFIG_ROOT_NFS
  516. ROOT_DEV = Root_NFS;
  517. #else
  518. ROOT_DEV = Root_HDA1;
  519. #endif
  520. if (ppc_md.progress)
  521. ppc_md.progress("mpc82xx_ads_setup_arch(), finish", 0);
  522. }
  523. /*
  524. * Called very early, device-tree isn't unflattened
  525. */
  526. static int __init mpc82xx_ads_probe(void)
  527. {
  528. /* We always match for now, eventually we should look at
  529. * the flat dev tree to ensure this is the board we are
  530. * supposed to run on
  531. */
  532. return 1;
  533. }
  534. #define RMR_CSRE 0x00000001
  535. static void m82xx_restart(char *cmd)
  536. {
  537. __volatile__ unsigned char dummy;
  538. local_irq_disable();
  539. ((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= RMR_CSRE;
  540. /* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
  541. mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
  542. dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
  543. printk("Restart failed\n");
  544. while (1) ;
  545. }
  546. static void m82xx_halt(void)
  547. {
  548. local_irq_disable();
  549. while (1) ;
  550. }
  551. define_machine(mpc82xx_ads)
  552. {
  553. .name = "MPC82xx ADS",
  554. .probe = mpc82xx_ads_probe,
  555. .setup_arch = mpc82xx_ads_setup_arch,
  556. .init_IRQ = mpc82xx_ads_pic_init,
  557. .show_cpuinfo = mpc82xx_ads_show_cpuinfo,
  558. .get_irq = cpm2_get_irq,
  559. .calibrate_decr = m82xx_calibrate_decr,
  560. .restart = m82xx_restart,.halt = m82xx_halt,
  561. };