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

From: Andy Shevchenko <hidden>
Date: 2018-06-07 13:28:13

On Thu, Jun 7, 2018 at 1:38 PM, Hans de Goede [off-list ref] wrote:
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.

This commit adds a gpiod_lookup_table adding the mappings from Android,
and installs this table on BYT system with their BIOS vendor DMI string
set to "INSYDE Corp.". This seems to indicate that a (mostly) unmodified
version of the reference design BIOS is used. 3 out of the 20 BYT tablets
which I have for testing have an external ULPI phy and all 3 models use
this vendor string.
quoted hunk
+                       vendor = dmi_get_system_info(DMI_BIOS_VENDOR);
+                       if (vendor && strcmp(vendor, "INSYDE Corp.") == 0) {
+                               gpiod_add_lookup_table(&platform_bytcr_gpios);
+                               dwc->gpio_mapping_added = true;
+                       }
I understand that my proposal might sound a bit overkill, though, I
would rather go with normal dmi tables and call back there.

P.S. Though, I would be okay with this as long as Felipe fine.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help