Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5560893rwb; Wed, 7 Sep 2022 04:56:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7aT3xOv7cGC45hB6rDpZzzuhY3PVHsY4gHhruYA7vbqQ1UakriWw3hXyHIYoOVVzU5Hejg X-Received: by 2002:a63:fb4a:0:b0:429:8605:6ebf with SMTP id w10-20020a63fb4a000000b0042986056ebfmr3003082pgj.225.1662551793098; Wed, 07 Sep 2022 04:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662551793; cv=none; d=google.com; s=arc-20160816; b=0GJlcWtHzYmyJym8cD1Y6hI9feuTY8sJLtrkvtOPxZ07uUUPYVFRzQonoIBDN5796T v9tMtt490SUAtauteTk7qJXLK+Z9Qcj5+F4KBp8Ps5mREt4btI9e2RKmofb4DL9jsbWM LF+AFjChpLIp+3YOvtYxYnFSWOaqfqVNrOGKyA6TDUFTck4bDr0oQ2wSesIDMj/6p/5J NDOGDjVyuZxtYkiKVnBNVDeKwfnrdkLt1b54amOYLqEyzpsQzjxddvnPxmCKyofZ8mKu lTC/N8CqWG4iZ8pyExr4/yqVm/5fi4qhd8J7IWNjEy9v7vtiKq6Lpvc/oee1A9gpqDhj godg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Xbed7SeNBtiEz1dFQ9H+u4okIBQ46NJ/CQZSJoc6cO8=; b=EzQihzPS+oa8K31sZeVotGDQo/n4KOSW8+LiI086s60Nco6uRS3+jLyMLWxDQa0eVm Qb59iQ9xdWgHuPO8LMlKWlACKedz5X+NyGzJW2EARYuNFrWNgRM3EwmepFHmGyaMlv2Q QKN4ZEJM/e6VqL4qNoCl6yUtMEocIKgyNRaiOz3gFOC1S7VWGd2sIX20I0+LFJz1qCEG DNdcdPIT7EmF0fyglcFnCX1VRp9R8WrIpn0ZjK2I97EbOwVcBr1j5lfJiTy4LnzRLq6/ RmU9bCXrKsYKzEH3/WTcr43CM8v4OhmUmDzfcL4hr52QvXhcpQPfevPNPe7HSizuTYTt lj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ybwtqw8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi16-20020a17090b4b5000b001f0d1914b69si16758254pjb.9.2022.09.07.04.56.21; Wed, 07 Sep 2022 04:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ybwtqw8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229979AbiIGLaC (ORCPT + 99 others); Wed, 7 Sep 2022 07:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbiIGLaA (ORCPT ); Wed, 7 Sep 2022 07:30:00 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D01A72843; Wed, 7 Sep 2022 04:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662550197; x=1694086197; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=TrnktqRIs+K86T7z1mbr+yegNoYFDmK9/RGPfMKeYaU=; b=Ybwtqw8/9gpk3DwiA2bJfAED9wHEjA0VQhtfGuoRU3mNRwcPwTAJTiA1 EqrVZbHZvQQpCEoRaVs8iuJPxxjdNARmxVFTJ1ix6dhAoIJTvm4eZl/1Z NO5PACLWxYSghiQ4XQhrN/g6ZUFHW8GMvCyFjAHTCDSvUyphk37+yqywl D6mFII7Gh8Zqu7XEgc9W4Hia89x3O88m5vgkgriFGz/QENC9LbSsubmy7 845a2OZWLvfU/sfkHL7wNVV+MpWUIMk5TYB0UOeTm++SfY9kHRtb6BNQJ Xj5/g/vZJPwthIYyytpiZ2RWSQ6VFaGHK0g7xZr5zyRAmFupzwWMt/YME w==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="279859340" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="279859340" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 04:29:56 -0700 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="676146243" Received: from dmatouse-mobl.ger.corp.intel.com ([10.251.223.53]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 04:29:50 -0700 Date: Wed, 7 Sep 2022 14:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Sergiu.Moga@microchip.com cc: lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Claudiu.Beznea@microchip.com, richard.genoud@gmail.com, radu_nicolae.pirea@upb.ro, Greg Kroah-Hartman , broonie@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, Jiri Slaby , admin@hifiphile.com, Kavyasree.Kotagiri@microchip.com, Tudor.Ambarus@microchip.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, LKML , linux-spi@vger.kernel.org, linux-serial , linux-clk@vger.kernel.org Subject: Re: [PATCH v2 12/13] tty: serial: atmel: Make the driver aware of the existence of GCLK In-Reply-To: Message-ID: References: <20220906135511.144725-1-sergiu.moga@microchip.com> <20220906135511.144725-13-sergiu.moga@microchip.com> <3f98d634-789-a0bd-84e-cfc2a1de70af@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-565948247-1662550196=:1717" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-565948247-1662550196=:1717 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 7 Sep 2022, Sergiu.Moga@microchip.com wrote: > On 07.09.2022 12:36, Ilpo Järvinen wrote: > > On Tue, 6 Sep 2022, Sergiu Moga wrote: > > > >> Previously, the atmel serial driver did not take into account the > >> possibility of using the more customizable generic clock as its > >> baudrate generator. Unless there is a Fractional Part available to > >> increase accuracy, there is a high chance that we may be able to > >> generate a baudrate closer to the desired one by using the GCLK as the > >> clock source. Now, depending on the error rate between > >> the desired baudrate and the actual baudrate, the serial driver will > >> fallback on the generic clock. The generic clock must be provided > >> in the DT node of the serial that may need a more flexible clock source. > >> > >> Signed-off-by: Sergiu Moga > >> --- > > Is percent accurate enough or would you perhaps want something slightly > > more accurate? > > > > > It is accurate enough for the all the baudrates I have tested. It > usually taps into the GCLK whenever high baudrates such as 921600 are > used. For 115200 for example, the error rate was slightly better in the > case of the peripheral clock and it acted accordingly, choosing the > latter as its baudrate source clock. I do not think that a higher > accuracy than this would be needed though. Say that using percent > accuracy yields that the error rates are equal, but the gclk would have > been better in this case by, say, a few 10 ^ -4, but the code logic does > not see it so it proceeds using the peripheral clock. In that case, the > error rate of the peripheral clock would still be low enough relative to > the desired baudrate for the communication to function properly. > > The higher the baudrate, the lower the error rate must be in order for > things to go smoothly. For example, for a baudrate of 57600 I noticed > that even an error rate as big as 6% is still enough for the > communication to work properly, while in the case of 921600 anything > bigger than 2% and things do not go smoothly anymore. So I guess that it > would be safe to say that, unless you go for baudrates as high as tens > of millions, things should work well with just percent accuracy. A > higher accuracy always definetely helps, but I believe it is not needed > in this case. > > > > Given you've abs() at the caller side, the error rate could be > > underestimated, is underestimating OK? > > > > > Yes, this should be fine. While (both empirically and after looking > stuff up) I noticed that in the case of negative error rates, their > absolute value needs to be smaller than the one of positive error rates, > it must be so by a very small margin that is negligible when estimating > through percent accuracy. OK. Thanks for checking. -- i. --8323329-565948247-1662550196=:1717--