Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp499492rwe; Fri, 26 Aug 2022 08:48:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR76VCcfO2Ma4mKeLLpbdaJvi53FW1nFsvoZ64fQT048Wo6XyXD+Wm/jNKm6HwGakxjQUfwG X-Received: by 2002:a17:907:94c4:b0:73c:1547:f2f5 with SMTP id dn4-20020a17090794c400b0073c1547f2f5mr5914983ejc.234.1661528912998; Fri, 26 Aug 2022 08:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661528912; cv=none; d=google.com; s=arc-20160816; b=WPWrZMWY8AIXFx/RpUXqPAbmzHx6WC0xGt+uvrx694ak18HcmOBrqxt+B4/LXsUUPi OBgljzBw+5GfFm9YOB3Eazo1psjWbAlDvKhlzBJiB9gM92hLTHmOLy3Ao3emRzP3P1g4 4RtMxuZconnQx31QPga8Butw/N6Wx4fZkdH4i2lsNPLAjwHgE0iZoMPvRjdGhn6bpnNw khtqbUfZQYLJCE4q+NRglCDIxU4GpIyidDIG94fWo2v/YTVDxqKtMwdEKkchAPiosSoo TdISSJ7+dPCXCkRmAM+upQWWvuJR0p3azcbskBDQYq1d7wmx0zZB50ZbGHz3iYSWOCHl nzXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=e6jaOjFBpgR9xO4tqPzgFu2wlQE44tE09/Gb4vXzB34=; b=aagcb6Dzdlgl2tjCOXkvDJ7bMEOoQ0PFu/yq/UnuesFh3MYv98QITaiM05AnyKHKBR IzR3viag64SD2MBqje1oMbAn4643Ny+XfhuA3NAD7qjnfcgGWefRK2r2bDJ609gjhR8Z pUU9iuzG28JG0Kt399rIZrT7ExgwOt8W23SrvOHtAKpBRsytS9sIzUg2eIVRk/MumDjA //uZki0PAljsyRNIsYns4dSwmkDgChBKtt4B7wqedhG5q6RIy4utrJP+D5Y/faqwd6qR acftAZ77fNQDkT4orrtOiLOgumR02aFL6u3B4Re5N4PeLucs5s6W0cuKs5NkJW2/gB4g CubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WvgvXV7F; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b006ff78d48b00si1825852ejt.534.2022.08.26.08.48.07; Fri, 26 Aug 2022 08:48:32 -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=@gmail.com header.s=20210112 header.b=WvgvXV7F; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235523AbiHZPhp (ORCPT + 99 others); Fri, 26 Aug 2022 11:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiHZPho (ORCPT ); Fri, 26 Aug 2022 11:37:44 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A9878580; Fri, 26 Aug 2022 08:37:43 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id h22so1525656qtu.2; Fri, 26 Aug 2022 08:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=e6jaOjFBpgR9xO4tqPzgFu2wlQE44tE09/Gb4vXzB34=; b=WvgvXV7Fla3xt0XKEFci2P0LRVXRyfTe+IZ0O1w7xIrlfqTxZv5ju02530GrSRRAHX 2YcPljebe3Ov4u42Jxif6NwTyVJPYM5Ep7YYL+7ZbMU+gDLeKOlpINY83cdo1FVsAkw/ D+SVT+mXlfV8A+JHq7i136qGgy46C3EXyzchbD17VMSBFqtMF+WvsWwM5ee+VDNWvHNA b9ijgZnSXgYIWK/IMk+TjXDNlTRAq1VSmWRxMxlpqQfv0BG+Mrm3Ze/DR4CbgsGq4+Ad H5yUAG+JkGes+wpJK5iB+ZWFxjNeLpUljl2wr5rRik/f5c0RbT6CnR46elGI0aIG4XSn 2q+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=e6jaOjFBpgR9xO4tqPzgFu2wlQE44tE09/Gb4vXzB34=; b=UN59+U4NAhYfgVS9NFFkiMVqjH8VVQV6RN0VbGuknpHDWllCg7F7929uvo8ktAAbgu c87UORsUJu8RmYjhZ/wBgRwrnfH2bwRT4IcxY2OfB3cq5mnfZcy9lLbMhM8lq820Waa5 8N3U1F/QLUGsee2RBDv7R1CTK9icwDnhyGJvj4K2j8AjcWJYePJRfLtOKU5prbyEwmnT 3wDBjbLC0rP83VYLe63RZIv3JwagXB4y1kcJ0Q/9iiPvdzBDMY79tJF/O+6M/uEea8ty Fkj+OsDxj9LDBfSQKf3WPoqiqafHJ7QKoYdSyIdZbt46X+nxppYoo85oc5EOu72q4At3 X1ww== X-Gm-Message-State: ACgBeo2rI00BLSvVy1tUuUcRcF5IpRSrX5Nb9F9E3aLTS9vjt+ans+UF cwndMddOgRXR3RBZkrwI+edo15ZNdQva59v/UuA= X-Received: by 2002:ac8:7f92:0:b0:344:8cd8:59a1 with SMTP id z18-20020ac87f92000000b003448cd859a1mr265879qtj.384.1661528262405; Fri, 26 Aug 2022 08:37:42 -0700 (PDT) MIME-Version: 1.0 References: <20220823145603.2606475-1-tharunkumar.pasumarthi@microchip.com> <80debd4bbf819cbfa16681172919436df476558a.camel@microchip.com> <787644272b3b260980ff8b9efc317ce3194b0acc.camel@microchip.com> <8f9e8be7084ad78671198f03313058809038a3f8.camel@microchip.com> In-Reply-To: From: Andy Shevchenko Date: Fri, 26 Aug 2022 18:37:06 +0300 Message-ID: Subject: Re: [PATCH RFC i2c-master] i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch To: Tharunkumar.Pasumarthi@microchip.com Cc: Wolfram Sang , Krzysztof Kozlowski , Arnd Bergmann , Sven Peter , Rob Herring , Jan Dabros , Olof Johansson , Jarkko Nikula , Sam Protsenko , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Microchip Linux Driver Support , Linux Kernel Mailing List , linux-i2c Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 On Fri, Aug 26, 2022 at 4:04 PM wrote: > On Fri, 2022-08-26 at 04:00 +0000, Tharunkumar Pasumarthi - I67821 wrote: > > On Thu, 2022-08-25 at 17:22 +0300, Andy Shevchenko wrote: > > > On Thu, Aug 25, 2022 at 01:15:42PM +0000, > > > Tharunkumar.Pasumarthi@microchip.com wrote: > > > > On Wed, 2022-08-24 at 21:31 +0300, Andy Shevchenko wrote: > > > > > On Wed, Aug 24, 2022 at 6:04 PM > > > > > wrote: > > > > > > On Tue, 2022-08-23 at 18:05 +0300, Andy Shevchenko wrote: > > > > > > > On Tue, Aug 23, 2022 at 08:26:03PM +0530, Tharun Kumar P wrote: ... > > > > > > > > +#define SMB_IDLE_SCALING_100KHZ 0x03E803C9 > > > > > > > > +#define SMB_IDLE_SCALING_400KHZ 0x01F4009D > > > > > > > > +#define SMB_IDLE_SCALING_1000KHZ 0x01F4009D > > > > > > > > > > > > > > Shouldn't these magics be decimals? > > > > > > > > > > This Q seems unanswered. > > > > > > > > These magic numbers need not be decimals. Configuring registers with these > > > > values in driver will set the time in device. However, these values do not > > > > convey any meaning when represented in decimals. > > > > > > Hmm... Maybe you don't see this, but I see the following: > > > > > > 0x03E803C9 = 65536 (i.e. 2^16) * 1000 + 969 > > > 0x01F4009D = 32768 (i.e. 2^15) * 1000 + 157 > > > > > > Pretty much sounds like a bit 15 for standard mode and bit 16 for fast modes > > > shifted by 1000 to have a room for the time in presumably nanoseconds up to > > > 1 > > > us. > > > > > > Please, dig up into the documentation, vendor chat, etc to get more > > > information > > > on these values. > > > > I have went through the documentation. > > Following is the bit mapping of idle scaling register: > Reserved [31:28] > Fair Idle Delay [27:16] > Reserved [15:12] > Bus Idle Min [11:0] > > 'Bus Idle Min' field will indicate the number of ticks of the baud clock > required to program 'bus idle period' delay and can have maximum value of 4095. > 'Fair Idle Min' field will indicate the number of ticks of the baud clock > required to program 'fair idle' delay and can have maximum value of 4095. > > So, either the entire IDLE_SCALING_REG value can be in hex or I could do > something like below: No hex. > #define BUS_IDLE_MIN_TICKS > #define FAIR_IDLE_DELAY_TICKS > > #define IDLE_SCALING_REG ((FAIR_IDLE_DELAY_TICKS << 16) | BUS_IDLE_MIN_TICKS) > > Which of these 2 approaches do you feel is better? Of course one with the comment explaining the thing and two decimal numbers. Now, since we know that both values are 1000 and 969 500 and 157 It's easy to see the difference and meaning. So per each mode you need to have those pairs of decimal numbers in ticks. and one comment explaining all what you have explained here in this mail. > > Sure, I will go through the documentation. Thanks. > > Also, I will modify these magic numbers to decimals. -- With Best Regards, Andy Shevchenko