From patchwork Wed Feb 8 00:57:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 9561565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9662160236 for ; Wed, 8 Feb 2017 00:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84C582848D for ; Wed, 8 Feb 2017 00:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77ED128490; Wed, 8 Feb 2017 00:58:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 120EB2848D for ; Wed, 8 Feb 2017 00:58:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cbGaG-0003M3-Ow; Wed, 08 Feb 2017 00:58:08 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cbGaD-0003LG-Fi for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2017 00:58:07 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E0C1F60A81; Wed, 8 Feb 2017 00:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486515466; bh=PY1Ns9qpGjux7khXItlkoHEzeNRehnRt/AymnHmUrkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcxxxRfRNbio4VcU5B/G0+NMJGpaIRwgz1rC9COyvdfPEmnoGo4I/4Cc96ckvwUhl 1h8S0PId05AiQUQaLkGqSW2J1OPFi1ax0ftfFN1KK5QTznjQvHF74OVL+nSeBTqc0u 5qG+cPUVdLTlKMAte2h3dWneQfoErqGkAzgOsP9g= Received: from illium.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cov@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 611A5609FD; Wed, 8 Feb 2017 00:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486515466; bh=PY1Ns9qpGjux7khXItlkoHEzeNRehnRt/AymnHmUrkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcxxxRfRNbio4VcU5B/G0+NMJGpaIRwgz1rC9COyvdfPEmnoGo4I/4Cc96ckvwUhl 1h8S0PId05AiQUQaLkGqSW2J1OPFi1ax0ftfFN1KK5QTznjQvHF74OVL+nSeBTqc0u 5qG+cPUVdLTlKMAte2h3dWneQfoErqGkAzgOsP9g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 611A5609FD Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cov@codeaurora.org From: Christopher Covington To: Jonathan Corbet , Marc Zyngier , Catalin Marinas , Will Deacon , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Rutland , linux-kernel@vger.kernel.org, shankerd@codeaurora.org, timur@codeaurora.org, Russell King , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org Subject: [PATCH 2/2] tty: pl011: Work around QDF2400 E44 for earlycon Date: Tue, 7 Feb 2017 19:57:36 -0500 Message-Id: <20170208005736.18724-2-cov@codeaurora.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170208005736.18724-1-cov@codeaurora.org> References: <20170208005736.18724-1-cov@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170207_165805_603846_E60924C7 X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jon Masters , Neil Leeder , Mark Langsdorf , Christopher Covington , Mark Salter MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The previous change worked around QDF2432v1 and QDF2400v1 SoC erratum 44 for the full-fledged console, when UART AMBA Port (UAP) data is available. Additionally provide a workaround the earlycon case, again checking TXFE == 0 instead of BUSY == 1. As earlycon is operating before UAP data is available, the implementation is different than in the preceding patch. Signed-off-by: Christopher Covington --- drivers/tty/serial/amba-pl011.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 41e51901d6ef..f25e7c994f8e 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2411,6 +2411,29 @@ static bool qdf2400_e44(void) { cpu_var_model == MIDR_QCOM_FALKOR_V1); } +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_44 +static void qdf2400_e44_putc(struct uart_port *port, int c) +{ + while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF) + cpu_relax(); + if (port->iotype == UPIO_MEM32) + writel(c, port->membase + UART01x_DR); + else + writeb(c, port->membase + UART01x_DR); + while (!(readl(port->membase + UART01x_FR) & UART011_FR_TXFE)) + cpu_relax(); +} + +static void qdf2400_e44_early_write(struct console *con, const char *s, unsigned n) +{ + struct earlycon_device *dev = con->data; + + uart_console_write(&dev->port, s, n, qdf2400_e44_putc); +} +#else +#define qdf2400_e44_early_write pl011_early_write +#endif + static void pl011_putc(struct uart_port *port, int c) { while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF) @@ -2436,7 +2459,10 @@ static int __init pl011_early_console_setup(struct earlycon_device *device, if (!device->port.membase) return -ENODEV; - device->con->write = pl011_early_write; + if (qdf2400_e44()) + device->con->write = qdf2400_e44_early_write; + else + device->con->write = pl011_early_write; return 0; } OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);