mbox series

[v6,0/5] usb: host: dwc2: use driver model for PHY and CLOCK

Message ID 20200310100912.28129-1-patrick.delaunay@st.com
Headers show
Series usb: host: dwc2: use driver model for PHY and CLOCK | expand

Message

Patrick Delaunay March 10, 2020, 10:09 a.m. UTC
In this serie I update the DWC2 host driver to use the device tree
information and the associated PHY and CLOCK drivers when they are
availables.

V6 is minor update of the first patch of the serie;
I update some clk stub to return success after Simon Goldschmidt
remarks on V5:
http://patchwork.ozlabs.org/project/uboot/list/?series=162791

I test the V4 of this serie on stm32mp157c-ev1 board, with PHY and CLK
support (V5 was a minor update).

The U-CLASS are provided by:
- PHY by USBPHYC driver = ./drivers/phy/phy-stm32-usbphyc.c
- CLOCK by RCC clock driver = drivers/clk/clk_stm32mp1.c
- RESET by RCC reset driver = drivers/reset/stm32-reset.c

And I activate the configuration
+CONFIG_USB_DWC2=y

PS: it is not the default configuration to avoid conflict with gadget
    driver

To solve a binding issue, I also deactivate the gadget support:
by default only one driver is bound to the usbotg_hs node with "snps,dwc2"
compatible, and today it is the device one (the first in the driver list).

I also need to deactivate hnp-srp support with:

&usbotg_hs {
	/* need to disable ONLY for HOST support */
	hnp-srp-disable;
};

WARNING: OTG with device or host support is not correctly handle by DWC2
         driver (see example for dynamic OTG role in DWC3 driver).

The tests executed on the stm32mp157c-ev1 target:

STM32MP> usb start
starting USB...
Bus usb-otg at 49000000: USB DWC2
Bus usbh-ehci at 5800d000: USB EHCI 1.00
scanning bus usb-otg at 49000000 for devices... 2 USB Device(s) found
scanning bus usbh-ehci at 5800d000 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
STM32MP> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
  |   U-Boot Root Hub
  |
  +-2  Mass Storage (480 Mb/s, 300mA)
       Verbatim STORE N GO 070731C8ACD7EE97

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 2mA)

STM32MP> ls usb 0
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 record
         1490212 xipImage
        21058006 vmlinux

STM32MP> load usb 0 0xC0000000 vmlinux
21058006 bytes read in 10851 ms (1.9 MiB/s)


Changes in v6:
- return success in stub for clk_free/clk_enable/clk_disable/
  clk_enable_bulk/clk_disable_bulk

Changes in v5:
- use ERR_PTR in clk_get_parent()
- force bulk->count = 0 in clk_get_bulk to avoid issue
  for next call of clk_enable_bulk / clk_enable_bulk
- update commit message
- inverse logic for -ENOENT test on generic_phy_get_by_index result
- Add some comments

Changes in v4:
- Add stub for all functions using 'struct clk' or 'struct clk_bulk'
  after remarks on v3

Changes in v3:
- Add stub for clk_disable_bulk

Changes in v2:
- update dev_err
- update commit message
- change dev_err to dev_dbg for PHY function call
- treat dwc2_shutdown_phy error
- add clk_disable_bulk in dwc2_usb_remove

Patrick Delaunay (5):
  dm: clk: add stub when CONFIG_CLK is deactivated
  usb: host: dwc2: add phy support
  usb: host: dwc2: add clk support
  usb: host: dwc2: force reset assert
  usb: host: dwc2: add trace to have clean usb start

 drivers/usb/host/dwc2.c | 100 ++++++++++++++++++++++++++++++++++++++-
 include/clk.h           | 102 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 188 insertions(+), 14 deletions(-)

Comments

Marek Vasut March 10, 2020, 3:20 p.m. UTC | #1
On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> 
> In this serie I update the DWC2 host driver to use the device tree
> information and the associated PHY and CLOCK drivers when they are
> availables.
> 
> V6 is minor update of the first patch of the serie;
> I update some clk stub to return success after Simon Goldschmidt
> remarks on V5:
> http://patchwork.ozlabs.org/project/uboot/list/?series=162791

Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on
1/5, would be helpful if you could keep the CC consistent, thanks.
Patrick Delaunay March 10, 2020, 5:01 p.m. UTC | #2
Hi Marek,

