base-files: define yes/no as valid boolean options
[openwrt/staging/wigyori.git] / target / linux / mvebu / patches-3.10 / 0076-ARM-pci-add-add_bus-and-remove_bus-hooks-to-hw_pci.patch
1 From ea6a42a34462ea382209ff4f083b8b17260eb409 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 19 Jun 2013 18:27:20 +0200
4 Subject: [PATCH 076/203] ARM: pci: add ->add_bus() and ->remove_bus() hooks to
5 hw_pci
6
7 Some PCI drivers may need to adjust the pci_bus structure after it has
8 been allocated by the Linux PCI core. The PCI core allows
9 architectures to implement the pcibios_add_bus() and
10 pcibios_remove_bus() for this purpose. This commit therefore extends
11 the hw_pci and pci_sys_data structures of the ARM PCI core to allow
12 PCI drivers to register ->add_bus() and ->remove_bus() in hw_pci,
13 which will get called when a bus is added or removed from the system.
14
15 This will be used for example by the Marvell PCIe driver to connect a
16 particular PCI bus with its corresponding MSI chip to handle Message
17 Signaled Interrupts.
18
19 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
20 Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
21 Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
22 Tested-by: Daniel Price <daniel.price@gmail.com>
23 Tested-by: Thierry Reding <thierry.reding@gmail.com>
24 ---
25 arch/arm/include/asm/mach/pci.h | 4 ++++
26 arch/arm/kernel/bios32.c | 16 ++++++++++++++++
27 2 files changed, 20 insertions(+)
28
29 --- a/arch/arm/include/asm/mach/pci.h
30 +++ b/arch/arm/include/asm/mach/pci.h
31 @@ -35,6 +35,8 @@ struct hw_pci {
32 resource_size_t start,
33 resource_size_t size,
34 resource_size_t align);
35 + void (*add_bus)(struct pci_bus *bus);
36 + void (*remove_bus)(struct pci_bus *bus);
37 };
38
39 /*
40 @@ -62,6 +64,8 @@ struct pci_sys_data {
41 resource_size_t start,
42 resource_size_t size,
43 resource_size_t align);
44 + void (*add_bus)(struct pci_bus *bus);
45 + void (*remove_bus)(struct pci_bus *bus);
46 void *private_data; /* platform controller private data */
47 };
48
49 --- a/arch/arm/kernel/bios32.c
50 +++ b/arch/arm/kernel/bios32.c
51 @@ -363,6 +363,20 @@ void pcibios_fixup_bus(struct pci_bus *b
52 }
53 EXPORT_SYMBOL(pcibios_fixup_bus);
54
55 +void pcibios_add_bus(struct pci_bus *bus)
56 +{
57 + struct pci_sys_data *sys = bus->sysdata;
58 + if (sys->add_bus)
59 + sys->add_bus(bus);
60 +}
61 +
62 +void pcibios_remove_bus(struct pci_bus *bus)
63 +{
64 + struct pci_sys_data *sys = bus->sysdata;
65 + if (sys->remove_bus)
66 + sys->remove_bus(bus);
67 +}
68 +
69 /*
70 * Swizzle the device pin each time we cross a bridge. If a platform does
71 * not provide a swizzle function, we perform the standard PCI swizzling.
72 @@ -463,6 +477,8 @@ static void pcibios_init_hw(struct hw_pc
73 sys->swizzle = hw->swizzle;
74 sys->map_irq = hw->map_irq;
75 sys->align_resource = hw->align_resource;
76 + sys->add_bus = hw->add_bus;
77 + sys->remove_bus = hw->remove_bus;
78 INIT_LIST_HEAD(&sys->resources);
79
80 if (hw->private_data)