linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yasushi SHOJI <yasushi.shoji@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "Remigiusz Kołłątaj" <remigiusz.kollataj@mobica.com>,
	"Yasushi SHOJI" <yashi@spacecubics.com>,
	"Wolfgang Grandegger" <wg@grandegger.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] can: mcba_usb: Fix termination command argument
Date: Thu, 24 Nov 2022 18:50:52 +0900	[thread overview]
Message-ID: <CAELBRWJoQjLD9UaFUmqnFWT9HkPMNb4kKF+1EZwcfrn_WBwBYw@mail.gmail.com> (raw)
In-Reply-To: <20221123223410.sg2ixkaqg4dpe7ew@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2753 bytes --]

Hi,

On Thu, Nov 24, 2022 at 7:34 AM Marc Kleine-Budde <mkl@pengutronix.de> wrote:
>
> Let's take the original driver author into the loop.
>
> On 24.11.2022 04:44:06, Yasushi SHOJI wrote:
> > Microchip USB Analyzer can be set with termination setting ON or OFF.
> > As I've observed, both with my oscilloscope and USB packet capture
> > below, you must send "0" to turn it ON, and "1" to turn it OFF.
> >
> > Reverse the argument value to fix this.
> >
> > These are the two commands sequence, ON then OFF.
> >
> > > No.     Time           Source                Destination           Protocol Length Info
> > >       1 0.000000       host                  1.3.1                 USB      46     URB_BULK out
> > >
> > > Frame 1: 46 bytes on wire (368 bits), 46 bytes captured (368 bits)
> > > USB URB
> > > Leftover Capture Data: a80000000000000000000000000000000000a8
> > >
> > > No.     Time           Source                Destination           Protocol Length Info
> > >       2 4.372547       host                  1.3.1                 USB      46     URB_BULK out
> > >
> > > Frame 2: 46 bytes on wire (368 bits), 46 bytes captured (368 bits)
> > > USB URB
> > > Leftover Capture Data: a80100000000000000000000000000000000a9
>
> Is this the USB data after applying the patch?

That's not from Linux.

> Can you measure the resistance between CAN-H and CAN-L to verify that
> your patch fixes the problem?

Sure.  The command I'm using on my Linux is:

    sudo ip link set can0 up type can bitrate 100000 termination X

where X is either 0 or 120.

With Debian Sid stock kernel: linux-image-6.0.0-4-amd64
  - termination 0: 135.4 Ohms
  - termination 120: 17.82 Ohms

With my patch on v6.1-rc6
  - termination 0: 22.20 Ohms
  - termination 120: 134.2 Ohms

> > Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
> > ---
> >  drivers/net/can/usb/mcba_usb.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
> > index 218b098b261d..67beff1a3876 100644
> > --- a/drivers/net/can/usb/mcba_usb.c
> > +++ b/drivers/net/can/usb/mcba_usb.c
> > @@ -785,9 +785,9 @@ static int mcba_set_termination(struct net_device *netdev, u16 term)
> >       };
> >
> >       if (term == MCBA_TERMINATION_ENABLED)
> > -             usb_msg.termination = 1;
> > -     else
> >               usb_msg.termination = 0;
> > +     else
> > +             usb_msg.termination = 1;
> >
> >       mcba_usb_xmit_cmd(priv, (struct mcba_usb_msg *)&usb_msg);
>
> What about the static void mcba_usb_process_ka_usb() function? Do you
> need to convert this, too?

Ah, yes. Thanks.
Attaching a compressed patch.

Let me know if I need to resend it as an email.

Best,
--
          yashi

[-- Attachment #2: 0001-can-mcba_usb-Fix-termination-command-argument.patch.gz --]
[-- Type: application/gzip, Size: 995 bytes --]

  reply	other threads:[~2022-11-24  9:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 19:44 [PATCH] can: mcba_usb: Fix termination command argument Yasushi SHOJI
2022-11-23 22:34 ` Marc Kleine-Budde
2022-11-24  9:50   ` Yasushi SHOJI [this message]
2022-11-24  0:53 ` Vincent Mailhol
2022-11-24  9:52   ` Yasushi SHOJI
2022-11-24  9:54     ` Vincent Mailhol
2022-11-24 14:38     ` Marc Kleine-Budde

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=CAELBRWJoQjLD9UaFUmqnFWT9HkPMNb4kKF+1EZwcfrn_WBwBYw@mail.gmail.com \
    --to=yasushi.shoji@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=remigiusz.kollataj@mobica.com \
    --cc=wg@grandegger.com \
    --cc=yashi@spacecubics.com \
    /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).