From patchwork Mon Feb 15 18:05:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 8317611 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8263C02AA for ; Mon, 15 Feb 2016 18:11:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA7B1203C3 for ; Mon, 15 Feb 2016 18:11:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A21920154 for ; Mon, 15 Feb 2016 18:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752533AbcBOSLe (ORCPT ); Mon, 15 Feb 2016 13:11:34 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:34200 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbcBOSLa (ORCPT ); Mon, 15 Feb 2016 13:11:30 -0500 Received: by mail-lf0-f43.google.com with SMTP id j78so93844501lfb.1 for ; Mon, 15 Feb 2016 10:11:30 -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=+vhPrs7VlXbpE+0Ge83I5OWcgGM7OQo9DeZ+9NIjhQ8=; b=Xughh8xoya80rKMlevQRamwuaAQuaPVIAbdHkzX6XyZb9rJz2LDBFghjoPyFa5XK12 fqN0RTJQbWlx7kkx+HB32RMjVILOJyAl+OtazYxAnFneV1+5OYgXkCyM/CccSefBDqCu mXxkqSVFbpGx6U7qSlWgtS8tInzMJY1FZ2pFs= 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=+vhPrs7VlXbpE+0Ge83I5OWcgGM7OQo9DeZ+9NIjhQ8=; b=W/E+8UA9lVoi7hEOWEJlxV7sVgEJ8PYA99Jro519y1jr+kigNiriCZdoLSC53xh+nt Esl9wg4FpKOGju/VZqFAqf038cWKFWoChV2OG5v1+E5URLYjkBCpEsArs1Tx57+GlG3V 6NklQN1FdXh5VgWRFfZg80KIUVSi9Oq2mjUAeNMF+V/tHrRcgc581tU7zTX19t2j/UI/ o3FRKJQITLOEXmhlu56Ok9FlsmNCA9yQnIuWok4XrPu+N7xwq60FqPVKa3FCEez+bb/0 Ps1NilYD8IqMLSUin+gItVbEUbXtIp7xbAI5nwQoG4v5A2PqldN8dM2BzVvUB3Etj78F QJNA== X-Gm-Message-State: AG10YOSvYS+IJnziaGQ0wixAcJTAUj6/F5TLWsclDHr8GzOOdmymXVyg9y5gEIDvO0jPVgyi X-Received: by 10.25.160.194 with SMTP id j185mr6129193lfe.128.1455559889316; Mon, 15 Feb 2016 10:11:29 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id i66sm3818526lfg.4.2016.02.15.10.11.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 10:11:28 -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 , Len Brown , Jiri Slaby Subject: [PATCH v3 5/5] serial: pl011: use SPCR to setup 32-bit access Date: Mon, 15 Feb 2016 21:05:29 +0300 Message-Id: <1455559532-8305-6-git-send-email-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455559532-8305-1-git-send-email-aleksey.makarov@linaro.org> References: <1455559532-8305-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 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 25 +++++++++++++++++++++++++ drivers/tty/serial/amba-pl011.c | 2 ++ include/linux/acpi.h | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index a1eca91..a5e241d 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -95,3 +95,28 @@ bool acpi_console_check(struct uart_port *uport) return acpi_table_parse_spcr(spcr_table_handler_check, uport) > 0; } + +static int spcr_table_handler_32_bit(struct acpi_table_spcr *table, void *data) +{ + return table->interface_type == ACPI_DBG2_ARM_SBSA_32BIT; +} + +/** + * 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) + return false; + + return acpi_table_parse_spcr(spcr_table_handler_32_bit, NULL) > 0; +} +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*/