Skip to content

Commit 9f1aa39

Browse files
committed
Merge branch 'pci/pwrctrl-tc9563'
- Add a struct pci_ops.assert_perst() function pointer to assert/deassert PCIe PERST# and implement it for the qcom driver (Krishna Chaitanya Chundru) - Add DT binding and pwrctrl driver for the Toshiba TC9563 PCIe switch, which must be held in reset after poweron so the pwrctrl driver can configure the switch via I2C before bringing up the links (Krishna Chaitanya Chundru) * pci/pwrctrl-tc9563: PCI: pwrctrl: Add power control driver for TC9563 PCI: qcom: Implement .assert_perst() PCI: dwc: Implement .assert_perst() for dwc glue drivers PCI: Add .assert_perst() to control PCIe PERST# dt-bindings: PCI: Add binding for Toshiba TC9563 PCIe switch
2 parents 7a13e83 + 4c9c7be commit 9f1aa39

8 files changed

Lines changed: 876 additions & 0 deletions

File tree

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pci/toshiba,tc9563.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Toshiba TC9563 PCIe switch
8+
9+
maintainers:
10+
- Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
11+
12+
description: |
13+
Toshiba TC9563 PCIe switch has one upstream and three downstream ports.
14+
The 3rd downstream port has integrated endpoint device of Ethernet MAC.
15+
Other two downstream ports are supposed to connect to external device.
16+
17+
The TC9563 PCIe switch can be configured through I2C interface before
18+
PCIe link is established to change FTS, ASPM related entry delays,
19+
tx amplitude etc for better power efficiency and functionality.
20+
21+
properties:
22+
compatible:
23+
enum:
24+
- pci1179,0623
25+
26+
reg:
27+
maxItems: 1
28+
29+
resx-gpios:
30+
maxItems: 1
31+
description:
32+
GPIO controlling the RESX# pin.
33+
34+
vdd18-supply: true
35+
36+
vdd09-supply: true
37+
38+
vddc-supply: true
39+
40+
vddio1-supply: true
41+
42+
vddio2-supply: true
43+
44+
vddio18-supply: true
45+
46+
i2c-parent:
47+
$ref: /schemas/types.yaml#/definitions/phandle-array
48+
description:
49+
A phandle to the parent I2C node and the slave address of the device
50+
used to configure tc9563 to change FTS, tx amplitude etc.
51+
items:
52+
- description: Phandle to the I2C controller node
53+
- description: I2C slave address
54+
55+
patternProperties:
56+
"^pcie@[1-3],0$":
57+
description:
58+
child nodes describing the internal downstream ports of
59+
the tc9563 switch.
60+
type: object
61+
allOf:
62+
- $ref: "#/$defs/tc9563-node"
63+
- $ref: /schemas/pci/pci-pci-bridge.yaml#
64+
unevaluatedProperties: false
65+
66+
$defs:
67+
tc9563-node:
68+
type: object
69+
70+
properties:
71+
toshiba,tx-amplitude-microvolt:
72+
description:
73+
Change Tx Margin setting for low power consumption.
74+
75+
toshiba,no-dfe-support:
76+
type: boolean
77+
description:
78+
Disable DFE (Decision Feedback Equalizer), which mitigates
79+
intersymbol interference and some reflections caused by
80+
impedance mismatches.
81+
82+
required:
83+
- resx-gpios
84+
- vdd18-supply
85+
- vdd09-supply
86+
- vddc-supply
87+
- vddio1-supply
88+
- vddio2-supply
89+
- vddio18-supply
90+
- i2c-parent
91+
92+
allOf:
93+
- $ref: "#/$defs/tc9563-node"
94+
- $ref: /schemas/pci/pci-bus-common.yaml#
95+
96+
unevaluatedProperties: false
97+
98+
examples:
99+
- |
100+
#include <dt-bindings/gpio/gpio.h>
101+
102+
pcie {
103+
#address-cells = <3>;
104+
#size-cells = <2>;
105+
106+
pcie@0 {
107+
device_type = "pci";
108+
reg = <0x0 0x0 0x0 0x0 0x0>;
109+
110+
#address-cells = <3>;
111+
#size-cells = <2>;
112+
ranges;
113+
bus-range = <0x01 0xff>;
114+
115+
pcie@0,0 {
116+
compatible = "pci1179,0623";
117+
118+
reg = <0x10000 0x0 0x0 0x0 0x0>;
119+
device_type = "pci";
120+
#address-cells = <3>;
121+
#size-cells = <2>;
122+
ranges;
123+
bus-range = <0x02 0xff>;
124+
125+
i2c-parent = <&qup_i2c 0x77>;
126+
127+
vdd18-supply = <&vdd>;
128+
vdd09-supply = <&vdd>;
129+
vddc-supply = <&vdd>;
130+
vddio1-supply = <&vdd>;
131+
vddio2-supply = <&vdd>;
132+
vddio18-supply = <&vdd>;
133+
134+
resx-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
135+
136+
pcie@1,0 {
137+
compatible = "pciclass,0604";
138+
reg = <0x20800 0x0 0x0 0x0 0x0>;
139+
#address-cells = <3>;
140+
#size-cells = <2>;
141+
device_type = "pci";
142+
ranges;
143+
bus-range = <0x03 0xff>;
144+
145+
toshiba,no-dfe-support;
146+
};
147+
148+
pcie@2,0 {
149+
compatible = "pciclass,0604";
150+
reg = <0x21000 0x0 0x0 0x0 0x0>;
151+
#address-cells = <3>;
152+
#size-cells = <2>;
153+
device_type = "pci";
154+
ranges;
155+
bus-range = <0x04 0xff>;
156+
};
157+
158+
pcie@3,0 {
159+
compatible = "pciclass,0604";
160+
reg = <0x21800 0x0 0x0 0x0 0x0>;
161+
#address-cells = <3>;
162+
#size-cells = <2>;
163+
device_type = "pci";
164+
ranges;
165+
bus-range = <0x05 0xff>;
166+
167+
toshiba,tx-amplitude-microvolt = <10>;
168+
169+
ethernet@0,0 {
170+
reg = <0x50000 0x0 0x0 0x0 0x0>;
171+
};
172+
173+
ethernet@0,1 {
174+
reg = <0x50100 0x0 0x0 0x0 0x0>;
175+
};
176+
};
177+
};
178+
};
179+
};

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,19 @@ void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
843843
}
844844
EXPORT_SYMBOL_GPL(dw_pcie_own_conf_map_bus);
845845

