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 98A79C433F5 for ; Wed, 6 Apr 2022 13:32:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E37883D2F; Wed, 6 Apr 2022 15:32:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="SrzWTEqw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C4DC283D2A; Wed, 6 Apr 2022 15:32:45 +0200 (CEST) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EA98B83D2A for ; Wed, 6 Apr 2022 15:32:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x835.google.com with SMTP id c4so4291635qtx.1 for ; Wed, 06 Apr 2022 06:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BvQxiFVMbuv3MHVsmMs8Zbl/LuP2L67C+js2tsJ34sg=; b=SrzWTEqw1uPQUTQ8KpwbckZ0Of6JKQzi0PB/+aK+gwaDoPdY95FZ3fVGRSvD/8FLxL xnQOGasyBYb5i2MjJyy1osHrTDJPj5NRsoD91JRYbwtwB5oJY6crzcdgl9QD95vyh8Lg +XmUdCw73IrENgBEpJezhmMbHopnANsebMLGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BvQxiFVMbuv3MHVsmMs8Zbl/LuP2L67C+js2tsJ34sg=; b=BweqjZawou+CsNvEZBFJ4TKwnhVBewMTYdzq8UEO8c/CYHhuQNwKBijj+smN2vXcye R3mqAPHUetXXoiVP6ix6bK13mNxXcbFe/0YGF7qWqOe9TSFj/rlq+ippUZoUQGH5YwyN 8vfNqclKqnD2sYtZE5CvkY3sWrAdHlbIu2qSUV296i/RnBhfgt1HHanHr3sYTnD5vYvH cHQFhzbTWbRy2Yh+X35kpjZw3DiUOxKIKzWFhzLt3F8Z/GCW7DiheY6Noh5FAe8Ci1Cl M+pQQm2s/il++yfyLaMlDTc3fUZRQ6LJETvDCtuYroy/pAoizsX7QoykdF7Ls1sD0tDy JUng== X-Gm-Message-State: AOAM532xIuttcVgmlYZZJxDDygHYiPH313Nn7in5DHOeqUsg2aXYyhNt qlEJnjS1xv9W4HYFlXNGfWKyjQ== X-Google-Smtp-Source: ABdhPJzTYNEIxQsN9XjUBpJAvhZ9hrFu1sPUNszOA+Iavzv4M1U1XewdQ4El3XBdMauViv4c9v6swQ== X-Received: by 2002:ae9:e20f:0:b0:67d:2e50:1774 with SMTP id c15-20020ae9e20f000000b0067d2e501774mr5640770qkc.430.1649251958711; Wed, 06 Apr 2022 06:32:38 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id r11-20020ae9d60b000000b0067e5308d664sm10369769qkk.92.2022.04.06.06.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:32:38 -0700 (PDT) Date: Wed, 6 Apr 2022 09:32:36 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: "Alex G." , Marek =?iso-8859-1?Q?Beh=FAn?= , 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: <20220406133236.GA14282@bill-the-cat> References: <20210925121958.26001-1-pali@kernel.org> <20210925135108.GX31748@bill-the-cat> <20210925142313.ym34s6jaja3of42w@pali> <20220406133011.rtog35k337tnewsj@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: <20220406133011.rtog35k337tnewsj@pali> X-Clacks-Overhead: GNU Terry Pratchett 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 --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 06, 2022 at 03:30:11PM +0200, Pali Roh=E1r wrote: > PING. Any progress in this direction? Any comments or objections in this = approach? I keep meaning to reply to this. I think this is the right direction, I'd just like to see it implemented for some other UARTs as well, and this hasn't re-appeared at the top of my CONFIG migrate list yet. >=20 > On Saturday 25 September 2021 16:23:13 Pali Roh=E1r wrote: > > On Saturday 25 September 2021 09:51:08 Tom Rini wrote: > > > On Sat, Sep 25, 2021 at 02:19:58PM +0200, Pali Roh=E1r wrote: > > >=20 > > > > Add new functions which returns the nearest baudrate and use them i= nstead > > > > of hardcoded and incomplete CONFIG_SYS_BAUDRATE_TABLE compile time = option. > > > >=20 > > > > Add implementation of rounding function for serial_mvebu_a3700 driv= er and > > > > also for A3720 Espressobin board which has integrated pl2303 USB<->= UART > > > > converter, which basically limits baudrates which can user set. > > > >=20 > > > > Completely remove CONFIG_SYS_BAUDRATE_TABLE defines from all A3720 = boards > > > > as now with rounding functions it is not used anymore. > > > >=20 > > > > 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 boa= rd. I > > > > have not tested A3720 Espressobin board yet. > > > >=20 > > > > More discussion on this approach is required, so take this just as = RFC > > > > change. > > > >=20 > > > > Signed-off-by: Pali Roh=E1r > > >=20 > > > Thanks for doing this. My first question is, is this really per-boar= d? > >=20 > > There is per UART chipset rounding / limitation and this should be > > implemented in UART driver (like I did it in serial_mvebu_a3700.c). > >=20 > > 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. > >=20 > > 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. > >=20 > > 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. > >=20 > > And this design with soldered USB<->UART chip on the board is not rare. > > So U-Boot should have better support for it. > >=20 > > 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. > >=20 > > > Or per SoC / UART chipset. I would hope for example that for plain o= ld > > > 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. > > >=20 > > > --=20 > > > Tom --=20 Tom --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmJNlm0ACgkQFHw5/5Y0 tyzD8Qv9GSFygXzCflcz3IgmdG7cZqp9L09oefLPYabPBHSWsQXCLU8DUTgKHO9f g9zbjZqmLD+DhJyAVBW4RZvJpWTnnnDKRV7KzE1AoV+rGaSlQMbARUGJXLMYPaCA WIwBJcwlimKlVkZ2DdNXPX+i1C29gydmFTuHoSFG/6fBqgRXOiJeGFYDTDJQgzRi N2nrP7YFiMmKDD0NrNF6sLf+ASxGlNB86OaEB++WE25XAHLtLunD3TpcTt5LKeOG o2RUF8kD5i5utl9GkAtZJ2L2t7T23paCKW0/lhP4bYttd1ozUWAklqyvOEQsxwkH NTMvbZ2huCo47nVTsh3mEP7sDUaBmtR7PmpCG9gfbjxT0sRksGHXYRl1XhVa6TGo hKiHvHRhhcIU04RzHcb9bqSn4cjzT1DqwJr0a/fv7XVQYzZ17uO/yAbd42jOTYJ4 e+DQ2h38bj0zMQtNkZ0J9hMM7hK43yOz8RuYVbV5D/1qufmTpfRCAYkQ6z5n3ae2 M/MkH2YJ =iCgf -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--