public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: "Mark A. Greer" <mgreer@mvista•com>
Cc: linuxppc-dev@ozlabs•org, Paul Mackerras <paulus@samba•org>
Subject: Re: [PATCH 9/13] powerpc: Add arch/powerpc mv64x60 I2C platform data setup
Date: Thu, 26 Apr 2007 04:02:16 +0200	[thread overview]
Message-ID: <200704260402.17248.arnd@arndb.de> (raw)
In-Reply-To: <20070426011328.GR4046@mag.az.mvista.com>

On Thursday 26 April 2007, Mark A. Greer wrote:
> > location is the smaller part of the problem. Even if it was the right
> > thing to scan the tree and then create platform_data instead of using
> > the of_device, that code would still belong into the device driver.
> 
> I don't think of_device is going to work very well on MIPS.

Ok, I see your point there. But after looking at the i2c and net drivers,
I believe that they can easily be split into an architecture dependent
part that is either an of_platform_driver or a platform_driver, and
a common part that does not know about either of these.

With the example of the i2c driver, you can have something like:

i2c-mv64xxx.c:
=============
int __devinit mv64xxx_i2c_probe(struct device *dev, struct mv64xxx_i2c_pdata *data,
		struct resource *regs, int irq)
{
	...
}
EXPORT_SYMBOL_GPL(mv64xxx_i2c_probe);

int __devexit mv64xxx_i2c_remove(struct device *dev)
{
	...
}
EXPORT_SYMBOL_GPL(mv64xxx_i2c_remove);

i2c-mv64xxx-pdev.c:
========================
static int __devinit mv64xxx_i2c_probe_pdev(struct platform_device *pd)
{
	return mv64xxx_i2c_probe(&pd->dev, &pd->dev.platform_data, 
			platform_get_resource(pd, IORESOURCE_MEM, 0)),
			platform_get_irq(pd, 0));
}
static int __devexit mv64xxx_i2c_remove_pdev(struct platform_device *pd)
{
	return mv64xxx_i2c_remove(&pd->dev);
}
static struct platform_driver mv64xxx_i2c_driver = {
	.probe	= mv64xxx_i2c_probe_pdev,
	.remove	= mv64xxx_i2c_remove_pdev,
	.driver	= {
		.owner	= THIS_MODULE,
		.name	= MV64XXX_I2C_CTLR_NAME,
	},
};
static int __init
mv64xxx_i2c_init_pdev(void)
{
	return platform_driver_register(&mv64xxx_i2c_driver);
}
static void __exit
mv64xxx_i2c_exit_pdev(void)
{
	platform_driver_unregister(&mv64xxx_i2c_driver);
}
module_init(mv64xxx_i2c_init_pdev);
module_exit(mv64xxx_i2c_exit_pdev);

