Re: [PATCH] i2c: aspeed: Improve driver to support multi-master use cases stably

From: Brendan Higgins
Date: Thu Jul 19 2018 - 12:58:42 EST


On Sun, Jul 15, 2018 at 8:05 PM Gary Hsu <gary_hsu@xxxxxxxxxxxxxx> wrote:
>
> Hi Jae,
>
> In originally, we reserved these register bits for debug purpose. But for some error handling case, we found it is also useful to help to clarify some error conditions. So driver also can use these fields information to check something.
> As for how driver use these information in their code, I have no comment. I donât understand the driver. But these information is the real controller state, it had no problem to use information.

Okay, so it was originally only intended for debugging, but then showed itself
to be useful, got it. Just out of curiosity, why did you mark it that way in
the documentation? It seems as though you are trying to discourage people from
using it.

>
> Best Regards,
>
> èéç Gary Hsu
>
> äéçæèäæéåå
> ASPEED Technology Inc.
>
> 2F,No.15,Industry East Road 4.,Hsinchu Science Park, Hsinchu City 30077, Taiwan
> æççååååææåè 15 è 2F
>
> Tel : 886-3-5789568 ext:807
> Fax : 886-3-5789586
> Web : http://www.aspeedtech.com
>
> ************* Email Confidentiality Notice ********************
> åèèæ:
> åæåäèæäèææè,æää(æåéä)åèååæåèèïäåæåäèãå åçéæåäæäèïèäéåéäéçæéåéääçéè, äèçååéæéåéäååéäåéæææèåäãèèæçåä!
>
> DISCLAIMER:
> This message (and any attachments) may contain legally privileged and/or other confidential information. If you have received it in error, please notify the sender by reply e-mail and immediately delete the e-mail and any attachments without copying or disclosing the contents. Thank you.
>
> -----Original Message-----
> From: Jae Hyun Yoo [mailto:jae.hyun.yoo@xxxxxxxxxxxxxxx]
> Sent: Saturday, July 14, 2018 2:54 AM
> To: Brendan Higgins <brendanhiggins@xxxxxxxxxx>
> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>; Joel Stanley <joel@xxxxxxxxx>; Andrew Jeffery <andrew@xxxxxxxx>; linux-i2c@xxxxxxxxxxxxxxx; OpenBMC Maillist <openbmc@xxxxxxxxxxxxxxxx>; Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>; linux-aspeed@xxxxxxxxxxxxxxxx; Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>; james.feist@xxxxxxxxxxxxxxx; vernon.mauery@xxxxxxxxxxxxxxx; Benjamin Fair <benjaminfair@xxxxxxxxxx>; Patrick Venture <venture@xxxxxxxxxx>; Gary Hsu <gary_hsu@xxxxxxxxxxxxxx>; Ryan Chen <ryan_chen@xxxxxxxxxxxxxx>
> Subject: Re: [PATCH] i2c: aspeed: Improve driver to support multi-master use cases stably
>
> On 7/13/2018 11:12 AM, Brendan Higgins wrote:
> > On Fri, Jul 13, 2018 at 10:22 AM Jae Hyun Yoo
> > <jae.hyun.yoo@xxxxxxxxxxxxxxx> wrote:
> >>
> >> On 7/12/2018 11:21 AM, Jae Hyun Yoo wrote:
> >>> On 7/12/2018 2:33 AM, Brendan Higgins wrote:
> >>>> On Wed, Jun 27, 2018 at 10:55 AM Jae Hyun Yoo
> >>>> <jae.hyun.yoo@xxxxxxxxxxxxxxx> wrote:
> > <snip>
> >>>> <snip>
> >>>>>>> + for (;;) {
> >>>>>>> + if (!(readl(bus->base + ASPEED_I2C_CMD_REG) &
> >>>>>>> + (ASPEED_I2CD_BUS_BUSY_STS |
> >>>>>>> + ASPEED_I2CD_XFER_MODE_STS_MASK)))
> >>>>>>
> >>>>>> Is using the Transfer Mode State Machine bits necessary? The
> >>>>>> documentation marks it as "for debugging purpose only," so
> >>>>>> relying on it makes me nervous.
> >>>>>>
> >>>>>
> >>>>> As you said, the documentation marks it as "for debugging purpose only."
> >>>>> but ASPEED also uses this way in their SDK code because it's the
> >>>>> best way for checking bus busy status which can cover both single
> >>>>> and multi-master use cases.
> >>>>>
> >>>>
> >>>> Well, it would also be really nice to have access to this bit if
> >>>> someone wants to implement MCTP. Could we maybe check with Aspeed
> >>>> what them meant by "for debugging purposes only" and document it
> >>>> here? It makes me nervous to rely on debugging functionality for
> >>>> normal usage.
> >>>>
> >>>
> >>> Okay, I'll check it with Aspeed. Will let you know their response.
> >>>
> >>
> >> I've checked it with Gary Hsu <gary_hsu@xxxxxxxxxxxxxx> and he
> >> confirmed that the bits reflect real information and good to be used
> >> in practical code.
> >
> > Huh. For my own edification, could you ask them why they said "for
> > debugging purpose only" in the documentation? I am just really curious
> > what they meant by that. I would be satisfied if you just CC'ed me on
> > your email thread with Gary, and I can ask him myself.
> >
>
> I've already CC'ed Gary and Ryan in this thread.
>
> Hi Gary,
>
> Can you explain why the documentation says that the bit field is 'for debugging purpose only'? Any plan to change the description?
>
> Thanks,
>
> Jae
>
> >>
> >> I'll add a comment like below:
> >>
> >> /*
> >> * This is marked as 'for debugging purpose only' in datasheet but
> >> * ASPEED confirmed that this reflects real information and good
> >> * to be used in practical code.
> >> */
> >>
> >> Is it acceptable then?
> >
> > Yeah, that's fine.
> >
> > <snip>
> >
> > Cheers
> >