From patchwork Tue Jan 20 15:46:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 43385 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0A8C24107 for ; Tue, 20 Jan 2015 15:46:27 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf2505256lbd.3 for ; Tue, 20 Jan 2015 07:46:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:reply-to:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=pQpzVpAnLJwp/knqofDao7h0E9hK4jPlPNKgbr8gIJM=; b=fPVyg62w+w82eDCFsc0mg5yoVaDUi2HgrZChAl9XLsG4Vs0EOCirJnzPrwi4h2cDb4 atRqEtG7uQJo0xMrw0coZVkne0lzGO1KiGinA9TUeyrH9aO+RRY6OWQw4Ee2fKJBnh7J rf2OZKuiJTjYhgevjT2bBicx3/Mypss3P9M/YFB80uHeujr6OYJm6DLG2UA3URwi97nJ jiNcj9F2aD/JLsguHZiPQSRBtxyDTeZVEtzAN0L77XQe3xqnvcl0bt433jsaeI7p0z5g KJp5vaBYn2s3fqqqNe+3u7T1cUlaFHOM9u1t6+ku0A91FWTqMIwdHj7QrpmhKKWBhok0 0+PQ== X-Gm-Message-State: ALoCoQkVFHN8eb5KwOBIS2XcL8mXfBEL1LTWONlsg1iro41KX0dcV4b/qJu3vHp8d2QTA4Dx5Az+ X-Received: by 10.112.99.37 with SMTP id en5mr103294lbb.17.1421768786746; Tue, 20 Jan 2015 07:46:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.229 with SMTP id e5ls577516laa.105.gmail; Tue, 20 Jan 2015 07:46:26 -0800 (PST) X-Received: by 10.152.9.170 with SMTP id a10mr3315877lab.1.1421768786608; Tue, 20 Jan 2015 07:46:26 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id js7si15555390lbc.58.2015.01.20.07.46.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 07:46:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so10984260lbv.4 for ; Tue, 20 Jan 2015 07:46:26 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr38505611lbb.32.1421768786505; Tue, 20 Jan 2015 07:46:26 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1460767lbb; Tue, 20 Jan 2015 07:46:25 -0800 (PST) X-Received: by 10.50.61.176 with SMTP id q16mr27030176igr.29.1421768784983; Tue, 20 Jan 2015 07:46:24 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id eh8si2965291igb.48.2015.01.20.07.46.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 07:46:24 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YDb0R-0004YU-8C; Tue, 20 Jan 2015 15:46:15 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YDb0N-0004YC-MO for edk2-devel@lists.sourceforge.net; Tue, 20 Jan 2015 15:46:11 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.176 as permitted sender) client-ip=74.125.82.176; envelope-from=leif.lindholm@linaro.org; helo=mail-we0-f176.google.com; Received: from mail-we0-f176.google.com ([74.125.82.176]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YDb0L-00039C-Hz for edk2-devel@lists.sourceforge.net; Tue, 20 Jan 2015 15:46:11 +0000 Received: by mail-we0-f176.google.com with SMTP id w62so11859038wes.7 for ; Tue, 20 Jan 2015 07:46:03 -0800 (PST) X-Received: by 10.180.90.241 with SMTP id bz17mr29341666wib.0.1421768763555; Tue, 20 Jan 2015 07:46:03 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc4-cmbg17-2-0-cust71.5-4.cable.virginm.net. [86.14.224.72]) by mx.google.com with ESMTPSA id 7sm21752450wjq.29.2015.01.20.07.46.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jan 2015 07:46:02 -0800 (PST) From: Leif Lindholm To: edk2-devel@lists.sourceforge.net, linaro-uefi@lists.linaro.org Date: Tue, 20 Jan 2015 15:46:33 +0000 Message-Id: <1421768793-31647-1-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.3 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YDb0L-00039C-Hz Subject: [edk2] [PATCH] ArmPlatformPkg: detect correct pl011 fifo depth X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leif.lindholm@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 pl011 releases earlier than r1p5 has a fifo depth of 16 bytes, whereas version r1p5 upwards has a fifo depth of 32 bytes. The pl011 driver was hardwired to 32 byte depth, causing dropped characters on some platforms (including default settings on FVP Base and Foundation models). Update driver to select 16 or 32 on port initialization by checking the component revision. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm --- ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c | 7 +++++-- ArmPlatformPkg/Include/Drivers/PL011Uart.h | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c index 7e74a05..90a41ab 100644 --- a/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c +++ b/ArmPlatformPkg/Drivers/PL011Uart/PL011Uart.c @@ -50,12 +50,15 @@ PL011UartInitializePort ( LineControl = 0; - // The PL011 supports a buffer of either 1 or 32 chars. Therefore we can accept + // The PL011 supports a buffer of 1, 16 or 32 chars. Therefore we can accept // 1 char buffer as the minimum fifo size. Because everything can be rounded down, // there is no maximum fifo size. if ((*ReceiveFifoDepth == 0) || (*ReceiveFifoDepth >= 32)) { LineControl |= PL011_UARTLCR_H_FEN; - *ReceiveFifoDepth = 32; + if (PL011_UARTPID2_VER(MmioRead32 (UartBase + UARTPID2)) > PL011_VER_R1P4) + *ReceiveFifoDepth = 32; + else + *ReceiveFifoDepth = 16; } else { ASSERT (*ReceiveFifoDepth < 32); // Nothing else to do. 1 byte fifo is default. diff --git a/ArmPlatformPkg/Include/Drivers/PL011Uart.h b/ArmPlatformPkg/Include/Drivers/PL011Uart.h index 6675cef..2fe796f 100644 --- a/ArmPlatformPkg/Include/Drivers/PL011Uart.h +++ b/ArmPlatformPkg/Include/Drivers/PL011Uart.h @@ -35,6 +35,11 @@ #define UARTICR 0x044 #define UARTDMACR 0x048 +#define UARTPID0 0xFE0 +#define UARTPID1 0xFE4 +#define UARTPID2 0xFE8 +#define UARTPID3 0xFEC + // Data status bits #define UART_DATA_ERROR_MASK 0x0F00 @@ -81,6 +86,9 @@ #define PL011_UARTLCR_H_PEN (1 << 1) // Parity Enable #define PL011_UARTLCR_H_BRK (1 << 0) // Send break +#define PL011_UARTPID2_VER(X) (((X) >> 4) & 0xF) +#define PL011_VER_R1P4 0x2 + /* Programmed hardware of Serial port.