linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] OF-platform PATA driver
@ 2007-12-14 18:21 Anton Vorontsov
  2007-12-14 18:24 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Anton Vorontsov @ 2007-12-14 18:21 UTC (permalink / raw)
  To: linuxppc-dev, linux-ide
  Cc: Jeff Garzik, Arnd Bergmann, Paul Mundt, Olof Johansson

Hi all,

Here is the third version of the OF-platform PATA driver and
related patches.


Changes since v2:
- "PPC" added to PATA_PLATFORM "depends on" Kconfig entry;
  I didn't remove EMBEDDED "depends on" -- this wasn't discussed
  much and these patches should not depend on the decision.
- cosmetic fixes;
- "s/ioport_shift/reg_shift/g" patch dropped.

Changes since v1:
- __pata_platform_probe now accepts pio_mask argument;
- pata-platform compatible property renamed to ata-generic;
- pata_of_platform understands pio-mode property. It's used to pass
  pio_mask to the __pata_platform_probe. That is, in ata-generic
  context pio-mode means "pio mode the bus already configured for";
- New optional patch that renames pata_platform_info's
  ioport_shift to reg_shift.

Changes since RFC:
- nuked drivers/ata/pata_platform.h;
- powerpc bits: proper localbus node added.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH v4 0/3] OF-platform PATA driver
@ 2008-01-09 19:08 Anton Vorontsov
  2008-01-09 19:10 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
  0 siblings, 1 reply; 11+ messages in thread
From: Anton Vorontsov @ 2008-01-09 19:08 UTC (permalink / raw)
  To: linuxppc-dev, linux-ide; +Cc: Olof Johansson, Paul Mundt, Jeff Garzik

Hi all,

Here is the resend (aka v4) version of the OF-platform PATA
driver and related patches.

Changes since v3:
- Acked-by: Paul Mundt <lethal@linux-sh.org>
- In the powerpc specific patch: update defconfig and use
  machine_device_initcall -- this is new call found in the
  galak/powerpc.git.

Changes since v2:
- "PPC" added to PATA_PLATFORM "depends on" Kconfig entry;
  I didn't remove EMBEDDED "depends on" -- this wasn't discussed
  much and these patches should not depend on the decision.
- cosmetic fixes;
- "s/ioport_shift/reg_shift/g" patch dropped.

Changes since v1:
- __pata_platform_probe now accepts pio_mask argument;
- pata-platform compatible property renamed to ata-generic;
- pata_of_platform understands pio-mode property. It's used to pass
  pio_mask to the __pata_platform_probe. That is, in ata-generic
  context pio-mode means "pio mode the bus already configured for";
- New optional patch that renames pata_platform_info's
  ioport_shift to reg_shift.

Changes since RFC:
- nuked drivers/ata/pata_platform.h;
- powerpc bits: proper localbus node added.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/3] OF-platform PATA driver
@ 2007-11-27 15:37 Anton Vorontsov
  2007-11-27 15:39 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
  0 siblings, 1 reply; 11+ messages in thread
From: Anton Vorontsov @ 2007-11-27 15:37 UTC (permalink / raw)
  To: linuxppc-dev, linux-ide; +Cc: Paul Mundt, Jeff Garzik, Arnd Bergmann

Hi all,

Here is the second spin of the OF-platform PATA driver and
related patches.

Changes since RFC:
- nuked drivers/ata/pata_platform.h;
- powerpc bits: proper localbus node added.


Thanks for the previous review! This time I'm collecting acks,
don't be shy to give 'em generously. ;-)


Good luck,

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [RFC][PATCH 0/3] OF-platform PATA driver
@ 2007-11-23 17:52 Anton Vorontsov
  2007-11-23 17:53 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
  0 siblings, 1 reply; 11+ messages in thread
From: Anton Vorontsov @ 2007-11-23 17:52 UTC (permalink / raw)
  To: linuxppc-dev, linux-ide

Hi all,

Here is the PATA Platform driver using OF infrastructure.

Mostly it's just a wrapper around a bit modified pata_platform
driver.

Patches are well split for the easier review:

First one factors out platform_device specific bits and modifies
pata_platform to be a library-alike driver (with platform_device
default binding).

Second patch is OF-driver itself which is using pata_platform
"library".

Third patch is PowerPC specific, but I'm still Cc'ing linux-ide,
just to show how we're using it.


