From patchwork Tue Nov 17 09:40:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7634941 Return-Path: X-Original-To: patchwork-linux-arm@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 1277ABF90C for ; Tue, 17 Nov 2015 10:03:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6013F204D9 for ; Tue, 17 Nov 2015 10:03:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [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 D7ECF20494 for ; Tue, 17 Nov 2015 10:03:39 +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 1Zyd4v-0002E4-TV; Tue, 17 Nov 2015 10:01:33 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zycqg-0001rS-Qt for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:46:58 +0000 Received: by wmec201 with SMTP id c201so218047124wme.0 for ; Tue, 17 Nov 2015 01:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zq4h55BRd9qL9z6vhJtw+qV2I7jL+Co2uY3r+PcJgYo=; b=MDY/lzPDEJ2p56YPLAImzR1qBy2/fazXWoUTIebGcatkfA3VsSRcgdZbB47/4uSYdD CIA4jf0KZ9qFpmQ85MPZoBgdGB8CxIAe5XHSp0GKliAv9cfXPeYXSRihwCD0XQE9s3Yg HlZGwHocqDibWk+bX3SAUCohnG96OfcXQEdEFKGE9WPAq5hmJTdnEkVu6Ipmf+NEQQqD +GIHzxDH9sGyhSnm+Dlo1U8K5/7k6o5SBWniDIwDb//c9jKTlFkSeXt9e57FZVLGkW33 zTq7lMWAAuw2beVLFYG6LUmZk/61JuFmAkW/aPomJ4+OFQQvBeDM4sc4eJdn0kkxxgbb AGAw== 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=zq4h55BRd9qL9z6vhJtw+qV2I7jL+Co2uY3r+PcJgYo=; b=RSRW/FokoUXWCGMEPrdsXC6XrDN036BfgQ/9G/DJVoXMTG74lPp0+4Kn7X6aR0B0fP m2TSrYuPeoVCtArg+bKJqPHfSm8LREAv4Fz6H7YQqhy/Uo5OyijZPgJwzpDR6ZWw3Q0d TcVZCMUq92aQZPZRdUrX87fVNXytrMU5uSudpLWrRbebFs8p0XV83cIJ6C6aFVuqVSbd 5BWpKk/V6NlDqrpbaS6ltt7Ni8Kfew8VkkFLPEw3r4DS/D687shdqcv5xr+FnwjgNQxW TqQ20YsGOm6zIUBy5FjA+a4/htwTVl928Mqx81XJe9aqfrBS8ixBcZCLabnydLSpJiW3 h+8A== X-Gm-Message-State: ALoCoQkO9NsrZoTHEZWMq7WF8dlKJjg0GUJeDqfHKaesvek0OtyzLPNhjmrBBZydqCowW/D+HaFi X-Received: by 10.28.135.206 with SMTP id j197mr1598358wmd.14.1447753589430; Tue, 17 Nov 2015 01:46:29 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id bk7sm38966406wjb.25.2015.11.17.01.46.26 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:46:28 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Subject: [PATCH v3 36/62] arm/acpi: Initialize serial port from ACPI SPCR table Date: Tue, 17 Nov 2015 17:40:35 +0800 Message-Id: <1447753261-7552-37-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014651_518066_1F6BB676 X-CRM114-Status: GOOD ( 12.93 ) X-Spam-Score: -2.6 (--) 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: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com 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=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 From: Parth Dixit Parse ACPI SPCR (Serial Port Console Redirection table) table and initialize the serial port pl011. Signed-off-by: Naresh Bhat Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao --- xen/drivers/char/pl011.c | 37 +++++++++++++++++++++++++++++++++++++ xen/include/acpi/actbl2.h | 5 +++++ 2 files changed, 42 insertions(+) diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index 1efb1cf..7106f1c 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -308,6 +309,42 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL) .init = dt_pl011_uart_init, DT_DEVICE_END +#ifdef CONFIG_ACPI +static int __init acpi_pl011_uart_init(const void *data) +{ + acpi_status status; + struct acpi_table_spcr *spcr=NULL; + int res; + + status = acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("pl011: Failed to get SPCR table\n"); + return -EINVAL; + } + + /* trigger/polarity information is not available in spcr */ + irq_set_type(spcr->interrupt, ACPI_IRQ_TYPE_EDGE_BOTH); + + res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address, + PAGE_SIZE); + if ( res < 0 ) + { + printk("pl011: Unable to initialize\n"); + return res; + } + + return 0; +} + +ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL) + .class_type = ACPI_SPCR_TYPE_PL011, + .init = acpi_pl011_uart_init, +ACPI_DEVICE_END +#endif + /* * Local variables: * mode: C diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index 87bc6b3..25be429 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -815,6 +815,11 @@ struct acpi_table_spcr { #define ACPI_SPCR_DO_NOT_DISABLE (1) +/* UART Interface type */ +#define ACPI_SPCR_TYPE_16550 0 +#define ACPI_SPCR_TYPE_16550_SUB 1 +#define ACPI_SPCR_TYPE_PL011 3 + /******************************************************************************* * * SPMI - Server Platform Management Interface table