Skip to contentSkip to conversation

Congatec Board Controller drivers

PATCH Applied Thomas Richard 3 participants 10 messages Oct 1, 2024 – Oct 10, 2024

Subsystems (5)
lore
Share & tools
lore

Thomas Richard

author maintainer
#0 lore raw

v3 cover Congatec Board Controller drivers

This is the third iteration of the Congatec Board Controller series.

There are only few changes for the GPIO driver (commit message, Kconfig, remove useless cast).
I also rebased the series on Linux v6.12-rc1.

Best Regards,

Thomas

---
Changes in v3:
- Rebased on Linux v6.12-rc1.
- gpio: improve commit message.
- gpio: in Kconfig move driver definition in the MFD GPIO drivers submenu.
- gpio: remove useless cast.
- gpio: take Reviewed-by: Linus Walleij <[email protected]>
- i2c: take Acked-by: Andi Shyti <[email protected]>
- watchdog: take Acked-by: Guenter Roeck <[email protected]>
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- mfd: use platform_device_register_simple(), so struct cgbc_platform_data
and cgbc_create_platform_device() were removed.
- mfd: rename cgbc_detect_device() to cgbc_wait_device().
- mfd: remove the useless abstracted function cgbc_command().
- mfd: set the release session message as warning instead of error.
- mfd: minor fixes (sort includes, add comments, fix some alignments and
nit ...).
- gpio: use scoped_guard() and guard().
- gpio: use devm_mutex_init().
- i2c: unset the I2C_FUNC_SMBUS_QUICK flag as smbus quick accesses are not
supported by the controller.
- i2c: rephrase comment for read_maxtime_us.
- i2c: set the invalid frequency message as an info (previously a warning).
- i2c: other minor fixes (sort includes, fix name of i2c_state enum).
- watchdog: add missing includes.
- watchdog: remove warning for the pretimeout.
- watchdog: remove timeout_action and pretimeout_action (ACTION_RESET and
ACTION_SMI are directly used in cgbc_wdt_start()).
- watchdog: set max_timeout and min_timeout.
- watchdog: use watchdog_init_timeout() to set the timeout.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Richard (5):
mfd: add Congatec Board Controller mfd driver
gpio: Congatec Board Controller gpio driver
i2c: Congatec Board Controller i2c bus driver
watchdog: Congatec Board Controller watchdog timer driver
MAINTAINERS: Add entry for Congatec Board Controller

 MAINTAINERS                   |   9 +
 drivers/gpio/Kconfig          |  10 +
 drivers/gpio/Makefile         |   1 +
 drivers/gpio/gpio-cgbc.c      | 196 ++++++++++++++++++++
 drivers/i2c/busses/Kconfig    |  10 +
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-cgbc.c | 406 +++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig           |  12 ++
 drivers/mfd/Makefile          |   1 +
 drivers/mfd/cgbc-core.c       | 411 ++++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/Kconfig      |  10 +
 drivers/watchdog/Makefile     |   1 +
 drivers/watchdog/cgbc_wdt.c   | 211 ++++++++++++++++++++++
 include/linux/mfd/cgbc.h      |  44 +++++
 14 files changed, 1323 insertions(+)

---
base-commit: 81178bc5d0ffdf50522adabda7a66093a56149ce
change-id: 20240503-congatec-board-controller-82c6b84cd4ea

Best regards,

Signature · 1 line
Thomas Richard <[email protected]>
author maintainer
#1 lore raw

PATCH v3 1/5 mfd: add Congatec Board Controller mfd driver

Add core MFD driver for the Board Controller found on some Congatec SMARC module. This Board Controller provides functions like watchdog, GPIO, and I2C busses.

This commit adds support only for the conga-SA7 module.

---
 drivers/mfd/Kconfig      |  12 ++
 drivers/mfd/Makefile     |   1 +
 drivers/mfd/cgbc-core.c  | 411 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/cgbc.h |  44 +++++
 4 files changed, 468 insertions(+)
