From patchwork Mon Dec 7 16:54:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijai Kumar K X-Patchwork-Id: 1412136 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=behindbytes.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=KAcx8Rm9; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=behindbytes.com header.i=vijai@behindbytes.com header.a=rsa-sha256 header.s=yrk header.b=dmh7JiXu; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CqTtq2vbWz9sW9 for ; Tue, 8 Dec 2020 03:54:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Date:Subject:Message-ID:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0KsBZZl6V5Y5Ab5DQvwiPboN7YiRckTTzlDN1jNuiig=; b=KAcx8Rm96JWGZ7poKqjo7cnu9i f1Zwkze6xANPft/RBov4o1xCIMUvMG84DF7voMcWkBXomToKhQMQ63ZKnOE8+v75eSyHxec0EwyYY PItNmBfmdJoSqjP5zuDFhJ0O1PlJDQqVUPcrOC2AkeEy04WHG6gy1l69A5VR/rsJNcqMH85DG/pH5 VJR1ND50vw3VSoLSDQkHqCZ1p6vf+cubN6llLACRXD3TLJ5L5xSxZRZgG5jBRqYjj677heXa0IYTt 5UEgyqEcBMZxOxO7XEqL8MkmBQRD/O2BVYJ0CwKComaxokIR4aSeXCfLZzX6yABj8VDMhwtspddkU KGef7Nnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmJmX-0005Fu-2m; Mon, 07 Dec 2020 16:54:37 +0000 Received: from sender-of-o50.zoho.in ([103.117.158.50]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmJmU-0005C5-DE for opensbi@lists.infradead.org; Mon, 07 Dec 2020 16:54:36 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1607360060; cv=none; d=zohomail.in; s=zohoarc; b=TW96jEv7u420UMWFYs210iGVa1TzwLt4sbvvPx8DVDSuxPuAS6+z0QBRmxB4FTKGMKrHYGOrNSIfndZ6NyNyPl16AgDor+q+RHNLzNCJon5ZCL07xqgKPmxIlYspTDpuPjsk6sJksT0qhROIFmPshHl1U9/aV+b51O9Od/4i5yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.in; s=zohoarc; t=1607360060; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=IoqGEw8h4UftIryzkZTakzmPDz6k2ys7cf2cImS3Wj0=; b=f95d2XycUaxcD8eyklqwkSBQGhf6uafI+bVhSM9FstEtPz4MK+CkxMsdjXfhCeQvo2Z22zaOy79zXJOocynh/dFDYhql1h7H+g33Opx37eOTEWVltw+kkslGABYPLO90aHFa1pcLJrjbo4qd8ATEkOPVfvac3a1LdXwhGddlRf8= ARC-Authentication-Results: i=1; mx.zohomail.in; dkim=pass header.i=behindbytes.com; spf=pass smtp.mailfrom=vijai@behindbytes.com; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1607360060; s=yrk; d=behindbytes.com; i=vijai@behindbytes.com; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=IoqGEw8h4UftIryzkZTakzmPDz6k2ys7cf2cImS3Wj0=; b=dmh7JiXulaoqMaHPIxxVHMBL5SqlBPSpdmj+06V28+8teQm9CAISHKUeXiNsxNF4 3Wyg/QxRsrGGj4vzzStQd7Hk5WTdU6H7/3cW7qU0okVDfBrH7+MRfmZDikvMlvfMMP8 WyHAzQt9EfQUURxHJBqm/EZzor8rGA+ezSQ5lV20= Received: from localhost.localdomain (49.207.195.106 [49.207.195.106]) by mx.zoho.in with SMTPS id 1607360058738853.9870237810862; Mon, 7 Dec 2020 22:24:18 +0530 (IST) From: Vijai Kumar K To: opensbi@lists.infradead.org Message-ID: <20201207165416.7279-1-vijai@behindbytes.com> Subject: [PATCH] lib: utils: Fix shakti uart implementation Date: Mon, 7 Dec 2020 22:24:16 +0530 X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_115434_852442_F829BED0 X-CRM114-Status: UNSURE ( 8.26 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [103.117.158.50 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vijai Kumar K Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Fix uart_putc implementation. Due to a bug in the IP, this went unnoticed. Use macros instead of magic numbers to make the code more readable. Signed-off-by: Vijai Kumar K Reviewed-by: Anup Patel --- lib/utils/serial/shakti-uart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils/serial/shakti-uart.c b/lib/utils/serial/shakti-uart.c index 493edcf..b2deb70 100644 --- a/lib/utils/serial/shakti-uart.c +++ b/lib/utils/serial/shakti-uart.c @@ -18,18 +18,21 @@ #define REG_IQ_CYCLES 0x1C #define REG_RX_THRES 0x20 +#define UART_TX_FULL 0x2 +#define UART_RX_FULL 0x8 + static volatile void *uart_base; void shakti_uart_putc(char ch) { - while((readw(uart_base + REG_STATUS) & 0x2) == 0); + while((readw(uart_base + REG_STATUS) & UART_TX_FULL)); writeb(ch, uart_base + REG_TX); } int shakti_uart_getc(void) { u16 status = readw(uart_base + REG_STATUS); - if (status & 0x8) + if (status & UART_RX_FULL) return readb(uart_base + REG_RX); return -1; }