tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

[SOLVED] SC16IS752 multiple SPI devices

Fri May 15, 2020 5:24 am

Hello,

I am trying to use a custom board with two sc16is752 chips wired to SPI1.

I can get either chip to occupy /dev/ttySC0 and /dev/ttySC1, but I can't get both chips working at the same time for /dev/ttySC0-3

Since chip select is not exposed as a user override, I am using a custom dts file. One of the chips uses the default chip select for SPI1 so that chip does work using the built in overlay, but for clarity I will show two custom dts files modified to contain the correct connections for my board.

When running both of the files below, only the one listed last in /boot/config.txt will be used.

Do I need to merge them in to one file, or...?

Here is the first file:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>;
			status = "okay";

			sc16is752: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 */
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};

	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

    __overrides__ {
		int_pin = <&sc16is752>,"interrupts:0";
		xtal = <&sc16is752_clk>,"clock-frequency:0";
    };
};
And here is the second:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 12 1>;
			status = "okay";

			sc16is752: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 - (This is actually going to be CS1 but the overlay doesn't work at all when this is set to 1) */
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};

	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

    __overrides__ {
		int_pin = <&sc16is752>,"interrupts:0";
		xtal = <&sc16is752_clk>,"clock-frequency:0";
    };
};
And then at the end of my /boot/config.txt I have the following lines:

Code: Select all

dtoverlay=sc16is752-1
dtoverlay=sc16is752-2
Whichever one is listed last seems to be the one that gets used. Any help would be greatly appreciated!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2808
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SC16IS752 multiple SPI devices

Fri May 15, 2020 9:14 am

You need to think of Device Tree nodes as directories and properties as files. When an overlay declares a node with some properties it is like unpacking a zip file containing a directory with some files. If you have two zip files that use the same directory and files then the last one which is extracted is going to be the one that wins.

The problems with your overlays are:

1. The main sc16is752 nodes are both called [email protected] The "@0" is a disambiguating address which is meant to match the value of the "reg" property. Change the name in the second overlay to "[email protected]".

2. The SPI controller needs to know about both chip selects - "cs-gpios = <&gpio 18 1>, <&gpio 12 1>;". Do the same with the pinctrl declaration:

Code: Select all

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
It doesn't matter that both overlays set the values (unless you are intending to apply the overlay at runtime), provided they both agree.

Make those changes then see how you get on.

tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

Re: SC16IS752 multiple SPI devices

Fri May 15, 2020 10:13 am

Thank you for the helpful reply!

I believe I've made the right changes, but I still get just the two serial ports. It's late for me so I may have made a simple mistake. I will look at it again with fresh eyes tomorrow. But in case there is an obvious error you could identify, this is what I have right now:

sc16is752-1.dts

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";

			sc16is752: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 */
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};

	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

    __overrides__ {
		int_pin = <&sc16is752>,"interrupts:0";
		xtal = <&sc16is752_clk>,"clock-frequency:0";
    };
};
sc16is752-2.dts

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";

			sc16is752: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <1>; /* CE1 */
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};

	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

    __overrides__ {
		int_pin = <&sc16is752>,"interrupts:0";
		xtal = <&sc16is752_clk>,"clock-frequency:0";
    };
};
The files are identical except for these lines:

Code: Select all