drivers/mfd/Kconfig +12 -0
index f9325bcce1b9..03c1e4e3eea4 100644
@@ -236,6 +236,18 @@ config MFD_AXP20X_RSB
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_CGBC
+	tristate "Congatec Board Controller"
+	select MFD_CORE
+	depends on X86
+	help
+	  This is the core driver of the Board Controller found on some Congatec
+	  SMARC modules. The Board Controller provides functions like watchdog,
+	  I2C busses, and GPIO controller.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called cgbc-core.
+
 config MFD_CROS_EC_DEV
 	tristate "ChromeOS Embedded Controller multifunction device"
 	select MFD_CORE
drivers/mfd/Makefile +1 -0
index 2a9f91e81af8..e057d6d6faef 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_ARCH_BCM2835)	+= bcm2835-pm.o
 obj-$(CONFIG_MFD_BCM590XX)	+= bcm590xx.o
 obj-$(CONFIG_MFD_BD9571MWV)	+= bd9571mwv.o
+obj-$(CONFIG_MFD_CGBC)		+= cgbc-core.o
 obj-$(CONFIG_MFD_CROS_EC_DEV)	+= cros_ec_dev.o
 obj-$(CONFIG_MFD_CS42L43)	+= cs42l43.o
 obj-$(CONFIG_MFD_CS42L43_I2C)	+= cs42l43-i2c.o
drivers/mfd/cgbc-core.c new file +411 -0

411 lines not on this page · raw message

include/linux/mfd/cgbc.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH v3 2/5 gpio: Congatec Board Controller gpio driver

In reply to Thomas Richard

Add gpio support for the Congatec Board Controller. This Board Controller has 14 GPIO pins.

The driver is probed by the Congatec Board Controller MFD driver.

---
 drivers/gpio/Kconfig     |  10 +++
 drivers/gpio/Makefile    |   1 +
 drivers/gpio/gpio-cgbc.c | 196 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)
drivers/gpio/Kconfig +10 -0
index d93cd4f722b4..29d037c6083b 100644
@@ -1287,6 +1287,16 @@ config GPIO_BD9571MWV
 	  This driver can also be built as a module. If so, the module
 	  will be called gpio-bd9571mwv.
 
+config GPIO_CGBC
+	tristate "Congatec Board Controller GPIO support"
+	depends on MFD_CGBC
+	help
+	  Select this option to enable GPIO support for the Congatec Board
+	  Controller.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called gpio-cgbc.
+
 config GPIO_CROS_EC
 	tristate "ChromeOS EC GPIO support"
 	depends on CROS_EC
drivers/gpio/Makefile +1 -0
index 1429e8c0229b..3cdfa927ed98 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_GPIO_BD9571MWV)		+= gpio-bd9571mwv.o
 obj-$(CONFIG_GPIO_BRCMSTB)		+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)		+= gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CADENCE)		+= gpio-cadence.o
+obj-$(CONFIG_GPIO_CGBC)			+= gpio-cgbc.o
 obj-$(CONFIG_GPIO_CLPS711X)		+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_SNPS_CREG)		+= gpio-creg-snps.o
 obj-$(CONFIG_GPIO_CROS_EC)		+= gpio-cros-ec.o
drivers/gpio/gpio-cgbc.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#4 lore raw

PATCH v3 3/5 i2c: Congatec Board Controller i2c bus driver

In reply to Thomas Richard

Add i2c support for the Congatec Board Controller.

The Board Controller has two i2c busses, a General Purpose bus and a Power Management bus.

---
 drivers/i2c/busses/Kconfig    |  10 ++
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-cgbc.c | 406 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 417 insertions(+)
drivers/i2c/busses/Kconfig +10 -0
index 6b3ba7e5723a..4977abcd7c46 100644
@@ -535,6 +535,16 @@ config I2C_CBUS_GPIO
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-cbus-gpio.
 
+config I2C_CGBC
+	tristate "Congatec I2C Controller"
+	depends on MFD_CGBC
+	help
+	  This driver supports the 2 I2C interfaces on the Congatec Board
+	  Controller.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called i2c-cgbc.ko.
+
 config I2C_CPM
 	tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)"
 	depends on CPM1 || CPM2
