Linux-MIPS Archive on lore.kernel.org
 help / Atom feed
* Loongson 2F IDE/ATA broken with lemote2f_defconfig
@ 2019-01-06 12:46 Aaro Koskinen
  2019-01-12 15:26 ` Aaro Koskinen
  0 siblings, 1 reply; 3+ messages in thread
From: Aaro Koskinen @ 2019-01-06 12:46 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Jens Axboe, linux-ide, linux-mips

Hi,

Commit 7ff7a5b1bfff ("MIPS: lemote2f_defconfig: Convert to use libata
PATA drivers") switched from IDE to libata PATA on Loongson 2F, but
neither PATA_AMD or PATA_CS5536 work well on this platform compared
to the AMD74XX IDE driver.

During the ATA init/probe there is interrupt storm from irq 14, and
majority of system boots end up with "nobody cared... IRQ disabled".
So the result is a very slow disk access.

It seems that the interrupt gets crazy after the port freeze done early
during the init, and for whatever reason it cannot be cleared.

With the below workaround I was able to boot the system normally. I
guess that rather than going back to old IDE driver, we should just try
to make pata_cs5536 work (and forget PATA AMD on this board)...?

A.

...

diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index dc1255294628..71e485547ee8 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -229,6 +229,16 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 	cs5536_write(pdev, ETC, etc);
 }
 
+static void cs5536_noop_freeze(struct ata_port *ap)
+{
+	/*
+	 * Some CS5536 controllers result in a screaming interrupt if ATA_NIEN
+	 * is manipulated. Leave it alone and just clear pending IRQ.
+	 */
+	ap->ops->sff_check_status(ap);
+	ata_bmdma_irq_clear(ap);
+}
+
 static struct scsi_host_template cs5536_sht = {
 	ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -238,6 +248,7 @@ static struct ata_port_operations cs5536_port_ops = {
 	.cable_detect		= cs5536_cable_detect,
 	.set_piomode		= cs5536_set_piomode,
 	.set_dmamode		= cs5536_set_dmamode,
+	.freeze			= cs5536_noop_freeze,
 };
 
 /**

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

* Re: Loongson 2F IDE/ATA broken with lemote2f_defconfig
  2019-01-06 12:46 Loongson 2F IDE/ATA broken with lemote2f_defconfig Aaro Koskinen
@ 2019-01-12 15:26 ` Aaro Koskinen
  2019-01-14 13:16   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Aaro Koskinen @ 2019-01-12 15:26 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Jens Axboe, linux-ide, linux-mips

Hi,

