[v2,3/4] net: ethernet: altera: move read write functions
Commit Message
From: Nagaraju DeepakX <deepakx.nagaraju@intel.com>
Move read write functions from altera_tse.h to altera_utils.h
so it can be shared with future altera ethernet IP's.
Signed-off-by: Nagaraju DeepakX <deepakx.nagaraju@intel.com>
Reviewed-by: Andy Schevchenko <andriy.schevchenko@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
drivers/net/ethernet/altera/altera_tse.h | 45 -------------------
.../net/ethernet/altera/altera_tse_ethtool.c | 1 +
drivers/net/ethernet/altera/altera_utils.h | 43 ++++++++++++++++++
3 files changed, 44 insertions(+), 45 deletions(-)
--
2.26.2
@@ -483,49 +483,4 @@ struct altera_tse_private {
*/
void altera_tse_set_ethtool_ops(struct net_device *);
-static inline
-u32 csrrd32(void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
- return readl(paddr);
-}
-
-static inline
-u16 csrrd16(void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
- return readw(paddr);
-}
-
-static inline
-u8 csrrd8(void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
- return readb(paddr);
-}
-
-static inline
-void csrwr32(u32 val, void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
-
- writel(val, paddr);
-}
-
-static inline
-void csrwr16(u16 val, void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
-
- writew(val, paddr);
-}
-
-static inline
-void csrwr8(u8 val, void __iomem *mac, size_t offs)
-{
- void __iomem *paddr = (void __iomem *)((uintptr_t)mac + offs);
-
- writeb(val, paddr);
-}
-
#endif /* __ALTERA_TSE_H__ */
@@ -22,6 +22,7 @@
#include <linux/phy.h>
#include "altera_tse.h"
+#include "altera_utils.h"
#define TSE_STATS_LEN 31
#define TSE_NUM_REGS 128
@@ -7,6 +7,7 @@
#define __ALTERA_UTILS_H__
#include <linux/compiler.h>
+#include <linux/io.h>
#include <linux/types.h>
void tse_set_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask);
@@ -14,4 +15,46 @@ void tse_clear_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask);
int tse_bit_is_set(void __iomem *ioaddr, size_t offs, u32 bit_mask);
int tse_bit_is_clear(void __iomem *ioaddr, size_t offs, u32 bit_mask);
+static inline u32 csrrd32(void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ return readl(paddr);
+}
+
+static inline u16 csrrd16(void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ return readw(paddr);
+}
+
+static inline u8 csrrd8(void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ return readb(paddr);
+}
+
+static inline void csrwr32(u32 val, void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ writel(val, paddr);
+}
+
+static inline void csrwr16(u16 val, void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ writew(val, paddr);
+}
+
+static inline void csrwr8(u8 val, void __iomem *mac, size_t offs)
+{
+ void __iomem *paddr = mac + offs;
+
+ writeb(val, paddr);
+}
+
#endif /* __ALTERA_UTILS_H__*/