Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: IBM405GP/GPr OPB bus_space endian (powerpc/ibm4xx/dev/opb.c)



Shigeyuki Fukushima wrote:

> Last week, a GPIO framework was imported from OpenBSD.
> This is conflicted with IBM405GP/GPr OPB GPIO device name, "gpio".
> I have fixed the above breakage.
> I send a patch for this modification (with using GPIO fremework).

Your LEDs work fine with the new GPIO framework?  If so, that's good!

However, I don't like the _ in the name of the gpio_opb device.  We
don't have any other devices on any platform that has an underscore in
it's name.  Maybe "opbgpio" instead?  It's reasonably normal to use
"bus-type device-type" as a naming convention rather than the other way
around.

I wonder if it is possible to just attach the MI gpio directly to the
opb with something like:

        gpio* at opb? addr ? irq ?

and

        device  gpio: gpiobus
        attach  gpio at opb with gpio_plb
        file    arch/powerpc/ibm4xx/dev/gpio_opb.c      gpio

and drop the intermediate gpio_opb/opbgpio/whatever device?

Also, in evbppc/conf/files.obs405 we don't need to comment out the old
obsled entries - just delete them.  We can easily get the old entries
back from cvs.  Same for the obs266_led_set() call in obs266_machdep.c.

> The bellow is the subject.
> In the current source (sys/arch/powerpc/ibm4xx/dev/opb),
> byte-ordering for opb(On-chip Peripheral Bus) bus_space is defined by
> Little-Endian (as the following).
> 
>  static struct powerpc_bus_space opb_tag = {
>       _BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
>       0x0, IBM405GP_UART0_BASE, 0x1000
>  };
> 
> Why it is Little-Endian in spite of CPU byte-order (Big-Endian) ?
> Is there any special reason?

After a little look, I'm not really sure!  If you look at
powerpc/powerpc/bus_space.c, you'll see that both the little- and
big-endian setup in bus_space_init() are exactly the same.  You'd
certainly think for most devices on a PPC cpu would be big-endian :-)

> In the gpio (on opb) driver,
> I want to handle some 32-bit registers easily.
> If there is no reason, I want to change bus_space byte-order
> from Little to Big.
> Is it ok?

As I said above, because the setup code is identical, so it
shouldn't actually make a difference.  We should audit the calls of
bus_space_init() and fix bus_space_init() itself.

Cheers,
Simon.
--
Simon Burge                            <simonb%wasabisystems.com@localhost>
NetBSD Support and Service:         http://www.wasabisystems.com/



Home | Main Index | Thread Index | Old Index