1 1
Igor

Default overlays

Recommended Posts

In general IMO we should introduce such a DEFAULT_OVERLAYS setting to address the mismatch between what the kernel folks want and what users expect (the device working the way it's supposed to do).

 

With NanoPi Duo for now we can do it either way since currently the submitted DT patches won't be accepted upstream anyway (since upstream policy will forbid including sun8i-h3-nanopi.dtsi where usb3 is active by default. Haha, nice mess created since not even board makers care about kernel developer's conventions). So to prepare for upstream NanoPi Duo support I would suggest introducing the variable and setting it already to

DEFAULT_OVERLAYS="usbhost2 usbhost3"

 

Share this post


Link to post
Share on other sites

Where else do we need by default?

- analogue-audio ?

- usbhost0 everywhere for g_serial or only for Neoair, Neo2, Zero2, ... usbhost2 for enabling USB on a header on Opi Zero2

 

Share this post


Link to post
Share on other sites
11 minutes ago, Igor said:

Where else do we need by default?

IMO we don't need anything and DEFAULT_OVERLAYS should be more an exception than a rule. We should improve documentation, download pages and/or MOTD messages to point users to the right direction regarding optional peripherals. Only if those changes prove to be inefficient we should move to loading more overlays by default.

And OTG port should be already activated in all DTs by default, but in the "otg" mode it needs loading a gadget module to work (even to use it as a host).

Share this post


Link to post
Share on other sites
2 hours ago, zador.blood.stained said:

IMO we don't need anything and DEFAULT_OVERLAYS should be more an exception than a rule.

 

I agree but would make the 'USB data lines on pin headers' the first accepted exception. Any objections against adding

DEFAULT_OVERLAYS="usbhost1 usbhost2"

to nanopiair.conf, nanopineo.conf, nanopineo2.conf and nanopineoplus2.wip and

DEFAULT_OVERLAYS="usbhost2 usbhost3"

to nanopiduo.conf, orangepizero.conf, orangepizeroplus2-h3.conf and orangepizeroplus2-h5.conf (I would add usbhost3 already to NanoPi Duo config since once the board will land upstream and we remove our deprecated patches commited yesterday usb3 needs to be added anyway and so there's less chance that we accidentally forget this switch later).

2 hours ago, zador.blood.stained said:

And OTG port should be already activated in all DTs by default, but in the "otg" mode it needs loading a gadget module to work (even to use it as a host).

So we don't need to add usbhost0 but need to point out that in default mode usb0 needs something else to appear (or just to work -- sorry, I really lost track wrt everything USB related and mainline kernel in the meantime). When g_serial is in /etc/modules the port will work in OTG mode? But how to let it work in (real) host mode?

 

And on a related note: With NanoPi NEO Plus 2 AFAIK usb0 is routed to another type A receptacle. In this case the best configuration would be to configure the port directly as real host port using the dedicated ehci/ohci controller pair and not otg/musb?

Share this post


Link to post
Share on other sites
2 minutes ago, tkaiser said:

I agree but would make the 'USB data lines on pin headers' the first accepted exception.

Agree with this in case vendor provides compatible expansion boards that use additional USB ports.

 

4 minutes ago, tkaiser said:

When g_serial is in /etc/modules the port will work in OTG mode? But how to let it work in (real) host mode?

When dr_mode = "otg" port mode is defined by miniUSB or microUSB ID detection pin. When you plug in a USB OTG cable the ID pin will be pulled to ground and port will switch to the host mode.

But you need to load a gadget module first (or make use of configfs gadget) in order to make the MUSB stack read the ID pin.

Share this post


Link to post
Share on other sites
15 minutes ago, tkaiser said:

 

And on a related note: With NanoPi NEO Plus 2 AFAIK usb0 is routed to another type A receptacle. In this case the best configuration would be to configure the port directly as real host port using the dedicated ehci/ohci controller pair and not otg/musb?

In this case it should be configured as dr_mode = "host", similar to Pine64. And it should work without loading gadget modules.

Share this post


Link to post
Share on other sites
22 minutes ago, zador.blood.stained said:

Agree with this in case vendor provides compatible expansion boards that use additional USB ports.

 

Which is the case for all those boards currently available and announced (NanoPi Core/Core2) :)

 

33 minutes ago, zador.blood.stained said:

When dr_mode = "otg" port mode is defined by miniUSB or microUSB ID detection pin. When you plug in a USB OTG cable the ID pin will be pulled to ground and port will switch to the host mode.

 

Why host mode? I think I still don't understand... let's try it the other way around. What to do if I want 'legacy behaviour' back? With 3.4 kernel on all H3 boards the Micro USB is set to host mode by default (on bananapim2plus and orangepiplus by accident fixed [1] on all other devices it's OTG/host configurable defaulting to host mode unless /sys/bus/platform/devices/sunxi_usb_udc/otg_role has been touched).

 

What to do with mainline kernel to attach an USB disk or any other 'normal' USB peripheral to the Micro USB port to have it working in real host mode (with legacy kernel and our default settings that's as easy as using an adapter cable and works out of the box). IMO that would be the desirable setting especially on boards like NanoPi Duo or Zero Plus 2 where without expansion boards only Micro USB is available to attach USB peripherals.

 

[1] default settings wrt usb0 and legacy kernel:

bananapim2plus.fex:usb_port_type       = 1
bananapim2plus.fex-usb_detect_type     = 0
--
beelinkx2.fex:usb_port_type       = 2
beelinkx2.fex-usb_detect_type     = 0
--
nanopiair.fex:usb_port_type = 2
nanopiair.fex-usb_detect_type = 0
--
nanopim1.fex:usb_port_type = 2
nanopim1.fex-usb_detect_type = 0
--
nanopim1plus.fex:usb_port_type = 2
nanopim1plus.fex-usb_detect_type = 0
--
nanopineo.fex:usb_port_type = 2
nanopineo.fex-usb_detect_type = 0
--
orangepi2.fex:usb_port_type       = 2
orangepi2.fex-usb_detect_type     = 0
--
orangepilite.fex:usb_port_type = 2
orangepilite.fex-usb_detect_type = 0
--
orangepione.fex:usb_port_type = 2
orangepione.fex-usb_detect_type = 0
--
orangepipc.fex:usb_port_type = 2
orangepipc.fex-usb_detect_type = 0
--
orangepipcplus.fex:usb_port_type = 2
orangepipcplus.fex-usb_detect_type = 0
--
orangepiplus.fex:usb_port_type       = 1
orangepiplus.fex-usb_detect_type     = 0
--
orangepiplus2e.fex:usb_port_type = 2
orangepiplus2e.fex-usb_detect_type = 0
--
orangepizero.fex:usb_port_type = 2
orangepizero.fex-usb_detect_type = 0
--
orangepizeroplus2-h3.fex:usb_port_type = 2
orangepizeroplus2-h3.fex-usb_detect_type = 0
--
sunvell-r69.fex:usb_port_type = 1
sunvell-r69.fex-usb_detect_type = 0

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
1 1