source: trunk/target/linux/ar71xx/files/arch/mips/ar71xx/dev-db120-pci.c @ 29022

Last change on this file since 29022 was 29022, checked in by juhosg, 5 years ago

ar71xx: fixup onboard PCIe chip registration on the DB120 board

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
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
22static struct ath9k_platform_data db120_wmac_data = {
23        .led_pin = -1,
24};
25static char db120_wmac_mac[6];
26
27static struct ar71xx_pci_irq db120_pci_irqs[] __initdata = {
28        {
29                .slot   = 0,
30                .pin    = 1,
31                .irq    = AR71XX_PCI_IRQ_DEV0,
32        }
33};
34
35static 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
46void __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}
Note: See TracBrowser for help on using the repository browser.