linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Tharunkumar.Pasumarthi@microchip.com>
To: <andy.shevchenko@gmail.com>
Cc: <wsa@kernel.org>, <krzk@kernel.org>,
	<linux-kernel@vger.kernel.org>, <sven@svenpeter.dev>,
	<robh@kernel.org>, <jarkko.nikula@linux.intel.com>,
	<arnd@arndb.de>, <jsd@semihalf.com>, <olof@lixom.net>,
	<rafal@milecki.pl>, <UNGLinuxDriver@microchip.com>,
	<semen.protsenko@linaro.org>, <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH RFC i2c-master] i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch
Date: Mon, 29 Aug 2022 03:00:21 +0000	[thread overview]
Message-ID: <914e31e65fe3dcc36d47be8eb4d14c8b4c255904.camel@microchip.com> (raw)
In-Reply-To: <CAHp75VcUKeRhh40dB4Lqh=TE93GhfzaBJ-3uDWrJedDTGLa5vQ@mail.gmail.com>

On Fri, 2022-08-26 at 18:37 +0300, Andy Shevchenko wrote:
> On Fri, Aug 26, 2022 at 4:04 PM <Tharunkumar.Pasumarthi@microchip.com> 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
> > > > > > <Tharunkumar.Pasumarthi@microchip.com>
> > > > > > 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     <VALUE_IN_DECIMAL>
> > #define FAIR_IDLE_DELAY_TICKS  <VALUE_IN_DECIMAL>
> > 
> > #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.

Okay. I will follow this approach.


Thanks,
Tharun Kumar P

      reply	other threads:[~2022-08-29  3:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 14:56 [PATCH RFC i2c-master] i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch Tharun Kumar P
2022-08-23 10:31 ` Krzysztof Kozlowski
2022-08-24 13:48   ` Tharunkumar.Pasumarthi
2022-08-30 14:21   ` Tharunkumar.Pasumarthi
2022-08-23 11:48 ` Christophe JAILLET
2022-08-24 13:52   ` Tharunkumar.Pasumarthi
2022-08-30 14:25   ` Tharunkumar.Pasumarthi
2022-08-23 15:05 ` Andy Shevchenko
2022-08-24 14:38   ` Tharunkumar.Pasumarthi
2022-08-24 18:31     ` Andy Shevchenko
2022-08-25 13:15       ` Tharunkumar.Pasumarthi
2022-08-25 14:22         ` Andy Shevchenko
2022-08-26  4:00           ` Tharunkumar.Pasumarthi
2022-08-26 13:03             ` Tharunkumar.Pasumarthi
2022-08-26 15:37               ` Andy Shevchenko
2022-08-29  3:00                 ` Tharunkumar.Pasumarthi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=914e31e65fe3dcc36d47be8eb4d14c8b4c255904.camel@microchip.com \
    --to=tharunkumar.pasumarthi@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=krzk@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=rafal@milecki.pl \
    --cc=robh@kernel.org \
    --cc=semen.protsenko@linaro.org \
    --cc=sven@svenpeter.dev \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).