]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
ASoC: cs4271: configure reset GPIO as output
[mirror_ubuntu-eoan-kernel.git] / drivers / net / ethernet / aquantia / atlantic / aq_hw_utils.h
CommitLineData
753f4783
DV
1/*
2 * aQuantia Corporation Network Driver
3 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 */
9
10/* File aq_hw_utils.h: Declaration of helper functions used across hardware
11 * layer.
12 */
13
14#ifndef AQ_HW_UTILS_H
15#define AQ_HW_UTILS_H
16
17#include "aq_common.h"
18
19#ifndef HIDWORD
20#define LODWORD(_qw) ((u32)(_qw))
21#define HIDWORD(_qw) ((u32)(((_qw) >> 32) & 0xffffffff))
22#endif
23
24#define AQ_HW_SLEEP(_US_) mdelay(_US_)
25
26#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \
27do { \
28 unsigned int AQ_HW_WAIT_FOR_i; \
29 for (AQ_HW_WAIT_FOR_i = _N_; (!(_B_)) && (AQ_HW_WAIT_FOR_i);\
30 --AQ_HW_WAIT_FOR_i) {\
31 udelay(_US_); \
32 } \
33 if (!AQ_HW_WAIT_FOR_i) {\
1a28242b 34 err = -ETIME; \
753f4783
DV
35 } \
36} while (0)
37
38struct aq_hw_s;
39
40void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
41 u32 shift, u32 val);
42u32 aq_hw_read_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk, u32 shift);
43u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg);
44void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value);
45int aq_hw_err_from_flags(struct aq_hw_s *hw);
46
47#endif /* AQ_HW_UTILS_H */