> From: Marek Vasut <marex at denx.de>
> Sent: mardi 10 mars 2020 16:20
> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and
> CLOCK
> Importance: High
> 
> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> >
> > In this serie I update the DWC2 host driver to use the device tree
> > information and the associated PHY and CLOCK drivers when they are
> > availables.
> >
> > V6 is minor update of the first patch of the serie; I update some clk
> > stub to return success after Simon Goldschmidt remarks on V5:
> > http://patchwork.ozlabs.org/project/uboot/list/?series=162791
> 
> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on 1/5,
> would be helpful if you could keep the CC consistent, thanks

Ok and thanks

I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC 
    Series-cc: simon.k.r.goldschmidt at gmail.com
    Series-cc: b.galvani at gmail.com
    Series-cc: ley.foon.tan at intel.com

But I forgot you. Sorry.

Patrick
.
Marek Vasut March 10, 2020, 6:27 p.m. UTC | #3
On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
> Hi Marek,
> 
>> From: Marek Vasut <marex at denx.de>
>> Sent: mardi 10 mars 2020 16:20
>> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and
>> CLOCK
>> Importance: High
>>
>> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
>>>
>>> In this serie I update the DWC2 host driver to use the device tree
>>> information and the associated PHY and CLOCK drivers when they are
>>> availables.
>>>
>>> V6 is minor update of the first patch of the serie; I update some clk
>>> stub to return success after Simon Goldschmidt remarks on V5:
>>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
>>
>> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on 1/5,
>> would be helpful if you could keep the CC consistent, thanks
> 
> Ok and thanks
> 
> I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC 
>     Series-cc: simon.k.r.goldschmidt at gmail.com
>     Series-cc: b.galvani at gmail.com
>     Series-cc: ley.foon.tan at intel.com
> 
> But I forgot you. Sorry.

I'd expect get-maintainer script should tell you to add me, maybe patman
needs fixing.
Patrick Delaunay March 11, 2020, 12:30 p.m. UTC | #4
Hi Marek,

> From: Marek Vasut <marex at denx.de>
> Sent: mardi 10 mars 2020 19:27
> 
> On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
> > Hi Marek,
> >
> >> From: Marek Vasut <marex at denx.de>
> >> Sent: mardi 10 mars 2020 16:20
> >> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY
> >> and CLOCK
> >> Importance: High
> >>
> >> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> >>>
> >>> In this serie I update the DWC2 host driver to use the device tree
> >>> information and the associated PHY and CLOCK drivers when they are
> >>> availables.
> >>>
> >>> V6 is minor update of the first patch of the serie; I update some
> >>> clk stub to return success after Simon Goldschmidt remarks on V5:
> >>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
> >>
> >> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed
> >> on 1/5, would be helpful if you could keep the CC consistent, thanks
> >
> > Ok and thanks
> >
> > I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC
> >     Series-cc: simon.k.r.goldschmidt at gmail.com
> >     Series-cc: b.galvani at gmail.com
> >     Series-cc: ley.foon.tan at intel.com
> >
> > But I forgot you. Sorry.
> 
> I'd expect get-maintainer script should tell you to add me, maybe patman needs
> fixing.

I will try to avoid this issue for my next serie...

FYI: I check and the CC list is build with (series.py::MakeCcFile)

1/ Get maitainer script

It give me for this patch

./scripts/get_maintainer.pl 0001-dm-clk-add-stub-when-CONFIG_CLK-is-deactivated.patch 
Peng Fan <peng.fan at nxp.com> (commit_signer:7/15=47%,authored:2/15=13%)
Lukasz Majewski <lukma at denx.de> (commit_signer:6/15=40%,authored:6/15=40%,added_lines:36/255=14%,removed_lines:1/17=6%)
Jean-Jacques Hiblot <jjhiblot at ti.com> (commit_signer:3/15=20%,authored:3/15=20%,added_lines:53/255=21%,removed_lines:3/17=18%)
Simon Glass <sjg at chromium.org> (commit_signer:3/15=20%)
Lokesh Vutla <lokeshvutla at ti.com> (commit_signer:1/15=7%)
Sekhar Nori <nsekhar at ti.com> (authored:1/15=7%)
Chunfeng Yun <chunfeng.yun at mediatek.com> (authored:1/15=7%,added_lines:40/255=16%)
Patrick Delaunay <patrick.delaunay at st.com> (added_lines:89/255=35%,removed_lines:13/17=76%)
Jagan Teki <jagan at amarulasolutions.com> (added_lines:15/255=6%)
u-boot at lists.denx.de (open list)

PS: same for "./scripts/get_maintainer.pl include/clk.h"

2/ tags (based on aliases of ./doc/git-mailrc)
   "dm" and "clk:"
	=> dm = sjg
	=> clk = unknown tag

   But no tag "usb" => marex

3/ Series-cc

So I don't think it is a not patman issue
and the maintainer list is build patch by patch in the serie...

I perhaps miss something in my configuration for the 'usb' serie.
 
For patman, I use 

$> git config sendemail.to uboot
$> git config sendemail.aliasesfile doc/git-mailrc
....
$> tools/patman/patman -c 5 -t -i

Perhaps I need to use the correct alias = "usb" for USB related topic....
(for all the serie and no more rely on "tags")

$> git config sendemail.to usb

In this case I have :

To: u-boot at lists.denx.de,
	Marek Vasut <marex at denx.de>
Cc: ley.foon.tan at intel.com,
	b.galvani at gmail.com,
	simon.k.r.goldschmidt at gmail.com,
	Patrick Delaunay <patrick.delaunay at st.com>,
	Chunfeng Yun <chunfeng.yun at mediatek.com>,
	Jagan Teki <jagan at amarulasolutions.com>,
	Jean-Jacques Hiblot <jjhiblot at ti.com>,
	Lukasz Majewski <lukma at denx.de>,
	Peng Fan <peng.fan at nxp.com>,
	Sekhar Nori <nsekhar at ti.com>,
	Simon Glass <sjg at chromium.org>,
	U-Boot STM32 <uboot-stm32 at st-md-mailman.stormreply.com>
Subject: [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivat

Regards

Patrick
Marek Vasut March 11, 2020, 12:42 p.m. UTC | #5
On 3/11/20 1:30 PM, Patrick DELAUNAY wrote:
> Hi Marek,

Hi,

>> From: Marek Vasut <marex at denx.de>
>> Sent: mardi 10 mars 2020 19:27
>>
>> On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
>>> Hi Marek,
>>>
>>>> From: Marek Vasut <marex at denx.de>
>>>> Sent: mardi 10 mars 2020 16:20
>>>> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY
>>>> and CLOCK
>>>> Importance: High
>>>>
>>>> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
>>>>>
>>>>> In this serie I update the DWC2 host driver to use the device tree
>>>>> information and the associated PHY and CLOCK drivers when they are
>>>>> availables.
>>>>>
>>>>> V6 is minor update of the first patch of the serie; I update some
>>>>> clk stub to return success after Simon Goldschmidt remarks on V5:
>>>>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
>>>>
>>>> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed
>>>> on 1/5, would be helpful if you could keep the CC consistent, thanks
>>>
>>> Ok and thanks
>>>
>>> I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC
>>>     Series-cc: simon.k.r.goldschmidt at gmail.com
>>>     Series-cc: b.galvani at gmail.com
>>>     Series-cc: ley.foon.tan at intel.com
>>>
>>> But I forgot you. Sorry.
>>
>> I'd expect get-maintainer script should tell you to add me, maybe patman needs
>> fixing.
> 
> I will try to avoid this issue for my next serie...
> 
> FYI: I check and the CC list is build with (series.py::MakeCcFile)
> 
> 1/ Get maitainer script
> 
> It give me for this patch
> 
> ./scripts/get_maintainer.pl 0001-dm-clk-add-stub-when-CONFIG_CLK-is-deactivated.patch 

Because it's a clock patch, I see.
[...]