drivers/i2c/busses/Makefile +1 -0
index ecc07c50f2a0..a6bcbf2febcf 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_I2C_BCM2835)	+= i2c-bcm2835.o
 obj-$(CONFIG_I2C_BCM_IPROC)	+= i2c-bcm-iproc.o
 obj-$(CONFIG_I2C_CADENCE)	+= i2c-cadence.o
 obj-$(CONFIG_I2C_CBUS_GPIO)	+= i2c-cbus-gpio.o
+obj-$(CONFIG_I2C_CGBC)		+= i2c-cgbc.o
 obj-$(CONFIG_I2C_CPM)		+= i2c-cpm.o
 obj-$(CONFIG_I2C_DAVINCI)	+= i2c-davinci.o
 obj-$(CONFIG_I2C_DESIGNWARE_CORE)			+= i2c-designware-core.o
drivers/i2c/busses/i2c-cgbc.c new file +406 -0

406 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#5 lore raw

PATCH v3 4/5 watchdog: Congatec Board Controller watchdog timer driver

In reply to Thomas Richard

Add watchdog timer support for the Congatec Board Controller.

---
 drivers/watchdog/Kconfig    |  10 +++
 drivers/watchdog/Makefile   |   1 +
 drivers/watchdog/cgbc_wdt.c | 211 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+)
drivers/watchdog/Kconfig +10 -0
index 684b9fe84fff..755cf3559540 100644
@@ -1151,6 +1151,16 @@ config ALIM7101_WDT
 
 	  Most people will say N.
 
+config CGBC_WDT
+	tristate "Congatec Board Controller Watchdog Timer"
+	depends on MFD_CGBC
+	select WATCHDOG_CORE
+	help
+	  Enables watchdog timer support for the Congatec Board Controller.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called cgbc_wdt.
+
 config EBC_C384_WDT
 	tristate "WinSystems EBC-C384 Watchdog Timer"
 	depends on (X86 || COMPILE_TEST) && HAS_IOPORT
drivers/watchdog/Makefile +1 -0
index ab6f2b41e38e..386d88d89fe5 100644
@@ -107,6 +107,7 @@ obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
 obj-$(CONFIG_ADVANTECH_EC_WDT) += advantech_ec_wdt.o
 obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
 obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
+obj-$(CONFIG_CGBC_WDT) += cgbc_wdt.o
 obj-$(CONFIG_EBC_C384_WDT) += ebc-c384_wdt.o
 obj-$(CONFIG_EXAR_WDT) += exar_wdt.o
 obj-$(CONFIG_F71808E_WDT) += f71808e_wdt.o
drivers/watchdog/cgbc_wdt.c new file +211 -0

211 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#6 lore raw

PATCH v3 5/5 MAINTAINERS: Add entry for Congatec Board Controller

In reply to Thomas Richard

Add the Congatec Board Controller drivers and header as Maintained by myself.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index c27f3190737f..6f218022bd02 100644
@@ -5760,6 +5760,15 @@ F:	fs/configfs/
 F:	include/linux/configfs.h
 F:	samples/configfs/
 
+CONGATEC BOARD CONTROLLER MFD DRIVER
+M:	Thomas Richard <[email protected]>
+S:	Maintained
+F:	drivers/gpio/gpio-cgbc.c
+F:	drivers/i2c/busses/i2c-cgbc.c
+F:	drivers/mfd/cgbc-core.c
+F:	drivers/watchdog/cgbc_wdt.c
+F:	include/linux/mfd/cgbc.h
+
 CONSOLE SUBSYSTEM
 M:	Greg Kroah-Hartman <[email protected]>
 S:	Supported
Signature · 1 line
2.39.5
maintainer Applied
#7 lore raw
In reply to Thomas Richard
Quoted 9 lines · Thomas Richard

This is the third iteration of the Congatec Board Controller series.

There are only few changes for the GPIO driver (commit message, Kconfig, remove useless cast).
I also rebased the series on Linux v6.12-rc1.

Best Regards,

[...]

Applied, thanks!

[1/5] mfd: add Congatec Board Controller mfd driver

      commit: 6f1067cfbee72b04fc42234f7f1588f838cec0b6
