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 B65B8C433F5 for ; Wed, 6 Apr 2022 13:30:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 06A5C83DC0; Wed, 6 Apr 2022 15:30:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="OiliKKcV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ACAAE83DCE; Wed, 6 Apr 2022 15:30:24 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6626083DBE for ; Wed, 6 Apr 2022 15:30:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC4DC615D7; Wed, 6 Apr 2022 13:30:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6CAEC385A8; Wed, 6 Apr 2022 13:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649251814; bh=MM+6M5DOoaNLjw14oiuHa/ixVQi9wL338cIpqUZcO8Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OiliKKcVSc0ZszHAOe/ndp9LNMNHRpc+HFdZon/MXld1BmT4e89PHQNmhb174doWu sbN62OpZywLbM2bbP4QUmfSnQEEAgeLTw/S37iI301MOe8vAhau51nbCSJjo2ELxHr PqdcIhbUIlAbnZ0wiys+3/FIHqVXXr/5zsIDerImDB4UFVjR5QoAIiL2aI+ud+9kX9 WIyDIQWtadGPFYCAkyPDdEL8ZWw6sFBBC1nz/gW6FbUXEqk6nIW/CqF/GtYq8xoBbH G/yqOfG7HeDjAXTsMnb0Y+K1FzTDJpT9ESo3+LttMEgOuOitv5jm1zAeXJ5oUIFiwD Zd1VvtiLlg9rA== Received: by pali.im (Postfix) id 33E18775; Wed, 6 Apr 2022 15:30:11 +0200 (CEST) Date: Wed, 6 Apr 2022 15:30:11 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Tom Rini Cc: "Alex G." , Marek =?utf-8?B?QmVow7pu?= , Simon Glass , u-boot@lists.denx.de Subject: Re: [RFC PATCH] RFC: Replace CONFIG_SYS_BAUDRATE_TABLE by board and UART driver rounding functions Message-ID: <20220406133011.rtog35k337tnewsj@pali> References: <20210925121958.26001-1-pali@kernel.org> <20210925135108.GX31748@bill-the-cat> <20210925142313.ym34s6jaja3of42w@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210925142313.ym34s6jaja3of42w@pali> User-Agent: NeoMutt/20180716 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.5 at phobos.denx.de X-Virus-Status: Clean PING. Any progress in this direction? Any comments or objections in this approach? On Saturday 25 September 2021 16:23:13 Pali Rohár wrote: > On Saturday 25 September 2021 09:51:08 Tom Rini wrote: > > On Sat, Sep 25, 2021 at 02:19:58PM +0200, Pali Rohár wrote: > > > > > Add new functions which returns the nearest baudrate and use them instead > > > of hardcoded and incomplete CONFIG_SYS_BAUDRATE_TABLE compile time option. > > > > > > Add implementation of rounding function for serial_mvebu_a3700 driver and > > > also for A3720 Espressobin board which has integrated pl2303 USB<->UART > > > converter, which basically limits baudrates which can user set. > > > > > > Completely remove CONFIG_SYS_BAUDRATE_TABLE defines from all A3720 boards > > > as now with rounding functions it is not used anymore. > > > > > > NOTE: This is just an example how to kill CONFIG_SYS_BAUDRATE_TABLE compile > > > time definitions. I tested it that it works on A3720 Turris Mox board. I > > > have not tested A3720 Espressobin board yet. > > > > > > More discussion on this approach is required, so take this just as RFC > > > change. > > > > > > Signed-off-by: Pali Rohár > > > > Thanks for doing this. My first question is, is this really per-board? > > There is per UART chipset rounding / limitation and this should be > implemented in UART driver (like I did it in serial_mvebu_a3700.c). > > Then there can be per SoC limitation, e.g. SoC has unstable clock source > for high baudrates. Meaning that UART chipset can support higher > baudrates (as exposed by UART driver) but for some reasons they are not > possible on SoC. > > And then there can be really per-board limitations, like it is for > Espressobin board. In most cases SoC has UART pins which people can > connect to other UART device (e.g. to other SoC with UART or to some > universal USB<->UART cables for "computers"). But Espressobin board > has integrated pl2303 chip which is soldered directly to A3720 SoC UART > pins. This pl2303 chip is USB<->UART converter and board itself has just > micro-USB port (which is soldered to this pl2303). So at the end you can > on this board use UART only via that integrated micro-USB port, which > talks with standard USB protocol. > > Therefore on this board you have two limitations for UART baudrates. > First one is exposed by UART SoC chip (serial_mvebu_a3700.c) and second > one is exposed by what that pl2303 supports. And this second limitation > is board specific -- not A3720 SoC. Other boards with A3720 SoC, e.g. > Turris Mox has exposed directly UART pins and you are free to connect > any USB<->UART cable to these pins as you want. > > And this design with soldered USB<->UART chip on the board is not rare. > So U-Boot should have better support for it. > > Note that lot of times clock source for these USB<->UART chips and SoC > UART chip is different (because these USB based chips have its own > clock source). So there are less common supported baudrates which can be > used on the boards. And when talking about high speed baudrates (above > 115200 bauds) then lot of times these "common supported baudrates" are > just non-standard baudrate numbers (e.g. 3 125 000 bauds). Because you > have to choose divisors both both chips to produce baudrate with only > about 2-3% difference. > > > Or per SoC / UART chipset. I would hope for example that for plain old > > ns16550s this would be a generic function, perhaps with an optional > > board call-out for board design limitations. This does feel like a > > reasonable amount of code for platforms like this that were supporting > > what was the maximal rate table before. > > > > -- > > Tom