Re: Moschip 7703 USB to serial free to a good home

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 23, 2019 at 11:58 PM Bjørn Mork <bjorn@xxxxxxx> wrote:
>
> Aaron Thompson <dev@xxxxxxxxxx> writes:
>
> > I have a Moschip 7703 USB to single serial port adapter that I'm not
> > using primarily because it doesn't have an in-tree driver, so I'd be
> > happy to send it to anyone who would like to add support for it. It
> > looks like it should be easy to add to the existing mos7720 driver.
> > Anyone interested?
>
> Sorry, not interested.  But did you try the obvious fix, even mentioned
> here under "Moschip MCS7720, MCS7715 driver"?:
> https://www.kernel.org/doc/Documentation/usb/usb-serial.txt
>
> Just add the VID/PID to the device table and see what happens.  Just
> post any error messages or other stuff here, along with the patch you
> are testing, and you will get help interpreting it.
>
> Note that you'll probably have to do a minor change in the
> mos77xx_calc_num_ports() too, since it hardcodes 2 ports. But if you're
> lucky then that's it.
>
>
> Bjørn

I have tinkered with it and unfortunately it's not that simple. The
patch below seems to make it work up to 115200 baud in my very minimal
testing. I have no confidence that it's correct though because I don't
have any information about the device. I only have the old
Moschip-authored 7703 driver to refer to and it's quite a bit
different than the current 7720 driver.

Thanks,
Aaron

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 18110225..3cef30a 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -65,10 +65,12 @@ struct moschip_port {
 #define USB_VENDOR_ID_MOSCHIP 0x9710
 #define MOSCHIP_DEVICE_ID_7720 0x7720
 #define MOSCHIP_DEVICE_ID_7715 0x7715
+#define MOSCHIP_DEVICE_ID_7703 0x7703

 static const struct usb_device_id id_table[] = {
  { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7720) },
  { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7715) },
+ { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7703) },
  { } /* terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -183,7 +185,7 @@ static inline __u16 get_reg_value(enum mos_regs reg,
  return 0x0100;

  else       /* serial port reg */
- return (serial_portnum + 2) << 8;
+ return (serial_portnum + 3) << 8;
 }

 /*
@@ -988,6 +990,8 @@ static int mos77xx_calc_num_ports(struct usb_serial *serial,
  swap(epds->bulk_out[0], epds->bulk_out[1]);

  return 1;
+        } else if (product == MOSCHIP_DEVICE_ID_7703) {
+                return 1;
  }

  return 2;
@@ -1052,7 +1056,7 @@ static int mos7720_open(struct tty_struct *tty,
struct usb_serial_port *port)

  dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);

- write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02);
+ write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x08);
  write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02);

  write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
@@ -1939,8 +1943,8 @@ static struct usb_serial_driver
moschip7720_2port_driver = {
  },
  .description = "Moschip 2 port adapter",
  .id_table = id_table,
- .num_bulk_in = 2,
- .num_bulk_out = 2,
+ .num_bulk_in = 1,
+ .num_bulk_out = 1,
  .num_interrupt_in = 1,
  .calc_num_ports = mos77xx_calc_num_ports,
  .open = mos7720_open,




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux