Skip to content

Commit 7b3cd7d

Browse files
committed
probe: Add USB support for RPI4
Need some special handling for RPI, since RPI does not present a phandle for the USB in sysfs (PCI device)
1 parent 67817a1 commit 7b3cd7d

File tree

1 file changed

+37
-1
lines changed
  • board/common/rootfs/usr/libexec/infix/init.d

1 file changed

+37
-1
lines changed

board/common/rootfs/usr/libexec/infix/init.d/00-probe

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,52 @@ def probe_qemusystem(out):
308308
subprocess.run("initctl -nbq cond set qemu".split(), check=False)
309309
return 0
310310

311+
def rasberry_pi_4_usb_ports(out):
312+
out["usb-ports"] = [
313+
{
314+
"name": "USB",
315+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/authorized"
316+
},
317+
{
318+
"name": "USB",
319+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/authorized_default"
320+
},
321+
{
322+
"name": "USB",
323+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/authorized",
324+
},
325+
{
326+
"name": "USB",
327+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-0:1.0/authorized"
328+
},
329+
{
330+
"name": "USB",
331+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/authorized"
332+
},
333+
{
334+
"name": "USB",
335+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/authorized_default"
336+
},
337+
{
338+
"name": "USB3",
339+
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-0:1.0/authorized"
340+
}
341+
]
311342

312343
def probe_dtsystem(out):
313344
"""Probe DTS based system, expects a VPD in ONIE PROM format."""
314345
dtsys = DTSystem()
315346
vpds = dtsys.infix_vpds()
316-
dtsys.infix_usb_devices(out)
347+
317348
model = dtsys.base.str("model")
318349
if model:
319350
out["product-name"] = model
320351

352+
# Since rpi4 has USB on PCIe, there is no phandle reference
353+
if model and model.startswith("Raspberry Pi 4"):
354+
rasberry_pi_4_usb_ports(out)
355+
else:
356+
dtsys.infix_usb_devices(out)
321357
out["compatible"] = dtsys.base.str_array("compatible")
322358

323359
staticpw = dtsys.infix.str("factory-password-hash")

0 commit comments

Comments
 (0)