i2c-mv64xxx-of.c:
========================
static int __devinit mv64xxx_i2c_probe_of(struct of_device *dev)
{
	struct mv64xxx_i2c_pdata pdata;
	struct resource resource;
	int irq;

	of_address_to_resource(&dev->node, 0, &resource);
	of_map_irq(&dev->node, 0, &irq);
	return mv64xxx_i2c_probe(&dev->dev, &pdata, &resource, irq);
}
static int __devexit mv64xxx_i2c_remove_pdev(struct of_device *dev)
{
	return mv64xxx_i2c_remove(&dev->dev);
}
static struct of_device_id mv64xxx_i2c_device_ids = {
	{ .type = "i2c", .compatible = "mv64x60-i2c" },
	{ },
};
static struct of_platform_driver mv64xxx_i2c_of_driver = {
	.probe	= mv64xxx_i2c_probe_of,
	.remove	= mv64xxx_i2c_remove_of,
	.ids = &mv64xxx_i2c_device_ids,
	.driver	= {
		.owner	= THIS_MODULE,
		.name	= MV64XXX_I2C_CTLR_NAME,
	},
};
static int __init
mv64xxx_i2c_init_of(void)
{
	return of_platform_driver_register(&mv64xxx_i2c_of_driver);
}
static void __exit
mv64xxx_i2c_exit_of(void)
{
	of_platform_driver_unregister(&mv64xxx_i2c_driver);
}
module_init(mv64xxx_i2c_init_of);
module_exit(mv64xxx_i2c_exit_of);

  reply	other threads:[~2007-04-26  2:02 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 23:46 [PATCH 0/13] powerpc: Add support for Marvell/mv64x60 and prpmc2800 Mark A. Greer
2007-04-25 23:55 ` [PATCH 1/13] powerpc: Add Makefile rule to wrap dts file in zImage Mark A. Greer
2007-04-30  6:06   ` David Gibson
2007-04-25 23:55 ` [PATCH 2/13] powerpc: Add dt_xlate_addr() to bootwrapper Mark A. Greer
2007-04-26 16:44   ` Scott Wood
2007-04-27  5:55   ` Paul Mackerras
2007-04-27 20:48     ` Mark A. Greer
2007-04-25 23:56 ` [PATCH 3/13] powerpc: Add bootwrapper support for Marvell/mv64x60 hostbridge Mark A. Greer
2007-04-27  6:01   ` Paul Mackerras
2007-04-27 22:02     ` Mark A. Greer
2007-05-03  5:25       ` Paul Mackerras
2007-05-03 18:44         ` Mark A. Greer
2007-05-03 19:00           ` Mark A. Greer
2007-05-05 23:27           ` Paul Mackerras
2007-05-07 18:15             ` Mark A. Greer
2007-04-25 23:57 ` [PATCH 4/13] powerpc: Add bootwrapper support for Marvell MPSC Mark A. Greer
2007-04-25 23:57 ` [PATCH 5/13] powerpc: Add bootwrapper support for Marvell/mv64x60 I2C Mark A. Greer
2007-04-25 23:58 ` [PATCH 6/13] powerpc: Add arch/powerpc support for Marvell/mv64x60 hostbridge Mark A. Greer
2007-04-26  0:42   ` Arnd Bergmann
2007-04-26  5:49     ` Dale Farnsworth
2007-05-02 21:38   ` [PATCH 6/13] powerpc: Add arch/powerpc interrupt handler for mv64x60 Dale Farnsworth
2007-05-03  1:47     ` Stephen Rothwell
2007-05-03  2:55       ` Dale Farnsworth
2007-04-25 23:59 ` [PATCH 7/13] powerpc: Add arch/powerpc mv64x60 MPSC platform data setup Mark A. Greer
2007-04-26  0:14   ` Arnd Bergmann
2007-04-26  5:57     ` Dale Farnsworth
2007-04-26 11:24       ` Arnd Bergmann
2007-04-26 14:30         ` Dale Farnsworth
2007-04-26 15:14           ` Arnd Bergmann
2007-05-02 21:41   ` Dale Farnsworth
2007-05-03  6:40     ` Arnd Bergmann
2007-05-04 21:03     ` [PATCH 7/13] powerpc: Create Marvell mv64x60 MPSC (serial) platform_data Dale Farnsworth
2007-05-05 12:26       ` Arnd Bergmann
2007-04-26  0:00 ` [PATCH 8/13] powerpc: Add arch/powerpc mv64x60_eth platform data setup Mark A. Greer
2007-04-26  0:18   ` Arnd Bergmann
2007-04-26  6:00     ` Dale Farnsworth
2007-05-02 21:43   ` Dale Farnsworth
2007-05-03  2:03     ` Stephen Rothwell
2007-05-03  6:43     ` Arnd Bergmann
2007-05-04 21:06     ` [PATCH 8/13] powerpc: Create Marvell mv64x60 ethernet platform_data Dale Farnsworth
2007-05-05 12:28       ` Arnd Bergmann
2007-04-26  0:00 ` [PATCH 9/13] powerpc: Add arch/powerpc mv64x60 I2C platform data setup Mark A. Greer
2007-04-26  0:21   ` Arnd Bergmann
2007-04-26  0:43     ` Mark A. Greer
2007-04-26  0:55       ` Arnd Bergmann
2007-04-26  1:13         ` Mark A. Greer
2007-04-26  2:02           ` Arnd Bergmann [this message]
2007-04-26  6:08             ` Dale Farnsworth
2007-04-26  9:00               ` Arnd Bergmann
2007-04-26 14:19                 ` Dale Farnsworth
2007-04-26 15:04                   ` Arnd Bergmann
2007-04-27 23:50                     ` Dale Farnsworth
2007-04-28  1:05                       ` Arnd Bergmann
2007-04-28  2:40                         ` Dale Farnsworth
2007-05-01  4:58                         ` Paul Mackerras
2007-05-01  4:45                     ` Paul Mackerras
2007-04-26  6:48             ` Mark A. Greer
2007-05-02 21:44   ` Dale Farnsworth
2007-05-03  6:53     ` Arnd Bergmann
2007-05-03 13:06       ` 
2007-05-04 21:08     ` [PATCH 9/13] powerpc: Create Marvell mv64x60 I2C platform_data Dale Farnsworth
2007-05-05 12:29       ` Arnd Bergmann
2007-04-26  0:01 ` [PATCH 10/13] powerpc: Add arch/powerpc mv64x60 PCI setup Mark A. Greer
2007-04-26  0:25   ` Arnd Bergmann
2007-04-26  6:33     ` Dale Farnsworth
2007-04-26 11:39       ` Arnd Bergmann
2007-04-26 14:42         ` Dale Farnsworth
2007-05-02 21:46   ` Dale Farnsworth
2007-05-03  2:13     ` Stephen Rothwell
2007-05-03  2:57       ` Dale Farnsworth
2007-05-03  7:17     ` Arnd Bergmann
2007-05-03 13:45       ` Dale Farnsworth
2007-05-04 21:10     ` [PATCH 10/13] powerpc: Add Marvell mv64x60 PCI bridge support Dale Farnsworth
2007-05-05 12:30       ` Arnd Bergmann
2007-04-26  0:01 ` [PATCH 11/13] powerpc: Add DTS file for the Motorola PrPMC2800 platform Mark A. Greer
2007-04-26 16:42   ` Scott Wood
2007-04-26 23:34     ` Mark A. Greer
2007-04-26 23:37     ` David Gibson
2007-04-27 20:41   ` Mark A. Greer
2007-04-30 16:45     ` Jon Loeliger
2007-04-30 18:08       ` Mark A. Greer
2007-04-30 22:29       ` Mark A. Greer
2007-04-26  0:02 ` [PATCH 12/13] powerpc: Add bootwrapper support for " Mark A. Greer
2007-04-26  0:02 ` [PATCH 13/13] powerpc: Add arch/powerpc support for the " Mark A. Greer
2007-04-26  0:45 ` [PATCH 0/13] powerpc: Add support for Marvell/mv64x60 and prpmc2800 David Gibson
2007-04-26  0:58   ` Mark A. Greer
2007-04-26  1:15     ` 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=200704260402.17248.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=mgreer@mvista$(echo .)com \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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