Skip to contentSkip to conversation

usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources

PATCH New Felipe Balbi 1 participant 1 message Jul 26, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources

Quoted 34 lines · Hans de Goede

Hi,

Quoted 22 lines · Hans de Goede

Bay Trail / BYT SoCs do not have a builtin device-mode phy, instead they require an external ULPI phy for device-mode.

Only some BYT devices have an external phy, but even on those devices device-mode is not working because the dwc3 does not see the phy.

The problem is that the ACPI fwnode for the dwc3 does not contain the expected GPIO resources for the GPIOs connected to the chip-select and reset pins of the phy.

I've found the workaround which some Android x86 kernels use for this:
https://github.com/BORETS24/Kernel-for-Asus-Zenfone-2/blob/master/arch/x86/platform/intel-mid/device_libs/pci/platform_usb_otg.c
Which boils down to hardcoding the GPIOs for these devices.

The good news it that all boards (*) use the same GPIOs.

This commit fixes the ULPI phy not woring by adding a gpiod_lookup_table call which adds a hardcoded mapping for BYT devices. Note that the mapping added by gpiod_add_lookup_table is a fallback mapping, so boards which properly provide GPIO resources in the ACPI firmware-node resources will not use this.

Quoted 8 lines

*) Except for the first revision of the evalulation-kit, which normal users don't have

---
Changes in v3:
-Add the mapping with gpiod_add_lookup_table() unconditionally on BYT
devices, as they are only used after checking for GPIO resources in ACPI

Quoted 3 lines

Ping? AFAIK this series is ready for merging now and it is necessary to make gadget mode work on all Bay Trail devices which support gadget mode.

now queued for v4.19