diff options
-rw-r--r-- | drivers/pci/cadence/pcie-cadence-ep.c | 3 | ||||
-rw-r--r-- | drivers/pci/dwc/pcie-designware-ep.c | 13 | ||||
-rw-r--r-- | drivers/pci/endpoint/functions/pci-epf-test.c | 5 | ||||
-rw-r--r-- | drivers/pci/endpoint/pci-epc-core.c | 7 | ||||
-rw-r--r-- | include/linux/pci-epc.h | 5 |
5 files changed, 23 insertions, 10 deletions
diff --git a/drivers/pci/cadence/pcie-cadence-ep.c b/drivers/pci/cadence/pcie-cadence-ep.c index 2905e098678c..3d8283e450a9 100644 --- a/drivers/pci/cadence/pcie-cadence-ep.c +++ b/drivers/pci/cadence/pcie-cadence-ep.c | |||
@@ -145,10 +145,11 @@ static int cdns_pcie_ep_set_bar(struct pci_epc *epc, u8 fn, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static void cdns_pcie_ep_clear_bar(struct pci_epc *epc, u8 fn, | 147 | static void cdns_pcie_ep_clear_bar(struct pci_epc *epc, u8 fn, |
148 | enum pci_barno bar) | 148 | struct pci_epf_bar *epf_bar) |
149 | { | 149 | { |
150 | struct cdns_pcie_ep *ep = epc_get_drvdata(epc); | 150 | struct cdns_pcie_ep *ep = epc_get_drvdata(epc); |
151 | struct cdns_pcie *pcie = &ep->pcie; | 151 | struct cdns_pcie *pcie = &ep->pcie; |
152 | enum pci_barno bar = epf_bar->barno; | ||
152 | u32 reg, cfg, b, ctrl; | 153 | u32 reg, cfg, b, ctrl; |
153 | 154 | ||
154 | if (bar < BAR_4) { | 155 | if (bar < BAR_4) { |
diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index 70c8c1eedb42..c9bdb5f139b4 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c | |||
@@ -19,7 +19,8 @@ void dw_pcie_ep_linkup(struct dw_pcie_ep *ep) | |||
19 | pci_epc_linkup(epc); | 19 | pci_epc_linkup(epc); |
20 | } | 20 | } |
21 | 21 | ||
22 | void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) | 22 | static void __dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar, |
23 | int flags) | ||
23 | { | 24 | { |
24 | u32 reg; | 25 | u32 reg; |
25 | 26 | ||
@@ -30,6 +31,11 @@ void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) | |||
30 | dw_pcie_dbi_ro_wr_dis(pci); | 31 | dw_pcie_dbi_ro_wr_dis(pci); |
31 | } | 32 | } |
32 | 33 | ||
34 | void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) | ||
35 | { | ||
36 | __dw_pcie_ep_reset_bar(pci, bar, 0); | ||
37 | } | ||
38 | |||
33 | static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, | 39 | static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, |
34 | struct pci_epf_header *hdr) | 40 | struct pci_epf_header *hdr) |
35 | { | 41 | { |
@@ -104,13 +110,14 @@ static int dw_pcie_ep_outbound_atu(struct dw_pcie_ep *ep, phys_addr_t phys_addr, | |||
104 | } | 110 | } |
105 | 111 | ||
106 | static void dw_pcie_ep_clear_bar(struct pci_epc *epc, u8 func_no, | 112 | static void dw_pcie_ep_clear_bar(struct pci_epc *epc, u8 func_no, |
107 | enum pci_barno bar) | 113 | struct pci_epf_bar *epf_bar) |
108 | { | 114 | { |
109 | struct dw_pcie_ep *ep = epc_get_drvdata(epc); | 115 | struct dw_pcie_ep *ep = epc_get_drvdata(epc); |
110 | struct dw_pcie *pci = to_dw_pcie_from_ep(ep); | 116 | struct dw_pcie *pci = to_dw_pcie_from_ep(ep); |
117 | enum pci_barno bar = epf_bar->barno; | ||
111 | u32 atu_index = ep->bar_to_atu[bar]; | 118 | u32 atu_index = ep->bar_to_atu[bar]; |
112 | 119 | ||
113 | dw_pcie_ep_reset_bar(pci, bar); | 120 | __dw_pcie_ep_reset_bar(pci, bar, epf_bar->flags); |
114 | 121 | ||
115 | dw_pcie_disable_atu(pci, atu_index, DW_PCIE_REGION_INBOUND); | 122 | dw_pcie_disable_atu(pci, atu_index, DW_PCIE_REGION_INBOUND); |
116 | clear_bit(atu_index, ep->ib_window_map); | 123 | clear_bit(atu_index, ep->ib_window_map); |
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index d46e3ebabb8e..7cef85124325 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c | |||
@@ -344,14 +344,17 @@ static void pci_epf_test_unbind(struct pci_epf *epf) | |||
344 | { | 344 | { |
345 | struct pci_epf_test *epf_test = epf_get_drvdata(epf); | 345 | struct pci_epf_test *epf_test = epf_get_drvdata(epf); |
346 | struct pci_epc *epc = epf->epc; | 346 | struct pci_epc *epc = epf->epc; |
347 | struct pci_epf_bar *epf_bar; | ||
347 | int bar; | 348 | int bar; |
348 | 349 | ||
349 | cancel_delayed_work(&epf_test->cmd_handler); | 350 | cancel_delayed_work(&epf_test->cmd_handler); |
350 | pci_epc_stop(epc); | 351 | pci_epc_stop(epc); |
351 | for (bar = BAR_0; bar <= BAR_5; bar++) { | 352 | for (bar = BAR_0; bar <= BAR_5; bar++) { |
353 | epf_bar = &epf->bar[bar]; | ||
354 | |||
352 | if (epf_test->reg[bar]) { | 355 | if (epf_test->reg[bar]) { |
353 | pci_epf_free_space(epf, epf_test->reg[bar], bar); | 356 | pci_epf_free_space(epf, epf_test->reg[bar], bar); |
354 | pci_epc_clear_bar(epc, epf->func_no, bar); | 357 | pci_epc_clear_bar(epc, epf->func_no, epf_bar); |
355 | } | 358 | } |
356 | } | 359 | } |
357 | } | 360 | } |
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 8637822605ff..eccc942043cb 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c | |||
@@ -276,11 +276,12 @@ EXPORT_SYMBOL_GPL(pci_epc_map_addr); | |||
276 | * pci_epc_clear_bar() - reset the BAR | 276 | * pci_epc_clear_bar() - reset the BAR |
277 | * @epc: the EPC device for which the BAR has to be cleared | 277 | * @epc: the EPC device for which the BAR has to be cleared |
278 | * @func_no: the endpoint function number in the EPC device | 278 | * @func_no: the endpoint function number in the EPC device |
279 | * @bar: the BAR number that has to be reset | 279 | * @epf_bar: the struct epf_bar that contains the BAR information |
280 | * | 280 | * |
281 | * Invoke to reset the BAR of the endpoint device. | 281 | * Invoke to reset the BAR of the endpoint device. |
282 | */ | 282 | */ |
283 | void pci_epc_clear_bar(struct pci_epc *epc, u8 func_no, int bar) | 283 | void pci_epc_clear_bar(struct pci_epc *epc, u8 func_no, |
284 | struct pci_epf_bar *epf_bar) | ||
284 | { | 285 | { |
285 | unsigned long flags; | 286 | unsigned long flags; |
286 | 287 | ||
@@ -291,7 +292,7 @@ void pci_epc_clear_bar(struct pci_epc *epc, u8 func_no, int bar) | |||
291 | return; | 292 | return; |
292 | 293 | ||
293 | spin_lock_irqsave(&epc->lock, flags); | 294 | spin_lock_irqsave(&epc->lock, flags); |
294 | epc->ops->clear_bar(epc, func_no, bar); | 295 | epc->ops->clear_bar(epc, func_no, epf_bar); |
295 | spin_unlock_irqrestore(&epc->lock, flags); | 296 | spin_unlock_irqrestore(&epc->lock, flags); |
296 | } | 297 | } |
297 | EXPORT_SYMBOL_GPL(pci_epc_clear_bar); | 298 | EXPORT_SYMBOL_GPL(pci_epc_clear_bar); |
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 75bae8aabbf9..af657ca58b70 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h | |||
@@ -41,7 +41,7 @@ struct pci_epc_ops { | |||
41 | int (*set_bar)(struct pci_epc *epc, u8 func_no, | 41 | int (*set_bar)(struct pci_epc *epc, u8 func_no, |
42 | struct pci_epf_bar *epf_bar); | 42 | struct pci_epf_bar *epf_bar); |
43 | void (*clear_bar)(struct pci_epc *epc, u8 func_no, | 43 | void (*clear_bar)(struct pci_epc *epc, u8 func_no, |
44 | enum pci_barno bar); | 44 | struct pci_epf_bar *epf_bar); |
45 | int (*map_addr)(struct pci_epc *epc, u8 func_no, | 45 | int (*map_addr)(struct pci_epc *epc, u8 func_no, |
46 | phys_addr_t addr, u64 pci_addr, size_t size); | 46 | phys_addr_t addr, u64 pci_addr, size_t size); |
47 | void (*unmap_addr)(struct pci_epc *epc, u8 func_no, | 47 | void (*unmap_addr)(struct pci_epc *epc, u8 func_no, |
@@ -127,7 +127,8 @@ int pci_epc_write_header(struct pci_epc *epc, u8 func_no, | |||
127 | struct pci_epf_header *hdr); | 127 | struct pci_epf_header *hdr); |
128 | int pci_epc_set_bar(struct pci_epc *epc, u8 func_no, | 128 | int pci_epc_set_bar(struct pci_epc *epc, u8 func_no, |
129 | struct pci_epf_bar *epf_bar); | 129 | struct pci_epf_bar *epf_bar); |
130 | void pci_epc_clear_bar(struct pci_epc *epc, u8 func_no, int bar); | 130 | void pci_epc_clear_bar(struct pci_epc *epc, u8 func_no, |
131 | struct pci_epf_bar *epf_bar); | ||
131 | int pci_epc_map_addr(struct pci_epc *epc, u8 func_no, | 132 | int pci_epc_map_addr(struct pci_epc *epc, u8 func_no, |
132 | phys_addr_t phys_addr, | 133 | phys_addr_t phys_addr, |
133 | u64 pci_addr, size_t size); | 134 | u64 pci_addr, size_t size); |