Skip to content

Commit 45e981b

Browse files
committed
Merge branch 'pci/controller/qcom'
- Drop endpoint redundant masking of global IRQ events (Manivannan Sadhasivam) - Clarify unknown global IRQ message and only log it once to avoid a flood (Manivannan Sadhasivam) - Add Manivannan Sadhasivam as maintainer of qcom endpoint driver (Manivannan Sadhasivam) - Add 'linux,pci-domain' property to endpoint DT binding (Manivannan Sadhasivam) - Assign PCI domain number for endpoint controllers (Manivannan Sadhasivam) - Add 'qcom_pcie_ep' and the PCI domain number to IRQ names for endpoint controller (Manivannan Sadhasivam) - Add global SPI interrupt for PCIe link events to DT binding (Manivannan Sadhasivam) - Add global RC interrupt handler to handle 'Link up' events and automatically enumerate hot-added devices (Manivannan Sadhasivam) - Avoid mirroring of DBI and iATU register space so it doesn't overlap BAR MMIO space (Prudhvi Yarlagadda) - Enable controller resources like PHY only after PERST# is deasserted to partially avoid the problem that the endpoint SoC crashes when accessing things when Refclk is absent (Manivannan Sadhasivam) - Rename dw_pcie.link_gen to max_link_speed to avoid ambiguity (Manivannan Sadhasivam) - Cache maximum link speed value in dw_pcie.max_link_speed for use by vendor drivers (Manivannan Sadhasivam) - Add 16.0 GT/s equalization and RX lane margining settings (Shashank Babu Chinta Venkata) - Pass domain number to pci_bus_release_domain_nr() explicitly to avoid a NULL pointer dereference (Manivannan Sadhasivam) * pci/controller/qcom: PCI: Pass domain number to pci_bus_release_domain_nr() explicitly PCI: qcom: Add RX lane margining settings for 16.0 GT/s PCI: qcom: Add equalization settings for 16.0 GT/s PCI: dwc: Always cache the maximum link speed value in dw_pcie::max_link_speed PCI: dwc: Rename 'dw_pcie::link_gen' to 'dw_pcie::max_link_speed' PCI: qcom-ep: Enable controller resources like PHY only after refclk is available PCI: qcom: Disable mirroring of DBI and iATU register space in BAR region PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names PCI: endpoint: Assign PCI domain number for endpoint controllers dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property dt-bindings: PCI: pci-ep: Update Maintainers PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event PCI: qcom-ep: Drop the redundant masking of global IRQ events
2 parents 1bcf233 + 0cca961 commit 45e981b

24 files changed

+361
-78
lines changed

Documentation/devicetree/bindings/pci/pci-ep.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ description: |
1010
Common properties for PCI Endpoint Controller Nodes.
1111
1212
maintainers:
13-
- Kishon Vijay Abraham I <[email protected]>
13+
- Kishon Vijay Abraham I <[email protected]>
14+
- Manivannan Sadhasivam <[email protected]>
1415

1516
properties:
1617
$nodename:
@@ -41,6 +42,17 @@ properties:
4142
default: 1
4243
maximum: 16
4344

45+
linux,pci-domain:
46+
description:
47+
If present this property assigns a fixed PCI domain number to a PCI
48+
Endpoint Controller, otherwise an unstable (across boots) unique number
49+
will be assigned. It is required to either not set this property at all
50+
or set it for all PCI endpoint controllers in the system, otherwise
51+
potentially conflicting domain numbers may be assigned to endpoint
52+
controllers. The domain number for each endpoint controller in the system
53+
must be unique.
54+
$ref: /schemas/types.yaml#/definitions/uint32
55+
4456
required:
4557
- compatible
4658

Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ properties:
2121

2222
interrupts:
2323
minItems: 1
24-
maxItems: 8
24+
maxItems: 9
2525

2626
interrupt-names:
2727
minItems: 1
28-
maxItems: 8
28+
maxItems: 9
2929

