Re: [PATCH 3/3] phy: apple: atc: Implement the USB4 pipehandler state

Sven Peter <[email protected]>
Newsgroups org.infradead.lists.linux-phy,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>

On 8/21/26 16:01, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [High] Missing cleanup of `PIPEHANDLER_OVERRIDE` registers on lock failure leaves link detection permanently disabled.
>
> Pre-existing issues:
> - [High] Unconditional state update of `atcphy->pipehandler_up = true` on the error path masks hardware configuration failures.
> --
>
> --- Patch [3]: [PATCH 3/3] phy: apple: atc: Implement the USB4 pipehandler state ---
> commit 6b90c04f8cd4e7a3f818a4bc0eb1057996bb1845
> Author: Sven Peter <[email protected]>
>
> phy: apple: atc: Implement the USB4 pipehandler state
>
> This commit implements the USB4 pipehandler state for the Apple ATC PHY driver.
> It switches the dwc3's PIPE interface to the USB4 NHI which takes care of
> tunneling USB3 over USB4.
>
>> diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
>> index 96158d3486560..613bcd0ae8865 100644
>> --- a/drivers/phy/apple/atc.c
>> +++ b/drivers/phy/apple/atc.c
>> @@ -1084,6 +1084,41 @@ static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool h
>>   	return 0;
>>   }
>>   
>> +static int atcphy_configure_pipehandler_usb4(struct apple_atcphy *atcphy)
>> +{
>> +	int ret;
>> +
>> +	ret = atcphy_pipehandler_check(atcphy);
>> +	if (ret)
>> +		return ret;
>> +
>> +	/* Force disable link detection */
>> +	clear32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE_VALUES,
>> +		PIPEHANDLER_OVERRIDE_VAL_RXDETECT0 | PIPEHANDLER_OVERRIDE_VAL_RXDETECT1);
>> +	set32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXVALID);
>> +	set32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXDETECT);
>> +
>> +	ret = atcphy_pipehandler_lock(atcphy);
>> +	if (ret) {
>> +		dev_err(atcphy->dev, "Failed to lock pipehandler\n");
>> +		return ret;
>> +	}
> [Severity: High]
> If atcphy_pipehandler_lock() fails and returns early, the link detection
> override bits (PIPEHANDLER_OVERRIDE_RXVALID and
> PIPEHANDLER_OVERRIDE_RXDETECT) are left set.
>
> Does this permanently disable link detection on the PHY hardware for
> subsequent retries until a hard reset occurs?

No, if this fails the port will be broken until the next unplug/plug 
which resets everything anyway.
Same pattern has been working in the other paths and since we have no 
documentation for this PHY I won't touch it or do anything else here.



Sven


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.