mpc82xx_ads.c 16 KB

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