mpc85xx_cds_common.c 16 KB

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