Title: [3938] trunk/drivers/ata/pata_bf54x.c: Fix bug[#3666] and [#3513] Set proper ATA UDMA mode according to sclk.
Revision
3938
Author
sonicz
Date
2007-11-26 20:54:13 -0600 (Mon, 26 Nov 2007)

Log Message

Fix bug[#3666] and [#3513] Set proper ATA UDMA mode according to sclk.

Diffstat

 pata_bf54x.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Modified Paths

Diff

Modified: trunk/drivers/ata/pata_bf54x.c (3937 => 3938)


--- trunk/drivers/ata/pata_bf54x.c	2007-11-26 07:09:03 UTC (rev 3937)
+++ trunk/drivers/ata/pata_bf54x.c	2007-11-27 02:54:13 UTC (rev 3938)
@@ -1437,11 +1437,7 @@
 				| ATA_FLAG_NO_LEGACY,
 		.pio_mask	= 0x1f,	/* pio0-4 */
 		.mwdma_mask	= 0,
-#ifdef CONFIG_PATA_BF54X_DMA
-		.udma_mask	= ATA_UDMA5,
-#else
 		.udma_mask	= 0,
-#endif
 		.port_ops	= &bfin_pata_ops,
 	},
 };
@@ -1515,6 +1511,10 @@
 	int board_idx = 0;
 	struct resource *res;
 	struct ata_host *host;
+#ifdef CONFIG_PATA_BF54X_DMA
+	unsigned int fsclk = get_sclk();
+	int udma_mode = 5;
+#endif
 	const struct ata_port_info *ppi[] =
 		{ &bfin_port_info[board_idx], NULL };
 
@@ -1533,6 +1533,14 @@
 	if (res == NULL)
 		return -EINVAL;
 
+#ifdef CONFIG_PATA_BF54X_DMA
+	bfin_port_info[board_idx].udma_mask = ATA_UDMA5;
+	while (udma_mode > 0 && udma_fsclk[udma_mode] > fsclk) {
+		udma_mode--;
+		bfin_port_info[board_idx].udma_mask >>= 1;
+	}
+#endif
+
 	/*
 	 * Now that that's out of the way, wire up the port..
 	 */
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to