blob: 49574284b755b8c16fff6a6e05e20b6ba12d42ab [file] [log] [blame]
Gabor Juhose2dbdc42012-03-14 10:29:21 +01001/*
2 * Atheros AR71XX/AR724X specific PCI setup code
3 *
4 * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#include <linux/pci.h>
Gabor Juhos3a6208d2012-03-14 10:29:22 +010012#include "pci.h"
Gabor Juhose2dbdc42012-03-14 10:29:21 +010013
14static struct ath724x_pci_data *pci_data;
15static int pci_data_size;
16
17void ath724x_pci_add_data(struct ath724x_pci_data *data, int size)
18{
19 pci_data = data;
20 pci_data_size = size;
21}
22
23int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin)
24{
25 unsigned int devfn = dev->devfn;
26 int irq = -1;
27
28 if (devfn > pci_data_size - 1)
29 return irq;
30
31 irq = pci_data[devfn].irq;
32
33 return irq;
34}
35
36int pcibios_plat_dev_init(struct pci_dev *dev)
37{
38 unsigned int devfn = dev->devfn;
39
40 if (devfn > pci_data_size - 1)
41 return PCIBIOS_DEVICE_NOT_FOUND;
42
43 dev->dev.platform_data = pci_data[devfn].pdata;
44
45 return PCIBIOS_SUCCESSFUL;
46}