diff mbox series

[v4,1/6] mfd: simple-mfd-i2c: Add Delta TN48M CPLD support

Message ID 20210602122439.2084775-1-robert.marko@sartura.hr
State Superseded
Headers show
Series [v4,1/6] mfd: simple-mfd-i2c: Add Delta TN48M CPLD support | expand

Commit Message

Robert Marko June 2, 2021, 12:24 p.m. UTC
Delta TN48M switches have a Lattice CPLD that serves
multiple purposes including being a GPIO expander.

So, lets use the simple I2C MFD driver to provide the MFD core.

Also add a virtual symbol which pulls in the simple-mfd-i2c driver and
provide a common symbol on which the subdevice drivers can depend on.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/Kconfig          | 10 ++++++++++
 drivers/mfd/simple-mfd-i2c.c |  1 +
 2 files changed, 11 insertions(+)

Comments

Philipp Zabel June 7, 2021, 9:23 a.m. UTC | #1
Hi Robert,

On Wed, 2021-06-02 at 14:24 +0200, Robert Marko wrote:
> Delta TN48M CPLD exposes resets for the following:

> * 88F7040 SoC

> * 88F6820 SoC

> * 98DX3265 switch MAC-s

> * 88E1680 PHY-s

> * 88E1512 PHY

> * PoE PSE controller

> 

> Controller supports only self clearing resets.

> 

> Signed-off-by: Robert Marko <robert.marko@sartura.hr>

> ---

>  drivers/reset/Kconfig       |   9 +++

>  drivers/reset/Makefile      |   1 +

>  drivers/reset/reset-tn48m.c | 128 ++++++++++++++++++++++++++++++++++++

>  3 files changed, 138 insertions(+)

>  create mode 100644 drivers/reset/reset-tn48m.c

> 

> diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig

> index 4171c6f76385..14e179cda58c 100644

> --- a/drivers/reset/Kconfig

> +++ b/drivers/reset/Kconfig

> @@ -237,6 +237,15 @@ config RESET_TI_SYSCON

>  	  you wish to use the reset framework for such memory-mapped devices,

>  	  say Y here. Otherwise, say N.

>  

> +config RESET_TN48M_CPLD

> +	tristate "Delta Networks TN48M switch CPLD reset controller"

> +	depends on MFD_TN48M_CPLD


Let's make this

	depends on MFD_TN48M_CPLD || COMPILE_TEST
	default MFD_TN48M_CPLD

unless there is a reason not to enable the reset driver by default when
the MFD driver is activated.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>


regards
Philipp
Robert Marko June 7, 2021, 10:40 a.m. UTC | #2
On Mon, Jun 7, 2021 at 11:23 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>

> Hi Robert,

>

> On Wed, 2021-06-02 at 14:24 +0200, Robert Marko wrote:

> > Delta TN48M CPLD exposes resets for the following:

> > * 88F7040 SoC

> > * 88F6820 SoC

> > * 98DX3265 switch MAC-s

> > * 88E1680 PHY-s

> > * 88E1512 PHY

> > * PoE PSE controller

> >

> > Controller supports only self clearing resets.

> >

> > Signed-off-by: Robert Marko <robert.marko@sartura.hr>

> > ---

> >  drivers/reset/Kconfig       |   9 +++

> >  drivers/reset/Makefile      |   1 +

> >  drivers/reset/reset-tn48m.c | 128 ++++++++++++++++++++++++++++++++++++

> >  3 files changed, 138 insertions(+)

> >  create mode 100644 drivers/reset/reset-tn48m.c

> >

> > diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig

> > index 4171c6f76385..14e179cda58c 100644

> > --- a/drivers/reset/Kconfig

> > +++ b/drivers/reset/Kconfig

> > @@ -237,6 +237,15 @@ config RESET_TI_SYSCON

> >         you wish to use the reset framework for such memory-mapped devices,

> >         say Y here. Otherwise, say N.

> >

> > +config RESET_TN48M_CPLD

> > +     tristate "Delta Networks TN48M switch CPLD reset controller"

> > +     depends on MFD_TN48M_CPLD

>

> Let's make this

>

>         depends on MFD_TN48M_CPLD || COMPILE_TEST

>         default MFD_TN48M_CPLD


Sure, I will change that and send a v5.
>

> unless there is a reason not to enable the reset driver by default when

> the MFD driver is activated.


No, it's just a habit of making everything optional.

Regards,
Robert
>

> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

>

> regards

> Philipp




-- 
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko@sartura.hr
Web: www.sartura.hr
diff mbox series

Patch

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b74efa469e90..733c2f9adb15 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -297,6 +297,16 @@  config MFD_ASIC3
 	  This driver supports the ASIC3 multifunction chip found on many
 	  PDAs (mainly iPAQ and HTC based ones)
 
+config MFD_TN48M_CPLD
+	tristate "Delta Networks TN48M switch CPLD driver"
+	depends on I2C
+	select MFD_SIMPLE_MFD_I2C
+	help
+	  Select this option to enable support for Delta Networks TN48M switch
+	  CPLD. It consists of reset and GPIO drivers. CPLD provides GPIOS-s
+	  for the SFP slots as well as power supply related information.
+	  SFP support depends on the GPIO driver being selected.
+
 config PMIC_DA903X
 	bool "Dialog Semiconductor DA9030/DA9034 PMIC Support"
 	depends on I2C=y
diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
index 87f684cff9a1..af8e91781417 100644
--- a/drivers/mfd/simple-mfd-i2c.c
+++ b/drivers/mfd/simple-mfd-i2c.c
@@ -39,6 +39,7 @@  static int simple_mfd_i2c_probe(struct i2c_client *i2c)
 
 static const struct of_device_id simple_mfd_i2c_of_match[] = {
 	{ .compatible = "kontron,sl28cpld" },
+	{ .compatible = "delta,tn48m-cpld" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);