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]
Message-ID: <570F7FB3.2040807@ti.com>
Date:	Thu, 14 Apr 2016 14:32:03 +0300
From:	Roger Quadros <rogerq@...com>
To:	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	"stern@...land.harvard.edu" <stern@...land.harvard.edu>,
	"balbi@...nel.org" <balbi@...nel.org>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"peter.chen@...escale.com" <peter.chen@...escale.com>
CC:	"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
	"jun.li@...escale.com" <jun.li@...escale.com>,
	"mathias.nyman@...ux.intel.com" <mathias.nyman@...ux.intel.com>,
	"tony@...mide.com" <tony@...mide.com>,
	"Joao.Pinto@...opsys.com" <Joao.Pinto@...opsys.com>,
	"abrestic@...omium.org" <abrestic@...omium.org>,
	"r.baldyga@...sung.com" <r.baldyga@...sung.com>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH v6 07/12] usb: otg: add OTG/dual-role core

On 14/04/16 14:15, Yoshihiro Shimoda wrote:
> Hi,
> 
>> From: Roger Quadros
>> Sent: Thursday, April 14, 2016 8:00 PM
>>
>> On 14/04/16 11:36, Yoshihiro Shimoda wrote:
>>> Hi,
>>>
> < snip >
>>> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
>>> index e3d0161..8b74715 100644
>>> --- a/drivers/usb/common/common.c
>>> +++ b/drivers/usb/common/common.c
>>> @@ -233,6 +233,8 @@ int of_usb_update_otg_caps(struct device_node *np,
>>>  	if (of_find_property(np, "adp-disable", NULL) ||
>>>  				(otg_caps->otg_rev < 0x0200))
>>>  		otg_caps->adp_support = false;
>>> +	if (of_find_property(np, "hcd-needs-companion", NULL))
>>> +		otg_caps->needs_companion = true;
>>
>> I'm not sure if otg_caps structure is a right place for this. Maybe Peter can confirm
>> if this is OK or not.
>>
>> I was thinking more about adding this bit in the otg_config structure.
> 
> I see. I also think the otg_config is more suitable.
> 
>>>
>>>  	return 0;
>>>  }
>>> diff --git a/drivers/usb/common/usb-otg.c b/drivers/usb/common/usb-otg.c
>>> index 41e762a..e0df839 100644
>>> --- a/drivers/usb/common/usb-otg.c
>>> +++ b/drivers/usb/common/usb-otg.c
>>> @@ -823,13 +823,15 @@ int usb_otg_register_hcd(struct usb_hcd *hcd, unsigned int irqnum,
>>>  	/* HCD will be started by OTG fsm when needed */
>>>  	mutex_lock(&otg->fsm.lock);
>>>  	if (otg->primary_hcd.hcd) {
>>> -		/* probably a shared HCD ? */
>>> -		if (usb_otg_hcd_is_primary_hcd(hcd)) {
>>> +		/* probably a shared HCD or a companion OHCI HCD ? */
>>> +		if (!otg->caps->needs_companion &&
>>> +		    usb_otg_hcd_is_primary_hcd(hcd)) {
>>>  			dev_err(otg_dev, "otg: primary host already registered\n");
>>>  			goto err;
>>>  		}
>>>
>>> -		if (hcd->shared_hcd == otg->primary_hcd.hcd) {
>>> +		if (otg->caps->needs_companion ||
>>> +		    (hcd->shared_hcd == otg->primary_hcd.hcd)) {
>>>  			if (otg->shared_hcd.hcd) {
>>>  				dev_err(otg_dev, "otg: shared host already registered\n");
>>>  				goto err;
>>> @@ -865,7 +867,8 @@ int usb_otg_register_hcd(struct usb_hcd *hcd, unsigned int irqnum,
>>>  	 * we're ready only if we have shared HCD
>>>  	 * or we don't need shared HCD.
>>>  	 */
>>> -	if (otg->shared_hcd.hcd || !otg->primary_hcd.hcd->shared_hcd) {
>>> +	if (otg->shared_hcd.hcd || (!otg->caps->needs_companion &&
>>> +				    !otg->primary_hcd.hcd->shared_hcd)) {
>>>  		otg->host = hcd_to_bus(hcd);
>>>  		/* FIXME: set bus->otg_port if this is true OTG port with HNP */
>>>
>>
>> These changes look good to me. Thanks.
> 
> Thank you for the comment.
> If we change the "needs_companion" place to the otg_config,
> do we need to add a flag into the otg, instead of otg->caps?

Yes we can add a flag in struct usb_otg.

cheers,
-roger

> 
>>> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
>>> index b094352..64a7db8 100644
>>> --- a/include/linux/usb/otg.h
>>> +++ b/include/linux/usb/otg.h
>>> @@ -112,12 +112,14 @@ struct usb_otg {
>>>   * @hnp_support: Indicates if the device supports HNP.
>>>   * @srp_support: Indicates if the device supports SRP.
>>>   * @adp_support: Indicates if the device supports ADP.
>>> + * @needs_companion: Indicates if the device needs a companion controller.
>>
>> Description is not exact. How about this.
>> "Indicates if host controller needs a companion controller"
>>
>> Is hcd_needs_companion is better than just needs_companion?
> 
> I agree with you.
> 
> So, I will modify my local patch and test it tomorrow.
> 
> Best regards,
> Yoshihiro Shimoda
> 
>>
>>>   */
>>>  struct usb_otg_caps {
>>>  	u16 otg_rev;
>>>  	bool hnp_support;
>>>  	bool srp_support;
>>>  	bool adp_support;
>>> +	bool needs_companion;
>>>  };
>>>
>>>  /**
>>>
>>
>> cheers,
>> -roger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