[U-Boot] [RFC][PATCH 3/3] Add board support for the eXMeritusHWW-1U-1A devices

Peter Tyser ptyser at xes-inc.com
Wed Sep 8 05:43:06 CEST 2010


On Tue, 2010-09-07 at 17:50 -0500, Moffett, Kyle D wrote:
> On Sep 07, 2010, at 18:09, Peter Tyser wrote:
> >>> The GPIO functions above aren't hww1u1a specific.  What about adding
> >>> generic 85xx GPIO functions so others can use them too?
> >> 
> >> I can do that.  Do you have any particular place you recommend I put them?
> > 
> > The 2 places that jump to mind are drivers/gpio, or
> > arch/powerpc/cpu/mpc8xxx.  My personal preference would be drivers/gpio.
> 
> Hmm, given that they all seem to inline smaller than a function call would be, I've put them as "static inline" functions in:
>   arch/powerpc/include/asm/mpc85xx_gpio.h
> 
> Is that OK?

I'd recommend throwing it in a C file and using the "standard" gpiolib
function names.  That way others can easily use it to tie into U-Boot's
LED, NAND, I2C, etc drivers.  Eg I'd use it for LEDs immediately on a
number of my company's boards if it existed.
board/altera/nios2-generic/gpio.c is a simple example,
arch/blackfin/cpu/gpio.c is a bit more complicated but featureful.

> >>> Is the above check the same as the hww1u1a_is_cpu_a() function
> >>> previously added?
> >> 
> >> Oops, yes it is, will fix.  That reminds me of one other question,
> >> though.  Several variables are different between the CPU A and the CPU
> >> B on the board but maintaining 2 nearly-identical device trees is kind
> >> of a pain.  Is there any good way to manage that?  Should I try to
> >> poke the device tree file during boot, or is there some kind of macro
> >> language I can use in the dts file? (EG: "#ifdef CPU_A", etc)
> > 
> > There isn't a macro language in the dts file that you can use.  Its hard
> > to say if you should tweak the dtb in U-Boot.  People's opinions vary:
> > http://www.mail-archive.com/u-boot@lists.denx.de/msg36029.html
> > 
> > I'd give modifying the dtb in U-Boot a try, and people will let you know
> > if its outside of the scope of U-Boot's responsibility.
> 
> Hmm, seems like a lot of extra work to try fiddling with the DTB for very little gain.

If done right its not much to tweak the dtb in code for what its worth.

> I think at this point I'll just implement an "is_cpu_a" command and use it from a hush script something like this:
> 
>   if is_cpu_a; then
>     bootm ${flkernel} ${flinitramfs} ${fldevicetree_cpua}
>   else
>     bootm ${flkernel} ${flinitramfs} ${fldevicetree_cpub}
>   fi
> 
> Does that seem OK?

Sounds good to me.  You could always try adding dtb tweaking to U-Boot
at a later date if you got sick of maintaining 2 device trees.

Best.
Peter



More information about the U-Boot mailing list