From patchwork Mon Feb 29 12:02:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 63202 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1203837lbc; Mon, 29 Feb 2016 04:04:14 -0800 (PST) X-Received: by 10.66.220.66 with SMTP id pu2mr21444929pac.115.1456747454835; Mon, 29 Feb 2016 04:04:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sc3si42654564pac.139.2016.02.29.04.04.14; Mon, 29 Feb 2016 04:04:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754997AbcB2MDz (ORCPT + 7 others); Mon, 29 Feb 2016 07:03:55 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33083 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754978AbcB2MDx (ORCPT ); Mon, 29 Feb 2016 07:03:53 -0500 Received: by mail-lf0-f50.google.com with SMTP id m1so89943452lfg.0 for ; Mon, 29 Feb 2016 04:03:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RnW48366yTzLAGMwWnZjEmpODEf2Z0ACTBhAPTXVmPo=; b=ky4rPU1Rt1JYAMG05XVi3LifjMdiiPYDEOoYqk6URG+IzthZMlChaXs/O4W9NuiTUf 4B2dBZdemUS1o+NHVqXY84jE5DKRM6uo8SXslDSqteOSX0+Q9IjxEbuJ6dA3qbQ1zIC9 mWTIcEnCXMzzt9N1bnxlnH6KRQUNP/JHR/kWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RnW48366yTzLAGMwWnZjEmpODEf2Z0ACTBhAPTXVmPo=; b=Dett7legB1f0Ld9XXRZDIQUWOR4P3GAR8yQ6WZTi9apR6BxMY36l/uqpyHF+wMsSHJ Jq/h3AsnCJiMQ4nzaYCZIUP5Brw8zaZFNMWBtRbddmLBmR7WLx7tUwrbc+6rfVxQvSzn MTB+pKfXlJYrII8gOUiWhHqXaSnuokkStgHzvrfklbconaxhAbaLzYxGUG9QCjwlAzwK UiUEpyILZK7EMGABqqoTM90herhb36SeyQN5bHJ39vtO7hdTkRCkLLt1QI9rUwlAENUv XWrzyfYiUAVXb9EppxJBGu/2/SkYHIqLfQQrqUniJKKtgZGJgKFLbdw8HUSmVmxadCGN r9pg== X-Gm-Message-State: AD7BkJJXRUkI/KEgpTX9+4zob5tsezPC2n5osL5h9AJaholMIl/yrz7cVcMjLbD0Gx1Z8edf X-Received: by 10.25.84.1 with SMTP id i1mr2415580lfb.2.1456747421533; Mon, 29 Feb 2016 04:03:41 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id wj2sm3889456lbb.5.2016.02.29.04.03.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Feb 2016 04:03:40 -0800 (PST) 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 , Yury Norov , Peter Hurley , "Zheng, Lv" , Len Brown , Jiri Slaby Subject: [PATCH v4 4/4] serial: pl011: use ACPI SPCR to setup 32-bit access Date: Mon, 29 Feb 2016 15:02:32 +0300 Message-Id: <1456747355-15692-5-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1456747355-15692-1-git-send-email-aleksey.makarov@linaro.org> References: <1456747355-15692-1-git-send-email-aleksey.makarov@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Some implementations of ARM SBSA serial port hardware require that access to the registers should be 32-bit. Unfortunately, the only way for the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2 tables. In this case the value of the 'Interface Type' field of the SPCR table is ACPI_DBG2_ARM_SBSA_32BIT. How this value is described in the DBG2 spec: "(deprecated) ARM SBSA (2.x only) Generic UART supporting only 32-bit accesses" Signed-off-by: Aleksey Makarov --- drivers/acpi/spcr.c | 22 ++++++++++++++++++++++ drivers/tty/serial/amba-pl011.c | 2 ++ include/linux/acpi.h | 5 +++++ 3 files changed, 29 insertions(+) -- 2.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index c460cb1..f2e81af 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -18,6 +18,7 @@ static char *options; static struct acpi_generic_address address; +static bool sbsa_32_bit; static int __init parse_spcr_init(void) { @@ -60,6 +61,7 @@ static int __init parse_spcr_init(void) } address = table->serial_port; + sbsa_32_bit = table->interface_type == ACPI_DBG2_ARM_SBSA_32BIT; done: early_acpi_os_unmap_memory((void __iomem *)table, table_size); @@ -114,3 +116,23 @@ bool acpi_console_check(struct uart_port *uport) return false; } + +/** + * acpi_console_sbsa_32bit - Tell if SPCR specifies 32-bit SBSA. + * + * Some implementations of ARM SBSA serial port hardware require that access + * to the registers should be 32-bit. Unfortunately, the only way for + * the driver to tell if it's the case is to use the data from ACPI SPCR/DBG2 + * tables. In this case the value of the 'Interface Type' field of the SPCR + * table is ACPI_DBG2_ARM_SBSA_32BIT. + * + * Return: true if access should be 32-bit wide. + */ +bool acpi_console_sbsa_32bit(void) +{ + if (acpi_disabled || parse_spcr() < 0) + return false; + + return sbsa_32_bit; +} +EXPORT_SYMBOL(acpi_console_sbsa_32bit); diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 500232a..d9ca3a4 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2541,6 +2541,8 @@ static int sbsa_uart_probe(struct platform_device *pdev) baudrate = 115200; } + vendor_sbsa.access_32b = acpi_console_sbsa_32bit(); + portnr = pl011_find_free_port(); if (portnr < 0) return portnr; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ea0c297..da1eb23 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1007,11 +1007,16 @@ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev, struct uart_port; #ifdef CONFIG_ACPI_SPCR_TABLE bool acpi_console_check(struct uart_port *uport); +bool acpi_console_sbsa_32bit(void); #else static inline bool acpi_console_check(struct uart_port *uport) { return FALSE; } +static inline bool acpi_console_sbsa_32bit(void) +{ + return false; +} #endif #endif /*_LINUX_ACPI_H*/