39 #include <linux/kernel.h>
40 #include <linux/errno.h>
42 #include <linux/slab.h>
43 #include <linux/tty.h>
45 #include <linux/module.h>
55 #define DRIVER_VERSION "v0.4"
56 #define DRIVER_AUTHOR "Roelf Diedericks"
57 #define DRIVER_DESC "IPWireless tty driver"
59 #define IPW_TTY_MAJOR 240
60 #define IPW_TTY_MINORS 256
62 #define USB_IPW_MAGIC 0x6d02
66 #define EVENT_BUFFER_SIZE 0xFF
67 #define CHAR2INT16(c1, c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff))
70 #define IPW_VID 0x0bc3
71 #define IPW_PID 0x0001
94 #define ipw_dtb_7 0x700
95 #define ipw_dtb_8 0x810
99 #define IPW_SIO_RXCTL 0x00
100 #define IPW_SIO_SET_BAUD 0x01
101 #define IPW_SIO_SET_LINE 0x03
102 #define IPW_SIO_SET_PIN 0x03
103 #define IPW_SIO_POLL 0x08
104 #define IPW_SIO_INIT 0x11
105 #define IPW_SIO_PURGE 0x12
106 #define IPW_SIO_HANDFLOW 0x13
107 #define IPW_SIO_SETCHARS 0x13
111 #define IPW_PIN_SETDTR 0x101
112 #define IPW_PIN_SETRTS 0x202
113 #define IPW_PIN_CLRDTR 0x100
114 #define IPW_PIN_CLRRTS 0x200
117 #define IPW_RXBULK_ON 1
118 #define IPW_RXBULK_OFF 0
121 #define IPW_BYTES_FLOWINIT { 0x01, 0, 0, 0, 0x40, 0, 0, 0, \
122 0, 0, 0, 0, 0, 0, 0, 0 }
130 #define IPW_DSR ((1<<4) | (1<<5))
131 #define IPW_CTS ((1<<5) | (1<<4))
133 #define IPW_WANTS_TO_SEND 0x30
156 dev_dbg(dev,
"%s: Sending SIO_INIT (we guess)\n", __func__);
166 dev_err(dev,
"Init of modem failed (error = %d)\n", result);
173 dev_dbg(dev,
"%s: setting up bulk read callback\n", __func__);
177 dev_dbg(dev,
"%s:asking modem for RxRead (RXBULK_ON)\n", __func__);
187 dev_err(dev,
"Enabling bulk RxRead failed (error = %d)\n", result);
190 dev_dbg(dev,
"%s:setting init flowcontrol (%s)\n", __func__, buf_flow_init);
200 dev_err(dev,
"initial flowcontrol failed (error = %d)\n", result);
202 kfree(buf_flow_init);
215 usb_set_serial_data(serial, data);
219 static void ipw_release(
struct usb_serial *serial)
223 usb_set_serial_data(serial,
NULL);
229 struct usb_device *udev = port->
serial->dev;
233 dev_dbg(dev,
"%s: on = %d\n", __func__, on);
244 dev_err(dev,
"setting dtr failed (error = %d)\n", result);
255 dev_err(dev,
"setting rts failed (error = %d)\n", result);
260 struct usb_device *udev = port->
serial->dev;
265 dev_dbg(dev,
"%s:sending purge\n", __func__);
275 dev_err(dev,
"purge failed (error = %d)\n", result);
290 dev_err(dev,
"Disabling bulk RxRead failed (error = %d)\n", result);
300 .description =
"IPWireless converter",
305 .attach = ipw_attach,
306 .release = ipw_release,
309 .dtr_rts = ipw_dtr_rts,