lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Nov 2020 14:22:25 +0200
From:   Roger Quadros <rogerq@...com>
To:     Peter Chen <peter.chen@....com>
CC:     "heikki.krogerus@...ux.intel.com" <heikki.krogerus@...ux.intel.com>,
        "pawell@...ence.com" <pawell@...ence.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "balbi@...nel.org" <balbi@...nel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Revert "usb: cdns3: core: quit if it uses role switch
 class"

Peter,

On 24/11/2020 13:47, Peter Chen wrote:
> On 20-11-24 12:33:34, Roger Quadros wrote:
>>>>>
>>>>> I am sorry about that. Do you use role switch /sys entry, if you have
>>>>> used, I prefer using "usb-role-switch" property at dts to judge if SoC
>>>>> OTG signals or external signals for role switch. If you have not used
>>>>> it, I prefer only setting cdns->role_sw for role switch use cases.
>>>>>
>>>>
>>>> We use both hardware role switch and /sys entries for manually forcing a
>>>> certain role.
>>>>
>>>> We do not set any "usb-role-switch" property at DTS.
>>>>
>>>> Currently cdns->role_sw is being always set by driver irrespective of any DT
>>>> property, so this patch is clearly wrong and needs to be reverted.
>>>>
>>>> What do you think?
>>>>
>>>
>>> Could you accept below fix?
>>>
>>> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>>> index 2e469139769f..fdd52e87a7b2 100644
>>> --- a/drivers/usb/cdns3/core.c
>>> +++ b/drivers/usb/cdns3/core.c
>>> @@ -280,8 +280,8 @@ int cdns3_hw_role_switch(struct cdns3 *cdns)
>>>           enum usb_role real_role, current_role;
>>>           int ret = 0;
>>>
>>> -       /* Depends on role switch class */
>>> -       if (cdns->role_sw)
>>> +       /* quit if switch role through external signals */
>>> +       if (device_property_read_bool(cdns->dev, "usb-role-switch"))
>>>                   return 0;
>>>
>>>           pm_runtime_get_sync(cdns->dev);
>>
>> Although this will fix the issue I don't think this is making the driver to behave
>> as expected with usb-role-switch property.
>>
>> Now, even if usb-role-switch property is not present the driver will still register
>> the role switch driver.
>>
>> I think we need to register the role switch driver only if usb-role-switch property
>> is present. We would also need to set the default role if role-switch-default-mode is present.
>>
>> How about the following? It still doesn't handle role-switch-default-mode property though.
>>
> 
> Roger, you said you also use /sys entries (I suppose it means through role
> switch class) to do role switch, with your change, there will be no /sys
> entry for role switch.

Sorry for the confusion. Although we do need both features (SW role switch + HW role switch)
I don't think it is required to operate simultaneously. If users need SW control they can set the DT flag.

cheers,
-roger

> 
> Peter
> 
>>>> We use both hardware role switch and /sys entries for manually forcing a
>>>> certain role.
> 
> 
> 
> 
>> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>> index 4c1445cf2ad0..986b56a9940c 100644
>> --- a/drivers/usb/cdns3/core.c
>> +++ b/drivers/usb/cdns3/core.c
>> @@ -532,11 +532,13 @@ static int cdns3_probe(struct platform_device *pdev)
>>   	if (device_property_read_bool(dev, "usb-role-switch"))
>>   		sw_desc.fwnode = dev->fwnode;
>> -	cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
>> -	if (IS_ERR(cdns->role_sw)) {
>> -		ret = PTR_ERR(cdns->role_sw);
>> -		dev_warn(dev, "Unable to register Role Switch\n");
>> -		goto err3;
>> +	if (device_property_read_bool(cdns->dev, "usb-role-switch")) {
>> +		cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
>> +		if (IS_ERR(cdns->role_sw)) {
>> +			ret = PTR_ERR(cdns->role_sw);
>> +			dev_warn(dev, "Unable to register Role Switch\n");
>> +			goto err3;
>> +		}
>>   	}
>>   	if (cdns->wakeup_irq) {
>>
>>
>>
>> cheers,
>> -roger
>> -- 
>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