Skip to contentSkip to conversation

ata: Add support for the MPC52xx ATA controller using libata

PATCH/RFC Sylvain Munaut 5 participants 8 messages Nov 16, 2006 – Nov 19, 2006 libata

lore
Share & tools
lore
#0 lore raw

This is the first attempt at a libata driver for this controller. The two main issues :

* The manual states we should check for the TIP bit before all PIO transaction. That's not really supported by libata and requires reimplementing almost all the hooks. But after talking to Freescale, it turnsout it's not really necessary. So this driver doesn't implement that check. I noticed no problem so far ...

* This driver doesn't use the standard function to compute timing because the 5200 needs more timing parameters that are not handled by the generic call (ta and t4).

---
Hi everyone,

This is a request for comments, I'd like to get that driver clean enough for the 2.6.20 merge window ;)

It has been tested on my system (but not stressed to the limits ...). I'd appreciate if someone could test it as well on other platforms.

Sylvain

---
 drivers/ata/Kconfig        |    9 +
 drivers/ata/Makefile       |    1 
 drivers/ata/pata_mpc52xx.c |  510 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/ata/pata_mpc52xx.h |  107 +++++++++
 4 files changed, 627 insertions(+), 0 deletions(-)
drivers/ata/Kconfig +9 -0
index 03f6338..be01ddf 100644
@@ -328,6 +328,15 @@ config PATA_TRIFLEX
 
 	  If unsure, say N.
 
+config PATA_MPC52xx
+	tristate "Freescale MPC52xx SoC internal IDE"
+	depends on PPC_MPC52xx
+	help
+	  This option enables support for integrated IDE controller
+	  of the Freescale MPC52xx SoC.
+
+	  If unsure, say N.
+
 config PATA_MPIIX
 	tristate "Intel PATA MPIIX support"
 	depends on PCI
drivers/ata/Makefile +1 -0
index 72243a6..e3a741c 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_PATA_NETCELL)	+= pata_netce
 obj-$(CONFIG_PATA_NS87410)	+= pata_ns87410.o
 obj-$(CONFIG_PATA_OPTI)		+= pata_opti.o
 obj-$(CONFIG_PATA_OPTIDMA)	+= pata_optidma.o
+obj-$(CONFIG_PATA_MPC52xx)	+= pata_mpc52xx.o
 obj-$(CONFIG_PATA_MPIIX)	+= pata_mpiix.o
 obj-$(CONFIG_PATA_OLDPIIX)	+= pata_oldpiix.o
 obj-$(CONFIG_PATA_PCMCIA)	+= pata_pcmcia.o
drivers/ata/pata_mpc52xx.c new file +510 -0

510 lines not on this page · raw message

drivers/ata/pata_mpc52xx.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
1.4.2
#1 lore raw
Quoted 6 lines · On Thu, 16 Nov 2006 23:12:19 +0100 Sylvain Munaut <[email protected]> wrote:

* The manual states we should check for the TIP bit before all PIO transaction. That's not really supported by libata and requires reimplementing almost all the hooks. But after talking to Freescale, it turnsout it's not really necessary. So this driver doesn't implement that check. I noticed no problem so far ...

All PIO transactions meaning each PIO command sequence or each register read/write ? In the former case is it not enough just to wrap the command write ?

Quoted 3 lines

* This driver doesn't use the standard function to compute timing because the 5200 needs more timing parameters that are not handled by the generic call (ta and t4).

I'd rather the generic code was taught to compute any extra times you need but it seems clean enough.

#2 lore raw
Quoted 12 lines · Alan
Quoted 7 lines · On Thu, 16 Nov 2006 23:12:19 +0100 Sylvain Munaut <[email protected]> wrote:

* The manual states we should check for the TIP bit before all PIO transaction. That's not really supported by libata and requires reimplementing almost all the hooks. But after talking to Freescale, it turnsout it's not really necessary. So this driver doesn't implement that check. I noticed no problem so far ...

Quoted 4 lines

All PIO transactions meaning each PIO command sequence or each register read/write ? In the former case is it not enough just to wrap the command write ?

Each register write apparently.

Quoted 8 lines
Quoted 4 lines

* This driver doesn't use the standard function to compute timing because the 5200 needs more timing parameters that are not handled by the generic call (ta and t4).

I'd rather the generic code was taught to compute any extra times you need but it seems clean enough.

Well, I can do that as well. It should be simple enough and not interfere with
the existing drivers.

Sylvain

#3 lore raw
In reply to Sylvain Munaut
Quoted 5 lines · Sylvain Munaut

