On 01/19/2017 01:33 PM, Alexander Loktionov wrote: > From: David VomLehn <voml...@texas.net> > > Add functions to interface with the hardware and some utility functions. > > Signed-off-by: Alexander Loktionov <alexander.loktio...@aquantia.com> > Signed-off-by: Dmitrii Tarakanov <dmitrii.taraka...@aquantia.com> > Signed-off-by: Pavel Belous <pavel.bel...@aquantia.com> > Signed-off-by: Dmitry Bezrukov <dmitry.bezru...@aquantia.com> > Signed-off-by: David M. VomLehn <voml...@texas.net> > ---
> +#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