Skip to contentSkip to conversation

Staging: octeon-usb: Changes macro CVMX_WAIT_FOR_FIELD32 to function call

PATCH New Georgios Tsotsos 1 participant 1 message Jul 29, 2018 1 message not in the archive Staging

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v5 1/1 Staging: octeon-usb: Changes macro CVMX_WAIT_FOR_FIELD32 to function call

Replacing CVMX_WAIT_FOR_FIELD32 macro with equivalent function, and used simpler approach for new function's parameters.

---
v3: Changed CVMX_WAIT_FOR_FIELD32 macro to function according as refereed in commit message and suggested by Greg Kroah-Hartman
v4: Added patch version text
v5: Fix parameters issue and simplify new function.

 drivers/staging/octeon-usb/octeon-hcd.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/staging/octeon-usb/octeon-hcd.c +5 -8
index edf87d1b3609..c9fbff93bed4 100644
@@ -574,18 +574,15 @@ static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
  * Loop through register until txfflsh or rxfflsh become zero.
  *
  * @usb:           USB block
- * @address:       64bit address to read
- * @timeout_usec:  Timeout
  * @fflsh_type:    Indicates fflsh type, 0 for txfflsh, 1 for rxfflsh
  *
  */
-static int cvmx_wait_for_field32(struct octeon_hcd *usb, u64 address,
-				 u64 timeout_usec, int fflsh_type)
+static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type)
 {
 	int result;
-	u64 done = cvmx_get_cycle() + timeout_usec *
+	u64 address = CVMX_USBCX_GRSTCTL(usb->index);
+	u64 done = cvmx_get_cycle() + 100 *
 		   (u64)octeon_get_clock_rate / 1000000;
-
 	union cvmx_usbcx_grstctl c;
 
 	while (1) {
@@ -648,9 +645,9 @@ static void cvmx_fifo_setup(struct octeon_hcd *usb)
 	/* Flush all FIFOs */
 	USB_SET_FIELD32(address, cvmx_usbcx_grstctl, txfnum, 0x10);
 	USB_SET_FIELD32(address, cvmx_usbcx_grstctl, txfflsh, 1);
-	cvmx_wait_for_field32(usb, address, 0, 100);
+	cvmx_wait_tx_rx(usb, 0);
 	USB_SET_FIELD32(address, cvmx_usbcx_grstctl, rxfflsh, 1);
-	cvmx_wait_for_field32(usb, address, 1, 100);
+	cvmx_wait_tx_rx(usb, 1);
 }
 
 /**
Signature · 1 line
2.16.4