Re: [PATCH 3/3 2.6.24-git] PPC/LIBATA: Select HAVE_PATA_PLATFORM for ARCH_PPC

2008-02-02 Thread Olof Johansson
On Sat, Feb 02, 2008 at 04:21:36PM +, Ben Dooks wrote:
 Use the new HAVE_PATA_PLATFORM to select PATA_PLATFORM
 driver.
 
 CC: [EMAIL PROTECTED]
 Signed-off-by: Ben Dooks [EMAIL PROTECTED]

What tree is this against? It doesn't apply to current mainline nor
jgarzik's libata-dev upstream branch.

Anyway: NACK: I like this approach but this needs to be added to
arch/powerpc as well.

It's actually more needed there than arch/ppc, I don't personally care
if arch/ppc can't use pata_platform for the last couple of months it's
still around (it's getting deleted this summer, all platforms should
have moved to powerpc by then).


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3 2.6.24-git] PPC/LIBATA: Select HAVE_PATA_PLATFORM for ARCH_PPC

2008-02-02 Thread Olof Johansson
On Sat, Feb 02, 2008 at 07:41:02PM +, Ben Dooks wrote:
 On Sat, Feb 02, 2008 at 01:12:39PM -0600, Olof Johansson wrote:
  On Sat, Feb 02, 2008 at 04:21:36PM +, Ben Dooks wrote:
   Use the new HAVE_PATA_PLATFORM to select PATA_PLATFORM
   driver.
   
   CC: [EMAIL PROTECTED]
   Signed-off-by: Ben Dooks [EMAIL PROTECTED]
  
  What tree is this against? It doesn't apply to current mainline nor
  jgarzik's libata-dev upstream branch.
 
 It is a series that i've just sent to the linux-ide list, only the ppc
 part was cc'd to the ppc list.

D'oh. Ok, makes more sense now.

Are you planning on adding HAVE_PATA_PLATFORM to the other archs that
use it as well, or keep it under EMBEDDED there?


  Anyway: NACK: I like this approach but this needs to be added to
  arch/powerpc as well.
 
 I can add that to the series.

Ok, cool. We can probably move it in under the relevant powerpc
sub-platforms over time, and that's a powerpc-specific change anyway,
no need to get that through linux-ide.

  It's actually more needed there than arch/ppc, I don't personally care
  if arch/ppc can't use pata_platform for the last couple of months it's
  still around (it's getting deleted this summer, all platforms should
  have moved to powerpc by then).
 
 Thanks, didn't know that.

No problem. :)


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 0/3] OF-platform PATA driver

2008-01-15 Thread Olof Johansson
Hi,

I've applied 1/3 and 2/3 together with my electra_ide move to pasemi.git
for-2.6.25, and will ask Paul to pull that. Kumar said he'd take 3/3.

I also added the const to the match table as spotted by Stephen.


-Olof

On Wed, Jan 09, 2008 at 10:08:52PM +0300, Anton Vorontsov wrote:
 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 [EMAIL PROTECTED]
 - 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: [EMAIL PROTECTED]
 backup email: [EMAIL PROTECTED]
 irc://irc.freenode.net/bd2
 ___
 Linuxppc-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/linuxppc-dev
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [POWERPC] pasemi: Move electra-ide to pata_of_platform

2008-01-15 Thread Olof Johansson
Move electra-ide glue over to the new pata_of_platform framework, and
add the quirks needed to that driver.

---

Applied with the rest of the patches to pasemi.git for-2.6.25

 arch/powerpc/platforms/pasemi/electra_ide.c |   96 
 b/arch/powerpc/configs/pasemi_defconfig |4 -
 b/arch/powerpc/platforms/pasemi/Kconfig |9 --
 b/arch/powerpc/platforms/pasemi/Makefile|1 
 b/drivers/ata/pata_of_platform.c|   20 -
5 files changed, 17 insertions(+), 113 deletions(-)


diff --git a/arch/powerpc/configs/pasemi_defconfig 
b/arch/powerpc/configs/pasemi_defconfig
index 9d21b08..797f0df 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.24-rc6
-# Fri Dec 28 11:01:53 2007
+# Tue Jan 15 10:26:10 2008
 #
 CONFIG_PPC64=y
 
@@ -152,7 +152,6 @@ CONFIG_PPC_PASEMI=y
 CONFIG_PPC_PASEMI_IOMMU=y
 # CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
 CONFIG_PPC_PASEMI_MDIO=y
-CONFIG_ELECTRA_IDE=y
 # CONFIG_PPC_CELLEB is not set
 # CONFIG_PPC_PS3 is not set
 # CONFIG_PPC_CELL is not set
@@ -663,6 +662,7 @@ CONFIG_PATA_PCMCIA=y
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
 CONFIG_PATA_PLATFORM=y
+CONFIG_PATA_OF_PLATFORM=y
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
 CONFIG_MD_LINEAR=y
diff --git a/arch/powerpc/platforms/pasemi/Kconfig 
b/arch/powerpc/platforms/pasemi/Kconfig
index b3458a1..348e061 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -37,13 +37,4 @@ config PPC_PASEMI_MDIO
help
  Driver for MDIO via GPIO on PWRficient platforms
 
-config ELECTRA_IDE
-  tristate Electra IDE driver
-  default y
-  depends on PPC_PASEMI  ATA
-  select PATA_PLATFORM
-  help
-   This includes driver support for the Electra on-board IDE
-   interface.
-
 endmenu
