3

I have built a kernel for Raspberry Pi 2 using the latest upstream kernel (version 4.15-rc5): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/

I configured it with multi_v7_defconfig and added only a very few changes to the default .config to support the touchscreen panel (CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m, CONFIG_DRM_VC4=m, CONFIG_I2C_GPIO=m)

If anyone wants to see my kernel config, it's here: https://pastebin.com/mg0KPTxN

I also installed the DTB files and modules associated with the kernel build. I know these are at least working because I have the 7" display working (which was the whole purpose of the exercise).

However, booting this kernel gives no USB support. Many USB drivers are loaded, but nothing works. There's no USB-related output (other than the messages about drivers loading) and lsusb -v returns nothing.

I verified that CONFIG_USB_DWC2=y and CONFIG_USB_DWC2_HOST=y (DWC2_HOST was originally DWC2_DUAL_ROLE, it doesn't matter).

Supposedly USB has been supported out of the box since 2014, so I am surprised to have this problem.

Then I mix-and-matched some parts just to see what would happen, trying my kernel with RPi's device tree and their kernel with my device tree. Neither has working USB - so it only works with the RPi kernel and RPi device tree.

Now, this might be because they use a different USB driver than in the upstream kernel - but it might also mean that the device tree that comes with the kernel is wrong.

So I dug around a little and all I could find was this: https://lists.denx.de/pipermail/u-boot/2013-November/167836.html Supposedly the firmware doesn't turn the USB on at boot time. However, that was four years ago. Since then, many things have changed, including booting from USB, and notes in other pages that it now supposedly just works.

In any event, I don't want to use U-boot. I noticed that the U-boot code was just calling the VC mailbox interface, so I looked at just trying to call it with the vcmailbox utility. Unfortunately, I didn't have the required /dev/vcio device file, nor any other promising-looking devices (tried making it myself with mknod, but no reason to expect that to work, and it didn't). I have verified that CONFIG_BCM2835_MBOX=y and I found a dmesg line: "bcm2835-mbox 3f00b880.mailbox: mailbox enabled" so it seems to be working, just the device file is different.

So, two unresolved problems: 1) VC mailbox is hiding, and 2) No USB. Obviously, #2 is more important, but #1 might be the key to getting #2 working.

If anyone has any ideas, that would be great! Thanks.

fluffysheap
  • 131
  • 1
  • I'm on the path now - upstream kernel with rpi devicetree and dwc2 overlay enables USB, so I will try to adapt the overlay for the upstream device tree. – fluffysheap Dec 30 '17 at 10:37

1 Answers1

0

I have not compiled a kernel in a while (and I never used the vanilla tree, but always the official Raspberry Pi source), so this information is not particularly up to date, but one thing to do with USB noted there is USB_DWCOTG.

"DWC" stands for DesignWare Core, which is vendor specific (Synopsys), so it could be this is selected anyway by DWC2_HOST, or these could be distinct products. You may know better than me since I know zilch about this -- I probably copied it from the default config as I thought the USB controller was the LAN9512 hub, made by Microchip, but a bit of searching around implies to me the former is part of the SoC and made by Synopsys.

If they are different, as a casual guess, it could be that the Pi actually uses an OTG hub in host mode -- pretty sure I've read this is the case but in pis other than the zero it is not wired to support slave. This would make the controller a different piece of equipment than a standard host contoller (DWC2_HOST). But again I know nothing about the stuff and am just hypothesizing.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • Yes, the DWCOTG driver used by the Pi foundation kernel is the "different driver" I referred to. RPF kernel uses it because it has better performance, but it's not in the official Linux tree. I haven't tried it yet largely because it seems like much more work,since source would have to be patched and I don't have a patch list incorporating all the elements of it. Even RPF kernels use the upstream driver for device mode on pi zero / A+, so it must work somehow. – fluffysheap Dec 29 '17 at 23:34