devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Ayush Singh <ayush@beagleboard.org>, Andrew Davis <afd@ti.com>
Cc: Jason Kridner <jkridner@beagleboard.org>,
	Deepak Khatri <lorforlinux@beagleboard.org>,
	Robert Nelson <robertcnelson@beagleboard.org>,
	nenad.marinkovic@mikroe.com,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Robert Nelson <robertcnelson@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Saravana Kannan <saravanak@google.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Dhruva Gole <d-gole@ti.com>,
	devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3] Add new `export-symbols` node
Date: Mon, 14 Apr 2025 16:46:17 +0200	[thread overview]
Message-ID: <20250414164617.51038dd4@bootlin.com> (raw)
In-Reply-To: <d78e60f2-e2e5-4e6a-9724-68cc0481fd77@beagleboard.org>

Hi Ayush, David,

On Sat, 12 Apr 2025 00:19:16 +0530
Ayush Singh <ayush@beagleboard.org> wrote:

> On 4/11/25 23:09, Andrew Davis wrote:
> 
> > On 4/11/25 3:00 AM, Ayush Singh wrote:  
> >> `export-symbols` is designed to be a local replacement of global
> >> `__symbols__` allowing nodes to define aliases to nodes in a tree, which
> >> will take precedence over the aliases defined in the global 
> >> `__symbols__`.
> >>
> >> Having a way to allow node local aliases helps in usecases such as
> >> connectors and addon-boards, by allowing decoupling of
> >> overlays/devicetree nodes of addon-board from the base connector.
> >>
> >> Reviewed-by: Herve Codina <herve.codina@bootlin.com>
> >> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> >> Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> >> ---
> >> This patch series follows the initial RFC [9] sent a few weeks ago. I
> >> will be reiterating the RFC here for anyone who might be seeing this the
> >> first time, since there was not much feedback in that thread.
> >>  
> >
> > I think this is a useful tool in the effort to build a complete 
> > addon-board
> > solution. But I'm still missing how it all fits together, do you have 
> > a real
> > working overlay making use of this somewhere I could take a look at? 
> > Maybe
> > an overlay for one of the addon-boards you list below (one of the 
> > BeagleCapes
> > for instance).
> >

We (me and Luca) have a working device-tree and overlay.

Our base device tree is the following (simplified but relevant part for
this topic are available):
/ {
	...

	addon_connector0: addon-connector0 {
		compatible = "gehc,sunhv1-addon-connector";

		/*
		 * addon-connector node is a nexus node
		 *  - 2 interupt lines are wired to the connector
		 *  - 1 gpio line is wired to the connector
		 *  - 1 PWM is wired to the connector
		 */
		#interrupt-cells = <2>;
		#address-cells = <0>;
		interrupt-map = <0 IRQ_TYPE_LEVEL_LOW    &gpio4 1 IRQ_TYPE_LEVEL_LOW>,
				<0 IRQ_TYPE_EDGE_FALLING &gpio4 1 IRQ_TYPE_EDGE_FALLING>,
				<1 IRQ_TYPE_LEVEL_LOW    &i2c3_mux 1 1 IRQ_TYPE_LEVEL_LOW>,
				<1 IRQ_TYPE_EDGE_FALLING &i2c3_mux 1 1 IRQ_TYPE_EDGE_FALLING>;
		#gpio-cells = <2>;
		gpio-map-mask = <0xf 0x0>;
		gpio-map-pass-thru = <0x0 0xf>;
		gpio-map = <0 0 &gpio4 1 0>;
		#pwm-cells = <3>;
		pwm-map-mask = <0xffffffff 0 0>;
		pwm-map-pass-thru = <0 0xffffffff 0xffffffff>;
		pwm-map = <0 0 0 &pwm1 0 57000 0>;


		devices {
			/*
			 * 'no bus' devices such as fixed-regulators or
			 * fixed-clocks will be added in this node by the
			 * overlay.
			 */
			#address-cells = <0>;
			#size-cells = <0>;
		};

		/*
		 * This is the i2c bus wired at the connector. It is
		 * handled by the i2c5 adapter available in the SoC.
		 * The overlay will add devices in this node. Those
		 * devices are devices available on the addon-board and
		 * connected to this i2c bus
		 */
		i2c-addon {
			i2c-parent = <&i2c5>;
			#address-cells = <1>;
			#size-cells = <0>;
		};

		export-symbols {
			/*
			 * The 'addon_connector' symbol can be used from the
			 * overlay to reference this connector
			 */
			addon_connector = <&addon_connector0>;
		};
	};
};


Then following overlay is applied at the addon-connector0 node and described
the addon board connected to the connector:

/ {
	fragment@0 {
		target-path = "";

		__overlay__ {
			devices {
				reg_addon_3v3: regulator-addon-3v3 {
					compatible = "regulator-fixed";
					regulator-name = "3V3_ADDON";
					regulator-min-microvolt = <15000000>;
					regulator-max-microvolt = <15000000>;
					regulator-always-on;
				};

				reg_addon_12v0: regulator-addon-12v0 {
					compatible = "regulator-fixed";
					regulator-name = "12V0_ADDON";
					vin-supply = <&reg_addon_3v3>;
					regulator-min-microvolt = <12000000>;
					regulator-max-microvolt = <12000000>;
					gpios = <&tca6424_addon 12 GPIO_ACTIVE_HIGH>;
					enable-active-high;
				};

				/*
				 * This backligh is a PWM driven backlight.
				 * It uses the PWM #0 available at the connector
				 */
				backlight_addon: backlight-addon {
					compatible = "pwm-backlight";
					power-supply = <&reg_addon_12v0>;
					pwms = <&addon_connector 0 57000 0>;
					brightness-levels = <0 255>;
					num-interpolated-steps = <255>;
					default-brightness-level = <255>;
				};
			};

			i2c-addon {
				#address-cells = <1>;
				#size-cells = <0>;

				/*
				 * This IO expander uses the interrupt #0
				 * available at the connector.
				 * It is a device connected to the i2c-addon bus
				 * available at the connector.
				 */
				tca6424_addon: gpio@23 {
					compatible = "ti,tca6424";
					status = "okay";
					reg = <0x23>;
					gpio-controller;
					#gpio-cells = <2>;
					interrupt-parent = <&addon_connector>;
					interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
					interrupt-controller;
					#interrupt-cells = <2>;
					vcc-supply = <&reg_addon_3v3>;
				};
			};
		};
	};
};


Best regards,
Hervé


  reply	other threads:[~2025-04-14 14:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11  8:00 [PATCH v3] Add new `export-symbols` node Ayush Singh
2025-04-11 17:39 ` Andrew Davis
2025-04-11 18:49   ` Ayush Singh
2025-04-14 14:46     ` Herve Codina [this message]
2025-04-14 16:34       ` Andrew Davis
2025-04-14 17:13         ` Ayush Singh
2025-04-15 10:24           ` Herve Codina
2025-04-29 19:15 ` Ayush Singh
2025-04-29 19:51   ` Andrew Davis
2025-04-30  7:32     ` Ayush Singh
2025-04-30 18:56       ` Andrew Davis

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=20250414164617.51038dd4@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=afd@ti.com \
    --cc=arnd@arndb.de \
    --cc=ayush@beagleboard.org \
    --cc=conor+dt@kernel.org \
    --cc=d-gole@ti.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-spec@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkridner@beagleboard.org \
    --cc=krzk+dt@kernel.org \
    --cc=lorforlinux@beagleboard.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=nenad.marinkovic@mikroe.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=robertcnelson@gmail.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=thomas.petazzoni@bootlin.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).