diff mbox

Compact Flash on 8349mITX

Message ID 20081009172338.GA4292@oksana.dev.rtsoft.ru (mailing list archive)
State Not Applicable, archived
Delegated to: Kumar Gala
Headers show

Commit Message

Anton Vorontsov Oct. 9, 2008, 5:23 p.m. UTC
On Thu, Oct 09, 2008 at 08:52:09AM -0700, Jeff Borlin wrote:
> 
> I have taken over this effort to get Compact Flash working on the 8349mITX
> board and am running into these same issues.  I can get uBoot to list the
> contents of a CF card,

U-Boot doesn't use interrupts.

> but am running into a couple problems through the
> kernel.  There appears to be an IRQ problem and a general communication
> problem with the CF card, possibly related.  Note that I am very new to
> Linux so please don't assume obvious things are correct
> 
> I am using the latest from /linux/kernel/git/benh/powerpc.git, and created
> my dtb from:  arch/powerpc/dts/mpc8349emitx.dts.  
> 
> Any ideas on what I could try or look into next with either issue?  
> 
> boot info:  
> [...]
[...]

This happens just before the PATA information is printed. I'm not
libata expert; and from the brief look I don't see where libata
clears any pending "unexpected" irqs. Just a guesswork,
could you try this patch?



> irq 23: nobody cared (try booting with the "irqpoll" option)
> Call Trace:
> [cec29a30] [c00089a4] 0xc00089a4 (unreliable)
> [cec29a60] [c00467d8] 0xc00467d8
> [...]
> Disabling IRQ #23
> scsi4 : pata_platform
> ata5: PATA max PIO6 mmio cmd 0xf0000000 ctl 0xf000020c irq 23
> ata5.00: CFA: SanDisk SDCFJ-512, HDX 3.13, max MWDMA2
> ata5.00: 1000944 sectors, multi 0: LBA
> ata5.00: configured for PIO

Can you check if the CF will work w/o IRQs? To try it:

1. open the arch/powerpc/dts/mpc8349emitx.dts file, find the pata node:

                pata@3,0 {
                        compatible = "fsl,mpc8349emitx-pata", "ata-generic";
                        reg = <0x3 0x0 0x10 0x3 0x20c 0x4>;
                        reg-shift = <1>;
                        pio-mode = <6>;
                        interrupts = <23 0x8>;
                        interrupt-parent = <&ipic>;
                };

2. delete interrupts = <>; and interrupt-parent = <>; lines.

3. recompile the dts to dtb.

4. Apply this patch to the kernel http://lkml.org/lkml/2008/10/6/176

5. And try to boot the patched kernel using the re-compiled dtb file.

> scsi 4:0:0:0: Direct-Access     ATA      SanDisk SDCFJ-51 HDX  PQ: 0 ANSI: 5
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
>  sda:<3>ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> ata5.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in
>          res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
> ata5.00: status: { DRDY }
> ata5: soft resetting link
> ata5.00: configured for PIO
> ata5: EH complete
> ata5.00: limiting speed to UDMA7:PIO5
> ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
> ata5.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in
>          res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
> ata5.00: status: { DRDY }
> ata5: soft resetting link
> ata5.00: configured for PIO
> ata5: EH complete
> ata5.00: limiting speed to PIO0
> [...]


Thanks,

Comments

Wang Jian Oct. 10, 2008, 2:14 a.m. UTC | #1
How 8349mITX's compact flash is wired? If it is wired using 8 bit data bus line,
without another patch, data transfer can't be done.

Looking at logs Sam Sparks provided (without irq):

ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)

it seems data transfer failed.

I have a 8 bit data transfer mode dirty hack on pata_platform. I am waiting for
the no irq handling patch goes in and then make my patch more generic.

