Subject: Re: Platform bus/ppc sys model...

From: Sylvain Munaut <[email-masked]>
Date: Wed, 30 Mar 2005 11:54:17 +0200

Hi,

> Is there some good documentation about how to use the platform bus / ppc
> sys model or is it only possible to read and try to understand the code
> for the freescale devices?

I'm not aware on documentation for the ppc_sys model in particular but
the code is pretty easy to understand/read.

Basically you have a ???_devices.c that describe all the devices you can
find in a family of devices (by family I mean basically the same 
processors but with slightly different options/peripheral), then a 
???_sys.c that describe each particular variant with the devices that 
are really implemented in that variant). Then somewhere in platform init 
code, you need to identify the ppc system  you're runngin on ( by a 
identify_ppc_sys_by_id(mfspr(SPRN_SVR)); for e.g. ).

Kumar, if I got it wrong, please correct ;)

> Specifically, how do you make the kernel aware of a certain device and
> what else is required? Do I have to "connect" the device and the driver
> or will the new model find this out automagically? I'm looking at adding 
> the usual serials, emacs etc...

It's "automatic" by using matching of strings. The driver name has to be
the same as the device name. More specifically by matching the name 
field in struct platform_device with the name field in struct 
device_driver. The code for this magic is in drivers/base/platform.c

> Lastly, I suppose this will be the way all platforms should connect
> their boards with the devices "from now on", right?

It seems to be the trend yes.
The OCP and platform bus model have the same base idea/concept. The 
advantage of platform bus is that it's common in multiple arch, the rest 
  is mainly style. The ppc sys model is based on platform bus to ease 
working with SoC variants.

	Sylvain.