sc16is752: [email protected] {
reg = <0>; /* CE0 */
interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */

Code: Select all

sc16is752: [email protected] {
reg = <1>; /* CE1 */
interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
I did double check that I have the interrupt and chip select pins correct, not swapped. IRQ0 pin BCM26 goes with BCM18 for CS0 and IRQ1 pin BCM27 goes with BCM12 for CS1.

And it does not make any difference if I put this line before the other two overlays:

Code: Select all

dtoverlay=spi1-2cs,cs0_pin=18,cs1_pin=12
The command

Code: Select all

sudo vcdbg log msg
Returns the following lines amongst some other stuff:

Code: Select all

004822.906: brfs: File read: /mfs/sd/overlays/sc16is752-1.dtbo
004863.013: Loaded overlay 'sc16is752-1'
005077.651: brfs: File read: 1960 bytes
005088.354: brfs: File read: /mfs/sd/overlays/sc16is752-2.dtbo
005129.005: Loaded overlay 'sc16is752-2'
005325.153: brfs: File read: 1960 bytes
I'll take another look once I've slept on it, but any thoughts are appreciated. Thanks again!

tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

Re: SC16IS752 multiple SPI devices

Sat May 16, 2020 1:57 am

No luck today. I'm not seeing any clear errors in my overlays unless I misunderstood the suggestion.

I also tried combining the overlays into a single file two different ways, one manually and one with ovmerge. Both load without errors according to "sudo vcdbg log msg" but still only show two serial ports.

Here is the file created by ovmerge:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>;
			};
			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>;
			};
		};
	};
	[email protected] {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";
			[email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>;
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>;
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;
				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};
	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins_1: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>;
			};
			spi1_cs_pins_1: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>;
			};
		};
	};
	[email protected] {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins_1 &spi1_cs_pins_1>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";
			[email protected] {
				compatible = "nxp,sc16is752";
				reg = <1>;
				clocks = <&sc16is752_clk_1>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>;
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;
				sc16is752_clk_1: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};
	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};
};
and here is the manually merged file:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";

			sc16is752_1: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 */
				clocks = <&sc16is752_clk_1>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_1: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};

			sc16is752_2: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <1>; /* CE1 */
				clocks = <&sc16is752_clk_2>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_2: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};

			};
		};
	};


	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

};
I will move on to some other bring-up tasks on this new board. But any guidance here would be greatly appreciated. Either I am making a mistake or I've uncovered a bug in the driver. I've noticed that past forum users who have tried multiple sc16is752 chips are using I2C, so perhaps there is a bug in the multiple SPI use case.

Also, I still don't see how any of these overlays are selecting the right chip select unless the "reg" value handles that.

Many thanks!

tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

Re: SC16IS752 multiple SPI devices

Tue May 19, 2020 5:57 am

PhilE,

I just noticed that in a post a year ago you debugged a similar issue with I2C.
viewtopic.php?f=107&t=235650&hilit=sc16 ... 5#p1445869

You said
In the absence of explicit clock names, the driver uses the node name as the name of the clock, leading to the clash. Unfortunately it ignores any "@xx" name suffix, stopping me from using the same disambiguation mechanism as the parent node (assigning to the "reg" property also renames the node). Fortunately it is possible to also treat the "addr" parameter as a string and assign it to the magic "name" property of the clock node, resulting in clocks called "0x48" and "0x4c".
Your I2C .dtbo file shared in that post didn't quite help, but I noticed in a text editor that the driver has aliases. I changed one of the driver items to be a SC16IS762 instead of the -752, and it worked! I now have both serial chips working, and they seem to be behaving well.

Here is the working .dts file.

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>;
			};
			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>;
			};
		};
	};
	[email protected] {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";
			[email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>;
				clocks = <&sc16is752_clk>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>;
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;
				sc16is752_clk: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};
	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins_1: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>;
			};
			spi1_cs_pins_1: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>;
			};
		};
	};
	[email protected] {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins_1 &spi1_cs_pins_1>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";
			[email protected] {
				compatible = "nxp,sc16is762";
				reg = <1>;
				clocks = <&sc16is762_clk_1>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>;
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;
				sc16is762_clk_1: sc16is762_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};
		};
	};
	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};
};
So is this a bug? And can I help get a pull request going for a fix? Unfortunately I'm not sure what to fix...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2808
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SC16IS752 multiple SPI devices

Tue May 19, 2020 7:53 am

It's an interesting theory - can you make certain that is the cause by trying this overlay:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";

			sc16is752_1: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 */
				clocks = <&sc16is752_clk_1>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_1: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};

			sc16is752_2: [email protected] {
				compatible = "nxp,sc16is762";
				reg = <1>; /* CE1 */
				clocks = <&sc16is752_clk_2>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_2: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};

			};
		};
	};


	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

};
It is a modified version of your previous combined overlay with only the second compatible string changed. If the modified version works while your original doesn't then you've gone a long way to identifying the cause. If so, this is one of those instances where knowing less can be beneficial, especially when dealing with counter-intuitive behaviour.

tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

Re: SC16IS752 multiple SPI devices

Wed May 20, 2020 11:29 pm

this is one of those instances where knowing less can be beneficial
:lol:

Well I tried the overlay and it does not work. It only shows two ports. I was wondering what the minimal change would be, so thank you for making that test overlay.

Hmm. So what makes my working overlay work?

tlalexander
Posts: 6
Joined: Thu Jul 11, 2013 2:13 am

Re: SC16IS752 multiple SPI devices

Wed May 20, 2020 11:51 pm

This file, modified from your above test file works:

Code: Select all

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2835";

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi1_pins: spi1_pins {
				brcm,pins = <19 20 21>;
				brcm,function = <3>; /* alt4 */
			};

			spi1_cs_pins: spi1_cs_pins {
				brcm,pins = <18 12>;
				brcm,function = <1>; /* output */
			};
		};
	};

	[email protected] {
		target = <&spi1>;
		frag1: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-names = "default";
			pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
			cs-gpios = <&gpio 18 1>, <&gpio 12 1>;
			status = "okay";

			sc16is752_1: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <0>; /* CE0 */
				clocks = <&sc16is752_clk_1>;
				interrupt-parent = <&gpio>;
				interrupts = <26 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_1: sc16is752_clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};
			};

			sc16is752_2: [email protected] {
				compatible = "nxp,sc16is752";
				reg = <1>; /* CE1 */
				clocks = <&sc16is752_clk_2>;
				interrupt-parent = <&gpio>;
				interrupts = <27 2>; /* IRQ_TYPE_EDGE_FALLING */
				#gpio-controller;
				#gpio-cells = <2>;
				spi-max-frequency = <4000000>;

				sc16is752_clk_2: foobar {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <14745600>;
				};

			};
		};
	};


	[email protected] {
		target = <&aux>;
		__overlay__ {
			status = "okay";
		};
	};

};
The line:
sc16is752_clk_2: sc16is752_clk {
from your test file has been changed to:
sc16is752_clk_2: foobar {
(I also reverted your "762" test line back to "752")

So i guess the name doesn't matter, that just has to be different. I should say that I don't understand this file format really, so this may have been obvious.

I would like to continue any help with debugging. Perhaps once we distill a minimal dts file or find a bug I can help with a pull request.

Thanks again!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2808
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SC16IS752 multiple SPI devices

Thu May 21, 2020 8:13 am

Interesting - this is ringing a bell, now. I think what's happening is that the Linux clock subsystem wants to give clocks names, and in the absence of any other information it uses the DT node name (without the path). Although the DT nodes don't clash because they have different parents, the resulting clocks do, so by renaming the clock node you've avoided the clash.

As an aside, nesting a "fixed-clock" node inside another normal, "non-bus" node like this only works when the overlay is applied by the firmware. If you wanted this overlay to work when loaded at run-time using the dtoverlay command then the clock would have to appear in the root (target-path = "/";) or under /soc (target-path = "/soc"), etc.

bearer
Posts: 21
Joined: Thu Jun 13, 2019 9:05 pm

Re: SC16IS752 multiple SPI devices

Thu Jun 04, 2020 7:59 am

tlalexander wrote:
Wed May 20, 2020 11:51 pm
This file, modified from your above test file works:
I just tested this, translated to spi0 (and using ID EEPROM), it allows me to use two sc16is752s providing 4 uarts.

awesome work guys!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2808
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: SC16IS752 multiple SPI devices

Thu Jun 04, 2020 8:04 am

That's great. The name clash is annoying, because we don't care what the clock is called - it could be something completely random or anonymous and the system would still work since the clock is located using the Device Tree label reference (phandle).

Return to “Device Tree”