* The manual states we should check for the TIP bit before all PIO transaction. That's not really supported by libata and requires reimplementing almost all the hooks. But after talking to Freescale, it turnsout it's not really necessary. So this driver doesn't implement that check. I noticed no problem so far ...

I've had some bad experiences with 2.4 line kernel when using BAPI 2.2 on Rev. A 5200 while imposing heavy I/O load. Problems manifested as hanging XLB-bus and so on. Funny thing is that combinations like Rev.A + BAPI 2.1 and Rev.B + BAPI 2.[12] seem to be immune while doing similar stress tests.

Problems went away after wrapping PIO access like this:

1. Stop XLB-pipelining
2. Wait for TIP bit to go down.
3. Do the access
4. Restore XLB-pipelining.

Just polling for the TIP bit is not enough due to errata on Rev. A if the pipelining is enabled.

Just in case if someone else is having mysterious hangs on Rev.A:s with newer microcode. :)

- Jarno

#4 lore raw
Quoted 22 lines · Jarno Manninen
Quoted 6 lines · Sylvain Munaut

* The manual states we should check for the TIP bit before all PIO transaction. That's not really supported by libata and requires reimplementing almost all the hooks. But after talking to Freescale, it turnsout it's not really necessary. So this driver doesn't implement that check. I noticed no problem so far ...

I've had some bad experiences with 2.4 line kernel when using BAPI 2.2 on Rev. A 5200 while imposing heavy I/O load. Problems manifested as hanging XLB-bus and so on. Funny thing is that combinations like Rev.A + BAPI 2.1 and Rev.B + BAPI 2.[12] seem to be immune while doing similar stress tests.

Problems went away after wrapping PIO access like this:

1. Stop XLB-pipelining
2. Wait for TIP bit to go down.
3. Do the access
4. Restore XLB-pipelining.

Quoted 6 lines

Just polling for the TIP bit is not enough due to errata on Rev. A if the pipelining is enabled.

Just in case if someone else is having mysterious hangs on Rev.A:s with newer microcode. :)

Thanks for the info ! I'll certainly try to remember that.

The currentl kernel doesn't handle DMA so far so there is no problem and we deactivate
XLB pipelining.

Since the current libata doesn't really support overriding IO accessors, I'd keep it like
that for now. Apparently some other architecture needs special IO stuff so we could see
a way to hook io accessor soon, and then we can change it if we notice big problems.

Sylvain

#5 lore raw
Quoted 6 lines · Sylvain Munaut

Since the current libata doesn't really support overriding IO accessors, I'd keep it like
that for now. Apparently some other architecture needs special IO stuff so we could see
a way to hook io accessor soon, and then we can change it if we notice big problems.

Sure it does... there are no individual outb etc. hooks, but you can override every available bitbang function. This is intentional, so that arches have more power to control when and how a set of registers is blasted to the hardware.

Jeff

#6 lore raw
Quoted 8 lines · Jeff Garzik
Quoted 6 lines · Sylvain Munaut

Since the current libata doesn't really support overriding IO accessors, I'd keep it like
that for now. Apparently some other architecture needs special IO stuff so we could see
a way to hook io accessor soon, and then we can change it if we notice big problems.

Quoted 4 lines

Sure it does... there are no individual outb etc. hooks, but you can override every available bitbang function. This is intentional, so that arches have more power to control when and how a set of registers is blasted to the hardware.

That why I said "really" but in english that doesn't quite mean what I meant.
I have a version that does it and it's not pretty, it needs to reimplement every hook where I basically just cut & pasted the standard libata ones and changed the outb to mpc52xx_ata_outb ...

I agree that this gives more flexibility when you need more than just change IO accessors. But this also means than when you just need to replace IO access, you need to do more work ... IMHO it would have made sense to add hooks for just inb and outb (not for all the possible io stuff like in driver/ide), but heh, I'm kind of biased ;)

So it's possible but as in the current state of thing since it doesn't matter
if we do it or not, I'd rather not. If it becomes necessary (when doing DMA or ...), then we can always add it. But for the moment, I would keep it as clean as possible.

Aside from that, does the driver looks ok ? It has been tested ok on another 5200b platform as well. I'd like to include it in a patch set I'll probably send next weekend. I'll try to add the timing computation to the generic call and make use of those.

Thanks,

Sylvain

#7 lore raw
Quoted 6 lines · On Sat, 18 Nov 2006 00:21:42 +0100 Sylvain Munaut <[email protected]> wrote:

Aside from that, does the driver looks ok ? It has been tested ok on another 5200b platform as well. I'd like to include it in a patch set I'll probably send next weekend. I'll try to add the timing computation to the generic call and make use of those.

I succefully tested the driver on Efika 5k2: I booted my root fs and did 2 min badblocks. No problems.

Regards,