|
34 | 34 | /* True if ACPI device is present */
|
35 | 35 | static bool cros_ec_lpc_acpi_device_found;
|
36 | 36 |
|
| 37 | +/* |
| 38 | + * Indicates that lpc_driver_data.quirk_mmio_memory_base should |
| 39 | + * be used as the base port for EC mapped memory. |
| 40 | + */ |
| 41 | +#define CROS_EC_LPC_QUIRK_REMAP_MEMORY BIT(0) |
| 42 | + |
| 43 | +/** |
| 44 | + * struct lpc_driver_data - driver data attached to a DMI device ID to indicate |
| 45 | + * hardware quirks. |
| 46 | + * @quirks: a bitfield composed of quirks from CROS_EC_LPC_QUIRK_* |
| 47 | + * @quirk_mmio_memory_base: The first I/O port addressing EC mapped memory (used |
| 48 | + * when quirk ...REMAP_MEMORY is set.) |
| 49 | + */ |
| 50 | +struct lpc_driver_data { |
| 51 | + u32 quirks; |
| 52 | + u16 quirk_mmio_memory_base; |
| 53 | +}; |
| 54 | + |
37 | 55 | /**
|
38 | 56 | * struct cros_ec_lpc - LPC device-specific data
|
39 | 57 | * @mmio_memory_base: The first I/O port addressing EC mapped memory.
|
@@ -363,15 +381,28 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
|
363 | 381 | acpi_status status;
|
364 | 382 | struct cros_ec_device *ec_dev;
|
365 | 383 | struct cros_ec_lpc *ec_lpc;
|
| 384 | + struct lpc_driver_data *driver_data; |
366 | 385 | u8 buf[2] = {};
|
367 | 386 | int irq, ret;
|
| 387 | + u32 quirks; |
368 | 388 |
|
369 | 389 | ec_lpc = devm_kzalloc(dev, sizeof(*ec_lpc), GFP_KERNEL);
|
370 | 390 | if (!ec_lpc)
|
371 | 391 | return -ENOMEM;
|
372 | 392 |
|
373 | 393 | ec_lpc->mmio_memory_base = EC_LPC_ADDR_MEMMAP;
|
374 | 394 |
|
| 395 | + driver_data = platform_get_drvdata(pdev); |
| 396 | + if (driver_data) { |
| 397 | + quirks = driver_data->quirks; |
| 398 | + |
| 399 | + if (quirks) |
| 400 | + dev_info(dev, "loaded with quirks %8.08x\n", quirks); |
| 401 | + |
| 402 | + if (quirks & CROS_EC_LPC_QUIRK_REMAP_MEMORY) |
| 403 | + ec_lpc->mmio_memory_base = driver_data->quirk_mmio_memory_base; |
| 404 | + } |
| 405 | + |
375 | 406 | /*
|
376 | 407 | * The Framework Laptop (and possibly other non-ChromeOS devices)
|
377 | 408 | * only exposes the eight I/O ports that are required for the Microchip EC.
|
|
0 commit comments