[PATCH net 1/3] net: txgbe: add IO address in I2C platform device data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider the necessity of reading/writing the IO address to acquire and
release the lock between software and firmware, add the IO address as
the platform data to register I2C platform device.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: c625e72561f6 ("net: txgbe: Register I2C platform device")
Signed-off-by: Jiawen Wu <jiawenwu@xxxxxxxxxxxxxx>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c |  5 +++++
 include/linux/platform_data/i2c-wx.h           | 11 +++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 include/linux/platform_data/i2c-wx.h

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index 5f502265f0a6..781a3a34aa4c 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -9,6 +9,7 @@
 #include <linux/i2c.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/i2c-wx.h>
 #include <linux/regmap.h>
 #include <linux/pcs/pcs-xpcs.h>
 #include <linux/phylink.h>
@@ -618,6 +619,7 @@ static const struct regmap_config i2c_regmap_config = {
 
 static int txgbe_i2c_register(struct txgbe *txgbe)
 {
+	struct txgbe_i2c_platform_data pdata = {};
 	struct platform_device_info info = {};
 	struct platform_device *i2c_dev;
 	struct regmap *i2c_regmap;
@@ -636,6 +638,9 @@ static int txgbe_i2c_register(struct txgbe *txgbe)
 	info.fwnode = software_node_fwnode(txgbe->nodes.group[SWNODE_I2C]);
 	info.name = "i2c_designware";
 	info.id = pci_dev_id(pdev);
+	pdata.hw_addr = wx->hw_addr;
+	info.data = &pdata;
+	info.size_data = sizeof(pdata);
 
 	info.res = &DEFINE_RES_IRQ(pdev->irq);
 	info.num_res = 1;
diff --git a/include/linux/platform_data/i2c-wx.h b/include/linux/platform_data/i2c-wx.h
new file mode 100644
index 000000000000..b46777fa1d85
--- /dev/null
+++ b/include/linux/platform_data/i2c-wx.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2015 - 2024 Beijing WangXun Technology Co., Ltd. */
+
+#ifndef _I2C_WX_H_
+#define _I2C_WX_H_
+
+struct txgbe_i2c_platform_data {
+	void __iomem *hw_addr;
+};
+
+#endif /* _I2C_WX_H_ */
-- 
2.27.0





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux