From: Gabriel Somlo <gsomlo@gmail.com>
To: shorne@gmail.com, mholenko@antmicro.com, kgugala@antmicro.com
Cc: linux-kernel@vger.kernel.org,
pczarnecki@internships.antmicro.com, f.kermarrec@gmail.com,
gregkh@linuxfoundation.org, gsomlo@gmail.com
Subject: [PATCH v6 2/5] drivers/soc/litex: separate MMIO from subregister offset calculation
Date: Tue, 12 Jan 2021 12:31:41 -0500 [thread overview]
Message-ID: <20210112173144.4002594-3-gsomlo@gmail.com> (raw)
In-Reply-To: <20210112173144.4002594-1-gsomlo@gmail.com>
Separate MMIO (read/write) access into _[read|write]_litex_subregister()
static inline functions, leaving existing "READ|WRITE" macros to handle
calculation of the subregister offset only.
NOTE: this is a non-functional change.
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
---
include/linux/litex.h | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/linux/litex.h b/include/linux/litex.h
index 67c1a18a7425..918bab45243c 100644
--- a/include/linux/litex.h
+++ b/include/linux/litex.h
@@ -24,11 +24,23 @@
#define LITEX_SUBREG_SIZE 0x1
#define LITEX_SUBREG_SIZE_BIT (LITEX_SUBREG_SIZE * 8)
+static inline void _write_litex_subregister(u32 val, void __iomem *addr)
+{
+ writel((u32 __force)cpu_to_le32(val), addr);
+}
+
+static inline u32 _read_litex_subregister(void __iomem *addr)
+{
+ return le32_to_cpu((__le32 __force)readl(addr));
+}
+
#define WRITE_LITEX_SUBREGISTER(val, base_offset, subreg_id) \
- writel((u32 __force)cpu_to_le32(val), base_offset + (LITEX_REG_SIZE * subreg_id))
+ _write_litex_subregister(val, (base_offset) + \
+ LITEX_REG_SIZE * (subreg_id))
#define READ_LITEX_SUBREGISTER(base_offset, subreg_id) \
- le32_to_cpu((__le32 __force)readl(base_offset + (LITEX_REG_SIZE * subreg_id)))
+ _read_litex_subregister((base_offset) + \
+ LITEX_REG_SIZE * (subreg_id))
/*
* LiteX SoC Generator, depending on the configuration, can split a single
--
2.26.2
next prev parent reply other threads:[~2021-01-12 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 17:31 [PATCH v6 0/5] drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs Gabriel Somlo
2021-01-12 17:31 ` [PATCH v6 1/5] drivers/soc/litex: move generic accessors to litex.h Gabriel Somlo
2021-01-12 17:31 ` Gabriel Somlo [this message]
2021-01-12 17:31 ` [PATCH v6 3/5] drivers/soc/litex: s/LITEX_REG_SIZE/LITEX_SUBREG_ALIGN/g Gabriel Somlo
2021-01-12 17:31 ` [PATCH v6 4/5] drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs Gabriel Somlo
2021-01-12 17:31 ` [PATCH v6 5/5] drivers/soc/litex: make 'litex_[set|get]_reg()' methods private Gabriel Somlo
2021-01-14 1:04 ` [PATCH v6 0/5] drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs Stafford Horne
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=20210112173144.4002594-3-gsomlo@gmail.com \
--to=gsomlo@gmail.com \
--cc=f.kermarrec@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kgugala@antmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mholenko@antmicro.com \
--cc=pczarnecki@internships.antmicro.com \
--cc=shorne@gmail.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;
as well as URLs for NNTP newsgroup(s).