Lines Matching refs:sisusb

75 static void sisusb_free_buffers(struct sisusb_usb_data *sisusb)  in sisusb_free_buffers()  argument
80 kfree(sisusb->obuf[i]); in sisusb_free_buffers()
81 sisusb->obuf[i] = NULL; in sisusb_free_buffers()
83 kfree(sisusb->ibuf); in sisusb_free_buffers()
84 sisusb->ibuf = NULL; in sisusb_free_buffers()
87 static void sisusb_free_urbs(struct sisusb_usb_data *sisusb) in sisusb_free_urbs() argument
92 usb_free_urb(sisusb->sisurbout[i]); in sisusb_free_urbs()
93 sisusb->sisurbout[i] = NULL; in sisusb_free_urbs()
95 usb_free_urb(sisusb->sisurbin); in sisusb_free_urbs()
96 sisusb->sisurbin = NULL; in sisusb_free_urbs()
106 static int sisusb_all_free(struct sisusb_usb_data *sisusb) in sisusb_all_free() argument
110 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_all_free()
112 if (sisusb->urbstatus[i] & SU_URB_BUSY) in sisusb_all_free()
121 static void sisusb_kill_all_busy(struct sisusb_usb_data *sisusb) in sisusb_kill_all_busy() argument
125 if (sisusb_all_free(sisusb)) in sisusb_kill_all_busy()
128 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_kill_all_busy()
130 if (sisusb->urbstatus[i] & SU_URB_BUSY) in sisusb_kill_all_busy()
131 usb_kill_urb(sisusb->sisurbout[i]); in sisusb_kill_all_busy()
137 static int sisusb_wait_all_out_complete(struct sisusb_usb_data *sisusb) in sisusb_wait_all_out_complete() argument
141 wait_event_timeout(sisusb->wait_q, (i = sisusb_all_free(sisusb)), in sisusb_wait_all_out_complete()
147 static int sisusb_outurb_available(struct sisusb_usb_data *sisusb) in sisusb_outurb_available() argument
151 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_outurb_available()
153 if ((sisusb->urbstatus[i] & (SU_URB_BUSY|SU_URB_ALLOC)) == 0) in sisusb_outurb_available()
161 static int sisusb_get_free_outbuf(struct sisusb_usb_data *sisusb) in sisusb_get_free_outbuf() argument
165 wait_event_timeout(sisusb->wait_q, in sisusb_get_free_outbuf()
166 ((i = sisusb_outurb_available(sisusb)) >= 0), timeout); in sisusb_get_free_outbuf()
171 static int sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb) in sisusb_alloc_outbuf() argument
175 i = sisusb_outurb_available(sisusb); in sisusb_alloc_outbuf()
178 sisusb->urbstatus[i] |= SU_URB_ALLOC; in sisusb_alloc_outbuf()
183 static void sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index) in sisusb_free_outbuf() argument
185 if ((index >= 0) && (index < sisusb->numobufs)) in sisusb_free_outbuf()
186 sisusb->urbstatus[index] &= ~SU_URB_ALLOC; in sisusb_free_outbuf()
194 struct sisusb_usb_data *sisusb; in sisusb_bulk_completeout() local
199 sisusb = context->sisusb; in sisusb_bulk_completeout()
201 if (!sisusb || !sisusb->sisusb_dev || !sisusb->present) in sisusb_bulk_completeout()
209 sisusb->urbstatus[context->urbindex] &= ~SU_URB_BUSY; in sisusb_bulk_completeout()
210 wake_up(&sisusb->wait_q); in sisusb_bulk_completeout()
213 static int sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, in sisusb_bulkout_msg() argument
217 struct urb *urb = sisusb->sisurbout[index]; in sisusb_bulkout_msg()
223 usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, in sisusb_bulkout_msg()
225 &sisusb->urbout_context[index]); in sisusb_bulkout_msg()
231 sisusb->urbout_context[index].actual_length = (timeout) ? in sisusb_bulkout_msg()
235 sisusb->urbstatus[index] |= SU_URB_BUSY; in sisusb_bulkout_msg()
242 wait_event_timeout(sisusb->wait_q, in sisusb_bulkout_msg()
243 (!(sisusb->urbstatus[index] & SU_URB_BUSY)), in sisusb_bulkout_msg()
245 if (sisusb->urbstatus[index] & SU_URB_BUSY) { in sisusb_bulkout_msg()
268 struct sisusb_usb_data *sisusb = urb->context; in sisusb_bulk_completein() local
270 if (!sisusb || !sisusb->sisusb_dev || !sisusb->present) in sisusb_bulk_completein()
273 sisusb->completein = 1; in sisusb_bulk_completein()
274 wake_up(&sisusb->wait_q); in sisusb_bulk_completein()
277 static int sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, in sisusb_bulkin_msg() argument
281 struct urb *urb = sisusb->sisurbin; in sisusb_bulkin_msg()
286 usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, in sisusb_bulkin_msg()
287 sisusb_bulk_completein, sisusb); in sisusb_bulkin_msg()
292 sisusb->completein = 0; in sisusb_bulkin_msg()
295 wait_event_timeout(sisusb->wait_q, sisusb->completein, timeout); in sisusb_bulkin_msg()
296 if (!sisusb->completein) { in sisusb_bulkin_msg()
329 static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, in sisusb_send_bulk_msg() argument
343 if (!sisusb || !sisusb->present || !sisusb->sisusb_dev) in sisusb_send_bulk_msg()
356 else if (len > sisusb->obufsize) in sisusb_send_bulk_msg()
359 pipe = usb_sndbulkpipe(sisusb->sisusb_dev, ep); in sisusb_send_bulk_msg()
362 passsize = thispass = (sisusb->obufsize < count) ? in sisusb_send_bulk_msg()
363 sisusb->obufsize : count; in sisusb_send_bulk_msg()
366 index = sisusb_get_free_outbuf(sisusb); in sisusb_send_bulk_msg()
371 buffer = sisusb->obuf[index]; in sisusb_send_bulk_msg()
390 if (!sisusb->sisusb_dev) in sisusb_send_bulk_msg()
393 result = sisusb_bulkout_msg(sisusb, index, pipe, in sisusb_send_bulk_msg()
432 sisusb_wait_all_out_complete(sisusb); in sisusb_send_bulk_msg()
450 static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, in sisusb_recv_bulk_msg() argument
462 if (!sisusb || !sisusb->present || !sisusb->sisusb_dev) in sisusb_recv_bulk_msg()
465 pipe = usb_rcvbulkpipe(sisusb->sisusb_dev, ep); in sisusb_recv_bulk_msg()
466 buffer = sisusb->ibuf; in sisusb_recv_bulk_msg()
467 bufsize = sisusb->ibufsize; in sisusb_recv_bulk_msg()
472 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_recv_bulk_msg()
478 if (!sisusb->sisusb_dev) in sisusb_recv_bulk_msg()
483 result = sisusb_bulkin_msg(sisusb, pipe, buffer, thispass, in sisusb_recv_bulk_msg()
526 static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len, in sisusb_send_packet() argument
537 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_send_packet()
545 ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_GFX_OUT, len, in sisusb_send_packet()
553 ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_GFX_IN, 4, in sisusb_send_packet()
562 static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len, in sisusb_send_bridge_packet() argument
573 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_send_bridge_packet()
581 ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_BRIDGE_OUT, len, in sisusb_send_bridge_packet()
589 ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_BRIDGE_IN, 4, in sisusb_send_bridge_packet()
610 static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_byte() argument
618 return sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_byte()
621 static int sisusb_write_memio_word(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_word() argument
633 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
638 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
643 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
648 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
652 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
658 static int sisusb_write_memio_24bit(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_24bit() argument
670 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
675 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
680 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
684 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
689 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
693 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
699 static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_long() argument
711 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
716 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
720 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
725 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
729 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
734 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
738 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
754 static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, in sisusb_write_mem_bulk() argument
770 kernbuffer = sisusb->obuf[index]; in sisusb_write_mem_bulk()
785 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, in sisusb_write_mem_bulk()
800 ret = sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_write_mem_bulk()
832 ret = sisusb_write_memio_24bit(sisusb, SISUSB_TYPE_MEM, in sisusb_write_mem_bulk()
847 ret = sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, in sisusb_write_mem_bulk()
860 ret = sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
865 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
870 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
873 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
880 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
887 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
893 (sisusb->obufsize-1)); in sisusb_write_mem_bulk()
901 ret = sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
906 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
908 if (sisusb->flagb0 != 0x16) { in sisusb_write_mem_bulk()
912 ret |= sisusb_send_bridge_packet(sisusb, in sisusb_write_mem_bulk()
914 sisusb->flagb0 = 0x16; in sisusb_write_mem_bulk()
917 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
924 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
931 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
937 (sisusb->obufsize-1)); in sisusb_write_mem_bulk()
943 dev_err(&sisusb->sisusb_dev->dev, in sisusb_write_mem_bulk()
948 dev_err(&sisusb->sisusb_dev->dev, in sisusb_write_mem_bulk()
967 static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_byte() argument
976 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_byte()
981 static int sisusb_read_memio_word(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_word() argument
994 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
999 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1004 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1009 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1013 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1020 static int sisusb_read_memio_24bit(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_24bit() argument
1031 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1036 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1041 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1045 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1050 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1054 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1061 static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_long() argument
1072 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1077 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1081 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1086 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1090 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1095 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1099 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1106 static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, in sisusb_read_mem_bulk() argument
1122 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1135 ret |= sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1149 ret |= sisusb_read_memio_24bit(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1175 ret |= sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1202 int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) in sisusb_setreg() argument
1204 return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); in sisusb_setreg()
1207 int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) in sisusb_getreg() argument
1209 return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); in sisusb_getreg()
1213 int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, in sisusb_setidxreg() argument
1218 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); in sisusb_setidxreg()
1219 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data); in sisusb_setidxreg()
1223 int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, in sisusb_getidxreg() argument
1228 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); in sisusb_getidxreg()
1229 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data); in sisusb_getidxreg()
1233 int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, in sisusb_setidxregandor() argument
1239 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx); in sisusb_setidxregandor()
1240 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp); in sisusb_setidxregandor()
1243 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp); in sisusb_setidxregandor()
1247 static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, in sisusb_setidxregmask() argument
1253 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx); in sisusb_setidxregmask()
1254 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp); in sisusb_setidxregmask()
1257 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp); in sisusb_setidxregmask()
1261 int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, in sisusb_setidxregor() argument
1264 return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); in sisusb_setidxregor()
1267 int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, in sisusb_setidxregand() argument
1270 return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); in sisusb_setidxregand()
1276 int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data) in sisusb_writeb() argument
1278 return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data); in sisusb_writeb()
1281 int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data) in sisusb_readb() argument
1283 return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data); in sisusb_readb()
1286 int sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, in sisusb_copy_memory() argument
1291 return sisusb_write_mem_bulk(sisusb, dest, src, length, in sisusb_copy_memory()
1296 static int sisusb_read_memory(struct sisusb_usb_data *sisusb, char *dest, in sisusb_read_memory() argument
1301 return sisusb_read_mem_bulk(sisusb, src, dest, length, in sisusb_read_memory()
1308 static void sisusb_testreadwrite(struct sisusb_usb_data *sisusb) in sisusb_testreadwrite() argument
1314 sisusb_copy_memory(sisusb, srcbuffer, sisusb->vrambase, 7); in sisusb_testreadwrite()
1317 dev_dbg(&sisusb->sisusb_dev->dev, in sisusb_testreadwrite()
1319 sisusb_read_memory(sisusb, destbuffer, sisusb->vrambase, i); in sisusb_testreadwrite()
1321 dev_dbg(&sisusb->sisusb_dev->dev, in sisusb_testreadwrite()
1331 static int sisusb_write_pci_config(struct sisusb_usb_data *sisusb, in sisusb_write_pci_config() argument
1339 return sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_pci_config()
1342 static int sisusb_read_pci_config(struct sisusb_usb_data *sisusb, in sisusb_read_pci_config() argument
1350 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_pci_config()
1357 static int sisusb_clear_vram(struct sisusb_usb_data *sisusb, in sisusb_clear_vram() argument
1363 if (address < sisusb->vrambase) in sisusb_clear_vram()
1366 if (address >= sisusb->vrambase + sisusb->vramsize) in sisusb_clear_vram()
1369 if (address + length > sisusb->vrambase + sisusb->vramsize) in sisusb_clear_vram()
1370 length = sisusb->vrambase + sisusb->vramsize - address; in sisusb_clear_vram()
1376 i = sisusb_alloc_outbuf(sisusb); in sisusb_clear_vram()
1380 memset(sisusb->obuf[i], 0, sisusb->obufsize); in sisusb_clear_vram()
1385 ret = sisusb_write_mem_bulk(sisusb, address, NULL, length, NULL, i, &j); in sisusb_clear_vram()
1388 sisusb_free_outbuf(sisusb, i); in sisusb_clear_vram()
1398 #define GETREG(r, d) sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)
1399 #define SETREG(r, d) sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)
1400 #define SETIREG(r, i, d) sisusb_setidxreg(sisusb, r, i, d)
1401 #define GETIREG(r, i, d) sisusb_getidxreg(sisusb, r, i, d)
1402 #define SETIREGOR(r, i, o) sisusb_setidxregor(sisusb, r, i, o)
1403 #define SETIREGAND(r, i, a) sisusb_setidxregand(sisusb, r, i, a)
1404 #define SETIREGANDOR(r, i, a, o) sisusb_setidxregandor(sisusb, r, i, a, o)
1405 #define READL(a, d) sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
1406 #define WRITEL(a, d) sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
1407 #define READB(a, d) sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
1408 #define WRITEB(a, d) sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
1410 static int sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype) in sisusb_triggersr16() argument
1440 static int sisusb_getbuswidth(struct sisusb_usb_data *sisusb, in sisusb_getbuswidth() argument
1460 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1488 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1524 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1553 static int sisusb_verify_mclk(struct sisusb_usb_data *sisusb) in sisusb_verify_mclk() argument
1581 static int sisusb_set_rank(struct sisusb_usb_data *sisusb, int *iret, in sisusb_set_rank() argument
1606 ret |= sisusb_triggersr16(sisusb, 0); /* sic! */ in sisusb_set_rank()
1613 static int sisusb_check_rbc(struct sisusb_usb_data *sisusb, int *iret, in sisusb_check_rbc() argument
1622 ret |= WRITEL(sisusb->vrambase + j, j); in sisusb_check_rbc()
1627 ret |= READL(sisusb->vrambase + j, &tmp); in sisusb_check_rbc()
1638 static int sisusb_check_ranks(struct sisusb_usb_data *sisusb, in sisusb_check_ranks() argument
1649 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2); in sisusb_check_ranks()
1655 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 4); in sisusb_check_ranks()
1660 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2); in sisusb_check_ranks()
1668 static int sisusb_get_sdram_size(struct sisusb_usb_data *sisusb, int *iret, in sisusb_get_sdram_size() argument
1693 ret |= sisusb_set_rank(sisusb, &i2ret, i, j, chab, in sisusb_get_sdram_size()
1698 ret |= sisusb_check_ranks(sisusb, &i2ret, j, i, bw, in sisusb_get_sdram_size()
1710 static int sisusb_setup_screen(struct sisusb_usb_data *sisusb, in sisusb_setup_screen() argument
1719 address = sisusb->vrambase; /* Clear video ram */ in sisusb_setup_screen()
1722 length = sisusb->vramsize; in sisusb_setup_screen()
1726 ret = sisusb_clear_vram(sisusb, address, length); in sisusb_setup_screen()
1730 address = sisusb->vrambase + (i * bpp); in sisusb_setup_screen()
1731 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1734 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1738 address = sisusb->vrambase + ((i * modex) * bpp); in sisusb_setup_screen()
1739 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1742 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1750 static int sisusb_set_default_mode(struct sisusb_usb_data *sisusb, in sisusb_set_default_mode() argument
1880 static int sisusb_init_gfxcore(struct sisusb_usb_data *sisusb) in sisusb_init_gfxcore() argument
2005 ret |= sisusb_read_pci_config(sisusb, 0x50, &tmp32); in sisusb_init_gfxcore()
2022 ret |= sisusb_set_default_mode(sisusb, 0); in sisusb_init_gfxcore()
2028 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_init_gfxcore()
2034 ret |= sisusb_getbuswidth(sisusb, &bw, &chab); in sisusb_init_gfxcore()
2035 ret |= sisusb_verify_mclk(sisusb); in sisusb_init_gfxcore()
2038 ret |= sisusb_get_sdram_size(sisusb, &iret, bw, chab); in sisusb_init_gfxcore()
2040 dev_err(&sisusb->sisusb_dev->dev, in sisusb_init_gfxcore()
2046 dev_err(&sisusb->sisusb_dev->dev, in sisusb_init_gfxcore()
2079 static void sisusb_get_ramconfig(struct sisusb_usb_data *sisusb) in sisusb_get_ramconfig() argument
2090 sisusb_getidxreg(sisusb, SISSR, 0x14, &tmp8); in sisusb_get_ramconfig()
2091 sisusb_getidxreg(sisusb, SISSR, 0x15, &tmp82); in sisusb_get_ramconfig()
2092 sisusb_getidxreg(sisusb, SISSR, 0x3a, &ramtype); in sisusb_get_ramconfig()
2093 sisusb->vramsize = (1 << ((tmp8 & 0xf0) >> 4)) * 1024 * 1024; in sisusb_get_ramconfig()
2106 sisusb->vramsize <<= 1; in sisusb_get_ramconfig()
2111 sisusb->vramsize += sisusb->vramsize/2; in sisusb_get_ramconfig()
2116 sisusb->vramsize <<= 1; in sisusb_get_ramconfig()
2121 dev_info(&sisusb->sisusb_dev->dev, in sisusb_get_ramconfig()
2123 sisusb->vramsize >> 20, ramtypetext1, in sisusb_get_ramconfig()
2127 static int sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb) in sisusb_do_init_gfxdevice() argument
2137 ret = sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2142 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2147 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2152 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2156 ret |= sisusb_send_bridge_packet(sisusb, 6, &packet, 0); in sisusb_do_init_gfxdevice()
2158 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2161 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_do_init_gfxdevice()
2162 ret |= sisusb_write_pci_config(sisusb, 0x10, 0xfffffff0); in sisusb_do_init_gfxdevice()
2163 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_do_init_gfxdevice()
2166 ret |= sisusb_write_pci_config(sisusb, 0x10, tmp32); in sisusb_do_init_gfxdevice()
2169 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_do_init_gfxdevice()
2170 ret |= sisusb_write_pci_config(sisusb, 0x14, 0xfffffff0); in sisusb_do_init_gfxdevice()
2171 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_do_init_gfxdevice()
2174 ret |= sisusb_write_pci_config(sisusb, 0x14, tmp32); in sisusb_do_init_gfxdevice()
2177 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_do_init_gfxdevice()
2178 ret |= sisusb_write_pci_config(sisusb, 0x18, 0xfffffff0); in sisusb_do_init_gfxdevice()
2179 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_do_init_gfxdevice()
2182 ret |= sisusb_write_pci_config(sisusb, 0x18, tmp32); in sisusb_do_init_gfxdevice()
2185 ret |= sisusb_read_pci_config(sisusb, 0x04, &tmp32); in sisusb_do_init_gfxdevice()
2187 ret |= sisusb_write_pci_config(sisusb, 0x04, tmp32); in sisusb_do_init_gfxdevice()
2194 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2205 static int sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen) in sisusb_init_gfxdevice() argument
2210 if (sisusb->devinit == 1) { in sisusb_init_gfxdevice()
2212 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_init_gfxdevice()
2219 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_init_gfxdevice()
2226 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_init_gfxdevice()
2235 if ((sisusb->devinit == 0) || (test != 3)) { in sisusb_init_gfxdevice()
2237 ret |= sisusb_do_init_gfxdevice(sisusb); in sisusb_init_gfxdevice()
2240 sisusb->devinit = 1; in sisusb_init_gfxdevice()
2244 if (sisusb->devinit) { in sisusb_init_gfxdevice()
2246 if (sisusb_init_gfxcore(sisusb) == 0) { in sisusb_init_gfxdevice()
2247 sisusb->gfxinit = 1; in sisusb_init_gfxdevice()
2248 sisusb_get_ramconfig(sisusb); in sisusb_init_gfxdevice()
2249 ret |= sisusb_set_default_mode(sisusb, 1); in sisusb_init_gfxdevice()
2250 ret |= sisusb_setup_screen(sisusb, 1, initscreen); in sisusb_init_gfxdevice()
2266 int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init) in sisusb_reset_text_mode() argument
2268 int ret = 0, slot = sisusb->font_slot, i; in sisusb_reset_text_mode()
2278 if (!sisusb->SiS_Pr) in sisusb_reset_text_mode()
2281 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_reset_text_mode()
2282 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_reset_text_mode()
2285 SiSUSBSetMode(sisusb->SiS_Pr, 0x03); in sisusb_reset_text_mode()
2299 ret = sisusbcon_do_font_op(sisusb, 1, 0, tempbuf, 8192, in sisusb_reset_text_mode()
2305 if (sisusb->font_backup) { in sisusb_reset_text_mode()
2306 ret |= sisusbcon_do_font_op(sisusb, 1, 2, sisusb->font_backup, in sisusb_reset_text_mode()
2307 8192, sisusb->font_backup_512, 1, NULL, in sisusb_reset_text_mode()
2308 sisusb->font_backup_height, 0); in sisusb_reset_text_mode()
2310 sisusbcon_do_font_op(sisusb, 1, 0, NULL, 0, 0, 1, in sisusb_reset_text_mode()
2314 if (init && !sisusb->scrbuf) { in sisusb_reset_text_mode()
2337 ret |= sisusb_copy_memory(sisusb, tempbuf, in sisusb_reset_text_mode()
2338 sisusb->vrambase, 8192); in sisusb_reset_text_mode()
2344 } else if (sisusb->scrbuf) { in sisusb_reset_text_mode()
2345 ret |= sisusb_copy_memory(sisusb, (char *)sisusb->scrbuf, in sisusb_reset_text_mode()
2346 sisusb->vrambase, sisusb->scrbuf_size); in sisusb_reset_text_mode()
2349 if (sisusb->sisusb_cursor_size_from >= 0 && in sisusb_reset_text_mode()
2350 sisusb->sisusb_cursor_size_to >= 0) { in sisusb_reset_text_mode()
2351 sisusb_setidxreg(sisusb, SISCR, 0x0a, in sisusb_reset_text_mode()
2352 sisusb->sisusb_cursor_size_from); in sisusb_reset_text_mode()
2353 sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0xe0, in sisusb_reset_text_mode()
2354 sisusb->sisusb_cursor_size_to); in sisusb_reset_text_mode()
2356 sisusb_setidxreg(sisusb, SISCR, 0x0a, 0x2d); in sisusb_reset_text_mode()
2357 sisusb_setidxreg(sisusb, SISCR, 0x0b, 0x0e); in sisusb_reset_text_mode()
2358 sisusb->sisusb_cursor_size_to = -1; in sisusb_reset_text_mode()
2361 slot = sisusb->sisusb_cursor_loc; in sisusb_reset_text_mode()
2365 sisusb->sisusb_cursor_loc = -1; in sisusb_reset_text_mode()
2366 sisusb->bad_cursor_pos = 1; in sisusb_reset_text_mode()
2368 sisusb_set_cursor(sisusb, slot); in sisusb_reset_text_mode()
2370 sisusb_setidxreg(sisusb, SISCR, 0x0c, (sisusb->cur_start_addr >> 8)); in sisusb_reset_text_mode()
2371 sisusb_setidxreg(sisusb, SISCR, 0x0d, (sisusb->cur_start_addr & 0xff)); in sisusb_reset_text_mode()
2373 sisusb->textmodedestroyed = 0; in sisusb_reset_text_mode()
2386 struct sisusb_usb_data *sisusb; in sisusb_open() local
2394 sisusb = usb_get_intfdata(interface); in sisusb_open()
2395 if (!sisusb) in sisusb_open()
2398 mutex_lock(&sisusb->lock); in sisusb_open()
2400 if (!sisusb->present || !sisusb->ready) { in sisusb_open()
2401 mutex_unlock(&sisusb->lock); in sisusb_open()
2405 if (sisusb->isopen) { in sisusb_open()
2406 mutex_unlock(&sisusb->lock); in sisusb_open()
2410 if (!sisusb->devinit) { in sisusb_open()
2411 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH || in sisusb_open()
2412 sisusb->sisusb_dev->speed >= USB_SPEED_SUPER) { in sisusb_open()
2413 if (sisusb_init_gfxdevice(sisusb, 0)) { in sisusb_open()
2414 mutex_unlock(&sisusb->lock); in sisusb_open()
2415 dev_err(&sisusb->sisusb_dev->dev, in sisusb_open()
2420 mutex_unlock(&sisusb->lock); in sisusb_open()
2421 dev_err(&sisusb->sisusb_dev->dev, in sisusb_open()
2428 kref_get(&sisusb->kref); in sisusb_open()
2430 sisusb->isopen = 1; in sisusb_open()
2432 file->private_data = sisusb; in sisusb_open()
2434 mutex_unlock(&sisusb->lock); in sisusb_open()
2441 struct sisusb_usb_data *sisusb = to_sisusb_dev(kref); in sisusb_delete() local
2443 if (!sisusb) in sisusb_delete()
2446 usb_put_dev(sisusb->sisusb_dev); in sisusb_delete()
2448 sisusb->sisusb_dev = NULL; in sisusb_delete()
2449 sisusb_free_buffers(sisusb); in sisusb_delete()
2450 sisusb_free_urbs(sisusb); in sisusb_delete()
2452 kfree(sisusb->SiS_Pr); in sisusb_delete()
2454 kfree(sisusb); in sisusb_delete()
2459 struct sisusb_usb_data *sisusb; in sisusb_release() local
2461 sisusb = file->private_data; in sisusb_release()
2462 if (!sisusb) in sisusb_release()
2465 mutex_lock(&sisusb->lock); in sisusb_release()
2467 if (sisusb->present) { in sisusb_release()
2469 if (!sisusb_wait_all_out_complete(sisusb)) in sisusb_release()
2470 sisusb_kill_all_busy(sisusb); in sisusb_release()
2473 sisusb->isopen = 0; in sisusb_release()
2476 mutex_unlock(&sisusb->lock); in sisusb_release()
2479 kref_put(&sisusb->kref, sisusb_delete); in sisusb_release()
2487 struct sisusb_usb_data *sisusb; in sisusb_read() local
2494 sisusb = file->private_data; in sisusb_read()
2495 if (!sisusb) in sisusb_read()
2498 mutex_lock(&sisusb->lock); in sisusb_read()
2501 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_read()
2502 mutex_unlock(&sisusb->lock); in sisusb_read()
2519 if (sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, in sisusb_read()
2530 if (sisusb_read_memio_word(sisusb, SISUSB_TYPE_IO, in sisusb_read()
2541 if (sisusb_read_memio_long(sisusb, SISUSB_TYPE_IO, in sisusb_read()
2557 SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) { in sisusb_read()
2565 errno = sisusb_read_mem_bulk(sisusb, address, in sisusb_read()
2581 errno = sisusb_read_mem_bulk(sisusb, address, in sisusb_read()
2591 mutex_unlock(&sisusb->lock); in sisusb_read()
2600 if (sisusb_read_pci_config(sisusb, address, &buf32)) in sisusb_read()
2615 mutex_unlock(&sisusb->lock); in sisusb_read()
2623 struct sisusb_usb_data *sisusb; in sisusb_write() local
2630 sisusb = file->private_data; in sisusb_write()
2631 if (!sisusb) in sisusb_write()
2634 mutex_lock(&sisusb->lock); in sisusb_write()
2637 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_write()
2638 mutex_unlock(&sisusb->lock); in sisusb_write()
2657 else if (sisusb_write_memio_byte(sisusb, in sisusb_write()
2668 else if (sisusb_write_memio_word(sisusb, in sisusb_write()
2679 else if (sisusb_write_memio_long(sisusb, in sisusb_write()
2693 sisusb->vramsize) { in sisusb_write()
2704 errno = sisusb_write_mem_bulk(sisusb, address, NULL, in sisusb_write()
2722 errno = sisusb_write_mem_bulk(sisusb, address, NULL, in sisusb_write()
2733 mutex_unlock(&sisusb->lock); in sisusb_write()
2744 else if (sisusb_write_pci_config(sisusb, address, buf32)) in sisusb_write()
2759 mutex_unlock(&sisusb->lock); in sisusb_write()
2766 struct sisusb_usb_data *sisusb; in sisusb_lseek() local
2769 sisusb = file->private_data; in sisusb_lseek()
2770 if (!sisusb) in sisusb_lseek()
2773 mutex_lock(&sisusb->lock); in sisusb_lseek()
2776 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_lseek()
2777 mutex_unlock(&sisusb->lock); in sisusb_lseek()
2783 mutex_unlock(&sisusb->lock); in sisusb_lseek()
2787 static int sisusb_handle_command(struct sisusb_usb_data *sisusb, in sisusb_handle_command() argument
2796 if (!sisusb->devinit) in sisusb_handle_command()
2805 retval = sisusb_getidxreg(sisusb, port, y->data0, &y->data1); in sisusb_handle_command()
2813 retval = sisusb_setidxreg(sisusb, port, y->data0, y->data1); in sisusb_handle_command()
2817 retval = sisusb_setidxregor(sisusb, port, y->data0, y->data1); in sisusb_handle_command()
2821 retval = sisusb_setidxregand(sisusb, port, y->data0, y->data1); in sisusb_handle_command()
2825 retval = sisusb_setidxregandor(sisusb, port, y->data0, in sisusb_handle_command()
2830 retval = sisusb_setidxregmask(sisusb, port, y->data0, in sisusb_handle_command()
2836 if (!sisusb->gfxinit) in sisusb_handle_command()
2842 retval = sisusb_clear_vram(sisusb, address, length); in sisusb_handle_command()
2849 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2854 retval = sisusb_reset_text_mode(sisusb, 0); in sisusb_handle_command()
2857 sisusb->textmodedestroyed = 1; in sisusb_handle_command()
2866 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2871 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_handle_command()
2872 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_handle_command()
2874 if (SiSUSBSetMode(sisusb->SiS_Pr, y->data3)) in sisusb_handle_command()
2881 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2886 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_handle_command()
2887 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_handle_command()
2889 if (SiSUSBSetVESAMode(sisusb->SiS_Pr, y->data3)) in sisusb_handle_command()
2907 struct sisusb_usb_data *sisusb; in sisusb_ioctl() local
2913 sisusb = file->private_data; in sisusb_ioctl()
2914 if (!sisusb) in sisusb_ioctl()
2917 mutex_lock(&sisusb->lock); in sisusb_ioctl()
2920 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_ioctl()
2939 x.sisusb_gfxinit = sisusb->gfxinit; in sisusb_ioctl()
2944 x.sisusb_vramsize = sisusb->vramsize; in sisusb_ioctl()
2945 x.sisusb_minor = sisusb->minor; in sisusb_ioctl()
2948 x.sisusb_conactive = sisusb->haveconsole ? 1 : 0; in sisusb_ioctl()
2964 retval = sisusb_handle_command(sisusb, &y, arg); in sisusb_ioctl()
2974 mutex_unlock(&sisusb->lock); in sisusb_ioctl()
3017 struct sisusb_usb_data *sisusb; in sisusb_probe() local
3024 sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL); in sisusb_probe()
3025 if (!sisusb) in sisusb_probe()
3028 kref_init(&sisusb->kref); in sisusb_probe()
3030 mutex_init(&(sisusb->lock)); in sisusb_probe()
3035 dev_err(&sisusb->sisusb_dev->dev, in sisusb_probe()
3042 sisusb->sisusb_dev = dev; in sisusb_probe()
3043 sisusb->minor = intf->minor; in sisusb_probe()
3044 sisusb->vrambase = SISUSB_PCI_MEMBASE; in sisusb_probe()
3045 sisusb->mmiobase = SISUSB_PCI_MMIOBASE; in sisusb_probe()
3046 sisusb->mmiosize = SISUSB_PCI_MMIOSIZE; in sisusb_probe()
3047 sisusb->ioportbase = SISUSB_PCI_IOPORTBASE; in sisusb_probe()
3051 sisusb->ibufsize = SISUSB_IBUF_SIZE; in sisusb_probe()
3052 sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL); in sisusb_probe()
3053 if (!sisusb->ibuf) { in sisusb_probe()
3058 sisusb->numobufs = 0; in sisusb_probe()
3059 sisusb->obufsize = SISUSB_OBUF_SIZE; in sisusb_probe()
3061 sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL); in sisusb_probe()
3062 if (!sisusb->obuf[i]) { in sisusb_probe()
3069 sisusb->numobufs++; in sisusb_probe()
3073 sisusb->sisurbin = usb_alloc_urb(0, GFP_KERNEL); in sisusb_probe()
3074 if (!sisusb->sisurbin) { in sisusb_probe()
3078 sisusb->completein = 1; in sisusb_probe()
3080 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_probe()
3081 sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL); in sisusb_probe()
3082 if (!sisusb->sisurbout[i]) { in sisusb_probe()
3086 sisusb->urbout_context[i].sisusb = (void *)sisusb; in sisusb_probe()
3087 sisusb->urbout_context[i].urbindex = i; in sisusb_probe()
3088 sisusb->urbstatus[i] = 0; in sisusb_probe()
3091 dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n", in sisusb_probe()
3092 sisusb->numobufs); in sisusb_probe()
3096 sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL); in sisusb_probe()
3097 if (!sisusb->SiS_Pr) { in sisusb_probe()
3105 init_waitqueue_head(&sisusb->wait_q); in sisusb_probe()
3107 usb_set_intfdata(intf, sisusb); in sisusb_probe()
3109 usb_get_dev(sisusb->sisusb_dev); in sisusb_probe()
3111 sisusb->present = 1; in sisusb_probe()
3121 if (sisusb_init_gfxdevice(sisusb, initscreen)) in sisusb_probe()
3122 dev_err(&sisusb->sisusb_dev->dev, in sisusb_probe()
3126 dev_info(&sisusb->sisusb_dev->dev, in sisusb_probe()
3129 sisusb->ready = 1; in sisusb_probe()
3132 dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST ***\n"); in sisusb_probe()
3133 sisusb_testreadwrite(sisusb); in sisusb_probe()
3134 dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST END ***\n"); in sisusb_probe()
3138 sisusb_console_init(sisusb, sisusb_first_vc, sisusb_last_vc); in sisusb_probe()
3144 sisusb_free_urbs(sisusb); in sisusb_probe()
3146 sisusb_free_buffers(sisusb); in sisusb_probe()
3150 kfree(sisusb); in sisusb_probe()
3156 struct sisusb_usb_data *sisusb; in sisusb_disconnect() local
3159 sisusb = usb_get_intfdata(intf); in sisusb_disconnect()
3160 if (!sisusb) in sisusb_disconnect()
3164 sisusb_console_exit(sisusb); in sisusb_disconnect()
3169 mutex_lock(&sisusb->lock); in sisusb_disconnect()
3172 if (!sisusb_wait_all_out_complete(sisusb)) in sisusb_disconnect()
3173 sisusb_kill_all_busy(sisusb); in sisusb_disconnect()
3177 sisusb->present = 0; in sisusb_disconnect()
3178 sisusb->ready = 0; in sisusb_disconnect()
3180 mutex_unlock(&sisusb->lock); in sisusb_disconnect()
3183 kref_put(&sisusb->kref, sisusb_delete); in sisusb_disconnect()