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: 11297 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 98F9523EFE for ; Tue, 11 Sep 2012 09:38:18 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4E527A18F23 for ; Tue, 11 Sep 2012 09:38:18 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so513911iea.11 for ; Tue, 11 Sep 2012 02:38:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=qpY+uAVCZy6MlKZ00Qy8qASFOd/jhYvO/fIHv6Z9pD4=; b=o+kYK8evjwyT6egiMwHsP4BqxgpitPX+vJ0UeSc4k5DqMdktHrc0cYgCI5gosLOJq+ UpgwUL3ggSBcnh0hC6qrCtuCZ5ORV/7eohNV+MEqOVljmoHe3McIE50H1sJdr3ghqhFo bzVwHn7Dg0bqiuKGhvC31BLX5944l+TVVx2dDlm5OozUaGDR3QfPtDnzluiBkQ7GTBdb N8jl5ngRUOEEi4oDm152fk5HUDEzAzBW011ox5nXbXkL5tPLsPZtAq074WJ5bEpmRG8l 6LTgl7JVVMrgGqM7QM6e9y6pWgKihSQONVToKNzFvM0GwpCZ6hU3MtSf9jhG9NMaym2N 91TA== Received: by 10.50.195.134 with SMTP id ie6mr15956713igc.28.1347356298080; Tue, 11 Sep 2012 02:38:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp4782igc; Tue, 11 Sep 2012 02:38:17 -0700 (PDT) Received: by 10.68.203.200 with SMTP id ks8mr10665248pbc.142.1347356297535; Tue, 11 Sep 2012 02:38:17 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id qd8si24203454pbc.127.2012.09.11.02.38.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Sep 2012 02:38:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md12so636945pbc.37 for ; Tue, 11 Sep 2012 02:38:17 -0700 (PDT) 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 Cc: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Colin Cross , Brian Swetland , John Stultz , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com, kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org 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: ALoCoQni5fNsQ8Idw566gHCtkVf7TjvBlY0tZPMRweukpL4tJxNoxX6DgXE85knp/2PM+OnNeHYV 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 };