pci-ar2315.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version 2
  5. * of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  14. */
  15. /**
  16. * Both AR2315 and AR2316 chips have PCI interface unit, which supports DMA
  17. * and interrupt. PCI interface supports MMIO access method, but does not
  18. * seem to support I/O ports.
  19. *
  20. * Read/write operation in the region 0x80000000-0xBFFFFFFF causes
  21. * a memory read/write command on the PCI bus. 30 LSBs of address on
  22. * the bus are taken from memory read/write request and 2 MSBs are
  23. * determined by PCI unit configuration.
  24. *
  25. * To work with the configuration space instead of memory is necessary set
  26. * the CFG_SEL bit in the PCI_MISC_CONFIG register.
  27. *
  28. * Devices on the bus can perform DMA requests via chip BAR1. PCI host
  29. * controller BARs are programmend as if an external device is programmed.
  30. * Which means that during configuration, IDSEL pin of the chip should be
  31. * asserted.
  32. *
  33. * We know (and support) only one board that uses the PCI interface -
  34. * Fonera 2.0g (FON2202). It has a USB EHCI controller connected to the
  35. * AR2315 PCI bus. IDSEL pin of USB controller is connected to AD[13] line
  36. * and IDSEL pin of AR2315 is connected to AD[16] line.
  37. */
  38. #include <linux/types.h>
  39. #include <linux/pci.h>
  40. #include <linux/platform_device.h>
  41. #include <linux/kernel.h>
  42. #include <linux/init.h>
  43. #include <linux/mm.h>
  44. #include <linux/delay.h>
  45. #include <linux/bitops.h>
  46. #include <linux/irq.h>
  47. #include <linux/irqdomain.h>
  48. #include <linux/io.h>
  49. #include <asm/paccess.h>
  50. /*
  51. * PCI Bus Interface Registers
  52. */
  53. #define AR2315_PCI_1MS_REG 0x0008
  54. #define AR2315_PCI_1MS_MASK 0x3FFFF /* # of AHB clk cycles in 1ms */
  55. #define AR2315_PCI_MISC_CONFIG 0x000c
  56. #define AR2315_PCIMISC_TXD_EN 0x00000001 /* Enable TXD for fragments */
  57. #define AR2315_PCIMISC_CFG_SEL 0x00000002 /* Mem or Config cycles */
  58. #define AR2315_PCIMISC_GIG_MASK 0x0000000C /* bits 31-30 for pci req */
  59. #define AR2315_PCIMISC_RST_MODE 0x00000030
  60. #define AR2315_PCIRST_INPUT 0x00000000 /* 4:5=0 rst is input */
  61. #define AR2315_PCIRST_LOW 0x00000010 /* 4:5=1 rst to GND */
  62. #define AR2315_PCIRST_HIGH 0x00000020 /* 4:5=2 rst to VDD */
  63. #define AR2315_PCIGRANT_EN 0x00000000 /* 6:7=0 early grant en */
  64. #define AR2315_PCIGRANT_FRAME 0x00000040 /* 6:7=1 grant waits 4 frame */
  65. #define AR2315_PCIGRANT_IDLE 0x00000080 /* 6:7=2 grant waits 4 idle */
  66. #define AR2315_PCIGRANT_GAP 0x00000000 /* 6:7=2 grant waits 4 idle */
  67. #define AR2315_PCICACHE_DIS 0x00001000 /* PCI external access cache
  68. * disable */
  69. #define AR2315_PCI_OUT_TSTAMP 0x0010
  70. #define AR2315_PCI_UNCACHE_CFG 0x0014
  71. #define AR2315_PCI_IN_EN 0x0100
  72. #define AR2315_PCI_IN_EN0 0x01 /* Enable chain 0 */
  73. #define AR2315_PCI_IN_EN1 0x02 /* Enable chain 1 */
  74. #define AR2315_PCI_IN_EN2 0x04 /* Enable chain 2 */
  75. #define AR2315_PCI_IN_EN3 0x08 /* Enable chain 3 */
  76. #define AR2315_PCI_IN_DIS 0x0104
  77. #define AR2315_PCI_IN_DIS0 0x01 /* Disable chain 0 */
  78. #define AR2315_PCI_IN_DIS1 0x02 /* Disable chain 1 */
  79. #define AR2315_PCI_IN_DIS2 0x04 /* Disable chain 2 */
  80. #define AR2315_PCI_IN_DIS3 0x08 /* Disable chain 3 */
  81. #define AR2315_PCI_IN_PTR 0x0200
  82. #define AR2315_PCI_OUT_EN 0x0400
  83. #define AR2315_PCI_OUT_EN0 0x01 /* Enable chain 0 */
  84. #define AR2315_PCI_OUT_DIS 0x0404
  85. #define AR2315_PCI_OUT_DIS0 0x01 /* Disable chain 0 */
  86. #define AR2315_PCI_OUT_PTR 0x0408
  87. /* PCI interrupt status (write one to clear) */
  88. #define AR2315_PCI_ISR 0x0500
  89. #define AR2315_PCI_INT_TX 0x00000001 /* Desc In Completed */
  90. #define AR2315_PCI_INT_TXOK 0x00000002 /* Desc In OK */
  91. #define AR2315_PCI_INT_TXERR 0x00000004 /* Desc In ERR */
  92. #define AR2315_PCI_INT_TXEOL 0x00000008 /* Desc In End-of-List */
  93. #define AR2315_PCI_INT_RX 0x00000010 /* Desc Out Completed */
  94. #define AR2315_PCI_INT_RXOK 0x00000020 /* Desc Out OK */
  95. #define AR2315_PCI_INT_RXERR 0x00000040 /* Desc Out ERR */
  96. #define AR2315_PCI_INT_RXEOL 0x00000080 /* Desc Out EOL */
  97. #define AR2315_PCI_INT_TXOOD 0x00000200 /* Desc In Out-of-Desc */
  98. #define AR2315_PCI_INT_DESCMASK 0x0000FFFF /* Desc Mask */
  99. #define AR2315_PCI_INT_EXT 0x02000000 /* Extern PCI INTA */
  100. #define AR2315_PCI_INT_ABORT 0x04000000 /* PCI bus abort event */
  101. /* PCI interrupt mask */
  102. #define AR2315_PCI_IMR 0x0504
  103. /* Global PCI interrupt enable */
  104. #define AR2315_PCI_IER 0x0508
  105. #define AR2315_PCI_IER_DISABLE 0x00 /* disable pci interrupts */
  106. #define AR2315_PCI_IER_ENABLE 0x01 /* enable pci interrupts */
  107. #define AR2315_PCI_HOST_IN_EN 0x0800
  108. #define AR2315_PCI_HOST_IN_DIS 0x0804
  109. #define AR2315_PCI_HOST_IN_PTR 0x0810
  110. #define AR2315_PCI_HOST_OUT_EN 0x0900
  111. #define AR2315_PCI_HOST_OUT_DIS 0x0904
  112. #define AR2315_PCI_HOST_OUT_PTR 0x0908
  113. /*
  114. * PCI interrupts, which share IP5
  115. * Keep ordered according to AR2315_PCI_INT_XXX bits
  116. */
  117. #define AR2315_PCI_IRQ_EXT 25
  118. #define AR2315_PCI_IRQ_ABORT 26
  119. #define AR2315_PCI_IRQ_COUNT 27
  120. /* Arbitrary size of memory region to access the configuration space */
  121. #define AR2315_PCI_CFG_SIZE 0x00100000
  122. #define AR2315_PCI_HOST_SLOT 3
  123. #define AR2315_PCI_HOST_DEVID ((0xff18 << 16) | PCI_VENDOR_ID_ATHEROS)
  124. /*
  125. * We need some arbitrary non-zero value to be programmed to the BAR1 register
  126. * of PCI host controller to enable DMA. The same value should be used as the
  127. * offset to calculate the physical address of DMA buffer for PCI devices.
  128. */
  129. #define AR2315_PCI_HOST_SDRAM_BASEADDR 0x20000000
  130. /* ??? access BAR */
  131. #define AR2315_PCI_HOST_MBAR0 0x10000000
  132. /* RAM access BAR */
  133. #define AR2315_PCI_HOST_MBAR1 AR2315_PCI_HOST_SDRAM_BASEADDR
  134. /* ??? access BAR */
  135. #define AR2315_PCI_HOST_MBAR2 0x30000000
  136. struct ar2315_pci_ctrl {
  137. void __iomem *cfg_mem;
  138. void __iomem *mmr_mem;
  139. unsigned irq;
  140. unsigned irq_ext;
  141. struct irq_domain *domain;
  142. struct pci_controller pci_ctrl;
  143. struct resource mem_res;
  144. struct resource io_res;
  145. };
  146. static inline dma_addr_t ar2315_dev_offset(struct device *dev)
  147. {
  148. if (dev && dev_is_pci(dev))
  149. return AR2315_PCI_HOST_SDRAM_BASEADDR;
  150. return 0;
  151. }
  152. dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
  153. {
  154. return paddr + ar2315_dev_offset(dev);
  155. }
  156. phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
  157. {
  158. return dma_addr - ar2315_dev_offset(dev);
  159. }
  160. static inline struct ar2315_pci_ctrl *ar2315_pci_bus_to_apc(struct pci_bus *bus)
  161. {
  162. struct pci_controller *hose = bus->sysdata;
  163. return container_of(hose, struct ar2315_pci_ctrl, pci_ctrl);
  164. }
  165. static inline u32 ar2315_pci_reg_read(struct ar2315_pci_ctrl *apc, u32 reg)
  166. {
  167. return __raw_readl(apc->mmr_mem + reg);
  168. }
  169. static inline void ar2315_pci_reg_write(struct ar2315_pci_ctrl *apc, u32 reg,
  170. u32 val)
  171. {
  172. __raw_writel(val, apc->mmr_mem + reg);
  173. }
  174. static inline void ar2315_pci_reg_mask(struct ar2315_pci_ctrl *apc, u32 reg,
  175. u32 mask, u32 val)
  176. {
  177. u32 ret = ar2315_pci_reg_read(apc, reg);
  178. ret &= ~mask;
  179. ret |= val;
  180. ar2315_pci_reg_write(apc, reg, ret);
  181. }
  182. static int ar2315_pci_cfg_access(struct ar2315_pci_ctrl *apc, unsigned devfn,
  183. int where, int size, u32 *ptr, bool write)
  184. {
  185. int func = PCI_FUNC(devfn);
  186. int dev = PCI_SLOT(devfn);
  187. u32 addr = (1 << (13 + dev)) | (func << 8) | (where & ~3);
  188. u32 mask = 0xffffffff >> 8 * (4 - size);
  189. u32 sh = (where & 3) * 8;
  190. u32 value, isr;
  191. /* Prevent access past the remapped area */
  192. if (addr >= AR2315_PCI_CFG_SIZE || dev > 18)
  193. return PCIBIOS_DEVICE_NOT_FOUND;
  194. /* Clear pending errors */
  195. ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT);
  196. /* Select Configuration access */
  197. ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, 0,
  198. AR2315_PCIMISC_CFG_SEL);
  199. mb(); /* PCI must see space change before we begin */
  200. value = __raw_readl(apc->cfg_mem + addr);
  201. isr = ar2315_pci_reg_read(apc, AR2315_PCI_ISR);
  202. if (isr & AR2315_PCI_INT_ABORT)
  203. goto exit_err;
  204. if (write) {
  205. value = (value & ~(mask << sh)) | *ptr << sh;
  206. __raw_writel(value, apc->cfg_mem + addr);
  207. isr = ar2315_pci_reg_read(apc, AR2315_PCI_ISR);
  208. if (isr & AR2315_PCI_INT_ABORT)
  209. goto exit_err;
  210. } else {
  211. *ptr = (value >> sh) & mask;
  212. }
  213. goto exit;
  214. exit_err:
  215. ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT);
  216. if (!write)
  217. *ptr = 0xffffffff;
  218. exit:
  219. /* Select Memory access */
  220. ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_CFG_SEL,
  221. 0);
  222. return isr & AR2315_PCI_INT_ABORT ? PCIBIOS_DEVICE_NOT_FOUND :
  223. PCIBIOS_SUCCESSFUL;
  224. }
  225. static inline int ar2315_pci_local_cfg_rd(struct ar2315_pci_ctrl *apc,
  226. unsigned devfn, int where, u32 *val)
  227. {
  228. return ar2315_pci_cfg_access(apc, devfn, where, sizeof(u32), val,
  229. false);
  230. }
  231. static inline int ar2315_pci_local_cfg_wr(struct ar2315_pci_ctrl *apc,
  232. unsigned devfn, int where, u32 val)
  233. {
  234. return ar2315_pci_cfg_access(apc, devfn, where, sizeof(u32), &val,
  235. true);
  236. }
  237. static int ar2315_pci_cfg_read(struct pci_bus *bus, unsigned devfn, int where,
  238. int size, u32 *value)
  239. {
  240. struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(bus);
  241. if (PCI_SLOT(devfn) == AR2315_PCI_HOST_SLOT)
  242. return PCIBIOS_DEVICE_NOT_FOUND;
  243. return ar2315_pci_cfg_access(apc, devfn, where, size, value, false);
  244. }
  245. static int ar2315_pci_cfg_write(struct pci_bus *bus, unsigned devfn, int where,
  246. int size, u32 value)
  247. {
  248. struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(bus);
  249. if (PCI_SLOT(devfn) == AR2315_PCI_HOST_SLOT)
  250. return PCIBIOS_DEVICE_NOT_FOUND;
  251. return ar2315_pci_cfg_access(apc, devfn, where, size, &value, true);
  252. }
  253. static struct pci_ops ar2315_pci_ops = {
  254. .read = ar2315_pci_cfg_read,
  255. .write = ar2315_pci_cfg_write,
  256. };
  257. static int ar2315_pci_host_setup(struct ar2315_pci_ctrl *apc)
  258. {
  259. unsigned devfn = PCI_DEVFN(AR2315_PCI_HOST_SLOT, 0);
  260. int res;
  261. u32 id;
  262. res = ar2315_pci_local_cfg_rd(apc, devfn, PCI_VENDOR_ID, &id);
  263. if (res != PCIBIOS_SUCCESSFUL || id != AR2315_PCI_HOST_DEVID)
  264. return -ENODEV;
  265. /* Program MBARs */
  266. ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_0,
  267. AR2315_PCI_HOST_MBAR0);
  268. ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_1,
  269. AR2315_PCI_HOST_MBAR1);
  270. ar2315_pci_local_cfg_wr(apc, devfn, PCI_BASE_ADDRESS_2,
  271. AR2315_PCI_HOST_MBAR2);
  272. /* Run */
  273. ar2315_pci_local_cfg_wr(apc, devfn, PCI_COMMAND, PCI_COMMAND_MEMORY |
  274. PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL |
  275. PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY |
  276. PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK);
  277. return 0;
  278. }
  279. static void ar2315_pci_irq_handler(struct irq_desc *desc)
  280. {
  281. struct ar2315_pci_ctrl *apc = irq_desc_get_handler_data(desc);
  282. u32 pending = ar2315_pci_reg_read(apc, AR2315_PCI_ISR) &
  283. ar2315_pci_reg_read(apc, AR2315_PCI_IMR);
  284. unsigned pci_irq = 0;
  285. if (pending)
  286. pci_irq = irq_find_mapping(apc->domain, __ffs(pending));
  287. if (pci_irq)
  288. generic_handle_irq(pci_irq);
  289. else
  290. spurious_interrupt();
  291. }
  292. static void ar2315_pci_irq_mask(struct irq_data *d)
  293. {
  294. struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d);
  295. ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, BIT(d->hwirq), 0);
  296. }
  297. static void ar2315_pci_irq_mask_ack(struct irq_data *d)
  298. {
  299. struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d);
  300. u32 m = BIT(d->hwirq);
  301. ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, m, 0);
  302. ar2315_pci_reg_write(apc, AR2315_PCI_ISR, m);
  303. }
  304. static void ar2315_pci_irq_unmask(struct irq_data *d)
  305. {
  306. struct ar2315_pci_ctrl *apc = irq_data_get_irq_chip_data(d);
  307. ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, 0, BIT(d->hwirq));
  308. }
  309. static struct irq_chip ar2315_pci_irq_chip = {
  310. .name = "AR2315-PCI",
  311. .irq_mask = ar2315_pci_irq_mask,
  312. .irq_mask_ack = ar2315_pci_irq_mask_ack,
  313. .irq_unmask = ar2315_pci_irq_unmask,
  314. };
  315. static int ar2315_pci_irq_map(struct irq_domain *d, unsigned irq,
  316. irq_hw_number_t hw)
  317. {
  318. irq_set_chip_and_handler(irq, &ar2315_pci_irq_chip, handle_level_irq);
  319. irq_set_chip_data(irq, d->host_data);
  320. return 0;
  321. }
  322. static struct irq_domain_ops ar2315_pci_irq_domain_ops = {
  323. .map = ar2315_pci_irq_map,
  324. };
  325. static void ar2315_pci_irq_init(struct ar2315_pci_ctrl *apc)
  326. {
  327. ar2315_pci_reg_mask(apc, AR2315_PCI_IER, AR2315_PCI_IER_ENABLE, 0);
  328. ar2315_pci_reg_mask(apc, AR2315_PCI_IMR, (AR2315_PCI_INT_ABORT |
  329. AR2315_PCI_INT_EXT), 0);
  330. apc->irq_ext = irq_create_mapping(apc->domain, AR2315_PCI_IRQ_EXT);
  331. irq_set_chained_handler_and_data(apc->irq, ar2315_pci_irq_handler,
  332. apc);
  333. /* Clear any pending Abort or external Interrupts
  334. * and enable interrupt processing */
  335. ar2315_pci_reg_write(apc, AR2315_PCI_ISR, AR2315_PCI_INT_ABORT |
  336. AR2315_PCI_INT_EXT);
  337. ar2315_pci_reg_mask(apc, AR2315_PCI_IER, 0, AR2315_PCI_IER_ENABLE);
  338. }
  339. static int ar2315_pci_probe(struct platform_device *pdev)
  340. {
  341. struct ar2315_pci_ctrl *apc;
  342. struct device *dev = &pdev->dev;
  343. struct resource *res;
  344. int irq, err;
  345. apc = devm_kzalloc(dev, sizeof(*apc), GFP_KERNEL);
  346. if (!apc)
  347. return -ENOMEM;
  348. irq = platform_get_irq(pdev, 0);
  349. if (irq < 0)
  350. return -EINVAL;
  351. apc->irq = irq;
  352. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  353. "ar2315-pci-ctrl");
  354. apc->mmr_mem = devm_ioremap_resource(dev, res);
  355. if (IS_ERR(apc->mmr_mem))
  356. return PTR_ERR(apc->mmr_mem);
  357. res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
  358. "ar2315-pci-ext");
  359. if (!res)
  360. return -EINVAL;
  361. apc->mem_res.name = "AR2315 PCI mem space";
  362. apc->mem_res.parent = res;
  363. apc->mem_res.start = res->start;
  364. apc->mem_res.end = res->end;
  365. apc->mem_res.flags = IORESOURCE_MEM;
  366. /* Remap PCI config space */
  367. apc->cfg_mem = devm_ioremap_nocache(dev, res->start,
  368. AR2315_PCI_CFG_SIZE);
  369. if (!apc->cfg_mem) {
  370. dev_err(dev, "failed to remap PCI config space\n");
  371. return -ENOMEM;
  372. }
  373. /* Reset the PCI bus by setting bits 5-4 in PCI_MCFG */
  374. ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG,
  375. AR2315_PCIMISC_RST_MODE,
  376. AR2315_PCIRST_LOW);
  377. msleep(100);
  378. /* Bring the PCI out of reset */
  379. ar2315_pci_reg_mask(apc, AR2315_PCI_MISC_CONFIG,
  380. AR2315_PCIMISC_RST_MODE,
  381. AR2315_PCIRST_HIGH | AR2315_PCICACHE_DIS | 0x8);
  382. ar2315_pci_reg_write(apc, AR2315_PCI_UNCACHE_CFG,
  383. 0x1E | /* 1GB uncached */
  384. (1 << 5) | /* Enable uncached */
  385. (0x2 << 30) /* Base: 0x80000000 */);
  386. ar2315_pci_reg_read(apc, AR2315_PCI_UNCACHE_CFG);
  387. msleep(500);
  388. err = ar2315_pci_host_setup(apc);
  389. if (err)
  390. return err;
  391. apc->domain = irq_domain_add_linear(NULL, AR2315_PCI_IRQ_COUNT,
  392. &ar2315_pci_irq_domain_ops, apc);
  393. if (!apc->domain) {
  394. dev_err(dev, "failed to add IRQ domain\n");
  395. return -ENOMEM;
  396. }
  397. ar2315_pci_irq_init(apc);
  398. /* PCI controller does not support I/O ports */
  399. apc->io_res.name = "AR2315 IO space";
  400. apc->io_res.start = 0;
  401. apc->io_res.end = 0;
  402. apc->io_res.flags = IORESOURCE_IO,
  403. apc->pci_ctrl.pci_ops = &ar2315_pci_ops;
  404. apc->pci_ctrl.mem_resource = &apc->mem_res,
  405. apc->pci_ctrl.io_resource = &apc->io_res,
  406. register_pci_controller(&apc->pci_ctrl);
  407. dev_info(dev, "register PCI controller\n");
  408. return 0;
  409. }
  410. static struct platform_driver ar2315_pci_driver = {
  411. .probe = ar2315_pci_probe,
  412. .driver = {
  413. .name = "ar2315-pci",
  414. },
  415. };
  416. static int __init ar2315_pci_init(void)
  417. {
  418. return platform_driver_register(&ar2315_pci_driver);
  419. }
  420. arch_initcall(ar2315_pci_init);
  421. int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  422. {
  423. struct ar2315_pci_ctrl *apc = ar2315_pci_bus_to_apc(dev->bus);
  424. return slot ? 0 : apc->irq_ext;
  425. }
  426. int pcibios_plat_dev_init(struct pci_dev *dev)
  427. {
  428. return 0;
  429. }