2 * Atheros AP91 reference board PCI initialization
4 * Copyright (C) 2009 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-ap91-pci.h"
19 #include "pci-ath9k-fixup.h"
21 static struct ath9k_platform_data ap91_wmac_data
= {
24 static char ap91_wmac_mac
[6];
26 static struct ar71xx_pci_irq ap91_pci_irqs
[] __initdata
= {
30 .irq
= AR71XX_PCI_IRQ_DEV0
,
34 static int ap91_pci_plat_dev_init(struct pci_dev
*dev
)
36 switch (PCI_SLOT(dev
->devfn
)) {
38 dev
->dev
.platform_data
= &ap91_wmac_data
;
45 __init
void ap91_pci_setup_wmac_leds(struct gpio_led
*leds
, int num_leds
)
47 ap91_wmac_data
.leds
= leds
;
48 ap91_wmac_data
.num_leds
= num_leds
;
51 __init
void ap91_pci_setup_wmac_led_pin(int pin
)
53 ap91_wmac_data
.led_pin
= pin
;
56 __init
void ap91_pci_setup_wmac_gpio(u32 mask
, u32 val
)
58 ap91_wmac_data
.gpio_mask
= mask
;
59 ap91_wmac_data
.gpio_val
= val
;
62 void __init
ap91_pci_init(u8
*cal_data
, u8
*mac_addr
)
65 memcpy(ap91_wmac_data
.eeprom_data
, cal_data
,
66 sizeof(ap91_wmac_data
.eeprom_data
));
69 memcpy(ap91_wmac_mac
, mac_addr
, sizeof(ap91_wmac_mac
));
70 ap91_wmac_data
.macaddr
= ap91_wmac_mac
;
73 ar71xx_pci_plat_dev_init
= ap91_pci_plat_dev_init
;
74 ar71xx_pci_init(ARRAY_SIZE(ap91_pci_irqs
), ap91_pci_irqs
);
76 pci_enable_ath9k_fixup(0, ap91_wmac_data
.eeprom_data
);