Thread (20 messages) flat view 20 messages, 4 authors, 2017-01-20

Re: [PATCH v7 10/13] net: ethernet: aquantia: Hardware interface and utility functions

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2017-01-19 22:40:44

On 01/19/2017 01:33 PM, Alexander Loktionov wrote:
From: David VomLehn <redacted>

Add functions to interface with the hardware and some utility functions.

Signed-off-by: Alexander Loktionov <redacted>
Signed-off-by: Dmitrii Tarakanov <redacted>
Signed-off-by: Pavel Belous <redacted>
Signed-off-by: Dmitry Bezrukov <redacted>
Signed-off-by: David M. VomLehn <redacted>
---
+#ifndef AQ_HW_UTILS_H
+#define AQ_HW_UTILS_H
+
+#include "aq_common.h"
+
+#ifndef HIDWORD
+#define LODWORD(_qw)    ((u32)(_qw))
+#define HIDWORD(_qw)    ((u32)(((_qw) >> 32) & 0xffffffff))
+#endif
upper_32_bits() and lower_32_bits()?
+
+#define AQ_HW_SLEEP(_US_) mdelay(_US_)
+
+#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \
+do { \
+	unsigned int AQ_HW_WAIT_FOR_i; \
+	for (AQ_HW_WAIT_FOR_i = _N_; (!(_B_)) && (AQ_HW_WAIT_FOR_i);\
+	--AQ_HW_WAIT_FOR_i) {\
+		udelay(_US_); \
+	} \
+	if (!AQ_HW_WAIT_FOR_i) {\
+		err = ETIME; \
+	} \
+} while (0)
You might want to use readl_poll_timeout() or something similar, at the
very least this should be a function for which we can get proper type
checking.
-- 
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help