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:   Fri, 25 Oct 2019 12:59:17 +0300
From:   Roger Quadros <rogerq@...com>
To:     Peter Chen <peter.chen@....com>,
        Pawel Laszczak <pawell@...ence.com>
CC:     "felipe.balbi@...ux.intel.com" <felipe.balbi@...ux.intel.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "nsekhar@...com" <nsekhar@...com>,
        Rahul Kumar <kurahul@...ence.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: cdns3: gadget: Don't manage pullups

Peter,

On 25/10/2019 06:13, Peter Chen wrote:
> On 19-10-23 09:17:45, Pawel Laszczak wrote:
>> Hi,
>>
>> Reviewed-by: Pawel Laszczak <pawell@...ence.com>
> 
> Hi Roger & Pawel,
> 
> Assume gadget function has already enabled, if you switch host mode
> to device mode, with your changes, where the device mode will be enabled
> again?

When it switches from device mode to host the UDC is removed. When we switch
back from host to device mode the UDC is added, so,

usb_add_gadget_udc_release()-> check_pending_gadget_drivers()->
udc_bind_to_driver()->usb_udc_connect_control()->usb_gadget_connect()->
gadget->ops->pullup()

cheers,
-roger
> 
> Peter
>>
>> Regards,
>> Pawel,
>>
>>> The USB gadget core is supposed to manage pullups
>>> of the controller. Don't manage pullups from within
>>> the controller driver. Otherwise, function drivers
>>> are not able to keep the controller disconnected from
>>> the bus till they are ready. (e.g. g_webcam)
>>>
>>> Signed-off-by: Roger Quadros <rogerq@...com>
>>> ---
>>> Hi Greg/Felipe,
>>>
>>> This can be used for -rc as it is a bug fix.
>>>
>>> cheers,
>>> -roger
>>>
>>> drivers/usb/cdns3/gadget.c | 4 ----
>>> 1 file changed, 4 deletions(-)
>>>
>>> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
>>> index 2ca280f4c054..714382d96055 100644
>>> --- a/drivers/usb/cdns3/gadget.c
>>> +++ b/drivers/usb/cdns3/gadget.c
>>> @@ -2324,8 +2324,6 @@ static void cdns3_gadget_config(struct cdns3_device *priv_dev)
>>> 	writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, &regs->usb_conf);
>>>
>>> 	cdns3_configure_dmult(priv_dev, NULL);
>>> -
>>> -	cdns3_gadget_pullup(&priv_dev->gadget, 1);
>>> }
>>>
>>> /**
>>> @@ -2708,8 +2706,6 @@ static int cdns3_gadget_suspend(struct cdns3 *cdns, bool do_wakeup)
>>> 	/* disable interrupt for device */
>>> 	writel(0, &priv_dev->regs->usb_ien);
>>>
>>> -	cdns3_gadget_pullup(&priv_dev->gadget, 0);
>>> -
>>> 	return 0;
>>> }
>>>
>>> --
>>> 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