Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715240

[PATCH 11/18] PCI: dwc: dra7xx: Reset all BARs during initialization

From Kishon Vijay Abraham I <kishon@ti.com>
Newsgroups linux.kernel
Subject [PATCH 11/18] PCI: dwc: dra7xx: Reset all BARs during initialization
Date 2017-08-18 17:10 +0200
Message-ID <ufR4n-5rS-61@gated-at.bofh.it> (permalink)
References <ufQUF-58U-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


dra7xx has all base address registers (BAR) enabled by default. Reset all
BARs during initialization and so that BARs are enabled only if they are
actually used.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/pci/dwc/pci-dra7xx.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c
index f2fc5f47064e..ee61f833b62c 100644
--- a/drivers/pci/dwc/pci-dra7xx.c
+++ b/drivers/pci/dwc/pci-dra7xx.c
@@ -335,10 +335,23 @@ static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
+static void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)
+{
+	u32 reg;
+
+	reg = PCI_BASE_ADDRESS_0 + (4 * bar);
+	dw_pcie_writel_dbi2(pci, reg, 0x0);
+	dw_pcie_writel_dbi(pci, reg, 0x0);
+}
+
 static void dra7xx_pcie_ep_init(struct dw_pcie_ep *ep)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
 	struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
+	enum pci_barno bar;
+
+	for (bar = BAR_0; bar <= BAR_5; bar++)
+		dw_pcie_ep_reset_bar(pci, bar);
 
 	dra7xx_pcie_enable_wrapper_interrupts(dra7xx);
 }
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/18] PCI: endpoint: Make pci-epf-test more flexible Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 04/18] PCI: endpoint: pci-epc-mem: Add support for configurable page size Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 03/18] PCI: endpoint: pci-epf-core: Make ->remove() callback optional Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 10/18] PCI: dwc: designware: Provide page_size to pci_epc_mem Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 12/18] PCI: dwc: designware-ep: Do not disable BARs during initialization Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 01/18] PCI: endpoint: pci-epc-core: Use of_dma_configure() to set initial dma mask Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 05/18] PCI: endpoint: functions/pci-epf-test: Add "volatile" to pci_epf_test_reg Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 14/18] misc: pci_endpoint_test: Add support to provide aligned buffer addresses Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  [PATCH 11/18] PCI: dwc: dra7xx: Reset all BARs during initialization Kishon Vijay Abraham I <kishon@ti.com> - 2017-08-18 17:10 +0200
  Re: [PATCH 00/18] PCI: endpoint: Make pci-epf-test more flexible Bjorn Helgaas <helgaas@kernel.org> - 2017-08-18 18:00 +0200

csiph-web