3030
iommu-map:
3131
minItems: 1

Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,5 @@ examples:
280280
phy-names = "pciephy";
281281
max-link-speed = <3>;
282282
num-lanes = <2>;
283+
linux,pci-domain = <0>;
283284
};

Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ properties:
5555
- const: aggre1 # Aggre NoC PCIe1 AXI clock
5656

5757
interrupts:
58-
minItems: 8
59-
maxItems: 8
58+
minItems: 9
59+
maxItems: 9
6060

6161
interrupt-names:
6262
items:
@@ -68,6 +68,7 @@ properties:
6868
- const: msi5
6969
- const: msi6
7070
- const: msi7
71+
- const: global
7172

7273
operating-points-v2: true
7374
opp-table:
@@ -149,9 +150,10 @@ examples:
149150
<GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
150151
<GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
151152
<GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>,
152-
<GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
153+
<GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
154+
<GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
153155
interrupt-names = "msi0", "msi1", "msi2", "msi3",
154-
"msi4", "msi5", "msi6", "msi7";
156+
"msi4", "msi5", "msi6", "msi7", "global";
155157
#interrupt-cells = <1>;
156158
interrupt-map-mask = <0 0 0 0x7>;
157159
interrupt-map = <0 0 0 1 &intc 0 0 0 149 IRQ_TYPE_LEVEL_HIGH>, /* int_a */

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2728,7 +2728,7 @@ F: drivers/iommu/msm*
27282728
F: drivers/mfd/ssbi.c
27292729
F: drivers/mmc/host/mmci_qcom*
27302730
F: drivers/mmc/host/sdhci-msm.c
2731-
F: drivers/pci/controller/dwc/pcie-qcom.c
2731+
F: drivers/pci/controller/dwc/pcie-qcom*
27322732
F: drivers/phy/qualcomm/
27332733
F: drivers/power/*/msm*
27342734
F: drivers/reset/reset-qcom-*
@@ -17754,6 +17754,7 @@ M: Manivannan Sadhasivam <[email protected]>
1775417754
1775517755
1775617756
S: Maintained
17757+
F: drivers/pci/controller/dwc/pcie-qcom-common.c
1775717758
F: drivers/pci/controller/dwc/pcie-qcom.c
1775817759

1775917760
PCIE DRIVER FOR ROCKCHIP
@@ -17790,6 +17791,7 @@ L: [email protected]
1779017791
1779117792
S: Maintained
1779217793
F: Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
17794+
F: drivers/pci/controller/dwc/pcie-qcom-common.c
1779317795
F: drivers/pci/controller/dwc/pcie-qcom-ep.c
1779417796

1779517797
PCMCIA SUBSYSTEM

drivers/pci/controller/dwc/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,16 @@ config PCIE_DW_PLAT_EP
265265
order to enable device-specific features PCI_DW_PLAT_EP must be
266266
selected.
267267

268+
config PCIE_QCOM_COMMON
269+
bool
270+
268271
config PCIE_QCOM
269272
bool "Qualcomm PCIe controller (host mode)"
270273
depends on OF && (ARCH_QCOM || COMPILE_TEST)
271274
depends on PCI_MSI
272275
select PCIE_DW_HOST
273276
select CRC8
277+
select PCIE_QCOM_COMMON
274278
help
275279
Say Y here to enable PCIe controller support on Qualcomm SoCs. The
276280
PCIe controller uses the DesignWare core plus Qualcomm-specific
@@ -281,6 +285,7 @@ config PCIE_QCOM_EP
281285
depends on OF && (ARCH_QCOM || COMPILE_TEST)
282286
depends on PCI_ENDPOINT
283287
select PCIE_DW_EP
288+
select PCIE_QCOM_COMMON
284289
help
285290
Say Y here to enable support for the PCIe controllers on Qualcomm SoCs
286291
to work in endpoint mode. The PCIe controller uses the DesignWare core

drivers/pci/controller/dwc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
1212
obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone.o
1313
obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
1414
obj-$(CONFIG_PCI_LAYERSCAPE_EP) += pci-layerscape-ep.o
15+
obj-$(CONFIG_PCIE_QCOM_COMMON) += pcie-qcom-common.o
1516
obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
1617
obj-$(CONFIG_PCIE_QCOM_EP) += pcie-qcom-ep.o
1718
obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,12 +860,12 @@ static int imx_pcie_start_link(struct dw_pcie *pci)
860860
if (ret)
861861
goto err_reset_phy;
862862

863-
if (pci->link_gen > 1) {
863+
if (pci->max_link_speed > 1) {
864864
/* Allow faster modes after the link is up */
865865
dw_pcie_dbi_ro_wr_en(pci);
866866
tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
867867
tmp &= ~PCI_EXP_LNKCAP_SLS;
868-
tmp |= pci->link_gen;
868+
tmp |= pci->max_link_speed;
869869
dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
870870

