@@ -106,8 +106,6 @@ enum uhc_dwc2_ctrl_stage {
106106};
107107
108108struct uhc_dwc2_chan {
109- /* XFER queuing related */
110- sys_dlist_t xfer_pending_list ;
111109 /* Pointer to the transfer associated with the buffer */
112110 struct uhc_transfer * xfer ;
113111 /* Interval in frames (FS) or microframes (HS) */
@@ -1159,8 +1157,6 @@ static inline int uhc_dwc2_chan_config(const struct device *dev, uint8_t chan_id
11591157
11601158 /* TODO: Add the chan to the list of idle chans in the port object */
11611159
1162- sys_dlist_init (& chan -> xfer_pending_list );
1163-
11641160 return 0 ;
11651161}
11661162
@@ -1294,7 +1290,7 @@ static inline void uhc_dwc2_handle_chan_events(const struct device *dev, struct
12941290 /* XFER transfer is done, process the transfer and release the chan buffer */
12951291 struct uhc_transfer * const xfer = (struct uhc_transfer * )chan -> xfer ;
12961292
1297- if (xfer -> buf != NULL && xfer -> buf -> len ) {
1293+ if (xfer -> buf != NULL ) {
12981294 LOG_HEXDUMP_INF (xfer -> buf -> data , xfer -> buf -> len , "data" );
12991295 }
13001296
@@ -1332,9 +1328,10 @@ static inline void uhc_dwc2_handle_chan_events(const struct device *dev, struct
13321328 }
13331329}
13341330
1335- static inline int uhc_dwc2_submit_ctrl_xfer (const struct device * dev , struct uhc_dwc2_chan * chan ,
1336- struct uhc_transfer * const xfer )
1331+ static inline int uhc_dwc2_submit_ctrl_xfer (const struct device * dev , struct uhc_dwc2_chan * chan )
13371332{
1333+ struct uhc_transfer * const xfer = uhc_xfer_get_next (dev );
1334+
13381335 LOG_HEXDUMP_INF (xfer -> setup_pkt , 8 , "setup" );
13391336
13401337 LOG_DBG ("endpoint=%02Xh, mps=%d, interval=%d, start_frame=%d, stage=%d, no_status=%d" ,
@@ -1349,13 +1346,11 @@ static inline int uhc_dwc2_submit_ctrl_xfer(const struct device *dev, struct uhc
13491346 }
13501347
13511348 /* TODO: Buffer addr that will used as dma addr also should be aligned */
1352- if (( xfer -> buf != NULL ) && (( uintptr_t )net_buf_tail (xfer -> buf ) % 4 ) ) {
1349+ if (xfer -> buf != NULL && (uintptr_t )net_buf_tail (xfer -> buf ) % 4 != 0 ) {
13531350 LOG_WRN ("XFER buffer address %08lXh is not 4-byte aligned" ,
13541351 (uintptr_t )net_buf_tail (xfer -> buf ));
13551352 }
13561353
1357- sys_dlist_append (& chan -> xfer_pending_list , & xfer -> node );
1358-
13591354 uhc_dwc2_buffer_fill_ctrl (chan , xfer );
13601355 uhc_dwc2_buffer_exec (dev , chan );
13611356
@@ -1437,10 +1432,12 @@ static int uhc_dwc2_enqueue(const struct device *dev, struct uhc_transfer *const
14371432 struct uhc_dwc2_data * priv = uhc_get_private (dev );
14381433 int ret ;
14391434
1435+ (void )uhc_xfer_append (dev , xfer );
1436+
14401437 uhc_lock_internal (dev , K_FOREVER );
14411438
14421439 if (USB_EP_GET_IDX (xfer -> ep ) == 0 ) {
1443- ret = uhc_dwc2_submit_ctrl_xfer (dev , & priv -> chan [0 ], xfer );
1440+ ret = uhc_dwc2_submit_ctrl_xfer (dev , & priv -> chan [0 ]);
14441441 if (ret ) {
14451442 LOG_ERR ("Failed to submit xfer: %d" , ret );
14461443 goto err ;
0 commit comments