Lines Matching refs:sisusb
75 sisusb_free_buffers(struct sisusb_usb_data *sisusb) in sisusb_free_buffers() argument
80 if (sisusb->obuf[i]) { in sisusb_free_buffers()
81 kfree(sisusb->obuf[i]); in sisusb_free_buffers()
82 sisusb->obuf[i] = NULL; in sisusb_free_buffers()
85 if (sisusb->ibuf) { in sisusb_free_buffers()
86 kfree(sisusb->ibuf); in sisusb_free_buffers()
87 sisusb->ibuf = NULL; in sisusb_free_buffers()
92 sisusb_free_urbs(struct sisusb_usb_data *sisusb) in sisusb_free_urbs() argument
97 usb_free_urb(sisusb->sisurbout[i]); in sisusb_free_urbs()
98 sisusb->sisurbout[i] = NULL; in sisusb_free_urbs()
100 usb_free_urb(sisusb->sisurbin); in sisusb_free_urbs()
101 sisusb->sisurbin = NULL; in sisusb_free_urbs()
112 sisusb_all_free(struct sisusb_usb_data *sisusb) in sisusb_all_free() argument
116 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_all_free()
118 if (sisusb->urbstatus[i] & SU_URB_BUSY) in sisusb_all_free()
128 sisusb_kill_all_busy(struct sisusb_usb_data *sisusb) in sisusb_kill_all_busy() argument
132 if (sisusb_all_free(sisusb)) in sisusb_kill_all_busy()
135 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_kill_all_busy()
137 if (sisusb->urbstatus[i] & SU_URB_BUSY) in sisusb_kill_all_busy()
138 usb_kill_urb(sisusb->sisurbout[i]); in sisusb_kill_all_busy()
145 sisusb_wait_all_out_complete(struct sisusb_usb_data *sisusb) in sisusb_wait_all_out_complete() argument
149 wait_event_timeout(sisusb->wait_q, in sisusb_wait_all_out_complete()
150 (i = sisusb_all_free(sisusb)), in sisusb_wait_all_out_complete()
157 sisusb_outurb_available(struct sisusb_usb_data *sisusb) in sisusb_outurb_available() argument
161 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_outurb_available()
163 if ((sisusb->urbstatus[i] & (SU_URB_BUSY|SU_URB_ALLOC)) == 0) in sisusb_outurb_available()
172 sisusb_get_free_outbuf(struct sisusb_usb_data *sisusb) in sisusb_get_free_outbuf() argument
176 wait_event_timeout(sisusb->wait_q, in sisusb_get_free_outbuf()
177 ((i = sisusb_outurb_available(sisusb)) >= 0), in sisusb_get_free_outbuf()
184 sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb) in sisusb_alloc_outbuf() argument
188 i = sisusb_outurb_available(sisusb); in sisusb_alloc_outbuf()
191 sisusb->urbstatus[i] |= SU_URB_ALLOC; in sisusb_alloc_outbuf()
197 sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index) in sisusb_free_outbuf() argument
199 if ((index >= 0) && (index < sisusb->numobufs)) in sisusb_free_outbuf()
200 sisusb->urbstatus[index] &= ~SU_URB_ALLOC; in sisusb_free_outbuf()
209 struct sisusb_usb_data *sisusb; in sisusb_bulk_completeout() local
214 sisusb = context->sisusb; in sisusb_bulk_completeout()
216 if (!sisusb || !sisusb->sisusb_dev || !sisusb->present) in sisusb_bulk_completeout()
224 sisusb->urbstatus[context->urbindex] &= ~SU_URB_BUSY; in sisusb_bulk_completeout()
225 wake_up(&sisusb->wait_q); in sisusb_bulk_completeout()
229 sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data, in sisusb_bulkout_msg() argument
232 struct urb *urb = sisusb->sisurbout[index]; in sisusb_bulkout_msg()
238 usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, in sisusb_bulkout_msg()
239 sisusb_bulk_completeout, &sisusb->urbout_context[index]); in sisusb_bulkout_msg()
245 sisusb->urbout_context[index].actual_length = (timeout) ? in sisusb_bulkout_msg()
249 sisusb->urbstatus[index] |= SU_URB_BUSY; in sisusb_bulkout_msg()
256 wait_event_timeout(sisusb->wait_q, in sisusb_bulkout_msg()
257 (!(sisusb->urbstatus[index] & SU_URB_BUSY)), in sisusb_bulkout_msg()
259 if (sisusb->urbstatus[index] & SU_URB_BUSY) { in sisusb_bulkout_msg()
283 struct sisusb_usb_data *sisusb = urb->context; in sisusb_bulk_completein() local
285 if (!sisusb || !sisusb->sisusb_dev || !sisusb->present) in sisusb_bulk_completein()
288 sisusb->completein = 1; in sisusb_bulk_completein()
289 wake_up(&sisusb->wait_q); in sisusb_bulk_completein()
293 sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, in sisusb_bulkin_msg() argument
296 struct urb *urb = sisusb->sisurbin; in sisusb_bulkin_msg()
301 usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len, in sisusb_bulkin_msg()
302 sisusb_bulk_completein, sisusb); in sisusb_bulkin_msg()
307 sisusb->completein = 0; in sisusb_bulkin_msg()
310 wait_event_timeout(sisusb->wait_q, sisusb->completein, timeout); in sisusb_bulkin_msg()
311 if (!sisusb->completein) { in sisusb_bulkin_msg()
344 static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, in sisusb_send_bulk_msg() argument
358 if (!sisusb || !sisusb->present || !sisusb->sisusb_dev) in sisusb_send_bulk_msg()
371 else if (len > sisusb->obufsize) in sisusb_send_bulk_msg()
374 pipe = usb_sndbulkpipe(sisusb->sisusb_dev, ep); in sisusb_send_bulk_msg()
377 passsize = thispass = (sisusb->obufsize < count) ? in sisusb_send_bulk_msg()
378 sisusb->obufsize : count; in sisusb_send_bulk_msg()
381 index = sisusb_get_free_outbuf(sisusb); in sisusb_send_bulk_msg()
386 buffer = sisusb->obuf[index]; in sisusb_send_bulk_msg()
405 if (!sisusb->sisusb_dev) in sisusb_send_bulk_msg()
408 result = sisusb_bulkout_msg(sisusb, in sisusb_send_bulk_msg()
452 sisusb_wait_all_out_complete(sisusb); in sisusb_send_bulk_msg()
470 static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, in sisusb_recv_bulk_msg() argument
482 if (!sisusb || !sisusb->present || !sisusb->sisusb_dev) in sisusb_recv_bulk_msg()
485 pipe = usb_rcvbulkpipe(sisusb->sisusb_dev, ep); in sisusb_recv_bulk_msg()
486 buffer = sisusb->ibuf; in sisusb_recv_bulk_msg()
487 bufsize = sisusb->ibufsize; in sisusb_recv_bulk_msg()
492 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_recv_bulk_msg()
498 if (!sisusb->sisusb_dev) in sisusb_recv_bulk_msg()
503 result = sisusb_bulkin_msg(sisusb, in sisusb_recv_bulk_msg()
551 static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len, in sisusb_send_packet() argument
562 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_send_packet()
570 ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_GFX_OUT, len, in sisusb_send_packet()
578 ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_GFX_IN, 4, in sisusb_send_packet()
587 static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len, in sisusb_send_bridge_packet() argument
599 if (!(sisusb_wait_all_out_complete(sisusb))) in sisusb_send_bridge_packet()
607 ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_BRIDGE_OUT, len, in sisusb_send_bridge_packet()
615 ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_BRIDGE_IN, 4, in sisusb_send_bridge_packet()
636 static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_byte() argument
645 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_byte()
649 static int sisusb_write_memio_word(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_word() argument
661 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
666 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
671 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
676 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
680 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_word()
686 static int sisusb_write_memio_24bit(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_24bit() argument
698 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
703 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
708 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
712 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
717 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
721 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_24bit()
727 static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type, in sisusb_write_memio_long() argument
739 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
744 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
748 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
753 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
757 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
762 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
766 ret |= sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_memio_long()
782 static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, in sisusb_write_mem_bulk() argument
799 kernbuffer = sisusb->obuf[index]; in sisusb_write_mem_bulk()
816 ret = sisusb_write_memio_byte(sisusb, in sisusb_write_mem_bulk()
832 ret = sisusb_write_memio_word(sisusb, in sisusb_write_mem_bulk()
866 ret = sisusb_write_memio_24bit(sisusb, in sisusb_write_mem_bulk()
883 ret = sisusb_write_memio_long(sisusb, in sisusb_write_mem_bulk()
898 ret = sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
903 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
908 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
911 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
918 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
925 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
931 (sisusb->obufsize-1)); in sisusb_write_mem_bulk()
939 ret = sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
944 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
946 if (sisusb->flagb0 != 0x16) { in sisusb_write_mem_bulk()
950 ret |= sisusb_send_bridge_packet(sisusb, 10, in sisusb_write_mem_bulk()
952 sisusb->flagb0 = 0x16; in sisusb_write_mem_bulk()
955 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
962 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
969 ret |= sisusb_send_bulk_msg(sisusb, in sisusb_write_mem_bulk()
975 (sisusb->obufsize-1)); in sisusb_write_mem_bulk()
981 dev_err(&sisusb->sisusb_dev->dev, "Wrote %zd of %d bytes, error %d\n", in sisusb_write_mem_bulk()
984 dev_err(&sisusb->sisusb_dev->dev, "Too many errors, logging stopped\n"); in sisusb_write_mem_bulk()
1002 static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_byte() argument
1011 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_byte()
1016 static int sisusb_read_memio_word(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_word() argument
1029 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1034 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1039 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1044 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1048 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_word()
1055 static int sisusb_read_memio_24bit(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_24bit() argument
1066 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1071 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1076 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1080 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1085 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1089 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_24bit()
1096 static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type, in sisusb_read_memio_long() argument
1107 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1112 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1116 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1121 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1125 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1130 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1134 ret |= sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_memio_long()
1141 static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, in sisusb_read_mem_bulk() argument
1160 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1176 ret |= sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1191 ret |= sisusb_read_memio_24bit(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1216 ret |= sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, in sisusb_read_mem_bulk()
1246 sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) in sisusb_setreg() argument
1248 return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); in sisusb_setreg()
1252 sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) in sisusb_getreg() argument
1254 return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); in sisusb_getreg()
1259 sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) in sisusb_setidxreg() argument
1262 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); in sisusb_setidxreg()
1263 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data); in sisusb_setidxreg()
1268 sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) in sisusb_getidxreg() argument
1271 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); in sisusb_getidxreg()
1272 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data); in sisusb_getidxreg()
1277 sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, in sisusb_setidxregandor() argument
1283 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx); in sisusb_setidxregandor()
1284 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp); in sisusb_setidxregandor()
1287 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp); in sisusb_setidxregandor()
1292 sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx, in sisusb_setidxregmask() argument
1297 ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx); in sisusb_setidxregmask()
1298 ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp); in sisusb_setidxregmask()
1301 ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp); in sisusb_setidxregmask()
1306 sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor) in sisusb_setidxregor() argument
1308 return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor)); in sisusb_setidxregor()
1312 sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand) in sisusb_setidxregand() argument
1314 return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00)); in sisusb_setidxregand()
1321 sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data) in sisusb_writeb() argument
1323 return(sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data)); in sisusb_writeb()
1327 sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data) in sisusb_readb() argument
1329 return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data)); in sisusb_readb()
1333 sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src, in sisusb_copy_memory() argument
1336 return(sisusb_write_mem_bulk(sisusb, dest, src, length, NULL, 0, bytes_written)); in sisusb_copy_memory()
1341 sisusb_read_memory(struct sisusb_usb_data *sisusb, char *dest, in sisusb_read_memory() argument
1344 return(sisusb_read_mem_bulk(sisusb, src, dest, length, NULL, bytes_written)); in sisusb_read_memory()
1351 sisusb_testreadwrite(struct sisusb_usb_data *sisusb) in sisusb_testreadwrite() argument
1358 sisusb_copy_memory(sisusb, srcbuffer, sisusb->vrambase, 7, &dummy); in sisusb_testreadwrite()
1361 dev_dbg(&sisusb->sisusb_dev->dev, "sisusb: rwtest %d bytes\n", i); in sisusb_testreadwrite()
1362 sisusb_read_memory(sisusb, destbuffer, sisusb->vrambase, i, &dummy); in sisusb_testreadwrite()
1364 dev_dbg(&sisusb->sisusb_dev->dev, "rwtest read[%d] = %x\n", j, destbuffer[j]); in sisusb_testreadwrite()
1373 sisusb_write_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 data) in sisusb_write_pci_config() argument
1381 ret = sisusb_send_packet(sisusb, 10, &packet); in sisusb_write_pci_config()
1386 sisusb_read_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 *data) in sisusb_read_pci_config() argument
1393 ret = sisusb_send_packet(sisusb, 6, &packet); in sisusb_read_pci_config()
1401 sisusb_clear_vram(struct sisusb_usb_data *sisusb, u32 address, int length) in sisusb_clear_vram() argument
1406 if (address < sisusb->vrambase) in sisusb_clear_vram()
1409 if (address >= sisusb->vrambase + sisusb->vramsize) in sisusb_clear_vram()
1412 if (address + length > sisusb->vrambase + sisusb->vramsize) in sisusb_clear_vram()
1413 length = sisusb->vrambase + sisusb->vramsize - address; in sisusb_clear_vram()
1419 if ((i = sisusb_alloc_outbuf(sisusb)) < 0) in sisusb_clear_vram()
1422 memset(sisusb->obuf[i], 0, sisusb->obufsize); in sisusb_clear_vram()
1427 ret = sisusb_write_mem_bulk(sisusb, address, NULL, length, NULL, i, &j); in sisusb_clear_vram()
1430 sisusb_free_outbuf(sisusb, i); in sisusb_clear_vram()
1440 #define GETREG(r,d) sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)
1441 #define SETREG(r,d) sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)
1442 #define SETIREG(r,i,d) sisusb_setidxreg(sisusb, r, i, d)
1443 #define GETIREG(r,i,d) sisusb_getidxreg(sisusb, r, i, d)
1444 #define SETIREGOR(r,i,o) sisusb_setidxregor(sisusb, r, i, o)
1445 #define SETIREGAND(r,i,a) sisusb_setidxregand(sisusb, r, i, a)
1446 #define SETIREGANDOR(r,i,a,o) sisusb_setidxregandor(sisusb, r, i, a, o)
1447 #define READL(a,d) sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
1448 #define WRITEL(a,d) sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)
1449 #define READB(a,d) sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
1450 #define WRITEB(a,d) sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
1453 sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype) in sisusb_triggersr16() argument
1484 sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab) in sisusb_getbuswidth() argument
1503 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1531 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1567 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_getbuswidth()
1597 sisusb_verify_mclk(struct sisusb_usb_data *sisusb) in sisusb_verify_mclk() argument
1626 sisusb_set_rank(struct sisusb_usb_data *sisusb, int *iret, int index, in sisusb_set_rank() argument
1650 ret |= sisusb_triggersr16(sisusb, 0); /* sic! */ in sisusb_set_rank()
1658 sisusb_check_rbc(struct sisusb_usb_data *sisusb, int *iret, u32 inc, int testn) in sisusb_check_rbc() argument
1666 ret |= WRITEL(sisusb->vrambase + j, j); in sisusb_check_rbc()
1671 ret |= READL(sisusb->vrambase + j, &tmp); in sisusb_check_rbc()
1681 sisusb_check_ranks(struct sisusb_usb_data *sisusb, int *iret, int rankno, in sisusb_check_ranks() argument
1694 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2); in sisusb_check_ranks()
1700 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 4); in sisusb_check_ranks()
1705 ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2); in sisusb_check_ranks()
1714 sisusb_get_sdram_size(struct sisusb_usb_data *sisusb, int *iret, int bw, in sisusb_get_sdram_size() argument
1739 ret |= sisusb_set_rank(sisusb, &i2ret, i, j, in sisusb_get_sdram_size()
1744 ret |= sisusb_check_ranks(sisusb, &i2ret, j, i, in sisusb_get_sdram_size()
1757 sisusb_setup_screen(struct sisusb_usb_data *sisusb, int clrall, int drwfr) in sisusb_setup_screen() argument
1765 address = sisusb->vrambase; /* Clear video ram */ in sisusb_setup_screen()
1768 length = sisusb->vramsize; in sisusb_setup_screen()
1772 ret = sisusb_clear_vram(sisusb, address, length); in sisusb_setup_screen()
1776 address = sisusb->vrambase + (i * bpp); in sisusb_setup_screen()
1777 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1780 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1784 address = sisusb->vrambase + ((i * modex) * bpp); in sisusb_setup_screen()
1785 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1788 ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM, in sisusb_setup_screen()
1797 sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines) in sisusb_set_default_mode() argument
1929 sisusb_init_gfxcore(struct sisusb_usb_data *sisusb) in sisusb_init_gfxcore() argument
2049 ret |= sisusb_read_pci_config(sisusb, 0x50, &tmp32); in sisusb_init_gfxcore()
2065 ret |= sisusb_set_default_mode(sisusb, 0); in sisusb_init_gfxcore()
2071 ret |= sisusb_triggersr16(sisusb, ramtype); in sisusb_init_gfxcore()
2077 ret |= sisusb_getbuswidth(sisusb, &bw, &chab); in sisusb_init_gfxcore()
2078 ret |= sisusb_verify_mclk(sisusb); in sisusb_init_gfxcore()
2081 ret |= sisusb_get_sdram_size(sisusb, &iret, bw, chab); in sisusb_init_gfxcore()
2083 dev_err(&sisusb->sisusb_dev->dev,"RAM size detection failed, assuming 8MB video RAM\n"); in sisusb_init_gfxcore()
2088 dev_err(&sisusb->sisusb_dev->dev, "DDR RAM device found, assuming 8MB video RAM\n"); in sisusb_init_gfxcore()
2121 sisusb_get_ramconfig(struct sisusb_usb_data *sisusb) in sisusb_get_ramconfig() argument
2132 sisusb_getidxreg(sisusb, SISSR, 0x14, &tmp8); in sisusb_get_ramconfig()
2133 sisusb_getidxreg(sisusb, SISSR, 0x15, &tmp82); in sisusb_get_ramconfig()
2134 sisusb_getidxreg(sisusb, SISSR, 0x3a, &ramtype); in sisusb_get_ramconfig()
2135 sisusb->vramsize = (1 << ((tmp8 & 0xf0) >> 4)) * 1024 * 1024; in sisusb_get_ramconfig()
2146 sisusb->vramsize <<= 1; in sisusb_get_ramconfig()
2150 sisusb->vramsize += sisusb->vramsize/2; in sisusb_get_ramconfig()
2154 sisusb->vramsize <<= 1; in sisusb_get_ramconfig()
2159 …dev_info(&sisusb->sisusb_dev->dev, "%dMB %s %s, bus width %d\n", (sisusb->vramsize >> 20), ramtype… in sisusb_get_ramconfig()
2164 sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb) in sisusb_do_init_gfxdevice() argument
2174 ret = sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2179 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2184 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2189 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2193 ret |= sisusb_send_bridge_packet(sisusb, 6, &packet, 0); in sisusb_do_init_gfxdevice()
2195 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2198 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_do_init_gfxdevice()
2199 ret |= sisusb_write_pci_config(sisusb, 0x10, 0xfffffff0); in sisusb_do_init_gfxdevice()
2200 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_do_init_gfxdevice()
2203 ret |= sisusb_write_pci_config(sisusb, 0x10, tmp32); in sisusb_do_init_gfxdevice()
2206 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_do_init_gfxdevice()
2207 ret |= sisusb_write_pci_config(sisusb, 0x14, 0xfffffff0); in sisusb_do_init_gfxdevice()
2208 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_do_init_gfxdevice()
2211 ret |= sisusb_write_pci_config(sisusb, 0x14, tmp32); in sisusb_do_init_gfxdevice()
2214 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_do_init_gfxdevice()
2215 ret |= sisusb_write_pci_config(sisusb, 0x18, 0xfffffff0); in sisusb_do_init_gfxdevice()
2216 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_do_init_gfxdevice()
2219 ret |= sisusb_write_pci_config(sisusb, 0x18, tmp32); in sisusb_do_init_gfxdevice()
2222 ret |= sisusb_read_pci_config(sisusb, 0x04, &tmp32); in sisusb_do_init_gfxdevice()
2224 ret |= sisusb_write_pci_config(sisusb, 0x04, tmp32); in sisusb_do_init_gfxdevice()
2231 ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0); in sisusb_do_init_gfxdevice()
2243 sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen) in sisusb_init_gfxdevice() argument
2248 if (sisusb->devinit == 1) { in sisusb_init_gfxdevice()
2250 ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32); in sisusb_init_gfxdevice()
2254 ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32); in sisusb_init_gfxdevice()
2258 ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32); in sisusb_init_gfxdevice()
2264 if ((sisusb->devinit == 0) || (test != 3)) { in sisusb_init_gfxdevice()
2266 ret |= sisusb_do_init_gfxdevice(sisusb); in sisusb_init_gfxdevice()
2269 sisusb->devinit = 1; in sisusb_init_gfxdevice()
2273 if (sisusb->devinit) { in sisusb_init_gfxdevice()
2275 if (sisusb_init_gfxcore(sisusb) == 0) { in sisusb_init_gfxdevice()
2276 sisusb->gfxinit = 1; in sisusb_init_gfxdevice()
2277 sisusb_get_ramconfig(sisusb); in sisusb_init_gfxdevice()
2278 ret |= sisusb_set_default_mode(sisusb, 1); in sisusb_init_gfxdevice()
2279 ret |= sisusb_setup_screen(sisusb, 1, initscreen); in sisusb_init_gfxdevice()
2296 sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init) in sisusb_reset_text_mode() argument
2298 int ret = 0, slot = sisusb->font_slot, i; in sisusb_reset_text_mode()
2308 if (!sisusb->SiS_Pr) in sisusb_reset_text_mode()
2311 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_reset_text_mode()
2312 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_reset_text_mode()
2315 SiSUSBSetMode(sisusb->SiS_Pr, 0x03); in sisusb_reset_text_mode()
2327 ret = sisusbcon_do_font_op(sisusb, 1, 0, tempbuf, 8192, 0, 1, NULL, 16, 0); in sisusb_reset_text_mode()
2332 if (sisusb->font_backup) { in sisusb_reset_text_mode()
2333 ret |= sisusbcon_do_font_op(sisusb, 1, 2, sisusb->font_backup, in sisusb_reset_text_mode()
2334 8192, sisusb->font_backup_512, 1, NULL, in sisusb_reset_text_mode()
2335 sisusb->font_backup_height, 0); in sisusb_reset_text_mode()
2337 sisusbcon_do_font_op(sisusb, 1, 0, NULL, 0, 0, 1, in sisusb_reset_text_mode()
2341 if (init && !sisusb->scrbuf) { in sisusb_reset_text_mode()
2363 ret |= sisusb_copy_memory(sisusb, tempbuf, in sisusb_reset_text_mode()
2364 sisusb->vrambase, 8192, &written); in sisusb_reset_text_mode()
2370 } else if (sisusb->scrbuf) { in sisusb_reset_text_mode()
2372 ret |= sisusb_copy_memory(sisusb, (char *)sisusb->scrbuf, in sisusb_reset_text_mode()
2373 sisusb->vrambase, sisusb->scrbuf_size, &written); in sisusb_reset_text_mode()
2377 if (sisusb->sisusb_cursor_size_from >= 0 && in sisusb_reset_text_mode()
2378 sisusb->sisusb_cursor_size_to >= 0) { in sisusb_reset_text_mode()
2379 sisusb_setidxreg(sisusb, SISCR, 0x0a, in sisusb_reset_text_mode()
2380 sisusb->sisusb_cursor_size_from); in sisusb_reset_text_mode()
2381 sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0xe0, in sisusb_reset_text_mode()
2382 sisusb->sisusb_cursor_size_to); in sisusb_reset_text_mode()
2384 sisusb_setidxreg(sisusb, SISCR, 0x0a, 0x2d); in sisusb_reset_text_mode()
2385 sisusb_setidxreg(sisusb, SISCR, 0x0b, 0x0e); in sisusb_reset_text_mode()
2386 sisusb->sisusb_cursor_size_to = -1; in sisusb_reset_text_mode()
2389 slot = sisusb->sisusb_cursor_loc; in sisusb_reset_text_mode()
2392 sisusb->sisusb_cursor_loc = -1; in sisusb_reset_text_mode()
2393 sisusb->bad_cursor_pos = 1; in sisusb_reset_text_mode()
2395 sisusb_set_cursor(sisusb, slot); in sisusb_reset_text_mode()
2397 sisusb_setidxreg(sisusb, SISCR, 0x0c, (sisusb->cur_start_addr >> 8)); in sisusb_reset_text_mode()
2398 sisusb_setidxreg(sisusb, SISCR, 0x0d, (sisusb->cur_start_addr & 0xff)); in sisusb_reset_text_mode()
2400 sisusb->textmodedestroyed = 0; in sisusb_reset_text_mode()
2414 struct sisusb_usb_data *sisusb; in sisusb_open() local
2422 if (!(sisusb = usb_get_intfdata(interface))) { in sisusb_open()
2426 mutex_lock(&sisusb->lock); in sisusb_open()
2428 if (!sisusb->present || !sisusb->ready) { in sisusb_open()
2429 mutex_unlock(&sisusb->lock); in sisusb_open()
2433 if (sisusb->isopen) { in sisusb_open()
2434 mutex_unlock(&sisusb->lock); in sisusb_open()
2438 if (!sisusb->devinit) { in sisusb_open()
2439 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH || in sisusb_open()
2440 sisusb->sisusb_dev->speed == USB_SPEED_SUPER) { in sisusb_open()
2441 if (sisusb_init_gfxdevice(sisusb, 0)) { in sisusb_open()
2442 mutex_unlock(&sisusb->lock); in sisusb_open()
2443 dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); in sisusb_open()
2447 mutex_unlock(&sisusb->lock); in sisusb_open()
2448 dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n"); in sisusb_open()
2454 kref_get(&sisusb->kref); in sisusb_open()
2456 sisusb->isopen = 1; in sisusb_open()
2458 file->private_data = sisusb; in sisusb_open()
2460 mutex_unlock(&sisusb->lock); in sisusb_open()
2468 struct sisusb_usb_data *sisusb = to_sisusb_dev(kref); in sisusb_delete() local
2470 if (!sisusb) in sisusb_delete()
2473 if (sisusb->sisusb_dev) in sisusb_delete()
2474 usb_put_dev(sisusb->sisusb_dev); in sisusb_delete()
2476 sisusb->sisusb_dev = NULL; in sisusb_delete()
2477 sisusb_free_buffers(sisusb); in sisusb_delete()
2478 sisusb_free_urbs(sisusb); in sisusb_delete()
2480 kfree(sisusb->SiS_Pr); in sisusb_delete()
2482 kfree(sisusb); in sisusb_delete()
2488 struct sisusb_usb_data *sisusb; in sisusb_release() local
2490 if (!(sisusb = file->private_data)) in sisusb_release()
2493 mutex_lock(&sisusb->lock); in sisusb_release()
2495 if (sisusb->present) { in sisusb_release()
2497 if (!sisusb_wait_all_out_complete(sisusb)) in sisusb_release()
2498 sisusb_kill_all_busy(sisusb); in sisusb_release()
2501 sisusb->isopen = 0; in sisusb_release()
2504 mutex_unlock(&sisusb->lock); in sisusb_release()
2507 kref_put(&sisusb->kref, sisusb_delete); in sisusb_release()
2515 struct sisusb_usb_data *sisusb; in sisusb_read() local
2522 if (!(sisusb = file->private_data)) in sisusb_read()
2525 mutex_lock(&sisusb->lock); in sisusb_read()
2528 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_read()
2529 mutex_unlock(&sisusb->lock); in sisusb_read()
2548 if (sisusb_read_memio_byte(sisusb, in sisusb_read()
2560 if (sisusb_read_memio_word(sisusb, in sisusb_read()
2572 if (sisusb_read_memio_long(sisusb, in sisusb_read()
2589 (*ppos) < SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) { in sisusb_read()
2598 errno = sisusb_read_mem_bulk(sisusb, address, in sisusb_read()
2614 errno = sisusb_read_mem_bulk(sisusb, address, in sisusb_read()
2624 mutex_unlock(&sisusb->lock); in sisusb_read()
2633 if (sisusb_read_pci_config(sisusb, address, &buf32)) in sisusb_read()
2648 mutex_unlock(&sisusb->lock); in sisusb_read()
2657 struct sisusb_usb_data *sisusb; in sisusb_write() local
2664 if (!(sisusb = file->private_data)) in sisusb_write()
2667 mutex_lock(&sisusb->lock); in sisusb_write()
2670 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_write()
2671 mutex_unlock(&sisusb->lock); in sisusb_write()
2692 else if (sisusb_write_memio_byte(sisusb, in sisusb_write()
2704 else if (sisusb_write_memio_word(sisusb, in sisusb_write()
2716 else if (sisusb_write_memio_long(sisusb, in sisusb_write()
2730 (*ppos) < SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) { in sisusb_write()
2742 errno = sisusb_write_mem_bulk(sisusb, address, NULL, in sisusb_write()
2760 errno = sisusb_write_mem_bulk(sisusb, address, NULL, in sisusb_write()
2770 mutex_unlock(&sisusb->lock); in sisusb_write()
2781 else if (sisusb_write_pci_config(sisusb, address, buf32)) in sisusb_write()
2796 mutex_unlock(&sisusb->lock); in sisusb_write()
2804 struct sisusb_usb_data *sisusb; in sisusb_lseek() local
2807 if (!(sisusb = file->private_data)) in sisusb_lseek()
2810 mutex_lock(&sisusb->lock); in sisusb_lseek()
2813 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_lseek()
2814 mutex_unlock(&sisusb->lock); in sisusb_lseek()
2834 mutex_unlock(&sisusb->lock); in sisusb_lseek()
2839 sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y, in sisusb_handle_command() argument
2848 if (!sisusb->devinit) in sisusb_handle_command()
2857 retval = sisusb_getidxreg(sisusb, port, in sisusb_handle_command()
2867 retval = sisusb_setidxreg(sisusb, port, in sisusb_handle_command()
2872 retval = sisusb_setidxregor(sisusb, port, in sisusb_handle_command()
2877 retval = sisusb_setidxregand(sisusb, port, in sisusb_handle_command()
2882 retval = sisusb_setidxregandor(sisusb, port, in sisusb_handle_command()
2887 retval = sisusb_setidxregmask(sisusb, port, in sisusb_handle_command()
2893 if (!sisusb->gfxinit) in sisusb_handle_command()
2900 retval = sisusb_clear_vram(sisusb, address, length); in sisusb_handle_command()
2907 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2912 retval = sisusb_reset_text_mode(sisusb, 0); in sisusb_handle_command()
2915 sisusb->textmodedestroyed = 1; in sisusb_handle_command()
2924 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2929 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_handle_command()
2930 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_handle_command()
2932 if (SiSUSBSetMode(sisusb->SiS_Pr, y->data3)) in sisusb_handle_command()
2939 if (!sisusb->gfxinit || !sisusb->SiS_Pr) in sisusb_handle_command()
2944 sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30; in sisusb_handle_command()
2945 sisusb->SiS_Pr->sisusb = (void *)sisusb; in sisusb_handle_command()
2947 if (SiSUSBSetVESAMode(sisusb->SiS_Pr, y->data3)) in sisusb_handle_command()
2966 struct sisusb_usb_data *sisusb; in sisusb_ioctl() local
2972 if (!(sisusb = file->private_data)) in sisusb_ioctl()
2975 mutex_lock(&sisusb->lock); in sisusb_ioctl()
2978 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { in sisusb_ioctl()
2998 x.sisusb_gfxinit = sisusb->gfxinit; in sisusb_ioctl()
3003 x.sisusb_vramsize = sisusb->vramsize; in sisusb_ioctl()
3004 x.sisusb_minor = sisusb->minor; in sisusb_ioctl()
3007 x.sisusb_conactive = sisusb->haveconsole ? 1 : 0; in sisusb_ioctl()
3023 retval = sisusb_handle_command(sisusb, &y, arg); in sisusb_ioctl()
3033 mutex_unlock(&sisusb->lock); in sisusb_ioctl()
3079 struct sisusb_usb_data *sisusb; in sisusb_probe() local
3086 if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) { in sisusb_probe()
3087 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for private data\n"); in sisusb_probe()
3090 kref_init(&sisusb->kref); in sisusb_probe()
3092 mutex_init(&(sisusb->lock)); in sisusb_probe()
3096 dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n", in sisusb_probe()
3102 sisusb->sisusb_dev = dev; in sisusb_probe()
3103 sisusb->minor = intf->minor; in sisusb_probe()
3104 sisusb->vrambase = SISUSB_PCI_MEMBASE; in sisusb_probe()
3105 sisusb->mmiobase = SISUSB_PCI_MMIOBASE; in sisusb_probe()
3106 sisusb->mmiosize = SISUSB_PCI_MMIOSIZE; in sisusb_probe()
3107 sisusb->ioportbase = SISUSB_PCI_IOPORTBASE; in sisusb_probe()
3111 sisusb->ibufsize = SISUSB_IBUF_SIZE; in sisusb_probe()
3112 if (!(sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL))) { in sisusb_probe()
3113 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer"); in sisusb_probe()
3118 sisusb->numobufs = 0; in sisusb_probe()
3119 sisusb->obufsize = SISUSB_OBUF_SIZE; in sisusb_probe()
3121 if (!(sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL))) { in sisusb_probe()
3123 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n"); in sisusb_probe()
3129 sisusb->numobufs++; in sisusb_probe()
3134 if (!(sisusb->sisurbin = usb_alloc_urb(0, GFP_KERNEL))) { in sisusb_probe()
3135 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate URBs\n"); in sisusb_probe()
3139 sisusb->completein = 1; in sisusb_probe()
3141 for (i = 0; i < sisusb->numobufs; i++) { in sisusb_probe()
3142 if (!(sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL))) { in sisusb_probe()
3143 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate URBs\n"); in sisusb_probe()
3147 sisusb->urbout_context[i].sisusb = (void *)sisusb; in sisusb_probe()
3148 sisusb->urbout_context[i].urbindex = i; in sisusb_probe()
3149 sisusb->urbstatus[i] = 0; in sisusb_probe()
3152 dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n", sisusb->numobufs); in sisusb_probe()
3156 if (!(sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL))) { in sisusb_probe()
3157 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n"); in sisusb_probe()
3163 init_waitqueue_head(&sisusb->wait_q); in sisusb_probe()
3165 usb_set_intfdata(intf, sisusb); in sisusb_probe()
3167 usb_get_dev(sisusb->sisusb_dev); in sisusb_probe()
3169 sisusb->present = 1; in sisusb_probe()
3180 if (sisusb_init_gfxdevice(sisusb, initscreen)) in sisusb_probe()
3181 dev_err(&sisusb->sisusb_dev->dev, "Failed to early initialize device\n"); in sisusb_probe()
3184 dev_info(&sisusb->sisusb_dev->dev, "Not attached to USB 2.0 hub, deferring init\n"); in sisusb_probe()
3186 sisusb->ready = 1; in sisusb_probe()
3189 dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST ***\n"); in sisusb_probe()
3190 sisusb_testreadwrite(sisusb); in sisusb_probe()
3191 dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST END ***\n"); in sisusb_probe()
3195 sisusb_console_init(sisusb, sisusb_first_vc, sisusb_last_vc); in sisusb_probe()
3201 sisusb_free_urbs(sisusb); in sisusb_probe()
3203 sisusb_free_buffers(sisusb); in sisusb_probe()
3207 kfree(sisusb); in sisusb_probe()
3213 struct sisusb_usb_data *sisusb; in sisusb_disconnect() local
3216 if (!(sisusb = usb_get_intfdata(intf))) in sisusb_disconnect()
3220 sisusb_console_exit(sisusb); in sisusb_disconnect()
3225 mutex_lock(&sisusb->lock); in sisusb_disconnect()
3228 if (!sisusb_wait_all_out_complete(sisusb)) in sisusb_disconnect()
3229 sisusb_kill_all_busy(sisusb); in sisusb_disconnect()
3233 sisusb->present = 0; in sisusb_disconnect()
3234 sisusb->ready = 0; in sisusb_disconnect()
3236 mutex_unlock(&sisusb->lock); in sisusb_disconnect()
3239 kref_put(&sisusb->kref, sisusb_delete); in sisusb_disconnect()