diff --git a/arch/powerpc/platforms/pasemi/Makefile 
b/arch/powerpc/platforms/pasemi/Makefile
index f47fcac..2cd2a4f 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1,4 +1,3 @@
 obj-y  += setup.o pci.o time.o idle.o powersave.o iommu.o
 obj-$(CONFIG_PPC_PASEMI_MDIO)  += gpio_mdio.o
-obj-$(CONFIG_ELECTRA_IDE) += electra_ide.o
 obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
diff --git a/arch/powerpc/platforms/pasemi/electra_ide.c 
b/arch/powerpc/platforms/pasemi/electra_ide.c
deleted file mode 100644
index 12fb0c9..000
--- a/arch/powerpc/platforms/pasemi/electra_ide.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2007 PA Semi, Inc
- *
- * Maintained by: Olof Johansson [EMAIL PROTECTED]
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- */
-
-#include linux/platform_device.h
-
-#include asm/prom.h
-#include asm/system.h
-
-/* The electra IDE interface is incredibly simple: Just a device on the 
localbus
- * with interrupts hooked up to one of the GPIOs. The device tree contains the
- * address window and interrupt mappings already, and the pata_platform driver 
handles
- * the rest. We just need to hook the two up.
- */
-
-#define MAX_IFS4   /* really, we have only one */
-
-static struct platform_device *pdevs[MAX_IFS];
-
-static int __devinit electra_ide_init(void)
-{
-   struct device_node *np;
-   struct resource r[3];
-   int ret = 0;
-   int i;
-
-   np = of_find_compatible_node(NULL, ide, electra-ide);
-   i = 0;
-
-   while (np  i  MAX_IFS) {
-   memset(r, 0, sizeof(r));
-
-   /* pata_platform wants two address ranges: one for the base 
registers,
-* another for the control (altstatus). It's located at offset 
0x3f6 in
-* the window, but the device tree only has one large register 
window
-* that covers both ranges. So we need to split it up by hand 
here:
-*/
-
-   ret = of_address_to_resource(np, 0, r[0]);
-   if (ret)
-   goto out;
-   ret = of_address_to_resource(np, 0, r[1]);
-   if (ret)
-   goto out;
-
-   r[1].start += 0x3f6;
-   r[0].end = r[1].start-1;
-
-   r[2].start = irq_of_parse_and_map(np, 0);
-   r[2].end = irq_of_parse_and_map(np, 0

Re: [PATCH 2/3] [libata] pata_of_platform: OF-Platform PATA device driver

2008-01-09 Thread Olof Johansson
On Thu, Jan 10, 2008 at 10:40:48AM +1100, Stephen Rothwell wrote:
 Hi Anton,
 
 Juts one small trivial comment (could be fixed later).
 
 On Wed, 9 Jan 2008 22:10:41 +0300 Anton Vorontsov [EMAIL PROTECTED] wrote:
 
  +static struct of_device_id pata_of_platform_match[] = {
 
 This could be declared const.

Good point, but let's not hold up merge based on this. Need something
for janitors to do too, and it's good enough to merge as-is. :)


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pata_of_platform: Move electra-ide support over to new framework

2007-12-20 Thread Olof Johansson
On Thu, Dec 20, 2007 at 02:53:46PM +1100, Paul Mackerras wrote:
 Olof Johansson writes:
 
   FWIW I'm presuming this work will go via a powerpc tree not libata... 
   Generally that's not the case, but here it's largely an arch-specific 
   work.
  
  Ok, that works. I was thinking of letting this patch go through libata,
  and do the removal through the powerpc merge path. But I can do both
  through powerpc.
 
 Are you going to send me a patch to do this addition plus the removal
 of the old stuff, or do you want me to merge this patch as is?

Yes, I will once the series it depends on has been sorted out and is
picked up somewhere, since it depends on it.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Fix build break caused by ide: remove ideprobe_init()

2007-12-17 Thread Olof Johansson
On Mon, Dec 17, 2007 at 09:53:31PM +0100, Bartlomiej Zolnierkiewicz wrote:
 
 Hi,
 
 applied but...
 
  ---
  
  On Sun, Nov 18, 2007 at 11:25:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
   
   * Rename ide_device_add() to ide_device_add_all() and make it accept
 'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.
   
   * Add ide_device_add() wrapper for ide_device_add_all().
   
   * Convert ide_generic_init() to use ide_device_add_all().
   
   * Remove no longer needed ideprobe_init().
   
   There should be no functionality changes caused by this patch.
  
  This patch broke builds of powerpc holly_defconfig in -mm. It has
  CONFIG_EMBEDDED=y, CONFIG_IDE=n but includes linux/ide.h:
  ^
 
 ...could you also fix the root source of the problem so the similar issue
 won't re-appear in the future?
 
 linux/ide.h is IDE subsystem specific in the same way that linux/libata.h
 is libata specific, linux/ata.h is the place to put subsystem independent
 defines, inlines and co.
 
 There are some powerpc abusers of the above rule but they should at least 
 cover
 references to linux/ide.h and IDE subsystem specific code with #ifdef/#endif
 CONFIG_BLK_DEV_IDE.
 
 In arch/powerpc/platforms/embedded6xx/holly.c case it seems that linux/ide.h
 include is actually not needed and may be just removed?

Yep, that was my original simple fix to the problem, but when I looked
closer I wanted to get the include file fixed as well.

Turns out I never posted the powerpc patch :), I'll do so (and audit
other platforms for the same).


Thanks,

-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-14 Thread Olof Johansson
On Wed, Dec 05, 2007 at 12:39:12PM -0600, Scott Wood wrote:
 On Wed, Dec 05, 2007 at 09:48:41AM +0900, Paul Mundt wrote:
  On Tue, Dec 04, 2007 at 02:01:21PM -0600, Olof Johansson wrote:
   On Tue, Dec 04, 2007 at 10:49:21PM +0300, Anton Vorontsov wrote:
tristate Generic platform device PATA support
-   depends on EMBEDDED || ARCH_RPC
+   depends on EMBEDDED || ARCH_PPC
   
   It needs to be || PPC, not || ARCH_PPC.
   
  Wrong. It needs to be EMBEDDED || ARCH_RPC || PPC.
 
 Why is it dependent on anything other than platform bus support and ATA?

There's no way to specify dependency on platform bus as a config option,
that's likely what EMBEDDED was meant to do. Some platforms have platform
bus in spite of being !EMBEDDED, arch/arm/configs/rpc_defconfig seems
to be among those. PPC too.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-14 Thread Olof Johansson
On Fri, Dec 14, 2007 at 10:09:28AM -0600, Scott Wood wrote:
 On Fri, Dec 14, 2007 at 02:23:13AM -0600, Olof Johansson wrote:
  On Wed, Dec 05, 2007 at 12:39:12PM -0600, Scott Wood wrote:
   Why is it dependent on anything other than platform bus support and ATA?
  
  There's no way to specify dependency on platform bus as a config option,
  that's likely what EMBEDDED was meant to do. Some platforms have platform
  bus in spite of being !EMBEDDED, arch/arm/configs/rpc_defconfig seems
  to be among those. PPC too.
 
 If platform bus can't be configged out, then the only dependency should
 be the implicit one on ATA (is there anything else whose absence will
 stop the code from building, or working if the appropriate platform
 device is passed in?).

Sure, sounds good to me.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-04 Thread Olof Johansson
Hi,

On Tue, Dec 04, 2007 at 08:07:19PM +0300, Anton Vorontsov wrote:
 This driver nicely wraps around pata_platform library functions,
 and provides OF platform bus bindings to the PATA devices.
 
 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
 ---
  drivers/ata/Kconfig|   10 
  drivers/ata/Makefile   |1 +
  drivers/ata/pata_of_platform.c |  102 
 
  3 files changed, 113 insertions(+), 0 deletions(-)
  create mode 100644 drivers/ata/pata_of_platform.c
 
 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
 index ba63619..5a492fa 100644
 --- a/drivers/ata/Kconfig
 +++ b/drivers/ata/Kconfig
 @@ -614,6 +614,16 @@ config PATA_PLATFORM
  
 If unsure, say N.
  
 +config PATA_OF_PLATFORM
 + tristate OpenFirmware platform device PATA support
 + depends on PATA_PLATFORM  PPC_OF
 + help
 +   This option enables support for generic directly connected ATA
 +   devices commonly found on embedded systems with OpenFirmware
 +   bindings.
 +
 +   If unsure, say N.
 +

There's a typo in the dependencies for PATA_PLATFORM that you should change:

depends on EMBEDDED || ARCH_RPC

(note ARCH_RPC). With my font it's hard to tell a difference :)

It should really be:

depends on EMBEDDED || PPC

Care to change that while you're at it?

 +static struct of_device_id pata_of_platform_match[] = {
 + { .compatible = ata-generic, },
 +};

Needs to be terminated by empty entry, and please add:
MODULE_DEVICE_TABLE(of, pata_of_platform_match);


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/4] [POWERPC] MPC8349E-mITX: introduce localbus and pata nodes

2007-12-04 Thread Olof Johansson
Hi,

On Tue, Dec 04, 2007 at 08:07:26PM +0300, Anton Vorontsov wrote:
 diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts 
 b/arch/powerpc/boot/dts/mpc8349emitx.dts
 index 5072f6d..c459b0a 100644
 --- a/arch/powerpc/boot/dts/mpc8349emitx.dts
 +++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
 @@ -249,6 +249,22 @@
   device_type = pci;
   };
  
 + [EMAIL PROTECTED] {
 + #address-cells = 2;
 + #size-cells = 1;
 + compatible = fsl,mpc8349emitx-localbus,
 +  fsl,mpc8349e-localbus,
 +  fsl,pq2pro-localbus;
 + reg = e0005000 d8;
 + ranges = 3 0 f000 210;
  
 -
 + [EMAIL PROTECTED],0 {

What's the ,0 for?

 + compatible = fsl,mpc8349emitx-pata, ata-generic;
 + reg = 3 0 10 3 20c 4;
 + reg-shift = 1;
 + pio-mode = 6;
 + interrupts = 17 8;
 + interrupt-parent = ipic;
 + };
 + };
  };
 diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c 
 b/arch/powerpc/platforms/83xx/mpc834x_itx.c
 index aa76819..ea5f176 100644
 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
 +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
 @@ -23,6 +23,7 @@
  #include linux/delay.h
  #include linux/seq_file.h
  #include linux/root_dev.h
 +#include linux/of_platform.h
  
  #include asm/system.h
  #include asm/atomic.h
 @@ -37,6 +38,22 @@
  
  #include mpc83xx.h
  
 +static struct of_device_id mpc834x_itx_ids[] = {
 + { .name = localbus, },
 + {},
 +};

