08e1ecba9a0b3d1f55a1b74c888801ad594cfc96
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 8237-pcie-ls208x-use-unified-compatible-fsl-ls2080a-pcie-.patch
1 From 562f1311b529d81662ed41786b8d240db2e2ff51 Mon Sep 17 00:00:00 2001
2 From: Shengzhou Liu <Shengzhou.Liu@nxp.com>
3 Date: Tue, 6 Dec 2016 15:30:39 +0800
4 Subject: [PATCH 237/238] pcie/ls208x: use unified compatible
5 "fsl,ls2080a-pcie" for ls208x
6
7 To avoid unnecessary reduplication, let's use unified compatible
8 "fsl,ls2080a-pcie" for ls2080a, ls2085a, ls2088a.
9
10 This patch fixes issue of pcie not working on ls2088a.
11
12 Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
13 ---
14 arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi | 12 ++++--------
15 drivers/pci/host/pci-layerscape.c | 13 ++++++++-----
16 2 files changed, 12 insertions(+), 13 deletions(-)
17
18 diff --git a/arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi
19 index bd69942..07c917b 100644
20 --- a/arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi
21 +++ b/arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi
22 @@ -513,8 +513,7 @@
23 };
24
25 pcie1: pcie@3400000 {
26 - compatible = "fsl,ls2088a-pcie", "fsl,ls2080a-pcie",
27 - "fsl,ls2085a-pcie", "snps,dw-pcie";
28 + compatible = "fsl,ls2080a-pcie", "snps,dw-pcie";
29 reg = <0x00 0x03400000 0x0 0x00100000 /* controller registers */
30 0x20 0x00000000 0x0 0x00002000>; /* configuration space */
31 reg-names = "regs", "config";
32 @@ -539,8 +538,7 @@
33 };
34
35 pcie2: pcie@3500000 {
36 - compatible = "fsl,ls2080a-pcie", "fsl,ls2080a-pcie",
37 - "fsl,ls2085a-pcie", "snps,dw-pcie";
38 + compatible = "fsl,ls2080a-pcie", "snps,dw-pcie";
39 reg = <0x00 0x03500000 0x0 0x00100000 /* controller registers */
40 0x28 0x00000000 0x0 0x00002000>; /* configuration space */
41 reg-names = "regs", "config";
42 @@ -565,8 +563,7 @@
43 };
44
45 pcie3: pcie@3600000 {
46 - compatible = "fsl,ls2088a-pcie", "fsl,ls2080a-pcie",
47 - "fsl,ls2085a-pcie", "snps,dw-pcie";
48 + compatible = "fsl,ls2080a-pcie", "snps,dw-pcie";
49 reg = <0x00 0x03600000 0x0 0x00100000 /* controller registers */
50 0x30 0x00000000 0x0 0x00002000>; /* configuration space */
51 reg-names = "regs", "config";
52 @@ -591,8 +588,7 @@
53 };
54
55 pcie4: pcie@3700000 {
56 - compatible = "fsl,ls2080a-pcie", "fsl,ls2080a-pcie",
57 - "fsl,ls2085a-pcie", "snps,dw-pcie";
58 + compatible = "fsl,ls2080a-pcie", "snps,dw-pcie";
59 reg = <0x00 0x03700000 0x0 0x00100000 /* controller registers */
60 0x38 0x00000000 0x0 0x00002000>; /* configuration space */
61 reg-names = "regs", "config";
62 diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
63 index 00feabf..3e2100d 100644
64 --- a/drivers/pci/host/pci-layerscape.c
65 +++ b/drivers/pci/host/pci-layerscape.c
66 @@ -158,9 +158,14 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)
67 static int ls_pcie_link_up(struct pcie_port *pp)
68 {
69 struct ls_pcie *pcie = to_ls_pcie(pp);
70 - u32 state;
71 + u32 state, offset;
72 +
73 + if (of_get_property(pp->dev->of_node, "fsl,lut_diff", NULL))
74 + offset = 0x407fc;
75 + else
76 + offset = pcie->drvdata->lut_dbg;
77
78 - state = (ioread32(pcie->lut + pcie->drvdata->lut_dbg) >>
79 + state = (ioread32(pcie->lut + offset) >>
80 pcie->drvdata->ltssm_shift) &
81 LTSSM_STATE_MASK;
82
83 @@ -261,7 +266,6 @@ static const struct of_device_id ls_pcie_of_match[] = {
84 { .compatible = "fsl,ls1046a-pcie", .data = &ls1046_drvdata },
85 { .compatible = "fsl,ls1088a-pcie", .data = &ls1088_drvdata },
86 { .compatible = "fsl,ls2080a-pcie", .data = &ls2080_drvdata },
87 - { .compatible = "fsl,ls2085a-pcie", .data = &ls2080_drvdata },
88 { },
89 };
90 MODULE_DEVICE_TABLE(of, ls_pcie_of_match);
91 @@ -315,8 +319,7 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
92 if (!ls_pcie_is_bridge(pcie))
93 return -ENODEV;
94
95 - if (of_device_is_compatible(pdev->dev.of_node, "fsl,ls2085a-pcie") ||
96 - of_device_is_compatible(pdev->dev.of_node, "fsl,ls2080a-pcie") ||
97 + if (of_device_is_compatible(pdev->dev.of_node, "fsl,ls2080a-pcie") ||
98 of_device_is_compatible(pdev->dev.of_node, "fsl,ls1088a-pcie")) {
99 int len;
100 const u32 *prop;
101 --
102 1.7.9.5
103