k2.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /*
  2. * arch/ppc/platforms/k2.c
  3. *
  4. * Board setup routines for SBS K2
  5. *
  6. * Author: Matt Porter <mporter@mvista.com>
  7. *
  8. * Updated by: Randy Vinson <rvinson@mvista.com.
  9. *
  10. * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
  11. * the terms of the GNU General Public License version 2. This program
  12. * is licensed "as is" without any warranty of any kind, whether express
  13. * or implied.
  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/types.h>
  24. #include <linux/major.h>
  25. #include <linux/initrd.h>
  26. #include <linux/console.h>
  27. #include <linux/delay.h>
  28. #include <linux/ide.h>
  29. #include <linux/irq.h>
  30. #include <linux/seq_file.h>
  31. #include <linux/root_dev.h>
  32. #include <asm/system.h>
  33. #include <asm/pgtable.h>
  34. #include <asm/page.h>
  35. #include <asm/dma.h>
  36. #include <asm/io.h>
  37. #include <asm/machdep.h>
  38. #include <asm/time.h>
  39. #include <asm/i8259.h>
  40. #include <asm/todc.h>
  41. #include <asm/bootinfo.h>
  42. #include <syslib/cpc710.h>
  43. #include "k2.h"
  44. extern unsigned long loops_per_jiffy;
  45. extern void gen550_progress(char *, unsigned short);
  46. static unsigned int cpu_7xx[16] = {
  47. 0, 15, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
  48. };
  49. static unsigned int cpu_6xx[16] = {
  50. 0, 0, 14, 0, 0, 13, 5, 9, 6, 11, 8, 10, 0, 12, 7, 0
  51. };
  52. static inline int __init
  53. k2_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  54. {
  55. struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
  56. /*
  57. * Check our hose index. If we are zero then we are on the
  58. * local PCI hose, otherwise we are on the cPCI hose.
  59. */
  60. if (!hose->index) {
  61. static char pci_irq_table[][4] =
  62. /*
  63. * PCI IDSEL/INTPIN->INTLINE
  64. * A B C D
  65. */
  66. {
  67. {1, 0, 0, 0}, /* Ethernet */
  68. {5, 5, 5, 5}, /* PMC Site 1 */
  69. {6, 6, 6, 6}, /* PMC Site 2 */
  70. {0, 0, 0, 0}, /* unused */
  71. {0, 0, 0, 0}, /* unused */
  72. {0, 0, 0, 0}, /* PCI-ISA Bridge */
  73. {0, 0, 0, 0}, /* unused */
  74. {0, 0, 0, 0}, /* unused */
  75. {0, 0, 0, 0}, /* unused */
  76. {0, 0, 0, 0}, /* unused */
  77. {0, 0, 0, 0}, /* unused */
  78. {0, 0, 0, 0}, /* unused */
  79. {0, 0, 0, 0}, /* unused */
  80. {0, 0, 0, 0}, /* unused */
  81. {15, 0, 0, 0}, /* M5229 IDE */
  82. };
  83. const long min_idsel = 3, max_idsel = 17, irqs_per_slot = 4;
  84. return PCI_IRQ_TABLE_LOOKUP;
  85. } else {
  86. static char pci_irq_table[][4] =
  87. /*
  88. * PCI IDSEL/INTPIN->INTLINE
  89. * A B C D
  90. */
  91. {
  92. {10, 11, 12, 9}, /* cPCI slot 8 */
  93. {11, 12, 9, 10}, /* cPCI slot 7 */
  94. {12, 9, 10, 11}, /* cPCI slot 6 */
  95. {9, 10, 11, 12}, /* cPCI slot 5 */
  96. {10, 11, 12, 9}, /* cPCI slot 4 */
  97. {11, 12, 9, 10}, /* cPCI slot 3 */
  98. {12, 9, 10, 11}, /* cPCI slot 2 */
  99. };
  100. const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4;
  101. return PCI_IRQ_TABLE_LOOKUP;
  102. }
  103. }
  104. void k2_pcibios_fixup(void)
  105. {
  106. #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
  107. struct pci_dev *ide_dev;
  108. /*
  109. * Enable DMA support on hdc
  110. */
  111. ide_dev = pci_get_device(PCI_VENDOR_ID_AL,
  112. PCI_DEVICE_ID_AL_M5229, NULL);
  113. if (ide_dev) {
  114. unsigned long ide_dma_base;
  115. ide_dma_base = pci_resource_start(ide_dev, 4);
  116. outb(0x00, ide_dma_base + 0x2);
  117. outb(0x20, ide_dma_base + 0xa);
  118. pci_dev_put(ide_dev);
  119. }
  120. #endif
  121. }
  122. void k2_pcibios_fixup_resources(struct pci_dev *dev)
  123. {
  124. int i;
  125. if ((dev->vendor == PCI_VENDOR_ID_IBM) &&
  126. (dev->device == PCI_DEVICE_ID_IBM_CPC710_PCI64)) {
  127. pr_debug("Fixup CPC710 resources\n");
  128. for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
  129. dev->resource[i].start = 0;
  130. dev->resource[i].end = 0;
  131. }
  132. }
  133. }
  134. void k2_setup_hoses(void)
  135. {
  136. struct pci_controller *hose_a, *hose_b;
  137. /*
  138. * Reconfigure CPC710 memory map so
  139. * we have some more PCI memory space.
  140. */
  141. /* Set FPHB mode */
  142. __raw_writel(0x808000e0, PGCHP); /* Set FPHB mode */
  143. /* PCI32 mappings */
  144. __raw_writel(0x00000000, K2_PCI32_BAR + PIBAR); /* PCI I/O base */
  145. __raw_writel(0x00000000, K2_PCI32_BAR + PMBAR); /* PCI Mem base */
  146. __raw_writel(0xf0000000, K2_PCI32_BAR + MSIZE); /* 256MB */
  147. __raw_writel(0xfff00000, K2_PCI32_BAR + IOSIZE); /* 1MB */
  148. __raw_writel(0xc0000000, K2_PCI32_BAR + SMBAR); /* Base@0xc0000000 */
  149. __raw_writel(0x80000000, K2_PCI32_BAR + SIBAR); /* Base@0x80000000 */
  150. __raw_writel(0x000000c0, K2_PCI32_BAR + PSSIZE); /* 1GB space */
  151. __raw_writel(0x000000c0, K2_PCI32_BAR + PPSIZE); /* 1GB space */
  152. __raw_writel(0x00000000, K2_PCI32_BAR + BARPS); /* Base@0x00000000 */
  153. __raw_writel(0x00000000, K2_PCI32_BAR + BARPP); /* Base@0x00000000 */
  154. __raw_writel(0x00000080, K2_PCI32_BAR + PSBAR); /* Base@0x80 */
  155. __raw_writel(0x00000000, K2_PCI32_BAR + PPBAR);
  156. __raw_writel(0xc0000000, K2_PCI32_BAR + BPMDLK);
  157. __raw_writel(0xd0000000, K2_PCI32_BAR + TPMDLK);
  158. __raw_writel(0x80000000, K2_PCI32_BAR + BIODLK);
  159. __raw_writel(0x80100000, K2_PCI32_BAR + TIODLK);
  160. __raw_writel(0xe0008000, K2_PCI32_BAR + DLKCTRL);
  161. __raw_writel(0xffffffff, K2_PCI32_BAR + DLKDEV);
  162. /* PCI64 mappings */
  163. __raw_writel(0x00100000, K2_PCI64_BAR + PIBAR); /* PCI I/O base */
  164. __raw_writel(0x10000000, K2_PCI64_BAR + PMBAR); /* PCI Mem base */
  165. __raw_writel(0xf0000000, K2_PCI64_BAR + MSIZE); /* 256MB */
  166. __raw_writel(0xfff00000, K2_PCI64_BAR + IOSIZE); /* 1MB */
  167. __raw_writel(0xd0000000, K2_PCI64_BAR + SMBAR); /* Base@0xd0000000 */
  168. __raw_writel(0x80100000, K2_PCI64_BAR + SIBAR); /* Base@0x80100000 */
  169. __raw_writel(0x000000c0, K2_PCI64_BAR + PSSIZE); /* 1GB space */
  170. __raw_writel(0x000000c0, K2_PCI64_BAR + PPSIZE); /* 1GB space */
  171. __raw_writel(0x00000000, K2_PCI64_BAR + BARPS); /* Base@0x00000000 */
  172. __raw_writel(0x00000000, K2_PCI64_BAR + BARPP); /* Base@0x00000000 */
  173. /* Setup PCI32 hose */
  174. hose_a = pcibios_alloc_controller();
  175. if (!hose_a)
  176. return;
  177. hose_a->first_busno = 0;
  178. hose_a->last_busno = 0xff;
  179. hose_a->pci_mem_offset = K2_PCI32_MEM_BASE;
  180. pci_init_resource(&hose_a->io_resource,
  181. K2_PCI32_LOWER_IO,
  182. K2_PCI32_UPPER_IO,
  183. IORESOURCE_IO, "PCI32 host bridge");
  184. pci_init_resource(&hose_a->mem_resources[0],
  185. K2_PCI32_LOWER_MEM + K2_PCI32_MEM_BASE,
  186. K2_PCI32_UPPER_MEM + K2_PCI32_MEM_BASE,
  187. IORESOURCE_MEM, "PCI32 host bridge");
  188. hose_a->io_space.start = K2_PCI32_LOWER_IO;
  189. hose_a->io_space.end = K2_PCI32_UPPER_IO;
  190. hose_a->mem_space.start = K2_PCI32_LOWER_MEM;
  191. hose_a->mem_space.end = K2_PCI32_UPPER_MEM;
  192. hose_a->io_base_virt = (void *)K2_ISA_IO_BASE;
  193. setup_indirect_pci(hose_a, K2_PCI32_CONFIG_ADDR, K2_PCI32_CONFIG_DATA);
  194. /* Initialize PCI32 bus registers */
  195. early_write_config_byte(hose_a,
  196. hose_a->first_busno,
  197. PCI_DEVFN(0, 0),
  198. CPC710_BUS_NUMBER, hose_a->first_busno);
  199. early_write_config_byte(hose_a,
  200. hose_a->first_busno,
  201. PCI_DEVFN(0, 0),
  202. CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
  203. /* Enable PCI interrupt polling */
  204. early_write_config_byte(hose_a,
  205. hose_a->first_busno,
  206. PCI_DEVFN(8, 0), 0x45, 0x80);
  207. /* Route polled PCI interrupts */
  208. early_write_config_byte(hose_a,
  209. hose_a->first_busno,
  210. PCI_DEVFN(8, 0), 0x48, 0x58);
  211. early_write_config_byte(hose_a,
  212. hose_a->first_busno,
  213. PCI_DEVFN(8, 0), 0x49, 0x07);
  214. early_write_config_byte(hose_a,
  215. hose_a->first_busno,
  216. PCI_DEVFN(8, 0), 0x4a, 0x31);
  217. early_write_config_byte(hose_a,
  218. hose_a->first_busno,
  219. PCI_DEVFN(8, 0), 0x4b, 0xb9);
  220. /* route secondary IDE channel interrupt to IRQ 15 */
  221. early_write_config_byte(hose_a,
  222. hose_a->first_busno,
  223. PCI_DEVFN(8, 0), 0x75, 0x0f);
  224. /* enable IDE controller IDSEL */
  225. early_write_config_byte(hose_a,
  226. hose_a->first_busno,
  227. PCI_DEVFN(8, 0), 0x58, 0x48);
  228. /* Enable IDE function */
  229. early_write_config_byte(hose_a,
  230. hose_a->first_busno,
  231. PCI_DEVFN(17, 0), 0x50, 0x03);
  232. /* Set M5229 IDE controller to native mode */
  233. early_write_config_byte(hose_a,
  234. hose_a->first_busno,
  235. PCI_DEVFN(17, 0), PCI_CLASS_PROG, 0xdf);
  236. hose_a->last_busno = pciauto_bus_scan(hose_a, hose_a->first_busno);
  237. /* Write out correct max subordinate bus number for hose A */
  238. early_write_config_byte(hose_a,
  239. hose_a->first_busno,
  240. PCI_DEVFN(0, 0),
  241. CPC710_SUB_BUS_NUMBER, hose_a->last_busno);
  242. /* Only setup PCI64 hose if we are in the system slot */
  243. if (!(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK)) {
  244. /* Setup PCI64 hose */
  245. hose_b = pcibios_alloc_controller();
  246. if (!hose_b)
  247. return;
  248. hose_b->first_busno = hose_a->last_busno + 1;
  249. hose_b->last_busno = 0xff;
  250. /* Reminder: quit changing the following, it is correct. */
  251. hose_b->pci_mem_offset = K2_PCI32_MEM_BASE;
  252. pci_init_resource(&hose_b->io_resource,
  253. K2_PCI64_LOWER_IO,
  254. K2_PCI64_UPPER_IO,
  255. IORESOURCE_IO, "PCI64 host bridge");
  256. pci_init_resource(&hose_b->mem_resources[0],
  257. K2_PCI64_LOWER_MEM + K2_PCI32_MEM_BASE,
  258. K2_PCI64_UPPER_MEM + K2_PCI32_MEM_BASE,
  259. IORESOURCE_MEM, "PCI64 host bridge");
  260. hose_b->io_space.start = K2_PCI64_LOWER_IO;
  261. hose_b->io_space.end = K2_PCI64_UPPER_IO;
  262. hose_b->mem_space.start = K2_PCI64_LOWER_MEM;
  263. hose_b->mem_space.end = K2_PCI64_UPPER_MEM;
  264. hose_b->io_base_virt = (void *)K2_ISA_IO_BASE;
  265. setup_indirect_pci(hose_b,
  266. K2_PCI64_CONFIG_ADDR, K2_PCI64_CONFIG_DATA);
  267. /* Initialize PCI64 bus registers */
  268. early_write_config_byte(hose_b,
  269. 0,
  270. PCI_DEVFN(0, 0),
  271. CPC710_SUB_BUS_NUMBER, 0xff);
  272. early_write_config_byte(hose_b,
  273. 0,
  274. PCI_DEVFN(0, 0),
  275. CPC710_BUS_NUMBER, hose_b->first_busno);
  276. hose_b->last_busno = pciauto_bus_scan(hose_b,
  277. hose_b->first_busno);
  278. /* Write out correct max subordinate bus number for hose B */
  279. early_write_config_byte(hose_b,
  280. hose_b->first_busno,
  281. PCI_DEVFN(0, 0),
  282. CPC710_SUB_BUS_NUMBER,
  283. hose_b->last_busno);
  284. /* Configure PCI64 PSBAR */
  285. early_write_config_dword(hose_b,
  286. hose_b->first_busno,
  287. PCI_DEVFN(0, 0),
  288. PCI_BASE_ADDRESS_0,
  289. K2_PCI64_SYS_MEM_BASE);
  290. }
  291. /* Configure i8259 level/edge settings */
  292. outb(0x62, 0x4d0);
  293. outb(0xde, 0x4d1);
  294. #ifdef CONFIG_CPC710_DATA_GATHERING
  295. {
  296. unsigned int tmp;
  297. tmp = __raw_readl(ABCNTL);
  298. /* Enable data gathering on both PCI interfaces */
  299. __raw_writel(tmp | 0x05000000, ABCNTL);
  300. }
  301. #endif
  302. ppc_md.pcibios_fixup = k2_pcibios_fixup;
  303. ppc_md.pcibios_fixup_resources = k2_pcibios_fixup_resources;
  304. ppc_md.pci_swizzle = common_swizzle;
  305. ppc_md.pci_map_irq = k2_map_irq;
  306. }
  307. static int k2_get_bus_speed(void)
  308. {
  309. int bus_speed;
  310. unsigned char board_id;
  311. board_id = *(unsigned char *)K2_BOARD_ID_REG;
  312. switch (K2_BUS_SPD(board_id)) {
  313. case 0:
  314. default:
  315. bus_speed = 100000000;
  316. break;
  317. case 1:
  318. bus_speed = 83333333;
  319. break;
  320. case 2:
  321. bus_speed = 75000000;
  322. break;
  323. case 3:
  324. bus_speed = 66666666;
  325. break;
  326. }
  327. return bus_speed;
  328. }
  329. static int k2_get_cpu_speed(void)
  330. {
  331. unsigned long hid1;
  332. int cpu_speed;
  333. hid1 = mfspr(SPRN_HID1) >> 28;
  334. if ((mfspr(SPRN_PVR) >> 16) == 8)
  335. hid1 = cpu_7xx[hid1];
  336. else
  337. hid1 = cpu_6xx[hid1];
  338. cpu_speed = k2_get_bus_speed() * hid1 / 2;
  339. return cpu_speed;
  340. }
  341. static void __init k2_calibrate_decr(void)
  342. {
  343. int freq, divisor = 4;
  344. /* determine processor bus speed */
  345. freq = k2_get_bus_speed();
  346. tb_ticks_per_jiffy = freq / HZ / divisor;
  347. tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
  348. }
  349. static int k2_show_cpuinfo(struct seq_file *m)
  350. {
  351. unsigned char k2_geo_bits, k2_system_slot;
  352. seq_printf(m, "vendor\t\t: SBS\n");
  353. seq_printf(m, "machine\t\t: K2\n");
  354. seq_printf(m, "cpu speed\t: %dMhz\n", k2_get_cpu_speed() / 1000000);
  355. seq_printf(m, "bus speed\t: %dMhz\n", k2_get_bus_speed() / 1000000);
  356. seq_printf(m, "memory type\t: SDRAM\n");
  357. k2_geo_bits = readb(K2_MSIZ_GEO_REG) & K2_GEO_ADR_MASK;
  358. k2_system_slot = !(readb(K2_MISC_REG) & K2_SYS_SLOT_MASK);
  359. seq_printf(m, "backplane\t: %s slot board",
  360. k2_system_slot ? "System" : "Non system");
  361. seq_printf(m, "with geographical address %x\n", k2_geo_bits);
  362. return 0;
  363. }
  364. TODC_ALLOC();
  365. static void __init k2_setup_arch(void)
  366. {
  367. unsigned int cpu;
  368. /* Setup TODC access */
  369. TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
  370. ioremap(K2_RTC_BASE_ADDRESS, K2_RTC_SIZE), 8);
  371. /* init to some ~sane value until calibrate_delay() runs */
  372. loops_per_jiffy = 50000000 / HZ;
  373. /* make FLASH transactions higher priority than PCI to avoid deadlock */
  374. __raw_writel(__raw_readl(SIOC1) | 0x80000000, SIOC1);
  375. /* Set hardware to access FLASH page 2 */
  376. __raw_writel(1 << 29, GPOUT);
  377. /* Setup PCI host bridges */
  378. k2_setup_hoses();
  379. #ifdef CONFIG_BLK_DEV_INITRD
  380. if (initrd_start)
  381. ROOT_DEV = Root_RAM0;
  382. else
  383. #endif
  384. #ifdef CONFIG_ROOT_NFS
  385. ROOT_DEV = Root_NFS;
  386. #else
  387. ROOT_DEV = Root_HDC1;
  388. #endif
  389. /* Identify the system */
  390. printk(KERN_INFO "System Identification: SBS K2 - PowerPC 750 @ "
  391. "%d Mhz\n", k2_get_cpu_speed() / 1000000);
  392. printk(KERN_INFO "Port by MontaVista Software, Inc. "
  393. "(source@mvista.com)\n");
  394. /* Identify the CPU manufacturer */
  395. cpu = PVR_REV(mfspr(SPRN_PVR));
  396. printk(KERN_INFO "CPU manufacturer: %s [rev=%04x]\n",
  397. (cpu & (1 << 15)) ? "IBM" : "Motorola", cpu);
  398. }
  399. static void k2_restart(char *cmd)
  400. {
  401. local_irq_disable();
  402. /* Flip FLASH back to page 1 to access firmware image */
  403. __raw_writel(0, GPOUT);
  404. /* SRR0 has system reset vector, SRR1 has default MSR value */
  405. /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
  406. mtspr(SPRN_SRR0, 0xfff00100);
  407. mtspr(SPRN_SRR1, 0);
  408. __asm__ __volatile__("rfi\n\t");
  409. /* not reached */
  410. for (;;) ;
  411. }
  412. static void k2_power_off(void)
  413. {
  414. for (;;) ;
  415. }
  416. static void k2_halt(void)
  417. {
  418. k2_restart(NULL);
  419. }
  420. /*
  421. * Set BAT 3 to map PCI32 I/O space.
  422. */
  423. static __inline__ void k2_set_bat(void)
  424. {
  425. /* wait for all outstanding memory accesses to complete */
  426. mb();
  427. /* setup DBATs */
  428. mtspr(SPRN_DBAT2U, 0x80001ffe);
  429. mtspr(SPRN_DBAT2L, 0x8000002a);
  430. mtspr(SPRN_DBAT3U, 0xf0001ffe);
  431. mtspr(SPRN_DBAT3L, 0xf000002a);
  432. /* wait for updates */
  433. mb();
  434. }
  435. static unsigned long __init k2_find_end_of_memory(void)
  436. {
  437. unsigned long total;
  438. unsigned char msize = 7; /* Default to 128MB */
  439. msize = K2_MEM_SIZE(readb(K2_MSIZ_GEO_REG));
  440. switch (msize) {
  441. case 2:
  442. /*
  443. * This will break without a lowered
  444. * KERNELBASE or CONFIG_HIGHMEM on.
  445. * It seems non 1GB builds exist yet,
  446. * though.
  447. */
  448. total = K2_MEM_SIZE_1GB;
  449. break;
  450. case 3:
  451. case 4:
  452. total = K2_MEM_SIZE_512MB;
  453. break;
  454. case 5:
  455. case 6:
  456. total = K2_MEM_SIZE_256MB;
  457. break;
  458. case 7:
  459. total = K2_MEM_SIZE_128MB;
  460. break;
  461. default:
  462. printk
  463. ("K2: Invalid memory size detected, defaulting to 128MB\n");
  464. total = K2_MEM_SIZE_128MB;
  465. break;
  466. }
  467. return total;
  468. }
  469. static void __init k2_map_io(void)
  470. {
  471. io_block_mapping(K2_PCI32_IO_BASE,
  472. K2_PCI32_IO_BASE, 0x00200000, _PAGE_IO);
  473. io_block_mapping(0xff000000, 0xff000000, 0x01000000, _PAGE_IO);
  474. }
  475. static void __init k2_init_irq(void)
  476. {
  477. int i;
  478. for (i = 0; i < 16; i++)
  479. irq_desc[i].handler = &i8259_pic;
  480. i8259_init(0);
  481. }
  482. void __init platform_init(unsigned long r3, unsigned long r4,
  483. unsigned long r5, unsigned long r6, unsigned long r7)
  484. {
  485. parse_bootinfo((struct bi_record *)(r3 + KERNELBASE));
  486. k2_set_bat();
  487. isa_io_base = K2_ISA_IO_BASE;
  488. isa_mem_base = K2_ISA_MEM_BASE;
  489. pci_dram_offset = K2_PCI32_SYS_MEM_BASE;
  490. ppc_md.setup_arch = k2_setup_arch;
  491. ppc_md.show_cpuinfo = k2_show_cpuinfo;
  492. ppc_md.init_IRQ = k2_init_irq;
  493. ppc_md.get_irq = i8259_irq;
  494. ppc_md.find_end_of_memory = k2_find_end_of_memory;
  495. ppc_md.setup_io_mappings = k2_map_io;
  496. ppc_md.restart = k2_restart;
  497. ppc_md.power_off = k2_power_off;
  498. ppc_md.halt = k2_halt;
  499. ppc_md.time_init = todc_time_init;
  500. ppc_md.set_rtc_time = todc_set_rtc_time;
  501. ppc_md.get_rtc_time = todc_get_rtc_time;
  502. ppc_md.calibrate_decr = k2_calibrate_decr;
  503. ppc_md.nvram_read_val = todc_direct_read_val;
  504. ppc_md.nvram_write_val = todc_direct_write_val;
  505. #ifdef CONFIG_SERIAL_TEXT_DEBUG
  506. ppc_md.progress = gen550_progress;
  507. #endif
  508. }