Please add the compatible field here (fsl,pq2pro-localbus should do
just fine), instead of the name.

(Sorry for not spotting this sooner)


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-04 Thread Olof Johansson
On Tue, Dec 04, 2007 at 10:49:21PM +0300, Anton Vorontsov wrote:
   tristate Generic platform device PATA support
 - depends on EMBEDDED || ARCH_RPC
 + depends on EMBEDDED || ARCH_PPC

It needs to be || PPC, not || ARCH_PPC.


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-04 Thread Olof Johansson
On Tue, Dec 04, 2007 at 11:37:51PM +0300, Anton Vorontsov wrote:
 On Tue, Dec 04, 2007 at 02:01:21PM -0600, Olof Johansson wrote:
  On Tue, Dec 04, 2007 at 10:49:21PM +0300, Anton Vorontsov wrote:
 tristate Generic platform device PATA support
   - depends on EMBEDDED || ARCH_RPC
   + depends on EMBEDDED || ARCH_PPC
  
  It needs to be || PPC, not || ARCH_PPC.
 
 D'oh.
 
 - - - -
 From: Anton Vorontsov [EMAIL PROTECTED]
 Subject: [PATCH v2.2] [libata] pata_of_platform: OF-Platform PATA device 
 driver
 
 This driver nicely wraps around pata_platform library functions,
 and provides OF platform bus bindings to the PATA devices.
 
 In addition fix ARCH_RPC typo in the PATA_PLATFORM Kconfig entry,
 spotted by Olof Johansson.
 
 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]

