mpc82xx_ads.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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. {
  327. unsigned long stat, mask, pend;
  328. int bit;
  329. for (;;) {
  330. stat = *pci_regs.pci_int_stat_reg;
  331. mask = *pci_regs.pci_int_mask_reg;
  332. pend = stat & ~mask & 0xf0000000;
  333. if (!pend)
  334. break;
  335. for (bit = 0; pend != 0; ++bit, pend <<= 1) {
  336. if (pend & 0x80000000)
  337. __do_IRQ(pci_int_base + bit);
  338. }
  339. }
  340. }
  341. static int pci_pic_host_match(struct irq_host *h, struct device_node *node)
  342. {
  343. return node == pci_pic_node;
  344. }
  345. static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
  346. irq_hw_number_t hw)
  347. {
  348. get_irq_desc(virq)->status |= IRQ_LEVEL;
  349. set_irq_chip(virq, &m82xx_pci_ic);
  350. return 0;
  351. }
  352. static void pci_host_unmap(struct irq_host *h, unsigned int virq)
  353. {
  354. /* remove chip and handler */
  355. set_irq_chip(virq, NULL);
  356. }
  357. static struct irq_host_ops pci_pic_host_ops = {
  358. .match = pci_pic_host_match,
  359. .map = pci_pic_host_map,
  360. .unmap = pci_host_unmap,
  361. };
  362. void m82xx_pci_init_irq(void)
  363. {
  364. int irq;
  365. cpm2_map_t *immap;
  366. struct device_node *np;
  367. struct resource r;
  368. const u32 *regs;
  369. unsigned int size;
  370. const u32 *irq_map;
  371. int i;
  372. unsigned int irq_max, irq_min;
  373. if ((np = of_find_node_by_type(NULL, "soc")) == NULL) {
  374. printk(KERN_INFO "No SOC node in device tree\n");
  375. return;
  376. }
  377. memset(&r, 0, sizeof(r));
  378. if (of_address_to_resource(np, 0, &r)) {
  379. printk(KERN_INFO "No SOC reg property in device tree\n");
  380. return;
  381. }
  382. immap = ioremap(r.start, sizeof(*immap));
  383. of_node_put(np);
  384. /* install the demultiplexer for the PCI cascade interrupt */
  385. np = of_find_node_by_type(NULL, "pci");
  386. if (!np) {
  387. printk(KERN_INFO "No pci node on device tree\n");
  388. iounmap(immap);
  389. return;
  390. }
  391. irq_map = get_property(np, "interrupt-map", &size);
  392. if ((!irq_map) || (size <= 7)) {
  393. printk(KERN_INFO "No interrupt-map property of pci node\n");
  394. iounmap(immap);
  395. return;
  396. }
  397. size /= sizeof(irq_map[0]);
  398. for (i = 0, irq_max = 0, irq_min = 512; i < size; i += 7, irq_map += 7) {
  399. if (irq_map[5] < irq_min)
  400. irq_min = irq_map[5];
  401. if (irq_map[5] > irq_max)
  402. irq_max = irq_map[5];
  403. }
  404. pci_int_base = irq_min;
  405. irq = irq_of_parse_and_map(np, 0);
  406. set_irq_chained_handler(irq, m82xx_pci_irq_demux);
  407. of_node_put(np);
  408. np = of_find_node_by_type(NULL, "pci-pic");
  409. if (!np) {
  410. printk(KERN_INFO "No pci pic node on device tree\n");
  411. iounmap(immap);
  412. return;
  413. }
  414. pci_pic_node = of_node_get(np);
  415. /* PCI interrupt controller registers: status and mask */
  416. regs = get_property(np, "reg", &size);
  417. if ((!regs) || (size <= 2)) {
  418. printk(KERN_INFO "No reg property in pci pic node\n");
  419. iounmap(immap);
  420. return;
  421. }
  422. pci_regs.pci_int_stat_reg =
  423. ioremap(regs[0], sizeof(*pci_regs.pci_int_stat_reg));
  424. pci_regs.pci_int_mask_reg =
  425. ioremap(regs[1], sizeof(*pci_regs.pci_int_mask_reg));
  426. of_node_put(np);
  427. /* configure chip select for PCI interrupt controller */
  428. immap->im_memctl.memc_br3 = regs[0] | 0x00001801;
  429. immap->im_memctl.memc_or3 = 0xffff8010;
  430. /* make PCI IRQ level sensitive */
  431. immap->im_intctl.ic_siexr &= ~(1 << (14 - (irq - SIU_INT_IRQ1)));
  432. /* mask all PCI interrupts */
  433. *pci_regs.pci_int_mask_reg |= 0xfff00000;
  434. iounmap(immap);
  435. pci_pic_host =
  436. irq_alloc_host(IRQ_HOST_MAP_LINEAR, irq_max - irq_min + 1,
  437. &pci_pic_host_ops, irq_max + 1);
  438. return;
  439. }
  440. static int m82xx_pci_exclude_device(u_char bus, u_char devfn)
  441. {
  442. if (bus == 0 && PCI_SLOT(devfn) == 0)
  443. return PCIBIOS_DEVICE_NOT_FOUND;
  444. else
  445. return PCIBIOS_SUCCESSFUL;
  446. }
  447. static void
  448. __init mpc82xx_pcibios_fixup(void)
  449. {
  450. struct pci_dev *dev = NULL;
  451. for_each_pci_dev(dev) {
  452. pci_read_irq_line(dev);
  453. }
  454. }
  455. void __init add_bridge(struct device_node *np)
  456. {
  457. int len;
  458. struct pci_controller *hose;
  459. struct resource r;
  460. const int *bus_range;
  461. const void *ptr;
  462. memset(&r, 0, sizeof(r));
  463. if (of_address_to_resource(np, 0, &r)) {
  464. printk(KERN_INFO "No PCI reg property in device tree\n");
  465. return;
  466. }
  467. if (!(ptr = get_property(np, "clock-frequency", NULL))) {
  468. printk(KERN_INFO "No clock-frequency property in PCI node");
  469. return;
  470. }
  471. pci_clk_frq = *(uint *) ptr;
  472. of_node_put(np);
  473. bus_range = get_property(np, "bus-range", &len);
  474. if (bus_range == NULL || len < 2 * sizeof(int)) {
  475. printk(KERN_WARNING "Can't get bus-range for %s, assume"
  476. " bus 0\n", np->full_name);
  477. }
  478. pci_assign_all_buses = 1;
  479. hose = pcibios_alloc_controller();
  480. if (!hose)
  481. return;
  482. hose->arch_data = np;
  483. hose->set_cfg_type = 1;
  484. hose->first_busno = bus_range ? bus_range[0] : 0;
  485. hose->last_busno = bus_range ? bus_range[1] : 0xff;
  486. hose->bus_offset = 0;
  487. hose->set_cfg_type = 1;
  488. setup_indirect_pci(hose,
  489. r.start + offsetof(pci_cpm2_t, pci_cfg_addr),
  490. r.start + offsetof(pci_cpm2_t, pci_cfg_data));
  491. pci_process_bridge_OF_ranges(hose, np, 1);
  492. }
  493. #endif
  494. /*
  495. * Setup the architecture
  496. */
  497. static void __init mpc82xx_ads_setup_arch(void)
  498. {
  499. #ifdef CONFIG_PCI
  500. struct device_node *np;
  501. #endif
  502. if (ppc_md.progress)
  503. ppc_md.progress("mpc82xx_ads_setup_arch()", 0);
  504. cpm2_reset();
  505. /* Map I/O region to a 256MB BAT */
  506. m82xx_board_setup();
  507. #ifdef CONFIG_PCI
  508. ppc_md.pci_exclude_device = m82xx_pci_exclude_device;
  509. for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
  510. add_bridge(np);
  511. of_node_put(np);
  512. ppc_md.pci_map_irq = NULL;
  513. ppc_md.pcibios_fixup = mpc82xx_pcibios_fixup;
  514. ppc_md.pcibios_fixup_bus = NULL;
  515. #endif
  516. #ifdef CONFIG_ROOT_NFS
  517. ROOT_DEV = Root_NFS;
  518. #else
  519. ROOT_DEV = Root_HDA1;
  520. #endif
  521. if (ppc_md.progress)
  522. ppc_md.progress("mpc82xx_ads_setup_arch(), finish", 0);
  523. }
  524. /*
  525. * Called very early, device-tree isn't unflattened
  526. */
  527. static int __init mpc82xx_ads_probe(void)
  528. {
  529. /* We always match for now, eventually we should look at
  530. * the flat dev tree to ensure this is the board we are
  531. * supposed to run on
  532. */
  533. return 1;
  534. }
  535. #define RMR_CSRE 0x00000001
  536. static void m82xx_restart(char *cmd)
  537. {
  538. __volatile__ unsigned char dummy;
  539. local_irq_disable();
  540. ((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= RMR_CSRE;
  541. /* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
  542. mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
  543. dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
  544. printk("Restart failed\n");
  545. while (1) ;
  546. }
  547. static void m82xx_halt(void)
  548. {
  549. local_irq_disable();
  550. while (1) ;
  551. }
  552. define_machine(mpc82xx_ads)
  553. {
  554. .name = "MPC82xx ADS",
  555. .probe = mpc82xx_ads_probe,
  556. .setup_arch = mpc82xx_ads_setup_arch,
  557. .init_IRQ = mpc82xx_ads_pic_init,
  558. .show_cpuinfo = mpc82xx_ads_show_cpuinfo,
  559. .get_irq = cpm2_get_irq,
  560. .calibrate_decr = m82xx_calibrate_decr,
  561. .restart = m82xx_restart,.halt = m82xx_halt,
  562. };