From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mitch Bradley Subject: "Early" devices and the DT Date: Sun, 26 Jun 2011 15:22:39 -0400 Message-ID: <4E0786FF.9010002@firmworks.com> References: <1308924659-31894-1-git-send-email-marc.zyngier@arm.com> <1308924659-31894-3-git-send-email-marc.zyngier@arm.com> <20110625204742.GB15026@ponder.secretlab.ca> <4E06513B.4030706@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Grant Likely Cc: Russell King - ARM Linux , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: devicetree@vger.kernel.org Some solutions to the early device problem a) Most complex: Use new properties to create a dependency graph. This is probably the most general solution, but also probably the hardest for people to think about and maintain. b) Define a set of init phases 0,1,2,... and mark each early device node with a phase number property. Scan the tree for each phase and handle only the devices with that phase number. Unmarked nodes are handled last. c) Similar to b, but instead of properties in nodes, have properties like "linux-phase0", "linux-phase1", etc in /chosen, whose values are lists of phandles. Admittedly, this is to some extent Linux-specific, but there is a fair chance that it would be useful to other OSs, as most OSs have similar ordering requirements for certain core devices. I know that Windows works this way - the Windows kernel startup code scans the NT device tree multiple times, picking off different devices in different phases. Some devices might appear in multiple phases. For example, you might want to init a serial device in phase 0, in a simplified mode that doesn't depend on interrupts, then do the interrupt controller in phase 1, then do the timer in phase 2 and also reinit the serial port to use interrupts in phase 2.