Reviewed-by: Olof Johansson [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/4] [POWERPC] MPC8349E-mITX: introduce localbus and pata nodes

2007-12-04 Thread Olof Johansson
On Tue, Dec 04, 2007 at 10:45:31PM +0300, Anton Vorontsov wrote:
 This patch adds localbus and pata nodes to use CF IDE interface
 on MPC8349E-mITX boards.
 
 Patch also adds code to probe localbus.
 
 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]

Acked-by: Olof Johansson [EMAIL PROTECTED]


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] [libata] pata_platform: make probe and remove functions device type neutral

2007-12-04 Thread Olof Johansson
On Tue, Dec 04, 2007 at 08:06:25PM +0300, Anton Vorontsov wrote:
 Split pata_platform_{probe,remove} into two pieces:
 1. pata_platform_{probe,remove} -- platform_device-dependant bits;
 2. __ptata_platform_{probe,remove} -- device type neutral bits.
 
 This is done to not duplicate code for the OF-platform driver.
 
 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]

Acked-by: Olof Johansson [EMAIL PROTECTED]

Tested with both the old pata_platform and new pata_of_platform drivers on
PA Semi Electra (see separate post with pata_of_platform cutover patch).


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pata_of_platform: Move electra-ide support over to new framework

2007-12-04 Thread Olof Johansson
[POWERPC] Move electra-ide support over to new pata_of_platform framework

Move electra-ide glue over to the new pata_of_platform framework, and
add the quirks needed to that driver.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

---

I'll remove the electra-ide stuff from arch/powerpc/platforms/pasemi
once this hits a common tree, since otherwise I'd be without IDE until
they converge (i.e.  2.6.25 merge window).


-Olof

diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 4daf118..3e9675a 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -34,11 +34,20 @@ static int __devinit pata_of_platform_probe(struct 
of_device *ofdev,
return -EINVAL;
}
 
-   ret = of_address_to_resource(dn, 1, ctl_res);
-   if (ret) {
-   dev_err(ofdev-dev, can't get CTL address from 
-   device tree\n);
-   return -EINVAL;
+   if (of_device_is_compatible(dn, electra-ide)) {
+   /* Altstatus is really at offset 0x3f6 from the primary window
+* on electra-ide. Adjust ctl_res and io_res accordingly.
+*/
+   ctl_res = io_res;
+   ctl_res.start = ctl_res.start+0x3f6;
+   io_res.end = ctl_res.start-1;
+   } else {
+   ret = of_address_to_resource(dn, 1, ctl_res);
+   if (ret) {
+   dev_err(ofdev-dev, can't get CTL address from 
+   device tree\n);
+   return -EINVAL;
+   }
}
 
ret = of_irq_to_resource(dn, 0, irq_res);
@@ -76,6 +85,7 @@ static int __devexit pata_of_platform_remove(struct of_device 
*ofdev)
 
 static struct of_device_id pata_of_platform_match[] = {
{ .compatible = ata-generic, },
+   { .compatible = electra-ide, },
{},
 };
 MODULE_DEVICE_TABLE(of, pata_of_platform_match);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pata_of_platform: Move electra-ide support over to new framework

2007-12-04 Thread Olof Johansson
On Tue, Dec 04, 2007 at 03:50:03PM -0500, Jeff Garzik wrote:
 Olof Johansson wrote:
 [POWERPC] Move electra-ide support over to new pata_of_platform framework
 Move electra-ide glue over to the new pata_of_platform framework, and
 add the quirks needed to that driver.
 Signed-off-by: Olof Johansson [EMAIL PROTECTED]
 ---
 I'll remove the electra-ide stuff from arch/powerpc/platforms/pasemi
 once this hits a common tree, since otherwise I'd be without IDE until
 they converge (i.e.  2.6.25 merge window).

 FWIW I'm presuming this work will go via a powerpc tree not libata... 
 Generally that's not the case, but here it's largely an arch-specific work.

Ok, that works. I was thinking of letting this patch go through libata,
and do the removal through the powerpc merge path. But I can do both
through powerpc.

-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-04 Thread Olof Johansson
On Wed, Dec 05, 2007 at 09:48:41AM +0900, Paul Mundt wrote:
 On Tue, Dec 04, 2007 at 02:01:21PM -0600, Olof Johansson wrote:
  On Tue, Dec 04, 2007 at 10:49:21PM +0300, Anton Vorontsov wrote:
 tristate Generic platform device PATA support
   - depends on EMBEDDED || ARCH_RPC
   + depends on EMBEDDED || ARCH_PPC
  
  It needs to be || PPC, not || ARCH_PPC.
  
 Wrong. It needs to be EMBEDDED || ARCH_RPC || PPC.
 
 ARCH_RPC is not a typo, it's an ARM platform. Please grep first :-)

I'm sorry, but seeing ARCH_RPC and not having an arch/rpc made me
suspect it being a typo. It surprises me that the ARM guys chose such
a generic prefix as ARCH_ for their specific platforms.  (powerpc uses
PPC_platform).

Anyway, thanks for catching it.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] OF-platform PATA driver

