Chrome platform driver development
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Dustin L. Howett" <dustin@howett.net>,
	Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	chrome-platform@lists.linux.dev, Kieran Levin <ktl@frame.work>
Subject: Re: [PATCH v1 4/4] cros_ec_lpc: add quirks for the Framework Laptop
Date: Thu, 5 Oct 2023 13:45:10 -0500	[thread overview]
Message-ID: <c4e4aee5-4bf2-475a-aa9a-247b5c2d8b85@amd.com> (raw)
In-Reply-To: <20231005160701.19987-6-dustin@howett.net>

On 10/5/2023 11:07, Dustin L. Howett wrote:
> The original Framework Laptop contains a Microchip EC, but the newer
> ones have switched to an NPCX EC which uses the standard linear MMIO
> protocol for host commands and EC memory.
> 
> However, those newer Framework Laptops diverge from the standard
> ChromeOS EC in two important ways:
> 
> 1. The ACPI table for PNP0C09 only claims I/O ports 0x800 to 0x8FE
>     instead of the traditional 0x8FF
> 2. The MMIO region for EC memory begins at port 0xE00 rather than the
>     traditional 0x900.
> 
> cros_ec_lpc's quirks system addresses both of these issues.
> 
> Signed-off-by: Dustin L. Howett <dustin@howett.net>
> ---
>   drivers/platform/chrome/cros_ec_lpc.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
> index c06575625d2f..66285c66ff22 100644
> --- a/drivers/platform/chrome/cros_ec_lpc.c
> +++ b/drivers/platform/chrome/cros_ec_lpc.c
> @@ -537,6 +537,13 @@ static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
>   };
>   MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);
>   
> +static const struct lpc_driver_data framework_laptop_lpc_driver_data __initconst = {
> +	.quirks =
> +		CROS_EC_LPC_QUIRK_REMAP_MEMORY |
> +		CROS_EC_LPC_QUIRK_SHORT_HOSTCMD_RESERVATION,
> +	.quirk_mmio_memory_base = 0xE00,
> +};

I think it would be really helpful for anyone that looks at this commit 
and scratches their head to have a decoder here as a comment along these 
lines to explain how this works (correct it for any inaccuracies please):

/*
  * 13" Gen 11 Intel uses Microchip EC
  * 13" Gen 12 Intel and newer use NPCX EC
  * 13"/16" Gen 1 AMD and newer use NPCX EC
  * These quirks set up the values used in cros_ec_lpc_probe() to be 
able to discover them properly with accordance to the fallback probing 
logic.
  */

If those comments grow stale because Gen 14 Intel or Gen 2 AMD change 
offsets or vendors, then the comment can be changed too, or a second 
quirk be introduced.

In the event that these need to change again in any way in the future 
models, it may be better to introduce a _DSD in the BIOS to allow the 
kernel to be able to discover values that would otherwise be included in 
a quirk.

> +
>   static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
>   	{
>   		/*
> @@ -596,6 +603,7 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
>   			DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
>   			DMI_MATCH(DMI_PRODUCT_NAME, "Laptop"),
>   		},
> +		.driver_data = (void *)&framework_laptop_lpc_driver_data,
>   	},
>   	{ /* sentinel */ }
>   };


  reply	other threads:[~2023-10-05 18:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 16:06 [PATCH v1 0/4] cros_ec: add support for newer versions of the Framework Laptop Dustin L. Howett
2023-10-05 16:06 ` [PATCH v1 1/4] cros_ec_lpc: introduce cros_ec_lpc, a priv struct for the lpc device Dustin L. Howett
2023-10-11  5:29   ` Tzung-Bi Shih
2023-10-05 16:07 ` [PATCH v1 2/4] cros_ec_lpc: pass driver_data from DMI down to the device Dustin L. Howett
2023-10-11  5:29   ` Tzung-Bi Shih
2023-10-05 16:07 ` [PATCH v1 3/4] cros_ec_lpc: add a quirks system, and propagate quirks from DMI Dustin L. Howett
2023-10-11  5:30   ` Tzung-Bi Shih
2023-11-16 23:17   ` Thomas Weißschuh
2023-10-05 16:07 ` [PATCH v1 4/4] cros_ec_lpc: add quirks for the Framework Laptop Dustin L. Howett
2023-10-05 18:45   ` Mario Limonciello [this message]
2023-10-11  5:30   ` Tzung-Bi Shih
2023-10-11  5:29 ` [PATCH v1 0/4] cros_ec: add support for newer versions of " Tzung-Bi Shih
2023-11-26 19:22   ` Dustin Howett
2023-11-27  3:30     ` Tzung-Bi Shih
2023-11-26 19:24 ` [PATCH v2 0/4] platform/chrome: cros_ec_lpc: add support for AMD Framework Laptops Dustin L. Howett
2023-11-26 19:24   ` [PATCH v2 1/4] platform/chrome: cros_ec_lpc: introduce a priv struct for the lpc device Dustin L. Howett
2023-11-26 19:24   ` [PATCH v2 2/4] platform/chrome: cros_ec_lpc: pass driver_data from DMI to the device Dustin L. Howett
2023-11-26 19:24   ` [PATCH v2 3/4] platform/chrome: cros_ec_lpc: add a "quirks" system Dustin L. Howett
2023-11-27  3:30     ` Tzung-Bi Shih
2023-11-26 19:24   ` [PATCH v2 4/4] platform/chrome: cros_ec_lpc: add quirks for the Framework Laptop (AMD) Dustin L. Howett
2023-12-23 11:33   ` [PATCH v2 0/4] platform/chrome: cros_ec_lpc: add support for AMD Framework Laptops Thomas Weißschuh
2024-04-03  0:47   ` [PATCH v3 " Dustin L. Howett
2024-04-03  0:47     ` [PATCH v3 1/4] platform/chrome: cros_ec_lpc: introduce a priv struct for the lpc device Dustin L. Howett
2024-04-03  0:47     ` [PATCH v3 2/4] platform/chrome: cros_ec_lpc: pass driver_data from DMI to the device Dustin L. Howett
2024-04-03  0:47     ` [PATCH v3 3/4] platform/chrome: cros_ec_lpc: add a "quirks" system Dustin L. Howett
2024-04-03  0:47     ` [PATCH v3 4/4] platform/chrome: cros_ec_lpc: add quirks for the Framework Laptop (AMD) Dustin L. Howett
2024-04-04 18:53     ` [PATCH v3 0/4] platform/chrome: cros_ec_lpc: add support for AMD Framework Laptops Thomas Weißschuh
2024-04-04 18:59       ` Dustin Howett
2024-04-04 19:57         ` Thomas Weißschuh
2024-04-05  1:02           ` Dustin Howett
2024-04-06 18:48     ` Mario Limonciello
2024-04-06 19:23       ` Mario Limonciello
2024-04-08  9:30     ` patchwork-bot+chrome-platform
2024-04-08  9:30     ` patchwork-bot+chrome-platform

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4e4aee5-4bf2-475a-aa9a-247b5c2d8b85@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dustin@howett.net \
    --cc=groeck@chromium.org \
    --cc=ktl@frame.work \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox