static int ti_command_in_sync(struct ti_device *tdev, __u8 command,
__u16 moduleid, __u16 value, __u8 *data, int size);
-static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
- __u8 mask, __u8 byte);
+static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev,
+ unsigned long addr, __u8 mask, __u8 byte);
static int ti_download_firmware(struct ti_device *tdev);
int i;
- dbg("%s - product 0x%4X, num configurations %d, configuration value %d",
- __func__, le16_to_cpu(dev->descriptor.idProduct),
- dev->descriptor.bNumConfigurations,
- dev->actconfig->desc.bConfigurationValue);
+ dev_dbg(&dev->dev,
+ "%s - product 0x%4X, num configurations %d, configuration value %d",
+ __func__, le16_to_cpu(dev->descriptor.idProduct),
+ dev->descriptor.bNumConfigurations,
+ dev->actconfig->desc.bConfigurationValue);
/* create device structure */
tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
/* determine device type */
if (usb_match_id(serial->interface, ti_id_table_3410))
tdev->td_is_3410 = 1;
- dbg("%s - device type is %s", __func__,
- tdev->td_is_3410 ? "3410" : "5052");
+ 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) {
/* start interrupt urb the first time a port is opened on this device */
if (tdev->td_open_port_count == 0) {
- dbg("%s - start interrupt in urb", __func__);
+ dev_dbg(&port->dev, "%s - start interrupt in urb\n", __func__);
urb = tdev->td_serial->port[0]->interrupt_in_urb;
if (!urb) {
- dev_err(&port->dev, "%s - no interrupt urb\n",
- __func__);
+ dev_err(&port->dev, "%s - no interrupt urb\n", __func__);
status = -EINVAL;
goto release_lock;
}
urb->context = tdev;
status = usb_submit_urb(urb, GFP_KERNEL);
if (status) {
- dev_err(&port->dev,
- "%s - submit interrupt urb failed, %d\n",
- __func__, status);
+ dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status);
goto release_lock;
}
}
if (tty)
ti_set_termios(tty, port, tty->termios);
- dbg("%s - sending TI_OPEN_PORT", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT\n", __func__);
status = ti_command_out_sync(tdev, TI_OPEN_PORT,
(__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
if (status) {
dev_err(&port->dev, "%s - cannot send open command, %d\n",
- __func__, status);
+ __func__, status);
goto unlink_int_urb;
}
- dbg("%s - sending TI_START_PORT", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_START_PORT\n", __func__);
status = ti_command_out_sync(tdev, TI_START_PORT,
(__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
if (status) {
goto unlink_int_urb;
}
- dbg("%s - sending TI_PURGE_PORT", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_PURGE_PORT\n", __func__);
status = ti_command_out_sync(tdev, TI_PURGE_PORT,
(__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0);
if (status) {
if (tty)
ti_set_termios(tty, port, tty->termios);
- dbg("%s - sending TI_OPEN_PORT (2)", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT (2)\n", __func__);
status = ti_command_out_sync(tdev, TI_OPEN_PORT,
(__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0);
if (status) {
goto unlink_int_urb;
}
- dbg("%s - sending TI_START_PORT (2)", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_START_PORT (2)\n", __func__);
status = ti_command_out_sync(tdev, TI_START_PORT,
(__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
if (status) {
}
/* start read urb */
- dbg("%s - start read urb", __func__);
+ dev_dbg(&port->dev, "%s - start read urb\n", __func__);
urb = port->read_urb;
if (!urb) {
dev_err(&port->dev, "%s - no read urb\n", __func__);
usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
release_lock:
mutex_unlock(&tdev->td_open_close_lock);
- dbg("%s - exit %d", __func__, status);
+ dev_dbg(&port->dev, "%s - exit %d\n", __func__, status);
return status;
}
port_number = port->number - port->serial->minor;
- dbg("%s - sending TI_CLOSE_PORT", __func__);
+ dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__);
status = ti_command_out_sync(tdev, TI_CLOSE_PORT,
(__u8)(TI_UART1_PORT + port_number), 0, NULL, 0);
if (status)
struct ti_port *tport = usb_get_serial_port_data(port);
if (count == 0) {
- dbg("%s - write request of 0 bytes", __func__);
+ dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
return 0;
}
room = kfifo_avail(&tport->write_fifo);
spin_unlock_irqrestore(&tport->tp_lock, flags);
- dbg("%s - returns %d", __func__, room);
+ dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
return room;
}
chars = kfifo_len(&tport->write_fifo);
spin_unlock_irqrestore(&tport->tp_lock, flags);
- dbg("%s - returns %d", __func__, chars);
+ dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
return chars;
}
struct ti_port *tport = usb_get_serial_port_data(port);
struct async_icount cnow = tport->tp_icount;
- dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d",
- __func__, port->number,
+ dev_dbg(&port->dev, "%s - TIOCGICOUNT RX=%d, TX=%d\n", __func__,
cnow.rx, cnow.tx);
icount->cts = cnow.cts;
struct async_icount cnow;
struct async_icount cprev;
- dbg("%s - port %d, cmd = 0x%04X", __func__, port->number, cmd);
+ dev_dbg(&port->dev, "%s - cmd = 0x%04X\n", __func__, cmd);
if (tport == NULL)
return -ENODEV;
switch (cmd) {
case TIOCGSERIAL:
- dbg("%s - (%d) TIOCGSERIAL", __func__, port->number);
+ dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__);
return ti_get_serial_info(tport,
(struct serial_struct __user *)arg);
case TIOCSSERIAL:
- dbg("%s - (%d) TIOCSSERIAL", __func__, port->number);
+ dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__);
return ti_set_serial_info(tty, tport,
(struct serial_struct __user *)arg);
case TIOCMIWAIT:
- dbg("%s - (%d) TIOCMIWAIT", __func__, port->number);
+ dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__);
cprev = tport->tp_icount;
while (1) {
interruptible_sleep_on(&tport->tp_msr_wait);
cflag = tty->termios->c_cflag;
iflag = tty->termios->c_iflag;
- dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag);
- dbg("%s - old clfag %08x, old iflag %08x", __func__,
- old_termios->c_cflag, old_termios->c_iflag);
+ dev_dbg(&port->dev, "%s - cflag %08x, iflag %08x\n", __func__, cflag, iflag);
+ dev_dbg(&port->dev, "%s - old clfag %08x, old iflag %08x\n", __func__,
+ old_termios->c_cflag, old_termios->c_iflag);
if (tport == NULL)
return;
if ((cflag & CBAUD) != B0)
tty_encode_baud_rate(tty, baud, baud);
- dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
- __func__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode);
+ dev_dbg(&port->dev,
+ "%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
+ __func__, baud, config->wBaudRate, config->wFlags,
+ config->bDataBits, config->bParity, config->bStopBits,
+ config->cXon, config->cXoff, config->bUartMode);
cpu_to_be16s(&config->wBaudRate);
cpu_to_be16s(&config->wFlags);
| ((msr & TI_MSR_RI) ? TIOCM_RI : 0)
| ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0);
- dbg("%s - 0x%04X", __func__, result);
+ dev_dbg(&port->dev, "%s - 0x%04X\n", __func__, result);
return result;
}
struct ti_port *tport = usb_get_serial_port_data(port);
int status;
- dbg("%s - state = %d", __func__, break_state);
+ dev_dbg(&port->dev, "%s - state = %d\n", __func__, break_state);
if (tport == NULL)
return;
ti_drain(tport, (tport->tp_closing_wait*HZ)/100, 0);
- status = ti_write_byte(tport->tp_tdev,
+ status = ti_write_byte(port, tport->tp_tdev,
tport->tp_uart_base_addr + TI_UART_OFFSET_LCR,
TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0);
if (status)
- dbg("%s - error setting break, %d", __func__, status);
+ dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status);
}
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
- dbg("%s - urb shutting down, %d", __func__, status);
+ dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status);
tdev->td_urb_error = 1;
return;
default:
- dev_err(dev, "%s - nonzero urb status, %d\n",
- __func__, status);
+ dev_err(dev, "%s - nonzero urb status, %d\n", __func__, status);
tdev->td_urb_error = 1;
goto exit;
}
if (length != 2) {
- dbg("%s - bad packet size, %d", __func__, length);
+ dev_dbg(dev, "%s - bad packet size, %d\n", __func__, length);
goto exit;
}
port_number = TI_GET_PORT_FROM_CODE(data[0]);
function = TI_GET_FUNC_FROM_CODE(data[0]);
- dbg("%s - port_number %d, function %d, data 0x%02X",
- __func__, port_number, function, data[1]);
+ dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n",
+ __func__, port_number, function, data[1]);
if (port_number >= serial->num_ports) {
dev_err(dev, "%s - bad port number, %d\n",
switch (function) {
case TI_CODE_DATA_ERROR:
dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n",
- __func__, port_number, data[1]);
+ __func__, port_number, data[1]);
break;
case TI_CODE_MODEM_STATUS:
msr = data[1];
- dbg("%s - port %d, msr 0x%02X", __func__, port_number, msr);
+ dev_dbg(dev, "%s - port %d, msr 0x%02X\n", __func__, port_number, msr);
ti_handle_new_msr(tport, msr);
break;
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
- dbg("%s - urb shutting down, %d", __func__, status);
+ dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status);
tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait);
return;
urb->actual_length, urb->transfer_buffer);
if (!tport->tp_is_open)
- dbg("%s - port closed, dropping data",
+ dev_dbg(dev, "%s - port closed, dropping data\n",
__func__);
else
ti_recv(&urb->dev->dev, tty,
case -ECONNRESET:
case -ENOENT:
case -ESHUTDOWN:
- dbg("%s - urb shutting down, %d", __func__, status);
+ dev_dbg(&port->dev, "%s - urb shutting down, %d\n", __func__, status);
tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait);
return;
unsigned long flags;
int status;
- status = ti_write_byte(tport->tp_tdev,
+ status = ti_write_byte(tport->tp_port, tport->tp_tdev,
tport->tp_uart_base_addr + TI_UART_OFFSET_MCR,
TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr);
goto free_data;
}
- dbg("%s - lsr 0x%02X", __func__, data->bLSR);
+ dev_dbg(&port->dev, "%s - lsr 0x%02X\n", __func__, data->bLSR);
tport->tp_lsr = data->bLSR;
struct tty_struct *tty;
unsigned long flags;
- dbg("%s - msr 0x%02X", __func__, msr);
+ dev_dbg(&tport->tp_port->dev, "%s - msr 0x%02X\n", __func__, msr);
if (msr & TI_MSR_DELTA_MASK) {
spin_lock_irqsave(&tport->tp_lock, flags);
}
-static int ti_write_byte(struct ti_device *tdev, unsigned long addr,
- __u8 mask, __u8 byte)
+static int ti_write_byte(struct usb_serial_port *port,
+ struct ti_device *tdev, unsigned long addr,
+ __u8 mask, __u8 byte)
{
int status;
unsigned int size;
struct ti_write_data_bytes *data;
- struct device *dev = &tdev->td_serial->dev->dev;
- dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X",
- __func__, addr, mask, byte);
+ dev_dbg(&port->dev, "%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X\n", __func__,
+ addr, mask, byte);
size = sizeof(struct ti_write_data_bytes) + 2;
data = kmalloc(size, GFP_KERNEL);
if (!data) {
- dev_err(dev, "%s - out of memory\n", __func__);
+ dev_err(&port->dev, "%s - out of memory\n", __func__);
return -ENOMEM;
}
(__u8 *)data, size);
if (status < 0)
- dev_err(dev, "%s - failed, %d\n", __func__, status);
+ dev_err(&port->dev, "%s - failed, %d\n", __func__, status);
kfree(data);
- sizeof(struct ti_firmware_header)));
header->bCheckSum = cs;
- dbg("%s - downloading firmware", __func__);
+ dev_dbg(&dev->dev, "%s - downloading firmware\n", __func__);
for (pos = 0; pos < size; pos += done) {
len = min(size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE);
status = usb_bulk_msg(dev, pipe, buffer + pos, len,
status = ti_do_download(dev, pipe, buffer, fw_p->size);
kfree(buffer);
} else {
- dbg("%s ENOMEM\n", __func__);
+ dev_dbg(&dev->dev, "%s ENOMEM\n", __func__);
status = -ENOMEM;
}
release_firmware(fw_p);
return status;
}
- dbg("%s - download successful", __func__);
+ dev_dbg(&dev->dev, "%s - download successful\n", __func__);
return 0;
}