PCI/pwrctrl: tc9563: Several fixes and improvements
Subsystems (4)
cover PCI/pwrctrl: tc9563: Several fixes and improvements
Hi,
This series contains several fixes and improvements for the TC9563 Pwrctrl driver and the switch binding. Most of the fixes are related to ensuring correctness in parsing the DT properties for the switch ports and the integrated Endpoint.
More details are in the individual patches.
Testing
=======
This series was validated on the RB3Gen2 board.
---
Manivannan Sadhasivam (6):
dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2 PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node PCI/pwrctrl: tc9563: Power off only the external ports in tc9563_pwrctrl_disable_port() PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
.../devicetree/bindings/pci/toshiba,tc9563.yaml | 21 +++- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 129 ++++++++++++++------- 2 files changed, 104 insertions(+), 46 deletions(-)
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260725-tc9563-fix-64eb7cbb1229
Best regards,
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH 1/6 dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2
TC9563 switch allows configuring Tx Amplitude, DFE and N_FTS settings only to USP, DSP1 and DSP2 ports. These settings don't apply to DSP3 and also the integrated Ethernet MAC Endpoint.
So restrict these properties and also move the 'toshiba,tx-amplitude-microvolt' property to DSP2 in the example to conform to the binding.
--- .../devicetree/bindings/pci/toshiba,tc9563.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +18 -3
@@ -54,7 +54,7 @@ properties: - description: I2C slave address patternProperties: - "^pcie@[1-3],0$": + "^pcie@[1-2],0$": description: child nodes describing the internal downstream ports of the tc9563 switch.
@@ -64,6 +64,21 @@ patternProperties: - $ref: /schemas/pci/pci-pci-bridge.yaml# unevaluatedProperties: false + "^pcie@[3],0$": + description: + child node describing the internal downstream port connected to the + integrated Ethernet MAC endpoint of the tc9563 switch. + type: object + $ref: /schemas/pci/pci-pci-bridge.yaml# + properties: + n-fts: false + patternProperties: + "^ethernet@0,[0-1]$": + type: object + properties: + n-fts: false + unevaluatedProperties: false + $defs: tc9563-node: type: object
@@ -154,6 +169,8 @@ examples: device_type = "pci"; ranges; bus-range = <0x04 0xff>; + + toshiba,tx-amplitude-microvolt = <10>; }; pcie@3,0 {
@@ -165,8 +182,6 @@ examples: ranges; bus-range = <0x05 0xff>; - toshiba,tx-amplitude-microvolt = <10>; - ethernet@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; };
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 1/6] dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] Missing schema constraints on Ethernet MAC node silently allows all undocumented properties.
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but there is an out-of-bounds array write in tc9563_pwrctrl_probe when parsing multiple Ethernet child nodes.
- [High] This problem wasn't introduced by this patch, but the driver assigns PCI switch port configurations based on fragile child node iteration order rather than reg addresses. --
--- Patch [1]: [PATCH 1/6] dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2 --- commit 54f91cfce5dde398e9e08b16babbdffbd75f5ca1
Author: Manivannan Sadhasivam <[email protected]>
dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2
This patch restricts Tx Amplitude, DFE, and N_FTS settings to USP, DSP1, and DSP2 ports in the toshiba,tc9563 PCIe switch binding. It updates the schema to explicitly disallow these properties on the DSP3 port and the integrated Ethernet MAC endpoint, and adjusts the example.
Quoted 4 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +0
-0
[ ... ]
Quoted 7 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +3
-0@@ -64,6 +64,21 @@ patternProperties: - $ref: /schemas/pci/pci-pci-bridge.yaml# unevaluatedProperties: false + "^pcie@[3],0$": + description: + child node describing the internal downstream port connected to the
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml patternProperties: · line 79
Quoted 10 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +10
-0+ integrated Ethernet MAC endpoint of the tc9563 switch. + type: object + $ref: /schemas/pci/pci-pci-bridge.yaml# + properties: + n-fts: false + patternProperties: + "^ethernet@0,[0-1]$": + type: object + properties: + n-fts: false
[Severity: Medium]
Does this ethernet node block need an additionalProperties: false constraint?
Without it, the schema defaults to allowing any undeclared properties. Could this allow toshiba,tx-amplitude-microvolt to still be placed in the ethernet node without failing validation?
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml patternProperties: · line 81
Quoted 2 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +2
-0+ unevaluatedProperties: false +
While reviewing the binding changes, I noticed a couple of pre-existing issues in the related pci-pwrctrl-tc9563 driver code that might be worth looking into since they relate to how these device tree nodes are parsed.
[Severity: High]
This isn't a bug introduced by this patch, but there is a potential out-of-bounds array write in tc9563_pwrctrl_probe() when parsing multiple Ethernet child nodes:
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c:tc9563_pwrctrl_probe() {
...
for_each_child_of_node_scoped(node, child) {
...
port++;
ret = tc9563_pwrctrl_parse_device_dt(tc9563, child1, port);
}If the device tree contains more than one Ethernet child node under the pcie@3,0 DSP3 port (which this YAML binding allows via the
^ethernet@0,[0-1]$ pattern), the inner loop can increment the port variable to 5.
Could this corrupt memory? There are no bounds checks on port before it is passed to tc9563_pwrctrl_parse_device_dt(), which uses it to index the cfg[TC9563_MAX] array (size 5). Writing to cfg[5] would overwrite subsequent struct fields.
[Severity: High]
This is a pre-existing issue, but the driver assigns PCI switch port configurations based on child node iteration order rather than reg addresses.
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c:tc9563_pwrctrl_probe() {
...
for_each_child_of_node_scoped(node, child) {
port++;
}If a board's Device Tree legitimately omits an unused downstream port (e.g., leaving out pcie@1,0), the iteration shifts.
Will this mistakenly map the next port (like pcie@2,0) to TC9563_DSP1? It seems this would desynchronize the driver's port layout from the physical hardware, routing commands to the wrong switch ports and missing the DSP3 ethernet handling entirely.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/6] dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2
In reply to Manivannan SadhasivamQuoted 5 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
TC9563 switch allows configuring Tx Amplitude, DFE and
N_FTSsettings only to USP, DSP1 and DSP2 ports. These settings don't apply to DSP3 and also the integrated Ethernet MAC Endpoint.
s/and also the/nor its/
Also I don't know if there is only one Ethernet MAC here, but the TC9564 has two, so maybe make "MAC Endpoint" plural.
Quoted 7 lines
So restrict these properties and also move the 'toshiba,tx-amplitude-microvolt' property to DSP2 in the example to conform to the binding.
Fixes 26f3ac884835 ("dt-bindings: PCI: Add binding for Toshiba TC9563 PCIe switch")Signed-off-by Manivannan Sadhasivam <[email protected]>
I have some other questions with implied suggestions below, but this looks good to me.
Quoted 9 lines
--- .../devicetree/bindings/pci/toshiba,tc9563.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +0
-0
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml properties: · line 60
Quoted 8 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +1
-1@@ -54,7 +54,7 @@ properties: - description: I2C slave address patternProperties: - "^pcie@[1-3],0$": + "^pcie@[1-2],0$": description: child nodes describing the internal downstream ports of the tc9563 switch.
Can you offer any explanation about why the settings apply to these two downstream ports but not the third? (I think it's because the third has a different type of link to the endpoint.)
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml patternProperties: · line 67
Quoted 5 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +1
-0@@ -64,6 +64,21 @@ patternProperties: - $ref: /schemas/pci/pci-pci-bridge.yaml# unevaluatedProperties: false + "^pcie@[3],0$":
Can this just be "^pcie@3,0$"?
Is there any need to define "^pcie@3,1" for the second PCI function?
Quoted 36 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +16
-2+ description: + child node describing the internal downstream port connected to the + integrated Ethernet MAC endpoint of the tc9563 switch. + type: object + $ref: /schemas/pci/pci-pci-bridge.yaml# + properties: + n-fts: false + patternProperties: + "^ethernet@0,[0-1]$": + type: object + properties: + n-fts: false + unevaluatedProperties: false + $defs: tc9563-node: type: object@@ -154,6 +169,8 @@ examples: device_type = "pci"; ranges; bus-range = <0x04 0xff>; + + toshiba,tx-amplitude-microvolt = <10>; }; pcie@3,0 {@@ -165,8 +182,6 @@ examples: ranges; bus-range = <0x05 0xff>; - toshiba,tx-amplitude-microvolt = <10>; - ethernet@0,0 { reg = <0x50000 0x0 0x0 0x0 0x0>; };
Manivannan Sadhasivam
maintainerRe: [PATCH 1/6] dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE and N_FTS to USP, DSP1 and DSP2
Quoted 29 lines · Alex Elder
Quoted 5 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
TC9563 switch allows configuring Tx Amplitude, DFE and
N_FTSsettings only to USP, DSP1 and DSP2 ports. These settings don't apply to DSP3 and also the integrated Ethernet MAC Endpoint.s/and also the/nor its/
Also I don't know if there is only one Ethernet MAC here, but the TC9564 has two, so maybe make "MAC Endpoint" plural.
Quoted 7 lines
So restrict these properties and also move the 'toshiba,tx-amplitude-microvolt' property to DSP2 in the example to conform to the binding.
Fixes 26f3ac884835 ("dt-bindings: PCI: Add binding for Toshiba TC9563 PCIe switch")Signed-off-by Manivannan Sadhasivam <[email protected]>I have some other questions with implied suggestions below, but this looks good to me.
Acked-by Alex Elder <[email protected]>Quoted 4 lines
--- .../devicetree/bindings/pci/toshiba,tc9563.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
Quoted 17 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml properties: · line 59
Quoted 12 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +1
-1@@ -54,7 +54,7 @@ properties: - description: I2C slave address patternProperties: - "^pcie@[1-3],0$": + "^pcie@[1-2],0$": description: child nodes describing the internal downstream ports of the tc9563 switch.Can you offer any explanation about why the settings apply to these two downstream ports but not the third? (I think it's because the third has a different type of link to the endpoint.)
There was no explanation provided in the manual or in the application note. But since these are PHY related tunings and the VDSP has an integrated MAC Endpoint, these tunings are irrelevant.
Quoted 9 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml patternProperties: · line 66
Quoted 4 lines
Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml +1
-0@@ -64,6 +64,21 @@ patternProperties: - $ref: /schemas/pci/pci-pci-bridge.yaml# unevaluatedProperties: false + "^pcie@[3],0$":Can this just be "^pcie@3,0$"?
Is there any need to define "^pcie@3,1" for the second PCI function?
Good question. I tried "^pcie@3,0$" first, but it throwed the dt_binding_check error:
/home/mani/tc9563-fix/Documentation/devicetree/bindings/pci/toshiba,tc9563.yaml:
patternProperties: '^pcie@3,0$' should not be valid under {'pattern': '^\\^[a-zA-Z0-9,\\-._#@]+\\$$'}
hint: Fixed strings belong in 'properties', not 'patternProperties'
Looks like the schema doesn't allow fixed strings in patternProperties. So I used regex, just to satisfy the requirement.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH 2/6 PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
In reply to Manivannan SadhasivamDSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
Hence, parse the Endpoint node under DSP3 instead of parsing both the functions. The existing parsing logic also has one OOB issue as parsing both functions will result in accessing past the tc9563_pwrctrl->cfg array.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +9 -4
@@ -596,12 +596,17 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port);if (ret)break ; -/* Embedded ethernet device are under DSP3 */ + +/* +* The integrated Ethernet MAC Endpoint under DSP3 is a single +* device whose functions share the same config registers. +*/ if (port ==TC9563_DSP3 ) { -for_each_child_of_node_scoped (child, child1) { - port++; + struct device_node *eth __free(device_node) = +of_get_next_available_child (child,NULL ); +if (eth) { ret =tc9563_pwrctrl_parse_device_dt (tc9563, - child1, port); + eth,TC9563_ETHERNET );if (ret)break ; }
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] Violation of Cleanup Subsystem rules by mixing goto-based error handling and __free scope-based cleanup.
Pre-existing issues:
- [High] Out-of-bounds array access due to missing bounds check on port variable.
- [High] Unbalanced regulator disable in error and remove paths.
--
--- Patch [2]: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node --- commit 23e1126e5da4215de8157dc6521fdb07d6e7dcfa
Author: Manivannan Sadhasivam <[email protected]>
PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
DSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 598
Quoted 8 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-0@@ -596,12 +596,17 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port);if (ret)break ;
[Severity: High]
This isn't a bug introduced by this patch, but does the outer loop in tc9563_pwrctrl_probe() lack a bounds check on the port variable?
If there are 5 or more children in the device tree, port could reach TC9563_MAX or greater, leading to an out-of-bounds write on the tc9563->cfg array.
This could overwrite subsequent fields like reset_gpio or adapter, causing a crash when those pointers are subsequently dereferenced.
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 606
Quoted 11 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7
-3-/* Embedded ethernet device are under DSP3 */ + +/* +* The integrated Ethernet MAC Endpoint under DSP3 is a single +* device whose functions share the same config registers. +*/ if (port ==TC9563_DSP3 ) { -for_each_child_of_node_scoped (child, child1) { - port++; + struct device_node *eth __free(device_node) = +of_get_next_available_child (child,NULL );
[Severity: Low]
Does introducing __free(device_node) here conflict with the goto-based error handling used elsewhere in this function?
The cleanup guidelines state that the usage of goto and cleanup helpers should never be mixed in the same function to avoid confusing ownership semantics.
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 612
Quoted 7 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +2
-1+if (eth) { ret =tc9563_pwrctrl_parse_device_dt (tc9563, - child1, port); + eth,TC9563_ETHERNET );if (ret)break ; }
[ ... ]
[Severity: High]
This is a pre-existing issue, but does the error path in tc9563_pwrctrl_probe() and tc9563_pwrctrl_remove() cause an unbalanced regulator disable?
If devm_pci_pwrctrl_device_set_ready() fails in tc9563_pwrctrl_probe():
ret = devm_pci_pwrctrl_device_set_ready(dev, &tc9563->pwrctrl);
if (ret)
goto power_off;
...
power_off:
tc9563_pwrctrl_power_off(&tc9563->pwrctrl);It jumps to power_off and calls tc9563_pwrctrl_power_off() which disables the regulators. However, the probe function never enabled them (they are only enabled asynchronously by the PCI framework later).
Could this mistakenly disable shared regulators and cause system instability?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
In reply to Manivannan SadhasivamQuoted 45 lines · On Sat, 25 Jul 2026 10:59:14 +0200, Manivannan Sadhasivam via B4 Relay…
From: Manivannan Sadhasivam <[email protected]>
DSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
Hence, parse the Endpoint node under DSP3 instead of parsing both the functions. The existing parsing logic also has one OOB issue as parsing both functions will result in accessing past the
tc9563_pwrctrl->cfgarray.Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +9
-5@@ -596,12 +596,17 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port);if (ret)break ; -/* Embedded ethernet device are under DSP3 */ + +/* +* The integrated Ethernet MAC Endpoint under DSP3 is a single +* device whose functions share the same config registers. +*/ if (port ==TC9563_DSP3 ) { -for_each_child_of_node_scoped (child, child1) { - port++; + struct device_node *eth __free(device_node) = +of_get_next_available_child (child,NULL ); +if (eth) { ret =tc9563_pwrctrl_parse_device_dt (tc9563, - child1, port); + eth,TC9563_ETHERNET );if (ret)break ; } --
Quoted 4 lines
2.43.0
Re: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
In reply to Manivannan SadhasivamQuoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
This was not clear from the code. So this explanation alone represents an improvement.
Quoted 3 lines
Hence, parse the Endpoint node under DSP3 instead of parsing both the functions. The existing parsing logic also has one OOB issue as parsing both functions will result in accessing past the
tc9563_pwrctrl->cfgarray.
The issue you mention is that the array has exactly one entry available for the Ethernet MAC endpoints, so parsing more than one (if defined in devicetree) references a non-existent entry. Right?
But this constraint only applies to power control. There can be multiple MAC nodes (for their PCI functions) defined. And it seems the pwrctl settings (if any) *must* be specified for function 0 and if specified for any others, they are quietly ignored.
Is that accurate?
If so I think the DT binding could explain and possibly enforce that, but I won't insist on that...
Quoted 16 lines
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-1@@ -596,12 +596,17 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port);if (ret)break ; -/* Embedded ethernet device are under DSP3 */
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 606
Quoted 10 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7
-2+ +/* +* The integrated Ethernet MAC Endpoint under DSP3 is a single +* device whose functions share the same config registers. +*/ if (port ==TC9563_DSP3 ) { -for_each_child_of_node_scoped (child, child1) { - port++; + struct device_node *eth __free(device_node) = +of_get_next_available_child (child,NULL );
I'd add a blank line here.
Quoted 8 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +2
-1+if (eth) { ret =tc9563_pwrctrl_parse_device_dt (tc9563, - child1, port); + eth,TC9563_ETHERNET );if (ret)break ; }
Manivannan Sadhasivam
maintainerRe: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
Quoted 11 lines · Alex Elder
Quoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
This was not clear from the code. So this explanation alone represents an improvement.
Quoted 9 lines
Quoted 3 lines
Hence, parse the Endpoint node under DSP3 instead of parsing both the functions. The existing parsing logic also has one OOB issue as parsing both functions will result in accessing past the
tc9563_pwrctrl->cfgarray.The issue you mention is that the array has exactly one entry available for the Ethernet MAC endpoints, so parsing more than one (if defined in devicetree) references a non-existent entry. Right?
Yes.
Quoted 8 lines
But this constraint only applies to power control. There can be multiple MAC nodes (for their PCI functions) defined. And it seems the pwrctl settings (if any) *must* be specified for function 0 and if specified for any others, they are quietly ignored.
Is that accurate?
Exactly. DT can define both functions, but since there is no per-function tuning, these properties cannot exist in both nodes, but only in function 0, which also corresponds to the Endpoint.
Quoted 3 lines
If so I think the DT binding could explain and possibly enforce that, but I won't insist on that...
It is being enforced in Patch 1.
- Mani
Quoted 40 lines
Reviewed-by Alex Elder <[email protected]>Quoted 16 lines
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-1@@ -596,12 +596,17 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port);if (ret)break ; -/* Embedded ethernet device are under DSP3 */ drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 606
Quoted 10 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7
-2+ +/* +* The integrated Ethernet MAC Endpoint under DSP3 is a single +* device whose functions share the same config registers. +*/ if (port ==TC9563_DSP3 ) { -for_each_child_of_node_scoped (child, child1) { - port++; + struct device_node *eth __free(device_node) = +of_get_next_available_child (child,NULL );I'd add a blank line here.
Quoted 8 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +2
-1+if (eth) { ret =tc9563_pwrctrl_parse_device_dt (tc9563, - child1, port); + eth,TC9563_ETHERNET );if (ret)break ; }
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Manivannan Sadhasivam
maintainerRe: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
Quoted 37 lines · Manivannan Sadhasivam
Quoted 11 lines · Alex Elder
Quoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 has an integrated Ethernet MAC Endpoint which has its own set of config registers for configuring settings such as ASPM. The Endpoint device has 2 physical functions and those 2 functions share the same settings.
This was not clear from the code. So this explanation alone represents an improvement.
Quoted 9 lines
Quoted 3 lines
Hence, parse the Endpoint node under DSP3 instead of parsing both the functions. The existing parsing logic also has one OOB issue as parsing both functions will result in accessing past the
tc9563_pwrctrl->cfgarray.The issue you mention is that the array has exactly one entry available for the Ethernet MAC endpoints, so parsing more than one (if defined in devicetree) references a non-existent entry. Right?
Yes.
Quoted 8 lines
But this constraint only applies to power control. There can be multiple MAC nodes (for their PCI functions) defined. And it seems the pwrctl settings (if any) *must* be specified for function 0 and if specified for any others, they are quietly ignored.
Is that accurate?
Exactly. DT can define both functions, but since there is no per-function tuning, these properties cannot exist in both nodes, but only in function 0, which also corresponds to the Endpoint.
Quoted 6 lines
Quoted 3 lines
If so I think the DT binding could explain and possibly enforce that, but I won't insist on that...
It is being enforced in Patch 1.
Sorry, the current enforcement is only for PHY related properties like Tx Amplitude, DFE and N_FTS. I didn't limit ASPM properties in function 1 though. Doesn't seem to be strictly needed as no one would configure per-function ASPM settings in DT (mostly unlikely).
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
Quoted 9 lines · Manivannan Sadhasivam
Quoted 5 lines
Quoted 3 lines
If so I think the DT binding could explain and possibly enforce that, but I won't insist on that...
It is being enforced in Patch 1.
Sorry, the current enforcement is only for PHY related properties like Tx Amplitude, DFE and
N_FTS. I didn't limit ASPM properties in function 1 though. Doesn't seem to be strictly needed as no one would configure per-function ASPM settings in DT (mostly unlikely).
I think it's fine. You enforce what's needed at run time regardless, right?
-Alex
Manivannan Sadhasivam
maintainerRe: [PATCH 2/6] PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node
Quoted 6 lines · Alex Elder
Quoted 5 lines · Manivannan Sadhasivam
Quoted 5 lines
Quoted 3 lines
If so I think the DT binding could explain and possibly enforce that, but I won't insist on that...
It is being enforced in Patch 1.
Quoted 8 lines
Quoted 4 lines
Sorry, the current enforcement is only for PHY related properties like Tx Amplitude, DFE and
N_FTS. I didn't limit ASPM properties in function 1 though. Doesn't seem to be strictly needed as no one would configure per-function ASPM settings in DT (mostly unlikely).I think it's fine. You enforce what's needed at run time regardless, right?
Well, we don't parse the properties even if they are available in the function DT nodes other than function 0.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH 3/6 PCI/pwrctrl: tc9563: Power off only the external ports in tc9563_pwrctrl_disable_port()
In reply to Manivannan SadhasivamTC9563 supports powering off only the external facing ports like DSP1 and DSP2. It is not recommended to power off USP and DSP3 as they have fixed ports/endpoint connected.
Hence, fix tc9563_pwrctrl_disable_port() to power off only DSP1 and DSP2.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8 -2
@@ -241,12 +241,18 @@ static int tc9563_pwrctrl_disable_port(struct tc9563_pwrctrl *tc9563,if (!cfg->disable_port)return 0 ; -if (port ==TC9563_DSP1 ) { +switch (port) { +case TC9563_DSP1 : seq = dsp1_pwroff_seq; len =ARRAY_SIZE (dsp1_pwroff_seq); - }else { +break ; +case TC9563_DSP2 : seq = dsp2_pwroff_seq; len =ARRAY_SIZE (dsp2_pwroff_seq); +break ; +default : +/* Only external downstream ports DSP1/DSP2 can be powered off */ +return 0 ; } ret =tc9563_pwrctrl_i2c_bulk_write (tc9563->client, seq, len);
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 3/6] PCI/pwrctrl: tc9563: Power off only the external ports in tc9563_pwrctrl_disable_port()
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
From: Manivannan Sadhasivam <[email protected]>
TC9563 supports powering off only the external facing ports like DSP1 and DSP2. It is not recommended to power off USP and DSP3 as they have fixed ports/endpoint connected.
Hence, fix
tc9563_pwrctrl_disable_port()to power off only DSP1 and DSP2.Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH 3/6] PCI/pwrctrl: tc9563: Power off only the external ports in tc9563_pwrctrl_disable_port()
In reply to Manivannan SadhasivamQuoted 41 lines · On Sat, 25 Jul 2026 10:59:15 +0200, Manivannan Sadhasivam via B4 Relay…
From: Manivannan Sadhasivam <[email protected]>
TC9563 supports powering off only the external facing ports like DSP1 and DSP2. It is not recommended to power off USP and DSP3 as they have fixed ports/endpoint connected.
Hence, fix
tc9563_pwrctrl_disable_port()to power off only DSP1 and DSP2.Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8
-3@@ -241,12 +241,18 @@ static int tc9563_pwrctrl_disable_port(struct tc9563_pwrctrl *tc9563,if (!cfg->disable_port)return 0 ; -if (port ==TC9563_DSP1 ) { +switch (port) { +case TC9563_DSP1 : seq = dsp1_pwroff_seq; len =ARRAY_SIZE (dsp1_pwroff_seq); - }else { +break ; +case TC9563_DSP2 : seq = dsp2_pwroff_seq; len =ARRAY_SIZE (dsp2_pwroff_seq); +break ; +default : +/* Only external downstream ports DSP1/DSP2 can be powered off */ +return 0 ; } ret =tc9563_pwrctrl_i2c_bulk_write (tc9563->client, seq, len); --
Quoted 4 lines
2.43.0
Re: [PATCH 3/6] PCI/pwrctrl: tc9563: Power off only the external ports in tc9563_pwrctrl_disable_port()
In reply to Manivannan SadhasivamQuoted 10 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
TC9563 supports powering off only the external facing ports like DSP1 and DSP2. It is not recommended to power off USP and DSP3 as they have fixed ports/endpoint connected.
Hence, fix
tc9563_pwrctrl_disable_port()to power off only DSP1 and DSP2.Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>
This is very nice and makes that function a little less confusing...
Quoted 30 lines
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8
-2@@ -241,12 +241,18 @@ static int tc9563_pwrctrl_disable_port(struct tc9563_pwrctrl *tc9563,if (!cfg->disable_port)return 0 ; -if (port ==TC9563_DSP1 ) { +switch (port) { +case TC9563_DSP1 : seq = dsp1_pwroff_seq; len =ARRAY_SIZE (dsp1_pwroff_seq); - }else { +break ; +case TC9563_DSP2 : seq = dsp2_pwroff_seq; len =ARRAY_SIZE (dsp2_pwroff_seq); +break ; +default : +/* Only external downstream ports DSP1/DSP2 can be powered off */ +return 0 ; } ret =tc9563_pwrctrl_i2c_bulk_write (tc9563->client, seq, len);
PATCH 4/6 PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
In reply to Manivannan SadhasivamDSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8 -0
@@ -308,6 +308,7 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563,static int tc9563_pwrctrl_set_tx_amplitude (struct tc9563_pwrctrl *tc9563,enum tc9563_pwrctrl_ports port) { +struct device *dev = tc9563->pwrctrl.dev;u32 amp = tc9563->cfg[port].tx_amp;int port_access;
@@ -327,6 +328,9 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; }
@@ -345,6 +349,7 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, enum tc9563_pwrctrl_ports port) {struct tc9563_pwrctrl_cfg *cfg = &tc9563->cfg[port]; +struct device *dev = tc9563->pwrctrl.dev;int port_access, lane_access =0x3 ;u32 phy_rate =0x21 ;
@@ -363,6 +368,9 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; }
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The error path in probe and the remove function unconditionally call tc9563_pwrctrl_power_off(), leading to an unbalanced regulator disable and GPIO reset.
- [Medium] The patch adds a skip condition for TC9563_DSP3 to prevent driver failure when tuning properties are present, but fails to handle TC9563_ETHERNET which suffers from the exact same vulnerability if tuning properties are erroneously provided. --
--- Patch [4]: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3 --- commit 1ca1e7c52e5adecc6adfed2aec9cf99588aec9d4
Author: Manivannan Sadhasivam <[email protected]>
PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
This commit skips Tx amplitude and DFE tuning for DSP3 by returning 0 when these tuning properties are passed. This prevents the driver from returning an error and failing to probe.
Quoted 4 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-0
[ ... ]
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563, · line 335
Quoted 9 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +3
-0@@ -327,6 +328,9 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ;
[Severity: Medium]
This is a pre-existing issue, but should TC9563_ETHERNET also be handled to avoid returning -EINVAL here?
If the device tree mistakenly provides tuning properties for the Ethernet MAC Endpoint node, the driver's power-on sequence fails entirely because tc9563_pwrctrl_power_on() iterates up to TC9563_MAX.
The patch fixes this exact flaw for TC9563_DSP3, but does TC9563_ETHERNET suffer from the same vulnerability if tuning properties are erroneously provided?
Quoted 1 line
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-0}
[ ... ]
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, · line 375
Quoted 9 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +3
-0@@ -363,6 +368,9 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ;
[Severity: Medium]
This is a pre-existing issue, but does this default case also cause the driver to fail if tuning properties are provided for TC9563_ETHERNET?
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, · line 376
Quoted 1 line
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-0}
[Severity: High]
This is a pre-existing issue, but does the error path in probe and the remove function unconditionally call tc9563_pwrctrl_power_off(), leading to an unbalanced regulator disable?
If devm_pci_pwrctrl_device_set_ready() fails during tc9563_pwrctrl_probe(), the driver jumps to power_off:
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c:tc9563_pwrctrl_probe() {
...
power_off:
tc9563_pwrctrl_power_off(&tc9563->pwrctrl);
}Because probe never calls regulator_bulk_enable(), does the error path disable regulators that were never enabled by this driver?
Additionally, tc9563_pwrctrl_remove() unconditionally calls tc9563_pwrctrl_power_off(). The PCI power control subsystem automatically powers down devices when they are unbound, meaning remove() calls .power_off() on an already powered-off device.
Can this unbalanced disable produce kernel warnings and mess up regulator use counts?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
In reply to Manivannan SadhasivamQuoted 54 lines · On Sat, 25 Jul 2026 10:59:16 +0200, Manivannan Sadhasivam via B4 Relay…
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8
-1@@ -308,6 +308,7 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563,static int tc9563_pwrctrl_set_tx_amplitude (struct tc9563_pwrctrl *tc9563,enum tc9563_pwrctrl_ports port) { +struct device *dev = tc9563->pwrctrl.dev;u32 amp = tc9563->cfg[port].tx_amp;int port_access;@@ -327,6 +328,9 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; }@@ -345,6 +349,7 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, enum tc9563_pwrctrl_ports port) {struct tc9563_pwrctrl_cfg *cfg = &tc9563->cfg[port]; +struct device *dev = tc9563->pwrctrl.dev;int port_access, lane_access =0x3 ;u32 phy_rate =0x21 ;@@ -363,6 +368,9 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; } --
Quoted 4 lines
2.43.0
Re: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
In reply to Manivannan SadhasivamQuoted 8 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>
So to keep things simple, tc9563_pwrctrl_parse_device_dt() is called for all downstream ports but you ignore the setting (with a warning) for those that do not apply to DSP3.
What about tc9563_pwrctrl_set_nfts()?
Other than that (question) this looks good.
Quoted 45 lines
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +8
-0@@ -308,6 +308,7 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563,static int tc9563_pwrctrl_set_tx_amplitude (struct tc9563_pwrctrl *tc9563,enum tc9563_pwrctrl_ports port) { +struct device *dev = tc9563->pwrctrl.dev;u32 amp = tc9563->cfg[port].tx_amp;int port_access;@@ -327,6 +328,9 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; }@@ -345,6 +349,7 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, enum tc9563_pwrctrl_ports port) {struct tc9563_pwrctrl_cfg *cfg = &tc9563->cfg[port]; +struct device *dev = tc9563->pwrctrl.dev;int port_access, lane_access =0x3 ;u32 phy_rate =0x21 ;@@ -363,6 +368,9 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; +case TC9563_DSP3 : +dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +return 0 ;default :return -EINVAL ; }
Manivannan Sadhasivam
maintainerRe: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
Quoted 7 lines · Alex Elder
Quoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Quoted 9 lines
Quoted 2 lines
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>So to keep things simple,
tc9563_pwrctrl_parse_device_dt()is called for all downstream ports but you ignore the setting (with a warning) for those that do not apply to DSP3.What about
tc9563_pwrctrl_set_nfts()?
Good catch! I missed adding the check for N_FTS as well:
```
diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
index 9d869483b6b3..978907aa0ce5 100644
--- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
+++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
@@ -410,11 +410,17 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563,
{TC9563_NFTS_2_5_GT, nfts[0]},
{TC9563_NFTS_5_GT, nfts[1]},
};
+ struct device *dev = tc9563->pwrctrl.dev;
int ret;
if (!nfts[0])
return 0;
+ if (port == TC9563_VDSP) {
+ dev_dbg(dev, "N_FTS tuning not supported for VDSP\n");
+ return 0;
+ }
+
ret = tc9563_pwrctrl_i2c_write(tc9563->client, TC9563_PORT_SELECT,
BIT(port));
if (ret)
```@Bjorn: Could you please amend the above diff with this commit?
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Alex Elder
Reviewed-byRe: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
Quoted 11 lines · Manivannan Sadhasivam
Quoted 10 lines · Alex Elder
Quoted 8 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>
Quoted 8 lines
Quoted 6 lines
So to keep things simple,
tc9563_pwrctrl_parse_device_dt()is called for all downstream ports but you ignore the setting (with a warning) for those that do not apply to DSP3.What about
tc9563_pwrctrl_set_nfts()?Good catch! I missed adding the check for
N_FTSas well:
In case you need it:
Quoted 30 lines
```
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +6
-0@@ -410,11 +410,17 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563, {TC9563_NFTS_2_5_GT, nfts[0]}, {TC9563_NFTS_5_GT, nfts[1]}, }; +struct device *dev = tc9563->pwrctrl.dev;int ret;if (!nfts[0 ])return 0 ; +if (port ==TC9563_VDSP ) { +dev_dbg (dev,"N_FTS tuning not supported for VDSP\n" ); +return 0 ; + } + ret =tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_PORT_SELECT ,BIT (port));if (ret)```
@Bjorn: Could you please amend the above diff with this commit?
- Mani
Re: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
In reply to Manivannan SadhasivamQuoted 44 lines · Manivannan Sadhasivam
Quoted 7 lines · Alex Elder
Quoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Quoted 8 lines
Quoted 2 lines
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>So to keep things simple,
tc9563_pwrctrl_parse_device_dt()is called for all downstream ports but you ignore the setting (with a warning) for those that do not apply to DSP3.What about
tc9563_pwrctrl_set_nfts()?Good catch! I missed adding the check for
N_FTSas well:```
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +6
-0@@ -410,11 +410,17 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563, {TC9563_NFTS_2_5_GT, nfts[0]}, {TC9563_NFTS_5_GT, nfts[1]}, }; +struct device *dev = tc9563->pwrctrl.dev;int ret;if (!nfts[0 ])return 0 ; +if (port ==TC9563_VDSP ) { +dev_dbg (dev,"N_FTS tuning not supported for VDSP\n" ); +return 0 ; + } + ret =tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_PORT_SELECT ,BIT (port));if (ret)```
Quoted 1 line
@Bjorn: Could you please amend the above diff with this commit?
It didn't apply cleanly (maybe whitespace damage?), but I applied it by hand:
https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git/commit/?id=b859b9366b44
Manivannan Sadhasivam
maintainerRe: [PATCH 4/6] PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
Quoted 45 lines · Bjorn Helgaas
Quoted 44 lines · Manivannan Sadhasivam
Quoted 7 lines · Alex Elder
Quoted 6 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
DSP3 doesn't support tuning Tx amplitude and DFE settings. So just skip the setting if DT has passed the tuning properties. There is no need to error out the whole driver because of it.
Quoted 8 lines
Quoted 2 lines
Fixes 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")Signed-off-by Manivannan Sadhasivam <[email protected]>So to keep things simple,
tc9563_pwrctrl_parse_device_dt()is called for all downstream ports but you ignore the setting (with a warning) for those that do not apply to DSP3.What about
tc9563_pwrctrl_set_nfts()?Good catch! I missed adding the check for
N_FTSas well:```
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +6
-0@@ -410,11 +410,17 @@ static int tc9563_pwrctrl_set_nfts(struct tc9563_pwrctrl *tc9563, {TC9563_NFTS_2_5_GT, nfts[0]}, {TC9563_NFTS_5_GT, nfts[1]}, }; +struct device *dev = tc9563->pwrctrl.dev;int ret;if (!nfts[0 ])return 0 ; +if (port ==TC9563_VDSP ) { +dev_dbg (dev,"N_FTS tuning not supported for VDSP\n" ); +return 0 ; + } + ret =tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_PORT_SELECT ,BIT (port));if (ret)```
Quoted 5 lines
Quoted 1 line
@Bjorn: Could you please amend the above diff with this commit?
It didn't apply cleanly (maybe whitespace damage?), but I applied it by hand:
https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git/commit/?id=b859b9366b44
LGTM, thanks!
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH 5/6 PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
In reply to Manivannan SadhasivamTC9563 Reference Manual calls DSP3 as VDSP (Virtual Downstream Port). Hence name it as such to avoid ambiguity.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7 -7
@@ -80,7 +80,7 @@ enum tc9563_pwrctrl_ports {TC9563_USP ,TC9563_DSP1 ,TC9563_DSP2 , -TC9563_DSP3 , +TC9563_VDSP ,TC9563_ETHERNET , TC9563_MAX };
@@ -328,8 +328,8 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"Tx amplitude tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;
@@ -368,8 +368,8 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"DFE tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;
@@ -612,10 +612,10 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)break ;/* -* The integrated Ethernet MAC Endpoint under DSP3 is a single +* The integrated Ethernet MAC Endpoint under VDSP is a single * device whose functions share the same config registers. */ -if (port ==TC9563_DSP3 ) { +if (port ==TC9563_VDSP ) { struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) {
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 5/6] PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unbalanced regulator_bulk_disable in probe error path and remove function. --
--- Patch [5]: [PATCH 5/6] PCI/pwrctrl: tc9563: Rename DSP3 to VDSP --- commit c88ec5f207551e44e4f9a4f5673e22f3dde64e6e
Author: Manivannan Sadhasivam <[email protected]>
PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
TC9563 Reference Manual calls DSP3 as VDSP (Virtual Downstream Port). Hence name it as such to avoid ambiguity.
Quoted 4 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-0
[ ... ]
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c static int tc9563_pwrctrl_probe(struct platform_device *pdev) · line 621
Quoted 13 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +2
-2@@ -612,10 +612,10 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)break ;/* -* The integrated Ethernet MAC Endpoint under DSP3 is a single +* The integrated Ethernet MAC Endpoint under VDSP is a single * device whose functions share the same config registers. */ -if (port ==TC9563_DSP3 ) { +if (port ==TC9563_VDSP ) { struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) {
[Severity: High]
This isn't a bug introduced by this patch, but does the probe error path cause an unbalanced regulator disable?
In tc9563_pwrctrl_probe(), if devm_pci_pwrctrl_device_set_ready() fails, the code jumps to power_off:
ret = devm_pci_pwrctrl_device_set_ready(dev, &tc9563->pwrctrl); if (ret) goto power_off; ... power_off: tc9563_pwrctrl_power_off(&tc9563->pwrctrl);
Since tc9563_pwrctrl_power_on() is meant to be called asynchronously by the PCI subsystem and is never invoked during probe, wouldn't calling tc9563_pwrctrl_power_off() here invoke regulator_bulk_disable() without a preceding regulator_bulk_enable()?
This triggers a WARN_ON_ONCE in the regulator core, which crashes systems with panic_on_warn enabled.
The same unconditional disable appears to occur in tc9563_pwrctrl_remove() when unbinding the driver.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH 5/6] PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
In reply to Manivannan SadhasivamQuoted 60 lines · On Sat, 25 Jul 2026 10:59:17 +0200, Manivannan Sadhasivam via B4 Relay…
From: Manivannan Sadhasivam <[email protected]>
TC9563 Reference Manual calls DSP3 as VDSP (Virtual Downstream Port). Hence name it as such to avoid ambiguity.
Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7
-8@@ -80,7 +80,7 @@ enum tc9563_pwrctrl_ports {TC9563_USP ,TC9563_DSP1 ,TC9563_DSP2 , -TC9563_DSP3 , +TC9563_VDSP ,TC9563_ETHERNET , TC9563_MAX };@@ -328,8 +328,8 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"Tx amplitude tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;@@ -368,8 +368,8 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"DFE tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;@@ -612,10 +612,10 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)break ;/* -* The integrated Ethernet MAC Endpoint under DSP3 is a single +* The integrated Ethernet MAC Endpoint under VDSP is a single * device whose functions share the same config registers. */ -if (port ==TC9563_DSP3 ) { +if (port ==TC9563_VDSP ) { struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) { --
Quoted 4 lines
2.43.0
Re: [PATCH 5/6] PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
In reply to Manivannan SadhasivamQuoted 4 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
TC9563 Reference Manual calls DSP3 as VDSP (Virtual Downstream Port). Hence name it as such to avoid ambiguity.
I didn't really like the overloaded "virtual" term (though maybe it is normal for PCI). However I do like that this makes it clearer that the third downstream port is different from the first two.
Quoted 55 lines
Signed-off-by Manivannan Sadhasivam <[email protected]>--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +7
-7@@ -80,7 +80,7 @@ enum tc9563_pwrctrl_ports {TC9563_USP ,TC9563_DSP1 ,TC9563_DSP2 , -TC9563_DSP3 , +TC9563_VDSP ,TC9563_ETHERNET , TC9563_MAX };@@ -328,8 +328,8 @@ static int tc9563_pwrctrl_set_tx_amplitude(struct tc9563_pwrctrl *tc9563,case TC9563_DSP2 : port_access =0x8 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"Tx amplitude tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"Tx amplitude tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;@@ -368,8 +368,8 @@ static int tc9563_pwrctrl_disable_dfe(struct tc9563_pwrctrl *tc9563, port_access =0x8 ; lane_access =0x1 ;break ; -case TC9563_DSP3 : -dev_dbg (dev,"DFE tuning not supported for DSP3\n" ); +case TC9563_VDSP : +dev_dbg (dev,"DFE tuning not supported for VDSP\n" );return 0 ;default :return -EINVAL ;@@ -612,10 +612,10 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)break ;/* -* The integrated Ethernet MAC Endpoint under DSP3 is a single +* The integrated Ethernet MAC Endpoint under VDSP is a single * device whose functions share the same config registers. */ -if (port ==TC9563_DSP3 ) { +if (port ==TC9563_VDSP ) { struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) {
PATCH 6/6 PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
In reply to Manivannan Sadhasivam'tc9563_pwrctrl_ports' is supposed to list only the internal ports of the switch. But it currently lists the integrated MAC Endpoint as well, which is wrong.
Hence, move it to a separate 'ep_cfg' struct and also configure/parse the ports and the MAC Endpoint separately.
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 96 ++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 36 deletions(-)
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +60 -36
@@ -81,7 +81,6 @@ enum tc9563_pwrctrl_ports {TC9563_DSP1 ,TC9563_DSP2 ,TC9563_VDSP , -TC9563_ETHERNET , TC9563_MAX };
@@ -109,6 +108,7 @@ struct tc9563_pwrctrl {struct pci_pwrctrl pwrctrl;struct regulator_bulk_data supplies[TC9563_PWRCTL_MAX_SUPPLY ];struct tc9563_pwrctrl_cfg cfg[TC9563_MAX ]; +struct tc9563_pwrctrl_cfg ep_cfg;struct gpio_desc *reset_gpio;struct i2c_adapter *adapter;struct i2c_client *client;
@@ -263,11 +263,11 @@ static int tc9563_pwrctrl_disable_port(struct tc9563_pwrctrl *tc9563, ARRAY_SIZE(common_pwroff_seq)); } -static int tc9563_pwrctrl_set_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, -enum tc9563_pwrctrl_ports port, -bool is_l1,u32 ns) +static int tc9563_pwrctrl_set_port_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, +enum tc9563_pwrctrl_ports port, +bool is_l1,u32 ns) { -u32 rd_val, units; +u32 units;int ret;if (ns <TC9563_L0S_L1_DELAY_UNIT_NS )
@@ -276,25 +276,6 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563,/* convert to units of 256ns */ units = ns /TC9563_L0S_L1_DELAY_UNIT_NS ; -if (port ==TC9563_ETHERNET ) { - ret =tc9563_pwrctrl_i2c_read (tc9563->client, -TC9563_EMBEDDED_ETH_DELAY , - &rd_val); -if (ret) -return ret; - -if (is_l1) - rd_val =u32_replace_bits (rd_val, units, -TC9563_ETH_L1_DELAY_MASK ); -else - rd_val =u32_replace_bits (rd_val, units, -TC9563_ETH_L0S_DELAY_MASK ); - -return tc9563_pwrctrl_i2c_write (tc9563->client, -TC9563_EMBEDDED_ETH_DELAY , - rd_val); - } - ret =tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_PORT_SELECT ,BIT (port));if (ret)
@@ -305,6 +286,34 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563, units); } +static int tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, +bool is_l1,u32 ns) +{ +u32 rd_val, units; +int ret; + +if (ns <TC9563_L0S_L1_DELAY_UNIT_NS ) +return 0 ; + +/* convert to units of 256ns */ + units = ns /TC9563_L0S_L1_DELAY_UNIT_NS ; + + ret =tc9563_pwrctrl_i2c_read (tc9563->client,TC9563_EMBEDDED_ETH_DELAY , + &rd_val); +if (ret) +return ret; + +if (is_l1) + rd_val =u32_replace_bits (rd_val, units, +TC9563_ETH_L1_DELAY_MASK ); +else + rd_val =u32_replace_bits (rd_val, units, +TC9563_ETH_L0S_DELAY_MASK ); + +return tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_EMBEDDED_ETH_DELAY , + rd_val); +} +static int tc9563_pwrctrl_set_tx_amplitude (struct tc9563_pwrctrl *tc9563,enum tc9563_pwrctrl_ports port) {
@@ -430,11 +439,9 @@ static int tc9563_pwrctrl_assert_deassert_reset(struct tc9563_pwrctrl *tc9563,return tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_RESET_GPIO , val); } -static int tc9563_pwrctrl_parse_device_dt (struct tc9563_pwrctrl *tc9563, -struct device_node *node, -enum tc9563_pwrctrl_ports port) +static int tc9563_pwrctrl_parse_device_dt (struct device_node *node, +struct tc9563_pwrctrl_cfg *cfg) { -struct tc9563_pwrctrl_cfg *cfg = &tc9563->cfg[port];int ret;/* Disable port if the status of the port is disabled. */
@@ -505,13 +512,13 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) goto power_off; } - ret =tc9563_pwrctrl_set_l0s_l1_entry_delay (tc9563, i, false, cfg->l0s_delay); + ret =tc9563_pwrctrl_set_port_l0s_l1_entry_delay (tc9563, i, false, cfg->l0s_delay);if (ret) {dev_err (dev,"Setting L0s entry delay failed\n" ); goto power_off; } - ret =tc9563_pwrctrl_set_l0s_l1_entry_delay (tc9563, i, true, cfg->l1_delay); + ret =tc9563_pwrctrl_set_port_l0s_l1_entry_delay (tc9563, i, true, cfg->l1_delay);if (ret) {dev_err (dev,"Setting L1 entry delay failed\n" ); goto power_off;
@@ -536,6 +543,21 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) } } +/* Configure the integrated Ethernet MAC endpoint */ + ret =tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (tc9563, false, + tc9563->ep_cfg.l0s_delay); +if (ret) { +dev_err (dev,"Setting Ethernet L0s entry delay failed\n" ); + goto power_off; + } + + ret =tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (tc9563, true, + tc9563->ep_cfg.l1_delay); +if (ret) { +dev_err (dev,"Setting Ethernet L1 entry delay failed\n" ); + goto power_off; + } + ret =tc9563_pwrctrl_assert_deassert_reset (tc9563, true);if (!ret)return 0 ;
@@ -593,8 +615,7 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)pci_pwrctrl_init (&tc9563->pwrctrl, dev); - port =TC9563_USP ; - ret =tc9563_pwrctrl_parse_device_dt (tc9563, node, port); + ret =tc9563_pwrctrl_parse_device_dt (node, &tc9563->cfg[TC9563_USP ]);if (ret) {dev_err (dev,"failed to parse device tree properties: %d\n" , ret); goto remove_i2c;
@@ -605,9 +626,12 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)* The first node represents DSP1, the second node represents DSP2, * and so on. */ + port =TC9563_USP ;for_each_child_of_node_scoped (node, child) { - port++; - ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port); +if (++port >=TC9563_MAX ) +break ; + + ret =tc9563_pwrctrl_parse_device_dt (child, &tc9563->cfg[port]);if (ret)break ;
@@ -619,8 +643,8 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) { - ret =tc9563_pwrctrl_parse_device_dt (tc9563, - eth,TC9563_ETHERNET ); + ret =tc9563_pwrctrl_parse_device_dt (eth, + &tc9563->ep_cfg);if (ret)break ; }
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 6/6] PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
From: Manivannan Sadhasivam <[email protected]>
'
tc9563_pwrctrl_ports' is supposed to list only the internal ports of the switch. But it currently lists the integrated MAC Endpoint as well, which is wrong.Hence, move it to a separate '
ep_cfg' struct and also configure/parse the ports and the MAC Endpoint separately.Signed-off-by Manivannan Sadhasivam <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Re: [PATCH 6/6] PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
In reply to Manivannan SadhasivamQuoted 11 lines · On Sat, 25 Jul 2026 10:59:18 +0200, Manivannan Sadhasivam via B4 Relay…
From: Manivannan Sadhasivam <[email protected]>
'
tc9563_pwrctrl_ports' is supposed to list only the internal ports of the switch. But it currently lists the integrated MAC Endpoint as well, which is wrong.Hence, move it to a separate '
ep_cfg' struct and also configure/parse the ports and the MAC Endpoint separately.Signed-off-by Manivannan Sadhasivam <[email protected]>---
Re: [PATCH 6/6] PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
In reply to Manivannan SadhasivamQuoted 10 lines · On 7/25/26 3:59 AM, Manivannan Sadhasivam via B4 Relay wrote:
From: Manivannan Sadhasivam <[email protected]>
'
tc9563_pwrctrl_ports' is supposed to list only the internal ports of the switch. But it currently lists the integrated MAC Endpoint as well, which is wrong.Hence, move it to a separate '
ep_cfg' struct and also configure/parse the ports and the MAC Endpoint separately.Signed-off-by Manivannan Sadhasivam <[email protected]>
I like this. It cleans up some things I was going to suggest myself at some point.
Quoted 17 lines
--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 96 ++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 36 deletions(-)drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +0
-1@@ -81,7 +81,6 @@ enum tc9563_pwrctrl_ports {TC9563_DSP1 ,TC9563_DSP2 ,TC9563_VDSP , -TC9563_ETHERNET , TC9563_MAX };
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c struct tc9563_pwrctrl { · line 111
Quoted 4 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +1
-0@@ -109,6 +108,7 @@ struct tc9563_pwrctrl {struct pci_pwrctrl pwrctrl;struct regulator_bulk_data supplies[TC9563_PWRCTL_MAX_SUPPLY ];struct tc9563_pwrctrl_cfg cfg[TC9563_MAX ]; +struct tc9563_pwrctrl_cfg ep_cfg;
maybe something with "eth" in the name?
Quoted 169 lines
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +59
-35struct gpio_desc *reset_gpio;struct i2c_adapter *adapter;struct i2c_client *client;@@ -263,11 +263,11 @@ static int tc9563_pwrctrl_disable_port(struct tc9563_pwrctrl *tc9563, ARRAY_SIZE(common_pwroff_seq)); } -static int tc9563_pwrctrl_set_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, -enum tc9563_pwrctrl_ports port, -bool is_l1,u32 ns) +static int tc9563_pwrctrl_set_port_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, +enum tc9563_pwrctrl_ports port, +bool is_l1,u32 ns) { -u32 rd_val, units; +u32 units;int ret;if (ns <TC9563_L0S_L1_DELAY_UNIT_NS )@@ -276,25 +276,6 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563,/* convert to units of 256ns */ units = ns /TC9563_L0S_L1_DELAY_UNIT_NS ; -if (port ==TC9563_ETHERNET ) { - ret =tc9563_pwrctrl_i2c_read (tc9563->client, -TC9563_EMBEDDED_ETH_DELAY , - &rd_val); -if (ret) -return ret; - -if (is_l1) - rd_val =u32_replace_bits (rd_val, units, -TC9563_ETH_L1_DELAY_MASK ); -else - rd_val =u32_replace_bits (rd_val, units, -TC9563_ETH_L0S_DELAY_MASK ); - -return tc9563_pwrctrl_i2c_write (tc9563->client, -TC9563_EMBEDDED_ETH_DELAY , - rd_val); - } - ret =tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_PORT_SELECT ,BIT (port));if (ret)@@ -305,6 +286,34 @@ static int tc9563_pwrctrl_set_l0s_l1_entry_delay(struct tc9563_pwrctrl *tc9563, units); } +static int tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (struct tc9563_pwrctrl *tc9563, +bool is_l1,u32 ns) +{ +u32 rd_val, units; +int ret; + +if (ns <TC9563_L0S_L1_DELAY_UNIT_NS ) +return 0 ; + +/* convert to units of 256ns */ + units = ns /TC9563_L0S_L1_DELAY_UNIT_NS ; + + ret =tc9563_pwrctrl_i2c_read (tc9563->client,TC9563_EMBEDDED_ETH_DELAY , + &rd_val); +if (ret) +return ret; + +if (is_l1) + rd_val =u32_replace_bits (rd_val, units, +TC9563_ETH_L1_DELAY_MASK ); +else + rd_val =u32_replace_bits (rd_val, units, +TC9563_ETH_L0S_DELAY_MASK ); + +return tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_EMBEDDED_ETH_DELAY , + rd_val); +} +static int tc9563_pwrctrl_set_tx_amplitude (struct tc9563_pwrctrl *tc9563,enum tc9563_pwrctrl_ports port) {@@ -430,11 +439,9 @@ static int tc9563_pwrctrl_assert_deassert_reset(struct tc9563_pwrctrl *tc9563,return tc9563_pwrctrl_i2c_write (tc9563->client,TC9563_RESET_GPIO , val); } -static int tc9563_pwrctrl_parse_device_dt (struct tc9563_pwrctrl *tc9563, -struct device_node *node, -enum tc9563_pwrctrl_ports port) +static int tc9563_pwrctrl_parse_device_dt (struct device_node *node, +struct tc9563_pwrctrl_cfg *cfg) { -struct tc9563_pwrctrl_cfg *cfg = &tc9563->cfg[port];int ret;/* Disable port if the status of the port is disabled. */ @@ -505,13 +512,13 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) goto power_off; } - ret =tc9563_pwrctrl_set_l0s_l1_entry_delay (tc9563, i, false, cfg->l0s_delay); + ret =tc9563_pwrctrl_set_port_l0s_l1_entry_delay (tc9563, i, false, cfg->l0s_delay);if (ret) {dev_err (dev,"Setting L0s entry delay failed\n" ); goto power_off; } - ret =tc9563_pwrctrl_set_l0s_l1_entry_delay (tc9563, i, true, cfg->l1_delay); + ret =tc9563_pwrctrl_set_port_l0s_l1_entry_delay (tc9563, i, true, cfg->l1_delay);if (ret) {dev_err (dev,"Setting L1 entry delay failed\n" ); goto power_off;@@ -536,6 +543,21 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) } } +/* Configure the integrated Ethernet MAC endpoint */ + ret =tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (tc9563, false, + tc9563->ep_cfg.l0s_delay); +if (ret) { +dev_err (dev,"Setting Ethernet L0s entry delay failed\n" ); + goto power_off; + } + + ret =tc9563_pwrctrl_set_eth_l0s_l1_entry_delay (tc9563, true, + tc9563->ep_cfg.l1_delay); +if (ret) { +dev_err (dev,"Setting Ethernet L1 entry delay failed\n" ); + goto power_off; + } + ret =tc9563_pwrctrl_assert_deassert_reset (tc9563, true);if (!ret)return 0 ;@@ -593,8 +615,7 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)pci_pwrctrl_init (&tc9563->pwrctrl, dev); - port =TC9563_USP ; - ret =tc9563_pwrctrl_parse_device_dt (tc9563, node, port); + ret =tc9563_pwrctrl_parse_device_dt (node, &tc9563->cfg[TC9563_USP ]);if (ret) {dev_err (dev,"failed to parse device tree properties: %d\n" , ret); goto remove_i2c;@@ -605,9 +626,12 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev)* The first node represents DSP1, the second node represents DSP2, * and so on. */ + port =TC9563_USP ;for_each_child_of_node_scoped (node, child) { - port++; - ret =tc9563_pwrctrl_parse_device_dt (tc9563, child, port); +if (++port >=TC9563_MAX ) +break ; + + ret =tc9563_pwrctrl_parse_device_dt (child, &tc9563->cfg[port]);if (ret)break ;@@ -619,8 +643,8 @@ static int tc9563_pwrctrl_probe(struct platform_device *pdev) struct device_node *eth __free(device_node) =of_get_next_available_child (child,NULL );if (eth) { - ret =tc9563_pwrctrl_parse_device_dt (tc9563, - eth,TC9563_ETHERNET ); + ret =tc9563_pwrctrl_parse_device_dt (eth, + &tc9563->ep_cfg);if (ret)break ; }
Quoted 24 lines · On Sat, Jul 25, 2026 at 10:59:12AM +0200, Manivannan Sadhasivam via B4 Relay…
Hi,
This series contains several fixes and improvements for the TC9563 Pwrctrl driver and the switch binding. Most of the fixes are related to ensuring correctness in parsing the DT properties for the switch ports and the integrated Endpoint.
More details are in the individual patches.
Testing
=======This series was validated on the RB3Gen2 board.
Signed-off-by Manivannan Sadhasivam <[email protected]>---
Manivannan Sadhasivam (6):
dt-bindings: PCI: toshiba,tc9563: Restrict Tx Amplitude, DFE andN_FTSto USP, DSP1 and DSP2 PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MAC Endpoint node PCI/pwrctrl: tc9563: Power off only the external ports intc9563_pwrctrl_disable_port()PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 'tc9563_pwrctrl_ports' enum
Quoted 3 lines
.../devicetree/bindings/pci/toshiba,tc9563.yaml | 21 +++- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 129 ++++++++++++++------- 2 files changed, 104 insertions(+), 46 deletions(-)
Added to pci/pwrctrl for v7.3, thanks!
Happy to revise if you respond to any of Alex's comments.