diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2016-06-01 21:58:32 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-06-03 09:14:14 +0200 |
commit | 940bd8bb25e037a31ba1cf26d8535bdb24c3723e (patch) | |
tree | 4b6677740366f8f829a2efada955bf749c4b8f7b /drivers/net/e1000/regio.c | |
parent | ae4915ff38ea9e376321e644108957ab2a93031d (diff) | |
download | barebox-940bd8bb25e037a31ba1cf26d8535bdb24c3723e.tar.gz barebox-940bd8bb25e037a31ba1cf26d8535bdb24c3723e.tar.xz |
e1000: Convert E1000_*_REG macros to functions
E1000_*_REG don't bring any value by being macros and implicit appending
of "E1000_" prefix to the constant name only makes thing harder to grep
or understand. Replace those macros with functions.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/e1000/regio.c')
-rw-r--r-- | drivers/net/e1000/regio.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/e1000/regio.c b/drivers/net/e1000/regio.c new file mode 100644 index 0000000000..8c529f1b23 --- /dev/null +++ b/drivers/net/e1000/regio.c @@ -0,0 +1,29 @@ +#include <common.h> + +#include "e1000.h" + +void e1000_write_reg(struct e1000_hw *hw, uint32_t reg, uint32_t value) +{ + writel(value, hw->hw_addr + reg); +} + +uint32_t e1000_read_reg(struct e1000_hw *hw, uint32_t reg) +{ + return readl(hw->hw_addr + reg); +} + +void e1000_write_reg_array(struct e1000_hw *hw, uint32_t base, + uint32_t idx, uint32_t value) +{ + writel(value, hw->hw_addr + base + idx * sizeof(uint32_t)); +} + +uint32_t e1000_read_reg_array(struct e1000_hw *hw, uint32_t base, uint32_t idx) +{ + return readl(hw->hw_addr + base + idx * sizeof(uint32_t)); +} + +void e1000_write_flush(struct e1000_hw *hw) +{ + e1000_read_reg(hw, E1000_STATUS); +} |