From patchwork Fri Feb 12 17:43:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 61878 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp967680lbl; Fri, 12 Feb 2016 09:49:21 -0800 (PST) X-Received: by 10.66.124.170 with SMTP id mj10mr3957454pab.92.1455299360689; Fri, 12 Feb 2016 09:49:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u69si21217355pfa.253.2016.02.12.09.49.20; Fri, 12 Feb 2016 09:49:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-serial-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-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-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 S1752271AbcBLRtP (ORCPT + 1 other); Fri, 12 Feb 2016 12:49:15 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:34248 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752310AbcBLRtN (ORCPT ); Fri, 12 Feb 2016 12:49:13 -0500 Received: by mail-lf0-f49.google.com with SMTP id j78so56285078lfb.1 for ; Fri, 12 Feb 2016 09:49:12 -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=/qRIeLbuY4oBnPDCP6GMPokwNezwBQXSINI3Dqd+5qg=; b=NdlOCC5Dxth3vreMWpa0v21ZE3ewjOqhS5MZ6DfZ6yPrCWy5qGOKDSOFRtayFZ8PY2 8CqTnU3I7tEkK044//mjSH3k75Z+eCsyCenCcBu0Ok44qmlY32f+b3a/FiQuwasY2ZuI ntgYcyNEAb7KPprm5gNaCqgHNnrcNA1+VH+5c= 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=/qRIeLbuY4oBnPDCP6GMPokwNezwBQXSINI3Dqd+5qg=; b=XeKLRR9ZIoJAj6cszB4myvOS4/kJfRHdG7++4zNeyi9Qst/Uood2ERu4Nmef5DYoIz oADa501UoK8mEm3+3bTk2IeavatSpL5gQjsgueJZ1l7wS1DrsWHzgcMypSRTCcgDbhtV FmH89r7ygkHI4vpLHPoUqlkR14dwB1f0AEbaZRYk8a2O4SpNpSrqdRLBw1SYore9hZkn jV45X3ruT+iDfEtcGrPgmKN9FfpyvyRabFDQnq00gZuCru79gXhR5lmgHQ3G3zdvQVJW fOWZJQeHwkHAT9OaQLd0PFtt84VEL1BxJt8kQnvGQuKdKtzQQDeL28bKASOz/vUFA1gp vx5w== X-Gm-Message-State: AG10YOQnewXOVQvTdkmM+KEyD518VzP437SyYi5WlDAreQ2/WSyifG4cG4CeoKR27SvRI7ky X-Received: by 10.25.144.80 with SMTP id s77mr1210740lfd.6.1455299351880; Fri, 12 Feb 2016 09:49:11 -0800 (PST) Received: from turnip.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id ei4sm2017549lbb.18.2016.02.12.09.49.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 09:49:10 -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 v2 9/9] serial: pl011: use SPCR to setup 32-bit access Date: Fri, 12 Feb 2016 20:43:40 +0300 Message-Id: <1455299022-11641-10-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-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@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 Tested-by: Christopher Covington --- drivers/acpi/spcr.c | 29 +++++++++++++++++++++++++++++ drivers/tty/serial/amba-pl011.c | 2 ++ include/linux/console.h | 5 +++++ 3 files changed, 36 insertions(+) -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" 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 0475840..df1741f 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -75,3 +75,32 @@ int acpi_console_match(struct console *console, char **options) return acpi_table_parse2(ACPI_SIG_SPCR, spcr_table_handler_match, &d); } + +static int spcr_table_handler_32_bit(struct acpi_table_header *t, + void *data) +{ + struct acpi_table_spcr *table = (struct acpi_table_spcr *)t; + + 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_parse2(ACPI_SIG_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 f613bff..699a3ce 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2563,6 +2563,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/console.h b/include/linux/console.h index dcc2b59..027ef50 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -137,11 +137,16 @@ struct console { #ifdef CONFIG_ACPI_SPCR_TABLE int acpi_console_match(struct console *c, char **options); +bool acpi_console_sbsa_32bit(void); #else static inline int acpi_console_match(struct console *c, char **options) { return -ENODEV; } +static inline bool acpi_console_sbsa_32bit(void) +{ + return false; +} #endif /*