* [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc
@ 2017-08-28 10:52 Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 1/9] PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init Zhiqiang Hou
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Split PATCHv4 4/9 into 2 patches, one is for moving the declare place
of ls1021 specific host_init function, another one is to make ls1021
host_init call the layerscape platform common host_init function.
Squashed PATCHv4 6/9 and 7/9 together.
Hou Zhiqiang (9):
PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init
PCI: layerscape: move STRFMR1 access out from the DBI write-enable
bracket
PCI: layerscape: add class code and multifunction fixups for ls1021a
PCI: layerscape: move ls1021 specific host_init behind the common one
PCI: layerscape: refactor the host_init function
PCI: layerscape: Disable the outbound windows configured by bootloader
PCI: designware: add accessors for write permission of DBI read-only
registers
PCI: designware: enable write permission before updating DBI RO
registers
PCI: dwc: remove the obsolete fixups
drivers/pci/dwc/pci-layerscape.c | 92 ++++++++++++++++++----------------
drivers/pci/dwc/pcie-artpec6.c | 6 ---
drivers/pci/dwc/pcie-designware-host.c | 6 +++
drivers/pci/dwc/pcie-designware.h | 25 +++++++++
4 files changed, 80 insertions(+), 49 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCHv5 1/9] PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 2/9] PCI: layerscape: move STRFMR1 access out from the DBI write-enable bracket Zhiqiang Hou
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
This function has been added to ls1021a host init function, but lost to
add to layerscape common host init, so other platforms still use the
setups from bootloader.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pci-layerscape.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 7581490f007c..aebefb42377a 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -165,6 +165,8 @@ static int ls_pcie_host_init(struct pcie_port *pp)
ls_pcie_drop_msg_tlp(pcie);
iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ dw_pcie_setup_rc(pp);
+
return 0;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 2/9] PCI: layerscape: move STRFMR1 access out from the DBI write-enable bracket
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 1/9] PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 3/9] PCI: layerscape: add class code and multifunction fixups for ls1021a Zhiqiang Hou
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
The STRFMR1 is not a DBI read-only register, so move it out from the
write-enable bracket.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pci-layerscape.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index aebefb42377a..c16940044ed6 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -162,9 +162,10 @@ static int ls_pcie_host_init(struct pcie_port *pp)
iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
ls_pcie_fix_class(pcie);
ls_pcie_clear_multifunction(pcie);
- ls_pcie_drop_msg_tlp(pcie);
iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ ls_pcie_drop_msg_tlp(pcie);
+
dw_pcie_setup_rc(pp);
return 0;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 3/9] PCI: layerscape: add class code and multifunction fixups for ls1021a
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 1/9] PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 2/9] PCI: layerscape: move STRFMR1 access out from the DBI write-enable bracket Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 4/9] PCI: layerscape: move ls1021 specific host_init behind the common one Zhiqiang Hou
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
The current code depends on these 2 fixups implemented in bootloader,
this patch is to resolve the dependence.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pci-layerscape.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index c16940044ed6..3aa34214643c 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -134,6 +134,11 @@ static int ls1021_pcie_host_init(struct pcie_port *pp)
dw_pcie_setup_rc(pp);
+ iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ ls_pcie_fix_class(pcie);
+ ls_pcie_clear_multifunction(pcie);
+ iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+
ls_pcie_drop_msg_tlp(pcie);
return 0;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 4/9] PCI: layerscape: move ls1021 specific host_init behind the common one
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (2 preceding siblings ...)
2017-08-28 10:52 ` [PATCHv5 3/9] PCI: layerscape: add class code and multifunction fixups for ls1021a Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 5/9] PCI: layerscape: refactor the host_init function Zhiqiang Hou
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
To prepare for calling the common host_init in ls1021 spceific
host_init, moves ls1021 specific host_init behind the common
host_init function.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- New patch, split from 4/9 patch v4
drivers/pci/dwc/pci-layerscape.c | 64 ++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 3aa34214643c..160035efa4d9 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -108,6 +108,38 @@ static int ls1021_pcie_link_up(struct dw_pcie *pci)
return 1;
}
+static int ls_pcie_link_up(struct dw_pcie *pci)
+{
+ struct ls_pcie *pcie = to_ls_pcie(pci);
+ u32 state;
+
+ state = (ioread32(pcie->lut + pcie->drvdata->lut_dbg) >>
+ pcie->drvdata->ltssm_shift) &
+ LTSSM_STATE_MASK;
+
+ if (state < LTSSM_PCIE_L0)
+ return 0;
+
+ return 1;
+}
+
+static int ls_pcie_host_init(struct pcie_port *pp)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+ struct ls_pcie *pcie = to_ls_pcie(pci);
+
+ iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ ls_pcie_fix_class(pcie);
+ ls_pcie_clear_multifunction(pcie);
+ iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+
+ ls_pcie_drop_msg_tlp(pcie);
+
+ dw_pcie_setup_rc(pp);
+
+ return 0;
+}
+
static int ls1021_pcie_host_init(struct pcie_port *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
@@ -144,38 +176,6 @@ static int ls1021_pcie_host_init(struct pcie_port *pp)
return 0;
}
-static int ls_pcie_link_up(struct dw_pcie *pci)
-{
- struct ls_pcie *pcie = to_ls_pcie(pci);
- u32 state;
-
- state = (ioread32(pcie->lut + pcie->drvdata->lut_dbg) >>
- pcie->drvdata->ltssm_shift) &
- LTSSM_STATE_MASK;
-
- if (state < LTSSM_PCIE_L0)
- return 0;
-
- return 1;
-}
-
-static int ls_pcie_host_init(struct pcie_port *pp)
-{
- struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
- struct ls_pcie *pcie = to_ls_pcie(pci);
-
- iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
- ls_pcie_fix_class(pcie);
- ls_pcie_clear_multifunction(pcie);
- iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
-
- ls_pcie_drop_msg_tlp(pcie);
-
- dw_pcie_setup_rc(pp);
-
- return 0;
-}
-
static int ls_pcie_msi_host_init(struct pcie_port *pp,
struct msi_controller *chip)
{
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 5/9] PCI: layerscape: refactor the host_init function
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (3 preceding siblings ...)
2017-08-28 10:52 ` [PATCHv5 4/9] PCI: layerscape: move ls1021 specific host_init behind the common one Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 6/9] PCI: layerscape: Disable the outbound windows configured by bootloader Zhiqiang Hou
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Make the ls1021a specific host_init reuse layerscape platform
common host_init function.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- Removed ls1021 host_init moving part from this patch
drivers/pci/dwc/pci-layerscape.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 160035efa4d9..27234dae4cba 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -164,16 +164,7 @@ static int ls1021_pcie_host_init(struct pcie_port *pp)
}
pcie->index = index[1];
- dw_pcie_setup_rc(pp);
-
- iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
- ls_pcie_fix_class(pcie);
- ls_pcie_clear_multifunction(pcie);
- iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
-
- ls_pcie_drop_msg_tlp(pcie);
-
- return 0;
+ return ls_pcie_host_init(pp);
}
static int ls_pcie_msi_host_init(struct pcie_port *pp,
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 6/9] PCI: layerscape: Disable the outbound windows configured by bootloader
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (4 preceding siblings ...)
2017-08-28 10:52 ` [PATCHv5 5/9] PCI: layerscape: refactor the host_init function Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 7/9] PCI: designware: add accessors for write permission of DBI read-only registers Zhiqiang Hou
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Disable all the outbound windows to avoid one transaction hitting
multiple outbound windows, because the function dw_pcie_setup_rc
will re-configure the outbound windows which maybe confict with
the bootloader configured.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pci-layerscape.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 27234dae4cba..8b5083aedf16 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -35,6 +35,8 @@
#define PCIE_STRFMR1 0x71c /* Symbol Timer & Filter Mask Register1 */
#define PCIE_DBI_RO_WR_EN 0x8bc /* DBI Read-Only Write Enable Register */
+#define PCIE_IATU_NUM 6
+
struct ls_pcie_drvdata {
u32 lut_offset;
u32 ltssm_shift;
@@ -91,6 +93,14 @@ static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie)
iowrite32(val, pci->dbi_base + PCIE_STRFMR1);
}
+static void ls_pcie_disable_outbound_atus(struct ls_pcie *pcie)
+{
+ int i;
+
+ for (i = 0; i < PCIE_IATU_NUM; i++)
+ dw_pcie_disable_atu(pcie->pci, DW_PCIE_REGION_OUTBOUND, i);
+}
+
static int ls1021_pcie_link_up(struct dw_pcie *pci)
{
u32 state;
@@ -128,6 +138,13 @@ static int ls_pcie_host_init(struct pcie_port *pp)
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct ls_pcie *pcie = to_ls_pcie(pci);
+ /*
+ * Disable the outbound windows configured by bootloader to avoid
+ * one transaction hitting multiple outbound windows and the function
+ * dw_pcie_setup_rc will re-configure the outbound windows.
+ */
+ ls_pcie_disable_outbound_atus(pcie);
+
iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
ls_pcie_fix_class(pcie);
ls_pcie_clear_multifunction(pcie);
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 7/9] PCI: designware: add accessors for write permission of DBI read-only registers
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (5 preceding siblings ...)
2017-08-28 10:52 ` [PATCHv5 6/9] PCI: layerscape: Disable the outbound windows configured by bootloader Zhiqiang Hou
@ 2017-08-28 10:52 ` Zhiqiang Hou
2017-08-28 10:53 ` [PATCHv5 8/9] PCI: designware: enable write permission before updating DBI RO registers Zhiqiang Hou
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:52 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
The read-only DBI registers can be written over when set the "Write
to RO Registers Using DBI" (DBI_RO_WR_EN) field of the register
MISC_CONTROL_1_OFF. And change to use the accessors instead accessing
the register MISC_CONTROL_1_OFF directly.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Joao Pinto <jpinto@synopsys.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- Squashed patch v4 6/9 and 7/9 together
drivers/pci/dwc/pci-layerscape.c | 5 ++---
drivers/pci/dwc/pcie-designware.h | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 8b5083aedf16..65f5d543fe89 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -33,7 +33,6 @@
/* PEX Internal Configuration Registers */
#define PCIE_STRFMR1 0x71c /* Symbol Timer & Filter Mask Register1 */
-#define PCIE_DBI_RO_WR_EN 0x8bc /* DBI Read-Only Write Enable Register */
#define PCIE_IATU_NUM 6
@@ -145,10 +144,10 @@ static int ls_pcie_host_init(struct pcie_port *pp)
*/
ls_pcie_disable_outbound_atus(pcie);
- iowrite32(1, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ dw_pcie_dbi_ro_wr_en(pci);
ls_pcie_fix_class(pcie);
ls_pcie_clear_multifunction(pcie);
- iowrite32(0, pci->dbi_base + PCIE_DBI_RO_WR_EN);
+ dw_pcie_dbi_ro_wr_dis(pci);
ls_pcie_drop_msg_tlp(pcie);
diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h
index 7366c8167404..0c5f874345f6 100644
--- a/drivers/pci/dwc/pcie-designware.h
+++ b/drivers/pci/dwc/pcie-designware.h
@@ -76,6 +76,9 @@
#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16)
#define PCIE_ATU_UPPER_TARGET 0x91C
+#define PCIE_MISC_CONTROL_1_OFF 0x8BC
+#define PCIE_DBI_RO_WR_EN (0x1 << 0)
+
/*
* iATU Unroll-specific register definitions
* From 4.80 core version the address translation will be made by unroll
@@ -279,6 +282,28 @@ static inline u32 dw_pcie_readl_dbi2(struct dw_pcie *pci, u32 reg)
return __dw_pcie_read_dbi(pci, pci->dbi_base2, reg, 0x4);
}
+static inline void dw_pcie_dbi_ro_wr_en(struct dw_pcie *pci)
+{
+ u32 reg;
+ u32 val;
+
+ reg = PCIE_MISC_CONTROL_1_OFF;
+ val = dw_pcie_readl_dbi(pci, reg);
+ val |= PCIE_DBI_RO_WR_EN;
+ dw_pcie_writel_dbi(pci, reg, val);
+}
+
+static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci)
+{
+ u32 reg;
+ u32 val;
+
+ reg = PCIE_MISC_CONTROL_1_OFF;
+ val = dw_pcie_readl_dbi(pci, reg);
+ val &= ~PCIE_DBI_RO_WR_EN;
+ dw_pcie_writel_dbi(pci, reg, val);
+}
+
#ifdef CONFIG_PCIE_DW_HOST
irqreturn_t dw_handle_msi_irq(struct pcie_port *pp);
void dw_pcie_msi_init(struct pcie_port *pp);
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 8/9] PCI: designware: enable write permission before updating DBI RO registers
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (6 preceding siblings ...)
2017-08-28 10:52 ` [PATCHv5 7/9] PCI: designware: add accessors for write permission of DBI read-only registers Zhiqiang Hou
@ 2017-08-28 10:53 ` Zhiqiang Hou
2017-08-28 10:53 ` [PATCHv5 9/9] PCI: dwc: remove the obsolete fixups Zhiqiang Hou
2017-08-29 21:45 ` [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Bjorn Helgaas
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:53 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
The existing fix doesn't actually work because the Class register and
interrupt PIN register are read-only, so it must enable the write
permission before writing the correct value to these registers.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Joao Pinto <jpinto@synopsys.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pcie-designware-host.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c
index 157621175147..582f5cc3cd96 100644
--- a/drivers/pci/dwc/pcie-designware-host.c
+++ b/drivers/pci/dwc/pcie-designware-host.c
@@ -597,10 +597,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_1, 0x00000000);
/* setup interrupt pins */
+ dw_pcie_dbi_ro_wr_en(pci);
val = dw_pcie_readl_dbi(pci, PCI_INTERRUPT_LINE);
val &= 0xffff00ff;
val |= 0x00000100;
dw_pcie_writel_dbi(pci, PCI_INTERRUPT_LINE, val);
+ dw_pcie_dbi_ro_wr_dis(pci);
/* setup bus numbers */
val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS);
@@ -637,8 +639,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
dw_pcie_wr_own_conf(pp, PCI_BASE_ADDRESS_0, 4, 0);
+ /* Enable write permission for the DBI read-only register */
+ dw_pcie_dbi_ro_wr_en(pci);
/* program correct class for RC */
dw_pcie_wr_own_conf(pp, PCI_CLASS_DEVICE, 2, PCI_CLASS_BRIDGE_PCI);
+ /* Better disable write permission right after the update */
+ dw_pcie_dbi_ro_wr_dis(pci);
dw_pcie_rd_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, &val);
val |= PORT_LOGIC_SPEED_CHANGE;
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCHv5 9/9] PCI: dwc: remove the obsolete fixups
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (7 preceding siblings ...)
2017-08-28 10:53 ` [PATCHv5 8/9] PCI: designware: enable write permission before updating DBI RO registers Zhiqiang Hou
@ 2017-08-28 10:53 ` Zhiqiang Hou
2017-08-29 21:45 ` [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Bjorn Helgaas
9 siblings, 0 replies; 11+ messages in thread
From: Zhiqiang Hou @ 2017-08-28 10:53 UTC (permalink / raw)
To: linux-pci, bhelgaas, jingoohan1, Joao.Pinto
Cc: minghuan.lian, mingkai.hu, roy.zang, niklas.cassel,
jesper.nilsson, Hou Zhiqiang
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Now, the dw_pcie_setup_rc() works well, so remove the obsolete fixups:
Remove the Class field fix code from layerscape pcie driver.
Remove the line to enable write permission of DBI RO register from
artpec6 pcie driver.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Acked-by: Roy Zang <tie-fei.zang@freescale.com>
---
V5:
- No change
drivers/pci/dwc/pci-layerscape.c | 9 ---------
drivers/pci/dwc/pcie-artpec6.c | 6 ------
2 files changed, 15 deletions(-)
diff --git a/drivers/pci/dwc/pci-layerscape.c b/drivers/pci/dwc/pci-layerscape.c
index 65f5d543fe89..c24dd77c6424 100644
--- a/drivers/pci/dwc/pci-layerscape.c
+++ b/drivers/pci/dwc/pci-layerscape.c
@@ -73,14 +73,6 @@ static void ls_pcie_clear_multifunction(struct ls_pcie *pcie)
iowrite8(PCI_HEADER_TYPE_BRIDGE, pci->dbi_base + PCI_HEADER_TYPE);
}
-/* Fix class value */
-static void ls_pcie_fix_class(struct ls_pcie *pcie)
-{
- struct dw_pcie *pci = pcie->pci;
-
- iowrite16(PCI_CLASS_BRIDGE_PCI, pci->dbi_base + PCI_CLASS_DEVICE);
-}
-
/* Drop MSG TLP except for Vendor MSG */
static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie)
{
@@ -145,7 +137,6 @@ static int ls_pcie_host_init(struct pcie_port *pp)
ls_pcie_disable_outbound_atus(pcie);
dw_pcie_dbi_ro_wr_en(pci);
- ls_pcie_fix_class(pcie);
ls_pcie_clear_multifunction(pcie);
dw_pcie_dbi_ro_wr_dis(pci);
diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
index 5d81f1d884e3..d153491f600f 100644
--- a/drivers/pci/dwc/pcie-artpec6.c
+++ b/drivers/pci/dwc/pcie-artpec6.c
@@ -141,12 +141,6 @@ static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie)
artpec6_pcie_writel(artpec6_pcie, PCIECFG, val);
usleep_range(100, 200);
- /*
- * Enable writing to config regs. This is required as the Synopsys
- * driver changes the class code. That register needs DBI write enable.
- */
- dw_pcie_writel_dbi(pci, MISC_CONTROL_1_OFF, DBI_RO_WR_EN);
-
/* setup root complex */
dw_pcie_setup_rc(pp);
--
2.14.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
` (8 preceding siblings ...)
2017-08-28 10:53 ` [PATCHv5 9/9] PCI: dwc: remove the obsolete fixups Zhiqiang Hou
@ 2017-08-29 21:45 ` Bjorn Helgaas
9 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2017-08-29 21:45 UTC (permalink / raw)
To: Zhiqiang Hou
Cc: linux-pci, bhelgaas, jingoohan1, Joao.Pinto, minghuan.lian,
mingkai.hu, roy.zang, niklas.cassel, jesper.nilsson
On Mon, Aug 28, 2017 at 06:52:52PM +0800, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> Split PATCHv4 4/9 into 2 patches, one is for moving the declare place
> of ls1021 specific host_init function, another one is to make ls1021
> host_init call the layerscape platform common host_init function.
>
> Squashed PATCHv4 6/9 and 7/9 together.
>
> Hou Zhiqiang (9):
> PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init
> PCI: layerscape: move STRFMR1 access out from the DBI write-enable
> bracket
> PCI: layerscape: add class code and multifunction fixups for ls1021a
> PCI: layerscape: move ls1021 specific host_init behind the common one
> PCI: layerscape: refactor the host_init function
> PCI: layerscape: Disable the outbound windows configured by bootloader
> PCI: designware: add accessors for write permission of DBI read-only
> registers
> PCI: designware: enable write permission before updating DBI RO
> registers
> PCI: dwc: remove the obsolete fixups
>
> drivers/pci/dwc/pci-layerscape.c | 92 ++++++++++++++++++----------------
> drivers/pci/dwc/pcie-artpec6.c | 6 ---
> drivers/pci/dwc/pcie-designware-host.c | 6 +++
> drivers/pci/dwc/pcie-designware.h | 25 +++++++++
> 4 files changed, 80 insertions(+), 49 deletions(-)
Applied the entire series to pci/host-layerscape for v4.14, thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-08-29 21:45 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-28 10:52 [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 1/9] PCI: layerscape: Add dw_pcie_setup_rc to ls-pcie common host init Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 2/9] PCI: layerscape: move STRFMR1 access out from the DBI write-enable bracket Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 3/9] PCI: layerscape: add class code and multifunction fixups for ls1021a Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 4/9] PCI: layerscape: move ls1021 specific host_init behind the common one Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 5/9] PCI: layerscape: refactor the host_init function Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 6/9] PCI: layerscape: Disable the outbound windows configured by bootloader Zhiqiang Hou
2017-08-28 10:52 ` [PATCHv5 7/9] PCI: designware: add accessors for write permission of DBI read-only registers Zhiqiang Hou
2017-08-28 10:53 ` [PATCHv5 8/9] PCI: designware: enable write permission before updating DBI RO registers Zhiqiang Hou
2017-08-28 10:53 ` [PATCHv5 9/9] PCI: dwc: remove the obsolete fixups Zhiqiang Hou
2017-08-29 21:45 ` [PATCHv5 0/9] PCI: dwc: refactor ls-pcie ->host_init() and fix bug for dw_pcie_setup_rc Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).