All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Quentin Schulz <foss+kernel@0leil.net>
Cc: Minas Harutyunyan <hminas@synopsys.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	William Wu <william.wu@rock-chips.com>,
	Bin Yang <yangbin@rock-chips.com>,
	Frank Wang <frank.wang@rock-chips.com>
Subject: Re: [PATCH 3/3] usb: dwc2: prevent core phy initialisation
Date: Fri, 9 Dec 2022 12:15:34 +0100	[thread overview]
Message-ID: <69c0f9c0-5c89-e99e-c807-9963ca377093@theobroma-systems.com> (raw)
In-Reply-To: <Y5IIaeip81DIvEZ6@kroah.com>

Hi Greg,

On 12/8/22 16:53, Greg Kroah-Hartman wrote:
> On Wed, Dec 07, 2022 at 02:19:18PM +0100, Quentin Schulz wrote:
>> From: Bin Yang <yangbin@rock-chips.com>
>>
>> The usb phys need to be controlled dynamically on some Rockchip SoCs.
>> So set the new HCD flag which prevents USB core from trying to manage
>> our phys.
>>
>> Signed-off-by: Bin Yang <yangbin@rock-chips.com>
>> Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
>> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>> ---
>>   drivers/usb/dwc2/hcd.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
>> index 657f1f659ffaf..757a66fa32fa8 100644
>> --- a/drivers/usb/dwc2/hcd.c
>> +++ b/drivers/usb/dwc2/hcd.c
>> @@ -5315,6 +5315,13 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
>>   	if (!IS_ERR_OR_NULL(hsotg->uphy))
>>   		otg_set_host(hsotg->uphy->otg, &hcd->self);
>>   
>> +	/*
>> +	 * do not manage the PHY state in the HCD core, instead let the driver
>> +	 * handle this (for example if the PHY can only be turned on after a
>> +	 * specific event)
>> +	 */
>> +	hcd->skip_phy_initialization = 1;
> 
> Wait, doesn't this mess with the phy logic for all other chips that use
> this IP block?  Have you tested this on other systems?
> 

I have not. I asked this in the cover-letter but I guess I should have 
made the patch series an RFC for this reason?

> I'd like some verification first before taking this change as it seems
> very specific-platform.
> 

There's already some platform-specific callbacks for the driver (see
dwc2_set_rk_params in drivers/usb/dwc2/params.c) but this gets called 
too early, before hcd structure is actually allocated. So we either need 
to use some "proxy"/shadow variable in dwc2_core_params and then update 
it right after hcd gets allocated or have another platform-specific 
callback only for hcd (post-)initialization.

Nothing too fancy so shouldn't take too long to implement. Any 
preference? Something else?

Also on a side note, after further testing, USB peripheral mode in 
dual-role mode does not seem to be entirely fixed with this patch 
series, I still have occasional locks. But considering that it 
absolutely didn't work before, it is some kind of progress.
There are also some issues related to USB host mode in dual-role mode 
but I saw those happening before the patch series too. I'll see what I 
can do, really frustrating to work with IPs for which there's no 
documentation :/

Cheers,
Quentin

  reply	other threads:[~2022-12-09 11:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 13:19 [PATCH 0/3] usb: dwc2: fix USB peripheral role in dual-role mode on PX30 Quentin Schulz
2022-12-07 13:19 ` [PATCH 1/3] usb: dwc2: disable lpm feature on Rockchip SoCs Quentin Schulz
2022-12-07 13:19 ` [PATCH 2/3] usb: dwc2: power on/off phy for peripheral mode in dual-role mode Quentin Schulz
2022-12-07 13:19 ` [PATCH 3/3] usb: dwc2: prevent core phy initialisation Quentin Schulz
2022-12-08 15:30   ` Greg Kroah-Hartman
2022-12-08 15:53   ` Greg Kroah-Hartman
2022-12-09 11:15     ` Quentin Schulz [this message]
2022-12-09 12:13       ` Greg Kroah-Hartman
2022-12-09 12:38         ` Quentin Schulz

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=69c0f9c0-5c89-e99e-c807-9963ca377093@theobroma-systems.com \
    --to=quentin.schulz@theobroma-systems.com \
    --cc=foss+kernel@0leil.net \
    --cc=frank.wang@rock-chips.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hminas@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=william.wu@rock-chips.com \
    --cc=yangbin@rock-chips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.