From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Thu, 19 Apr 2007 13:29:37 -0400 Subject: [U-Boot-Users] fdt_chosen() In-Reply-To: <46279D4F.1080603@freescale.com> References: <46279D4F.1080603@freescale.com> Message-ID: <4627A701.3030506@smiths-aerospace.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Timur Tabi wrote: > Jerry, > > I noticed that fdt_chosen() is called with force=0. Does that mean that > if the DTB has a chosen node in it already, that it won't be > overwritten? If so, I think that's wrong, because some DTBs have a > bogus chosen section in them that has, in the past, always been > overwritten by U-Boot. If the chosen node already exists, then it means > that it was present in the DTS when it was compiled, and that means the > DTS is probably old and the chosen node has bad data in it. Hi Timur, In the "old" code, if the dts had a "chosen" node bootm created _a second_ "chosen" node which is just wrong. I originally removed the auto-generation of the "chosen" node which forced the user to use the "fdt chosen" command (manually or as a boot script) to create the node if he really wanted it (and it would add missing properties and overwrite existing properties the "chosen" node, rather than creating a bogus node). Forcing the user to create the "chosen" node (either manually/scripted or through the dts) was deemed undesirable. In the discussion that ensued, at least as I understood it, the compromise was to create the node if it did not exist and not touch it if it did exist. The reason I chose to /not/ create/overwrite "chosen" properties as part of the bootm command is that would potentially overwrite changes that the user made before running bootm. Scenario: fdt addr
fdt chosen # create the default chosen node and properties fdt set /chosen bootm # ...would be BAD if were rewritten I'm open to tuning the behavior, but I don't like automagic and I *hate* automagic which it undoes something I just got done doing. Best regards, gvb