2007-12-02 Thread Olof Johansson
On Sun, Dec 02, 2007 at 02:46:17PM +0300, Anton Vorontsov wrote:
 On Sat, Dec 01, 2007 at 09:57:55PM -0600, Olof Johansson wrote:
  On Sun, Dec 02, 2007 at 02:58:10AM +0300, Anton Vorontsov wrote:
   On Sat, Dec 01, 2007 at 05:54:49PM -0500, Jeff Garzik wrote:
   while (1) {
 send_patches();
   
 if (ack_collected(PaulM)  ack_collected(PowerPC_people))
 break;
   
 sleep(wait_for_comments_timeout); -- currently here.
  
  I still haven't seen you address the compatible comments (that
  pata-platform is suboptimal). Or did I miss some respin of the patches?
 
 I didn't resend these patches yet. You started the thread, but you hid
 away from the discussion (you had been Cc'ed to every mail).
 
 1. Arnd suggested {p,s}ata-pio-{1,2,3,..} or ata-{1,2,3,..} compatible
scheme;
 2. Sergei verbosely explained that that there is no reason to
complicate compatible property. He suggested ata-generic, or
ata-simple;
 
 Mainly I was awaiting for your further comments. By now I tend to
 follow Sergei's comments and rename compatible stuff to ata-generic.
 Are you fine with it?

Ah, sorry about that. The discussion got a bit noisy so I tuned it out.

Yes, I agree with Sergei: I don't think the pio/ata mode belongs there,
ata-generic (or generic-ata) sounds good to me. If firmwares want to
specify pata/sata stuff as more specific compatible fields, then they are
free to, but the driver shouldn't depend on it as long as ata-generic
is in the list.

ATA/PIO modes could be communicated with separate properties as well,
but I don't see a need for it right now. Tuning PIO modes normally
involves changing bus parameters/cycle times, etc, and that' hardly
generic enough to be handled by this driver in the first place.

I will need to add a compatible field to it myself (our firmware uses
electra-ide) + some minor changes, but I will do that on top of this
patch once it goes in since it involves removing the old code from
arch/powerpc/platforms/pasemi.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] OF-platform PATA driver

2007-12-02 Thread Olof Johansson
On Mon, Dec 03, 2007 at 12:40:21AM +0100, Arnd Bergmann wrote:
 On Sunday 02 December 2007, Olof Johansson wrote:
 
  Yes, I agree with Sergei: I don't think the pio/ata mode belongs there,
  ata-generic (or generic-ata) sounds good to me. If firmwares want to
  specify pata/sata stuff as more specific compatible fields, then they are
  free to, but the driver shouldn't depend on it as long as ata-generic
  is in the list.
 
 Yes, that makes sense. Let me just make it clear that I no longer think
 we should have the PIO mode or the ATA level in the compatible property.
 The PIO modes should really have their own property, if any, and the ATA
 standard would need to be a property of the attached device, not a property
 of the controller.

Right. And configuring PIO modes is something quite hardware specific,
which defeats the purpose of having a generic driver as a catch-all
for simple configs in the first place. If the hardware needs (much)
tuning it probably makes more sense to do it as a separate driver.

 I can see a point in listing the ATA devices themselves in the device tree,
 but it's probably not really worth it for the fdt setup, since they
 can easily be probed at runtime.

If the firmware probes them and/or knows about them. It's the kind of
thing that can change quite often. We don't list USB devices under the usb
controllers either, since they're quite volatile and the device tree is
(fairly) static on the DTS-based platforms.

  I will need to add a compatible field to it myself (our firmware uses
  electra-ide) + some minor changes, but I will do that on top of this
  patch once it goes in since it involves removing the old code from
  arch/powerpc/platforms/pasemi.
 
 I'd suggest to also have electra-ide hardcoded in the driver alongside
 ata-generic, as a special case for backwards compatibility.

Yep, that's my plan, I'll do that when I move it over.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] OF-platform PATA driver

2007-12-01 Thread Olof Johansson
On Sun, Dec 02, 2007 at 02:58:10AM +0300, Anton Vorontsov wrote:
 On Sat, Dec 01, 2007 at 05:54:49PM -0500, Jeff Garzik wrote:
 while (1) {
   send_patches();
 
   if (ack_collected(PaulM)  ack_collected(PowerPC_people))
   break;
 
   sleep(wait_for_comments_timeout); -- currently here.

I still haven't seen you address the compatible comments (that
pata-platform is suboptimal). Or did I miss some respin of the patches?


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] [libata] pata_of_platform: OF-Platform PATA device driver

2007-12-01 Thread Olof Johansson
On Tue, Nov 27, 2007 at 06:39:08PM +0300, Anton Vorontsov wrote:

 +static struct of_device_id pata_of_platform_match[] = {
 + { .compatible = pata-platform, },
 +};

