Lines Matching refs:isp1362_hcd
119 static inline void isp1362_enable_int(struct isp1362_hcd *isp1362_hcd, u16 mask) in isp1362_enable_int() argument
121 if ((isp1362_hcd->irqenb | mask) == isp1362_hcd->irqenb) in isp1362_enable_int()
123 if (mask & ~isp1362_hcd->irqenb) in isp1362_enable_int()
124 isp1362_write_reg16(isp1362_hcd, HCuPINT, mask & ~isp1362_hcd->irqenb); in isp1362_enable_int()
125 isp1362_hcd->irqenb |= mask; in isp1362_enable_int()
126 if (isp1362_hcd->irq_active) in isp1362_enable_int()
128 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_enable_int()
133 static inline struct isp1362_ep_queue *get_ptd_queue(struct isp1362_hcd *isp1362_hcd, in get_ptd_queue() argument
138 if (offset < isp1362_hcd->istl_queue[1].buf_start) in get_ptd_queue()
139 epq = &isp1362_hcd->istl_queue[0]; in get_ptd_queue()
140 else if (offset < isp1362_hcd->intl_queue.buf_start) in get_ptd_queue()
141 epq = &isp1362_hcd->istl_queue[1]; in get_ptd_queue()
142 else if (offset < isp1362_hcd->atl_queue.buf_start) in get_ptd_queue()
143 epq = &isp1362_hcd->intl_queue; in get_ptd_queue()
144 else if (offset < isp1362_hcd->atl_queue.buf_start + in get_ptd_queue()
145 isp1362_hcd->atl_queue.buf_size) in get_ptd_queue()
146 epq = &isp1362_hcd->atl_queue; in get_ptd_queue()
260 static void prepare_ptd(struct isp1362_hcd *isp1362_hcd, struct urb *urb, in prepare_ptd() argument
345 static void isp1362_write_ptd(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep, in isp1362_write_ptd() argument
352 isp1362_write_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); in isp1362_write_ptd()
354 isp1362_write_buffer(isp1362_hcd, ep->data, in isp1362_write_ptd()
361 static void isp1362_read_ptd(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep, in isp1362_read_ptd() argument
374 isp1362_read_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); in isp1362_read_ptd()
388 isp1362_read_buffer(isp1362_hcd, ep->data, in isp1362_read_ptd()
398 static void remove_ptd(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep) in remove_ptd() argument
407 epq = get_ptd_queue(isp1362_hcd, ep->ptd_offset); in remove_ptd()
412 list_add_tail(&ep->remove_list, &isp1362_hcd->remove_list); in remove_ptd()
414 isp1362_enable_int(isp1362_hcd, HCuPINT_SOF); in remove_ptd()
426 if (epq == &isp1362_hcd->atl_queue) { in remove_ptd()
428 isp1362_read_reg32(isp1362_hcd, HCATLSKIP), epq->skip_map); in remove_ptd()
429 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, epq->skip_map); in remove_ptd()
431 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ATL_ACTIVE); in remove_ptd()
432 } else if (epq == &isp1362_hcd->intl_queue) { in remove_ptd()
434 isp1362_read_reg32(isp1362_hcd, HCINTLSKIP), epq->skip_map); in remove_ptd()
435 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, epq->skip_map); in remove_ptd()
437 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_INTL_ACTIVE); in remove_ptd()
445 static void finish_request(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep, in finish_request() argument
447 __releases(isp1362_hcd->lock) in finish_request()
448 __acquires(isp1362_hcd->lock) in finish_request()
469 usb_hcd_unlink_urb_from_ep(isp1362_hcd_to_hcd(isp1362_hcd), urb); in finish_request()
470 spin_unlock(&isp1362_hcd->lock); in finish_request()
471 usb_hcd_giveback_urb(isp1362_hcd_to_hcd(isp1362_hcd), urb, status); in finish_request()
472 spin_lock(&isp1362_hcd->lock); in finish_request()
489 isp1362_hcd->load[ep->branch], in finish_request()
490 isp1362_hcd->load[ep->branch] - ep->load); in finish_request()
491 isp1362_hcd->load[ep->branch] -= ep->load; in finish_request()
499 static void postproc_ep(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep) in postproc_ep() argument
649 finish_request(isp1362_hcd, ep, urb, urbstat); in postproc_ep()
653 static void finish_unlinks(struct isp1362_hcd *isp1362_hcd) in finish_unlinks() argument
658 list_for_each_entry_safe(ep, tmp, &isp1362_hcd->remove_list, remove_list) { in finish_unlinks()
660 get_ptd_queue(isp1362_hcd, ep->ptd_offset); in finish_unlinks()
674 finish_request(isp1362_hcd, ep, urb, -ESHUTDOWN); in finish_unlinks()
687 static inline void enable_atl_transfers(struct isp1362_hcd *isp1362_hcd, int count) in enable_atl_transfers() argument
690 if (count < isp1362_hcd->atl_queue.ptd_count) in enable_atl_transfers()
691 isp1362_write_reg16(isp1362_hcd, HCATLDTC, count); in enable_atl_transfers()
692 isp1362_enable_int(isp1362_hcd, HCuPINT_ATL); in enable_atl_transfers()
693 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, isp1362_hcd->atl_queue.skip_map); in enable_atl_transfers()
694 isp1362_set_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ATL_ACTIVE); in enable_atl_transfers()
696 isp1362_enable_int(isp1362_hcd, HCuPINT_SOF); in enable_atl_transfers()
699 static inline void enable_intl_transfers(struct isp1362_hcd *isp1362_hcd) in enable_intl_transfers() argument
701 isp1362_enable_int(isp1362_hcd, HCuPINT_INTL); in enable_intl_transfers()
702 isp1362_set_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_INTL_ACTIVE); in enable_intl_transfers()
703 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, isp1362_hcd->intl_queue.skip_map); in enable_intl_transfers()
706 static inline void enable_istl_transfers(struct isp1362_hcd *isp1362_hcd, int flip) in enable_istl_transfers() argument
708 isp1362_enable_int(isp1362_hcd, flip ? HCuPINT_ISTL1 : HCuPINT_ISTL0); in enable_istl_transfers()
709 isp1362_set_mask16(isp1362_hcd, HCBUFSTAT, flip ? in enable_istl_transfers()
713 static int submit_req(struct isp1362_hcd *isp1362_hcd, struct urb *urb, in submit_req() argument
718 prepare_ptd(isp1362_hcd, urb, ep, epq, 0); in submit_req()
736 isp1362_write_ptd(isp1362_hcd, ep, epq); in submit_req()
742 static void start_atl_transfers(struct isp1362_hcd *isp1362_hcd) in start_atl_transfers() argument
745 struct isp1362_ep_queue *epq = &isp1362_hcd->atl_queue; in start_atl_transfers()
754 list_for_each_entry(ep, &isp1362_hcd->async, schedule) { in start_atl_transfers()
766 ret = submit_req(isp1362_hcd, urb, ep, epq); in start_atl_transfers()
781 if (isp1362_hcd->async.next != isp1362_hcd->async.prev) { in start_atl_transfers()
783 list_move(&isp1362_hcd->async, isp1362_hcd->async.next); in start_atl_transfers()
786 enable_atl_transfers(isp1362_hcd, defer ? 0 : ptd_count); in start_atl_transfers()
795 static void start_intl_transfers(struct isp1362_hcd *isp1362_hcd) in start_intl_transfers() argument
798 struct isp1362_ep_queue *epq = &isp1362_hcd->intl_queue; in start_intl_transfers()
806 list_for_each_entry(ep, &isp1362_hcd->periodic, schedule) { in start_intl_transfers()
818 ret = submit_req(isp1362_hcd, urb, ep, epq); in start_intl_transfers()
833 enable_intl_transfers(isp1362_hcd); in start_intl_transfers()
856 static void start_iso_transfers(struct isp1362_hcd *isp1362_hcd) in start_iso_transfers() argument
859 int flip = isp1362_hcd->istl_flip; in start_iso_transfers()
864 u16 fno = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in start_iso_transfers()
867 epq = &isp1362_hcd->istl_queue[flip]; in start_iso_transfers()
877 list_for_each_entry_safe(ep, tmp, &isp1362_hcd->isoc, schedule) { in start_iso_transfers()
885 finish_request(isp1362_hcd, ep, urb, -EOVERFLOW); in start_iso_transfers()
895 prepare_ptd(isp1362_hcd, urb, ep, epq, fno); in start_iso_transfers()
916 isp1362_write_ptd(isp1362_hcd, ep, epq); in start_iso_transfers()
921 enable_istl_transfers(isp1362_hcd, flip); in start_iso_transfers()
928 if (!(isp1362_read_reg16(isp1362_hcd, HCBUFSTAT) & in start_iso_transfers()
937 static void finish_transfers(struct isp1362_hcd *isp1362_hcd, unsigned long done_map, in finish_transfers() argument
959 isp1362_read_ptd(isp1362_hcd, ep, epq); in finish_transfers()
972 postproc_ep(isp1362_hcd, ep); in finish_transfers()
983 static void finish_iso_transfers(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep_queue *epq) in finish_iso_transfers() argument
999 isp1362_read_ptd(isp1362_hcd, ep, epq); in finish_iso_transfers()
1001 postproc_ep(isp1362_hcd, ep); in finish_iso_transfers()
1010 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_irq() local
1014 spin_lock(&isp1362_hcd->lock); in isp1362_irq()
1016 BUG_ON(isp1362_hcd->irq_active++); in isp1362_irq()
1018 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, 0); in isp1362_irq()
1020 irqstat = isp1362_read_reg16(isp1362_hcd, HCuPINT); in isp1362_irq()
1021 DBG(3, "%s: got IRQ %04x:%04x\n", __func__, irqstat, isp1362_hcd->irqenb); in isp1362_irq()
1024 irqstat &= isp1362_hcd->irqenb; in isp1362_irq()
1025 isp1362_write_reg16(isp1362_hcd, HCuPINT, irqstat); in isp1362_irq()
1029 isp1362_hcd->irqenb &= ~HCuPINT_SOF; in isp1362_irq()
1030 isp1362_hcd->irq_stat[ISP1362_INT_SOF]++; in isp1362_irq()
1034 isp1362_hcd->fmindex = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in isp1362_irq()
1035 if (!list_empty(&isp1362_hcd->remove_list)) in isp1362_irq()
1036 finish_unlinks(isp1362_hcd); in isp1362_irq()
1037 if (!list_empty(&isp1362_hcd->async) && !(irqstat & HCuPINT_ATL)) { in isp1362_irq()
1038 if (list_empty(&isp1362_hcd->atl_queue.active)) { in isp1362_irq()
1039 start_atl_transfers(isp1362_hcd); in isp1362_irq()
1041 isp1362_enable_int(isp1362_hcd, HCuPINT_ATL); in isp1362_irq()
1042 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, in isp1362_irq()
1043 isp1362_hcd->atl_queue.skip_map); in isp1362_irq()
1044 isp1362_set_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ATL_ACTIVE); in isp1362_irq()
1050 isp1362_hcd->irq_stat[ISP1362_INT_ISTL0]++; in isp1362_irq()
1053 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ISTL0_FULL); in isp1362_irq()
1055 WARN_ON((int)!!isp1362_hcd->istl_flip); in isp1362_irq()
1056 WARN_ON(isp1362_read_reg16(isp1362_hcd, HCBUFSTAT) & in isp1362_irq()
1058 WARN_ON(!(isp1362_read_reg16(isp1362_hcd, HCBUFSTAT) & in isp1362_irq()
1060 isp1362_hcd->irqenb &= ~HCuPINT_ISTL0; in isp1362_irq()
1064 isp1362_hcd->irq_stat[ISP1362_INT_ISTL1]++; in isp1362_irq()
1067 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ISTL1_FULL); in isp1362_irq()
1069 WARN_ON(!(int)isp1362_hcd->istl_flip); in isp1362_irq()
1070 WARN_ON(isp1362_read_reg16(isp1362_hcd, HCBUFSTAT) & in isp1362_irq()
1072 WARN_ON(!(isp1362_read_reg16(isp1362_hcd, HCBUFSTAT) & in isp1362_irq()
1074 isp1362_hcd->irqenb &= ~HCuPINT_ISTL1; in isp1362_irq()
1080 finish_iso_transfers(isp1362_hcd, in isp1362_irq()
1081 &isp1362_hcd->istl_queue[isp1362_hcd->istl_flip]); in isp1362_irq()
1082 start_iso_transfers(isp1362_hcd); in isp1362_irq()
1083 isp1362_hcd->istl_flip = 1 - isp1362_hcd->istl_flip; in isp1362_irq()
1087 u32 done_map = isp1362_read_reg32(isp1362_hcd, HCINTLDONE); in isp1362_irq()
1088 u32 skip_map = isp1362_read_reg32(isp1362_hcd, HCINTLSKIP); in isp1362_irq()
1089 isp1362_hcd->irq_stat[ISP1362_INT_INTL]++; in isp1362_irq()
1095 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, skip_map | done_map); in isp1362_irq()
1098 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_INTL_ACTIVE); in isp1362_irq()
1104 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->intl_queue); in isp1362_irq()
1105 start_intl_transfers(isp1362_hcd); in isp1362_irq()
1110 u32 done_map = isp1362_read_reg32(isp1362_hcd, HCATLDONE); in isp1362_irq()
1111 u32 skip_map = isp1362_read_reg32(isp1362_hcd, HCATLSKIP); in isp1362_irq()
1112 isp1362_hcd->irq_stat[ISP1362_INT_ATL]++; in isp1362_irq()
1118 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, skip_map | done_map); in isp1362_irq()
1120 isp1362_clr_mask16(isp1362_hcd, HCBUFSTAT, HCBUFSTAT_ATL_ACTIVE); in isp1362_irq()
1123 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->atl_queue); in isp1362_irq()
1124 start_atl_transfers(isp1362_hcd); in isp1362_irq()
1130 u32 intstat = isp1362_read_reg32(isp1362_hcd, HCINTSTAT); in isp1362_irq()
1131 isp1362_hcd->irq_stat[ISP1362_INT_OPR]++; in isp1362_irq()
1134 DBG(2, "%s: OPR %08x:%08x\n", __func__, intstat, isp1362_hcd->intenb); in isp1362_irq()
1135 intstat &= isp1362_hcd->intenb; in isp1362_irq()
1141 isp1362_hcd->rhstatus = isp1362_read_reg32(isp1362_hcd, HCRHSTATUS); in isp1362_irq()
1142 isp1362_hcd->rhport[0] = isp1362_read_reg32(isp1362_hcd, HCRHPORT1); in isp1362_irq()
1143 isp1362_hcd->rhport[1] = isp1362_read_reg32(isp1362_hcd, HCRHPORT2); in isp1362_irq()
1147 isp1362_show_reg(isp1362_hcd, HCCONTROL); in isp1362_irq()
1150 isp1362_write_reg32(isp1362_hcd, HCINTSTAT, intstat); in isp1362_irq()
1156 isp1362_hcd->irq_stat[ISP1362_INT_SUSP]++; in isp1362_irq()
1164 isp1362_hcd->irq_stat[ISP1362_INT_CLKRDY]++; in isp1362_irq()
1166 isp1362_hcd->irqenb &= ~HCuPINT_CLKRDY; in isp1362_irq()
1174 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_irq()
1175 isp1362_hcd->irq_active--; in isp1362_irq()
1176 spin_unlock(&isp1362_hcd->lock); in isp1362_irq()
1184 static int balance(struct isp1362_hcd *isp1362_hcd, u16 interval, u16 load) in balance() argument
1192 if (branch < 0 || isp1362_hcd->load[branch] > isp1362_hcd->load[i]) { in balance()
1196 if ((isp1362_hcd->load[j] + load) > MAX_PERIODIC_LOAD) { in balance()
1198 load, j, isp1362_hcd->load[j], MAX_PERIODIC_LOAD); in balance()
1220 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_urb_enqueue() local
1256 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_urb_enqueue()
1259 if (!((isp1362_hcd->rhport[0] | isp1362_hcd->rhport[1]) & in isp1362_urb_enqueue()
1308 ep->num_req = isp1362_hcd->req_serial++; in isp1362_urb_enqueue()
1317 list_add_tail(&ep->schedule, &isp1362_hcd->async); in isp1362_urb_enqueue()
1328 retval = balance(isp1362_hcd, ep->interval, ep->load); in isp1362_urb_enqueue()
1335 isp1362_hcd->fmindex = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in isp1362_urb_enqueue()
1337 __func__, isp1362_hcd->fmindex, ep->branch, in isp1362_urb_enqueue()
1338 ((isp1362_hcd->fmindex + PERIODIC_SIZE - 1) & in isp1362_urb_enqueue()
1340 (isp1362_hcd->fmindex & (PERIODIC_SIZE - 1)) + ep->branch); in isp1362_urb_enqueue()
1344 u16 frame = isp1362_hcd->fmindex; in isp1362_urb_enqueue()
1349 if (frame_before(frame, isp1362_hcd->fmindex)) in isp1362_urb_enqueue()
1354 list_add_tail(&ep->schedule, &isp1362_hcd->isoc); in isp1362_urb_enqueue()
1357 list_add_tail(&ep->schedule, &isp1362_hcd->periodic); in isp1362_urb_enqueue()
1363 ep->load / ep->interval, isp1362_hcd->load[ep->branch], in isp1362_urb_enqueue()
1364 isp1362_hcd->load[ep->branch] + ep->load); in isp1362_urb_enqueue()
1365 isp1362_hcd->load[ep->branch] += ep->load; in isp1362_urb_enqueue()
1369 ALIGNSTAT(isp1362_hcd, urb->transfer_buffer); in isp1362_urb_enqueue()
1374 start_atl_transfers(isp1362_hcd); in isp1362_urb_enqueue()
1377 start_intl_transfers(isp1362_hcd); in isp1362_urb_enqueue()
1380 start_iso_transfers(isp1362_hcd); in isp1362_urb_enqueue()
1391 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_enqueue()
1399 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_urb_dequeue() local
1407 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1415 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1427 remove_ptd(isp1362_hcd, ep); in isp1362_urb_dequeue()
1434 finish_request(isp1362_hcd, ep, urb, status); in isp1362_urb_dequeue()
1442 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_urb_dequeue()
1452 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_endpoint_disable() local
1458 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_endpoint_disable()
1463 remove_ptd(isp1362_hcd, ep); in isp1362_endpoint_disable()
1467 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_endpoint_disable()
1481 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_get_frame() local
1485 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_get_frame()
1486 fmnum = isp1362_read_reg32(isp1362_hcd, HCFMNUM); in isp1362_get_frame()
1487 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_get_frame()
1497 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_hub_status_data() local
1509 ports = isp1362_hcd->rhdesca & RH_A_NDP; in isp1362_hub_status_data()
1512 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_status_data()
1514 if (isp1362_hcd->rhstatus & (RH_HS_LPSC | RH_HS_OCIC)) in isp1362_hub_status_data()
1520 u32 status = isp1362_hcd->rhport[i]; in isp1362_hub_status_data()
1532 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_status_data()
1536 static void isp1362_hub_descriptor(struct isp1362_hcd *isp1362_hcd, in isp1362_hub_descriptor() argument
1539 u32 reg = isp1362_hcd->rhdesca; in isp1362_hub_descriptor()
1566 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_hub_control() local
1570 int ports = isp1362_hcd->rhdesca & RH_A_NDP; in isp1362_hub_control()
1579 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1580 isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_OCIC); in isp1362_hub_control()
1581 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1603 isp1362_hub_descriptor(isp1362_hcd, (struct usb_hub_descriptor *)buf); in isp1362_hub_control()
1615 tmp = isp1362_hcd->rhport[--wIndex]; in isp1362_hub_control()
1662 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1663 isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, tmp); in isp1362_hub_control()
1664 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1665 isp1362_read_reg32(isp1362_hcd, HCRHPORT1 + wIndex); in isp1362_hub_control()
1666 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1676 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1677 isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, RH_PS_PSS); in isp1362_hub_control()
1678 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1679 isp1362_read_reg32(isp1362_hcd, HCRHPORT1 + wIndex); in isp1362_hub_control()
1680 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1684 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1685 isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, RH_PS_PPS); in isp1362_hub_control()
1686 isp1362_hcd->rhport[wIndex] = in isp1362_hub_control()
1687 isp1362_read_reg32(isp1362_hcd, HCRHPORT1 + wIndex); in isp1362_hub_control()
1688 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1692 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1698 tmp = isp1362_read_reg32(isp1362_hcd, HCRHPORT1 + wIndex); in isp1362_hub_control()
1706 isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, (RH_PS_PRS)); in isp1362_hub_control()
1708 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1710 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1713 isp1362_hcd->rhport[wIndex] = isp1362_read_reg32(isp1362_hcd, in isp1362_hub_control()
1715 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hub_control()
1736 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_bus_suspend() local
1739 if (time_before(jiffies, isp1362_hcd->next_statechange)) in isp1362_bus_suspend()
1742 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_suspend()
1744 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1745 switch (isp1362_hcd->hc_control & OHCI_CTRL_HCFS) { in isp1362_bus_suspend()
1748 isp1362_hcd->hc_control &= ~OHCI_CTRL_HCFS; in isp1362_bus_suspend()
1749 isp1362_hcd->hc_control |= OHCI_USB_RESET; in isp1362_bus_suspend()
1750 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_suspend()
1764 if (!list_empty(&isp1362_hcd->atl_queue.active) || in isp1362_bus_suspend()
1765 !list_empty(&isp1362_hcd->intl_queue.active) || in isp1362_bus_suspend()
1766 !list_empty(&isp1362_hcd->istl_queue[0] .active) || in isp1362_bus_suspend()
1767 !list_empty(&isp1362_hcd->istl_queue[1] .active)) { in isp1362_bus_suspend()
1770 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, ~0); in isp1362_bus_suspend()
1771 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, ~0); in isp1362_bus_suspend()
1772 isp1362_write_reg16(isp1362_hcd, HCBUFSTAT, 0); in isp1362_bus_suspend()
1773 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, 0); in isp1362_bus_suspend()
1774 isp1362_write_reg32(isp1362_hcd, HCINTSTAT, OHCI_INTR_SF); in isp1362_bus_suspend()
1781 if (isp1362_read_reg32(isp1362_hcd, HCINTSTAT) & OHCI_INTR_SF) in isp1362_bus_suspend()
1785 if (isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_ATL) { in isp1362_bus_suspend()
1786 u32 done_map = isp1362_read_reg32(isp1362_hcd, HCATLDONE); in isp1362_bus_suspend()
1787 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->atl_queue); in isp1362_bus_suspend()
1789 if (isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_INTL) { in isp1362_bus_suspend()
1790 u32 done_map = isp1362_read_reg32(isp1362_hcd, HCINTLDONE); in isp1362_bus_suspend()
1791 finish_transfers(isp1362_hcd, done_map, &isp1362_hcd->intl_queue); in isp1362_bus_suspend()
1793 if (isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_ISTL0) in isp1362_bus_suspend()
1794 finish_iso_transfers(isp1362_hcd, &isp1362_hcd->istl_queue[0]); in isp1362_bus_suspend()
1795 if (isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_ISTL1) in isp1362_bus_suspend()
1796 finish_iso_transfers(isp1362_hcd, &isp1362_hcd->istl_queue[1]); in isp1362_bus_suspend()
1799 isp1362_read_reg32(isp1362_hcd, HCINTSTAT)); in isp1362_bus_suspend()
1800 isp1362_write_reg32(isp1362_hcd, HCINTSTAT, in isp1362_bus_suspend()
1801 isp1362_read_reg32(isp1362_hcd, HCINTSTAT)); in isp1362_bus_suspend()
1804 isp1362_hcd->hc_control = OHCI_USB_SUSPEND; in isp1362_bus_suspend()
1805 isp1362_show_reg(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1806 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_suspend()
1807 isp1362_show_reg(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1810 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_suspend()
1811 if ((isp1362_hcd->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_SUSPEND) { in isp1362_bus_suspend()
1813 isp1362_hcd->hc_control); in isp1362_bus_suspend()
1819 isp1362_hcd->next_statechange = jiffies + msecs_to_jiffies(5); in isp1362_bus_suspend()
1825 isp1362_read_reg32(isp1362_hcd, HCCONTROL)); in isp1362_bus_suspend()
1827 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_suspend()
1833 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_bus_resume() local
1838 if (time_before(jiffies, isp1362_hcd->next_statechange)) in isp1362_bus_resume()
1841 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1842 isp1362_hcd->hc_control = isp1362_read_reg32(isp1362_hcd, HCCONTROL); in isp1362_bus_resume()
1843 pr_info("%s: HCCONTROL: %08x\n", __func__, isp1362_hcd->hc_control); in isp1362_bus_resume()
1848 switch (isp1362_hcd->hc_control & OHCI_CTRL_HCFS) { in isp1362_bus_resume()
1851 isp1362_hcd->hc_control &= ~OHCI_CTRL_HCFS; in isp1362_bus_resume()
1852 isp1362_hcd->hc_control |= OHCI_USB_RESUME; in isp1362_bus_resume()
1853 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_resume()
1868 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1876 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1877 port = isp1362_read_reg32(isp1362_hcd, HCRHDESCA) & RH_A_NDP; in isp1362_bus_resume()
1879 u32 stat = isp1362_read_reg32(isp1362_hcd, HCRHPORT1 + port); in isp1362_bus_resume()
1887 isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + port, RH_PS_POCI); in isp1362_bus_resume()
1889 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1895 isp1362_hcd->hc_control = OHCI_USB_OPER; in isp1362_bus_resume()
1896 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1897 isp1362_show_reg(isp1362_hcd, HCCONTROL); in isp1362_bus_resume()
1898 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_bus_resume()
1899 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_bus_resume()
1904 isp1362_hcd->next_statechange = jiffies + msecs_to_jiffies(250); in isp1362_bus_resume()
1967 static void dump_regs(struct seq_file *s, struct isp1362_hcd *isp1362_hcd) in dump_regs() argument
1970 isp1362_read_reg32(isp1362_hcd, HCREVISION)); in dump_regs()
1972 isp1362_read_reg32(isp1362_hcd, HCCONTROL)); in dump_regs()
1974 isp1362_read_reg32(isp1362_hcd, HCCMDSTAT)); in dump_regs()
1976 isp1362_read_reg32(isp1362_hcd, HCINTSTAT)); in dump_regs()
1978 isp1362_read_reg32(isp1362_hcd, HCINTENB)); in dump_regs()
1980 isp1362_read_reg32(isp1362_hcd, HCFMINTVL)); in dump_regs()
1982 isp1362_read_reg32(isp1362_hcd, HCFMREM)); in dump_regs()
1984 isp1362_read_reg32(isp1362_hcd, HCFMNUM)); in dump_regs()
1986 isp1362_read_reg32(isp1362_hcd, HCLSTHRESH)); in dump_regs()
1988 isp1362_read_reg32(isp1362_hcd, HCRHDESCA)); in dump_regs()
1990 isp1362_read_reg32(isp1362_hcd, HCRHDESCB)); in dump_regs()
1992 isp1362_read_reg32(isp1362_hcd, HCRHSTATUS)); in dump_regs()
1994 isp1362_read_reg32(isp1362_hcd, HCRHPORT1)); in dump_regs()
1996 isp1362_read_reg32(isp1362_hcd, HCRHPORT2)); in dump_regs()
1999 isp1362_read_reg16(isp1362_hcd, HCHWCFG)); in dump_regs()
2001 isp1362_read_reg16(isp1362_hcd, HCDMACFG)); in dump_regs()
2003 isp1362_read_reg16(isp1362_hcd, HCXFERCTR)); in dump_regs()
2005 isp1362_read_reg16(isp1362_hcd, HCuPINT)); in dump_regs()
2007 isp1362_read_reg16(isp1362_hcd, HCuPINTENB)); in dump_regs()
2009 isp1362_read_reg16(isp1362_hcd, HCCHIPID)); in dump_regs()
2011 isp1362_read_reg16(isp1362_hcd, HCSCRATCH)); in dump_regs()
2013 isp1362_read_reg16(isp1362_hcd, HCBUFSTAT)); in dump_regs()
2015 isp1362_read_reg32(isp1362_hcd, HCDIRADDR)); in dump_regs()
2018 isp1362_read_reg16(isp1362_hcd, HCDIRDATA)); in dump_regs()
2021 isp1362_read_reg16(isp1362_hcd, HCISTLBUFSZ)); in dump_regs()
2023 isp1362_read_reg16(isp1362_hcd, HCISTLRATE)); in dump_regs()
2026 isp1362_read_reg16(isp1362_hcd, HCINTLBUFSZ)); in dump_regs()
2028 isp1362_read_reg16(isp1362_hcd, HCINTLBLKSZ)); in dump_regs()
2030 isp1362_read_reg32(isp1362_hcd, HCINTLDONE)); in dump_regs()
2032 isp1362_read_reg32(isp1362_hcd, HCINTLSKIP)); in dump_regs()
2034 isp1362_read_reg32(isp1362_hcd, HCINTLLAST)); in dump_regs()
2036 isp1362_read_reg16(isp1362_hcd, HCINTLCURR)); in dump_regs()
2039 isp1362_read_reg16(isp1362_hcd, HCATLBUFSZ)); in dump_regs()
2041 isp1362_read_reg16(isp1362_hcd, HCATLBLKSZ)); in dump_regs()
2044 isp1362_read_reg32(isp1362_hcd, HCATLDONE)); in dump_regs()
2047 isp1362_read_reg32(isp1362_hcd, HCATLSKIP)); in dump_regs()
2049 isp1362_read_reg32(isp1362_hcd, HCATLLAST)); in dump_regs()
2051 isp1362_read_reg16(isp1362_hcd, HCATLCURR)); in dump_regs()
2054 isp1362_read_reg16(isp1362_hcd, HCATLDTC)); in dump_regs()
2056 isp1362_read_reg16(isp1362_hcd, HCATLDTCTO)); in dump_regs()
2061 struct isp1362_hcd *isp1362_hcd = s->private; in isp1362_show() local
2066 isp1362_hcd_to_hcd(isp1362_hcd)->product_desc, hcd_name, DRIVER_VERSION); in isp1362_show()
2072 isp1362_hcd->stat16, isp1362_hcd->stat8, isp1362_hcd->stat4, in isp1362_show()
2073 isp1362_hcd->stat2, isp1362_hcd->stat1); in isp1362_show()
2074 seq_printf(s, "max # ptds in ATL fifo: %d\n", isp1362_hcd->atl_queue.stat_maxptds); in isp1362_show()
2075 seq_printf(s, "max # ptds in INTL fifo: %d\n", isp1362_hcd->intl_queue.stat_maxptds); in isp1362_show()
2077 max(isp1362_hcd->istl_queue[0] .stat_maxptds, in isp1362_show()
2078 isp1362_hcd->istl_queue[1] .stat_maxptds)); in isp1362_show()
2081 spin_lock_irq(&isp1362_hcd->lock); in isp1362_show()
2083 dump_irq(s, "hc_irq_enable", isp1362_read_reg16(isp1362_hcd, HCuPINTENB)); in isp1362_show()
2084 dump_irq(s, "hc_irq_status", isp1362_read_reg16(isp1362_hcd, HCuPINT)); in isp1362_show()
2085 dump_int(s, "ohci_int_enable", isp1362_read_reg32(isp1362_hcd, HCINTENB)); in isp1362_show()
2086 dump_int(s, "ohci_int_status", isp1362_read_reg32(isp1362_hcd, HCINTSTAT)); in isp1362_show()
2087 dump_ctrl(s, "ohci_control", isp1362_read_reg32(isp1362_hcd, HCCONTROL)); in isp1362_show()
2090 if (isp1362_hcd->irq_stat[i]) in isp1362_show()
2092 ISP1362_INT_NAME(i), isp1362_hcd->irq_stat[i]); in isp1362_show()
2094 dump_regs(s, isp1362_hcd); in isp1362_show()
2095 list_for_each_entry(ep, &isp1362_hcd->async, schedule) { in isp1362_show()
2125 if (!list_empty(&isp1362_hcd->async)) in isp1362_show()
2127 dump_ptd_queue(&isp1362_hcd->atl_queue); in isp1362_show()
2131 list_for_each_entry(ep, &isp1362_hcd->periodic, schedule) { in isp1362_show()
2133 isp1362_hcd->load[ep->branch], ep->ptd_index, ep->ptd_offset); in isp1362_show()
2143 dump_ptd_queue(&isp1362_hcd->intl_queue); in isp1362_show()
2147 list_for_each_entry(ep, &isp1362_hcd->isoc, schedule) { in isp1362_show()
2157 spin_unlock_irq(&isp1362_hcd->lock); in isp1362_show()
2165 static void create_debug_file(struct isp1362_hcd *isp1362_hcd) in create_debug_file() argument
2167 debugfs_create_file("isp1362", S_IRUGO, usb_debug_root, isp1362_hcd, in create_debug_file()
2171 static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) in remove_debug_file() argument
2178 static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) in __isp1362_sw_reset() argument
2182 isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); in __isp1362_sw_reset()
2183 isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); in __isp1362_sw_reset()
2186 if (!(isp1362_read_reg32(isp1362_hcd, HCCMDSTAT) & OHCI_HCR)) in __isp1362_sw_reset()
2193 static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) in isp1362_sw_reset() argument
2197 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_sw_reset()
2198 __isp1362_sw_reset(isp1362_hcd); in isp1362_sw_reset()
2199 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_sw_reset()
2204 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_mem_config() local
2244 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_mem_config()
2247 isp1362_hcd->istl_queue[i].buf_start = i * istl_size / 2, in isp1362_mem_config()
2248 isp1362_hcd->istl_queue[i].buf_size = istl_size / 2; in isp1362_mem_config()
2249 isp1362_hcd->istl_queue[i].blk_size = 4; in isp1362_mem_config()
2250 INIT_LIST_HEAD(&isp1362_hcd->istl_queue[i].active); in isp1362_mem_config()
2251 snprintf(isp1362_hcd->istl_queue[i].name, in isp1362_mem_config()
2252 sizeof(isp1362_hcd->istl_queue[i].name), "ISTL%d", i); in isp1362_mem_config()
2254 isp1362_hcd->istl_queue[i].name, in isp1362_mem_config()
2255 isp1362_hcd->istl_queue[i].buf_start, in isp1362_mem_config()
2256 isp1362_hcd->istl_queue[i].buf_size); in isp1362_mem_config()
2258 isp1362_write_reg16(isp1362_hcd, HCISTLBUFSZ, istl_size / 2); in isp1362_mem_config()
2260 isp1362_hcd->intl_queue.buf_start = istl_size; in isp1362_mem_config()
2261 isp1362_hcd->intl_queue.buf_size = intl_size; in isp1362_mem_config()
2262 isp1362_hcd->intl_queue.buf_count = ISP1362_INTL_BUFFERS; in isp1362_mem_config()
2263 isp1362_hcd->intl_queue.blk_size = intl_blksize; in isp1362_mem_config()
2264 isp1362_hcd->intl_queue.buf_avail = isp1362_hcd->intl_queue.buf_count; in isp1362_mem_config()
2265 isp1362_hcd->intl_queue.skip_map = ~0; in isp1362_mem_config()
2266 INIT_LIST_HEAD(&isp1362_hcd->intl_queue.active); in isp1362_mem_config()
2268 isp1362_write_reg16(isp1362_hcd, HCINTLBUFSZ, in isp1362_mem_config()
2269 isp1362_hcd->intl_queue.buf_size); in isp1362_mem_config()
2270 isp1362_write_reg16(isp1362_hcd, HCINTLBLKSZ, in isp1362_mem_config()
2271 isp1362_hcd->intl_queue.blk_size - PTD_HEADER_SIZE); in isp1362_mem_config()
2272 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, ~0); in isp1362_mem_config()
2273 isp1362_write_reg32(isp1362_hcd, HCINTLLAST, in isp1362_mem_config()
2276 isp1362_hcd->atl_queue.buf_start = istl_size + intl_size; in isp1362_mem_config()
2277 isp1362_hcd->atl_queue.buf_size = atl_size; in isp1362_mem_config()
2278 isp1362_hcd->atl_queue.buf_count = atl_buffers; in isp1362_mem_config()
2279 isp1362_hcd->atl_queue.blk_size = atl_blksize; in isp1362_mem_config()
2280 isp1362_hcd->atl_queue.buf_avail = isp1362_hcd->atl_queue.buf_count; in isp1362_mem_config()
2281 isp1362_hcd->atl_queue.skip_map = ~0; in isp1362_mem_config()
2282 INIT_LIST_HEAD(&isp1362_hcd->atl_queue.active); in isp1362_mem_config()
2284 isp1362_write_reg16(isp1362_hcd, HCATLBUFSZ, in isp1362_mem_config()
2285 isp1362_hcd->atl_queue.buf_size); in isp1362_mem_config()
2286 isp1362_write_reg16(isp1362_hcd, HCATLBLKSZ, in isp1362_mem_config()
2287 isp1362_hcd->atl_queue.blk_size - PTD_HEADER_SIZE); in isp1362_mem_config()
2288 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, ~0); in isp1362_mem_config()
2289 isp1362_write_reg32(isp1362_hcd, HCATLLAST, in isp1362_mem_config()
2292 snprintf(isp1362_hcd->atl_queue.name, in isp1362_mem_config()
2293 sizeof(isp1362_hcd->atl_queue.name), "ATL"); in isp1362_mem_config()
2294 snprintf(isp1362_hcd->intl_queue.name, in isp1362_mem_config()
2295 sizeof(isp1362_hcd->intl_queue.name), "INTL"); in isp1362_mem_config()
2297 isp1362_hcd->intl_queue.name, in isp1362_mem_config()
2298 isp1362_hcd->intl_queue.buf_start, in isp1362_mem_config()
2299 ISP1362_INTL_BUFFERS, isp1362_hcd->intl_queue.blk_size, in isp1362_mem_config()
2300 isp1362_hcd->intl_queue.buf_size); in isp1362_mem_config()
2302 isp1362_hcd->atl_queue.name, in isp1362_mem_config()
2303 isp1362_hcd->atl_queue.buf_start, in isp1362_mem_config()
2304 atl_buffers, isp1362_hcd->atl_queue.blk_size, in isp1362_mem_config()
2305 isp1362_hcd->atl_queue.buf_size); in isp1362_mem_config()
2307 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_mem_config()
2315 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_hc_reset() local
2323 if (isp1362_hcd->board && isp1362_hcd->board->reset) { in isp1362_hc_reset()
2324 isp1362_hcd->board->reset(hcd->self.controller, 1); in isp1362_hc_reset()
2326 if (isp1362_hcd->board->clock) in isp1362_hc_reset()
2327 isp1362_hcd->board->clock(hcd->self.controller, 1); in isp1362_hc_reset()
2328 isp1362_hcd->board->reset(hcd->self.controller, 0); in isp1362_hc_reset()
2330 isp1362_sw_reset(isp1362_hcd); in isp1362_hc_reset()
2335 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2336 clkrdy = isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_CLKRDY; in isp1362_hc_reset()
2337 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2342 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2343 isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_CLKRDY); in isp1362_hc_reset()
2344 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_reset()
2354 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_hc_stop() local
2362 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_stop()
2364 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, 0); in isp1362_hc_stop()
2367 tmp = isp1362_read_reg32(isp1362_hcd, HCRHDESCA); in isp1362_hc_stop()
2369 isp1362_write_reg32(isp1362_hcd, HCRHDESCA, tmp); in isp1362_hc_stop()
2370 isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_LPS); in isp1362_hc_stop()
2373 if (isp1362_hcd->board && isp1362_hcd->board->reset) in isp1362_hc_stop()
2374 isp1362_hcd->board->reset(hcd->self.controller, 1); in isp1362_hc_stop()
2376 __isp1362_sw_reset(isp1362_hcd); in isp1362_hc_stop()
2378 if (isp1362_hcd->board && isp1362_hcd->board->clock) in isp1362_hc_stop()
2379 isp1362_hcd->board->clock(hcd->self.controller, 0); in isp1362_hc_stop()
2381 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_stop()
2385 static int isp1362_chip_test(struct isp1362_hcd *isp1362_hcd) in isp1362_chip_test() argument
2405 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2406 isp1362_write_buffer(isp1362_hcd, (u8 *)ref + offset, 0, j); in isp1362_chip_test()
2407 isp1362_read_buffer(isp1362_hcd, (u8 *)tst + offset, 0, j); in isp1362_chip_test()
2408 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2420 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2421 isp1362_write_buffer(isp1362_hcd, ref, 0, ISP1362_BUF_SIZE); in isp1362_chip_test()
2422 isp1362_read_buffer(isp1362_hcd, tst, 0, ISP1362_BUF_SIZE); in isp1362_chip_test()
2423 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2437 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2438 isp1362_write_buffer(isp1362_hcd, tst, 0, ISP1362_BUF_SIZE); in isp1362_chip_test()
2439 isp1362_read_buffer(isp1362_hcd, tst, 0, ISP1362_BUF_SIZE); in isp1362_chip_test()
2440 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2447 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2448 isp1362_write_buffer(isp1362_hcd, ref, offset * 2, PTD_HEADER_SIZE); in isp1362_chip_test()
2449 isp1362_write_buffer(isp1362_hcd, ref + PTD_HEADER_SIZE / sizeof(*ref), in isp1362_chip_test()
2451 isp1362_read_buffer(isp1362_hcd, tst, offset * 2, in isp1362_chip_test()
2453 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2457 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2458 isp1362_read_buffer(isp1362_hcd, tst, offset * 2, in isp1362_chip_test()
2460 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_chip_test()
2480 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_hc_start() local
2481 struct isp1362_platform_data *board = isp1362_hcd->board; in isp1362_hc_start()
2488 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2489 chipid = isp1362_read_reg16(isp1362_hcd, HCCHIPID); in isp1362_hc_start()
2490 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2498 ret = isp1362_chip_test(isp1362_hcd); in isp1362_hc_start()
2502 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2504 isp1362_write_reg16(isp1362_hcd, HCuPINT, 0xff); in isp1362_hc_start()
2505 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, 0); in isp1362_hc_start()
2524 isp1362_write_reg16(isp1362_hcd, HCHWCFG, hwcfg); in isp1362_hc_start()
2525 isp1362_show_reg(isp1362_hcd, HCHWCFG); in isp1362_hc_start()
2526 isp1362_write_reg16(isp1362_hcd, HCDMACFG, 0); in isp1362_hc_start()
2527 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2533 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2536 isp1362_hcd->rhdesca = 0; in isp1362_hc_start()
2538 isp1362_hcd->rhdesca |= RH_A_NPS; in isp1362_hc_start()
2540 isp1362_hcd->rhdesca |= RH_A_PSM; in isp1362_hc_start()
2542 isp1362_hcd->rhdesca |= (board->potpg << 24) & RH_A_POTPGT; in isp1362_hc_start()
2544 isp1362_hcd->rhdesca |= (25 << 24) & RH_A_POTPGT; in isp1362_hc_start()
2546 isp1362_write_reg32(isp1362_hcd, HCRHDESCA, isp1362_hcd->rhdesca & ~RH_A_OCPM); in isp1362_hc_start()
2547 isp1362_write_reg32(isp1362_hcd, HCRHDESCA, isp1362_hcd->rhdesca | RH_A_OCPM); in isp1362_hc_start()
2548 isp1362_hcd->rhdesca = isp1362_read_reg32(isp1362_hcd, HCRHDESCA); in isp1362_hc_start()
2550 isp1362_hcd->rhdescb = RH_B_PPCM; in isp1362_hc_start()
2551 isp1362_write_reg32(isp1362_hcd, HCRHDESCB, isp1362_hcd->rhdescb); in isp1362_hc_start()
2552 isp1362_hcd->rhdescb = isp1362_read_reg32(isp1362_hcd, HCRHDESCB); in isp1362_hc_start()
2554 isp1362_read_reg32(isp1362_hcd, HCFMINTVL); in isp1362_hc_start()
2555 isp1362_write_reg32(isp1362_hcd, HCFMINTVL, (FSMP(FI) << 16) | FI); in isp1362_hc_start()
2556 isp1362_write_reg32(isp1362_hcd, HCLSTHRESH, LSTHRESH); in isp1362_hc_start()
2558 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2560 isp1362_hcd->hc_control = OHCI_USB_OPER; in isp1362_hc_start()
2563 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2565 isp1362_hcd->intenb = OHCI_INTR_MIE | OHCI_INTR_RHSC | OHCI_INTR_UE; in isp1362_hc_start()
2566 isp1362_hcd->intenb |= OHCI_INTR_RD; in isp1362_hc_start()
2567 isp1362_hcd->irqenb = HCuPINT_OPR | HCuPINT_SUSP; in isp1362_hc_start()
2568 isp1362_write_reg32(isp1362_hcd, HCINTENB, isp1362_hcd->intenb); in isp1362_hc_start()
2569 isp1362_write_reg16(isp1362_hcd, HCuPINTENB, isp1362_hcd->irqenb); in isp1362_hc_start()
2572 isp1362_write_reg32(isp1362_hcd, HCCONTROL, isp1362_hcd->hc_control); in isp1362_hc_start()
2574 isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_LPSC | RH_HS_DRWE); in isp1362_hc_start()
2576 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_hc_start()
2586 .hcd_priv_size = sizeof(struct isp1362_hcd),
2612 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_remove() local
2614 remove_debug_file(isp1362_hcd); in isp1362_remove()
2625 struct isp1362_hcd *isp1362_hcd; in isp1362_probe() local
2664 isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_probe()
2665 isp1362_hcd->data_reg = data_reg; in isp1362_probe()
2666 isp1362_hcd->addr_reg = addr_reg; in isp1362_probe()
2668 isp1362_hcd->next_statechange = jiffies; in isp1362_probe()
2669 spin_lock_init(&isp1362_hcd->lock); in isp1362_probe()
2670 INIT_LIST_HEAD(&isp1362_hcd->async); in isp1362_probe()
2671 INIT_LIST_HEAD(&isp1362_hcd->periodic); in isp1362_probe()
2672 INIT_LIST_HEAD(&isp1362_hcd->isoc); in isp1362_probe()
2673 INIT_LIST_HEAD(&isp1362_hcd->remove_list); in isp1362_probe()
2674 isp1362_hcd->board = dev_get_platdata(&pdev->dev); in isp1362_probe()
2676 if (!isp1362_hcd->board->delay) { in isp1362_probe()
2699 create_debug_file(isp1362_hcd); in isp1362_probe()
2713 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_suspend() local
2724 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_suspend()
2725 isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_LPS); in isp1362_suspend()
2726 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_suspend()
2736 struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd); in isp1362_resume() local
2743 spin_lock_irqsave(&isp1362_hcd->lock, flags); in isp1362_resume()
2744 isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_LPSC); in isp1362_resume()
2745 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); in isp1362_resume()
2751 return isp1362_bus_resume(isp1362_hcd_to_hcd(isp1362_hcd)); in isp1362_resume()