mpc10x_common.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /*
  2. * arch/ppc/syslib/mpc10x_common.c
  3. *
  4. * Common routines for the Motorola SPS MPC106, MPC107 and MPC8240 Host bridge,
  5. * Mem ctlr, EPIC, etc.
  6. *
  7. * Author: Mark A. Greer
  8. * mgreer@mvista.com
  9. *
  10. * 2001 (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. /*
  16. * *** WARNING - A BAT MUST be set to access the PCI config addr/data regs ***
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/pci.h>
  21. #include <linux/slab.h>
  22. #include <linux/serial_8250.h>
  23. #include <linux/fsl_devices.h>
  24. #include <linux/device.h>
  25. #include <asm/byteorder.h>
  26. #include <asm/io.h>
  27. #include <asm/irq.h>
  28. #include <asm/uaccess.h>
  29. #include <asm/machdep.h>
  30. #include <asm/pci-bridge.h>
  31. #include <asm/open_pic.h>
  32. #include <asm/mpc10x.h>
  33. #include <asm/ppc_sys.h>
  34. #ifdef CONFIG_MPC10X_OPENPIC
  35. #ifdef CONFIG_EPIC_SERIAL_MODE
  36. #define EPIC_IRQ_BASE (epic_serial_mode ? 16 : 5)
  37. #else
  38. #define EPIC_IRQ_BASE 5
  39. #endif
  40. #define MPC10X_I2C_IRQ (EPIC_IRQ_BASE + NUM_8259_INTERRUPTS)
  41. #define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS)
  42. #define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS)
  43. #define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS)
  44. #else
  45. #define MPC10X_I2C_IRQ -1
  46. #define MPC10X_DMA0_IRQ -1
  47. #define MPC10X_DMA1_IRQ -1
  48. #define MPC10X_UART0_IRQ -1
  49. #endif
  50. static struct fsl_i2c_platform_data mpc10x_i2c_pdata = {
  51. .device_flags = 0,
  52. };
  53. static struct plat_serial8250_port serial_platform_data[] = {
  54. [0] = {
  55. .mapbase = 0x4500,
  56. .iotype = UPIO_MEM,
  57. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  58. },
  59. [1] = {
  60. .mapbase = 0x4600,
  61. .iotype = UPIO_MEM,
  62. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  63. },
  64. { },
  65. };
  66. struct platform_device ppc_sys_platform_devices[] = {
  67. [MPC10X_IIC1] = {
  68. .name = "fsl-i2c",
  69. .id = 1,
  70. .dev.platform_data = &mpc10x_i2c_pdata,
  71. .num_resources = 2,
  72. .resource = (struct resource[]) {
  73. {
  74. .start = MPC10X_EUMB_I2C_OFFSET,
  75. .end = MPC10X_EUMB_I2C_OFFSET +
  76. MPC10X_EUMB_I2C_SIZE - 1,
  77. .flags = IORESOURCE_MEM,
  78. },
  79. {
  80. .flags = IORESOURCE_IRQ
  81. },
  82. },
  83. },
  84. [MPC10X_DMA0] = {
  85. .name = "fsl-dma",
  86. .id = 0,
  87. .num_resources = 2,
  88. .resource = (struct resource[]) {
  89. {
  90. .start = MPC10X_EUMB_DMA_OFFSET + 0x10,
  91. .end = MPC10X_EUMB_DMA_OFFSET + 0x1f,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. {
  95. .flags = IORESOURCE_IRQ,
  96. },
  97. },
  98. },
  99. [MPC10X_DMA1] = {
  100. .name = "fsl-dma",
  101. .id = 1,
  102. .num_resources = 2,
  103. .resource = (struct resource[]) {
  104. {
  105. .start = MPC10X_EUMB_DMA_OFFSET + 0x20,
  106. .end = MPC10X_EUMB_DMA_OFFSET + 0x2f,
  107. .flags = IORESOURCE_MEM,
  108. },
  109. {
  110. .flags = IORESOURCE_IRQ,
  111. },
  112. },
  113. },
  114. [MPC10X_DMA1] = {
  115. .name = "fsl-dma",
  116. .id = 1,
  117. .num_resources = 2,
  118. .resource = (struct resource[]) {
  119. {
  120. .start = MPC10X_EUMB_DMA_OFFSET + 0x20,
  121. .end = MPC10X_EUMB_DMA_OFFSET + 0x2f,
  122. .flags = IORESOURCE_MEM,
  123. },
  124. {
  125. .flags = IORESOURCE_IRQ,
  126. },
  127. },
  128. },
  129. [MPC10X_DUART] = {
  130. .name = "serial8250",
  131. .id = 0,
  132. .dev.platform_data = serial_platform_data,
  133. },
  134. };
  135. /* We use the PCI ID to match on */
  136. struct ppc_sys_spec *cur_ppc_sys_spec;
  137. struct ppc_sys_spec ppc_sys_specs[] = {
  138. {
  139. .ppc_sys_name = "8245",
  140. .mask = 0xFFFFFFFF,
  141. .value = MPC10X_BRIDGE_8245,
  142. .num_devices = 4,
  143. .device_list = (enum ppc_sys_devices[])
  144. {
  145. MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_DUART,
  146. },
  147. },
  148. {
  149. .ppc_sys_name = "8240",
  150. .mask = 0xFFFFFFFF,
  151. .value = MPC10X_BRIDGE_8240,
  152. .num_devices = 3,
  153. .device_list = (enum ppc_sys_devices[])
  154. {
  155. MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1,
  156. },
  157. },
  158. {
  159. .ppc_sys_name = "107",
  160. .mask = 0xFFFFFFFF,
  161. .value = MPC10X_BRIDGE_107,
  162. .num_devices = 3,
  163. .device_list = (enum ppc_sys_devices[])
  164. {
  165. MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1,
  166. },
  167. },
  168. { /* default match */
  169. .ppc_sys_name = "",
  170. .mask = 0x00000000,
  171. .value = 0x00000000,
  172. },
  173. };
  174. /* Set resources to match bridge memory map */
  175. void __init
  176. mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
  177. {
  178. switch (map) {
  179. case MPC10X_MEM_MAP_A:
  180. pci_init_resource(&hose->io_resource,
  181. 0x00000000,
  182. 0x3f7fffff,
  183. IORESOURCE_IO,
  184. "PCI host bridge");
  185. pci_init_resource (&hose->mem_resources[0],
  186. 0xc0000000,
  187. 0xfeffffff,
  188. IORESOURCE_MEM,
  189. "PCI host bridge");
  190. break;
  191. case MPC10X_MEM_MAP_B:
  192. pci_init_resource(&hose->io_resource,
  193. 0x00000000,
  194. 0x00bfffff,
  195. IORESOURCE_IO,
  196. "PCI host bridge");
  197. pci_init_resource (&hose->mem_resources[0],
  198. 0x80000000,
  199. 0xfcffffff,
  200. IORESOURCE_MEM,
  201. "PCI host bridge");
  202. break;
  203. default:
  204. printk("mpc10x_bridge_set_resources: "
  205. "Invalid map specified\n");
  206. if (ppc_md.progress)
  207. ppc_md.progress("mpc10x:exit1", 0x100);
  208. }
  209. }
  210. /*
  211. * Do some initialization and put the EUMB registers at the specified address
  212. * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set).
  213. *
  214. * The EPIC is not on the 106, only the 8240 and 107.
  215. */
  216. int __init
  217. mpc10x_bridge_init(struct pci_controller *hose,
  218. uint current_map,
  219. uint new_map,
  220. uint phys_eumb_base)
  221. {
  222. int host_bridge, picr1, picr1_bit, i;
  223. ulong pci_config_addr, pci_config_data;
  224. u_char pir, byte;
  225. if (ppc_md.progress) ppc_md.progress("mpc10x:enter", 0x100);
  226. /* Set up for current map so we can get at config regs */
  227. switch (current_map) {
  228. case MPC10X_MEM_MAP_A:
  229. setup_indirect_pci(hose,
  230. MPC10X_MAPA_CNFG_ADDR,
  231. MPC10X_MAPA_CNFG_DATA);
  232. break;
  233. case MPC10X_MEM_MAP_B:
  234. setup_indirect_pci(hose,
  235. MPC10X_MAPB_CNFG_ADDR,
  236. MPC10X_MAPB_CNFG_DATA);
  237. break;
  238. default:
  239. printk("mpc10x_bridge_init: %s\n",
  240. "Invalid current map specified");
  241. if (ppc_md.progress)
  242. ppc_md.progress("mpc10x:exit1", 0x100);
  243. return -1;
  244. }
  245. /* Make sure it's a supported bridge */
  246. early_read_config_dword(hose,
  247. 0,
  248. PCI_DEVFN(0,0),
  249. PCI_VENDOR_ID,
  250. &host_bridge);
  251. switch (host_bridge) {
  252. case MPC10X_BRIDGE_106:
  253. case MPC10X_BRIDGE_8240:
  254. case MPC10X_BRIDGE_107:
  255. case MPC10X_BRIDGE_8245:
  256. break;
  257. default:
  258. if (ppc_md.progress)
  259. ppc_md.progress("mpc10x:exit2", 0x100);
  260. return -1;
  261. }
  262. switch (new_map) {
  263. case MPC10X_MEM_MAP_A:
  264. MPC10X_SETUP_HOSE(hose, A);
  265. pci_config_addr = MPC10X_MAPA_CNFG_ADDR;
  266. pci_config_data = MPC10X_MAPA_CNFG_DATA;
  267. picr1_bit = MPC10X_CFG_PICR1_ADDR_MAP_A;
  268. break;
  269. case MPC10X_MEM_MAP_B:
  270. MPC10X_SETUP_HOSE(hose, B);
  271. pci_config_addr = MPC10X_MAPB_CNFG_ADDR;
  272. pci_config_data = MPC10X_MAPB_CNFG_DATA;
  273. picr1_bit = MPC10X_CFG_PICR1_ADDR_MAP_B;
  274. break;
  275. default:
  276. printk("mpc10x_bridge_init: %s\n",
  277. "Invalid new map specified");
  278. if (ppc_md.progress)
  279. ppc_md.progress("mpc10x:exit3", 0x100);
  280. return -1;
  281. }
  282. /* Make bridge use the 'new_map', if not already usng it */
  283. if (current_map != new_map) {
  284. early_read_config_dword(hose,
  285. 0,
  286. PCI_DEVFN(0,0),
  287. MPC10X_CFG_PICR1_REG,
  288. &picr1);
  289. picr1 = (picr1 & ~MPC10X_CFG_PICR1_ADDR_MAP_MASK) |
  290. picr1_bit;
  291. early_write_config_dword(hose,
  292. 0,
  293. PCI_DEVFN(0,0),
  294. MPC10X_CFG_PICR1_REG,
  295. picr1);
  296. asm volatile("sync");
  297. /* Undo old mappings & map in new cfg data/addr regs */
  298. iounmap((void *)hose->cfg_addr);
  299. iounmap((void *)hose->cfg_data);
  300. setup_indirect_pci(hose,
  301. pci_config_addr,
  302. pci_config_data);
  303. }
  304. /* Setup resources to match map */
  305. mpc10x_bridge_set_resources(new_map, hose);
  306. /*
  307. * Want processor accesses of 0xFDxxxxxx to be mapped
  308. * to PCI memory space at 0x00000000. Do not want
  309. * host bridge to respond to PCI memory accesses of
  310. * 0xFDxxxxxx. Do not want host bridge to respond
  311. * to PCI memory addresses 0xFD000000-0xFDFFFFFF;
  312. * want processor accesses from 0x000A0000-0x000BFFFF
  313. * to be forwarded to system memory.
  314. *
  315. * Only valid if not in agent mode and using MAP B.
  316. */
  317. if (new_map == MPC10X_MEM_MAP_B) {
  318. early_read_config_byte(hose,
  319. 0,
  320. PCI_DEVFN(0,0),
  321. MPC10X_CFG_MAPB_OPTIONS_REG,
  322. &byte);
  323. byte &= ~(MPC10X_CFG_MAPB_OPTIONS_PFAE |
  324. MPC10X_CFG_MAPB_OPTIONS_PCICH |
  325. MPC10X_CFG_MAPB_OPTIONS_PROCCH);
  326. if (host_bridge != MPC10X_BRIDGE_106) {
  327. byte |= MPC10X_CFG_MAPB_OPTIONS_CFAE;
  328. }
  329. early_write_config_byte(hose,
  330. 0,
  331. PCI_DEVFN(0,0),
  332. MPC10X_CFG_MAPB_OPTIONS_REG,
  333. byte);
  334. }
  335. if (host_bridge != MPC10X_BRIDGE_106) {
  336. early_read_config_byte(hose,
  337. 0,
  338. PCI_DEVFN(0,0),
  339. MPC10X_CFG_PIR_REG,
  340. &pir);
  341. if (pir != MPC10X_CFG_PIR_HOST_BRIDGE) {
  342. printk("Host bridge in Agent mode\n");
  343. /* Read or Set LMBAR & PCSRBAR? */
  344. }
  345. /* Set base addr of the 8240/107 EUMB. */
  346. early_write_config_dword(hose,
  347. 0,
  348. PCI_DEVFN(0,0),
  349. MPC10X_CFG_EUMBBAR,
  350. phys_eumb_base);
  351. #ifdef CONFIG_MPC10X_OPENPIC
  352. /* Map EPIC register part of EUMB into vitual memory - PCORE
  353. uses an i8259 instead of EPIC. */
  354. OpenPIC_Addr =
  355. ioremap(phys_eumb_base + MPC10X_EUMB_EPIC_OFFSET,
  356. MPC10X_EUMB_EPIC_SIZE);
  357. #endif
  358. }
  359. #ifdef CONFIG_MPC10X_STORE_GATHERING
  360. mpc10x_enable_store_gathering(hose);
  361. #else
  362. mpc10x_disable_store_gathering(hose);
  363. #endif
  364. /* setup platform devices for MPC10x bridges */
  365. identify_ppc_sys_by_id (host_bridge);
  366. for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
  367. unsigned int dev_id = cur_ppc_sys_spec->device_list[i];
  368. ppc_sys_fixup_mem_resource(&ppc_sys_platform_devices[dev_id],
  369. phys_eumb_base);
  370. }
  371. /* IRQ's are determined at runtime */
  372. ppc_sys_platform_devices[MPC10X_IIC1].resource[1].start = MPC10X_I2C_IRQ;
  373. ppc_sys_platform_devices[MPC10X_IIC1].resource[1].end = MPC10X_I2C_IRQ;
  374. ppc_sys_platform_devices[MPC10X_DMA0].resource[1].start = MPC10X_DMA0_IRQ;
  375. ppc_sys_platform_devices[MPC10X_DMA0].resource[1].end = MPC10X_DMA0_IRQ;
  376. ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ;
  377. ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ;
  378. serial_platform_data[0].mapbase += phys_eumb_base;
  379. serial_platform_data[0].irq = MPC10X_UART0_IRQ;
  380. serial_platform_data[1].mapbase += phys_eumb_base;
  381. serial_platform_data[1].irq = MPC10X_UART0_IRQ + 1;
  382. /*
  383. * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
  384. * PCI reads may return stale data so turn off.
  385. */
  386. if ((host_bridge == MPC10X_BRIDGE_8240)
  387. || (host_bridge == MPC10X_BRIDGE_8245)
  388. || (host_bridge == MPC10X_BRIDGE_107)) {
  389. early_read_config_dword(hose, 0, PCI_DEVFN(0,0),
  390. MPC10X_CFG_PICR1_REG, &picr1);
  391. picr1 &= ~MPC10X_CFG_PICR1_SPEC_PCI_RD;
  392. early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
  393. MPC10X_CFG_PICR1_REG, picr1);
  394. }
  395. /*
  396. * 8241/8245 erratum 28: PCI reads from local memory may return
  397. * stale data. Workaround by setting PICR2[0] to disable copyback
  398. * optimization. Oddly, the latest available user manual for the
  399. * 8245 (Rev 2., dated 10/2003) says PICR2[0] is reserverd.
  400. */
  401. if (host_bridge == MPC10X_BRIDGE_8245) {
  402. u32 picr2;
  403. early_read_config_dword(hose, 0, PCI_DEVFN(0,0),
  404. MPC10X_CFG_PICR2_REG, &picr2);
  405. picr2 |= MPC10X_CFG_PICR2_COPYBACK_OPT;
  406. early_write_config_dword(hose, 0, PCI_DEVFN(0,0),
  407. MPC10X_CFG_PICR2_REG, picr2);
  408. }
  409. if (ppc_md.progress) ppc_md.progress("mpc10x:exit", 0x100);
  410. return 0;
  411. }
  412. /*
  413. * Need to make our own PCI config space access macros because
  414. * mpc10x_get_mem_size() is called before the data structures are set up for
  415. * the 'early_xxx' and 'indirect_xxx' routines to work.
  416. * Assumes bus 0.
  417. */
  418. #define MPC10X_CFG_read(val, addr, type, op) *val = op((type)(addr))
  419. #define MPC10X_CFG_write(val, addr, type, op) op((type *)(addr), (val))
  420. #define MPC10X_PCI_OP(rw, size, type, op, mask) \
  421. static void \
  422. mpc10x_##rw##_config_##size(uint *cfg_addr, uint *cfg_data, int devfn, int offset, type val) \
  423. { \
  424. out_be32(cfg_addr, \
  425. ((offset & 0xfc) << 24) | (devfn << 16) \
  426. | (0 << 8) | 0x80); \
  427. MPC10X_CFG_##rw(val, cfg_data + (offset & mask), type, op); \
  428. return; \
  429. }
  430. MPC10X_PCI_OP(read, byte, u8 *, in_8, 3)
  431. MPC10X_PCI_OP(read, dword, u32 *, in_le32, 0)
  432. #if 0 /* Not used */
  433. MPC10X_PCI_OP(write, byte, u8, out_8, 3)
  434. MPC10X_PCI_OP(read, word, u16 *, in_le16, 2)
  435. MPC10X_PCI_OP(write, word, u16, out_le16, 2)
  436. MPC10X_PCI_OP(write, dword, u32, out_le32, 0)
  437. #endif
  438. /*
  439. * Read the memory controller registers to determine the amount of memory in
  440. * the system. This assumes that the firmware has correctly set up the memory
  441. * controller registers.
  442. */
  443. unsigned long __init
  444. mpc10x_get_mem_size(uint mem_map)
  445. {
  446. uint *config_addr, *config_data, val;
  447. ulong start, end, total, offset;
  448. int i;
  449. u_char bank_enables;
  450. switch (mem_map) {
  451. case MPC10X_MEM_MAP_A:
  452. config_addr = (uint *)MPC10X_MAPA_CNFG_ADDR;
  453. config_data = (uint *)MPC10X_MAPA_CNFG_DATA;
  454. break;
  455. case MPC10X_MEM_MAP_B:
  456. config_addr = (uint *)MPC10X_MAPB_CNFG_ADDR;
  457. config_data = (uint *)MPC10X_MAPB_CNFG_DATA;
  458. break;
  459. default:
  460. return 0;
  461. }
  462. mpc10x_read_config_byte(config_addr,
  463. config_data,
  464. PCI_DEVFN(0,0),
  465. MPC10X_MCTLR_MEM_BANK_ENABLES,
  466. &bank_enables);
  467. total = 0;
  468. for (i=0; i<8; i++) {
  469. if (bank_enables & (1 << i)) {
  470. offset = MPC10X_MCTLR_MEM_START_1 + ((i > 3) ? 4 : 0);
  471. mpc10x_read_config_dword(config_addr,
  472. config_data,
  473. PCI_DEVFN(0,0),
  474. offset,
  475. &val);
  476. start = (val >> ((i & 3) << 3)) & 0xff;
  477. offset = MPC10X_MCTLR_EXT_MEM_START_1 + ((i>3) ? 4 : 0);
  478. mpc10x_read_config_dword(config_addr,
  479. config_data,
  480. PCI_DEVFN(0,0),
  481. offset,
  482. &val);
  483. val = (val >> ((i & 3) << 3)) & 0x03;
  484. start = (val << 28) | (start << 20);
  485. offset = MPC10X_MCTLR_MEM_END_1 + ((i > 3) ? 4 : 0);
  486. mpc10x_read_config_dword(config_addr,
  487. config_data,
  488. PCI_DEVFN(0,0),
  489. offset,
  490. &val);
  491. end = (val >> ((i & 3) << 3)) & 0xff;
  492. offset = MPC10X_MCTLR_EXT_MEM_END_1 + ((i > 3) ? 4 : 0);
  493. mpc10x_read_config_dword(config_addr,
  494. config_data,
  495. PCI_DEVFN(0,0),
  496. offset,
  497. &val);
  498. val = (val >> ((i & 3) << 3)) & 0x03;
  499. end = (val << 28) | (end << 20) | 0xfffff;
  500. total += (end - start + 1);
  501. }
  502. }
  503. return total;
  504. }
  505. int __init
  506. mpc10x_enable_store_gathering(struct pci_controller *hose)
  507. {
  508. uint picr1;
  509. early_read_config_dword(hose,
  510. 0,
  511. PCI_DEVFN(0,0),
  512. MPC10X_CFG_PICR1_REG,
  513. &picr1);
  514. picr1 |= MPC10X_CFG_PICR1_ST_GATH_EN;
  515. early_write_config_dword(hose,
  516. 0,
  517. PCI_DEVFN(0,0),
  518. MPC10X_CFG_PICR1_REG,
  519. picr1);
  520. return 0;
  521. }
  522. int __init
  523. mpc10x_disable_store_gathering(struct pci_controller *hose)
  524. {
  525. uint picr1;
  526. early_read_config_dword(hose,
  527. 0,
  528. PCI_DEVFN(0,0),
  529. MPC10X_CFG_PICR1_REG,
  530. &picr1);
  531. picr1 &= ~MPC10X_CFG_PICR1_ST_GATH_EN;
  532. early_write_config_dword(hose,
  533. 0,
  534. PCI_DEVFN(0,0),
  535. MPC10X_CFG_PICR1_REG,
  536. picr1);
  537. return 0;
  538. }
  539. #ifdef CONFIG_MPC10X_OPENPIC
  540. void __init mpc10x_set_openpic(void)
  541. {
  542. /* Map external IRQs */
  543. openpic_set_sources(0, EPIC_IRQ_BASE, OpenPIC_Addr + 0x10200);
  544. /* Skip reserved space and map i2c and DMA Ch[01] */
  545. openpic_set_sources(EPIC_IRQ_BASE, 3, OpenPIC_Addr + 0x11020);
  546. /* Skip reserved space and map Message Unit Interrupt (I2O) */
  547. openpic_set_sources(EPIC_IRQ_BASE + 3, 1, OpenPIC_Addr + 0x110C0);
  548. /* Skip reserved space and map Serial Interupts */
  549. openpic_set_sources(EPIC_IRQ_BASE + 4, 2, OpenPIC_Addr + 0x11120);
  550. openpic_init(NUM_8259_INTERRUPTS);
  551. }
  552. #endif