On top of previous comment about the compatible string being
inappropriate:

You should add a MODULE_DEVICE_TABLE() entry for this. Dave Woodhouse
pointed out it's needed for autoloading modules (i.e. by the fedora
installer, etc).


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] [libata] pata_of_platform: OF-Platform PATA device driver

2007-11-27 Thread Olof Johansson
On Tue, Nov 27, 2007 at 06:39:08PM +0300, Anton Vorontsov wrote:
 This driver nicely wraps around pata_platform library functions,
 and provides OF platform bus bindings to the PATA devices.

 +static struct of_device_id pata_of_platform_match[] = {
 + { .compatible = pata-platform, },
 +};

pata-platform really means nothing outside of linux. A more
generic label would be useful.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libata: fix for sata_mv 64KB DMA segments

2007-10-02 Thread Olof Johansson
Fix bug in sata_mv for cases where the IOMMU layer has merged SG entries
to larger than 64KB. They need to be split up before being sent to
the driver.

Just for simplicity's sake, split up at 64K boundary instead of 64K size,
since that's what the common code does anyway.

Signed-off-by: Olof Johansson [EMAIL PROTECTED]


---

On Tue, Oct 02, 2007 at 07:23:10PM -0400, Jeff Garzik wrote:
 Olof Johansson wrote:
 On Mon, Oct 01, 2007 at 06:37:44PM -0400, Jeff Garzik wrote:
 Looks like it's caused by enabling vmerge (which tends to be on for the
 common PPC defconfigs). If I disable it, things look OK.
 Perhaps the Marvell controller doesn't like requests larger than 64K,
 or wrapping some boundary. Do you have access to erratas/docs?
 I have verified it on a powermac now as well (had a quick scare that it
 might have been some problem with the PA Semi IOMMU, but no).

 FWIW:  I just tried the 6042 on my AMD64 platform with iommu=force, and was 
 unable to reproduce any trouble.

 You could try changing MV_DMA_BOUNDARY to 0xU and see what happens.

As per discussion on IRC, it was really caused by mv_fill_sg() not
handing SG entries larger than 64K properly. Below patch fixes it to
behave like ata_fill_sg() instead.

Works OK here after some light testing (restoring my corrupted root
filesystem and running a few fscks on it, among other things).


Thanks,

Olof


diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 11bf6c7..1a82e22 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1139,15 +1139,27 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd 
*qc)
dma_addr_t addr = sg_dma_address(sg);
u32 sg_len = sg_dma_len(sg);
 
-   mv_sg-addr = cpu_to_le32(addr  0x);
-   mv_sg-addr_hi = cpu_to_le32((addr  16)  16);
-   mv_sg-flags_size = cpu_to_le32(sg_len  0x);
+   while (sg_len) {
+   u32 offset = addr  0x;
+   u32 len = sg_len;
 
-   if (ata_sg_is_last(sg, qc))
-   mv_sg-flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
+   if ((offset + sg_len  0x1))
+   len = 0x1 - offset;
+
+   mv_sg-addr = cpu_to_le32(addr  0x);
+   mv_sg-addr_hi = cpu_to_le32((addr  16)  16);
+   mv_sg-flags_size = cpu_to_le32(len);
+
+   sg_len -= len;
+   addr += len;
+
+   if (!sg_len  ata_sg_is_last(sg, qc))
+   mv_sg-flags_size |= 
cpu_to_le32(EPRD_FLAG_END_OF_TBL);
+
+   mv_sg++;
+   n_sg++;
+   }
 
-   mv_sg++;
-   n_sg++;
}
 
return n_sg;
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[regression] 2.6.23 sata_mv EH updates broke my 7042 controller

2007-10-01 Thread Olof Johansson
Hi,

I just pulled out my Marvell 7042 SATA controller here to give it a spin
and noticed that it no longer worked (i.e. init segvs when loading from
it), etc. 2.6.22 is fine.

Bisecting (just the file drivers/ata/sata_mv.c) resulted in
bdd4dddee325a7dce3e84cf48201a06aa8508aa4 popping out as the culprit
(file version 4537deb5e90b717a725b3d74b58b4bb1d28443d0 is fine).

Just for sanity checking: Has anyone else used 7042/6042 with the current
mainline driver?

Hardware config in my case:
Highpoint 2310 controller
PPC (big endian)
WD Raptor disk

Works fine with the other controller I've been using (SIL24), and works
fine if I revert the driver.

It also works fine if I disable the IOMMU. This would point towards
either a stale dma mapping, or a missing setup of one.

Not being much at home in the SATA drivers I could keep digging but I
figured I'd bring it up first in case it rings a bell for someone.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [regression] 2.6.23 sata_mv EH updates broke my 7042 controller

2007-10-01 Thread Olof Johansson
On Mon, Oct 01, 2007 at 06:37:44PM -0400, Jeff Garzik wrote:
 Olof Johansson wrote:
 Hardware config in my case:
 Highpoint 2310 controller
 PPC (big endian)
 WD Raptor disk
 Works fine with the other controller I've been using (SIL24), and works
 fine if I revert the driver.
 It also works fine if I disable the IOMMU. This would point towards
 either a stale dma mapping, or a missing setup of one.
 Not being much at home in the SATA drivers I could keep digging but I
 figured I'd bring it up first in case it rings a bell for someone.

 The IOMMU data point is certainly interesting.  Nothing jumps out on a 
 re-review of the patch, so keep digging and let us know ;-)

