|
16 | 16 | #include <linux/pm_runtime.h>
|
17 | 17 | #include <linux/platform_device.h>
|
18 | 18 | #include <linux/gpio/consumer.h>
|
| 19 | +#include <linux/gpio/machine.h> |
19 | 20 | #include <linux/acpi.h>
|
20 | 21 | #include <linux/delay.h>
|
21 | 22 |
|
@@ -64,6 +65,15 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = {
|
64 | 65 | { },
|
65 | 66 | };
|
66 | 67 |
|
| 68 | +static struct gpiod_lookup_table platform_bytcr_gpios = { |
| 69 | + .dev_id = "0000:00:16.0", |
| 70 | + .table = { |
| 71 | + GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH), |
| 72 | + GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH), |
| 73 | + {} |
| 74 | + }, |
| 75 | +}; |
| 76 | + |
67 | 77 | static int dwc3_pci_quirks(struct dwc3_pci *dwc)
|
68 | 78 | {
|
69 | 79 | struct platform_device *dwc3 = dwc->dwc3;
|
@@ -124,6 +134,13 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
|
124 | 134 | if (ret)
|
125 | 135 | dev_dbg(&pdev->dev, "failed to add mapping table\n");
|
126 | 136 |
|
| 137 | + /* |
| 138 | + * A lot of BYT devices lack ACPI resource entries for |
| 139 | + * the GPIOs, add a fallback mapping to the reference |
| 140 | + * design GPIOs which all boards seem to use. |
| 141 | + */ |
| 142 | + gpiod_add_lookup_table(&platform_bytcr_gpios); |
| 143 | + |
127 | 144 | /*
|
128 | 145 | * These GPIOs will turn on the USB2 PHY. Note that we have to
|
129 | 146 | * put the gpio descriptors again here because the phy driver
|
@@ -239,6 +256,7 @@ static void dwc3_pci_remove(struct pci_dev *pci)
|
239 | 256 | {
|
240 | 257 | struct dwc3_pci *dwc = pci_get_drvdata(pci);
|
241 | 258 |
|
| 259 | + gpiod_remove_lookup_table(&platform_bytcr_gpios); |
242 | 260 | #ifdef CONFIG_PM
|
243 | 261 | cancel_work_sync(&dwc->wakeup_work);
|
244 | 262 | #endif
|
|
0 commit comments