Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475AbdFFHU0 (ORCPT ); Tue, 6 Jun 2017 03:20:26 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:32786 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbdFFHUX (ORCPT ); Tue, 6 Jun 2017 03:20:23 -0400 Subject: Re: [PATCH] external references for device tree overlays To: Stefani Seibold , Stefani Seibold , Pantelis Antoniou , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <1496667567-13266-1-git-send-email-stefani.seibold.ext@huawei.com> Cc: Holm Rauchfuss From: Frank Rowand Message-ID: <593657AF.8050208@gmail.com> Date: Tue, 6 Jun 2017 00:20:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1496667567-13266-1-git-send-email-stefani.seibold.ext@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2259 Lines: 69 On 06/05/17 05:59, Stefani Seibold wrote: > From: Stefani Seibold > > This patch enables external references for symbols which are not > exported by the current device tree. For example > > // RASPI example (only for testing) > /dts-v1/; > /plugin/; > > / { > compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; > > fragment@0 { > target-path = "/soc/i2s@7e203000"; > __overlay__ { > #address-cells = <0x00000001>; > #size-cells = <0x00000001>; > test = "test"; > timer = <&timer>; > }; > }; > > __external_symbols__ { > timer = "/soc/timer@7e003000"; > }; > }; My hope is that the dtc compiler will stop supporting specification of the __symbols__ node in dts source, and only generate it automatically in the dtb. That change to dtc would not allow any node name specified in a dts to begin with an underscore. Thus node __external_symbols__ would not be allowed. > > The "timer" symbol is not exported by the RASPI device tree, because it is > missing in the __symbols__ section of the device tree. > > In case of the RASPI device tree this could be simple fixed by modifing > the device tree source, but when the device tree is provided by a closed > source BIOS this kind of missing symbol could not be fixed. Is there a real example of this issue, or is this a theoretical concern? If this is a real example, we should be discouraging such behavior. The suggestion by Pantelis should work, but that is just a hack to get you out of a bad situation, not a good practice. > > An additional benefit is to override a (possible broken) symbol exported > by the currect live device tree. > > The patch is based and tested on linux 4.12-rc3. > > Signed-off-by: Stefani Seibold > Signed-off-by: Stefani Seibold > --- > drivers/of/overlay.c | 19 +++++++++++++++++++ > drivers/of/resolver.c | 27 ++++++++++++++++++++++----- > 2 files changed, 41 insertions(+), 5 deletions(-) > > diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c > index 7827786718d8..de6516ea0fcd 100644 > --- a/drivers/of/overlay.c > +++ b/drivers/of/overlay.c < snip > -Frank