ops-tx4927.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /*
  2. * Define the pci_ops for the PCIC on Toshiba TX4927, TX4938, etc.
  3. *
  4. * Based on linux/arch/mips/pci/ops-tx4938.c,
  5. * linux/arch/mips/pci/fixup-rbtx4938.c,
  6. * linux/arch/mips/txx9/rbtx4938/setup.c,
  7. * and RBTX49xx patch from CELF patch archive.
  8. *
  9. * 2003-2005 (c) MontaVista Software, Inc.
  10. * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
  11. * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/irq.h>
  21. #include <asm/txx9/pci.h>
  22. #include <asm/txx9/tx4927pcic.h>
  23. static struct {
  24. struct pci_controller *channel;
  25. struct tx4927_pcic_reg __iomem *pcicptr;
  26. } pcicptrs[2]; /* TX4938 has 2 pcic */
  27. static void __init set_tx4927_pcicptr(struct pci_controller *channel,
  28. struct tx4927_pcic_reg __iomem *pcicptr)
  29. {
  30. int i;
  31. for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
  32. if (pcicptrs[i].channel == channel) {
  33. pcicptrs[i].pcicptr = pcicptr;
  34. return;
  35. }
  36. }
  37. for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
  38. if (!pcicptrs[i].channel) {
  39. pcicptrs[i].channel = channel;
  40. pcicptrs[i].pcicptr = pcicptr;
  41. return;
  42. }
  43. }
  44. BUG();
  45. }
  46. struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
  47. struct pci_controller *channel)
  48. {
  49. int i;
  50. for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
  51. if (pcicptrs[i].channel == channel)
  52. return pcicptrs[i].pcicptr;
  53. }
  54. return NULL;
  55. }
  56. static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where,
  57. struct tx4927_pcic_reg __iomem *pcicptr)
  58. {
  59. if (bus->parent == NULL &&
  60. devfn >= PCI_DEVFN(TX4927_PCIC_MAX_DEVNU, 0))
  61. return -1;
  62. __raw_writel(((bus->number & 0xff) << 0x10)
  63. | ((devfn & 0xff) << 0x08) | (where & 0xfc)
  64. | (bus->parent ? 1 : 0),
  65. &pcicptr->g2pcfgadrs);
  66. /* clear M_ABORT and Disable M_ABORT Int. */
  67. __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
  68. | (PCI_STATUS_REC_MASTER_ABORT << 16),
  69. &pcicptr->pcistatus);
  70. return 0;
  71. }
  72. static int check_abort(struct tx4927_pcic_reg __iomem *pcicptr)
  73. {
  74. int code = PCIBIOS_SUCCESSFUL;
  75. /* wait write cycle completion before checking error status */
  76. while (__raw_readl(&pcicptr->pcicstatus) & TX4927_PCIC_PCICSTATUS_IWB)
  77. ;
  78. if (__raw_readl(&pcicptr->pcistatus)
  79. & (PCI_STATUS_REC_MASTER_ABORT << 16)) {
  80. __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
  81. | (PCI_STATUS_REC_MASTER_ABORT << 16),
  82. &pcicptr->pcistatus);
  83. /* flush write buffer */
  84. iob();
  85. code = PCIBIOS_DEVICE_NOT_FOUND;
  86. }
  87. return code;
  88. }
  89. static u8 icd_readb(int offset, struct tx4927_pcic_reg __iomem *pcicptr)
  90. {
  91. #ifdef __BIG_ENDIAN
  92. offset ^= 3;
  93. #endif
  94. return __raw_readb((void __iomem *)&pcicptr->g2pcfgdata + offset);
  95. }
  96. static u16 icd_readw(int offset, struct tx4927_pcic_reg __iomem *pcicptr)
  97. {
  98. #ifdef __BIG_ENDIAN
  99. offset ^= 2;
  100. #endif
  101. return __raw_readw((void __iomem *)&pcicptr->g2pcfgdata + offset);
  102. }
  103. static u32 icd_readl(struct tx4927_pcic_reg __iomem *pcicptr)
  104. {
  105. return __raw_readl(&pcicptr->g2pcfgdata);
  106. }
  107. static void icd_writeb(u8 val, int offset,
  108. struct tx4927_pcic_reg __iomem *pcicptr)
  109. {
  110. #ifdef __BIG_ENDIAN
  111. offset ^= 3;
  112. #endif
  113. __raw_writeb(val, (void __iomem *)&pcicptr->g2pcfgdata + offset);
  114. }
  115. static void icd_writew(u16 val, int offset,
  116. struct tx4927_pcic_reg __iomem *pcicptr)
  117. {
  118. #ifdef __BIG_ENDIAN
  119. offset ^= 2;
  120. #endif
  121. __raw_writew(val, (void __iomem *)&pcicptr->g2pcfgdata + offset);
  122. }
  123. static void icd_writel(u32 val, struct tx4927_pcic_reg __iomem *pcicptr)
  124. {
  125. __raw_writel(val, &pcicptr->g2pcfgdata);
  126. }
  127. static struct tx4927_pcic_reg __iomem *pci_bus_to_pcicptr(struct pci_bus *bus)
  128. {
  129. struct pci_controller *channel = bus->sysdata;
  130. return get_tx4927_pcicptr(channel);
  131. }
  132. static int tx4927_pci_config_read(struct pci_bus *bus, unsigned int devfn,
  133. int where, int size, u32 *val)
  134. {
  135. struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus);
  136. if (mkaddr(bus, devfn, where, pcicptr)) {
  137. *val = 0xffffffff;
  138. return -1;
  139. }
  140. switch (size) {
  141. case 1:
  142. *val = icd_readb(where & 3, pcicptr);
  143. break;
  144. case 2:
  145. *val = icd_readw(where & 3, pcicptr);
  146. break;
  147. default:
  148. *val = icd_readl(pcicptr);
  149. }
  150. return check_abort(pcicptr);
  151. }
  152. static int tx4927_pci_config_write(struct pci_bus *bus, unsigned int devfn,
  153. int where, int size, u32 val)
  154. {
  155. struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus);
  156. if (mkaddr(bus, devfn, where, pcicptr))
  157. return -1;
  158. switch (size) {
  159. case 1:
  160. icd_writeb(val, where & 3, pcicptr);
  161. break;
  162. case 2:
  163. icd_writew(val, where & 3, pcicptr);
  164. break;
  165. default:
  166. icd_writel(val, pcicptr);
  167. }
  168. return check_abort(pcicptr);
  169. }
  170. static struct pci_ops tx4927_pci_ops = {
  171. .read = tx4927_pci_config_read,
  172. .write = tx4927_pci_config_write,
  173. };
  174. static struct {
  175. u8 trdyto;
  176. u8 retryto;
  177. u16 gbwc;
  178. } tx4927_pci_opts = {
  179. .trdyto = 0,
  180. .retryto = 0,
  181. .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */
  182. };
  183. char *tx4927_pcibios_setup(char *str)
  184. {
  185. if (!strncmp(str, "trdyto=", 7)) {
  186. u8 val = 0;
  187. if (kstrtou8(str + 7, 0, &val) == 0)
  188. tx4927_pci_opts.trdyto = val;
  189. return NULL;
  190. }
  191. if (!strncmp(str, "retryto=", 8)) {
  192. u8 val = 0;
  193. if (kstrtou8(str + 8, 0, &val) == 0)
  194. tx4927_pci_opts.retryto = val;
  195. return NULL;
  196. }
  197. if (!strncmp(str, "gbwc=", 5)) {
  198. u16 val;
  199. if (kstrtou16(str + 5, 0, &val) == 0)
  200. tx4927_pci_opts.gbwc = val;
  201. return NULL;
  202. }
  203. return str;
  204. }
  205. void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
  206. struct pci_controller *channel, int extarb)
  207. {
  208. int i;
  209. unsigned long flags;
  210. set_tx4927_pcicptr(channel, pcicptr);
  211. if (!channel->pci_ops)
  212. printk(KERN_INFO
  213. "PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
  214. __raw_readl(&pcicptr->pciid) >> 16,
  215. __raw_readl(&pcicptr->pciid) & 0xffff,
  216. __raw_readl(&pcicptr->pciccrev) & 0xff,
  217. extarb ? "External" : "Internal");
  218. channel->pci_ops = &tx4927_pci_ops;
  219. local_irq_save(flags);
  220. /* Disable All Initiator Space */
  221. __raw_writel(__raw_readl(&pcicptr->pciccfg)
  222. & ~(TX4927_PCIC_PCICCFG_G2PMEN(0)
  223. | TX4927_PCIC_PCICCFG_G2PMEN(1)
  224. | TX4927_PCIC_PCICCFG_G2PMEN(2)
  225. | TX4927_PCIC_PCICCFG_G2PIOEN),
  226. &pcicptr->pciccfg);
  227. /* GB->PCI mappings */
  228. __raw_writel((channel->io_resource->end - channel->io_resource->start)
  229. >> 4,
  230. &pcicptr->g2piomask);
  231. ____raw_writeq((channel->io_resource->start +
  232. channel->io_map_base - IO_BASE) |
  233. #ifdef __BIG_ENDIAN
  234. TX4927_PCIC_G2PIOGBASE_ECHG
  235. #else
  236. TX4927_PCIC_G2PIOGBASE_BSDIS
  237. #endif
  238. , &pcicptr->g2piogbase);
  239. ____raw_writeq(channel->io_resource->start - channel->io_offset,
  240. &pcicptr->g2piopbase);
  241. for (i = 0; i < 3; i++) {
  242. __raw_writel(0, &pcicptr->g2pmmask[i]);
  243. ____raw_writeq(0, &pcicptr->g2pmgbase[i]);
  244. ____raw_writeq(0, &pcicptr->g2pmpbase[i]);
  245. }
  246. if (channel->mem_resource->end) {
  247. __raw_writel((channel->mem_resource->end
  248. - channel->mem_resource->start) >> 4,
  249. &pcicptr->g2pmmask[0]);
  250. ____raw_writeq(channel->mem_resource->start |
  251. #ifdef __BIG_ENDIAN
  252. TX4927_PCIC_G2PMnGBASE_ECHG
  253. #else
  254. TX4927_PCIC_G2PMnGBASE_BSDIS
  255. #endif
  256. , &pcicptr->g2pmgbase[0]);
  257. ____raw_writeq(channel->mem_resource->start -
  258. channel->mem_offset,
  259. &pcicptr->g2pmpbase[0]);
  260. }
  261. /* PCI->GB mappings (I/O 256B) */
  262. __raw_writel(0, &pcicptr->p2giopbase); /* 256B */
  263. ____raw_writeq(0, &pcicptr->p2giogbase);
  264. /* PCI->GB mappings (MEM 512MB (64MB on R1.x)) */
  265. __raw_writel(0, &pcicptr->p2gm0plbase);
  266. __raw_writel(0, &pcicptr->p2gm0pubase);
  267. ____raw_writeq(TX4927_PCIC_P2GMnGBASE_TMEMEN |
  268. #ifdef __BIG_ENDIAN
  269. TX4927_PCIC_P2GMnGBASE_TECHG
  270. #else
  271. TX4927_PCIC_P2GMnGBASE_TBSDIS
  272. #endif
  273. , &pcicptr->p2gmgbase[0]);
  274. /* PCI->GB mappings (MEM 16MB) */
  275. __raw_writel(0xffffffff, &pcicptr->p2gm1plbase);
  276. __raw_writel(0xffffffff, &pcicptr->p2gm1pubase);
  277. ____raw_writeq(0, &pcicptr->p2gmgbase[1]);
  278. /* PCI->GB mappings (MEM 1MB) */
  279. __raw_writel(0xffffffff, &pcicptr->p2gm2pbase); /* 1MB */
  280. ____raw_writeq(0, &pcicptr->p2gmgbase[2]);
  281. /* Clear all (including IRBER) except for GBWC */
  282. __raw_writel((tx4927_pci_opts.gbwc << 16)
  283. & TX4927_PCIC_PCICCFG_GBWC_MASK,
  284. &pcicptr->pciccfg);
  285. /* Enable Initiator Memory Space */
  286. if (channel->mem_resource->end)
  287. __raw_writel(__raw_readl(&pcicptr->pciccfg)
  288. | TX4927_PCIC_PCICCFG_G2PMEN(0),
  289. &pcicptr->pciccfg);
  290. /* Enable Initiator I/O Space */
  291. if (channel->io_resource->end)
  292. __raw_writel(__raw_readl(&pcicptr->pciccfg)
  293. | TX4927_PCIC_PCICCFG_G2PIOEN,
  294. &pcicptr->pciccfg);
  295. /* Enable Initiator Config */
  296. __raw_writel(__raw_readl(&pcicptr->pciccfg)
  297. | TX4927_PCIC_PCICCFG_ICAEN | TX4927_PCIC_PCICCFG_TCAR,
  298. &pcicptr->pciccfg);
  299. /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */
  300. __raw_writel(0, &pcicptr->pcicfg1);
  301. __raw_writel((__raw_readl(&pcicptr->g2ptocnt) & ~0xffff)
  302. | (tx4927_pci_opts.trdyto & 0xff)
  303. | ((tx4927_pci_opts.retryto & 0xff) << 8),
  304. &pcicptr->g2ptocnt);
  305. /* Clear All Local Bus Status */
  306. __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicstatus);
  307. /* Enable All Local Bus Interrupts */
  308. __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicmask);
  309. /* Clear All Initiator Status */
  310. __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pstatus);
  311. /* Enable All Initiator Interrupts */
  312. __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pmask);
  313. /* Clear All PCI Status Error */
  314. __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
  315. | (TX4927_PCIC_PCISTATUS_ALL << 16),
  316. &pcicptr->pcistatus);
  317. /* Enable All PCI Status Error Interrupts */
  318. __raw_writel(TX4927_PCIC_PCISTATUS_ALL, &pcicptr->pcimask);
  319. if (!extarb) {
  320. /* Reset Bus Arbiter */
  321. __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg);
  322. __raw_writel(0, &pcicptr->pbabm);
  323. /* Enable Bus Arbiter */
  324. __raw_writel(TX4927_PCIC_PBACFG_PBAEN, &pcicptr->pbacfg);
  325. }
  326. __raw_writel(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
  327. | PCI_COMMAND_PARITY | PCI_COMMAND_SERR,
  328. &pcicptr->pcistatus);
  329. local_irq_restore(flags);
  330. printk(KERN_DEBUG
  331. "PCI: COMMAND=%04x,PCIMASK=%04x,"
  332. "TRDYTO=%02x,RETRYTO=%02x,GBWC=%03x\n",
  333. __raw_readl(&pcicptr->pcistatus) & 0xffff,
  334. __raw_readl(&pcicptr->pcimask) & 0xffff,
  335. __raw_readl(&pcicptr->g2ptocnt) & 0xff,
  336. (__raw_readl(&pcicptr->g2ptocnt) & 0xff00) >> 8,
  337. (__raw_readl(&pcicptr->pciccfg) >> 16) & 0xfff);
  338. }
  339. static void tx4927_report_pcic_status1(struct tx4927_pcic_reg __iomem *pcicptr)
  340. {
  341. __u16 pcistatus = (__u16)(__raw_readl(&pcicptr->pcistatus) >> 16);
  342. __u32 g2pstatus = __raw_readl(&pcicptr->g2pstatus);
  343. __u32 pcicstatus = __raw_readl(&pcicptr->pcicstatus);
  344. static struct {
  345. __u32 flag;
  346. const char *str;
  347. } pcistat_tbl[] = {
  348. { PCI_STATUS_DETECTED_PARITY, "DetectedParityError" },
  349. { PCI_STATUS_SIG_SYSTEM_ERROR, "SignaledSystemError" },
  350. { PCI_STATUS_REC_MASTER_ABORT, "ReceivedMasterAbort" },
  351. { PCI_STATUS_REC_TARGET_ABORT, "ReceivedTargetAbort" },
  352. { PCI_STATUS_SIG_TARGET_ABORT, "SignaledTargetAbort" },
  353. { PCI_STATUS_PARITY, "MasterParityError" },
  354. }, g2pstat_tbl[] = {
  355. { TX4927_PCIC_G2PSTATUS_TTOE, "TIOE" },
  356. { TX4927_PCIC_G2PSTATUS_RTOE, "RTOE" },
  357. }, pcicstat_tbl[] = {
  358. { TX4927_PCIC_PCICSTATUS_PME, "PME" },
  359. { TX4927_PCIC_PCICSTATUS_TLB, "TLB" },
  360. { TX4927_PCIC_PCICSTATUS_NIB, "NIB" },
  361. { TX4927_PCIC_PCICSTATUS_ZIB, "ZIB" },
  362. { TX4927_PCIC_PCICSTATUS_PERR, "PERR" },
  363. { TX4927_PCIC_PCICSTATUS_SERR, "SERR" },
  364. { TX4927_PCIC_PCICSTATUS_GBE, "GBE" },
  365. { TX4927_PCIC_PCICSTATUS_IWB, "IWB" },
  366. };
  367. int i, cont;
  368. printk(KERN_ERR "");
  369. if (pcistatus & TX4927_PCIC_PCISTATUS_ALL) {
  370. printk(KERN_CONT "pcistat:%04x(", pcistatus);
  371. for (i = 0, cont = 0; i < ARRAY_SIZE(pcistat_tbl); i++)
  372. if (pcistatus & pcistat_tbl[i].flag)
  373. printk(KERN_CONT "%s%s",
  374. cont++ ? " " : "", pcistat_tbl[i].str);
  375. printk(KERN_CONT ") ");
  376. }
  377. if (g2pstatus & TX4927_PCIC_G2PSTATUS_ALL) {
  378. printk(KERN_CONT "g2pstatus:%08x(", g2pstatus);
  379. for (i = 0, cont = 0; i < ARRAY_SIZE(g2pstat_tbl); i++)
  380. if (g2pstatus & g2pstat_tbl[i].flag)
  381. printk(KERN_CONT "%s%s",
  382. cont++ ? " " : "", g2pstat_tbl[i].str);
  383. printk(KERN_CONT ") ");
  384. }
  385. if (pcicstatus & TX4927_PCIC_PCICSTATUS_ALL) {
  386. printk(KERN_CONT "pcicstatus:%08x(", pcicstatus);
  387. for (i = 0, cont = 0; i < ARRAY_SIZE(pcicstat_tbl); i++)
  388. if (pcicstatus & pcicstat_tbl[i].flag)
  389. printk(KERN_CONT "%s%s",
  390. cont++ ? " " : "", pcicstat_tbl[i].str);
  391. printk(KERN_CONT ")");
  392. }
  393. printk(KERN_CONT "\n");
  394. }
  395. void tx4927_report_pcic_status(void)
  396. {
  397. int i;
  398. for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
  399. if (pcicptrs[i].pcicptr)
  400. tx4927_report_pcic_status1(pcicptrs[i].pcicptr);
  401. }
  402. }
  403. static void tx4927_dump_pcic_settings1(struct tx4927_pcic_reg __iomem *pcicptr)
  404. {
  405. int i;
  406. __u32 __iomem *preg = (__u32 __iomem *)pcicptr;
  407. printk(KERN_INFO "tx4927 pcic (0x%p) settings:", pcicptr);
  408. for (i = 0; i < sizeof(struct tx4927_pcic_reg); i += 4, preg++) {
  409. if (i % 32 == 0) {
  410. printk(KERN_CONT "\n");
  411. printk(KERN_INFO "%04x:", i);
  412. }
  413. /* skip registers with side-effects */
  414. if (i == offsetof(struct tx4927_pcic_reg, g2pintack)
  415. || i == offsetof(struct tx4927_pcic_reg, g2pspc)
  416. || i == offsetof(struct tx4927_pcic_reg, g2pcfgadrs)
  417. || i == offsetof(struct tx4927_pcic_reg, g2pcfgdata)) {
  418. printk(KERN_CONT " XXXXXXXX");
  419. continue;
  420. }
  421. printk(KERN_CONT " %08x", __raw_readl(preg));
  422. }
  423. printk(KERN_CONT "\n");
  424. }
  425. void tx4927_dump_pcic_settings(void)
  426. {
  427. int i;
  428. for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
  429. if (pcicptrs[i].pcicptr)
  430. tx4927_dump_pcic_settings1(pcicptrs[i].pcicptr);
  431. }
  432. }
  433. irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id)
  434. {
  435. struct pt_regs *regs = get_irq_regs();
  436. struct tx4927_pcic_reg __iomem *pcicptr =
  437. (struct tx4927_pcic_reg __iomem *)(unsigned long)dev_id;
  438. if (txx9_pci_err_action != TXX9_PCI_ERR_IGNORE) {
  439. printk(KERN_WARNING "PCIERR interrupt at 0x%0*lx\n",
  440. (int)(2 * sizeof(unsigned long)), regs->cp0_epc);
  441. tx4927_report_pcic_status1(pcicptr);
  442. }
  443. if (txx9_pci_err_action != TXX9_PCI_ERR_PANIC) {
  444. /* clear all pci errors */
  445. __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
  446. | (TX4927_PCIC_PCISTATUS_ALL << 16),
  447. &pcicptr->pcistatus);
  448. __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pstatus);
  449. __raw_writel(TX4927_PCIC_PBASTATUS_ALL, &pcicptr->pbastatus);
  450. __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicstatus);
  451. return IRQ_HANDLED;
  452. }
  453. console_verbose();
  454. tx4927_dump_pcic_settings1(pcicptr);
  455. panic("PCI error.");
  456. }
  457. #ifdef CONFIG_TOSHIBA_FPCIB0
  458. static void tx4927_quirk_slc90e66_bridge(struct pci_dev *dev)
  459. {
  460. struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus);
  461. if (!pcicptr)
  462. return;
  463. if (__raw_readl(&pcicptr->pbacfg) & TX4927_PCIC_PBACFG_PBAEN) {
  464. /* Reset Bus Arbiter */
  465. __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg);
  466. /*
  467. * swap reqBP and reqXP (raise priority of SLC90E66).
  468. * SLC90E66(PCI-ISA bridge) is connected to REQ2 on
  469. * PCI Backplane board.
  470. */
  471. __raw_writel(0x72543610, &pcicptr->pbareqport);
  472. __raw_writel(0, &pcicptr->pbabm);
  473. /* Use Fixed ParkMaster (required by SLC90E66) */
  474. __raw_writel(TX4927_PCIC_PBACFG_FIXPA, &pcicptr->pbacfg);
  475. /* Enable Bus Arbiter */
  476. __raw_writel(TX4927_PCIC_PBACFG_FIXPA |
  477. TX4927_PCIC_PBACFG_PBAEN,
  478. &pcicptr->pbacfg);
  479. printk(KERN_INFO "PCI: Use Fixed Park Master (REQPORT %08x)\n",
  480. __raw_readl(&pcicptr->pbareqport));
  481. }
  482. }
  483. #define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
  484. DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_0,
  485. tx4927_quirk_slc90e66_bridge);
  486. #endif