base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0017-pci-mvebu-fix-the-emulation-of-the-status-register.patch
1 From 33e771556f5e1a59c7dbcd953ce858dd3e50ed66 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 23 May 2013 16:32:53 +0200
4 Subject: [PATCH 017/203] pci: mvebu: fix the emulation of the status register
5
6 The status register of the PCI configuration space of PCI-to-PCI
7 bridges contain some read-only bits, and so write-1-to-clear bits. So,
8 the Linux PCI core sometimes writes 0xffff to this status register,
9 and in the current PCI-to-PCI bridge emulation code of the Marvell
10 driver, we do take all those 1s being written. Even the read-only bits
11 are being overwritten.
12
13 For now, all the read-only bits should be emulated to have the zero
14 value.
15
16 The other bits, that are write-1-to-clear bits are used to report
17 various kind of errors, and are never set by the emulated bridge, so
18 there is no need to support this write-1-to-clear bits mechanism.
19
20 As a conclusion, the easiest solution is to simply emulate this status
21 register by returning zero when read, and ignore the writes to it.
22
23 This has two visible effects:
24
25  * The devsel is no longer 'unknown' in, i.e
26
27    Flags: bus master, 66MHz, user-definable features, ?? devsel, latency 0
28
29    becomes:
30
31    Flags: bus master, 66MHz, user-definable features, fast devsel, latency 0
32
33    in lspci -v.
34
35    This was caused by a value of 11b being read for devsel, which is
36    an invalid value. This 11b value being read was due to a previous
37    write of 0xffff into the status register.
38
39  * The capability list is no longer broken, because we indicate to the
40    Linux PCI core that we don't have a Capabilities Pointer in the PCI
41    configuration space of this bridge. The following message is
42    therefore no longer visible in lspci -v:
43
44    Capabilities: [fc] <chain broken>
45
46 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
47 Acked-by: Bjorn Helgaas <bhelgaas@google.com>
48 Signed-off-by: Jason Cooper <jason@lakedaemon.net>
49 ---
50  drivers/pci/host/pci-mvebu.c | 5 +----
51  1 file changed, 1 insertion(+), 4 deletions(-)
52
53 --- a/drivers/pci/host/pci-mvebu.c
54 +++ b/drivers/pci/host/pci-mvebu.c
55 @@ -69,7 +69,6 @@ struct mvebu_sw_pci_bridge {
56         u16 vendor;
57         u16 device;
58         u16 command;
59 -       u16 status;
60         u16 class;
61         u8 interface;
62         u8 revision;
63 @@ -359,7 +358,6 @@ static void mvebu_sw_pci_bridge_init(str
64  
65         memset(bridge, 0, sizeof(struct mvebu_sw_pci_bridge));
66  
67 -       bridge->status = PCI_STATUS_CAP_LIST;
68         bridge->class = PCI_CLASS_BRIDGE_PCI;
69         bridge->vendor = PCI_VENDOR_ID_MARVELL;
70         bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;
71 @@ -386,7 +384,7 @@ static int mvebu_sw_pci_bridge_read(stru
72                 break;
73  
74         case PCI_COMMAND:
75 -               *value = bridge->status << 16 | bridge->command;
76 +               *value = bridge->command;
77                 break;
78  
79         case PCI_CLASS_REVISION:
80 @@ -479,7 +477,6 @@ static int mvebu_sw_pci_bridge_write(str
81         switch (where & ~3) {
82         case PCI_COMMAND:
83                 bridge->command = value & 0xffff;
84 -               bridge->status = value >> 16;
85                 break;
86  
87         case PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_1: