From patchwork Tue Sep 11 09:35:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 1436471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id C745B3FC33 for ; Tue, 11 Sep 2012 09:43:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBMwg-00043W-Fn; Tue, 11 Sep 2012 09:39:50 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TBMvB-0003Ra-Jb for linux-arm-kernel@lists.infradead.org; Tue, 11 Sep 2012 09:38:19 +0000 Received: by mail-pb0-f49.google.com with SMTP id rq8so569921pbb.36 for ; Tue, 11 Sep 2012 02:38:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=qpY+uAVCZy6MlKZ00Qy8qASFOd/jhYvO/fIHv6Z9pD4=; b=JxtXocAuqlETnbsvm1yGk5eoiNEC0o9sQds+7UMtdCpdMBSNSZl5rL87fPRM08R3Qo RIWAvDQxmnAZlC9dfx4J6MgByJRd2AhnsPFrab+/bpNMASvrpMvK5f1ln4tdCflenlnf o0Ta62/f4chYavwNaH8g+/sR02HTqCJXSbBPIruzfH/4GawG+P1lGahi8FcmshbZ0zUf Yy+Ug3+tLbR211bxWc+AruKaUj0OOXokHAjxQmKxswIUq2UljnGHneuzdM57bEz8V7DL OHGsotNuN6USmwBh/tcxuiW+eUyjRnaMr7TupBrKGIJO5VHFwK/fBghFVTHeHCnxVLcL W+7A== Received: by 10.68.227.165 with SMTP id sb5mr10483290pbc.82.1347356297307; Tue, 11 Sep 2012 02:38:17 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id pv9sm9487076pbb.67.2012.09.11.02.38.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 02:38:16 -0700 (PDT) From: Anton Vorontsov To: Andrew Morton , Russell King , Jason Wessel , Greg Kroah-Hartman , Alan Cox Subject: [PATCH 07/12] tty/serial/amba-pl011: Implement clear_irqs callback Date: Tue, 11 Sep 2012 02:35:01 -0700 Message-Id: <1347356106-25368-7-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <20120911093042.GA12471@lizard> References: <20120911093042.GA12471@lizard> X-Gm-Message-State: ALoCoQlgf1uNjXglUzWsKD1Oumc4wfkRo1tM/t30wr+oHsjwrnPeGwm8vUVptJSqaFARax/s1/LU X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, Brian Swetland , linux-kernel@vger.kernel.org, =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , John Stultz , linux-serial@vger.kernel.org, Colin Cross , kgdb-bugreport@lists.sourceforge.net, kernel-team@android.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It's all pretty straightforward, except for TXIM interrupt. The interrupt has meaning "ready to transmit", so it's almost always raised, and the only way to silence it is to mask it. But that's OK, ops->start_tx will unmask it. Signed-off-by: Anton Vorontsov --- drivers/tty/serial/amba-pl011.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 45137e4..ec15312 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1307,6 +1307,27 @@ static void pl011_put_poll_char(struct uart_port *port, writew(ch, uap->port.membase + UART01x_DR); } +static void pl011_clear_irqs(struct uart_port *port) +{ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned char __iomem *regs = uap->port.membase; + + writew(readw(regs + UART011_MIS), regs + UART011_ICR); + /* + * There is no way to clear TXIM as this is "ready to transmit IRQ", so + * we simply mask it. start_tx() will unmask it. + * + * Note we can race with start_tx(), and if the race happens, the + * clear_irq() caller might get another interrupt just after we clear + * it. But it should be OK and can happen even w/o the race, e.g. + * controller immediately got some new data and raised the IRQ. + * + * And whoever calls clear_irqs() assumes that the caller manages the + * device (including tx queue), so we're also fine with start_tx()'s + * caller side. + */ + writew(readw(regs + UART011_IMSC) & ~UART011_TXIM, regs + UART011_IMSC); +} #endif /* CONFIG_CONSOLE_POLL */ static int pl011_hwinit(struct uart_port *port) @@ -1712,6 +1733,7 @@ static struct uart_ops amba_pl011_pops = { .poll_init = pl011_hwinit, .poll_get_char = pl011_get_poll_char, .poll_put_char = pl011_put_poll_char, + .clear_irqs = pl011_clear_irqs, #endif };