|
@@ -303,15 +303,12 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
|
|
/* For the UART control registers, the application number need
|
|
/* For the UART control registers, the application number need
|
|
to be Or'ed */
|
|
to be Or'ed */
|
|
if (port->serial->num_ports == 4) {
|
|
if (port->serial->num_ports == 4) {
|
|
- val |= (((__u16) port->number -
|
|
|
|
- (__u16) (port->serial->minor)) + 1) << 8;
|
|
|
|
|
|
+ val |= ((__u16)port->port_number + 1) << 8;
|
|
} else {
|
|
} else {
|
|
- if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) {
|
|
|
|
- val |= (((__u16) port->number -
|
|
|
|
- (__u16) (port->serial->minor)) + 1) << 8;
|
|
|
|
|
|
+ if (port->port_number == 0) {
|
|
|
|
+ val |= ((__u16)port->port_number + 1) << 8;
|
|
} else {
|
|
} else {
|
|
- val |= (((__u16) port->number -
|
|
|
|
- (__u16) (port->serial->minor)) + 2) << 8;
|
|
|
|
|
|
+ val |= ((__u16)port->port_number + 2) << 8;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dev_dbg(&port->dev, "%s application number is %x\n", __func__, val);
|
|
dev_dbg(&port->dev, "%s application number is %x\n", __func__, val);
|
|
@@ -340,16 +337,12 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg,
|
|
|
|
|
|
/* Wval is same as application number */
|
|
/* Wval is same as application number */
|
|
if (port->serial->num_ports == 4) {
|
|
if (port->serial->num_ports == 4) {
|
|
- Wval =
|
|
|
|
- (((__u16) port->number - (__u16) (port->serial->minor)) +
|
|
|
|
- 1) << 8;
|
|
|
|
|
|
+ Wval = ((__u16)port->port_number + 1) << 8;
|
|
} else {
|
|
} else {
|
|
- if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) {
|
|
|
|
- Wval = (((__u16) port->number -
|
|
|
|
- (__u16) (port->serial->minor)) + 1) << 8;
|
|
|
|
|
|
+ if (port->port_number == 0) {
|
|
|
|
+ Wval = ((__u16)port->port_number + 1) << 8;
|
|
} else {
|
|
} else {
|
|
- Wval = (((__u16) port->number -
|
|
|
|
- (__u16) (port->serial->minor)) + 2) << 8;
|
|
|
|
|
|
+ Wval = ((__u16)port->port_number + 2) << 8;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval);
|
|
dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval);
|
|
@@ -631,9 +624,7 @@ static void mos7840_interrupt_callback(struct urb *urb)
|
|
|
|
|
|
for (i = 0; i < serial->num_ports; i++) {
|
|
for (i = 0; i < serial->num_ports; i++) {
|
|
mos7840_port = mos7840_get_port_private(serial->port[i]);
|
|
mos7840_port = mos7840_get_port_private(serial->port[i]);
|
|
- wval =
|
|
|
|
- (((__u16) serial->port[i]->number -
|
|
|
|
- (__u16) (serial->minor)) + 1) << 8;
|
|
|
|
|
|
+ wval = ((__u16)serial->port[i]->port_number + 1) << 8;
|
|
if (mos7840_port->open) {
|
|
if (mos7840_port->open) {
|
|
if (sp[i] & 0x01) {
|
|
if (sp[i] & 0x01) {
|
|
dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i);
|
|
dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i);
|
|
@@ -1065,8 +1056,8 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|
* (can't set it up in mos7840_startup as the *
|
|
* (can't set it up in mos7840_startup as the *
|
|
* structures were not set up at that time.) */
|
|
* structures were not set up at that time.) */
|
|
|
|
|
|
- dev_dbg(&port->dev, "port number is %d\n", port->number);
|
|
|
|
- dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor);
|
|
|
|
|
|
+ dev_dbg(&port->dev, "port number is %d\n", port->port_number);
|
|
|
|
+ dev_dbg(&port->dev, "minor number is %d\n", port->serial->minor);
|
|
dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
|
|
dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
|
|
dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
|
|
dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
|
|
dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
|
|
dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
|
|
@@ -1074,9 +1065,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|
mos7840_port->read_urb = port->read_urb;
|
|
mos7840_port->read_urb = port->read_urb;
|
|
|
|
|
|
/* set up our bulk in urb */
|
|
/* set up our bulk in urb */
|
|
- if ((serial->num_ports == 2)
|
|
|
|
- && ((((__u16)port->number -
|
|
|
|
- (__u16)(port->serial->minor)) % 2) != 0)) {
|
|
|
|
|
|
+ if ((serial->num_ports == 2) && (((__u16)port->port_number % 2) != 0)) {
|
|
usb_fill_bulk_urb(mos7840_port->read_urb,
|
|
usb_fill_bulk_urb(mos7840_port->read_urb,
|
|
serial->dev,
|
|
serial->dev,
|
|
usb_rcvbulkpipe(serial->dev,
|
|
usb_rcvbulkpipe(serial->dev,
|
|
@@ -1199,7 +1188,7 @@ static void mos7840_close(struct usb_serial_port *port)
|
|
mos7840_port->read_urb_busy = false;
|
|
mos7840_port->read_urb_busy = false;
|
|
|
|
|
|
port0->open_ports--;
|
|
port0->open_ports--;
|
|
- dev_dbg(&port->dev, "%s in close%d:in port%d\n", __func__, port0->open_ports, port->number);
|
|
|
|
|
|
+ dev_dbg(&port->dev, "%s in close%d\n", __func__, port0->open_ports);
|
|
if (port0->open_ports == 0) {
|
|
if (port0->open_ports == 0) {
|
|
if (serial->port[0]->interrupt_in_urb) {
|
|
if (serial->port[0]->interrupt_in_urb) {
|
|
dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n");
|
|
dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n");
|
|
@@ -1435,9 +1424,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
|
|
memcpy(urb->transfer_buffer, current_position, transfer_size);
|
|
memcpy(urb->transfer_buffer, current_position, transfer_size);
|
|
|
|
|
|
/* fill urb with data and submit */
|
|
/* fill urb with data and submit */
|
|
- if ((serial->num_ports == 2)
|
|
|
|
- && ((((__u16)port->number -
|
|
|
|
- (__u16)(port->serial->minor)) % 2) != 0)) {
|
|
|
|
|
|
+ if ((serial->num_ports == 2) && (((__u16)port->port_number % 2) != 0)) {
|
|
usb_fill_bulk_urb(urb,
|
|
usb_fill_bulk_urb(urb,
|
|
serial->dev,
|
|
serial->dev,
|
|
usb_sndbulkpipe(serial->dev,
|
|
usb_sndbulkpipe(serial->dev,
|
|
@@ -1732,10 +1719,9 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
|
|
if (mos7840_serial_paranoia_check(port->serial, __func__))
|
|
if (mos7840_serial_paranoia_check(port->serial, __func__))
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
- number = mos7840_port->port->number - mos7840_port->port->serial->minor;
|
|
|
|
|
|
+ number = mos7840_port->port->port_number;
|
|
|
|
|
|
- dev_dbg(&port->dev, "%s - port = %d, baud = %d\n", __func__,
|
|
|
|
- mos7840_port->port->number, baudRate);
|
|
|
|
|
|
+ dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudRate);
|
|
/* reset clk_uart_sel in spregOffset */
|
|
/* reset clk_uart_sel in spregOffset */
|
|
if (baudRate > 115200) {
|
|
if (baudRate > 115200) {
|
|
#ifdef HW_flow_control
|
|
#ifdef HW_flow_control
|
|
@@ -2016,7 +2002,6 @@ static void mos7840_set_termios(struct tty_struct *tty,
|
|
tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
|
|
tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
|
|
dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
|
|
dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
|
|
old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
|
|
old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
|
|
- dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number);
|
|
|
|
|
|
|
|
/* change the port settings to the new ones specified */
|
|
/* change the port settings to the new ones specified */
|
|
|
|
|
|
@@ -2084,7 +2069,7 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port,
|
|
|
|
|
|
tmp.type = PORT_16550A;
|
|
tmp.type = PORT_16550A;
|
|
tmp.line = mos7840_port->port->serial->minor;
|
|
tmp.line = mos7840_port->port->serial->minor;
|
|
- tmp.port = mos7840_port->port->number;
|
|
|
|
|
|
+ tmp.port = mos7840_port->port->port_number;
|
|
tmp.irq = 0;
|
|
tmp.irq = 0;
|
|
tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
|
|
tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
|
|
tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
|
|
tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
|
|
@@ -2240,7 +2225,7 @@ static int mos7840_port_probe(struct usb_serial_port *port)
|
|
/* we set up the pointers to the endpoints in the mos7840_open *
|
|
/* we set up the pointers to the endpoints in the mos7840_open *
|
|
* function, as the structures aren't created yet. */
|
|
* function, as the structures aren't created yet. */
|
|
|
|
|
|
- pnum = port->number - serial->minor;
|
|
|
|
|
|
+ pnum = port->port_number;
|
|
|
|
|
|
dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
|
|
dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
|
|
mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
|
|
mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
|
|
@@ -2261,7 +2246,6 @@ static int mos7840_port_probe(struct usb_serial_port *port)
|
|
* usb-serial.c:get_free_serial() and cannot therefore be used
|
|
* usb-serial.c:get_free_serial() and cannot therefore be used
|
|
* to index device instances */
|
|
* to index device instances */
|
|
mos7840_port->port_num = pnum + 1;
|
|
mos7840_port->port_num = pnum + 1;
|
|
- dev_dbg(&port->dev, "port->number = %d\n", port->number);
|
|
|
|
dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor);
|
|
dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor);
|
|
dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
|
|
dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
|
|
dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor);
|
|
dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor);
|