Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* USB_DWC3_OF_SIMPLE
@ 2020-01-08 16:19 Jonathan Thibault
  2020-01-09  9:02 ` USB_DWC3_OF_SIMPLE Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Thibault @ 2020-01-08 16:19 UTC (permalink / raw)
  To: linux-usb

Greetings,

I am currently trying to port OpenWRT to Ubiquiti's EdgeRouter 4 which 
is a Cavium Octeon 7130.  While investigating to support XHCI (the 
device has a single USB3 port), I ran into the dwc3 driver which 
apparently supports that very chipset via the dwc3-of-simple glue.

Looking at Ubiquiti's own firmware, it seems they are using a modified 
version of the standard xhci-platform driver.

So now I am faced with two different approaches:

1- Attempt to replicate Ubiquiti's modifications to xhci-plat.

2- Switch to dwc3-of-simple.

With option 1, so far, I can get xhci to load by merely adding a 
'.compatible =' member to usb_xhci_of_match[], but the driver complains 
about LPM algorithms and disables LPM (which may be fine, I don't know 
if it is even supported on this device).

Option 2 (where you might hopefully help), potentially involves more 
modification to the OpenWRT since their Octeon kernel config does not 
appear to enable CONFIG_COMMON_CLK, which the driver depends on.  And I 
do not know if I should also disable standard ohci and ehci drivers once 
I manage to enable the USB_DWC3_OF_SIMPLE.

I'm looking for recommendations on the best approach.  Keep in mind that 
while I can cobble together some ugly but functional hacks, I am not an 
experienced kernel dev.

-- 
Jonathan Thibault
Analyste/Administrateur Réseau
Navigue
97, route 132, Saint-Godefroi (Québec) G0C 3C0
581-357-2015
jonathan@navigue.com
www.navigue.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: USB_DWC3_OF_SIMPLE
  2020-01-08 16:19 USB_DWC3_OF_SIMPLE Jonathan Thibault
@ 2020-01-09  9:02 ` Felipe Balbi
  2020-01-09 15:27   ` USB_DWC3_OF_SIMPLE Jonathan Thibault
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2020-01-09  9:02 UTC (permalink / raw)
  To: Jonathan Thibault, linux-usb

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]


Hi,

Jonathan Thibault <jonathan@navigue.com> writes:

> Greetings,
>
> I am currently trying to port OpenWRT to Ubiquiti's EdgeRouter 4 which 
> is a Cavium Octeon 7130.  While investigating to support XHCI (the 
> device has a single USB3 port), I ran into the dwc3 driver which 
> apparently supports that very chipset via the dwc3-of-simple glue.
>
> Looking at Ubiquiti's own firmware, it seems they are using a modified 
> version of the standard xhci-platform driver.
>
> So now I am faced with two different approaches:
>
> 1- Attempt to replicate Ubiquiti's modifications to xhci-plat.
>
> 2- Switch to dwc3-of-simple.
>
> With option 1, so far, I can get xhci to load by merely adding a 
> '.compatible =' member to usb_xhci_of_match[], but the driver complains 
> about LPM algorithms and disables LPM (which may be fine, I don't know 
> if it is even supported on this device).
>
> Option 2 (where you might hopefully help), potentially involves more 
> modification to the OpenWRT since their Octeon kernel config does not 
> appear to enable CONFIG_COMMON_CLK, which the driver depends on.  And I 
> do not know if I should also disable standard ohci and ehci drivers once 
> I manage to enable the USB_DWC3_OF_SIMPLE.
>
> I'm looking for recommendations on the best approach.  Keep in mind that 
> while I can cobble together some ugly but functional hacks, I am not an 
> experienced kernel dev.

Just switch to dwc3-of-simple, it already supports the SoC you're
dealing with. Try removing the dependency on CONFIG_COMMON_CLK. I think
we already get empty stubs when common clk is disabled.

If that works for you, that's an easy patch.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: USB_DWC3_OF_SIMPLE
  2020-01-09  9:02 ` USB_DWC3_OF_SIMPLE Felipe Balbi
@ 2020-01-09 15:27   ` Jonathan Thibault
  2020-01-15  8:56     ` USB_DWC3_OF_SIMPLE Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Thibault @ 2020-01-09 15:27 UTC (permalink / raw)
  To: Felipe Balbi, linux-usb

Thanks for the quick reply.

On 2020-01-09 4:02 a.m., Felipe Balbi wrote:
> Hi,
>
> Jonathan Thibault <jonathan@navigue.com> writes:
>
>> Greetings,
>>
>> I am currently trying to port OpenWRT to Ubiquiti's EdgeRouter 4 which
>> is a Cavium Octeon 7130.  While investigating to support XHCI (the
>> device has a single USB3 port), I ran into the dwc3 driver which
>> apparently supports that very chipset via the dwc3-of-simple glue.
>>
>> Looking at Ubiquiti's own firmware, it seems they are using a modified
>> version of the standard xhci-platform driver.
>>
>> So now I am faced with two different approaches:
>>
>> 1- Attempt to replicate Ubiquiti's modifications to xhci-plat.
>>
>> 2- Switch to dwc3-of-simple.
>>
>> With option 1, so far, I can get xhci to load by merely adding a
>> '.compatible =' member to usb_xhci_of_match[], but the driver complains
>> about LPM algorithms and disables LPM (which may be fine, I don't know
>> if it is even supported on this device).
>>
>> Option 2 (where you might hopefully help), potentially involves more
>> modification to the OpenWRT since their Octeon kernel config does not
>> appear to enable CONFIG_COMMON_CLK, which the driver depends on.  And I
>> do not know if I should also disable standard ohci and ehci drivers once
>> I manage to enable the USB_DWC3_OF_SIMPLE.
>>
>> I'm looking for recommendations on the best approach.  Keep in mind that
>> while I can cobble together some ugly but functional hacks, I am not an
>> experienced kernel dev.
> Just switch to dwc3-of-simple, it already supports the SoC you're
> dealing with. Try removing the dependency on CONFIG_COMMON_CLK. I think
> we already get empty stubs when common clk is disabled.
>
> If that works for you, that's an easy patch.
>

Sadly, while it does build without the COMMON_CLK dependency, probing fails:

[    4.881646] dwc3 1680000000000.xhci: Configuration mismatch. dr_mode 
forced to host
[    4.889574] dwc3 1690000000000.xhci: Configuration mismatch. dr_mode 
forced to host
[    4.897546] dwc3-of-simple: probe of 1180068000000.uctl failed with 
error -12
[    4.904715] dwc3-of-simple: probe of 1180069000000.uctl failed with 
error -12

The return value suggests that it's from the if(!simple->clks) check in 
dwc3_of_simple_clk_init().

The configuration mismatch warning is a bit of a mystery to me as well 
since the only mode available in kernel config is USB_DWC3_HOST and what 
I selected.  Would this be because the controller itself is reporting 
another configuration?

-- 
Jonathan Thibault
Analyste/Administrateur Réseau
Navigue
97, route 132, Saint-Godefroi (Québec) G0C 3C0
581-357-2015
jonathan@navigue.com
www.navigue.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: USB_DWC3_OF_SIMPLE
  2020-01-09 15:27   ` USB_DWC3_OF_SIMPLE Jonathan Thibault
@ 2020-01-15  8:56     ` Felipe Balbi
  0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2020-01-15  8:56 UTC (permalink / raw)
  To: Jonathan Thibault, linux-usb

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]


Hi,

Jonathan Thibault <jonathan@navigue.com> writes:
>>> I am currently trying to port OpenWRT to Ubiquiti's EdgeRouter 4 which
>>> is a Cavium Octeon 7130.  While investigating to support XHCI (the
>>> device has a single USB3 port), I ran into the dwc3 driver which
>>> apparently supports that very chipset via the dwc3-of-simple glue.
>>>
>>> Looking at Ubiquiti's own firmware, it seems they are using a modified
>>> version of the standard xhci-platform driver.
>>>
>>> So now I am faced with two different approaches:
>>>
>>> 1- Attempt to replicate Ubiquiti's modifications to xhci-plat.
>>>
>>> 2- Switch to dwc3-of-simple.
>>>
>>> With option 1, so far, I can get xhci to load by merely adding a
>>> '.compatible =' member to usb_xhci_of_match[], but the driver complains
>>> about LPM algorithms and disables LPM (which may be fine, I don't know
>>> if it is even supported on this device).
>>>
>>> Option 2 (where you might hopefully help), potentially involves more
>>> modification to the OpenWRT since their Octeon kernel config does not
>>> appear to enable CONFIG_COMMON_CLK, which the driver depends on.  And I
>>> do not know if I should also disable standard ohci and ehci drivers once
>>> I manage to enable the USB_DWC3_OF_SIMPLE.
>>>
>>> I'm looking for recommendations on the best approach.  Keep in mind that
>>> while I can cobble together some ugly but functional hacks, I am not an
>>> experienced kernel dev.
>> Just switch to dwc3-of-simple, it already supports the SoC you're
>> dealing with. Try removing the dependency on CONFIG_COMMON_CLK. I think
>> we already get empty stubs when common clk is disabled.
>>
>> If that works for you, that's an easy patch.
>>
>
> Sadly, while it does build without the COMMON_CLK dependency, probing fails:
>
> [    4.881646] dwc3 1680000000000.xhci: Configuration mismatch. dr_mode 
> forced to host
> [    4.889574] dwc3 1690000000000.xhci: Configuration mismatch. dr_mode 
> forced to host
> [    4.897546] dwc3-of-simple: probe of 1180068000000.uctl failed with 
> error -12
> [    4.904715] dwc3-of-simple: probe of 1180069000000.uctl failed with 
> error -12
>
> The return value suggests that it's from the if(!simple->clks) check in 
> dwc3_of_simple_clk_init().

Add a check for your platform and ignore clocks altogether.

if (of_platform_is_compatible(....)) {
	ignore_clocks = true;

> The configuration mismatch warning is a bit of a mystery to me as well 
> since the only mode available in kernel config is USB_DWC3_HOST and what 
> I selected.  Would this be because the controller itself is reporting 
> another configuration?

What do you have in your Device Tree?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 16:19 USB_DWC3_OF_SIMPLE Jonathan Thibault
2020-01-09  9:02 ` USB_DWC3_OF_SIMPLE Felipe Balbi
2020-01-09 15:27   ` USB_DWC3_OF_SIMPLE Jonathan Thibault
2020-01-15  8:56     ` USB_DWC3_OF_SIMPLE Felipe Balbi

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git