mpc82xx_ads.c 15 KB

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