Skip to contentSkip to conversation

i2c: add support for microchip fpga i2c controllers

PATCH Superseded Conor Dooley 1 participant 1 message May 25, 2022

Subsystems (2)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 i2c: add support for microchip fpga i2c controllers

Add Microchip CoreI2C i2c controller support. This driver supports the "hard" i2c controller on the Microchip PolarFire SoC & the basic feature set for "soft" i2c controller implemtations in the FPGA fabric.

---
Changes from v3:
- update variables in struct doc comment & reordered them in the struct
- move mchp_corei2c_transfer in its caller
- change msg_len to a u16
- remove unused variable msg_read
- use adapater.timeout for completion
- dropped gotos in irq handler, replaced both with flags.
- remove block on zero length messages
(the hardware can do them, was a carryover from the baremetal driver)
- probe:
- drop unneeded initialisation
- use ret not val
- explain shared irq
- disallow 0 bus_clock_rate
- include base in device name
- dropped the duplicate "microchip" in the registered print (its in driver.name)

Changes from v2:
- Fixed whitespace in defines that I removed accidentally

Changes from v1:
- Use byte write and read functions
- Return IRQ_NONE and don't warn if not this drivers interrupt
- Add a clk_disable_unprepare to avoid leaking a clock in the probe

---
 drivers/i2c/busses/Kconfig              |  11 +
 drivers/i2c/busses/Makefile             |   1 +
 drivers/i2c/busses/i2c-microchip-core.c | 486 ++++++++++++++++++++++++
 3 files changed, 498 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-microchip-core.c
drivers/i2c/busses/Kconfig +11 -0
index a1bae59208e3..3d4d8e0e9de7 100644
@@ -781,6 +781,17 @@ config I2C_MESON
 	  If you say yes to this option, support will be included for the
 	  I2C interface on the Amlogic Meson family of SoCs.
 
+config I2C_MICROCHIP_CORE
+	tristate "Microchip FPGA I2C controller"
+	depends on SOC_MICROCHIP_POLARFIRE || COMPILE_TEST
+	depends on OF
+	help
+	  If you say yes to this option, support will be included for the
+	  I2C interface on Microchip FPGAs.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called i2c-microchip-core.
+
 config I2C_MPC
 	tristate "MPC107/824x/85xx/512x/52xx/83xx/86xx"
 	depends on PPC
drivers/i2c/busses/Makefile +1 -0
index 479f60e4ee3d..75869b189e43 100644
@@ -78,6 +78,7 @@ obj-$(CONFIG_I2C_JZ4780)	+= i2c-jz4780.o
 obj-$(CONFIG_I2C_KEMPLD)	+= i2c-kempld.o
 obj-$(CONFIG_I2C_LPC2K)		+= i2c-lpc2k.o
 obj-$(CONFIG_I2C_MESON)		+= i2c-meson.o
+obj-$(CONFIG_I2C_MICROCHIP_CORE)	+= i2c-microchip-core.o
 obj-$(CONFIG_I2C_MPC)		+= i2c-mpc.o
 obj-$(CONFIG_I2C_MT65XX)	+= i2c-mt65xx.o
 obj-$(CONFIG_I2C_MT7621)	+= i2c-mt7621.o
drivers/i2c/busses/i2c-microchip-core.c new file +486 -0

486 lines not on this page · raw message

Signature · 1 line
2.36.1