static int RS485mode = 0;
/* setting and get register values */
-static int ATEN2011_set_reg_sync(struct usb_serial_port *port, __u16 reg,
- __u16 val);
static int ATEN2011_get_reg_sync(struct usb_serial_port *port, __u16 reg,
__u16 * val);
static int ATEN2011_set_Uart_Reg(struct usb_serial_port *port, __u16 reg,
return (struct ATENINTL_port *)usb_get_serial_port_data(port);
}
-static int ATEN2011_set_reg_sync(struct usb_serial_port *port, __u16 reg,
- __u16 val)
+static int set_reg_sync(struct usb_serial_port *port, __u16 reg, __u16 val)
{
struct usb_device *dev = port->serial->dev;
val = val & 0x00ff;
- DPRINTK("ATEN2011_set_reg_sync offset is %x, value %x\n", reg, val);
+
+ dbg("%s: is %x, value %x\n", __func__, reg, val);
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ATEN_WRREQ,
ATEN_WR_RTYPE, val, reg, NULL, 0,
return -1;
}
Data |= 0x80;
- status = ATEN2011_set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
if (status < 0) {
DPRINTK("writing Spreg failed\n");
return -1;
}
Data &= ~0x80;
- status = ATEN2011_set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
if (status < 0) {
DPRINTK("writing Spreg failed\n");
return -1;
return -1;
}
Data |= 0x08; //Driver done bit
- /*
- status = ATEN2011_set_reg_sync(port,ATEN2011_port->ControlRegOffset,Data);
- if(status<0){
- DPRINTK("writing Controlreg failed\n");
- return -1;
- }
- */
Data |= 0x20; //rx_disable
status = 0;
status =
- ATEN2011_set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
+ set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
if (status < 0) {
DPRINTK("writing Controlreg failed\n");
return -1;
Data = Data | 0x0c;
status = 0;
- status = ATEN2011_set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
Data = Data & ~0x0c;
status = 0;
- status = ATEN2011_set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
//Finally enable all interrupts
Data = 0x0;
Data = 0x0c;
ATEN2011_get_reg_sync(port, ATEN2011_port->ControlRegOffset, &Data);
Data = Data & ~0x20;
status = 0;
- status =
- ATEN2011_set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
// rx_negate
Data = 0x0;
ATEN2011_get_reg_sync(port, ATEN2011_port->ControlRegOffset, &Data);
Data = Data | 0x10;
status = 0;
- status =
- ATEN2011_set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
+ status = set_reg_sync(port, ATEN2011_port->ControlRegOffset, Data);
/* force low_latency on so that our tty_push actually forces *
* the data through,otherwise it is scheduled, and with *
return -1;
}
Data = (Data & 0x8f) | clk_sel_val;
- status = 0;
- status =
- ATEN2011_set_reg_sync(port, ATEN2011_port->SpRegOffset,
- Data);
+ status = set_reg_sync(port, ATEN2011_port->SpRegOffset, Data);
if (status < 0) {
DPRINTK("Writing spreg failed in set_serial_baud\n");
return -1;
Data |= 0x04; //sp1_bit to have cts change reflect in modem status reg
//Data |= 0x20; //rx_disable bit
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i],
- ATEN2011_port->ControlRegOffset,
- Data);
+ status = set_reg_sync(serial->port[i],
+ ATEN2011_port->ControlRegOffset, Data);
if (status < 0) {
DPRINTK
("Writing ControlReg failed(rx_disable) status-0x%x\n",
//Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 and 0x24 in DCR3
Data = 0x01;
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i],
- (__u16) (ATEN2011_port->DcrRegOffset +
- 0), Data);
+ status = set_reg_sync(serial->port[i],
+ (__u16)(ATEN2011_port->DcrRegOffset + 0),
+ Data);
if (status < 0) {
DPRINTK("Writing DCR0 failed status-0x%x\n", status);
break;
DPRINTK("DCR0 Writing success status%d\n", status);
Data = 0x05;
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i],
- (__u16) (ATEN2011_port->DcrRegOffset +
- 1), Data);
+ status = set_reg_sync(serial->port[i],
+ (__u16)(ATEN2011_port->DcrRegOffset + 1),
+ Data);
if (status < 0) {
DPRINTK("Writing DCR1 failed status-0x%x\n", status);
break;
DPRINTK("DCR1 Writing success status%d\n", status);
Data = 0x24;
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i],
- (__u16) (ATEN2011_port->DcrRegOffset +
- 2), Data);
+ status = set_reg_sync(serial->port[i],
+ (__u16)(ATEN2011_port->DcrRegOffset + 2),
+ Data);
if (status < 0) {
DPRINTK("Writing DCR2 failed status-0x%x\n", status);
break;
// write values in clkstart0x0 and clkmulti 0x20
Data = 0x0;
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i],
- CLK_START_VALUE_REGISTER, Data);
+ status = set_reg_sync(serial->port[i], CLK_START_VALUE_REGISTER,
+ Data);
if (status < 0) {
DPRINTK
("Writing CLK_START_VALUE_REGISTER failed status-0x%x\n",
status);
Data = 0x20;
- status = 0;
- status =
- ATEN2011_set_reg_sync(serial->port[i], CLK_MULTI_REGISTER,
- Data);
+ status = set_reg_sync(serial->port[i], CLK_MULTI_REGISTER,
+ Data);
if (status < 0) {
DPRINTK
("Writing CLK_MULTI_REGISTER failed status-0x%x\n",
&& (ATEN2011_serial->ATEN2011_spectrum_2or4ports == 2)) {
Data = 0xff;
- status = 0;
- status = ATEN2011_set_reg_sync(serial->port[i],
- (__u16) (ZLP_REG1 +
- ((__u16)
- ATEN2011_port->
- port_num)),
- Data);
+ status = set_reg_sync(serial->port[i],
+ (__u16)(ZLP_REG1 + ((__u16)ATEN2011_port->port_num)),
+ Data);
DPRINTK("ZLIP offset%x\n",
(__u16) (ZLP_REG1 +
((__u16) ATEN2011_port->port_num)));
i + 2, status);
} else {
Data = 0xff;
- status = 0;
- status = ATEN2011_set_reg_sync(serial->port[i],
- (__u16) (ZLP_REG1 +
- ((__u16)
- ATEN2011_port->
- port_num) -
- 0x1), Data);
+ status = set_reg_sync(serial->port[i],
+ (__u16)(ZLP_REG1 + ((__u16)ATEN2011_port->port_num) - 0x1),
+ Data);
DPRINTK("ZLIP offset%x\n",
(__u16) (ZLP_REG1 +
((__u16) ATEN2011_port->port_num) -
//Zero Length flag enable
Data = 0x0f;
- status = 0;
- status = ATEN2011_set_reg_sync(serial->port[0], ZLP_REG5, Data);
+ status = set_reg_sync(serial->port[0], ZLP_REG5, Data);
if (status < 0) {
DPRINTK("Writing ZLP_REG5 failed status-0x%x\n", status);
return -1;