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: 8317741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 281C79F6E4 for ; Mon, 15 Feb 2016 18:21:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FA8920386 for ; Mon, 15 Feb 2016 18:21:42 +0000 (UTC) Received: from bombadil.infradead.org (unknown [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B51120320 for ; Mon, 15 Feb 2016 18:21:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVNdd-0007Ff-Gn; Mon, 15 Feb 2016 18:12:45 +0000 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVNcl-0006T2-BW for linux-arm-kernel@lists.infradead.org; Mon, 15 Feb 2016 18:11:53 +0000 Received: by mail-lf0-x22a.google.com with SMTP id 78so93904003lfy.3 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=Bax1PipnVEcqjEmANGk9f7W1OUSrQt8Yoqo6AsnbE1f/cKzzP0dMAu/Ycnc9lvWae8 h0PY2ho0yY3PBL7DUKN8AtBhBJs+V1UX148vtmNt2tYkNViM2FtgpXPaEge56OEOzapg mXClf0A/st6LOwfSRG79zkqPgJ1ZUVFB6Ol71ohoo24HHKCNMBKj8NNwDrqCIXyAhkp3 oMtoikGVmDqeVh7um3GQjhKzrdJBTMrRh4jydHpKAnDoiDiG3npwHM7pRKw9VL8fgYzw J/yN5qz+2QGBz7gUlbKcAynl+AAR/W2dRPvGdMplXqIY+O/oGYSs8zXOzEWrZe2GE647 fIeQ== X-Gm-Message-State: AG10YOQPqxg6ynu8y1qfVAEDs63JJYrFqaNG+dgO/LztlqLeOYLUbem93Vn6MYonr4KRWIWE 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160215_101151_675283_EBA3551D X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Russell King , Graeme Gregory , Greg Kroah-Hartman , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Leif Lindholm , Aleksey Makarov , Christopher Covington , linux-serial@vger.kernel.org, Jiri Slaby , Al Stone , linux-arm-kernel@lists.infradead.org, Len Brown MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RDNS_NONE,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*/