linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Surovegin <ebs@ebshome.net>
To: Kumar Gala <galak@somerset.sps.mot.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: RFC: [PATCH] platform device driver model support
Date: Wed, 12 Jan 2005 00:36:37 -0800	[thread overview]
Message-ID: <20050112083637.GA13794@gate.ebshome.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0501120133080.21665@blarg.somerset.sps.mot.com>

On Wed, Jan 12, 2005 at 01:43:09AM -0600, Kumar Gala wrote:
> 
> Please take a look at the following patch.  It adds driver model support 
> via platform devices to 85xx.  This is originally based on patches from 
> Jason M. 
> 
> The idea behind the code is that for a give family: 4xx, 8xx, 82xx, 83xx, 
> 85xx, 86xx we will have structure defns for the following:
> 
> enum ppc_soc_devices 
> in asm-ppc/<family.h>:
>   list of all unique devices in the family
> 
> struct platform_device soc_platform_devices[]
> in arch/ppc/platforms/<family>/<family>_devices.c:
>   describes all platform devices that exist in the family
> 
> struct soc_spec soc_specs[]
> in arch/ppc/platforms/<family>/<family>_soc.c:
>   describes each unique chip in the family and what devices it has

Well, there is a problem right here at least for 4xx. 
Current OCP implementation is much more flexible IMHO.

For 4xx is not uncommon when you have the same "logical" device at the 
different places with different "properties" (e.h. different channel, 
etc).

Your case (85xx) looks simpler - all you need is a list of devices 
which particular SoC supports, without significant differences in 
"properties". This will not work that easy for 4xx.

In fact, I don't see any gain (at least for 4xx) in all these changes. 
It makes 4xx much more tangled IMHO, because we'll still need all 
those ibm405gp.c, ibm405ep.c, ibm440gp.c etc.

Please note, using platform_device is orthogonal to the way we 
describe each SoC (this is what I don't quite like in your patch), and 
I don't have any strong objections to using platform_device instead of 
OCP or feature_call or whatever for communication with device drivers.

> Plus the following functions:
> 
> identify_soc_by_id() -- determine soc by an int id
> identify_soc_by_name() -- determin soc by name (useful in some 82xx cases)
> ppc_soc_get_pdata() -- get platform_data pointer so board code can modify
> ppc_soc_update_paddr() -- update iomem resources with a given paddr

IMHO, ppc_soc_update_paddr - is a very confusing name, in fact, from 
first read I though it _changes_ paddr to the new value, not _adds_ it 
:)

Probably this function should be made 85xx specific as I cannot come 
up with any use for it in 4xx (we don't have anything similar to 
CCSRBAR ;).


[snip]

> +
> +struct platform_device soc_platform_devices[] = {
> +	[MPC85xx_TSEC1] = {
> +		.name = "fsl-gianfar",
> +		.id	= 1,
> +		.dev.platform_data = &mpc85xx_tsec1_pdata,
> +		.num_resources	 = 4,
> +		.resource = (struct resource[]) {
> +			{
> +				.start	= MPC85xx_ENET1_OFFSET,
> +				.end	= MPC85xx_ENET1_OFFSET +
> +						MPC85xx_ENET1_SIZE - 1,
> +				.flags	= IORESOURCE_MEM,
> +			},
> +			{
> +				.name	= "tx",
> +				.start	= MPC85xx_IRQ_TSEC1_TX,
> +				.end	= MPC85xx_IRQ_TSEC1_TX,
> +				.flags	= IORESOURCE_IRQ,
> +			},
> +			{
> +				.name	= "rx",
> +				.start	= MPC85xx_IRQ_TSEC1_RX,
> +				.end	= MPC85xx_IRQ_TSEC1_RX,
> +				.flags	= IORESOURCE_IRQ,
> +			},
> +			{
> +				.name	= "error",
> +				.start	= MPC85xx_IRQ_TSEC1_ERROR,
> +				.end	= MPC85xx_IRQ_TSEC1_ERROR,
> +				.flags	= IORESOURCE_IRQ,
> +			},
[snip]


I already wrote about this but repeat again :(. 

Why put all these defines (e.g. for memory regions) into header when 
the only user is this particular file. It doesn't help readability and 
only obfuscates sources (and 4xx is a very good example of such mess 
:)


--
Eugene

  reply	other threads:[~2005-01-12  8:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12  7:43 RFC: [PATCH] platform device driver model support Kumar Gala
2005-01-12  8:36 ` Eugene Surovegin [this message]
2005-01-12 14:41   ` Kumar Gala
2005-01-12 21:14   ` Matt Porter
2005-01-12 21:28     ` Matt Porter
2005-01-14 19:13     ` Andrew May
2005-01-14 19:14       ` Kumar Gala
2005-01-12 23:30 ` Mark A. Greer
2005-01-13  4:19   ` Kumar Gala
2005-01-13 17:34     ` Mark A. Greer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050112083637.GA13794@gate.ebshome.net \
    --to=ebs@ebshome.net \
    --cc=galak@somerset.sps.mot.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).