From patchwork Sun May 17 20:03:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48641 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 44EE2214BA for ; Sun, 17 May 2015 20:06:30 +0000 (UTC) Received: by wivs14 with SMTP id s14sf15382603wiv.1 for ; Sun, 17 May 2015 13:06:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=bH+8CLRfbLwmSpzJ5cMsZMxZgIZFbRPzOcFrTm7DGyc=; b=MuAkA3n2b+wMKibhKqneUfl260OeBevBncMbYV+JXU5xLq46IRk8aa5/eCNh77zaJp J99+eItEUMBIYX01G9fsdUgsmB3aSsErG/gvuCF83JiU74W8w7c6pZqkHuJnMJyMK0Tj Dr/asdBU2y5Ti/JQ0ak5EcZWGHvAqySNvGsYZdql4EOUuMfa1SH9+KZcbin5yFcxMFNQ IKrCpTKmLVf93dbrFH0XWPULWV/rZOR4VMT/XdkFgqkQ4tmH1ZQQRgRLVfosHQTmU6BQ 7KEwTZM2s15e7G/oXxzHRlePfPcstONdixQ0KCeP060QVuagn/SXMdbkW46b2c3WC/yw Mwog== X-Gm-Message-State: ALoCoQk5voMlqm1V0g0b1q2aNOelp5b+xwD/VFvRJyIM55Q4uapLRiB1GIWXjl0xIYyhjJfCSK8O X-Received: by 10.112.151.146 with SMTP id uq18mr15223113lbb.20.1431893189563; Sun, 17 May 2015 13:06:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.9 with SMTP id ky9ls580135lab.98.gmail; Sun, 17 May 2015 13:06:29 -0700 (PDT) X-Received: by 10.152.26.130 with SMTP id l2mr14877843lag.20.1431893189355; Sun, 17 May 2015 13:06:29 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id xp11si5344698lac.1.2015.05.17.13.06.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:06:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by laat2 with SMTP id t2so191057656laa.1 for ; Sun, 17 May 2015 13:06:29 -0700 (PDT) X-Received: by 10.112.182.4 with SMTP id ea4mr15158401lbc.35.1431893189247; Sun, 17 May 2015 13:06:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3507914lbb; Sun, 17 May 2015 13:06:28 -0700 (PDT) X-Received: by 10.55.26.86 with SMTP id a83mr31638846qka.83.1431893187768; Sun, 17 May 2015 13:06:27 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id b125si8246558qhc.126.2015.05.17.13.06.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:06:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4op-0002UJ-Dv; Sun, 17 May 2015 20:05:51 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4oo-0002SD-7H for xen-devel@lists.xen.org; Sun, 17 May 2015 20:05:50 +0000 Received: from [193.109.254.147] by server-9.bemta-14.messagelabs.com id 61/9B-02790-D94F8555; Sun, 17 May 2015 20:05:49 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-5.tower-27.messagelabs.com!1431893147!13619766!1 X-Originating-IP: [209.85.192.181] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27987 invoked from network); 17 May 2015 20:05:48 -0000 Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:05:48 -0000 Received: by pdfh10 with SMTP id h10so117356412pdf.3 for ; Sun, 17 May 2015 13:05:46 -0700 (PDT) X-Received: by 10.70.55.41 with SMTP id o9mr37829877pdp.80.1431893146775; Sun, 17 May 2015 13:05:46 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.05.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:05:46 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:48 +0530 Message-Id: <1431893048-5214-22-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 21/41] arm : acpi Initialize serial port from ACPI SPCR table X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 --- xen/drivers/char/pl011.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ xen/include/acpi/actbl2.h | 5 +++++ 2 files changed, 54 insertions(+) diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index f0c3daf..bc34555 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -307,6 +308,54 @@ 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) +{ + struct pl011 *uart; + 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("\nFailed to get SPCR table \n"); + return 1; + } + + uart = &pl011_com; + + if ( spcr->interrupt < 0 ) + { + printk("pl011: Unable to retrieve the IRQ\n"); + return -EINVAL; + } + + uart->irq = spcr->interrupt; + /* trigger/polarity information is not available in spcr */ + set_irq_type(uart->irq, ACPI_IRQ_TYPE_EDGE_BOTH); + + res = pl011_uart_init(uart, spcr->serial_port.address, PAGE_SIZE); + if ( res < 0 ) + { + printk("pl011: Unable to initialize\n"); + return res; + } + + /* Register with generic serial driver. */ + serial_register_uart(SERHND_UART, &pl011_driver, uart); + + 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