@@ -174,6 +174,19 @@ static inline void track_missed_sofs(uint16_t curr_frame_number)
174174}
175175#endif
176176
177+ struct tracking
178+ {
179+ int frame ;
180+ int next_sched ;
181+ int info ;
182+ } tracking_frames [16 ];
183+ int tracking_frames_n = 0 ;
184+
185+ void info_data (int info )
186+ {
187+ tracking_frames [(tracking_frames_n + 15 ) % 16 ].info |= info ;
188+ }
189+
177190/**
178191 * Handles the start-of-frame interrupt in host mode. Non-periodic
179192 * transactions may be queued to the DWC_otg controller for the current
@@ -204,18 +217,44 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd)
204217#ifdef DWC_TRACK_MISSED_SOFS
205218 track_missed_sofs (hcd -> frame_number );
206219#endif
220+
221+ qh_entry = DWC_LIST_FIRST (& hcd -> periodic_sched_inactive );
222+ next_sched = (DWC_LIST_ENTRY (qh_entry , dwc_otg_qh_t , qh_list_entry ))-> sched_frame ;
223+ while (qh_entry != & hcd -> periodic_sched_inactive ) {
224+ qh = DWC_LIST_ENTRY (qh_entry , dwc_otg_qh_t , qh_list_entry );
225+ qh_entry = qh_entry -> next ;
226+ if (dwc_frame_num_le (qh -> sched_frame , next_sched )) {
227+ next_sched = qh -> sched_frame ;
228+ }
229+ }
230+
231+ tracking_frames [tracking_frames_n ].frame = hcd -> frame_number ;
232+ tracking_frames [tracking_frames_n ].next_sched = next_sched ;
233+ tracking_frames [tracking_frames_n ].info = 0 ;
234+ tracking_frames_n = (tracking_frames_n + 1 ) % 16 ;
235+ info_data (info_frame );
236+
207237 /* Determine whether any periodic QHs should be executed. */
208238 qh_entry = DWC_LIST_FIRST (& hcd -> periodic_sched_inactive );
209239 while (qh_entry != & hcd -> periodic_sched_inactive ) {
210240 qh = DWC_LIST_ENTRY (qh_entry , dwc_otg_qh_t , qh_list_entry );
211241 qh_entry = qh_entry -> next ;
212242 if (dwc_frame_num_le (qh -> sched_frame , hcd -> frame_number )) {
213- /*
214- * Move QH to the ready list to be executed next
215- * (micro)frame.
216- */
217- DWC_LIST_MOVE_HEAD (& hcd -> periodic_sched_ready ,
218- & qh -> qh_list_entry );
243+ dwc_otg_qtd_t * qtd = DWC_CIRCLEQ_FIRST (& qh -> qtd_list );
244+ if (qh -> do_split && !qtd -> complete_split && qh -> sched_frame != hcd -> frame_number ) {
245+ if ((qh -> sched_frame & 7 ) != 7 )
246+ printk ("start split not scheduled for frame 7\n" );
247+ qh -> sched_frame = hcd -> frame_number | 7 ;
248+ qh -> start_split_frame = qh -> sched_frame ;
249+ }
250+ else {
251+ /*
252+ * Move QH to the ready list to be executed next
253+ * (micro)frame.
254+ */
255+ DWC_LIST_MOVE_HEAD (& hcd -> periodic_sched_ready ,
256+ & qh -> qh_list_entry );
257+ }
219258 }
220259 }
221260 tr_type = dwc_otg_hcd_select_transactions (hcd );
@@ -1480,10 +1519,23 @@ static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd,
14801519
14811520 if (dwc_full_frame_num (frnum ) !=
14821521 dwc_full_frame_num (hc -> qh -> sched_frame )) {
1522+ int i ;
14831523 /*
14841524 * No longer in the same full speed frame.
14851525 * Treat this as a transaction error.
14861526 */
1527+ printk (KERN_ERR "Dropping split complete packet, check interrupt latency, scheduled at %d.%d frame number %d.%d start_split_frame = %d.%d\n" , hc -> qh -> sched_frame /8 , hc -> qh -> sched_frame %8 , frnum /8 , frnum %8 , hc -> qh -> start_split_frame /8 , hc -> qh -> start_split_frame %8 );
1528+ for (i = 0 ; i < 16 ; i ++ )
1529+ {
1530+ int info = tracking_frames [(tracking_frames_n + i )%16 ].info ;
1531+ int frame = tracking_frames [(tracking_frames_n + i )%16 ].frame ;
1532+ int next = tracking_frames [(tracking_frames_n + i )%16 ].next_sched ;
1533+ char info_string [32 ] = "f...........pncs" ;
1534+ int i ;
1535+ for (i = 0 ; i < 16 ; i ++ )
1536+ if (info & (1 << i )) info_string [15 - i ] = info_string [15 - i ] + ('A' - 'a' );
1537+ printk ("frame %d.%d - (%d) %s next_sched = %d.%d\n" , frame /8 , frame %8 , info , info_string , next /8 , next %8 );
1538+ }
14871539#if 0
14881540 /** @todo Fix system performance so this can
14891541 * be treated as an error. Right now complete
@@ -1501,6 +1553,8 @@ static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd,
15011553 }
15021554 }
15031555
1556+ info_data (info_complete_nyet );
1557+
15041558 halt_channel (hcd , hc , qtd , DWC_OTG_HC_XFER_NYET );
15051559 goto handle_nyet_done ;
15061560 }
0 commit comments