On Sun, Jan 06, 2019 at 02:46:07PM +0200, Aaro Koskinen wrote:
> Commit 7ff7a5b1bfff ("MIPS: lemote2f_defconfig: Convert to use libata
> PATA drivers") switched from IDE to libata PATA on Loongson 2F, but
> neither PATA_AMD or PATA_CS5536 work well on this platform compared
> to the AMD74XX IDE driver.
> 
> During the ATA init/probe there is interrupt storm from irq 14, and
> majority of system boots end up with "nobody cared... IRQ disabled".
> So the result is a very slow disk access.
> 
> It seems that the interrupt gets crazy after the port freeze done early
> during the init, and for whatever reason it cannot be cleared.
> 
> With the below workaround I was able to boot the system normally. I
> guess that rather than going back to old IDE driver, we should just try
> to make pata_cs5536 work (and forget PATA AMD on this board)...?

Hmm, even with this hack I get ~500 spurious IRQs during the boot.

Also compared to old IDE, there's 33 vs 100 speed difference:

[    3.324000] ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x4ce0 irq 14
[    3.584000] ata1.00: ATA-8: WDC WD1600BEVS-00VAT0, 11.01A11, max UDMA/133
[    3.588000] ata1.00: 312581808 sectors, multi 16: LBA48
[    3.592000] ata1.00: limited to UDMA/33 due to 40-wire cable

[    4.540000] Probing IDE interface ide0...
[    4.992000] hda: WDC WD1600BEVS-00VAT0, ATA DISK drive
[    5.716000] hda: host max PIO5 wanted PIO255(auto-tune) selected PIO4
[    5.716000] hda: UDMA/100 mode selected

A.

> diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
> index dc1255294628..71e485547ee8 100644
> --- a/drivers/ata/pata_cs5536.c
> +++ b/drivers/ata/pata_cs5536.c
> @@ -229,6 +229,16 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev)
>  	cs5536_write(pdev, ETC, etc);
>  }
>  
> +static void cs5536_noop_freeze(struct ata_port *ap)
> +{
> +	/*
> +	 * Some CS5536 controllers result in a screaming interrupt if ATA_NIEN
> +	 * is manipulated. Leave it alone and just clear pending IRQ.
> +	 */
> +	ap->ops->sff_check_status(ap);
> +	ata_bmdma_irq_clear(ap);
> +}
> +
>  static struct scsi_host_template cs5536_sht = {
>  	ATA_BMDMA_SHT(DRV_NAME),
>  };
> @@ -238,6 +248,7 @@ static struct ata_port_operations cs5536_port_ops = {
>  	.cable_detect		= cs5536_cable_detect,
>  	.set_piomode		= cs5536_set_piomode,
>  	.set_dmamode		= cs5536_set_dmamode,
> +	.freeze			= cs5536_noop_freeze,
>  };
>  
>  /**

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

* Re: Loongson 2F IDE/ATA broken with lemote2f_defconfig
  2019-01-12 15:26 ` Aaro Koskinen
@ 2019-01-14 13:16   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-01-14 13:16 UTC (permalink / raw)
  To: Aaro Koskinen, linux-mips; +Cc: Jens Axboe, linux-ide


Hi,

On 01/12/2019 04:26 PM, Aaro Koskinen wrote:
> Hi,
> 
> On Sun, Jan 06, 2019 at 02:46:07PM +0200, Aaro Koskinen wrote:
>> Commit 7ff7a5b1bfff ("MIPS: lemote2f_defconfig: Convert to use libata
>> PATA drivers") switched from IDE to libata PATA on Loongson 2F, but
>> neither PATA_AMD or PATA_CS5536 work well on this platform compared
>> to the AMD74XX IDE driver.

Sorry about that.

>> During the ATA init/probe there is interrupt storm from irq 14, and
>> majority of system boots end up with "nobody cared... IRQ disabled".
>> So the result is a very slow disk access.
>>
>> It seems that the interrupt gets crazy after the port freeze done early
>> during the init, and for whatever reason it cannot be cleared.
>>
>> With the below workaround I was able to boot the system normally. I
>> guess that rather than going back to old IDE driver, we should just try
>> to make pata_cs5536 work (and forget PATA AMD on this board)...?
> 
> Hmm, even with this hack I get ~500 spurious IRQs during the boot.
> 
> Also compared to old IDE, there's 33 vs 100 speed difference:
> 
> [    3.324000] ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x4ce0 irq 14
> [    3.584000] ata1.00: ATA-8: WDC WD1600BEVS-00VAT0, 11.01A11, max UDMA/133
> [    3.588000] ata1.00: 312581808 sectors, multi 16: LBA48
> [    3.592000] ata1.00: limited to UDMA/33 due to 40-wire cable
> 
> [    4.540000] Probing IDE interface ide0...
> [    4.992000] hda: WDC WD1600BEVS-00VAT0, ATA DISK drive
> [    5.716000] hda: host max PIO5 wanted PIO255(auto-tune) selected PIO4
> [    5.716000] hda: UDMA/100 mode selected

Can you try booting with "libata.force=1:80c" (and if that doesn't work with
"libata.force=1:short40c") and also provide full dmesg-s for working (ide) and
not working (libata) kernels.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-06 12:46 Loongson 2F IDE/ATA broken with lemote2f_defconfig Aaro Koskinen
2019-01-12 15:26 ` Aaro Koskinen
2019-01-14 13:16   ` Bartlomiej Zolnierkiewicz

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox