fix aruba compile for .21
[librecmc/librecmc.git] / target / linux / aruba-2.6 / patches / 003-pci.patch
1 diff -Nur linux-2.6.15/arch/mips/pci/Makefile linux-2.6.15-openwrt/arch/mips/pci/Makefile
2 --- linux-2.6.15/arch/mips/pci/Makefile 2006-01-03 04:21:10.000000000 +0100
3 +++ linux-2.6.15-openwrt/arch/mips/pci/Makefile 2006-01-10 00:32:32.000000000 +0100
4 @@ -53,3 +53,4 @@
5  obj-$(CONFIG_VICTOR_MPC30X)    += fixup-mpc30x.o
6  obj-$(CONFIG_ZAO_CAPCELLA)     += fixup-capcella.o
7  obj-$(CONFIG_WR_PPMC)          += fixup-wrppmc.o
8 +obj-$(CONFIG_MACH_ARUBA)        += fixup-aruba.o ops-aruba.o pci-aruba.o
9 diff -Nur linux-2.6.15/drivers/pci/access.c linux-2.6.15-openwrt/drivers/pci/access.c
10 --- linux-2.6.15/drivers/pci/access.c   2006-01-03 04:21:10.000000000 +0100
11 +++ linux-2.6.15-openwrt/drivers/pci/access.c   2006-01-10 00:43:10.000000000 +0100
12 @@ -21,6 +21,7 @@
13  #define PCI_word_BAD (pos & 1)
14  #define PCI_dword_BAD (pos & 3)
15  
16 +#ifdef __MIPSEB__
17  #define PCI_OP_READ(size,type,len) \
18  int pci_bus_read_config_##size \
19         (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
20 @@ -31,11 +32,32 @@
21         if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER;       \
22         spin_lock_irqsave(&pci_lock, flags);                            \
23         res = bus->ops->read(bus, devfn, pos, len, &data);              \
24 +       if (len == 1)                                                   \
25 +        *value = (type)((data >> 24) & 0xff);                          \
26 +        else if (len == 2)                                             \
27 +        *value = (type)((data >> 16) & 0xffff);                        \
28 +       else                                                            \
29         *value = (type)data;                                            \
30         spin_unlock_irqrestore(&pci_lock, flags);                       \
31         return res;                                                     \
32  }
33 +#else
34  
35 +#define PCI_OP_READ(size,type,len) \
36 +int pci_bus_read_config_##size \
37 +       (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
38 +{                                                                      \
39 +       int res;                                                        \
40 +       unsigned long flags;                                            \
41 +       u32 data = 0;                                                   \
42 +       if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER;       \
43 +       spin_lock_irqsave(&pci_lock, flags);                            \
44 +       res = bus->ops->read(bus, devfn, pos, len, &data);              \
45 +       *value = (type)data;                                            \
46 +       spin_unlock_irqrestore(&pci_lock, flags);                       \
47 +       return res;                                                     \
48 +}
49 +#endif
50  #define PCI_OP_WRITE(size,type,len) \
51  int pci_bus_write_config_##size \
52         (struct pci_bus *bus, unsigned int devfn, int pos, type value)  \