871871
/*
@@ -1423,8 +1423,8 @@ static int imx_pcie_probe(struct platform_device *pdev)
14231423
imx_pcie->tx_swing_low = 127;
14241424

14251425
/* Limit link speed */
1426-
pci->link_gen = 1;
1427-
of_property_read_u32(node, "fsl,max-link-speed", &pci->link_gen);
1426+
pci->max_link_speed = 1;
1427+
of_property_read_u32(node, "fsl,max-link-speed", &pci->max_link_speed);
14281428

14291429
imx_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie");
14301430
if (IS_ERR(imx_pcie->vpcie)) {

drivers/pci/controller/dwc/pcie-designware.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
112112
pci->dbi_base = devm_pci_remap_cfg_resource(pci->dev, res);
113113
if (IS_ERR(pci->dbi_base))
114114
return PTR_ERR(pci->dbi_base);
115+
pci->dbi_phys_addr = res->start;
115116
}
116117

117118
/* DBI2 is mainly useful for the endpoint controller */
@@ -134,6 +135,7 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
134135
pci->atu_base = devm_ioremap_resource(pci->dev, res);
135136
if (IS_ERR(pci->atu_base))
136137
return PTR_ERR(pci->atu_base);
138+
pci->atu_phys_addr = res->start;
137139
} else {
138140
pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET;
139141
}
@@ -166,8 +168,8 @@ int dw_pcie_get_resources(struct dw_pcie *pci)
166168
return ret;
167169
}
168170

169-
if (pci->link_gen < 1)
170-
pci->link_gen = of_pci_get_max_link_speed(np);
171+
if (pci->max_link_speed < 1)
172+
pci->max_link_speed = of_pci_get_max_link_speed(np);
171173

172174
of_property_read_u32(np, "num-lanes", &pci->num_lanes);
173175

@@ -687,16 +689,27 @@ void dw_pcie_upconfig_setup(struct dw_pcie *pci)
687689
}
688690
EXPORT_SYMBOL_GPL(dw_pcie_upconfig_setup);
689691

690-
static void dw_pcie_link_set_max_speed(struct dw_pcie *pci, u32 link_gen)
692+
static void dw_pcie_link_set_max_speed(struct dw_pcie *pci)
691693
{
692694
u32 cap, ctrl2, link_speed;
693695
u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
694696

695697
cap = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
698+
699+
/*
700+
* Even if the platform doesn't want to limit the maximum link speed,
701+
* just cache the hardware default value so that the vendor drivers can
702+
* use it to do any link specific configuration.
703+
*/
704+
if (pci->max_link_speed < 1) {
705+
pci->max_link_speed = FIELD_GET(PCI_EXP_LNKCAP_SLS, cap);
706+
return;
707+
}
708+
696709
ctrl2 = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCTL2);
697710
ctrl2 &= ~PCI_EXP_LNKCTL2_TLS;
698711

