From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 22 Aug 2011 22:10:23 +0200 Subject: [U-Boot] [RFC] New init sequence processing without init_sequence array In-Reply-To: <1313587343-3693-1-git-send-email-graeme.russ@gmail.com> References: <1313587343-3693-1-git-send-email-graeme.russ@gmail.com> Message-ID: <20110822201023.0F8A111EF9D9@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Graeme Russ, In message <1313587343-3693-1-git-send-email-graeme.russ@gmail.com> you wrote: > I have been thinking about the problem of the pesky init_sequence arrays > and the inevitable #ifdefs and empty stub functions that result so I > thought I'de have a crack at a more dynamic implementation. And like all > good programmers, I stole the solution ;). This implementation is based > on Linux's __initcall(fn) et. al. macros > > If this works cross-platform, we can finally move board_init_* into > /lib/ - Wouldn't that be nice > > Thoughts? My initial thoughts are these two: 1. I think we should change the code in a different order. I would prefer to first unify the init code across architectures (the big ARM reorganization we just seem to have overcome was an important prerequisite for this), before we start changing the init code. 2. One of the advantages of the current implementation is that there is a central place in the code (well, at least per architecture, untill we unify these as mentioned above) where you can see exactly which steps get performed in which sequence. I understand (and appreciate) your intentions, does the initcall concept not mean that we will have some sort of sequence numbers distributed all over the code? Maybe I'm mising something - but does this not make it really difficult to actually see (from the source code) what the exact init sequence is? 3. Hardware initialization in inherently very much hardware depen- dent ;-) We have some boards where PCI must be initialized early because it is needed to access some other peripherals like memory. And we have other boards where PCI can only be initialized late because it depends on a lot of other functions that must be working first. I explained this a number of times before: the current code was designed to allow even for completely board specific init sequences, by simply adding #define for the list of init functions to the board config file - see for example here: http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/33951/focus=36436 http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/72131/focus=72136 If you look at the current code - heavily larded with #ifdefs of all shapes and colors - I cannot see any good way to transform this into an initcall (and thus sequence number based) implementation. Do you have any specific ideas how to address this? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Landing: a controlled mid-air collision with a planet.