2 * Atheros AP94 reference board PCI initialization
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
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.
11 #include <linux/pci.h>
12 #include <linux/ath9k_platform.h>
13 #include <linux/delay.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
16 #include <asm/mach-ar71xx/pci.h>
18 #include "dev-ap94-pci.h"
19 #include "pci-ath9k-fixup.h"
21 static struct ath9k_platform_data ap94_wmac0_data;
22 static struct ath9k_platform_data ap94_wmac1_data;
23 static char ap94_wmac0_mac[6];
24 static char ap94_wmac1_mac[6];
26 static struct ar71xx_pci_irq ap94_pci_irqs[] __initdata = {
30 .irq = AR71XX_PCI_IRQ_DEV0,
34 .irq = AR71XX_PCI_IRQ_DEV1,
38 static int ap94_pci_plat_dev_init(struct pci_dev *dev)
40 switch(PCI_SLOT(dev->devfn)) {
42 dev->dev.platform_data = &ap94_wmac0_data;
46 dev->dev.platform_data = &ap94_wmac1_data;
53 void __init ap94_pci_enable_quirk_wndr3700(void)
55 ap94_wmac0_data.quirk_wndr3700 = 1;
56 ap94_wmac1_data.quirk_wndr3700 = 1;
59 void __init ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
60 u8 *cal_data1, u8 *mac_addr1)
63 memcpy(ap94_wmac0_data.eeprom_data, cal_data0,
64 sizeof(ap94_wmac0_data.eeprom_data));
67 memcpy(ap94_wmac1_data.eeprom_data, cal_data1,
68 sizeof(ap94_wmac1_data.eeprom_data));
71 memcpy(ap94_wmac0_mac, mac_addr0, sizeof(ap94_wmac0_mac));
72 ap94_wmac0_data.macaddr = ap94_wmac0_mac;
76 memcpy(ap94_wmac1_mac, mac_addr1, sizeof(ap94_wmac1_mac));
77 ap94_wmac1_data.macaddr = ap94_wmac1_mac;
80 ar71xx_pci_plat_dev_init = ap94_pci_plat_dev_init;
81 ar71xx_pci_init(ARRAY_SIZE(ap94_pci_irqs), ap94_pci_irqs);
83 pci_enable_ath9k_fixup(17, ap94_wmac0_data.eeprom_data);
84 pci_enable_ath9k_fixup(18, ap94_wmac1_data.eeprom_data);