From patchwork Wed May 8 02:33:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16754 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 89A8D238FD for ; Wed, 8 May 2013 02:35:17 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id w16sf1628316vbb.5 for ; Tue, 07 May 2013 19:34:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=jxRrWNZQ057a7cj5rDGX3H3yQNsi1r7TlKJZ2fjoZ0s=; b=he82+IUMwoGnucp5FIksZYMLgHbVAm9k3vLezJEfcbBUgOM0o1ooufrso8A/bDxVmJ p13j0NtEnDihNdIDIZMNwxDZsoX487cwman+bWrqEA0Ixw9qPqZo6QlJ0pESHfdl1ViE J+Qsj1fPtmK9nv5o0nB5KKVwJKNF6sl+UKzBnh1duM31QsNr72bX6ePm0WG/BS1aSbs/ hVJixvXHxq/uFhQzpUMTuw/CfxXmW3ZzVOtAvGX1j4F48OF34AVfmCweaTpedRMNxeM8 QVmtCx8sFPbBSyQpd3XV9Dsj012cBvxsL1B5VxNb8F83KsgKABBBgpNvxBQC/BHbfvZm K+jw== X-Received: by 10.224.165.130 with SMTP id i2mr6519892qay.2.1367980497363; Tue, 07 May 2013 19:34:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.5 with SMTP id 5ls670499qey.92.gmail; Tue, 07 May 2013 19:34:57 -0700 (PDT) X-Received: by 10.52.25.101 with SMTP id b5mr2602570vdg.115.1367980497154; Tue, 07 May 2013 19:34:57 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id gr7si14158398vdc.25.2013.05.07.19.34.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:34:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id gf12so1243012vcb.15 for ; Tue, 07 May 2013 19:34:57 -0700 (PDT) X-Received: by 10.52.66.101 with SMTP id e5mr2695800vdt.57.1367980497005; Tue, 07 May 2013 19:34:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp131019veb; Tue, 7 May 2013 19:34:56 -0700 (PDT) X-Received: by 10.194.58.163 with SMTP id s3mr7259096wjq.6.1367980496075; Tue, 07 May 2013 19:34:56 -0700 (PDT) Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [2a00:1450:400c:c03::22a]) by mx.google.com with ESMTPS id f12si8826562wjs.205.2013.05.07.19.34.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:34:56 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22a is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c03::22a; Received: by mail-we0-f170.google.com with SMTP id u54so1290798wes.29 for ; Tue, 07 May 2013 19:34:55 -0700 (PDT) X-Received: by 10.194.10.129 with SMTP id i1mr7228902wjb.21.1367980495451; Tue, 07 May 2013 19:34:55 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id v6sm6823630wiy.11.2013.05.07.19.34.54 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:34:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: Stefano.Stabellini@eu.citrix.com, patches@linaro.org, ian.campbell@citrix.com, Julien Grall Subject: [PATCH V2 19/33] xen/arm: New callback in uart_driver to get device tree interrupt structure Date: Wed, 8 May 2013 03:33:39 +0100 Message-Id: <00be9057a5ed0f83b98d4cbfc44538ec66755907.1367979526.git.julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQljDyvUDywoCARqtv/eUBpOyIS+MeAruAVhXe+ZcdfcVi8KP3FobkmfX2gClLCy2t4MKIvC X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The existing function serial_irq doesn't allow to retrieve if the interrupt is edge or level trigger. Use this function to routes IRQs for all serial ports which Xen is using to Xen. Signed-off-by: Julien Grall Acked-by: Ian Campbell Changes in v2: - Improve commit message --- xen/arch/arm/gic.c | 12 ++++++++++++ xen/drivers/char/serial.c | 10 ++++++++++ xen/include/xen/serial.h | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 715db60..d719229 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -497,9 +498,20 @@ void gic_route_ppis(void) void gic_route_spis(void) { + int seridx; + const struct dt_irq *irq; + /* XXX should get these from DT */ /* UART */ gic_route_irq(37, 0, 1u << smp_processor_id(), 0xa0); + + for ( seridx = 0; seridx <= SERHND_IDX; seridx++ ) + { + if ( (irq = serial_dt_irq(seridx)) == NULL ) + continue; + + gic_route_dt_irq(irq, 1u << smp_processor_id(), 0xa0); + } } void __init release_irq(unsigned int irq) diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c index a3d2b26..0ae7e4d 100644 --- a/xen/drivers/char/serial.c +++ b/xen/drivers/char/serial.c @@ -482,6 +482,16 @@ int __init serial_irq(int idx) return -1; } +const struct dt_irq __init *serial_dt_irq(int idx) +{ + if ( (idx >= 0) && (idx < ARRAY_SIZE(com)) && + com[idx].driver && com[idx].driver->dt_irq_get ) + return com[idx].driver->dt_irq_get(&com[idx]); + + return NULL; +} + + void serial_suspend(void) { int i; diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h index b932ed4..5de5171 100644 --- a/xen/include/xen/serial.h +++ b/xen/include/xen/serial.h @@ -71,6 +71,8 @@ struct uart_driver { int (*getc)(struct serial_port *, char *); /* Get IRQ number for this port's serial line: returns -1 if none. */ int (*irq)(struct serial_port *); + /* Get IRQ device node for this port's serial line: returns NULL if none. */ + const struct dt_irq *(*dt_irq_get)(struct serial_port *); }; /* 'Serial handles' are composed from the following fields. */ @@ -120,6 +122,9 @@ void serial_end_log_everything(int handle); /* Return irq number for specified serial port (identified by index). */ int serial_irq(int idx); +/* Return irq device node for specified serial port (identified by index). */ +const struct dt_irq *serial_dt_irq(int idx); + /* Serial suspend/resume. */ void serial_suspend(void); void serial_resume(void);