diff options
-rw-r--r-- | Documentation/devicetree/bindings/pci/host-generic-pci.txt | 5 | ||||
-rw-r--r-- | drivers/pci/host/pci-host-generic.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/pci/host-generic-pci.txt b/Documentation/devicetree/bindings/pci/host-generic-pci.txt index cf3e205e0b7e..3f1d3fca62bb 100644 --- a/Documentation/devicetree/bindings/pci/host-generic-pci.txt +++ b/Documentation/devicetree/bindings/pci/host-generic-pci.txt | |||
@@ -34,8 +34,9 @@ Properties of the host controller node: | |||
34 | - #size-cells : Must be 2. | 34 | - #size-cells : Must be 2. |
35 | 35 | ||
36 | - reg : The Configuration Space base address and size, as accessed | 36 | - reg : The Configuration Space base address and size, as accessed |
37 | from the parent bus. | 37 | from the parent bus. The base address corresponds to |
38 | 38 | the first bus in the "bus-range" property. If no | |
39 | "bus-range" is specified, this will be bus 0 (the default). | ||
39 | 40 | ||
40 | Properties of the /chosen node: | 41 | Properties of the /chosen node: |
41 | 42 | ||
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 895c0e39ca3b..5434c90db243 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c | |||
@@ -169,6 +169,7 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) | |||
169 | struct resource *bus_range; | 169 | struct resource *bus_range; |
170 | struct device *dev = pci->host.dev.parent; | 170 | struct device *dev = pci->host.dev.parent; |
171 | struct device_node *np = dev->of_node; | 171 | struct device_node *np = dev->of_node; |
172 | u32 sz = 1 << pci->cfg.ops->bus_shift; | ||
172 | 173 | ||
173 | err = of_address_to_resource(np, 0, &pci->cfg.res); | 174 | err = of_address_to_resource(np, 0, &pci->cfg.res); |
174 | if (err) { | 175 | if (err) { |
@@ -196,10 +197,9 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) | |||
196 | bus_range = pci->cfg.bus_range; | 197 | bus_range = pci->cfg.bus_range; |
197 | for (busn = bus_range->start; busn <= bus_range->end; ++busn) { | 198 | for (busn = bus_range->start; busn <= bus_range->end; ++busn) { |
198 | u32 idx = busn - bus_range->start; | 199 | u32 idx = busn - bus_range->start; |
199 | u32 sz = 1 << pci->cfg.ops->bus_shift; | ||
200 | 200 | ||
201 | pci->cfg.win[idx] = devm_ioremap(dev, | 201 | pci->cfg.win[idx] = devm_ioremap(dev, |
202 | pci->cfg.res.start + busn * sz, | 202 | pci->cfg.res.start + idx * sz, |
203 | sz); | 203 | sz); |
204 | if (!pci->cfg.win[idx]) | 204 | if (!pci->cfg.win[idx]) |
205 | return -ENOMEM; | 205 | return -ENOMEM; |