All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: Add base addr info
@ 2021-03-25 15:12 Daniel Gomez
  2021-03-25 15:43 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Daniel Gomez @ 2021-03-25 15:12 UTC (permalink / raw)
  Cc: Daniel Gomez, Jarkko Nikula, Andy Shevchenko, Mika Westerberg,
	linux-i2c, linux-kernel

Add i2c hw base address in the adapter name and when the device is
probed.

Output:
root@qt5222:~# dmesg | grep -i syno
[    0.347045] i2c_designware AMDI0010:00: Synopsys DesignWare I2C
adapter at 0xfedc4000
[    0.348843] i2c_designware AMDI0010:01: Synopsys DesignWare I2C
adapter at 0xfedc5000
root@qt5222:~# i2cdetect -l | grep -i desig
i2c-1   i2c             Synopsys DesignWare I2C adapter at 0xfedc5000
I2C adapter
i2c-0   i2c             Synopsys DesignWare I2C adapter at 0xfedc4000
I2C adapter

Signed-off-by: Daniel Gomez <daniel@qtec.com>
---

Hi,
We think it might be interesting to add the physical address if you have
multiple adapters like the above example so we don't write to the wrong
device. Could it be possible to add this patch?

Thanks


 drivers/i2c/busses/i2c-designware-core.h    | 1 +
 drivers/i2c/busses/i2c-designware-master.c  | 2 +-
 drivers/i2c/busses/i2c-designware-platdrv.c | 6 +++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 5392b82f68a4..8c56a7ec8693 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -241,6 +241,7 @@ struct dw_i2c_dev {
 	struct regmap		*sysmap;
 	void __iomem		*base;
 	void __iomem		*ext;
+	phys_addr_t		base_addr;
 	struct completion	cmd_complete;
 	struct clk		*clk;
 	struct clk		*pclk;
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index dd27b9dbe931..5e78b0aec2d3 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -767,7 +767,7 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
 		return ret;

 	snprintf(adap->name, sizeof(adap->name),
-		 "Synopsys DesignWare I2C adapter");
+		 "Synopsys DesignWare I2C adapter at 0x%llx", dev->base_addr);
 	adap->retries = 3;
 	adap->algo = &i2c_dw_algo;
 	adap->quirks = &i2c_dw_quirks;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0dfeb2d11603..c8ffcc85bc51 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -178,6 +178,7 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
 static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev->dev);
+	struct resource *res;
 	int ret;

 	switch (dev->flags & MODEL_MASK) {
@@ -185,7 +186,8 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
 		ret = bt1_i2c_request_regs(dev);
 		break;
 	default:
-		dev->base = devm_platform_ioremap_resource(pdev, 0);
+		dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+		dev->base_addr = res->start;
 		ret = PTR_ERR_OR_ZERO(dev->base);
 		break;
 	}
@@ -313,6 +315,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (ret)
 		goto exit_probe;

+	dev_info(&pdev->dev, "%s\n", adap->name);
+
 	return ret;

 exit_probe:
--
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-03-29 16:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 15:12 [PATCH] i2c: designware: Add base addr info Daniel Gomez
2021-03-25 15:43 ` Andy Shevchenko
2021-03-26 10:35   ` Daniel Gomez
2021-03-26 12:28     ` Andy Shevchenko
2021-03-27 18:15       ` Daniel Gomez
2021-03-27 19:03         ` Andy Shevchenko
2021-03-26  1:50 ` kernel test robot
2021-03-26  1:50   ` kernel test robot
2021-03-29 15:59 ` kernel test robot
2021-03-29 15:59   ` kernel test robot

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.