Looks like it's caused by enabling vmerge (which tends to be on for the
common PPC defconfigs). If I disable it, things look OK.

Perhaps the Marvell controller doesn't like requests larger than 64K,
or wrapping some boundary. Do you have access to erratas/docs?

I have verified it on a powermac now as well (had a quick scare that it
might have been some problem with the PA Semi IOMMU, but no).


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] [ide] mmio ide support

2007-07-07 Thread Olof Johansson
On Sat, Jul 07, 2007 at 01:48:52PM +0400, Vitaly Bordug wrote:
 
 This adds support for MMIO IDE device like CompactFlash 
 in TrueIDE mode.

Doesn't this duplicate most of pata_platform, but as the
no-longer-preferred legacy IDE device? Did you try using
pata_platform instead?


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] [POWERPC] mmio ide support for mpc8349-itx target

2007-07-07 Thread Olof Johansson
On Sat, Jul 07, 2007 at 01:49:00PM +0400, Vitaly Bordug wrote:
 
 This updates relevant platform code
 (freescale mpc8349itx target) to make the CompactFlash
 work in TrueIDE mode.

Shouldn't you be writing a PCMCIA driver instead for the CF, so it
handles other devices as well? Then you get storage for free, as
well as hotplug, etc.

It's not hard:

http://patchwork.ozlabs.org/linuxppc/patch?person=124id=12044


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libata: CONFIG_PM=n compile fix

2007-06-03 Thread Olof Johansson
CONFIG_PM=n compile fix.

Signed-off-by: Olof Johansson [EMAIL PROTECTED]

---

Hi,

On Sat, May 26, 2007 at 11:09:54PM -0400, Jeff Garzik wrote:

 This is checked into the 'mv-ahci-pata' branch of
 git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

Didn't build for me without this change, since I had CONFIG_PM=n.


diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 21df81e..07d5a95 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1818,6 +1836,14 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd 
*qc)
}
 }
 
+static int ahci_port_resume(struct ata_port *ap)
+{
+   ahci_power_up(ap);
+   ahci_start_port(ap);
+
+   return 0;
+}
+
 #ifdef CONFIG_PM
 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
 {
@@ -1835,14 +1861,6 @@ static int ahci_port_suspend(struct ata_port *ap, 
pm_message_t mesg)
return rc;
 }
 
-static int ahci_port_resume(struct ata_port *ap)
-{
-   ahci_power_up(ap);
-   ahci_start_port(ap);
-
-   return 0;
-}
-
 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
struct ata_host *host = dev_get_drvdata(pdev-dev);
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [2.6.22] libata: fix probe time irq printouts

2007-06-03 Thread Olof Johansson
Most drivers don't seem to fill out the host-irq field, resulting in the
wrong (no) irq being reported at probe time. For example, sil24 on my system:

ata1: SATA max UDMA/100 cmd 0xd8009001f000 ctl 0x bmdma 
0x irq 0
ata2: SATA max UDMA/100 cmd 0xd80090021000 ctl 0x bmdma 
0x irq 0

Since they're allocated and set up in ata_host_activate(), just save
them away there.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]


diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index af62514..7491b11 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6438,6 +6438,9 @@ int ata_host_activate(struct ata_host *host, int irq,
if (rc)
devm_free_irq(host-dev, irq, host);
 
+   /* Used to print device info at probe */
+   host-irq = irq;
+
return rc;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pasemi: electra IDE/pata_platform glue

2007-05-13 Thread Olof Johansson
On Sun, May 13, 2007 at 12:20:10PM +1000, Benjamin Herrenschmidt wrote:

 Then, the plans I have in mind for the future of that stuff are around
 the idea of registering constructors based on bus matches and device
 matches respectively.
 
 The kernel will then walk the whole OF device-tree at boot, and will
 instanciate devices using those constructors, passing them the struct
 device of whatever was the parent.
 
 Thus we could easily have platforms registers constructors for specific
 devices that build a platform device off an OF node.

Great. That should fit perfectly with the glue I have now, it'll turn
into the constructor instead.

I honestly don't see what the benefit is of this recent obsession
with creating of_platform devices for every new device that's not
PCI, especially when there's an already well-fitting driver in the
traditional platform model. It's not like the code to link the two is
large and complex.

Also, in this particular case, the bindings are not standardized, and
there's a good chance that whatever new platform uses a similar device
will need to do something slightly different.


-Olof
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pasemi: electra IDE/pata_platform glue

2007-05-13 Thread Olof Johansson
Hi,

On Sun, May 13, 2007 at 02:48:22AM +0200, Arnd Bergmann wrote:

 Olof, have you looked at which of the two -set_mode functions is more
 appropriate for electra? I would guess that you actually want to use
 the ata_generic one.

Actually, the pata_platform driver is _exactly_ what I want at this time,
since we can't do bus master dma and it assumes that. It's a perfect fit,
I see no reason to retool it.

Another reason for why I'm not that excited about doing a generic
of_platform driver is that it's likely that I'll do a new driver that
uses one of the simple dma engines on our SoC to get the data over PIO
(i.e still not bus master dma, but at least offloaded). That'd make the
resulting number of users of a pata_of driver 0 until the next one comes
around, with whatever that means with respect to bit-rot, etc.

That driver will, on the other hand, likely be an of_platform one. But
until then there's not much use in doing one.


-Olof

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] pasemi: electra IDE/pata_platform glue

2007-05-12 Thread Olof Johansson
Glue code to hook up the pata_platform on the PA Semi Electra eval board.
CFE sets up device tree entries for the IDE interface, with device type
'ide' and compatible field 'electra-ide'.