699-
switch (pcie_link_speed[link_gen]) {
712+
switch (pcie_link_speed[pci->max_link_speed]) {
700713
case PCIE_SPEED_2_5GT:
701714
link_speed = PCI_EXP_LNKCTL2_TLS_2_5GT;
702715
break;
@@ -1058,8 +1071,7 @@ void dw_pcie_setup(struct dw_pcie *pci)
10581071
{
10591072
u32 val;
10601073

1061-
if (pci->link_gen > 0)
1062-
dw_pcie_link_set_max_speed(pci, pci->link_gen);
1074+
dw_pcie_link_set_max_speed(pci);
10631075

10641076
/* Configure Gen1 N_FTS */
10651077
if (pci->n_fts[0]) {

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@
125125
#define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16)
126126
#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24
127127
#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24)
128+
#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_16_0GT 0x1
129+
130+
#define GEN3_EQ_CONTROL_OFF 0x8A8
131+
#define GEN3_EQ_CONTROL_OFF_FB_MODE GENMASK(3, 0)
132+
#define GEN3_EQ_CONTROL_OFF_PHASE23_EXIT_MODE BIT(4)
133+
#define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC GENMASK(23, 8)
134+
#define GEN3_EQ_CONTROL_OFF_FOM_INC_INITIAL_EVAL BIT(24)
135+
136+
#define GEN3_EQ_FB_MODE_DIR_CHANGE_OFF 0x8AC
137+
#define GEN3_EQ_FMDC_T_MIN_PHASE23 GENMASK(4, 0)
138+
#define GEN3_EQ_FMDC_N_EVALS GENMASK(9, 5)
139+
#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA GENMASK(13, 10)
140+
#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA GENMASK(17, 14)
128141

129142
#define PCIE_PORT_MULTI_LANE_CTRL 0x8C0
130143
#define PORT_MLTI_UPCFG_SUPPORT BIT(7)
@@ -197,6 +210,24 @@
197210

198211
#define PCIE_PL_CHK_REG_ERR_ADDR 0xB28
199212

213+
/*
214+
* 16.0 GT/s (Gen 4) lane margining register definitions
215+
*/
216+
#define GEN4_LANE_MARGINING_1_OFF 0xB80
217+
#define MARGINING_MAX_VOLTAGE_OFFSET GENMASK(29, 24)
218+
#define MARGINING_NUM_VOLTAGE_STEPS GENMASK(22, 16)
219+
#define MARGINING_MAX_TIMING_OFFSET GENMASK(13, 8)
220+
#define MARGINING_NUM_TIMING_STEPS GENMASK(5, 0)
221+
222+
#define GEN4_LANE_MARGINING_2_OFF 0xB84
223+
#define MARGINING_IND_ERROR_SAMPLER BIT(28)
224+
#define MARGINING_SAMPLE_REPORTING_METHOD BIT(27)
225+
#define MARGINING_IND_LEFT_RIGHT_TIMING BIT(26)
226+
#define MARGINING_IND_UP_DOWN_VOLTAGE BIT(25)
227+
#define MARGINING_VOLTAGE_SUPPORTED BIT(24)
228+
#define MARGINING_MAXLANES GENMASK(20, 16)
229+
#define MARGINING_SAMPLE_RATE_TIMING GENMASK(13, 8)
230+
#define MARGINING_SAMPLE_RATE_VOLTAGE GENMASK(5, 0)
200231
/*
201232
* iATU Unroll-specific register definitions
202233
* From 4.80 core version the address translation will be made by unroll
@@ -407,8 +438,10 @@ struct dw_pcie_ops {
407438
struct dw_pcie {
408439
struct device *dev;
409440
void __iomem *dbi_base;
441+
resource_size_t dbi_phys_addr;
410442
void __iomem *dbi_base2;
411443
void __iomem *atu_base;
444+
resource_size_t atu_phys_addr;
412445
size_t atu_size;
413446
u32 num_ib_windows;
414447
u32 num_ob_windows;
@@ -421,7 +454,7 @@ struct dw_pcie {
421454
u32 type;
422455
unsigned long caps;
423456
int num_lanes;
424-
int link_gen;
457+
int max_link_speed;
425458
u8 n_fts[2];
426459
struct dw_edma_chip edma;
427460
struct clk_bulk_data app_clks[DW_PCIE_NUM_APP_CLKS];

0 commit comments

Comments
 (0)