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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3bba104-9a85-df8d-c62d-6acb8913c3fe@ti.com>
Date:   Mon, 12 Aug 2019 14:05:49 +0300
From:   Roger Quadros <rogerq@...com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Pawel Laszczak <pawell@...ence.com>
CC:     "felipe.balbi@...ux.intel.com" <felipe.balbi@...ux.intel.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "jbergsagel@...com" <jbergsagel@...com>,
        "nsekhar@...com" <nsekhar@...com>, "nm@...com" <nm@...com>,
        Suresh Punnoose <sureshp@...ence.com>,
        Jayshri Dajiram Pawar <jpawar@...ence.com>,
        Rahul Kumar <kurahul@...ence.com>,
        Anil Joy Varughese <aniljoy@...ence.com>
Subject: Re: [PATCH v10 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

On 12/08/2019 13:31, Heikki Krogerus wrote:
> Hi,
> 
>>>>>> +	real_role = cdsn3_real_role_switch_get(cdns->dev);
>>>>>> +
>>>>>> +	current_role = role;
>>>>>> +	dev_dbg(cdns->dev, "Switching role");
>>>>>> +
>>>>>> +	ret = cdns3_role_start(cdns, real_role);
>>>>>> +	if (ret) {
>>>>>> +		/* Back to current role */
>>>>>> +		dev_err(cdns->dev, "set %d has failed, back to %d\n",
>>>>>> +			role, current_role);
>>>>>> +		ret = cdns3_role_start(cdns, current_role);
>>>>>> +		if (ret)
>>>>>> +			dev_err(cdns->dev, "back to %d failed too\n",
>>>>>> +				current_role);
>>>>>> +	}
>>>>>> +exit:
>>>>>> +	pm_runtime_put_sync(cdns->dev);
>>>>>> +	return ret;
>>>>>> +}
>>>>>> +
>>>>>> +static const struct usb_role_switch_desc cdns3_switch_desc = {
>>>>>> +	.set = cdns3_role_switch_set,
>>>>>> +	.get = cdsn3_real_role_switch_get,
>>>>>> +	.allow_userspace_control = true,
>>>>>
>>>>> how does user initiated cdns3_role_switch_set() via sysfs co-exist with role
>>>>> changes done by hardware events. e.g. ID/VBUS?
>>>>>
>>>>
>>>> Do you expect any issues whit this,  have you seen any problem with this
>>>> on your  platform ?
>>>>
>>>> I assume that it should work in this way:
>>>> 1. user change role by sysfs
>>>> 2. Driver change the role according with user request.
>>>> 3. If we receive correct ID/VBUS then role should not be changed
>>>>     because new role is the same as current set in point 2.
>>>>
>>>
>>> I have not tested this series yet.
>>> My understanding is that if user sets role to "host" or "device" then it should
>>> remain in that role irrespective of ID/VBUS. Once user sets it to "none" then
>>> port should set role based on ID/VBUS.
>>
>> According with your understanding it works the same way as by debugfs. 
>> Now I have no doubts to remove debugfs.c file :)
> 
> Hold on! The role "none" means that the connector should not be
> connected to either the host nor device.

OK.
> 
> The sysfs file we expose from the class for the role switches is
> primarily meant for supporting proprietary protocols that require us
> to basically override the connector USB data role. The default role
> should always be selected in the drivers.

OK. Let's take this example
- Port is dual-role port micro AB.
- microAB to type-A adapter is connected which pulls ID low. port transitions
to "host" role by the controller driver.
- proprietary protocol want to switch role to device role so writes "device" to
mode switch sysfs. port transitions to "device" role.

Now, how does controller driver know to fall back to HW based role switching?

> 
> With USB Type-C connectors and alternate modes, the "none" role is
> used for example when the connector is put into "USB Safe State". In
> case you guys are not familiar with USB Safe State, then it is a state
> (defined in USB PD specifications) for the connector where the data
> lines on the connector should not be physically connected to anything.
> The connector needs to be put into safe state always when entering
> or exiting an alternate mode, before the final mode (USB or alternate)
> is actually being set for the connector.
> 
> 
> thanks,
> 

-- 
cheers,
-roger
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