Skip to contentSkip to conversation

i2c/busses: Add i2c-icy for I2C on m68k/Amiga

PATCH Superseded Max Staudt 1 participant 3 messages Aug 16, 2019

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH v4 2/3 hwmon/ltc2990: Generalise DT to fwnode support

In reply to Max Staudt

ltc2990 will now use device_property_read_u32_array() instead of of_property_read_u32_array() - allowing the use of software nodes via fwnode_create_software_node().

This allows code using i2c_new_device() to specify a default measurement mode for the LTC2990 via fwnode_create_software_node().

---
 drivers/hwmon/ltc2990.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/ltc2990.c +5 -5
index f9431ad43..53ff50517 100644
@@ -13,7 +13,7 @@
 #include <linux/i2c.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/property.h>
 
 #define LTC2990_STATUS	0x00
 #define LTC2990_CONTROL	0x01
@@ -206,7 +206,6 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
 	int ret;
 	struct device *hwmon_dev;
 	struct ltc2990_data *data;
-	struct device_node *of_node = i2c->dev.of_node;
 
 	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
 				     I2C_FUNC_SMBUS_WORD_DATA))
@@ -218,9 +217,10 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
 
 	data->i2c = i2c;
 
-	if (of_node) {
-		ret = of_property_read_u32_array(of_node, "lltc,meas-mode",
-						 data->mode, 2);
+	if (dev_fwnode(&i2c->dev)) {
+		ret = device_property_read_u32_array(&i2c->dev,
+						     "lltc,meas-mode",
+						     data->mode, 2);
 		if (ret < 0)
 			return ret;
 
Signature · 1 line
2.11.0

Max Staudt

author maintainer
#0 lore raw

PATCH v4 1/3 i2c/busses: Add i2c-icy for I2C on m68k/Amiga

This is the i2c-icy driver for the ICY board for Amiga computers. It connects a PCF8584 I2C controller to the Zorro bus, providing I2C connectivity. The original documentation can be found on Aminet:

https://aminet.net/package/docs/hard/icy

IRQ support is currently not implemented, as i2c-algo-pcf is built for the ISA bus and a straight implementation of the same stack locks up a Zorro machine.

v3: Fixed %pa format string
Dropped adapter class.
Clarified licence.
Removed clock parameter.

v2: Matched function names to callbacks from i2c-algo-pcf
Used z_readb()/z_writeb()
Removed BROKEN_ON_SMP in Kconfig
Moved LTC2990 to a separate commit

---
 MAINTAINERS                  |   6 ++
 drivers/i2c/busses/Kconfig   |  11 +++
 drivers/i2c/busses/Makefile  |   1 +
 drivers/i2c/busses/i2c-icy.c | 183 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 201 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-icy.c
MAINTAINERS +6 -0
index 1be025959..70336c083 100644
@@ -7705,6 +7705,12 @@ S:	Maintained
 F:	drivers/mfd/lpc_ich.c
 F:	drivers/gpio/gpio-ich.c
 
+ICY I2C DRIVER
+M:	Max Staudt <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/i2c/busses/i2c-icy.c
+
 IDE SUBSYSTEM
 M:	"David S. Miller" <[email protected]>
 L:	[email protected]
drivers/i2c/busses/Kconfig +11 -0
index ee5dfb5ae..9e57e1101 100644
@@ -1300,6 +1300,17 @@ config I2C_ELEKTOR
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-elektor.
 
+config I2C_ICY
+	tristate "ICY Zorro card"
+	depends on ZORRO
+	select I2C_ALGOPCF
+	help
+	  This supports the PCF8584 Zorro bus I2C adapter, known as ICY.
+	  Say Y if you own such an adapter.
+
+	  This support is also available as a module.  If so, the module
+	  will be called i2c-icy.
+
 config I2C_MLXCPLD
 	tristate "Mellanox I2C driver"
 	depends on X86_64
drivers/i2c/busses/Makefile +1 -0
index a3245231b..d0e1c3d4e 100644
@@ -139,6 +139,7 @@ obj-$(CONFIG_I2C_BCM_KONA)	+= i2c-bcm-kona.o
 obj-$(CONFIG_I2C_BRCMSTB)	+= i2c-brcmstb.o
 obj-$(CONFIG_I2C_CROS_EC_TUNNEL)	+= i2c-cros-ec-tunnel.o
 obj-$(CONFIG_I2C_ELEKTOR)	+= i2c-elektor.o
+obj-$(CONFIG_I2C_ICY)		+= i2c-icy.o
 obj-$(CONFIG_I2C_MLXCPLD)	+= i2c-mlxcpld.o
 obj-$(CONFIG_I2C_OPAL)		+= i2c-opal.o
 obj-$(CONFIG_I2C_PCA_ISA)	+= i2c-pca-isa.o
drivers/i2c/busses/i2c-icy.c new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
2.11.0
author maintainer
#2 lore raw

PATCH v4 3/3 i2c/busses/i2c-icy: Add LTC2990 present on 2019 board revision

Since the 2019 a1k.org community re-print of these PCBs sports an LTC2990 hwmon chip as an example use case, let this driver autoprobe for that as well. If it is present, modprobing ltc2990 is sufficient.

The property_entry enables the three additional inputs available on this particular board:

in1 will be the voltage of the 5V rail, divided by 2. in2 will be the voltage of the 12V rail, divided by 4. temp3 will be measured using a PCB loop next the chip.

v4: Style
Added other possible addresses for LTC2990.

v3: Merged with initial LTC2990 support on ICY.
Moved defaults from platform_data to swnode.
Added note to Kconfig.

---
 drivers/i2c/busses/Kconfig   |  3 +++
 drivers/i2c/busses/i2c-icy.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
drivers/i2c/busses/Kconfig +3 -0
index 9e57e1101..a311d07f3 100644
@@ -1311,6 +1311,9 @@ config I2C_ICY
 	  This support is also available as a module.  If so, the module
 	  will be called i2c-icy.
 
+	  If you have a 2019 edition board with an LTC2990 sensor at address
+	  0x4c, loading the module 'ltc2990' is sufficient to enable it.
+
 config I2C_MLXCPLD
 	tristate "Mellanox I2C driver"
 	depends on X86_64
drivers/i2c/busses/i2c-icy.c +58 -0

87 lines not on this page · raw message

Signature · 1 line
2.11.0