As an alternative approach we can use plain pata_platform
driver, but I'm not sure how Linux OF bindings' ideologists will
or will not like it.

So, these patches are strongly Request For Comments. Feel free
to train your nitpicking skills ;-), and/or vote for the option
you most pleased about (or suggest another?).


Thanks.

---
Down here is "alternative approach".

Probably board-neutral version may be placed somewhere in
the drivers/of/...? But who will call it: board file, or
device_initcall for all boards?

diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 150fafb..4caa90d 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -24,6 +24,7 @@
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/of_platform.h>
+#include <linux/pata_platform.h>
 
 #include <asm/system.h>
 #include <asm/atomic.h>
@@ -102,6 +103,78 @@ static int __init mpc834x_itx_probe(void)
         return of_flat_dt_is_compatible(root, "MPC834xMITX");
 }
 
+static int __init mpc834x_itx_pata_init(void)
+{
+	struct device_node *np;
+	unsigned int i;
+
+	if (!machine_is(mpc834x_itx))
+		return 0;
+
+	for (np = NULL, i = 0;
+	     (np = of_find_compatible_node(np, NULL, "pata-platform"));
+	     i++) {
+		int ret;
+		struct resource res[3];
+		const u32 *ioport_shift;
+		struct platform_device *pdev;
+		struct pata_platform_info pdata = {};
+
+		memset(res, 0, sizeof(res));
+
+		ret = of_address_to_resource(np, 0, &res[0]);
+		if (ret) {
+			printk(KERN_ERR "pata.%d: unable to get IO address "
+			       "from the device tree\n", i);
+			goto err0;
+		}
+
+		ret = of_address_to_resource(np, 1, &res[1]);
+		if (ret) {
+			printk(KERN_ERR "pata.%d: unable to get CTL address "
+			       "from the device tree\n", i);
+			goto err0;
+		}
+
+		ret = of_irq_to_resource(np, 0, &res[2]);
+		if (ret == NO_IRQ) {
+			printk(KERN_ERR "pata.%d: no IRQ\n", i);
+			goto err0;
+		}
+
+		ioport_shift = of_get_property(np, "ioport-shift", NULL);
+		if (ioport_shift)
+			pdata.ioport_shift = *ioport_shift;
+
+		pdev = platform_device_alloc("pata_platform", i);
+		if (!pdev)
+			goto err0;
+
+		ret = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+		if (ret)
+			goto err1;
+
+		ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+		if (ret)
+			goto err1;
+
+		ret = platform_device_register(pdev);
+		if (ret)
+			goto err1;
+
+		continue;
+err1:
+		printk(KERN_ERR "pata.%d: registration failed\n", i);
+		platform_device_del(pdev); /* will free everything */
+err0:
+		/* Even if some device failed, try others */
+		continue;
+	}
+
+	return 0;
+}
+device_initcall(mpc834x_itx_pata_init);
+
 define_machine(mpc834x_itx) {
 	.name			= "MPC834x ITX",
 	.probe			= mpc834x_itx_probe,

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-01-09 19:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 18:21 [PATCH v3 0/3] OF-platform PATA driver Anton Vorontsov
2007-12-14 18:24 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
2007-12-16 12:46   ` Paul Mundt
2007-12-14 18:24 ` [PATCH 2/3] [libata] pata_of_platform: OF-Platform PATA device driver Anton Vorontsov
2007-12-15 14:09   ` Stephen Rothwell
2007-12-15 15:19     ` Anton Vorontsov
2007-12-14 18:25 ` [PATCH 3/3] [POWERPC] MPC8349E-mITX: introduce localbus and pata nodes Anton Vorontsov
  -- strict thread matches above, loose matches on Subject: below --
2008-01-09 19:08 [PATCH v4 0/3] OF-platform PATA driver Anton Vorontsov
2008-01-09 19:10 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
2007-11-27 15:37 [PATCH 0/3] OF-platform PATA driver Anton Vorontsov
2007-11-27 15:39 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov
2007-11-27 22:31   ` Arnd Bergmann
2007-11-23 17:52 [RFC][PATCH 0/3] OF-platform PATA driver Anton Vorontsov
2007-11-23 17:53 ` [PATCH 1/3] [libata] pata_platform: make probe and remove functions device type neutral Anton Vorontsov

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).