From patchwork Mon Dec 10 21:21:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1859951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 02DE9DFB79 for ; Mon, 10 Dec 2012 21:25:12 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TiAn1-0007kD-Dp; Mon, 10 Dec 2012 21:21:27 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TiAmx-0007jl-TS for linux-arm-kernel@lists.infradead.org; Mon, 10 Dec 2012 21:21:25 +0000 Received: by mail-wi0-f179.google.com with SMTP id o1so1285771wic.0 for ; Mon, 10 Dec 2012 13:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding:content-type; bh=MivVLVE/dlHLJTyoZdQ22/KAEI13TRTtS/CbOAj0jA8=; b=hJu8tCG2zR+H9lst/2uQn+nNlyfJ6VkrvaIJ9gOogGx48LfT5zJoI5v9TINswvORUF NSfbcP1GvfuuYP0jMKWO1/4zX16XWTs8+wz+MOyCrKxUN3LjDqHL37DC7SrmO87u8Caq /winVkbRXJ6qAc0YUDlshQmvmz2UU0CGyCvlkezojyUAjNDAbgRps+NSpewTTfhdBFaD +N2vhTWYPV9c+1VeHEvc7KpXE8vvnHj1xHuGBjcJbCtnoVh2/VTBP+woG7gRHSWm8VS8 QjDi53fQX/Sddj8fNY4Mfvhe6suwnyAlfYMnxoxSD/diTFJBBY8Mo002XsF1o2aBxyX8 4hjw== Received: by 10.216.211.91 with SMTP id v69mr5783638weo.217.1355174481614; Mon, 10 Dec 2012 13:21:21 -0800 (PST) Received: from bender.localnet ([2a01:e35:2f70:4010:3cb1:6893:2f9b:7af7]) by mx.google.com with ESMTPS id eo10sm13406315wib.9.2012.12.10.13.21.20 (version=SSLv3 cipher=OTHER); Mon, 10 Dec 2012 13:21:20 -0800 (PST) From: Florian Fainelli To: rmallon@gmail.com Subject: [PATCH] ARM: ep93xx: properly wait for UART FIFO to be empty Date: Mon, 10 Dec 2012 22:21:19 +0100 Message-ID: <1836468.ZU3cPkV103@bender> Organization: OpenWrt User-Agent: KMail/4.8.5 (Linux/3.2.0-34-generic; KDE/4.9.2; x86_64; ; ) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121210_162124_671871_BC96EA88 X-CRM114-Status: GOOD ( 13.76 ) 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.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (f.fainelli[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.179 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: hsweeten@visionengravers.com, linux@arm.linux.org.uk, 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: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch changes the busy-waiting loop around in the decompressor putc() function on the UART FIFO register. Without a proper wait, the output of the decompressor was corrupted like this: Uncompressing Linx. done, booting th enl To highlight the issue more evidently, looping 100 times instead of 1000 makes the issue appear much faster. This patch takes the approach of using an active while loop until the FIFO is empty (not FULL). This issue happened to me on Sim.One running at 200Mhz. Signed-off-by: Florian Fainelli --- Ryan, this is based on your ep93xx-fixes branch, thanks! arch/arm/mach-ep93xx/include/mach/uncompress.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h index 16026c2..d64274f 100644 --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h +++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h @@ -47,13 +47,9 @@ static void __raw_writel(unsigned int value, unsigned int ptr) static inline void putc(int c) { - int i; - - for (i = 0; i < 1000; i++) { - /* Transmit fifo not full? */ - if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)) - break; - } + /* Transmit fifo not full? */ + while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF) + ; __raw_writeb(c, PHYS_UART_DATA); }