Patchwork AHCI support Port Multiplier problem.

login
register
mail settings
Submitter Lin Mac
Date Jan. 10, 2011, 3:42 p.m.
Message ID <loom.20110110T161018-804@post.gmane.org>
Download mbox | patch
Permalink /patch/78165/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

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
> AHCI_HFLAG_NO_PMP from AHCI_HFLAGS. 
> 
> 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
http://www.spinics.net/lists/linux-ide/msg39512.html
http://www.spinics.net/lists/linux-ide/msg39859.html

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(-)

Patch

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;

        DPRINTK("ENTER\n");

-       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;
 }
 EXPORT_SYMBOL_GPL(ahci_do_softreset);