Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1392446 > unrolled thread

[PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support

Started byMathieu OTHACEHE <m.othacehe@gmail.com>
First post2016-05-02 20:40 +0200
Last post2016-05-04 09:50 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support Mathieu OTHACEHE <m.othacehe@gmail.com> - 2016-05-02 20:40 +0200
    Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0  support Johan Hovold <johan@kernel.org> - 2016-05-03 10:20 +0200
      Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support Mathieu OTHACEHE <m.othacehe@gmail.com> - 2016-05-03 13:50 +0200
        Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0  support Johan Hovold <johan@kernel.org> - 2016-05-04 09:50 +0200

#1392446 — [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support

FromMathieu OTHACEHE <m.othacehe@gmail.com>
Date2016-05-02 20:40 +0200
Subject[PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
Message-ID<ruqVd-dJ-47@gated-at.bofh.it>
Hi Johan,

Thanks for your review.

> Looks like this code could use a few vid/pid temporaries.

> I'm not sure it makes sense to try to load a "ti_usb-v110a-p1150.fw"
> firmware before requesting the moxa firmware. Avoids a confusing:

> usb 1-2.2: Direct firmware load for ti_usb-v110a-p1150.fw failed with error -2

> message too.

I'm not sure to get your point here, shall I rename moxa firmwares in linux-firmware repo
to be compliant with ti_usb-v%04x-p%04x.fw format ?

> I did a quick test of the patch using a Moxa 1150-device. Works at
> 115200, but communication appeared broken at 9600. Looks like the baud
> rate calculations are similar but not identical to what the Moxa driver
> does. Is this something you have looked into?

Well, on my moxa 1110 communication is working at 9600, 115200 and other baud rates.
However, I think baud rate calculation may be wrong for TI3410 chips.

According to table 5-13 in datasheet http://www.ti.com/lit/ds/symlink/tusb3410.pdf
the baud rate calculation formula, is :

baud_rate = 923077 / (desired_baud_rate)

So, we get :

desired_baud = 9600   -> baud_rate = 923077 / 9600 = 96
desired_baud = 115200 -> baud_rate = 923077 / 115200 = 8
...

In ti_usb_3410_5052 driver, the formula used for 3410 is :

baud_rate = (923077 + desired_baud_rate/2) / desired_baud_rate

so,

desired_baud = 9600   -> baud_rate = (923077 + 9600/2) / 9600 = 97 (!= 96)
desired_baud = 115200 -> baud_rate = (923077 + 115200/2) / 115200 = 9 (!= 8)

It seems the formula is wrong but some firmware deal with it anyway.
Should I correct the formula or use a quirk for moxa devices ?

Thank you,

Mathieu

[toc] | [next] | [standalone]


#1393157 — Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support

FromJohan Hovold <johan@kernel.org>
Date2016-05-03 10:20 +0200
SubjectRe: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
Message-ID<ruDIL-4pf-19@gated-at.bofh.it>
In reply to#1392446
On Mon, May 02, 2016 at 08:37:15PM +0200, Mathieu OTHACEHE wrote:
> Hi Johan,
> 
> Thanks for your review.
> 
> > Looks like this code could use a few vid/pid temporaries.
> 
> > I'm not sure it makes sense to try to load a "ti_usb-v110a-p1150.fw"
> > firmware before requesting the moxa firmware. Avoids a confusing:
> 
> > usb 1-2.2: Direct firmware load for ti_usb-v110a-p1150.fw failed with error -2
> 
> > message too.
> 
> I'm not sure to get your point here, shall I rename moxa firmwares in
> linux-firmware repo to be compliant with ti_usb-v%04x-p%04x.fw format ?

No, I was trying to say that the we should not attempt to load a
firmware on the "ti_usb-v%04x-p%04x.fw" format before loading the moxa
firmware.

I guess the moxa firmware names have been chosen by Moxa and it might be
confusing if we renamed them, but that could be an option too.

> > I did a quick test of the patch using a Moxa 1150-device. Works at
> > 115200, but communication appeared broken at 9600. Looks like the baud
> > rate calculations are similar but not identical to what the Moxa driver
> > does. Is this something you have looked into?
> 
> Well, on my moxa 1110 communication is working at 9600, 115200 and
> other baud rates.

I must have messed something up in my test, as now 9600 seems to work.

> However, I think baud rate calculation may be wrong for TI3410 chips.
> 
> According to table 5-13 in datasheet http://www.ti.com/lit/ds/symlink/tusb3410.pdf
> the baud rate calculation formula, is :
> 
> baud_rate = 923077 / (desired_baud_rate)
> 
> So, we get :
> 
> desired_baud = 9600   -> baud_rate = 923077 / 9600 = 96
> desired_baud = 115200 -> baud_rate = 923077 / 115200 = 8
> ...
> 
> In ti_usb_3410_5052 driver, the formula used for 3410 is :
> 
> baud_rate = (923077 + desired_baud_rate/2) / desired_baud_rate
> 
> so,
> 
> desired_baud = 9600   -> baud_rate = (923077 + 9600/2) / 9600 = 97 (!= 96)
> desired_baud = 115200 -> baud_rate = (923077 + 115200/2) / 115200 = 9 (!= 8)
> 
> It seems the formula is wrong but some firmware deal with it anyway.
> Should I correct the formula or use a quirk for moxa devices ?

No, that's just integer-division with rounding. Remember that the
divisions above are integer divisions so the results are actually 96 and
8 as expected.

Thanks,
Johan

[toc] | [prev] | [next] | [standalone]


#1393353

FromMathieu OTHACEHE <m.othacehe@gmail.com>
Date2016-05-03 13:50 +0200
Message-ID<ruGZZ-7ro-17@gated-at.bofh.it>
In reply to#1393157
> No, I was trying to say that the we should not attempt to load a
> firmware on the "ti_usb-v%04x-p%04x.fw" format before loading the moxa
> firmware.

For MTS devices (mts_*.fw) and for devices using generic firmware (ti_3410.fw
and ti_5052.fw), ti_usb-v%04x-p%04x.fw loading is already failing.

So, I can patch the driver to request firmwares in this order :

1. VID dependant (MTS and MOXA now)
2. ti_usb-v%04x-p%04x.fw format
3. Generic firmware

But, for generic firmware users, ti_usb-v%04x-p%04x.fw loading will
still always fail ...

Or we can get rid of ti_usb-v%04x-p%04x.fw loading because no one has
defined a firmware with this format in linux-firmware repository ?

> No, that's just integer-division with rounding. Remember that the
> divisions above are integer divisions so the results are actually 96 and
> 8 as expected.

You're right, sorry !

Thank you,

Mathieu

[toc] | [prev] | [next] | [standalone]


#1394066 — Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support

FromJohan Hovold <johan@kernel.org>
Date2016-05-04 09:50 +0200
SubjectRe: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
Message-ID<ruZJf-8aG-11@gated-at.bofh.it>
In reply to#1393353
On Tue, May 03, 2016 at 01:46:51PM +0200, Mathieu OTHACEHE wrote:
> > No, I was trying to say that the we should not attempt to load a
> > firmware on the "ti_usb-v%04x-p%04x.fw" format before loading the moxa
> > firmware.
> 
> For MTS devices (mts_*.fw) and for devices using generic firmware (ti_3410.fw
> and ti_5052.fw), ti_usb-v%04x-p%04x.fw loading is already failing.
> 
> So, I can patch the driver to request firmwares in this order :
> 
> 1. VID dependant (MTS and MOXA now)
> 2. ti_usb-v%04x-p%04x.fw format
> 3. Generic firmware
> 
> But, for generic firmware users, ti_usb-v%04x-p%04x.fw loading will
> still always fail ...
> 
> Or we can get rid of ti_usb-v%04x-p%04x.fw loading because no one has
> defined a firmware with this format in linux-firmware repository ?

Let's try to be conservative and not necessarily change the current
behaviour right away. Just make sure the Moxa firmware is loaded
directly, without fallback, and we can see about possibly cleaning up
the legacy behaviour later (in incremental patches that can easily be
reverted if anyone complains).

Thanks,
Johan

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web