846+
static int dw_pcie_op_assert_perst(struct pci_bus *bus, bool assert)
847+
{
848+
struct dw_pcie_rp *pp = bus->sysdata;
849+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
850+
851+
return dw_pcie_assert_perst(pci, assert);
852+
}
853+
846854
static struct pci_ops dw_pcie_ops = {
847855
.map_bus = dw_pcie_own_conf_map_bus,
848856
.read = pci_generic_config_read,
849857
.write = pci_generic_config_write,
858+
.assert_perst = dw_pcie_op_assert_perst,
850859
};
851860

852861
static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ struct dw_pcie_ops {
493493
enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie);
494494
int (*start_link)(struct dw_pcie *pcie);
495495
void (*stop_link)(struct dw_pcie *pcie);
496+
int (*assert_perst)(struct dw_pcie *pcie, bool assert);
496497
};
497498

498499
struct debugfs_info {
@@ -797,6 +798,14 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci)
797798
pci->ops->stop_link(pci);
798799
}
799800

801+
static inline int dw_pcie_assert_perst(struct dw_pcie *pci, bool assert)
802+
{
803+
if (pci->ops && pci->ops->assert_perst)
804+
return pci->ops->assert_perst(pci, assert);
805+
806+
return 0;
807+
}
808+
800809
static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
801810
{
802811
u32 val;

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,18 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
696696
return 0;
697697
}
698698

699+
static int qcom_pcie_assert_perst(struct dw_pcie *pci, bool assert)
700+
{
701+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
702+
703+
if (assert)
704+
qcom_ep_reset_assert(pcie);
705+
else
706+
qcom_ep_reset_deassert(pcie);
707+
708+
return 0;
709+
}
710+
699711
static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie)
700712
{
701713
u32 val;
@@ -1518,6 +1530,7 @@ static const struct qcom_pcie_cfg cfg_fw_managed = {
15181530
static const struct dw_pcie_ops dw_pcie_ops = {
15191531
.link_up = qcom_pcie_link_up,
15201532
.start_link = qcom_pcie_start_link,
1533+
.assert_perst = qcom_pcie_assert_perst,
15211534
};
15221535

15231536
static int qcom_pcie_icc_init(struct qcom_pcie *pcie)

drivers/pci/pwrctrl/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ config PCI_PWRCTRL_SLOT
2222
PCI slots. The voltage regulators powering the rails of the PCI slots
2323
are expected to be defined in the devicetree node of the PCI bridge.
2424

25+
config PCI_PWRCTRL_TC9563
26+
tristate "PCI Power Control driver for TC9563 PCIe switch"
27+
select PCI_PWRCTRL
28+
default m if ARCH_QCOM
29+
depends on I2C
30+
help
31+
Say Y here to enable the PCI Power Control driver of TC9563 PCIe
32+
switch.
33+
34+
This driver enables power and configures the TC9563 PCIe switch
35+
through i2c. TC9563 is a PCIe switch which has one upstream and three
36+
downstream ports. To one of the downstream ports integrated ethernet
37+
MAC is connected as endpoint device. Other two downstream ports are
38+
supposed to connect to external device.
39+
2540
# deprecated
2641
config HAVE_PWRCTL
2742
bool

drivers/pci/pwrctrl/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ obj-$(CONFIG_PCI_PWRCTRL_PWRSEQ) += pci-pwrctrl-pwrseq.o
77

88
obj-$(CONFIG_PCI_PWRCTRL_SLOT) += pci-pwrctrl-slot.o
99
pci-pwrctrl-slot-y := slot.o
10+
11+
obj-$(CONFIG_PCI_PWRCTRL_TC9563) += pci-pwrctrl-tc9563.o

0 commit comments

Comments
 (0)