From 62e6798c2365a95fe08f12802a1357a51c095d3a Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Wed, 14 Mar 2012 10:36:09 +0100 Subject: [PATCH] --- yaml --- r: 309045 b: refs/heads/master c: a68ad4d892c6254310d2bfc3d6b0c0d989377636 h: refs/heads/master i: 309043: 2757c469bfdfd7a45f10c0f30ca5c73c2ed7cbca v: v3 --- [refs] | 2 +- trunk/arch/mips/ath79/mach-ubnt-xm.c | 13 ++++++++++++- trunk/arch/mips/ath79/pci.c | 14 ++++++++------ trunk/arch/mips/ath79/pci.h | 4 +++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 21a4719e0a2c..ac796113502e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 881b6ef0cca3395ac0171472a1ce768fede7535b +refs/heads/master: a68ad4d892c6254310d2bfc3d6b0c0d989377636 diff --git a/trunk/arch/mips/ath79/mach-ubnt-xm.c b/trunk/arch/mips/ath79/mach-ubnt-xm.c index 1e6b986cb470..ca47ba57a206 100644 --- a/trunk/arch/mips/ath79/mach-ubnt-xm.c +++ b/trunk/arch/mips/ath79/mach-ubnt-xm.c @@ -85,16 +85,27 @@ static struct ath9k_platform_data ubnt_xm_eeprom_data; static struct ar724x_pci_data ubnt_xm_pci_data[] = { { .irq = ATH79_PCI_IRQ(0), - .pdata = &ubnt_xm_eeprom_data, }, }; +static int ubnt_xm_pci_plat_dev_init(struct pci_dev *dev) +{ + switch (PCI_SLOT(dev->devfn)) { + case 0: + dev->dev.platform_data = &ubnt_xm_eeprom_data; + break; + } + + return 0; +} + static void __init ubnt_xm_pci_init(void) { memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, sizeof(ubnt_xm_eeprom_data.eeprom_data)); ar724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data)); + ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init); ath79_register_pci(); } #else diff --git a/trunk/arch/mips/ath79/pci.c b/trunk/arch/mips/ath79/pci.c index 14f981c295d2..2b4c730ccbcb 100644 --- a/trunk/arch/mips/ath79/pci.c +++ b/trunk/arch/mips/ath79/pci.c @@ -14,6 +14,7 @@ #include #include "pci.h" +static int (*ath79_pci_plat_dev_init)(struct pci_dev *dev); static struct ar724x_pci_data *pci_data; static int pci_data_size; @@ -38,14 +39,15 @@ int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) int pcibios_plat_dev_init(struct pci_dev *dev) { - unsigned int devfn = dev->devfn; - - if (devfn > pci_data_size - 1) - return PCIBIOS_DEVICE_NOT_FOUND; + if (ath79_pci_plat_dev_init) + return ath79_pci_plat_dev_init(dev); - dev->dev.platform_data = pci_data[devfn].pdata; + return 0; +} - return PCIBIOS_SUCCESSFUL; +void __init ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)) +{ + ath79_pci_plat_dev_init = func; } int __init ath79_register_pci(void) diff --git a/trunk/arch/mips/ath79/pci.h b/trunk/arch/mips/ath79/pci.h index e0601c4a7fc6..de30e158932d 100644 --- a/trunk/arch/mips/ath79/pci.h +++ b/trunk/arch/mips/ath79/pci.h @@ -13,14 +13,16 @@ struct ar724x_pci_data { int irq; - void *pdata; }; void ar724x_pci_add_data(struct ar724x_pci_data *data, int size); #ifdef CONFIG_PCI +void ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)); int ath79_register_pci(void); #else +static inline void +ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *)) {} static inline int ath79_register_pci(void) { return 0; } #endif