Re: [PATCH #upstream-fixes 1/3] pata_hpt366: fix cable detection,

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I wrote:

pata_hpt366 is strange in that its two channels occupy two PCI
functions and both are primary channels and bit1 of PCI configuration
register 0x5A indicates cable for both channels.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Cc: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>

   Alas, NAK.

If you say that it does work, then the datasheet appears to be wrong, so have my:

Acked-by: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>

Index: work/drivers/ata/pata_hpt366.c
===================================================================
--- work.orig/drivers/ata/pata_hpt366.c
+++ work/drivers/ata/pata_hpt366.c
@@ -211,11 +211,15 @@ static u32 hpt36x_find_mode(struct ata_p
static int hpt36x_cable_detect(struct ata_port *ap)
 {
-    u8 ata66;
     struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+    u8 ata66;
+ /*
+     * Each channel of pata_hpt366 occupies separate PCI function
+     * as the primary channel and bit1 indicates the cable type.
+     */

   No, it doesn't for the secondary channel (which is fucntion 1).

     pci_read_config_byte(pdev, 0x5A, &ata66);
-    if (ata66 & (1 << ap->port_no))
+    if (ata66 & 2)

You need to use (pdev->devfn & 1) as a right shift count instead. Not very sophisticated indeed. :-)

   Well, then I won't have to fix hpt366.c if that's not needed. :-)

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux