From patchwork Sun Apr 28 23:02:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16483 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f200.google.com (mail-gg0-f200.google.com [209.85.161.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 314172395E for ; Sun, 28 Apr 2013 23:03:44 +0000 (UTC) Received: by mail-gg0-f200.google.com with SMTP id w6sf8706047ggk.7 for ; Sun, 28 Apr 2013 16:02:43 -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=Xte8xPkqINmGrTTh/JgvBZIH506/S3FGnQ1qx47TSI4=; b=TTZ+8f4baBWUeFrMIun4iMp2TbLDB9FwmX1gb0cCvah1jUoGGTiXtzV1tjmt9Vv05Q 5vTG5T8AAXm4vx7clt0RHTYbN/+xFvdgvMhTEkbyuuP9i1WIps6IxPo6a4k8e0VTwu/c drvCrtou+3ebXTTKJrpS1d2Tawr7NHwjpUDpgU5PYS0HaRwe/jD+jJV73UPgsbmLUeDH Xo7v4uEyGaMwyb8Yoavn+Scauxow3nNDtGhLrokaOVdzQJu68rH9aBFK11vNtIunHj/5 /+8l2qACLEw7NnC7pOZMlOXW8zUmDkzKk+eDTMYdEgrST0eGhW6HM/L0+nUPj5RyhO1H DdSA== X-Received: by 10.236.60.73 with SMTP id t49mr20950395yhc.19.1367190163021; Sun, 28 Apr 2013 16:02:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.9 with SMTP id l9ls2593387qec.97.gmail; Sun, 28 Apr 2013 16:02:42 -0700 (PDT) X-Received: by 10.59.0.226 with SMTP id bb2mr9898657ved.1.1367190162758; Sun, 28 Apr 2013 16:02:42 -0700 (PDT) Received: from mail-vb0-x22d.google.com (mail-vb0-x22d.google.com [2607:f8b0:400c:c02::22d]) by mx.google.com with ESMTPS id sc6si8950052vdc.112.2013.04.28.16.02.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Apr 2013 16:02:42 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22d; Received: by mail-vb0-f45.google.com with SMTP id p14so4762866vbm.4 for ; Sun, 28 Apr 2013 16:02:42 -0700 (PDT) X-Received: by 10.52.66.101 with SMTP id e5mr421680vdt.57.1367190162601; Sun, 28 Apr 2013 16:02:42 -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 nf2csp33800veb; Sun, 28 Apr 2013 16:02:42 -0700 (PDT) X-Received: by 10.194.82.34 with SMTP id f2mr34652891wjy.25.1367190160267; Sun, 28 Apr 2013 16:02:40 -0700 (PDT) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [2a00:1450:400c:c03::231]) by mx.google.com with ESMTPS id x5si1751595wia.14.2013.04.28.16.02.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Apr 2013 16:02:40 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::231 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c03::231; Received: by mail-we0-f177.google.com with SMTP id s47so4093711wey.8 for ; Sun, 28 Apr 2013 16:02:39 -0700 (PDT) X-Received: by 10.180.183.50 with SMTP id ej18mr14163454wic.4.1367190159896; Sun, 28 Apr 2013 16:02:39 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id k5sm18711393wiy.5.2013.04.28.16.02.38 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Apr 2013 16:02:39 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, patches@linaro.org, anthony.perard@citrix.com, stefano.stabellini@eu.citrix.com, Julien Grall Subject: [RFC 17/29] xen/arm: New callback in uart_driver to get device tree interrupt structure Date: Mon, 29 Apr 2013 00:02:00 +0100 Message-Id: <019572ab35c0212bbcfee16002738f9e5c8d1aa5.1367188423.git.julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQk8v6UqYB4XobROf45QaK2gFEgnG2JrIuclKYUjA+0HgoeusbZA6D99SyAKZQHXFzkaL/X1 X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22d 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 route all serial IRQs to xen. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- 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 bf0c1fd..8085b6e 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);