[PATCH v13 3/3] platform/chrome: cros_ec_uart: Add DT enumeration support
From: Mark Hasemeyer
Date: Tue Dec 27 2022 - 14:33:25 EST
From: Bhanu Prakash Maiya <bhanumaiya@xxxxxxxxxxxx>
Existing firmware uses the "PRP0001" _HID and an associated compatible
string to enumerate the cros_ec_uart.
Add DT enumeration support for already shipped firmware.
Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@xxxxxxxxxxxx>
Co-developed-by: Mark Hasemeyer <markhas@xxxxxxxxxxxx>
Signed-off-by: Mark Hasemeyer <markhas@xxxxxxxxxxxx>
Reviewed-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
---
Changes in v13:
- No change
Changes in v12:
- Add Reviewed-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
Changes in v11:
- No change
Changes in v10:
- No change
Changes in v9:
- Rebase onto for-next
- Update authorship
Changes in v8:
- No change
Changes in v7:
- Move PRP0001 enumeration support to its own commit
drivers/platform/chrome/cros_ec_uart.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/platform/chrome/cros_ec_uart.c b/drivers/platform/chrome/cros_ec_uart.c
index 971ea4bc2df80..0cef2888dffd0 100644
--- a/drivers/platform/chrome/cros_ec_uart.c
+++ b/drivers/platform/chrome/cros_ec_uart.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/serdev.h>
#include <linux/slab.h>
@@ -326,6 +327,12 @@ static int __maybe_unused cros_ec_uart_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_uart_pm_ops, cros_ec_uart_suspend,
cros_ec_uart_resume);
+static const struct of_device_id cros_ec_uart_of_match[] = {
+ { .compatible = "google,cros-ec-uart" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, cros_ec_uart_of_match);
+
#ifdef CONFIG_ACPI
static const struct acpi_device_id cros_ec_uart_acpi_id[] = {
{ "GOOG0019", 0 },
@@ -339,6 +346,7 @@ static struct serdev_device_driver cros_ec_uart_driver = {
.driver = {
.name = "cros-ec-uart",
.acpi_match_table = ACPI_PTR(cros_ec_uart_acpi_id),
+ .of_match_table = cros_ec_uart_of_match,
.pm = &cros_ec_uart_pm_ops,
},
.probe = cros_ec_uart_probe,
--
2.39.0.314.g84b9a713c41-goog