[PATCH] serdev: Don't claim unsupported serial devices

Punit Agrawal
2019-12-18T06:56:24Z

Serdev sub-system claims all serial devices that are not already
enumerated. As a result, no device node is created for serial port on
certain boards such as the Apollo Lake based UP2. This has the
unintended consequence of not being able to raise the login prompt via
serial connection.

Introduce a blacklist to reject devices that should not be treated as
a serdev device. Add the Intel HS UART peripheral ids to the blacklist
to bring back serial port on SoCs carrying them.

Cc: stable@vger.kernel.org
Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Cc: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
---

Hi,

The patch has been updated based on feedback recieved on the RFC[0].

Please consider merging if there are no objections.

Thanks,
Punit

[0] https://www.spinics.net/lists/linux-serial/msg36646.html

drivers/tty/serdev/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 226adeec2aed..0d64fb7d4f36 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -663,6 +663,12 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
return AE_OK;
}

+static const struct acpi_device_id serdev_blacklist_devices[] = {
+ {"INT3511", 0},
+ {"INT3512", 0},
+ { },
+};
+
static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
void *data, void **return_value)
{
@@ -675,6 +681,10 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
if (acpi_device_enumerated(adev))
return AE_OK;

+ /* Skip if black listed */
+ if (!acpi_match_device_ids(adev, serdev_blacklist_devices))
+ return AE_OK;
+
if (acpi_serdev_check_resources(ctrl, adev))
return AE_OK;

--
2.24.0