* [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
[not found] <20160502180407.GA4330@gmail.com>
@ 2016-05-02 18:37 ` Mathieu OTHACEHE
2016-05-03 8:14 ` Johan Hovold
0 siblings, 1 reply; 6+ messages in thread
From: Mathieu OTHACEHE @ 2016-05-02 18:37 UTC (permalink / raw)
To: johan; +Cc: Johan Hovold, Greg Kroah-Hartman, linux-usb, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
2016-05-02 18:37 ` [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support Mathieu OTHACEHE
@ 2016-05-03 8:14 ` Johan Hovold
2016-05-03 11:46 ` Mathieu OTHACEHE
0 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2016-05-03 8:14 UTC (permalink / raw)
To: Mathieu OTHACEHE; +Cc: johan, Greg Kroah-Hartman, linux-usb, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
2016-05-03 8:14 ` Johan Hovold
@ 2016-05-03 11:46 ` Mathieu OTHACEHE
2016-05-04 7:40 ` Johan Hovold
0 siblings, 1 reply; 6+ messages in thread
From: Mathieu OTHACEHE @ 2016-05-03 11:46 UTC (permalink / raw)
To: Johan Hovold
Cc: Mathieu OTHACEHE, Greg Kroah-Hartman, linux-usb, linux-kernel
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
2016-05-03 11:46 ` Mathieu OTHACEHE
@ 2016-05-04 7:40 ` Johan Hovold
0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2016-05-04 7:40 UTC (permalink / raw)
To: Mathieu OTHACEHE
Cc: Johan Hovold, Greg Kroah-Hartman, linux-usb, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
@ 2016-03-02 9:46 Mathieu OTHACEHE
2016-04-24 15:59 ` Johan Hovold
0 siblings, 1 reply; 6+ messages in thread
From: Mathieu OTHACEHE @ 2016-03-02 9:46 UTC (permalink / raw)
To: johan, gregkh; +Cc: linux-usb, linux-kernel, Mathieu OTHACEHE
Add support for :
- UPort 1110 : 1 port RS-232 USB to Serial Hub.
- UPort 1130 : 1 port RS-422/485 USB to Serial Hub.
- UPort 1130I : 1 port RS-422/485 USB to Serial Hub with Isolation.
- UPort 1150 : 1 port RS-232/422/485 USB to Serial Hub.
- UPort 1150I : 1 port RS-232/422/485 USB to Serial Hub with Isolation.
These devices are based on TI 3410 chip.
Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
---
Hi,
This patch add support for MOXA UPORT 11x0 devices to ti_usb_3410_5052.
The informations are extracted from the now reverted mxu11x0 driver.
There is a delicate point in the attach callback.
The driver is comparing bNumConfigurations to 1 to see if the firmware
has to be downloaded. I guess bNumConfigurations is 2 after firmware download
and device reseting.
On MOXA 1110, bNumConfigurations is always 1, before and after firmware download.
So, I also check that the interface has only 1 endpoint to determine if we have
to download firmware or not.
Thanks,
Mathieu
drivers/usb/serial/ti_usb_3410_5052.c | 44 ++++++++++++++++++++++++++++++++---
drivers/usb/serial/ti_usb_3410_5052.h | 8 +++++++
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 2694df2..b9119de 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -80,6 +80,7 @@ struct ti_device {
int td_open_port_count;
struct usb_serial *td_serial;
int td_is_3410;
+ int td_model;
int td_urb_error;
};
@@ -160,6 +161,11 @@ static const struct usb_device_id ti_id_table_3410[] = {
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
{ USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1110_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1130_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
{ } /* terminator */
};
@@ -193,6 +199,11 @@ static const struct usb_device_id ti_id_table_combined[] = {
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
{ USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1110_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1130_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
+ { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
{ } /* terminator */
};
@@ -277,6 +288,11 @@ MODULE_FIRMWARE("mts_gsm.fw");
MODULE_FIRMWARE("mts_edge.fw");
MODULE_FIRMWARE("mts_mt9234mu.fw");
MODULE_FIRMWARE("mts_mt9234zba.fw");
+MODULE_FIRMWARE("moxa/moxa-1110.fw");
+MODULE_FIRMWARE("moxa/moxa-1130.fw");
+MODULE_FIRMWARE("moxa/moxa-1131.fw");
+MODULE_FIRMWARE("moxa/moxa-1150.fw");
+MODULE_FIRMWARE("moxa/moxa-1151.fw");
module_param(closing_wait, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(closing_wait,
@@ -292,6 +308,7 @@ static int ti_startup(struct usb_serial *serial)
{
struct ti_device *tdev;
struct usb_device *dev = serial->dev;
+ struct usb_host_interface *cur_altsetting;
int status;
dev_dbg(&dev->dev,
@@ -315,8 +332,13 @@ static int ti_startup(struct usb_serial *serial)
dev_dbg(&dev->dev, "%s - device type is %s\n", __func__,
tdev->td_is_3410 ? "3410" : "5052");
- /* if we have only 1 configuration, download firmware */
- if (dev->descriptor.bNumConfigurations == 1) {
+ tdev->td_model = le16_to_cpu(dev->descriptor.idProduct);
+
+ cur_altsetting = serial->interface->cur_altsetting;
+
+ /* if we have only 1 configuration and 1 endpoint, download firmware */
+ if (dev->descriptor.bNumConfigurations == 1 &&
+ cur_altsetting->desc.bNumEndpoints == 1) {
status = ti_download_firmware(tdev);
if (status != 0)
@@ -371,7 +393,15 @@ static int ti_port_probe(struct usb_serial_port *port)
port->port.closing_wait = msecs_to_jiffies(10 * closing_wait);
tport->tp_port = port;
tport->tp_tdev = usb_get_serial_data(port->serial);
- tport->tp_uart_mode = 0; /* default is RS232 */
+
+ switch (tport->tp_tdev->td_model) {
+ case MXU1_1130_PRODUCT_ID:
+ case MXU1_1131_PRODUCT_ID:
+ tport->tp_uart_mode = TI_UART_485_RECEIVER_DISABLED;
+ break;
+ default:
+ tport->tp_uart_mode = TI_UART_232; /* default is RS232 */
+ }
usb_set_serial_port_data(port, tport);
@@ -1479,6 +1509,14 @@ static int ti_download_firmware(struct ti_device *tdev)
strcpy(buf, "mts_mt9234zba.fw");
break; }
}
+
+ if (le16_to_cpu(dev->descriptor.idVendor) == MXU1_VENDOR_ID) {
+ snprintf(buf,
+ sizeof(buf),
+ "moxa/moxa-%04x.fw",
+ le16_to_cpu(dev->descriptor.idProduct));
+ }
+
if (buf[0] == '\0') {
if (tdev->td_is_3410)
strcpy(buf, "ti_3410.fw");
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index 98f35c6..93ac6ad 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -60,6 +60,14 @@
#define HONEYWELL_VENDOR_ID 0x10ac
#define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */
+/* Moxa UPORT 11x0 vendor and product IDs */
+#define MXU1_VENDOR_ID 0x110a
+#define MXU1_1110_PRODUCT_ID 0x1110
+#define MXU1_1130_PRODUCT_ID 0x1130
+#define MXU1_1150_PRODUCT_ID 0x1150
+#define MXU1_1151_PRODUCT_ID 0x1151
+#define MXU1_1131_PRODUCT_ID 0x1131
+
/* Commands */
#define TI_GET_VERSION 0x01
#define TI_GET_PORT_STATUS 0x02
--
2.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
2016-03-02 9:46 Mathieu OTHACEHE
@ 2016-04-24 15:59 ` Johan Hovold
0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2016-04-24 15:59 UTC (permalink / raw)
To: Mathieu OTHACEHE; +Cc: johan, gregkh, linux-usb, linux-kernel
On Wed, Mar 02, 2016 at 10:46:13AM +0100, Mathieu OTHACEHE wrote:
> Add support for :
>
> - UPort 1110 : 1 port RS-232 USB to Serial Hub.
> - UPort 1130 : 1 port RS-422/485 USB to Serial Hub.
> - UPort 1130I : 1 port RS-422/485 USB to Serial Hub with Isolation.
> - UPort 1150 : 1 port RS-232/422/485 USB to Serial Hub.
> - UPort 1150I : 1 port RS-232/422/485 USB to Serial Hub with Isolation.
>
> These devices are based on TI 3410 chip.
>
> Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
> ---
Thanks for the patch and sorry for the late review.
> This patch add support for MOXA UPORT 11x0 devices to ti_usb_3410_5052.
> The informations are extracted from the now reverted mxu11x0 driver.
>
> There is a delicate point in the attach callback.
> The driver is comparing bNumConfigurations to 1 to see if the firmware
> has to be downloaded. I guess bNumConfigurations is 2 after firmware download
> and device reseting.
>
> On MOXA 1110, bNumConfigurations is always 1, before and after firmware download.
> So, I also check that the interface has only 1 endpoint to determine if we have
> to download firmware or not.
That sounds reasonable.
> drivers/usb/serial/ti_usb_3410_5052.c | 44 ++++++++++++++++++++++++++++++++---
> drivers/usb/serial/ti_usb_3410_5052.h | 8 +++++++
> 2 files changed, 49 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
> index 2694df2..b9119de 100644
> --- a/drivers/usb/serial/ti_usb_3410_5052.c
> +++ b/drivers/usb/serial/ti_usb_3410_5052.c
> @@ -80,6 +80,7 @@ struct ti_device {
> int td_open_port_count;
> struct usb_serial *td_serial;
> int td_is_3410;
> + int td_model;
> int td_urb_error;
> };
>
> @@ -160,6 +161,11 @@ static const struct usb_device_id ti_id_table_3410[] = {
> { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
> { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
> { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1110_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1130_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
Keep these sorted internally at least.
> { } /* terminator */
> };
>
> @@ -193,6 +199,11 @@ static const struct usb_device_id ti_id_table_combined[] = {
> { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
> { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
> { USB_DEVICE(HONEYWELL_VENDOR_ID, HONEYWELL_HGI80_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1110_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1130_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
> + { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
Ditto.
> { } /* terminator */
> };
>
> @@ -277,6 +288,11 @@ MODULE_FIRMWARE("mts_gsm.fw");
> MODULE_FIRMWARE("mts_edge.fw");
> MODULE_FIRMWARE("mts_mt9234mu.fw");
> MODULE_FIRMWARE("mts_mt9234zba.fw");
> +MODULE_FIRMWARE("moxa/moxa-1110.fw");
> +MODULE_FIRMWARE("moxa/moxa-1130.fw");
> +MODULE_FIRMWARE("moxa/moxa-1131.fw");
> +MODULE_FIRMWARE("moxa/moxa-1150.fw");
> +MODULE_FIRMWARE("moxa/moxa-1151.fw");
>
> module_param(closing_wait, int, S_IRUGO | S_IWUSR);
> MODULE_PARM_DESC(closing_wait,
> @@ -292,6 +308,7 @@ static int ti_startup(struct usb_serial *serial)
> {
> struct ti_device *tdev;
> struct usb_device *dev = serial->dev;
> + struct usb_host_interface *cur_altsetting;
> int status;
>
> dev_dbg(&dev->dev,
> @@ -315,8 +332,13 @@ static int ti_startup(struct usb_serial *serial)
> dev_dbg(&dev->dev, "%s - device type is %s\n", __func__,
> tdev->td_is_3410 ? "3410" : "5052");
>
> - /* if we have only 1 configuration, download firmware */
> - if (dev->descriptor.bNumConfigurations == 1) {
> + tdev->td_model = le16_to_cpu(dev->descriptor.idProduct);
Instead of storing the model (which really is the vid-dependent pid),
just set an rs485-only flag when you detect a Moxa 1130/1131 here.
> + cur_altsetting = serial->interface->cur_altsetting;
> +
> + /* if we have only 1 configuration and 1 endpoint, download firmware */
> + if (dev->descriptor.bNumConfigurations == 1 &&
> + cur_altsetting->desc.bNumEndpoints == 1) {
Indent continuation lines two tabs further, or rewrite so that you don't
need a line break.
> status = ti_download_firmware(tdev);
>
> if (status != 0)
> @@ -371,7 +393,15 @@ static int ti_port_probe(struct usb_serial_port *port)
> port->port.closing_wait = msecs_to_jiffies(10 * closing_wait);
> tport->tp_port = port;
> tport->tp_tdev = usb_get_serial_data(port->serial);
> - tport->tp_uart_mode = 0; /* default is RS232 */
> +
> + switch (tport->tp_tdev->td_model) {
> + case MXU1_1130_PRODUCT_ID:
> + case MXU1_1131_PRODUCT_ID:
> + tport->tp_uart_mode = TI_UART_485_RECEIVER_DISABLED;
> + break;
> + default:
> + tport->tp_uart_mode = TI_UART_232; /* default is RS232 */
> + }
Use the flag set mentioned above instead.
>
> usb_set_serial_port_data(port, tport);
>
> @@ -1479,6 +1509,14 @@ static int ti_download_firmware(struct ti_device *tdev)
> strcpy(buf, "mts_mt9234zba.fw");
> break; }
> }
> +
> + if (le16_to_cpu(dev->descriptor.idVendor) == MXU1_VENDOR_ID) {
> + snprintf(buf,
> + sizeof(buf),
> + "moxa/moxa-%04x.fw",
> + le16_to_cpu(dev->descriptor.idProduct));
> + }
> +
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.
> if (buf[0] == '\0') {
> if (tdev->td_is_3410)
> strcpy(buf, "ti_3410.fw");
> diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
> index 98f35c6..93ac6ad 100644
> --- a/drivers/usb/serial/ti_usb_3410_5052.h
> +++ b/drivers/usb/serial/ti_usb_3410_5052.h
> @@ -60,6 +60,14 @@
> #define HONEYWELL_VENDOR_ID 0x10ac
> #define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */
>
> +/* Moxa UPORT 11x0 vendor and product IDs */
> +#define MXU1_VENDOR_ID 0x110a
> +#define MXU1_1110_PRODUCT_ID 0x1110
> +#define MXU1_1130_PRODUCT_ID 0x1130
> +#define MXU1_1150_PRODUCT_ID 0x1150
> +#define MXU1_1151_PRODUCT_ID 0x1151
> +#define MXU1_1131_PRODUCT_ID 0x1131
Keep these sorted too.
> +
> /* Commands */
> #define TI_GET_VERSION 0x01
> #define TI_GET_PORT_STATUS 0x02
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?
Thanks,
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-04 7:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20160502180407.GA4330@gmail.com>
2016-05-02 18:37 ` [PATCH] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support Mathieu OTHACEHE
2016-05-03 8:14 ` Johan Hovold
2016-05-03 11:46 ` Mathieu OTHACEHE
2016-05-04 7:40 ` Johan Hovold
2016-03-02 9:46 Mathieu OTHACEHE
2016-04-24 15:59 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox