From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752489AbcBLRt5 (ORCPT ); Fri, 12 Feb 2016 12:49:57 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:33247 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751847AbcBLRtH (ORCPT ); Fri, 12 Feb 2016 12:49:07 -0500 From: Aleksey Makarov To: linux-acpi@vger.kernel.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aleksey Makarov , Russell King , Greg Kroah-Hartman , "Rafael J . Wysocki" , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington , Jiri Slaby Subject: [PATCH v2 7/9] serial: pl011: add acpi_match Date: Fri, 12 Feb 2016 20:43:38 +0300 Message-Id: <1455299022-11641-8-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> References: <1455299022-11641-1-git-send-email-aleksey.makarov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an implementation of acpi_match() to the pl011 driver. It allows console to check if it matches the console specified by ACPI SPCR table. Signed-off-by: Aleksey Makarov Tested-by: Christopher Covington --- drivers/tty/serial/amba-pl011.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 500232a..f613bff 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2285,12 +2285,34 @@ static int __init pl011_console_setup(struct console *co, char *options) return uart_set_options(&uap->port, co, baud, parity, bits, flow); } +static int __init pl011_console_acpi_match(struct console *co, + struct acpi_table_spcr *spcr) +{ + struct uart_amba_port *uap = amba_ports[co->index < 0 ? 0 : co->index]; + + if (uap->vendor->access_32b) { + if (spcr->interface_type != ACPI_DBG2_ARM_SBSA_32BIT) + return -ENODEV; + } else { + if (spcr->interface_type != ACPI_DBG2_ARM_PL011 && + spcr->interface_type != ACPI_DBG2_ARM_SBSA_GENERIC) + return -ENODEV; + } + + if (spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY || + spcr->serial_port.address != (u64)uap->port.mapbase) + return -ENODEV; + + return 0; +} + static struct uart_driver amba_reg; static struct console amba_console = { .name = "ttyAMA", .write = pl011_console_write, .device = uart_console_device, .setup = pl011_console_setup, + .acpi_match = pl011_console_acpi_match, .flags = CON_PRINTBUFFER, .index = -1, .data = &amba_reg, -- 2.7.0