summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiangliang Yu <Xiangliang.Yu@amd.com>2015-11-26 15:27:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 01:28:35 +0300
commitb81c867b0b23a949cedca2dc4ac67bdc857062d3 (patch)
tree30b1e194a30391ac6b95b9adc14c0327169e56fb
parent38c3e0d5568453c519ae53e1a67cc7e3501274d7 (diff)
downloadlinux-b81c867b0b23a949cedca2dc4ac67bdc857062d3.tar.xz
AHCI: Fix softreset failed issue of Port Multiplier
commit 023113d24ef9e1d2b44cb2446872b17e2b01d8b1 upstream. Current code doesn't update port value of Port Multiplier(PM) when sending FIS of softreset to device, command will fail if FBS is enabled. There are two ways to fix the issue: the first is to disable FBS before sending softreset command to PM device and the second is to update port value of PM when sending command. For the first way, i can't find any related rule in AHCI Spec. The second way can avoid disabling FBS and has better performance. Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/ata/libahci.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index d256a66158be..98c482ae062e 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1266,6 +1266,15 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
ata_tf_to_fis(tf, pmp, is_cmd, fis);
ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12));
+ /* set port value for softreset of Port Multiplier */
+ if (pp->fbs_enabled && pp->fbs_last_dev != pmp) {
+ tmp = readl(port_mmio + PORT_FBS);
+ tmp &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC);
+ tmp |= pmp << PORT_FBS_DEV_OFFSET;
+ writel(tmp, port_mmio + PORT_FBS);
+ pp->fbs_last_dev = pmp;
+ }
+
/* issue & wait */
writel(1, port_mmio + PORT_CMD_ISSUE);