Lines Matching refs:hci

124 int SL11StartXaction (hci_t * hci, __u8 addr, __u8 epaddr, int pid, int len,
132 static int hc_reset (hci_t * hci);
145 static __u8 inline SL811Read (hci_t *hci, __u8 offset) in SL811Read() argument
147 hcipriv_t *hp = &hci->hp; in SL811Read()
168 static void inline SL811Write (hci_t *hci, __u8 offset, __u8 data) in SL811Write() argument
170 hcipriv_t *hp = &hci->hp; in SL811Write()
192 static void SL811BufRead (hci_t *hci, __u8 offset, __u8 *buf, __u8 size) in SL811BufRead() argument
194 hcipriv_t *hp = &hci->hp; in SL811BufRead()
223 static void SL811BufWrite(hci_t *hci, __u8 offset, __u8 *buf, __u8 size) in SL811BufWrite() argument
225 hcipriv_t *hp = &hci->hp; in SL811BufWrite()
259 int regTest (hci_t * hci) in regTest() argument
267 buf[i] = SL811Read (hci, i); in regTest()
270 SL811Write (hci, i, i); in regTest()
275 data = SL811Read (hci, i); in regTest()
289 SL811Write (hci, i, buf[i]); in regTest()
305 static void regShow (hci_t * hci)
309 printk ("offset %d: 0x%x\n", i, SL811Read (hci, i));
326 static int USBReset (hci_t * hci) in USBReset() argument
329 hcipriv_t *hp = &hci->hp; in USBReset()
333 SL811Write (hci, SL11H_CTLREG2, 0xae); in USBReset()
337 SL811Write (hci, SL11H_CTLREG1, 0x08); // reset USB in USBReset()
339 SL811Write (hci, SL11H_CTLREG1, 0); // remove SE0 in USBReset()
342 SL811Write (hci, SL11H_INTENBLREG, 0); in USBReset()
346 SL811Write (hci, SL11H_INTSTATREG, 0xff); // clear all interrupt bits in USBReset()
347 status = SL811Read (hci, SL11H_INTSTATREG); in USBReset()
351 DBG ("USBReset: Device removed %03X\n", hci->hp.hcport); in USBReset()
357 SL811Write (hci, SL11H_INTENBLREG, in USBReset()
366 SL811Write (hci, SL11H_BUFLNTHREG_B, 0); //zero lenth in USBReset()
367 SL811Write (hci, SL11H_PIDEPREG_B, 0x50); //send SOF to EP0 in USBReset()
368 SL811Write (hci, SL11H_DEVADDRREG_B, 0x01); //address0 in USBReset()
369 SL811Write (hci, SL11H_SOFLOWREG, 0xe0); in USBReset()
374 DBG ("USBReset: low speed Device attached %03X\n", hci->hp.hcport); in USBReset()
375 SL811Write (hci, SL11H_CTLREG1, 0x8); in USBReset()
378 SL811Write (hci, SL11H_CTLREG2, 0xee); in USBReset()
379 SL811Write (hci, SL11H_CTLREG1, 0x21); in USBReset()
387 DBG ("USBReset: full speed Device attached %03X \n", hci->hp.hcport); in USBReset()
388 SL811Write (hci, SL11H_CTLREG1, 0x8); in USBReset()
391 SL811Write (hci, SL11H_CTLREG2, 0xae); in USBReset()
392 SL811Write (hci, SL11H_CTLREG1, 0x01); in USBReset()
400 SL811Write (hci, SL11H_HOSTCTLREG_B, 0x01); in USBReset()
405 SL811Write (hci, SL11H_INTSTATREG, 0xff); in USBReset()
408 SL811Write (hci, SL11H_INTENBLREG, in USBReset()
417 static inline void hc_mark_last_trans (hci_t * hci) in hc_mark_last_trans() argument
419 hcipriv_t *hp = &hci->hp; in hc_mark_last_trans()
431 static inline void hc_flush_data_cache (hci_t * hci, void *data, int len) in hc_flush_data_cache() argument
460 static inline int hc_add_trans (hci_t * hci, int len, void *data, int toggle, in hc_add_trans() argument
464 hcipriv_t *hp = &hci->hp; in hc_add_trans()
491 jj = SL811Read (hci, SL11H_SOFTMRREG); in hc_add_trans()
501 hci->active_trans); in hc_add_trans()
508 SL811BufWrite (hci, SL11H_DATA_START, (__u8 *) data, len); in hc_add_trans()
513 SL11StartXaction (hci, (__u8) address, (__u8) endpoint, (__u8) pid, len, in hc_add_trans()
539 static inline int hc_parse_trans (hci_t * hci, int *actbytes, __u8 * data, in hc_parse_trans() argument
552 = SL811Read (hci, SL11H_PKTSTATREG); in hc_parse_trans()
560 SL811Read (hci, SL11H_PKTSTATREG), in hc_parse_trans()
561 SL811Read (hci, SL11H_BUFLNTHREG), in hc_parse_trans()
562 SL811Read (hci, SL11H_XFERCNTREG)); in hc_parse_trans()
565 pkt_stat, SL811Read (hci, SL11H_PKTSTATREG)); in hc_parse_trans()
574 addr = SL811Read (hci, SL11H_BUFADDRREG); in hc_parse_trans()
577 len = SL811Read (hci, SL11H_BUFLNTHREG); in hc_parse_trans()
580 *actbytes = len - SL811Read (hci, SL11H_XFERCNTREG); in hc_parse_trans()
583 SL811BufRead (hci, addr, data, *actbytes); in hc_parse_trans()
613 static void hc_start_int (hci_t * hci) in hc_start_int() argument
619 SL811Write (hci, IntEna, mask); in hc_start_int()
632 static void hc_stop_int (hci_t * hci) in hc_stop_int() argument
635 SL811Write (hci, SL11H_INTSTATREG, 0xff); in hc_stop_int()
651 void handleInsRmvIntr (hci_t * hci) in handleInsRmvIntr() argument
653 hcipriv_t *hp = &hci->hp; in handleInsRmvIntr()
655 USBReset (hci); in handleInsRmvIntr()
704 int SL11StartXaction (hci_t * hci, __u8 addr, __u8 epaddr, int pid, int len, in SL11StartXaction() argument
708 hcipriv_t *hp = &hci->hp; in SL11StartXaction()
753 SL811BufWrite (hci, SL11H_BUFADDRREG, (__u8 *) & setup_data[0], 4); in SL11StartXaction()
756 SL811Write (hci, SL11H_HOSTCTLREG, cmd); /* 00: 26.11.2002 (hne) */ in SL11StartXaction()
766 SL811Write (hci, SL11H_PIDEPREG_B, 0xc0); in SL11StartXaction()
767 SL811Write (hci, SL11H_HOSTCTLREG_B, 0x1); // send the premable in SL11StartXaction()
794 hci_t *hci = __hci; in hc_interrupt() local
801 hcipriv_t *hp = &hci->hp; in hc_interrupt()
814 ii = SL811Read (hci, SL11H_INTSTATREG); in hc_interrupt()
831 SL811Write (hci, SL11H_INTSTATREG, 0xff); in hc_interrupt()
840 hci->hp.hcport ); in hc_interrupt()
848 SL811Write (hci, SL11H_INTENBLREG, 0); in hc_interrupt()
850 SL811Write (hci, SL11H_CTLREG1, 0); in hc_interrupt()
853 handleInsRmvIntr (hci); in hc_interrupt()
865 urb_state = sh_done_list (hci, &isExcessNak); in hc_interrupt()
867 if (hci->td_array->len > 0) in hc_interrupt()
869 hci->td_array->len); in hc_interrupt()
871 if (hci->td_array->len == 0 && !isExcessNak in hc_interrupt()
878 if (hci->last_packet_nak == 0) { in hc_interrupt()
880 (hci->td_array->td[0].urb->pipe)) in hc_interrupt()
881 sh_add_packet (hci, hci->td_array-> td[0].urb); in hc_interrupt()
888 sh_schedule_trans (hci, 0); in hc_interrupt()
898 hci->frame_number = (hci->frame_number + 1) % 2048; in hc_interrupt()
899 if (hci->td_array->len == 0) in hc_interrupt()
900 sh_schedule_trans (hci, 1); in hc_interrupt()
911 hci->td_array->len, in hc_interrupt()
912 hci->hp.hcport ); in hc_interrupt()
913 urb_print (hci->td_array->td[hci->td_array->len - 1].urb, in hc_interrupt()
916 sh_done_list (hci, &isExcessNak); in hc_interrupt()
920 hci->td_array->len = 0; in hc_interrupt()
926 tmpIrq = SL811Read (hci, SL11H_INTSTATREG) & SL811Read (hci, SL11H_INTENBLREG); in hc_interrupt()
938 urb_state = sh_done_list (hci, &isExcessNak); in hc_interrupt()
940 SL811Write (hci, SL11H_INTSTATREG, 0xff); in hc_interrupt()
944 DBG ("SL811 ISR: unknown, int=0x%x io=%03X\n", ii, hci->hp.hcport); in hc_interrupt()
970 static int hc_reset (hci_t * hci) in hc_reset() argument
975 attachFlag = USBReset (hci); in hc_reset()
977 setPortChange (hci, PORT_CONNECT_CHANGE); in hc_reset()
993 static int hc_alloc_trans_buffer (hci_t * hci) in hc_alloc_trans_buffer() argument
995 hcipriv_t *hp = &hci->hp; in hc_alloc_trans_buffer()
1028 static __u32 getPortStatusAndChange (hci_t * hci) in getPortStatusAndChange() argument
1030 hcipriv_t *hp = &hci->hp; in getPortStatusAndChange()
1052 static void setPortChange (hci_t * hci, __u16 bitPos) in setPortChange() argument
1054 hcipriv_t *hp = &hci->hp; in setPortChange()
1095 static void clrPortChange (hci_t * hci, __u16 bitPos) in clrPortChange() argument
1097 hcipriv_t *hp = &hci->hp; in clrPortChange()
1133 static void clrPortStatus (hci_t * hci, __u16 bitPos) in clrPortStatus() argument
1135 hcipriv_t *hp = &hci->hp; in clrPortStatus()
1167 static void setPortStatus (hci_t * hci, __u16 bitPos) in setPortStatus() argument
1169 hcipriv_t *hp = &hci->hp; in setPortStatus()
1200 static int hc_start (hci_t * hci) in hc_start() argument
1204 rh_connect_rh (hci); in hc_start()
1223 hci_t *hci; in hc_alloc_hci() local
1229 hci = (hci_t *) kmalloc (sizeof (hci_t), GFP_KERNEL); in hc_alloc_hci()
1230 if (!hci) in hc_alloc_hci()
1233 memset (hci, 0, sizeof (hci_t)); in hc_alloc_hci()
1235 hp = &hci->hp; in hc_alloc_hci()
1250 hci->nakCnt = 0; in hc_alloc_hci()
1251 hci->last_packet_nak = 0; in hc_alloc_hci()
1253 hci->a_td_array.len = 0; in hc_alloc_hci()
1254 hci->i_td_array[0].len = 0; in hc_alloc_hci()
1255 hci->i_td_array[1].len = 0; in hc_alloc_hci()
1256 hci->td_array = &hci->a_td_array; in hc_alloc_hci()
1257 hci->active_urbs = 0; in hc_alloc_hci()
1258 hci->active_trans = 0; in hc_alloc_hci()
1259 INIT_LIST_HEAD (&hci->hci_hcd_list); in hc_alloc_hci()
1260 list_add (&hci->hci_hcd_list, &hci_hcd_list); in hc_alloc_hci()
1261 init_waitqueue_head (&hci->waitq); in hc_alloc_hci()
1263 INIT_LIST_HEAD (&hci->ctrl_list); in hc_alloc_hci()
1264 INIT_LIST_HEAD (&hci->bulk_list); in hc_alloc_hci()
1265 INIT_LIST_HEAD (&hci->iso_list); in hc_alloc_hci()
1266 INIT_LIST_HEAD (&hci->intr_list); in hc_alloc_hci()
1267 INIT_LIST_HEAD (&hci->del_list); in hc_alloc_hci()
1271 kfree (hci); in hc_alloc_hci()
1275 hci->bus = bus; in hc_alloc_hci()
1277 bus->hcpriv = (void *) hci; in hc_alloc_hci()
1279 return hci; in hc_alloc_hci()
1293 static void hc_release_hci (hci_t * hci) in hc_release_hci() argument
1295 hcipriv_t *hp = &hci->hp; in hc_release_hci()
1300 if (hci->bus->root_hub) in hc_release_hci()
1301 usb_disconnect (&hci->bus->root_hub); in hc_release_hci()
1303 hc_reset (hci); in hc_release_hci()
1307 SL811Write (hci, SL11H_INTENBLREG, 0x00); in hc_release_hci()
1311 SL811Write (hci, SL11H_INTSTATREG, 0xff); in hc_release_hci()
1320 free_irq (hp->irq, hci); in hc_release_hci()
1324 usb_deregister_bus (hci->bus); in hc_release_hci()
1325 usb_free_bus (hci->bus); in hc_release_hci()
1327 list_del (&hci->hci_hcd_list); in hc_release_hci()
1328 INIT_LIST_HEAD (&hci->hci_hcd_list); in hc_release_hci()
1330 kfree (hci); in hc_release_hci()
1349 hci_t *hci; in hc_found_hci() local
1353 hci = hc_alloc_hci (); in hc_found_hci()
1354 if (!hci) { in hc_found_hci()
1359 hp = &hci->hp; in hc_found_hci()
1362 hc_release_hci (hci); in hc_found_hci()
1366 if (!regTest (hci)) { in hc_found_hci()
1368 hc_release_hci (hci); in hc_found_hci()
1372 if (hc_alloc_trans_buffer (hci)) { in hc_found_hci()
1373 hc_release_hci (hci); in hc_found_hci()
1377 usb_register_bus (hci->bus); in hc_found_hci()
1379 if (request_irq (irq, hc_interrupt, SA_SHIRQ, MODNAME, hci) != 0) { in hc_found_hci()
1381 hc_release_hci (hci); in hc_found_hci()
1391 __u8 u = SL811Read (hci, SL11H_HWREVREG); in hc_found_hci()
1403 if (hc_reset (hci)) { in hc_found_hci()
1404 hc_release_hci (hci); in hc_found_hci()
1408 if (hc_start (hci) < 0) { in hc_found_hci()
1410 hc_release_hci (hci); in hc_found_hci()
1470 hci_t *hci; in hci_hcd_cleanup() local
1474 hci = list_entry (hci_l, hci_t, hci_hcd_list); in hci_hcd_cleanup()
1476 hc_release_hci (hci); in hci_hcd_cleanup()