From: Andrew Davis <afd@ti.com>
To: Tony Lindgren <tony@atomide.com>, Vignesh R <vigneshr@ti.com>,
"Andreas Kemnade" <andreas@kemnade.info>,
Kevin Hilman <khilman@baylibre.com>,
"Roger Quadros" <rogerq@kernel.org>,
Andi Shyti <andi.shyti@kernel.org>
Cc: <linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Andrew Davis <afd@ti.com>
Subject: [PATCH 1/8] i2c: omap: Drop bit shift for I2C register addresses
Date: Fri, 4 Sep 2026 08:12:45 -0500 [thread overview]
Message-ID: <20260904131252.2126353-2-afd@ti.com> (raw)
In-Reply-To: <20260904131252.2126353-1-afd@ti.com>
No remaining board device uses a shift other than 2, and no DT supported
platform ever did. We can drop this flag and use the pre-shifted register
addresses. This simplifies the register access.
Signed-off-by: Andrew Davis <afd@ti.com>
---
arch/arm/mach-omap1/i2c.c | 4 ---
drivers/i2c/busses/i2c-omap.c | 50 +++++++++++---------------
include/linux/platform_data/i2c-omap.h | 5 ---
3 files changed, 21 insertions(+), 38 deletions(-)
diff --git a/arch/arm/mach-omap1/i2c.c b/arch/arm/mach-omap1/i2c.c
index 94d3e7883e027..bc7828a858941 100644
--- a/arch/arm/mach-omap1/i2c.c
+++ b/arch/arm/mach-omap1/i2c.c
@@ -61,10 +61,6 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
OMAP_I2C_FLAG_16BIT_DATA_REG |
OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
- /* how the cpu bus is wired up differs for 7xx only */
-
- pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
-
pdev->dev.platform_data = pdata;
return platform_device_register(pdev);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f02d294db42a6..72f979eec7311 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -180,7 +180,6 @@ struct omap_i2c_dev {
struct device *dev;
void __iomem *base; /* virtual */
int irq;
- int reg_shift; /* bit shift for I2C register addresses */
struct completion cmd_complete;
struct resource *ioarea;
u32 latency; /* maximum mpu wkup latency */
@@ -217,23 +216,23 @@ struct omap_i2c_dev {
static const u8 reg_map_ip_v1[] = {
[OMAP_I2C_REV_REG] = 0x00,
- [OMAP_I2C_IE_REG] = 0x01,
- [OMAP_I2C_STAT_REG] = 0x02,
- [OMAP_I2C_IV_REG] = 0x03,
- [OMAP_I2C_WE_REG] = 0x03,
- [OMAP_I2C_SYSS_REG] = 0x04,
- [OMAP_I2C_BUF_REG] = 0x05,
- [OMAP_I2C_CNT_REG] = 0x06,
- [OMAP_I2C_DATA_REG] = 0x07,
- [OMAP_I2C_SYSC_REG] = 0x08,
- [OMAP_I2C_CON_REG] = 0x09,
- [OMAP_I2C_OA_REG] = 0x0a,
- [OMAP_I2C_SA_REG] = 0x0b,
- [OMAP_I2C_PSC_REG] = 0x0c,
- [OMAP_I2C_SCLL_REG] = 0x0d,
- [OMAP_I2C_SCLH_REG] = 0x0e,
- [OMAP_I2C_SYSTEST_REG] = 0x0f,
- [OMAP_I2C_BUFSTAT_REG] = 0x10,
+ [OMAP_I2C_IE_REG] = 0x04,
+ [OMAP_I2C_STAT_REG] = 0x0c,
+ [OMAP_I2C_IV_REG] = 0x0c,
+ [OMAP_I2C_WE_REG] = 0x0c,
+ [OMAP_I2C_SYSS_REG] = 0x10,
+ [OMAP_I2C_BUF_REG] = 0x14,
+ [OMAP_I2C_CNT_REG] = 0x18,
+ [OMAP_I2C_DATA_REG] = 0x1c,
+ [OMAP_I2C_SYSC_REG] = 0x20,
+ [OMAP_I2C_CON_REG] = 0x24,
+ [OMAP_I2C_OA_REG] = 0x28,
+ [OMAP_I2C_SA_REG] = 0x2c,
+ [OMAP_I2C_PSC_REG] = 0x30,
+ [OMAP_I2C_SCLL_REG] = 0x34,
+ [OMAP_I2C_SCLH_REG] = 0x38,
+ [OMAP_I2C_SYSTEST_REG] = 0x3c,
+ [OMAP_I2C_BUFSTAT_REG] = 0x40,
};
static const u8 reg_map_ip_v2[] = {
@@ -267,14 +266,12 @@ static int omap_i2c_xfer_data(struct omap_i2c_dev *omap);
static inline void omap_i2c_write_reg(struct omap_i2c_dev *omap,
int reg, u16 val)
{
- writew_relaxed(val, omap->base +
- (omap->regs[reg] << omap->reg_shift));
+ writew_relaxed(val, omap->base + omap->regs[reg]);
}
static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *omap, int reg)
{
- return readw_relaxed(omap->base +
- (omap->regs[reg] << omap->reg_shift));
+ return readw_relaxed(omap->base + omap->regs[reg]);
}
static void __omap_i2c_init(struct omap_i2c_dev *omap)
@@ -1214,19 +1211,16 @@ static struct omap_i2c_bus_platform_data omap2420_pdata = {
.rev = OMAP_I2C_IP_VERSION_1,
.flags = OMAP_I2C_FLAG_NO_FIFO |
OMAP_I2C_FLAG_SIMPLE_CLOCK |
- OMAP_I2C_FLAG_16BIT_DATA_REG |
- OMAP_I2C_FLAG_BUS_SHIFT_2,
+ OMAP_I2C_FLAG_16BIT_DATA_REG,
};
static struct omap_i2c_bus_platform_data omap2430_pdata = {
.rev = OMAP_I2C_IP_VERSION_1,
- .flags = OMAP_I2C_FLAG_BUS_SHIFT_2 |
- OMAP_I2C_FLAG_FORCE_19200_INT_CLK,
+ .flags = OMAP_I2C_FLAG_FORCE_19200_INT_CLK,
};
static struct omap_i2c_bus_platform_data omap3_pdata = {
.rev = OMAP_I2C_IP_VERSION_1,
- .flags = OMAP_I2C_FLAG_BUS_SHIFT_2,
};
static struct omap_i2c_bus_platform_data omap4_pdata = {
@@ -1384,8 +1378,6 @@ omap_i2c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, omap);
init_completion(&omap->cmd_complete);
- omap->reg_shift = (omap->flags >> OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
-
pm_runtime_enable(omap->dev);
pm_runtime_set_autosuspend_delay(omap->dev, OMAP_I2C_PM_TIMEOUT);
pm_runtime_use_autosuspend(omap->dev);
diff --git a/include/linux/platform_data/i2c-omap.h b/include/linux/platform_data/i2c-omap.h
index 3444265ee8ee7..fe6753cd17bf5 100644
--- a/include/linux/platform_data/i2c-omap.h
+++ b/include/linux/platform_data/i2c-omap.h
@@ -23,11 +23,6 @@
#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2)
#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5)
#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6)
-/* how the CPU address bus must be translated for I2C unit access */
-#define OMAP_I2C_FLAG_BUS_SHIFT_NONE 0
-#define OMAP_I2C_FLAG_BUS_SHIFT_1 BIT(7)
-#define OMAP_I2C_FLAG_BUS_SHIFT_2 BIT(8)
-#define OMAP_I2C_FLAG_BUS_SHIFT__SHIFT 7
struct omap_i2c_bus_platform_data {
u32 clkrate;
--
2.39.2
next prev parent reply other threads:[~2026-09-04 13:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 13:12 [PATCH 0/8] OMAP I2C driver cleanups Andrew Davis
2026-09-04 13:12 ` Andrew Davis [this message]
2026-09-06 7:33 ` [PATCH 1/8] i2c: omap: Drop bit shift for I2C register addresses Andreas Kemnade
2026-09-04 13:12 ` [PATCH 2/8] i2c: omap: Remove unused is_rdr and is_xdr variables Andrew Davis
2026-09-06 7:41 ` Andreas Kemnade
2026-09-04 13:12 ` [PATCH 3/8] i2c: omap: Use devm_pm_runtime_enable() helper Andrew Davis
2026-09-04 13:12 ` [PATCH 4/8] i2c: omap: Combine event flags register definitions Andrew Davis
2026-09-04 13:12 ` [PATCH 5/8] i2c: omap: Use bool for flag values Andrew Davis
2026-09-04 13:12 ` [PATCH 6/8] i2c: omap: Make reset bit name match register name Andrew Davis
2026-09-04 13:12 ` [PATCH 7/8] i2c: omap: Switch to using BIT and GENMASK Andrew Davis
2026-09-04 13:12 ` [PATCH 8/8] i2c: omap: Add OMAP_I2C_BUF_{TX,RX}TRSH definitions Andrew Davis
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=20260904131252.2126353-2-afd@ti.com \
--to=afd@ti.com \
--cc=andi.shyti@kernel.org \
--cc=andreas@kemnade.info \
--cc=khilman@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rogerq@kernel.org \
--cc=tony@atomide.com \
--cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.