Anton Vorontsov wrote:
> On Thu, Oct 09, 2008 at 08:52:09AM -0700, Jeff Borlin wrote:
>> I have taken over this effort to get Compact Flash working on the 8349mITX
>> board and am running into these same issues.  I can get uBoot to list the
>> contents of a CF card,
> 
> U-Boot doesn't use interrupts.
> 
>> but am running into a couple problems through the
>> kernel.  There appears to be an IRQ problem and a general communication
>> problem with the CF card, possibly related.  Note that I am very new to
>> Linux so please don't assume obvious things are correct
>>
>> I am using the latest from /linux/kernel/git/benh/powerpc.git, and created
>> my dtb from:  arch/powerpc/dts/mpc8349emitx.dts.  
>>
>> Any ideas on what I could try or look into next with either issue?  
>>
>> boot info:  
>> [...]
> [...]
> 
> This happens just before the PATA information is printed. I'm not
> libata expert; and from the brief look I don't see where libata
> clears any pending "unexpected" irqs. Just a guesswork,
> could you try this patch?
> 
> diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
> index 8f65ad6..3b7c79d 100644
> --- a/drivers/ata/pata_platform.c
> +++ b/drivers/ata/pata_platform.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/blkdev.h>
> +#include <linux/io.h>
>  #include <scsi/scsi_host.h>
>  #include <linux/ata.h>
>  #include <linux/libata.h>
> @@ -171,6 +172,8 @@ int __devinit __pata_platform_probe(struct device *dev,
>  
>  	pata_platform_setup_port(&ap->ioaddr, ioport_shift);
>  
> +	ioread8(ap->ioaddr.status_addr);
> +
>  	ata_port_desc(ap, "%s cmd 0x%llx ctl 0x%llx", mmio ? "mmio" : "ioport",
>  		      (unsigned long long)io_res->start,
>  		      (unsigned long long)ctl_res->start);
> 
> 
>> irq 23: nobody cared (try booting with the "irqpoll" option)
>> Call Trace:
>> [cec29a30] [c00089a4] 0xc00089a4 (unreliable)
>> [cec29a60] [c00467d8] 0xc00467d8
>> [...]
>> Disabling IRQ #23
>> scsi4 : pata_platform
>> ata5: PATA max PIO6 mmio cmd 0xf0000000 ctl 0xf000020c irq 23
>> ata5.00: CFA: SanDisk SDCFJ-512, HDX 3.13, max MWDMA2
>> ata5.00: 1000944 sectors, multi 0: LBA
>> ata5.00: configured for PIO
> 
> Can you check if the CF will work w/o IRQs? To try it:
> 
> 1. open the arch/powerpc/dts/mpc8349emitx.dts file, find the pata node:
> 
>                 pata@3,0 {
>                         compatible = "fsl,mpc8349emitx-pata", "ata-generic";
>                         reg = <0x3 0x0 0x10 0x3 0x20c 0x4>;
>                         reg-shift = <1>;
>                         pio-mode = <6>;
>                         interrupts = <23 0x8>;
>                         interrupt-parent = <&ipic>;
>                 };
> 
> 2. delete interrupts = <>; and interrupt-parent = <>; lines.
> 
> 3. recompile the dts to dtb.
> 
> 4. Apply this patch to the kernel http://lkml.org/lkml/2008/10/6/176
> 
> 5. And try to boot the patched kernel using the re-compiled dtb file.
> 
>> scsi 4:0:0:0: Direct-Access     ATA      SanDisk SDCFJ-51 HDX  PQ: 0 ANSI: 5
>> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
>> sd 4:0:0:0: [sda] Write Protect is off
>> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
>> support DPO or FUA
>> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
>> sd 4:0:0:0: [sda] Write Protect is off
>> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
>> support DPO or FUA
>>  sda:<3>ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
>> ata5.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in
>>          res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
>> ata5.00: status: { DRDY }
>> ata5: soft resetting link
>> ata5.00: configured for PIO
>> ata5: EH complete
>> ata5.00: limiting speed to UDMA7:PIO5
>> ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
>> ata5.00: cmd 20/00:08:00:00:00/00:00:00:00:00/e0 tag 0 pio 4096 in
>>          res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
>> ata5.00: status: { DRDY }
>> ata5: soft resetting link
>> ata5.00: configured for PIO
>> ata5: EH complete
>> ata5.00: limiting speed to PIO0
>> [...]
> 
> 
> Thanks,
>
Jeff Borlin Oct. 10, 2008, 3:27 a.m. UTC | #2
Anton Vorontsov-2 wrote:
> 
> This happens just before the PATA information is printed. I'm not
> libata expert; and from the brief look I don't see where libata
> clears any pending "unexpected" irqs. Just a guesswork,
> could you try this patch?
> 
This patch did not appear to change anything.  


Anton Vorontsov-2 wrote:
> 
> Can you check if the CF will work w/o IRQs? To try it:
> 
Your directions did result in progress:
[...]
scsi4 : pata_platform
ata5: PATA max PIO6 no IRQ, using PIO polling mmio cmd 0xf0000000 ctl
0xf000020c
ata5.00: CFA: SanDisk SDCFJ-512, HDX 3.13, max MWDMA2
ata5.00: 1000944 sectors, multi 0: LBA
ata5.00: configured for PIO
scsi 4:0:0:0: Direct-Access     ATA      SanDisk SDCFJ-51 HDX  PQ: 0 ANSI: 5
sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
sd 4:0:0:0: [sda] Write Protect is off
sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
support DPO or FUA
sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
sd 4:0:0:0: [sda] Write Protect is off
sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
support DPO or FUA
 sda: sda1 sda2
sd 4:0:0:0: [sda] Attached SCSI removable disk
sd 4:0:0:0: Attached scsi generic sg0 type 0
physmap platform flash device: 01000000 at fe000000
[...]
/ # dd if=/dev/sda of=/dev/null count=20000
20000+0 records in
20000+0 records out
/ # mount -t vfat /dev/sda /mnt/cf
mount: Mounting /dev/sda on /mnt/cf failed: Invalid argument
/ # mount -t vfat /dev/sda2 /mnt/cf
mount: Mounting /dev/sda2 on /mnt/cf failed: Invalid argument

I still need to figure out what I may be doing wrong here, but wanted to
post the results I have so far in case they are useful.
Wang Jian Oct. 10, 2008, 7:26 a.m. UTC | #3
Jeff Borlin wrote:
> 
> Anton Vorontsov-2 wrote:
>> This happens just before the PATA information is printed. I'm not
>> libata expert; and from the brief look I don't see where libata
>> clears any pending "unexpected" irqs. Just a guesswork,
>> could you try this patch?
>>
> This patch did not appear to change anything.  

Without this patch, you can't use it without irq.

> Anton Vorontsov-2 wrote:
>> Can you check if the CF will work w/o IRQs? To try it:
>>
> Your directions did result in progress:
> [...]
> scsi4 : pata_platform
> ata5: PATA max PIO6 no IRQ, using PIO polling mmio cmd 0xf0000000 ctl
> 0xf000020c
> ata5.00: CFA: SanDisk SDCFJ-512, HDX 3.13, max MWDMA2
> ata5.00: 1000944 sectors, multi 0: LBA
> ata5.00: configured for PIO
> scsi 4:0:0:0: Direct-Access     ATA      SanDisk SDCFJ-51 HDX  PQ: 0 ANSI: 5
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
>  sda: sda1 sda2
> sd 4:0:0:0: [sda] Attached SCSI removable disk
> sd 4:0:0:0: Attached scsi generic sg0 type 0
> physmap platform flash device: 01000000 at fe000000
> [...]
> / # dd if=/dev/sda of=/dev/null count=20000
> 20000+0 records in
> 20000+0 records out
> / # mount -t vfat /dev/sda /mnt/cf
> mount: Mounting /dev/sda on /mnt/cf failed: Invalid argument
> / # mount -t vfat /dev/sda2 /mnt/cf
> mount: Mounting /dev/sda2 on /mnt/cf failed: Invalid argument
> 
> I still need to figure out what I may be doing wrong here, but wanted to
> post the results I have so far in case they are useful.  

The CF card seems to work fine. See if your kernel supports vfat by

# cat /proc/filesystems

Of course, you need to mount /proc properly first. If your kernel
doesn't support vfat, make it support.

Or you can insert a blank CF card and play with it (ext2, etc)
Anton Vorontsov Oct. 10, 2008, 11:40 a.m. UTC | #4
On Fri, Oct 10, 2008 at 03:26:00PM +0800, Wang Jian wrote:
> Jeff Borlin wrote:
>>
>> Anton Vorontsov-2 wrote:
>>> This happens just before the PATA information is printed. I'm not
>>> libata expert; and from the brief look I don't see where libata
>>> clears any pending "unexpected" irqs. Just a guesswork,
>>> could you try this patch?
>>>
>> This patch did not appear to change anything.  
>
> Without this patch, you can't use it without irq.

I purposed two patches to Jeff: one is

+       ioread8(ap->ioaddr.status_addr);

I.e. clear an interrupt before requesting (just to be sure, I guess
libata is doing this already, just don't see where exactly). That didn't
work. :-/

And another approach was to try IRQ-less pata (another patch).
Anton Vorontsov Oct. 10, 2008, 11:47 a.m. UTC | #5
On Thu, Oct 09, 2008 at 08:27:05PM -0700, Jeff Borlin wrote:
> 
> 
> Anton Vorontsov-2 wrote:
> > 
> > This happens just before the PATA information is printed. I'm not
> > libata expert; and from the brief look I don't see where libata
> > clears any pending "unexpected" irqs. Just a guesswork,
> > could you try this patch?
> > 
> This patch did not appear to change anything.  

:-(

> Anton Vorontsov-2 wrote:
> > 
> > Can you check if the CF will work w/o IRQs? To try it:
> > 
> Your directions did result in progress:
> [...]
> scsi4 : pata_platform
> ata5: PATA max PIO6 no IRQ, using PIO polling mmio cmd 0xf0000000 ctl
> 0xf000020c
> ata5.00: CFA: SanDisk SDCFJ-512, HDX 3.13, max MWDMA2
> ata5.00: 1000944 sectors, multi 0: LBA
> ata5.00: configured for PIO
> scsi 4:0:0:0: Direct-Access     ATA      SanDisk SDCFJ-51 HDX  PQ: 0 ANSI: 5
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
> sd 4:0:0:0: [sda] 1000944 512-byte hardware sectors (512 MB)
> sd 4:0:0:0: [sda] Write Protect is off
> sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't
> support DPO or FUA
>  sda: sda1 sda2
> sd 4:0:0:0: [sda] Attached SCSI removable disk
> sd 4:0:0:0: Attached scsi generic sg0 type 0
> physmap platform flash device: 01000000 at fe000000
> [...]
> / # dd if=/dev/sda of=/dev/null count=20000
> 20000+0 records in
> 20000+0 records out

Ok, it basically works w/o IRQs...

I'll try to find bunch of CF flashes to test, but to my knowledge
they all worked for me on the mitx (i.e. with IRQs)... :-/

If I could find the non-working CF (or non-working mITX board)
I would investigate this...

> / # mount -t vfat /dev/sda /mnt/cf
> mount: Mounting /dev/sda on /mnt/cf failed: Invalid argument
> / # mount -t vfat /dev/sda2 /mnt/cf
> mount: Mounting /dev/sda2 on /mnt/cf failed: Invalid argument

This seems unrelated, either there isn't vfat support enabled in the
kernel, or there is another filesystem on the CF).
Anton Vorontsov Oct. 10, 2008, 12:03 p.m. UTC | #6
On Fri, Oct 10, 2008 at 10:14:17AM +0800, Wang Jian wrote:
> How 8349mITX's compact flash is wired?

FYI, the schematics are openly available.

http://www.freescale.com/files/32bit/hardware_tools/schematics/MPC8349EMITXESCH.pdf?WT_TYPE=Schematics&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Downloads

> If it is wired using 8 bit data bus line,
> without another patch, data transfer can't be done.

It is wired that way:

LBD[7:0]    D[0:7]
LBD[15:8]   D[8:15]
LBA[30..28] A[0..2]

I.e. 16 bits for data.

> Looking at logs Sam Sparks provided (without irq):
>
> ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
>
> it seems data transfer failed.

Well, w/o IRQs everything is OK. I think it's just a bogus message
after the interrupt issues.

Thanks,
diff mbox

Patch

diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 8f65ad6..3b7c79d 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -15,6 +15,7 @@ 
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
+#include <linux/io.h>
 #include <scsi/scsi_host.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
@@ -171,6 +172,8 @@  int __devinit __pata_platform_probe(struct device *dev,
 
 	pata_platform_setup_port(&ap->ioaddr, ioport_shift);
 
+	ioread8(ap->ioaddr.status_addr);
+
 	ata_port_desc(ap, "%s cmd 0x%llx ctl 0x%llx", mmio ? "mmio" : "ioport",
 		      (unsigned long long)io_res->start,
 		      (unsigned long long)ctl_res->start);