We unfortunately need to modify the resources before calling the generic
platform driver, since the device tree only has one register window in
it and the driver expects two. Adding this as an of_platform driver
instead doesn't give us any benefit, it just adds one more layer of
register/probe functions.

Since CONFIG_PATA_PLATFORM depends on CONFIG_EMBEDDED, add that as a
default for PPC_PASEMI.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]


Index: 2.6.21/arch/powerpc/platforms/pasemi/Makefile
===
--- 2.6.21.orig/arch/powerpc/platforms/pasemi/Makefile
+++ 2.6.21/arch/powerpc/platforms/pasemi/Makefile
@@ -1,3 +1,4 @@
 obj-y  += setup.o pci.o time.o idle.o powersave.o iommu.o
 obj-$(CONFIG_PPC_PASEMI_MDIO)  += gpio_mdio.o
+obj-$(CONFIG_ELECTRA_IDE) += electra_ide.o
 obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
Index: 2.6.21/arch/powerpc/platforms/pasemi/electra_ide.c
===
--- /dev/null
+++ 2.6.21/arch/powerpc/platforms/pasemi/electra_ide.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2007 PA Semi, Inc
+ *
+ * Maintained by: Olof Johansson [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include linux/platform_device.h
+
+#include asm/prom.h
+#include asm/system.h
+
+/* The electra IDE interface is incredibly simple: Just a device on the 
localbus
+ * with interrupts hooked up to one of the GPIOs. The device tree contains the
+ * address window and interrupt mappings already, and the pata_platform driver 
handles
+ * the rest. We just need to hook the two up.
+ */
+
+#define MAX_IFS4   /* really, we have only one */
+
+static struct platform_device *pdevs[MAX_IFS];
+
+static int __devinit electra_ide_init(void)
+{
+   struct device_node *np;
+   struct resource r[3];
+   int ret = 0;
+   int i;
+
+   np = of_find_compatible_node(NULL, ide, electra-ide);
+   i = 0;
+
+   while (np  i  MAX_IFS) {
+   memset(r, 0, sizeof(r));
+
+   /* pata_platform wants two address ranges: one for the base 
registers,
+* another for the control (altstatus). It's located at offset 
0x3f6 in
+* the window, but the device tree only has one large register 
window
+* that covers both ranges. So we need to split it up by hand 
here:
+*/
+
+   ret = of_address_to_resource(np, 0, r[0]);
+   if (ret)
+   goto out;
+   ret = of_address_to_resource(np, 0, r[1]);
+   if (ret)
+   goto out;
+
+   r[1].start += 0x3f6;
+   r[0].end = r[1].start-1;
+
+   r[2].start = irq_of_parse_and_map(np, 0);
+   r[2].end = irq_of_parse_and_map(np, 0);
+   r[2].flags = IORESOURCE_IRQ;
+
+   pr_debug(registering platform device at 0x%lx/0x%lx, irq is 
%ld\n,
+r[0].start, r[1].start, r[2].start);
+   pdevs[i] = platform_device_register_simple(pata_platform, i, 
r, 3);
+   if (IS_ERR(pdevs[i])) {
+   ret = PTR_ERR(pdevs[i]);
+   pdevs[i] = NULL;
+   goto out;
+   }
+   np = of_find_compatible_node(np, ide, electra-ide);
+   }
+out:
+   return ret;
+}
+module_init(electra_ide_init);
+
+static void __devexit electra_ide_exit(void)
+{
+   int i;
+
+   for (i = 0; i  MAX_IFS; i++)
+   if (pdevs[i])
+   platform_device_unregister(pdevs[i]);
+}
+module_exit(electra_ide_exit);
+
+
+MODULE_LICENSE(GPL);
+MODULE_AUTHOR (Olof Johansson [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(PA Semi Electra IDE driver);
Index: 2.6.21/arch/powerpc/platforms/pasemi/Kconfig
===
--- 2.6.21.orig/arch/powerpc/platforms/pasemi/Kconfig
+++ 2.6.21/arch/powerpc/platforms/pasemi/Kconfig
@@ -6,6 +6,7 @@ config PPC_PASEMI
select PPC_UDBG_16550
select GENERIC_TBSYNC
select PPC_NATIVE
+   select EMBEDDED

[PATCH] pata_platform: don't use generic ata_port_start

2007-05-09 Thread Olof Johansson
Hi,

I have a system where I have a simple IDE controller that sits on a
local bus without bus master dma capability, and thus no dma_mapping
ops defined for the device/bus.

pata_platform works great for me, with the exception of using the generic
ata_port_start which tries to do a dmam_alloc_coherent.

Looks like it doesn't need to allocate a prd table at all, so replace it
with a dummy function instead.


Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 4b82a54..a0aede1 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -48,6 +48,8 @@ static int pata_platform_set_mode(struct ata_port *ap, struct 
ata_device **unuse
return 0;
 }
 
+static int ata_dummy_ret0(struct ata_port *ap) { return 0; }
+
 static struct scsi_host_template pata_platform_sht = {
.module = THIS_MODULE,
.name   = DRV_NAME,
@@ -91,7 +93,7 @@ static struct ata_port_operations pata_platform_port_ops = {
.irq_on = ata_irq_on,
.irq_ack= ata_irq_ack,
 
-   .port_start = ata_port_start,
+   .port_start = ata_dummy_ret0,
 };
 
 static void pata_platform_setup_port(struct ata_ioports *ioaddr,
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html