devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: "Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Sean Wang" <sean.wang@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	upstream@airoha.com, benjamin.larsson@genexis.eu,
	linux-pwm@vger.kernel.org
Subject: Re: [PATCH v5 3/5] mfd: airoha: Add support for Airoha EN7581 MFD
Date: Thu, 10 Oct 2024 17:25:23 +0100	[thread overview]
Message-ID: <20241010162523.GJ661995@google.com> (raw)
In-Reply-To: <6707a8ec.df0a0220.376450.293e@mx.google.com>

On Thu, 10 Oct 2024, Christian Marangi wrote:

> On Wed, Oct 09, 2024 at 11:55:50AM +0100, Lee Jones wrote:
> > On Wed, 09 Oct 2024, Lee Jones wrote:
> > 
> > > On Wed, 09 Oct 2024, Lorenzo Bianconi wrote:
> > > 
> > > > On Oct 02, Lee Jones wrote:
> > > > > On Tue, 01 Oct 2024, Lorenzo Bianconi wrote:
> > > > > 
> > > > > > From: Christian Marangi <ansuelsmth@gmail.com>
> > > > > > 
> > > > > > Support for Airoha EN7581 Multi Function Device that
> > > > > > expose PINCTRL functionality and PWM functionality.
> > > > > 
> > > > > The device is a jumble of pinctrl registers, some of which can oscillate.
> > > > > 
> > > > > This is *still* not an MFD.
> > > > > 
> > > > > If you wish to spread this functionality over 2 drivers, use syscon to
> > > > > obtain the registers and simple-mfd to automatically probe the drivers.
> > > > 
> > > > Hi Lee,
> > > > 
> > > > IIUC you are suggesting two possible approaches here:
> > > > 
> > > > 1- have a single driver implementing both pinctrl and pwm functionalities.
> > > >    This approach will not let us reuse the code for future devices that
> > > >    have just one of them in common, like pwm (but we can live with that).
> > > 
> > > If you can have one without the other, then they are separate devices.
> > > 
> > > > 2- use a device node like the one below (something similar to [0])
> > > > 
> > > > system-controller@1fbf0200 {
> > > > 	compatible = "syscon", "simple-mfd";
> > > > 	reg = <0x0 0x1fbf0200 0x0 0xc0>;
> > > > 
> > > > 	interrupt-parent = <&gic>;
> > > > 	interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
> > > > 
> > > > 	gpio-controller;
> > > > 	#gpio-cells = <2>;
> > > > 
> > > > 	interrupt-controller;
> > > > 	#interrupt-cells = <2>;
> > > > 
> > > > 	pio: pinctrl {
> > > > 		compatible = "airoha,en7581-pinctrl";
> > > > 
> > > > 		[ some pinctrl properties here ]
> > > > 	};
> > > > 
> > > > 	#pwm-cells = <3>;
> > > > 
> > > > 	pwm {
> > > > 		compatible = "airoha,en7581-pwm";
> > > > 	};
> > > > };
> > > > 
> > > > Please correct me if I am wrong, but using syscon/simple-mfd as compatible
> > > > string for the 'parent' device, will require to introduce the compatible strings
> > > > even for the child devices in order to probe them, correct? 
> > > > If so, as pointed out by Christian, this is something nacked by Rob/Krzysztof/Conor
> > > > (this is the main reason why we introduced a full mfd driver here).
> > > > 
> > > > @Rob, Krzysztof, Conor: am I right?
> > > 
> > > I don't see why separate functionality shouldn't have separate
> > > compatible strings, even if the registers are together.  Register layout
> > > and functionality separation are not related.
> > 
> > We've been happy to support both pinctrl and pwm devices before:
> > 
> >   git grep "\-pinctrl\|\-pwm" -- drivers/mfd
> >   git grep "\-pinctrl\|\-pwm" -- arch/*/boot/dts
> > 
> >   git grep "\-pinctrl" -- arch/*/boot/dts | wc -l
> >   602
> >   git grep "\-pwm" -- arch/*/boot/dts | wc -l
> >   856
> > 
> > What makes this particular device different to all of the others?
> >
> 
> Hi Lee,
> 
> this would be the final DTS following the "simple-mfd" pattern.
> 
> Can you confirm it's correct?

I can't confirm that it's 100% correct, but it looks okay to me.

> mfd: system-controller@1fbf0200 {

Not sure about the mfd: label though.

What is the device?

> 	compatible = "syscon", "simple-mfd";
> 	reg = <0x0 0x1fbf0200 0x0 0xc0>;
>  
> 	interrupt-parent = <&gic>;
> 	interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
>  
> 	gpio-controller;
> 	#gpio-cells = <2>;
>  
> 	interrupt-controller;
> 	#interrupt-cells = <2>;
> 
> 	gpio-ranges = <&mfd 0 13 47>;
> 
> 	#pwm-cells = <3>;
>  
> 	pio: pinctrl {
> 		compatible = "airoha,en7581-pinctrl";
>  
> 		mdio_pins: mdio-pins {
> 			mux {
> 				function = "mdio";
> 				groups = "mdio";
> 			};
>  
> 			conf {
> 				pins = "gpio2";
> 				output-high;
> 			};
> 		};
>  
> 		pcie0_rst_pins: pcie0-rst-pins {
> 			conf {
> 				pins = "pcie_reset0";
> 				drive-open-drain = <1>;
> 			};
> 		};
>  
> 		pcie1_rst_pins: pcie1-rst-pins {
> 			conf {
> 				pins = "pcie_reset1";
> 				drive-open-drain = <1>;
> 			};
> 		};
> 	};
>  
> 	pwm {
> 		compatible = "airoha,en7581-pwm";
> 	};
> };
> 
> -- 
> 	Ansuel

-- 
Lee Jones [李琼斯]

  parent reply	other threads:[~2024-10-10 16:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 17:29 [PATCH v5 0/5] Add mfd, pinctrl and pwm support to EN7581 SoC Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 1/5] dt-bindings: arm: airoha: Add the chip-scu node for " Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 2/5] dt-bindings: mfd: Add support for Airoha EN7581 GPIO System Controller Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 3/5] mfd: airoha: Add support for Airoha EN7581 MFD Lorenzo Bianconi
2024-10-02 13:25   ` Lee Jones
2024-10-02 22:42     ` Christian Marangi
2024-10-08 22:04     ` Lorenzo Bianconi
2024-10-09 10:48       ` Lee Jones
2024-10-09 10:55         ` Lee Jones
2024-10-10 10:14           ` Christian Marangi
2024-10-10 10:41             ` Christian Marangi
2024-10-10 16:25             ` Lee Jones [this message]
2024-10-10 19:34             ` Linus Walleij
2024-10-10 21:41               ` Lorenzo Bianconi
2024-10-11  6:51                 ` Linus Walleij
2024-10-01 17:29 ` [PATCH v5 4/5] pinctrl: airoha: Add support for EN7581 SoC Lorenzo Bianconi
2024-10-02 13:27   ` Linus Walleij
2024-10-02 15:37     ` Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 5/5] pwm: " Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241010162523.GJ661995@google.com \
    --to=lee@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ansuelsmth@gmail.com \
    --cc=benjamin.larsson@genexis.eu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).