[2/5] gpio: Congatec Board Controller gpio driver
      commit: 4342bf63b64b09561f4ad1537de2e1a971cfb197
[3/5] i2c: Congatec Board Controller i2c bus driver
      commit: 6894f640b8f3f48700ccc828419ba60704f5a405
[4/5] watchdog: Congatec Board Controller watchdog timer driver
      commit: 6f264047869e9683520ff8f7c235c07c1ca989d6
[5/5] MAINTAINERS: Add entry for Congatec Board Controller
      commit: 590bcce85e014a2e16afe910bc6a20b4c1b2b374

--
Lee Jones [李琼斯]

maintainer
#8 lore raw
Quoted 14 lines · Lee Jones
Quoted 9 lines · Thomas Richard

This is the third iteration of the Congatec Board Controller series.

There are only few changes for the GPIO driver (commit message, Kconfig, remove useless cast).
I also rebased the series on Linux v6.12-rc1.

Best Regards,

[...]

Applied, thanks!

[1/5] mfd: add Congatec Board Controller mfd driver

Quoted 9 lines
      commit: 6f1067cfbee72b04fc42234f7f1588f838cec0b6
[2/5] gpio: Congatec Board Controller gpio driver
      commit: 4342bf63b64b09561f4ad1537de2e1a971cfb197
[3/5] i2c: Congatec Board Controller i2c bus driver
      commit: 6894f640b8f3f48700ccc828419ba60704f5a405
[4/5] watchdog: Congatec Board Controller watchdog timer driver
      commit: 6f264047869e9683520ff8f7c235c07c1ca989d6
[5/5] MAINTAINERS: Add entry for Congatec Board Controller
      commit: 590bcce85e014a2e16afe910bc6a20b4c1b2b374

Sent for build testing. Will follow-up with an PR once complete.

Note to self: ib-mfd-gpio-i2c-watchdog-6.13

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#9 lore raw

[GIT PULL] Immutable branch between MFD, GPIO, I2C and Watchdog due for the v6.13 merge window

In reply to Thomas Richard

Enjoy!

The following changes since commit 9852d85ec9d492ebef56dc5f229416c925758edc:

Linux 6.12-rc1 (2024-09-29 15:06:19 -0700)

are available in the Git repository at:

ssh://[email protected]/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-gpio-i2c-watchdog-v6.13

for you to fetch changes up to 590bcce85e014a2e16afe910bc6a20b4c1b2b374:

MAINTAINERS: Add entry for Congatec Board Controller (2024-10-09 16:32:13 +0100)

----------------------------------------------------------------
Immutable branch between MFD, GPIO, I2C and Watchdog due for the v6.13 merge window

----------------------------------------------------------------
Thomas Richard (5):
mfd: Add Congatec Board Controller driver
gpio: Congatec Board Controller gpio driver
i2c: Congatec Board Controller i2c bus driver
watchdog: Congatec Board Controller watchdog timer driver
MAINTAINERS: Add entry for Congatec Board Controller

 MAINTAINERS                   |   9 +
 drivers/gpio/Kconfig          |  10 +
 drivers/gpio/Makefile         |   1 +
 drivers/gpio/gpio-cgbc.c      | 196 ++++++++++++++++++++
 drivers/i2c/busses/Kconfig    |  10 +
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-cgbc.c | 406 +++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig           |  12 ++
 drivers/mfd/Makefile          |   1 +
 drivers/mfd/cgbc-core.c       | 411 ++++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/Kconfig      |  10 +
 drivers/watchdog/Makefile     |   1 +
 drivers/watchdog/cgbc_wdt.c   | 211 ++++++++++++++++++++++
 include/linux/mfd/cgbc.h      |  44 +++++
 14 files changed, 1323 insertions(+)
 create mode 100644 drivers/gpio/gpio-cgbc.c
 create mode 100644 drivers/i2c/busses/i2c-cgbc.c
 create mode 100644 drivers/mfd/cgbc-core.c
 create mode 100644 drivers/watchdog/cgbc_wdt.c
 create mode 100644 include/linux/mfd/cgbc.h
Signature · 1 line
Lee Jones [李琼斯]