ar71xx: move arch specific files to files-2.6.39
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files-2.6.39 / arch / mips / ar71xx / dev-db120-pci.c
1 /*
2 * Atheros db120 reference board PCI initialization
3 *
4 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
6 *
7 * Parts of this file are based on Atheros linux 2.6.31 BSP
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 */
13
14 #include <linux/pci.h>
15 #include <linux/ath9k_platform.h>
16
17 #include <asm/mach-ar71xx/ar71xx.h>
18 #include <asm/mach-ar71xx/pci.h>
19
20 #include "dev-db120-pci.h"
21
22 static struct ath9k_platform_data db120_wmac_data = {
23 .led_pin = -1,
24 };
25 static char db120_wmac_mac[6];
26
27 static struct ar71xx_pci_irq db120_pci_irqs[] __initdata = {
28 {
29 .slot = 0,
30 .pin = 1,
31 .irq = AR71XX_PCI_IRQ_DEV0,
32 }
33 };
34
35 static int db120_pci_plat_dev_init(struct pci_dev *dev)
36 {
37 switch (PCI_SLOT(dev->devfn)) {
38 case 0:
39 dev->dev.platform_data = &db120_wmac_data;
40 break;
41 }
42
43 return 0;
44 }
45
46 void __init db120_pci_init(u8 *cal_data, u8 *mac_addr)
47 {
48 if (cal_data)
49 memcpy(db120_wmac_data.eeprom_data, cal_data,
50 sizeof(db120_wmac_data.eeprom_data));
51
52 if (mac_addr) {
53 memcpy(db120_wmac_mac, mac_addr, sizeof(db120_wmac_mac));
54 db120_wmac_data.macaddr = db120_wmac_mac;
55 }
56
57 ar71xx_pci_plat_dev_init = db120_pci_plat_dev_init;
58 ar71xx_pci_init(ARRAY_SIZE(db120_pci_irqs), db120_pci_irqs);
59 }