[U-Boot] Multiple device support -- sorry state :(

Robert Schwebel r.schwebel at pengutronix.de
Wed Apr 8 22:02:12 CEST 2009


Hi Jerry,

On Wed, Apr 08, 2009 at 03:19:19PM -0400, Jerry Van Baren wrote:
> ksi at koi8.net wrote:
> > OK, this is _NOT_ just multiple I2C adapters... The entire thing is
> > fundamentally broken.
> >
> > One supposed to have _THE_ device and only this device is somehow supported.
> >
> > Now it is USB. Each and every USB driver exports the same set of functions,
> > submit_XXX_msg(...) That means there can be one and only one USB device in
> > the system.
>
> [snip the badly scorched spot ;-)]
>
> > USB keyboard is another grand kludge deserving its own chapter... As of now
> > one can only switch to it from command line because USB is not even
> > initialized until do_usb() from cmd_usb.c is called... What if we do NOT
> > have a serial console at all?
>
> Dumb question because I have not looked seriously at the v2 fork of
> u-boot: how does the v2 fork handle this? Better? Since the v2 fork
> uses (or is close to) the linux driver model, I would expect it to be
> better.

Right, we use something close to the driver model, so no problem with
that in v2 land. Other than linux, we have per-device parameters.

Example, with a freshly checked out tree:

  rsc at thebe:u-boot-v2$ make sandbox_defconfig
  rsc at thebe:u-boot-v2$ make
  rsc at thebe:u-boot-v2$ ./scripts/ubootenv -s -p 0x10000 examples/environment/ env.bin

That gets you an u-boot-v2 (user mode u-boot) plus the example
environment.

Let's start it:

  rsc at thebe:u-boot-v2-denx$ ./uboot -e env.bin
  add file env.bin()


  U-Boot 2.0.0-rc8-00084-g97568fd (Apr  8 2009 - 21:54:30)

  Board: sandbox
  Malloc space: 0xb761f008 -> 0xb7e1f008 (size  8 MB)
  Open /dev/env0 Function not implemented
  running /env/bin/init...
  not found
  uboot:/

Let's check which devices we have:

  uboot:/ devinfo
  devices:
  |----env0
  |----console0
  |----mem
  |----eth0
  |----filesystem: /
  |----filesystem: /dev

  drivers:
     console
   cfi_flash
         mem
         ram
         rom
      cramfs
       ramfs
       devfs
    hostfile

Let's check what parameters are there:

  uboot:/ devinfo /dev/console0
  base  : 0x00000000
  size  : 0x00000000
  driver: console

  no info available for console0
  Parameters:
            active = ioe

So you can have as many devices as you want, plus each device has parameters
attached to it, so it's completely object oriented, without any global variable
crap.

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


More information about the U-Boot mailing list