AHCI support Port Multiplier problem.

Message ID loom.20110110T161018-804@post.gmane.org
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Lin Mac Jan. 10, 2011, 3:42 p.m.
Luo Dislo <dislo_b_j <at> yahoo.com.tw> writes:

> Hello,
> This is my company(Faraday) implemented AHCI SATA controller. Our 
> controller is not located at PCI bus, but AHB bus(ARM based platform).
> However, I modify Linux kernel builtin AHCI driver(ahci.c) to replace
> the PCI related code by using platform bus. Just pretty similar way 
> with drivers/ata/ahci_platform.c (Kernel 2.6.35).
> I think the problem happens because libata does not give up, keep on 
> expecting the Port Multiplier Signature when we set CONFIG_SATA_PMP 
> to 1. 
> I know how to fix this problem, just add AHCI_HFLAG_NO_PMP to AHCI_HFLAGS when
I connect hard drive to the
> controller. Meanwhile, when I want to connect the Port Muliplier to my
controller, I need to remove
> I don't think this is a good solution because I have to compile two version of
my code. It does not make sense.
> We set CONFIG_SATA_PMP to 1 and inside the driver code DOES NOT have
AHCI_HFLAG_NO_PMP just means that
> controller support Port Multiplier but the device connecting to the port might
be others type.

We have a similar issue on cns3xxx

Could you try the following patch with CONFIG_SATA_PMP enabled and see if it fix
the issue?
If so, then it would be the same issue.
 drivers/ata/libahci.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ebc08d6..081548f 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1302,10 +1302,15 @@  static int ahci_softreset(struct ata_link *link,
unsigned int *class,
                          unsigned long deadline)
        int pmp = sata_srst_pmp(link);
+       int ret;


-       return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
+       ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
+       if (ret && pmp)
+               return ahci_do_softreset(link, class, 0, deadline,
+                       ahci_check_ready);
+       return ret;