From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC862C38A02 for ; Wed, 26 Oct 2022 00:17:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF09584F23; Wed, 26 Oct 2022 02:17:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1666743476; bh=kSJJJ2m/pEq+NYQ+GMQKaLWK9w9cX8ymanGl5+1SmOk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aYnMGVPkBNnDwAWKfz1/DVPQUUU/qVOk5ax+4Ihf8ba8nisPtCCjTq0KCTv57kLbN CRcqTAO1n2Xw+o8SX6NfH5G6DS6D5vzkZXegYLp8ztNNDiXuA5skCNnuKPHpnPqsHc w9OI3sHRD2BBh5A+/wWP3ZHpr8OInS7j7h6YO/BR2240c/L6hJxyqpI2OBF6Egvtsc Fik2gEuoOobotTlqtXdghRe/OHnuR8rlsN5TYqtcM5+uGfkM9WAqZZ0mYZhbt3TCSk lKXjj2Jl8cORiSF6D8S88x9dQZiLf+k65b4MrWZnktN9+QdH6opixEye68x3+geVKp hRQ+mq2BbTBeA== Received: from mail.denx.de (unknown [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: festevam@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9F61D84EB6; Wed, 26 Oct 2022 02:17:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1666743472; bh=kSJJJ2m/pEq+NYQ+GMQKaLWK9w9cX8ymanGl5+1SmOk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=av9kMMme7e27g5n06IC5yMFBhTs0jOYP4rnKq/YZRPK/ahbIlZDazEPFzEGksLFqR 56uwhMPxy+wCS5zT5t53BTgd7CpdGAte5tg7vRyD3zH2hdnwFlHx/NyAUbe0Ydq1gC TktAFi7i/scUwxozZvk4uQW2zsAt3tePJfM+v1kx44n3QdXo54EHiJs9MN/HgVnQDj 31MUByzGzRANOYAtcErobgZWBvaTtDh0ROJ6iYB+hnrJ8i8oXT7gmTB+WOifGM8LiZ FJV7NHzzNfPwu6hn5lUx7uwsxdz02eZdBv8jizcz70j+Qfq2NPHtWlbhAvWXN4CWaO EE/kqpiu1evNA== MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 25 Oct 2022 21:17:52 -0300 From: Fabio Estevam To: Tim Harvey Cc: Fabio Estevam , sbabic@denx.de, uboot-imx@nxp.com, johannes.schneider@leica-geosystems.com, u-boot@lists.denx.de, pali@kernel.org Subject: Re: [PATCH v2] serial: mxc: Keep the original FIFO empty check In-Reply-To: References: <20221025225657.904240-1-festevam@gmail.com> Message-ID: <7ca76b640820add897a976222c3d4e00@denx.de> X-Sender: festevam@denx.de User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Tim, On 25/10/2022 20:23, Tim Harvey wrote: > Fabio, > > This resolves the issue. Why would the kernel not suffer from this as > well? We are essentially saying if the FIFO is not full but also not > empty we need to wait.... so do we have a FIFO size of 1 or something > here as opposed to the kernel? The FIFO has a fixed size of 32 chars. Kernel uses TXTL, which "controls the threshold at which a maskable interrupt is generated by the TxFIFO". We do not use interrupts in U-Boot. Prior to Johannes' patch, we only checked for the TXFIFO empty condition, which avoided sending data when nothing was available inside the FIFO (under-run condition). Johannes' patch handles over-run condition. My patch guarantees that both over-run and under-run conditions are handled. When the number of chars in the FIFO is 1, 2, 3,...30, the transmission can safely happen. Special cases are FIFO empty and FIFO full, which returns -EAGAIN to the serial core. Regards, Fabio Estevam -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-60 Fax: (+49)-8142-66989-80 Email: festevam@denx.de