Re: [PATCH v2 1/2] overlays: auto allocate phandles for nodes in base fdt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 01/04/18 12:15, Kyle Evans wrote:
> On Thu, Jan 4, 2018 at 2:11 PM, Frank Rowand <frowand.list@xxxxxxxxx> wrote:
>> On 12/31/17 22:59, kevans@xxxxxxxxxxx wrote:
>>> Currently, references cannot be made to nodes in the base that do not already
>>> have phandles, limiting us to nodes that have been referenced in the base fdt.
>>> Lift that restriction by allocating them on an as-needed basis.
>>
>> I am very confused.  If I understand correctly, the problem is:
>>
>>   A base devicetree contains a __symbols__ node, where one of the properties
>>   in that node has a value which is a path to a node, where that node does
>>   not have a phandle property.
>>
>> Is that correct?
> 
> This is correct. Currently, the overlay support resolves the path to
> the node just fine, but then dies when it doesn't have a phandle. This
> changes it to allocate that phandle so that it and any further
> overlays can properly reference that node.
> 

Then it appears that the base devicetree was not compiled with the
proper options.  Using the .dts from patch 2/2, I can cause the problem
with:

$ 
dtc -O dts overlay_base_manual_symbols_auto_phandle.dts 
/dts-v1/;

/ {

	test: test-node {
		test-int-property = <0x2a>;
		test-str-property = "foo";

		subtest: sub-test-node {
			sub-test-property;
		};
	};

	__symbols__ {
		test = "/test-node";
	};
};


But if I add the "-@" option, the phandle exists:

$ dtc -@ -O dts overlay_base_manual_symbols_auto_phandle.dts 
WARNING: label test already exists in /__symbols__/dts-v1/;

/ {

	test: test-node {
		test-int-property = <0x2a>;
		test-str-property = "foo";
		phandle = <0x1>;

		subtest: sub-test-node {
			sub-test-property;
			phandle = <0x2>;
		};
	};

	__symbols__ {
		test = "/test-node";
		subtest = "/test-node/sub-test-node";
	};
};


To go even further, there is no need to hand code a __symbols__
node with the current dtc:

$ cat overlay_base_manual_symbols_auto_phandle--no__symbols__.dts 
/*
 * Copyright (c) 2016 NextThing Co
 * Copyright (c) 2016 Free Electrons
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

/dts-v1/;

/ {
	test: test-node {
		test-int-property = <42>;
		test-str-property = "foo";

		subtest: sub-test-node {
			sub-test-property;
		};
	};
};

$ dtc -@ -O dts overlay_base_manual_symbols_auto_phandle--no__symbols__.dts 
/dts-v1/;

/ {

	test: test-node {
		test-int-property = <0x2a>;
		test-str-property = "foo";
		phandle = <0x1>;

		subtest: sub-test-node {
			sub-test-property;
			phandle = <0x2>;
		};
	};

	__symbols__ {
		test = "/test-node";
		subtest = "/test-node/sub-test-node";
	};
};


Does this remove the need for the proposed patch, or am I still
missing something?

-Frank
--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux