mpc85xx_cds_common.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * arch/ppc/platform/85xx/mpc85xx_cds_common.c
  3. *
  4. * MPC85xx CDS board specific routines
  5. *
  6. * Maintainer: Kumar Gala <kumar.gala@freescale.com>
  7. *
  8. * Copyright 2004 Freescale Semiconductor, Inc
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. */
  15. #include <linux/config.h>
  16. #include <linux/stddef.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/errno.h>
  20. #include <linux/reboot.h>
  21. #include <linux/pci.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/irq.h>
  27. #include <linux/seq_file.h>
  28. #include <linux/serial.h>
  29. #include <linux/module.h>
  30. #include <linux/root_dev.h>
  31. #include <linux/initrd.h>
  32. #include <linux/tty.h>
  33. #include <linux/serial_core.h>
  34. #include <linux/fsl_devices.h>
  35. #include <asm/system.h>
  36. #include <asm/pgtable.h>
  37. #include <asm/page.h>
  38. #include <asm/atomic.h>
  39. #include <asm/time.h>
  40. #include <asm/todc.h>
  41. #include <asm/io.h>
  42. #include <asm/machdep.h>
  43. #include <asm/prom.h>
  44. #include <asm/open_pic.h>
  45. #include <asm/i8259.h>
  46. #include <asm/bootinfo.h>
  47. #include <asm/pci-bridge.h>
  48. #include <asm/mpc85xx.h>
  49. #include <asm/irq.h>
  50. #include <asm/immap_85xx.h>
  51. #include <asm/immap_cpm2.h>
  52. #include <asm/ppc_sys.h>
  53. #include <asm/kgdb.h>
  54. #include <mm/mmu_decl.h>
  55. #include <syslib/cpm2_pic.h>
  56. #include <syslib/ppc85xx_common.h>
  57. #include <syslib/ppc85xx_setup.h>
  58. #ifndef CONFIG_PCI
  59. unsigned long isa_io_base = 0;
  60. unsigned long isa_mem_base = 0;
  61. #endif
  62. extern unsigned long total_memory; /* in mm/init */
  63. unsigned char __res[sizeof (bd_t)];
  64. static int cds_pci_slot = 2;
  65. static volatile u8 * cadmus;
  66. /* Internal interrupts are all Level Sensitive, and Positive Polarity */
  67. static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
  68. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */
  69. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */
  70. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */
  71. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */
  72. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */
  73. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */
  74. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */
  75. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */
  76. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */
  77. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */
  78. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */
  79. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */
  80. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */
  81. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */
  82. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */
  83. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */
  84. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */
  85. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */
  86. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */
  87. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */
  88. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */
  89. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */
  90. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */
  91. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */
  92. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */
  93. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */
  94. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */
  95. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */
  96. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */
  97. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */
  98. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */
  99. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */
  100. #if defined(CONFIG_PCI)
  101. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 0: PCI1 slot */
  102. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI1 slot */
  103. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI1 slot */
  104. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI1 slot */
  105. #else
  106. 0x0, /* External 0: */
  107. 0x0, /* External 1: */
  108. 0x0, /* External 2: */
  109. 0x0, /* External 3: */
  110. #endif
  111. 0x0, /* External 4: */
  112. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
  113. 0x0, /* External 6: */
  114. 0x0, /* External 7: */
  115. 0x0, /* External 8: */
  116. 0x0, /* External 9: */
  117. 0x0, /* External 10: */
  118. #if defined(CONFIG_85xx_PCI2) && defined(CONFIG_PCI)
  119. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 11: PCI2 slot 0 */
  120. #else
  121. 0x0, /* External 11: */
  122. #endif
  123. };
  124. /* ************************************************************************ */
  125. int
  126. mpc85xx_cds_show_cpuinfo(struct seq_file *m)
  127. {
  128. uint pvid, svid, phid1;
  129. uint memsize = total_memory;
  130. bd_t *binfo = (bd_t *) __res;
  131. unsigned int freq;
  132. /* get the core frequency */
  133. freq = binfo->bi_intfreq;
  134. pvid = mfspr(SPRN_PVR);
  135. svid = mfspr(SPRN_SVR);
  136. seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
  137. seq_printf(m, "Machine\t\t: CDS - MPC%s (%x)\n", cur_ppc_sys_spec->ppc_sys_name, cadmus[CM_VER]);
  138. seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
  139. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  140. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  141. /* Display cpu Pll setting */
  142. phid1 = mfspr(SPRN_HID1);
  143. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  144. /* Display the amount of memory */
  145. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  146. return 0;
  147. }
  148. #ifdef CONFIG_CPM2
  149. static void cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
  150. {
  151. while((irq = cpm2_get_irq(regs)) >= 0)
  152. __do_IRQ(irq, regs);
  153. }
  154. static struct irqaction cpm2_irqaction = {
  155. .handler = cpm2_cascade,
  156. .flags = SA_INTERRUPT,
  157. .mask = CPU_MASK_NONE,
  158. .name = "cpm2_cascade",
  159. };
  160. #endif /* CONFIG_CPM2 */
  161. void __init
  162. mpc85xx_cds_init_IRQ(void)
  163. {
  164. bd_t *binfo = (bd_t *) __res;
  165. int i;
  166. /* Determine the Physical Address of the OpenPIC regs */
  167. phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
  168. OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
  169. OpenPIC_InitSenses = mpc85xx_cds_openpic_initsenses;
  170. OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses);
  171. /* Skip reserved space and internal sources */
  172. openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
  173. /* Map PIC IRQs 0-11 */
  174. openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
  175. /* we let openpic interrupts starting from an offset, to
  176. * leave space for cascading interrupts underneath.
  177. */
  178. openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
  179. #ifdef CONFIG_PCI
  180. openpic_hookup_cascade(PIRQ0A, "82c59 cascade", i8259_irq);
  181. for (i = 0; i < NUM_8259_INTERRUPTS; i++)
  182. irq_desc[i].handler = &i8259_pic;
  183. i8259_init(0);
  184. #endif
  185. #ifdef CONFIG_CPM2
  186. /* Setup CPM2 PIC */
  187. cpm2_init_IRQ();
  188. setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
  189. #endif
  190. return;
  191. }
  192. #ifdef CONFIG_PCI
  193. /*
  194. * interrupt routing
  195. */
  196. int
  197. mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  198. {
  199. struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
  200. if (!hose->index)
  201. {
  202. /* Handle PCI1 interrupts */
  203. char pci_irq_table[][4] =
  204. /*
  205. * PCI IDSEL/INTPIN->INTLINE
  206. * A B C D
  207. */
  208. /* Note IRQ assignment for slots is based on which slot the elysium is
  209. * in -- in this setup elysium is in slot #2 (this PIRQA as first
  210. * interrupt on slot */
  211. {
  212. { 0, 1, 2, 3 }, /* 16 - PMC */
  213. { 0, 1, 2, 3 }, /* 17 P2P (Tsi320) */
  214. { 0, 1, 2, 3 }, /* 18 - Slot 1 */
  215. { 1, 2, 3, 0 }, /* 19 - Slot 2 */
  216. { 2, 3, 0, 1 }, /* 20 - Slot 3 */
  217. { 3, 0, 1, 2 }, /* 21 - Slot 4 */
  218. };
  219. const long min_idsel = 16, max_idsel = 21, irqs_per_slot = 4;
  220. int i, j;
  221. for (i = 0; i < 6; i++)
  222. for (j = 0; j < 4; j++)
  223. pci_irq_table[i][j] =
  224. ((pci_irq_table[i][j] + 5 -
  225. cds_pci_slot) & 0x3) + PIRQ0A;
  226. return PCI_IRQ_TABLE_LOOKUP;
  227. } else {
  228. /* Handle PCI2 interrupts (if we have one) */
  229. char pci_irq_table[][4] =
  230. {
  231. /*
  232. * We only have one slot and one interrupt
  233. * going to PIRQA - PIRQD */
  234. { PIRQ1A, PIRQ1A, PIRQ1A, PIRQ1A }, /* 21 - slot 0 */
  235. };
  236. const long min_idsel = 21, max_idsel = 21, irqs_per_slot = 4;
  237. return PCI_IRQ_TABLE_LOOKUP;
  238. }
  239. }
  240. #define ARCADIA_HOST_BRIDGE_IDSEL 17
  241. #define ARCADIA_2ND_BRIDGE_IDSEL 3
  242. extern int mpc85xx_pci1_last_busno;
  243. int
  244. mpc85xx_exclude_device(u_char bus, u_char devfn)
  245. {
  246. if (bus == 0 && PCI_SLOT(devfn) == 0)
  247. return PCIBIOS_DEVICE_NOT_FOUND;
  248. #ifdef CONFIG_85xx_PCI2
  249. if (mpc85xx_pci1_last_busno)
  250. if (bus == (mpc85xx_pci1_last_busno + 1) && PCI_SLOT(devfn) == 0)
  251. return PCIBIOS_DEVICE_NOT_FOUND;
  252. #endif
  253. /* We explicitly do not go past the Tundra 320 Bridge */
  254. if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
  255. return PCIBIOS_DEVICE_NOT_FOUND;
  256. if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
  257. return PCIBIOS_DEVICE_NOT_FOUND;
  258. else
  259. return PCIBIOS_SUCCESSFUL;
  260. }
  261. void __init
  262. mpc85xx_cds_enable_via(struct pci_controller *hose)
  263. {
  264. u32 pci_class;
  265. u16 vid, did;
  266. early_read_config_dword(hose, 0, 0x88, PCI_CLASS_REVISION, &pci_class);
  267. if ((pci_class >> 16) != PCI_CLASS_BRIDGE_PCI)
  268. return;
  269. /* Configure P2P so that we can reach bus 1 */
  270. early_write_config_byte(hose, 0, 0x88, PCI_PRIMARY_BUS, 0);
  271. early_write_config_byte(hose, 0, 0x88, PCI_SECONDARY_BUS, 1);
  272. early_write_config_byte(hose, 0, 0x88, PCI_SUBORDINATE_BUS, 0xff);
  273. early_read_config_word(hose, 1, 0x10, PCI_VENDOR_ID, &vid);
  274. early_read_config_word(hose, 1, 0x10, PCI_DEVICE_ID, &did);
  275. if ((vid != PCI_VENDOR_ID_VIA) ||
  276. (did != PCI_DEVICE_ID_VIA_82C686))
  277. return;
  278. /* Enable USB and IDE functions */
  279. early_write_config_byte(hose, 1, 0x10, 0x48, 0x08);
  280. }
  281. void __init
  282. mpc85xx_cds_fixup_via(struct pci_controller *hose)
  283. {
  284. u32 pci_class;
  285. u16 vid, did;
  286. early_read_config_dword(hose, 0, 0x88, PCI_CLASS_REVISION, &pci_class);
  287. if ((pci_class >> 16) != PCI_CLASS_BRIDGE_PCI)
  288. return;
  289. /*
  290. * Force the backplane P2P bridge to have a window
  291. * open from 0x00000000-0x00001fff in PCI I/O space.
  292. * This allows legacy I/O (i8259, etc) on the VIA
  293. * southbridge to be accessed.
  294. */
  295. early_write_config_byte(hose, 0, 0x88, PCI_IO_BASE, 0x00);
  296. early_write_config_word(hose, 0, 0x88, PCI_IO_BASE_UPPER16, 0x0000);
  297. early_write_config_byte(hose, 0, 0x88, PCI_IO_LIMIT, 0x10);
  298. early_write_config_word(hose, 0, 0x88, PCI_IO_LIMIT_UPPER16, 0x0000);
  299. early_read_config_word(hose, 1, 0x10, PCI_VENDOR_ID, &vid);
  300. early_read_config_word(hose, 1, 0x10, PCI_DEVICE_ID, &did);
  301. if ((vid != PCI_VENDOR_ID_VIA) ||
  302. (did != PCI_DEVICE_ID_VIA_82C686))
  303. return;
  304. /*
  305. * Since the P2P window was forced to cover the fixed
  306. * legacy I/O addresses, it is necessary to manually
  307. * place the base addresses for the IDE and USB functions
  308. * within this window.
  309. */
  310. /* Function 1, IDE */
  311. early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_0, 0x1ff8);
  312. early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_1, 0x1ff4);
  313. early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_2, 0x1fe8);
  314. early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_3, 0x1fe4);
  315. early_write_config_dword(hose, 1, 0x11, PCI_BASE_ADDRESS_4, 0x1fd0);
  316. /* Function 2, USB ports 0-1 */
  317. early_write_config_dword(hose, 1, 0x12, PCI_BASE_ADDRESS_4, 0x1fa0);
  318. /* Function 3, USB ports 2-3 */
  319. early_write_config_dword(hose, 1, 0x13, PCI_BASE_ADDRESS_4, 0x1f80);
  320. /* Function 5, Power Management */
  321. early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_0, 0x1e00);
  322. early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_1, 0x1dfc);
  323. early_write_config_dword(hose, 1, 0x15, PCI_BASE_ADDRESS_2, 0x1df8);
  324. /* Function 6, AC97 Interface */
  325. early_write_config_dword(hose, 1, 0x16, PCI_BASE_ADDRESS_0, 0x1c00);
  326. }
  327. void __init
  328. mpc85xx_cds_pcibios_fixup(void)
  329. {
  330. struct pci_dev *dev = NULL;
  331. u_char c;
  332. if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
  333. PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
  334. /*
  335. * U-Boot does not set the enable bits
  336. * for the IDE device. Force them on here.
  337. */
  338. pci_read_config_byte(dev, 0x40, &c);
  339. c |= 0x03; /* IDE: Chip Enable Bits */
  340. pci_write_config_byte(dev, 0x40, c);
  341. /*
  342. * Since only primary interface works, force the
  343. * IDE function to standard primary IDE interrupt
  344. * w/ 8259 offset
  345. */
  346. dev->irq = 14;
  347. pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
  348. }
  349. /*
  350. * Force legacy USB interrupt routing
  351. */
  352. if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
  353. PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
  354. dev->irq = 10;
  355. pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
  356. }
  357. if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
  358. PCI_DEVICE_ID_VIA_82C586_2, dev))) {
  359. dev->irq = 11;
  360. pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
  361. }
  362. }
  363. #endif /* CONFIG_PCI */
  364. TODC_ALLOC();
  365. /* ************************************************************************
  366. *
  367. * Setup the architecture
  368. *
  369. */
  370. static void __init
  371. mpc85xx_cds_setup_arch(void)
  372. {
  373. bd_t *binfo = (bd_t *) __res;
  374. unsigned int freq;
  375. struct gianfar_platform_data *pdata;
  376. /* get the core frequency */
  377. freq = binfo->bi_intfreq;
  378. printk("mpc85xx_cds_setup_arch\n");
  379. #ifdef CONFIG_CPM2
  380. cpm2_reset();
  381. #endif
  382. cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE);
  383. cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
  384. printk("CDS Version = %x in PCI slot %d\n", cadmus[CM_VER], cds_pci_slot);
  385. /* Setup TODC access */
  386. TODC_INIT(TODC_TYPE_DS1743,
  387. 0,
  388. 0,
  389. ioremap(CDS_RTC_ADDR, CDS_RTC_SIZE),
  390. 8);
  391. /* Set loops_per_jiffy to a half-way reasonable value,
  392. for use until calibrate_delay gets called. */
  393. loops_per_jiffy = freq / HZ;
  394. #ifdef CONFIG_PCI
  395. /* VIA IDE configuration */
  396. ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup;
  397. /* setup PCI host bridges */
  398. mpc85xx_setup_hose();
  399. #endif
  400. #ifdef CONFIG_SERIAL_8250
  401. mpc85xx_early_serial_map();
  402. #endif
  403. #ifdef CONFIG_SERIAL_TEXT_DEBUG
  404. /* Invalidate the entry we stole earlier the serial ports
  405. * should be properly mapped */
  406. invalidate_tlbcam_entry(NUM_TLBCAMS - 1);
  407. #endif
  408. /* setup the board related information for the enet controllers */
  409. pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
  410. pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
  411. pdata->interruptPHY = MPC85xx_IRQ_EXT5;
  412. pdata->phyid = 0;
  413. /* fixup phy address */
  414. pdata->phy_reg_addr += binfo->bi_immr_base;
  415. memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
  416. pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
  417. pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
  418. pdata->interruptPHY = MPC85xx_IRQ_EXT5;
  419. pdata->phyid = 1;
  420. /* fixup phy address */
  421. pdata->phy_reg_addr += binfo->bi_immr_base;
  422. memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
  423. #ifdef CONFIG_BLK_DEV_INITRD
  424. if (initrd_start)
  425. ROOT_DEV = Root_RAM0;
  426. else
  427. #endif
  428. #ifdef CONFIG_ROOT_NFS
  429. ROOT_DEV = Root_NFS;
  430. #else
  431. ROOT_DEV = Root_HDA1;
  432. #endif
  433. }
  434. /* ************************************************************************ */
  435. void __init
  436. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  437. unsigned long r6, unsigned long r7)
  438. {
  439. /* parse_bootinfo must always be called first */
  440. parse_bootinfo(find_bootinfo());
  441. /*
  442. * If we were passed in a board information, copy it into the
  443. * residual data area.
  444. */
  445. if (r3) {
  446. memcpy((void *) __res, (void *) (r3 + KERNELBASE),
  447. sizeof (bd_t));
  448. }
  449. #ifdef CONFIG_SERIAL_TEXT_DEBUG
  450. {
  451. bd_t *binfo = (bd_t *) __res;
  452. struct uart_port p;
  453. /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
  454. settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base,
  455. binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
  456. memset(&p, 0, sizeof (p));
  457. p.iotype = SERIAL_IO_MEM;
  458. p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
  459. p.uartclk = binfo->bi_busfreq;
  460. gen550_init(0, &p);
  461. memset(&p, 0, sizeof (p));
  462. p.iotype = SERIAL_IO_MEM;
  463. p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
  464. p.uartclk = binfo->bi_busfreq;
  465. gen550_init(1, &p);
  466. }
  467. #endif
  468. #if defined(CONFIG_BLK_DEV_INITRD)
  469. /*
  470. * If the init RAM disk has been configured in, and there's a valid
  471. * starting address for it, set it up.
  472. */
  473. if (r4) {
  474. initrd_start = r4 + KERNELBASE;
  475. initrd_end = r5 + KERNELBASE;
  476. }
  477. #endif /* CONFIG_BLK_DEV_INITRD */
  478. /* Copy the kernel command line arguments to a safe place. */
  479. if (r6) {
  480. *(char *) (r7 + KERNELBASE) = 0;
  481. strcpy(cmd_line, (char *) (r6 + KERNELBASE));
  482. }
  483. identify_ppc_sys_by_id(mfspr(SPRN_SVR));
  484. /* setup the PowerPC module struct */
  485. ppc_md.setup_arch = mpc85xx_cds_setup_arch;
  486. ppc_md.show_cpuinfo = mpc85xx_cds_show_cpuinfo;
  487. ppc_md.init_IRQ = mpc85xx_cds_init_IRQ;
  488. ppc_md.get_irq = openpic_get_irq;
  489. ppc_md.restart = mpc85xx_restart;
  490. ppc_md.power_off = mpc85xx_power_off;
  491. ppc_md.halt = mpc85xx_halt;
  492. ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
  493. ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
  494. ppc_md.time_init = todc_time_init;
  495. ppc_md.set_rtc_time = todc_set_rtc_time;
  496. ppc_md.get_rtc_time = todc_get_rtc_time;
  497. ppc_md.nvram_read_val = todc_direct_read_val;
  498. ppc_md.nvram_write_val = todc_direct_write_val;
  499. #if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
  500. ppc_md.progress = gen550_progress;
  501. #endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
  502. #if defined(CONFIG_SERIAL_8250) && defined(CONFIG_KGDB)
  503. ppc_md.early_serial_map = mpc85xx_early_serial_map;
  504. #endif /* CONFIG_SERIAL_8250 && CONFIG_KGDB */
  505. if (ppc_md.progress)
  506. ppc_md.progress("mpc85xx_cds_init(): exit", 0);
  507. return;
  508. }