driver_pcicore.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /*
  2. * Sonics Silicon Backplane
  3. * Broadcom PCI-core driver
  4. *
  5. * Copyright 2005, Broadcom Corporation
  6. * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
  7. *
  8. * Licensed under the GNU/GPL. See COPYING for details.
  9. */
  10. #include <linux/ssb/ssb.h>
  11. #include <linux/pci.h>
  12. #include <linux/delay.h>
  13. #include <linux/ssb/ssb_embedded.h>
  14. #include "ssb_private.h"
  15. static inline
  16. u32 pcicore_read32(struct ssb_pcicore *pc, u16 offset)
  17. {
  18. return ssb_read32(pc->dev, offset);
  19. }
  20. static inline
  21. void pcicore_write32(struct ssb_pcicore *pc, u16 offset, u32 value)
  22. {
  23. ssb_write32(pc->dev, offset, value);
  24. }
  25. static inline
  26. u16 pcicore_read16(struct ssb_pcicore *pc, u16 offset)
  27. {
  28. return ssb_read16(pc->dev, offset);
  29. }
  30. static inline
  31. void pcicore_write16(struct ssb_pcicore *pc, u16 offset, u16 value)
  32. {
  33. ssb_write16(pc->dev, offset, value);
  34. }
  35. /**************************************************
  36. * Code for hostmode operation.
  37. **************************************************/
  38. #ifdef CONFIG_SSB_PCICORE_HOSTMODE
  39. #include <asm/paccess.h>
  40. /* Probe a 32bit value on the bus and catch bus exceptions.
  41. * Returns nonzero on a bus exception.
  42. * This is MIPS specific */
  43. #define mips_busprobe32(val, addr) get_dbe((val), ((u32 *)(addr)))
  44. /* Assume one-hot slot wiring */
  45. #define SSB_PCI_SLOT_MAX 16
  46. /* Global lock is OK, as we won't have more than one extpci anyway. */
  47. static DEFINE_SPINLOCK(cfgspace_lock);
  48. /* Core to access the external PCI config space. Can only have one. */
  49. static struct ssb_pcicore *extpci_core;
  50. static u32 ssb_pcicore_pcibus_iobase = 0x100;
  51. static u32 ssb_pcicore_pcibus_membase = SSB_PCI_DMA;
  52. int pcibios_plat_dev_init(struct pci_dev *d)
  53. {
  54. struct resource *res;
  55. int pos, size;
  56. u32 *base;
  57. ssb_printk(KERN_INFO "PCI: Fixing up device %s\n",
  58. pci_name(d));
  59. /* Fix up resource bases */
  60. for (pos = 0; pos < 6; pos++) {
  61. res = &d->resource[pos];
  62. if (res->flags & IORESOURCE_IO)
  63. base = &ssb_pcicore_pcibus_iobase;
  64. else
  65. base = &ssb_pcicore_pcibus_membase;
  66. if (res->end) {
  67. size = res->end - res->start + 1;
  68. if (*base & (size - 1))
  69. *base = (*base + size) & ~(size - 1);
  70. res->start = *base;
  71. res->end = res->start + size - 1;
  72. *base += size;
  73. pci_write_config_dword(d, PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
  74. }
  75. /* Fix up PCI bridge BAR0 only */
  76. if (d->bus->number == 0 && PCI_SLOT(d->devfn) == 0)
  77. break;
  78. }
  79. /* Fix up interrupt lines */
  80. d->irq = ssb_mips_irq(extpci_core->dev) + 2;
  81. pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
  82. return 0;
  83. }
  84. static void __init ssb_fixup_pcibridge(struct pci_dev *dev)
  85. {
  86. if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
  87. return;
  88. ssb_printk(KERN_INFO "PCI: fixing up bridge\n");
  89. /* Enable PCI bridge bus mastering and memory space */
  90. pci_set_master(dev);
  91. pcibios_enable_device(dev, ~0);
  92. /* Enable PCI bridge BAR1 prefetch and burst */
  93. pci_write_config_dword(dev, SSB_BAR1_CONTROL, 3);
  94. /* Make sure our latency is high enough to handle the devices behind us */
  95. pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xa8);
  96. }
  97. DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_fixup_pcibridge);
  98. int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  99. {
  100. return ssb_mips_irq(extpci_core->dev) + 2;
  101. }
  102. static u32 get_cfgspace_addr(struct ssb_pcicore *pc,
  103. unsigned int bus, unsigned int dev,
  104. unsigned int func, unsigned int off)
  105. {
  106. u32 addr = 0;
  107. u32 tmp;
  108. /* We do only have one cardbus device behind the bridge. */
  109. if (pc->cardbusmode && (dev >= 1))
  110. goto out;
  111. if (bus == 0) {
  112. /* Type 0 transaction */
  113. if (unlikely(dev >= SSB_PCI_SLOT_MAX))
  114. goto out;
  115. /* Slide the window */
  116. tmp = SSB_PCICORE_SBTOPCI_CFG0;
  117. tmp |= ((1 << (dev + 16)) & SSB_PCICORE_SBTOPCI1_MASK);
  118. pcicore_write32(pc, SSB_PCICORE_SBTOPCI1, tmp);
  119. /* Calculate the address */
  120. addr = SSB_PCI_CFG;
  121. addr |= ((1 << (dev + 16)) & ~SSB_PCICORE_SBTOPCI1_MASK);
  122. addr |= (func << 8);
  123. addr |= (off & ~3);
  124. } else {
  125. /* Type 1 transaction */
  126. pcicore_write32(pc, SSB_PCICORE_SBTOPCI1,
  127. SSB_PCICORE_SBTOPCI_CFG1);
  128. /* Calculate the address */
  129. addr = SSB_PCI_CFG;
  130. addr |= (bus << 16);
  131. addr |= (dev << 11);
  132. addr |= (func << 8);
  133. addr |= (off & ~3);
  134. }
  135. out:
  136. return addr;
  137. }
  138. static int ssb_extpci_read_config(struct ssb_pcicore *pc,
  139. unsigned int bus, unsigned int dev,
  140. unsigned int func, unsigned int off,
  141. void *buf, int len)
  142. {
  143. int err = -EINVAL;
  144. u32 addr, val;
  145. void __iomem *mmio;
  146. SSB_WARN_ON(!pc->hostmode);
  147. if (unlikely(len != 1 && len != 2 && len != 4))
  148. goto out;
  149. addr = get_cfgspace_addr(pc, bus, dev, func, off);
  150. if (unlikely(!addr))
  151. goto out;
  152. err = -ENOMEM;
  153. mmio = ioremap_nocache(addr, len);
  154. if (!mmio)
  155. goto out;
  156. if (mips_busprobe32(val, mmio)) {
  157. val = 0xffffffff;
  158. goto unmap;
  159. }
  160. val = readl(mmio);
  161. val >>= (8 * (off & 3));
  162. switch (len) {
  163. case 1:
  164. *((u8 *)buf) = (u8)val;
  165. break;
  166. case 2:
  167. *((u16 *)buf) = (u16)val;
  168. break;
  169. case 4:
  170. *((u32 *)buf) = (u32)val;
  171. break;
  172. }
  173. err = 0;
  174. unmap:
  175. iounmap(mmio);
  176. out:
  177. return err;
  178. }
  179. static int ssb_extpci_write_config(struct ssb_pcicore *pc,
  180. unsigned int bus, unsigned int dev,
  181. unsigned int func, unsigned int off,
  182. const void *buf, int len)
  183. {
  184. int err = -EINVAL;
  185. u32 addr, val = 0;
  186. void __iomem *mmio;
  187. SSB_WARN_ON(!pc->hostmode);
  188. if (unlikely(len != 1 && len != 2 && len != 4))
  189. goto out;
  190. addr = get_cfgspace_addr(pc, bus, dev, func, off);
  191. if (unlikely(!addr))
  192. goto out;
  193. err = -ENOMEM;
  194. mmio = ioremap_nocache(addr, len);
  195. if (!mmio)
  196. goto out;
  197. if (mips_busprobe32(val, mmio)) {
  198. val = 0xffffffff;
  199. goto unmap;
  200. }
  201. switch (len) {
  202. case 1:
  203. val = readl(mmio);
  204. val &= ~(0xFF << (8 * (off & 3)));
  205. val |= *((const u8 *)buf) << (8 * (off & 3));
  206. break;
  207. case 2:
  208. val = readl(mmio);
  209. val &= ~(0xFFFF << (8 * (off & 3)));
  210. val |= *((const u16 *)buf) << (8 * (off & 3));
  211. break;
  212. case 4:
  213. val = *((const u32 *)buf);
  214. break;
  215. }
  216. writel(val, mmio);
  217. err = 0;
  218. unmap:
  219. iounmap(mmio);
  220. out:
  221. return err;
  222. }
  223. static int ssb_pcicore_read_config(struct pci_bus *bus, unsigned int devfn,
  224. int reg, int size, u32 *val)
  225. {
  226. unsigned long flags;
  227. int err;
  228. spin_lock_irqsave(&cfgspace_lock, flags);
  229. err = ssb_extpci_read_config(extpci_core, bus->number, PCI_SLOT(devfn),
  230. PCI_FUNC(devfn), reg, val, size);
  231. spin_unlock_irqrestore(&cfgspace_lock, flags);
  232. return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
  233. }
  234. static int ssb_pcicore_write_config(struct pci_bus *bus, unsigned int devfn,
  235. int reg, int size, u32 val)
  236. {
  237. unsigned long flags;
  238. int err;
  239. spin_lock_irqsave(&cfgspace_lock, flags);
  240. err = ssb_extpci_write_config(extpci_core, bus->number, PCI_SLOT(devfn),
  241. PCI_FUNC(devfn), reg, &val, size);
  242. spin_unlock_irqrestore(&cfgspace_lock, flags);
  243. return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
  244. }
  245. static struct pci_ops ssb_pcicore_pciops = {
  246. .read = ssb_pcicore_read_config,
  247. .write = ssb_pcicore_write_config,
  248. };
  249. static struct resource ssb_pcicore_mem_resource = {
  250. .name = "SSB PCIcore external memory",
  251. .start = SSB_PCI_DMA,
  252. .end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1,
  253. .flags = IORESOURCE_MEM,
  254. };
  255. static struct resource ssb_pcicore_io_resource = {
  256. .name = "SSB PCIcore external I/O",
  257. .start = 0x100,
  258. .end = 0x7FF,
  259. .flags = IORESOURCE_IO,
  260. };
  261. static struct pci_controller ssb_pcicore_controller = {
  262. .pci_ops = &ssb_pcicore_pciops,
  263. .io_resource = &ssb_pcicore_io_resource,
  264. .mem_resource = &ssb_pcicore_mem_resource,
  265. .mem_offset = 0x24000000,
  266. };
  267. static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
  268. {
  269. u32 val;
  270. if (WARN_ON(extpci_core))
  271. return;
  272. extpci_core = pc;
  273. ssb_dprintk(KERN_INFO PFX "PCIcore in host mode found\n");
  274. /* Reset devices on the external PCI bus */
  275. val = SSB_PCICORE_CTL_RST_OE;
  276. val |= SSB_PCICORE_CTL_CLK_OE;
  277. pcicore_write32(pc, SSB_PCICORE_CTL, val);
  278. val |= SSB_PCICORE_CTL_CLK; /* Clock on */
  279. pcicore_write32(pc, SSB_PCICORE_CTL, val);
  280. udelay(150); /* Assertion time demanded by the PCI standard */
  281. val |= SSB_PCICORE_CTL_RST; /* Deassert RST# */
  282. pcicore_write32(pc, SSB_PCICORE_CTL, val);
  283. val = SSB_PCICORE_ARBCTL_INTERN;
  284. pcicore_write32(pc, SSB_PCICORE_ARBCTL, val);
  285. udelay(1); /* Assertion time demanded by the PCI standard */
  286. if (pc->dev->bus->has_cardbus_slot) {
  287. ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n");
  288. pc->cardbusmode = 1;
  289. /* GPIO 1 resets the bridge */
  290. ssb_gpio_out(pc->dev->bus, 1, 1);
  291. ssb_gpio_outen(pc->dev->bus, 1, 1);
  292. pcicore_write16(pc, SSB_PCICORE_SPROM(0),
  293. pcicore_read16(pc, SSB_PCICORE_SPROM(0))
  294. | 0x0400);
  295. }
  296. /* 64MB I/O window */
  297. pcicore_write32(pc, SSB_PCICORE_SBTOPCI0,
  298. SSB_PCICORE_SBTOPCI_IO);
  299. /* 64MB config space */
  300. pcicore_write32(pc, SSB_PCICORE_SBTOPCI1,
  301. SSB_PCICORE_SBTOPCI_CFG0);
  302. /* 1GB memory window */
  303. pcicore_write32(pc, SSB_PCICORE_SBTOPCI2,
  304. SSB_PCICORE_SBTOPCI_MEM | SSB_PCI_DMA);
  305. /* Enable PCI bridge BAR0 prefetch and burst */
  306. val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  307. ssb_extpci_write_config(pc, 0, 0, 0, PCI_COMMAND, &val, 2);
  308. /* Clear error conditions */
  309. val = 0;
  310. ssb_extpci_write_config(pc, 0, 0, 0, PCI_STATUS, &val, 2);
  311. /* Enable PCI interrupts */
  312. pcicore_write32(pc, SSB_PCICORE_IMASK,
  313. SSB_PCICORE_IMASK_INTA);
  314. /* Ok, ready to run, register it to the system.
  315. * The following needs change, if we want to port hostmode
  316. * to non-MIPS platform. */
  317. set_io_port_base((unsigned long)ioremap_nocache(SSB_PCI_MEM, 0x04000000));
  318. /* Give some time to the PCI controller to configure itself with the new
  319. * values. Not waiting at this point causes crashes of the machine. */
  320. mdelay(10);
  321. register_pci_controller(&ssb_pcicore_controller);
  322. }
  323. static int pcicore_is_in_hostmode(struct ssb_pcicore *pc)
  324. {
  325. struct ssb_bus *bus = pc->dev->bus;
  326. u16 chipid_top;
  327. u32 tmp;
  328. chipid_top = (bus->chip_id & 0xFF00);
  329. if (chipid_top != 0x4700 &&
  330. chipid_top != 0x5300)
  331. return 0;
  332. if (bus->sprom.r1.boardflags_lo & SSB_PCICORE_BFL_NOPCI)
  333. return 0;
  334. /* The 200-pin BCM4712 package does not bond out PCI. Even when
  335. * PCI is bonded out, some boards may leave the pins floating. */
  336. if (bus->chip_id == 0x4712) {
  337. if (bus->chip_package == SSB_CHIPPACK_BCM4712S)
  338. return 0;
  339. if (bus->chip_package == SSB_CHIPPACK_BCM4712M)
  340. return 0;
  341. }
  342. if (bus->chip_id == 0x5350)
  343. return 0;
  344. return !mips_busprobe32(tmp, (bus->mmio + (pc->dev->core_index * SSB_CORE_SIZE)));
  345. }
  346. #endif /* CONFIG_SSB_PCICORE_HOSTMODE */
  347. /**************************************************
  348. * Generic and Clientmode operation code.
  349. **************************************************/
  350. static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
  351. {
  352. /* Disable PCI interrupts. */
  353. ssb_write32(pc->dev, SSB_INTVEC, 0);
  354. }
  355. void ssb_pcicore_init(struct ssb_pcicore *pc)
  356. {
  357. struct ssb_device *dev = pc->dev;
  358. struct ssb_bus *bus;
  359. if (!dev)
  360. return;
  361. bus = dev->bus;
  362. if (!ssb_device_is_enabled(dev))
  363. ssb_device_enable(dev, 0);
  364. #ifdef CONFIG_SSB_PCICORE_HOSTMODE
  365. pc->hostmode = pcicore_is_in_hostmode(pc);
  366. if (pc->hostmode)
  367. ssb_pcicore_init_hostmode(pc);
  368. #endif /* CONFIG_SSB_PCICORE_HOSTMODE */
  369. if (!pc->hostmode)
  370. ssb_pcicore_init_clientmode(pc);
  371. }
  372. static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address)
  373. {
  374. pcicore_write32(pc, 0x130, address);
  375. return pcicore_read32(pc, 0x134);
  376. }
  377. static void ssb_pcie_write(struct ssb_pcicore *pc, u32 address, u32 data)
  378. {
  379. pcicore_write32(pc, 0x130, address);
  380. pcicore_write32(pc, 0x134, data);
  381. }
  382. static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
  383. u8 address, u16 data)
  384. {
  385. const u16 mdio_control = 0x128;
  386. const u16 mdio_data = 0x12C;
  387. u32 v;
  388. int i;
  389. v = 0x80; /* Enable Preamble Sequence */
  390. v |= 0x2; /* MDIO Clock Divisor */
  391. pcicore_write32(pc, mdio_control, v);
  392. v = (1 << 30); /* Start of Transaction */
  393. v |= (1 << 28); /* Write Transaction */
  394. v |= (1 << 17); /* Turnaround */
  395. v |= (u32)device << 22;
  396. v |= (u32)address << 18;
  397. v |= data;
  398. pcicore_write32(pc, mdio_data, v);
  399. /* Wait for the device to complete the transaction */
  400. udelay(10);
  401. for (i = 0; i < 10; i++) {
  402. v = pcicore_read32(pc, mdio_control);
  403. if (v & 0x100 /* Trans complete */)
  404. break;
  405. msleep(1);
  406. }
  407. pcicore_write32(pc, mdio_control, 0);
  408. }
  409. static void ssb_broadcast_value(struct ssb_device *dev,
  410. u32 address, u32 data)
  411. {
  412. /* This is used for both, PCI and ChipCommon core, so be careful. */
  413. BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
  414. BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
  415. ssb_write32(dev, SSB_PCICORE_BCAST_ADDR, address);
  416. ssb_read32(dev, SSB_PCICORE_BCAST_ADDR); /* flush */
  417. ssb_write32(dev, SSB_PCICORE_BCAST_DATA, data);
  418. ssb_read32(dev, SSB_PCICORE_BCAST_DATA); /* flush */
  419. }
  420. static void ssb_commit_settings(struct ssb_bus *bus)
  421. {
  422. struct ssb_device *dev;
  423. dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
  424. if (WARN_ON(!dev))
  425. return;
  426. /* This forces an update of the cached registers. */
  427. ssb_broadcast_value(dev, 0xFD8, 0);
  428. }
  429. int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
  430. struct ssb_device *dev)
  431. {
  432. struct ssb_device *pdev = pc->dev;
  433. struct ssb_bus *bus;
  434. int err = 0;
  435. u32 tmp;
  436. might_sleep();
  437. if (!pdev)
  438. goto out;
  439. bus = pdev->bus;
  440. /* Enable interrupts for this device. */
  441. if (bus->host_pci &&
  442. ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) {
  443. u32 coremask;
  444. /* Calculate the "coremask" for the device. */
  445. coremask = (1 << dev->core_index);
  446. err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp);
  447. if (err)
  448. goto out;
  449. tmp |= coremask << 8;
  450. err = pci_write_config_dword(bus->host_pci, SSB_PCI_IRQMASK, tmp);
  451. if (err)
  452. goto out;
  453. } else {
  454. u32 intvec;
  455. intvec = ssb_read32(pdev, SSB_INTVEC);
  456. if ((bus->chip_id & 0xFF00) == 0x4400) {
  457. /* Workaround: On the BCM44XX the BPFLAG routing
  458. * bit is wrong. Use a hardcoded constant. */
  459. intvec |= 0x00000002;
  460. } else {
  461. tmp = ssb_read32(dev, SSB_TPSFLAG);
  462. tmp &= SSB_TPSFLAG_BPFLAG;
  463. intvec |= tmp;
  464. }
  465. ssb_write32(pdev, SSB_INTVEC, intvec);
  466. }
  467. /* Setup PCIcore operation. */
  468. if (pc->setup_done)
  469. goto out;
  470. if (pdev->id.coreid == SSB_DEV_PCI) {
  471. tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  472. tmp |= SSB_PCICORE_SBTOPCI_PREF;
  473. tmp |= SSB_PCICORE_SBTOPCI_BURST;
  474. pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  475. if (pdev->id.revision < 5) {
  476. tmp = ssb_read32(pdev, SSB_IMCFGLO);
  477. tmp &= ~SSB_IMCFGLO_SERTO;
  478. tmp |= 2;
  479. tmp &= ~SSB_IMCFGLO_REQTO;
  480. tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
  481. ssb_write32(pdev, SSB_IMCFGLO, tmp);
  482. ssb_commit_settings(bus);
  483. } else if (pdev->id.revision >= 11) {
  484. tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
  485. tmp |= SSB_PCICORE_SBTOPCI_MRM;
  486. pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
  487. }
  488. } else {
  489. WARN_ON(pdev->id.coreid != SSB_DEV_PCIE);
  490. //TODO: Better make defines for all these magic PCIE values.
  491. if ((pdev->id.revision == 0) || (pdev->id.revision == 1)) {
  492. /* TLP Workaround register. */
  493. tmp = ssb_pcie_read(pc, 0x4);
  494. tmp |= 0x8;
  495. ssb_pcie_write(pc, 0x4, tmp);
  496. }
  497. if (pdev->id.revision == 0) {
  498. const u8 serdes_rx_device = 0x1F;
  499. ssb_pcie_mdio_write(pc, serdes_rx_device,
  500. 2 /* Timer */, 0x8128);
  501. ssb_pcie_mdio_write(pc, serdes_rx_device,
  502. 6 /* CDR */, 0x0100);
  503. ssb_pcie_mdio_write(pc, serdes_rx_device,
  504. 7 /* CDR BW */, 0x1466);
  505. } else if (pdev->id.revision == 1) {
  506. /* DLLP Link Control register. */
  507. tmp = ssb_pcie_read(pc, 0x100);
  508. tmp |= 0x40;
  509. ssb_pcie_write(pc, 0x100, tmp);
  510. }
  511. }
  512. pc->setup_done = 1;
  513. out:
  514. return err;
  515. }
  516. EXPORT_SYMBOL(ssb_pcicore_dev_irqvecs_enable);