From: <deepakx.nagaraju@intel.com>
To: joyce.ooi@intel.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, Nagaraju DeepakX <deepakx.nagaraju@intel.com>,
Andy Schevchenko <andriy.schevchenko@linux.intel.com>
Subject: [PATCH 3/5] net: ethernet: altera: move read write functions
Date: Wed, 13 Dec 2023 15:11:10 +0800 [thread overview]
Message-ID: <20231213071112.18242-4-deepakx.nagaraju@intel.com> (raw)
In-Reply-To: <20231213071112.18242-1-deepakx.nagaraju@intel.com>
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>
---
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(-)
diff --git a/drivers/net/ethernet/altera/altera_tse.h b/drivers/net/ethernet/altera/altera_tse.h
index 82f2363a45cd..4874139e7cdf 100644
--- a/drivers/net/ethernet/altera/altera_tse.h
+++ b/drivers/net/ethernet/altera/altera_tse.h
@@ -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__ */
diff --git a/drivers/net/ethernet/altera/altera_tse_ethtool.c b/drivers/net/ethernet/altera/altera_tse_ethtool.c
index 81313c85833e..d34373bac94a 100644
--- a/drivers/net/ethernet/altera/altera_tse_ethtool.c
+++ b/drivers/net/ethernet/altera/altera_tse_ethtool.c
@@ -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
diff --git a/drivers/net/ethernet/altera/altera_utils.h b/drivers/net/ethernet/altera/altera_utils.h
index 3c2e32fb7389..c3f09c5257f7 100644
--- a/drivers/net/ethernet/altera/altera_utils.h
+++ b/drivers/net/ethernet/altera/altera_utils.h
@@ -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__*/
--
2.26.2
next prev parent reply other threads:[~2023-12-13 7:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 7:11 [PATCH 0/5] Rename functions and their prototypes and move to common files deepakx.nagaraju
2023-12-13 7:11 ` [PATCH 1/5] net: ethernet: altera: remove unneeded assignments deepakx.nagaraju
2023-12-16 20:03 ` Simon Horman
2023-12-13 7:11 ` [PATCH 2/5] net: ethernet: altera: fix indentation warnings deepakx.nagaraju
2023-12-13 7:11 ` deepakx.nagaraju [this message]
2023-12-16 20:03 ` [PATCH 3/5] net: ethernet: altera: move read write functions Simon Horman
2023-12-13 7:11 ` [PATCH 4/5] net: ethernet: altera: sorting headers in alphabetical order deepakx.nagaraju
2023-12-14 19:06 ` Jakub Kicinski
2023-12-13 7:11 ` [PATCH 5/5] net: ethernet: altera: rename functions and their prototypes deepakx.nagaraju
2023-12-21 13:40 ` [PATCH v2 0/4] Rename functions and their prototypes and move to common files deepakx.nagaraju
2023-12-21 13:40 ` [PATCH v2 1/4] net: ethernet: altera: remove unneeded assignments deepakx.nagaraju
2023-12-21 13:40 ` [PATCH v2 2/4] net: ethernet: altera: fix indentation warnings deepakx.nagaraju
2023-12-23 14:57 ` Simon Horman
2023-12-21 13:40 ` [PATCH v2 3/4] net: ethernet: altera: move read write functions deepakx.nagaraju
2023-12-21 13:40 ` [PATCH v2 4/4] net: ethernet: altera: rename functions and their prototypes deepakx.nagaraju
2023-12-23 14:54 ` Simon Horman
2023-12-23 15:06 ` Simon Horman
2024-01-03 11:23 ` [PATCH 5/5] " Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231213071112.18242-4-deepakx.nagaraju@intel.com \
--to=deepakx.nagaraju@intel.com \
--cc=andriy.schevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joyce.ooi@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®