From: Roger Quadros <rogerq@ti.com>
To: Pawel Laszczak <pawell@cadence.com>,
"felipe.balbi@linux.intel.com" <felipe.balbi@linux.intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "peter.chen@nxp.com" <peter.chen@nxp.com>,
"nsekhar@ti.com" <nsekhar@ti.com>,
Rahul Kumar <kurahul@cadence.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] usb: cdns3: fix cdns3_core_init_role()
Date: Wed, 16 Oct 2019 12:20:49 +0300 [thread overview]
Message-ID: <715c8f74-2790-6546-66ae-c0aea53946ed@ti.com> (raw)
In-Reply-To: <BYAPR07MB470974496C7C59FDE615E5F3DD920@BYAPR07MB4709.namprd07.prod.outlook.com>
Hi Pawel,
On 16/10/2019 07:32, Pawel Laszczak wrote:
> Hi Roger
>
>>
>> At startup we should trigger the HW state machine
>> only if it is OTG mode. Otherwise we should just
>> start the respective role.
>>
>> Initialize idle role by default. If we don't do this then
>> cdns3_idle_role_stop() is not called when switching to
>> host/device role and so lane switch mechanism
>> doesn't work. This results to super-speed device not working
>> in one orientation if it was plugged before driver probe.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> ---
>> drivers/usb/cdns3/core.c | 20 +++++++++++++++++++-
>> 1 file changed, 19 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>> index 06f1e105be4e..1109dc5a4c39 100644
>> --- a/drivers/usb/cdns3/core.c
>> +++ b/drivers/usb/cdns3/core.c
>> @@ -160,10 +160,28 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
>> if (ret)
>> goto err;
>>
>> - if (cdns->dr_mode != USB_DR_MODE_OTG) {
>> + /* Initialize idle role to start with */
>> + ret = cdns3_role_start(cdns, USB_ROLE_NONE);
>> + if (ret)
>> + goto err;
>> +
>> + switch (cdns->dr_mode) {
>> + case USB_DR_MODE_UNKNOWN:
>
> One note in this place. USB_DR_MODE_UNKNOWN is not possible in this place.
> If cdns->dr_mode will be USB_DR_MODE_UNKNOWN then driver returns -EINVAL
At which place? I could not find.
> some line before after returning form cdns3_drd_update_mode and in consequence
> it jump to err label.
>
> Maybe for better readability it this condition should be treated here also as error.
>
>> + case USB_DR_MODE_OTG:
>> ret = cdns3_hw_role_switch(cdns);
>> if (ret)
>> goto err;
>> + break;
>> + case USB_DR_MODE_PERIPHERAL:
>> + ret = cdns3_role_start(cdns, USB_ROLE_DEVICE);
>> + if (ret)
>> + goto err;
>> + break;
>> + case USB_DR_MODE_HOST:
>> + ret = cdns3_role_start(cdns, USB_ROLE_HOST);
>> + if (ret)
>> + goto err;
>> + break;
>> }
>>
>> return ret;
>
> Reviewed-by: Pawel Laszczak <pawell@cadence.com>
> Tested-by: Pawel Laszczak <pawell@cadence.com>
>
> --
> Regards,
> Pawel
>
--
cheers,
-roger
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next prev parent reply other threads:[~2019-10-16 9:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 12:15 [PATCH 0/2] usb: cdns3: fixes for 5.4-rc Roger Quadros
2019-10-07 12:16 ` [PATCH 1/2] usb: cdns3: fix cdns3_core_init_role() Roger Quadros
2019-10-16 4:32 ` Pawel Laszczak
2019-10-16 9:20 ` Roger Quadros [this message]
2019-10-16 9:38 ` Pawel Laszczak
2019-10-16 9:54 ` Roger Quadros
2019-10-07 12:16 ` [PATCH 2/2] usb: cdns3: gadget: Fix full-speed mode Roger Quadros
2019-10-08 8:07 ` Peter Chen
2019-10-16 4:35 ` Pawel Laszczak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=715c8f74-2790-6546-66ae-c0aea53946ed@ti.com \
--to=rogerq@ti.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=pawell@cadence.com \
--cc=peter.chen@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox