Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbbKZH2a (ORCPT ); Thu, 26 Nov 2015 02:28:30 -0500 Received: from mail-bn1on0059.outbound.protection.outlook.com ([157.56.110.59]:8288 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752151AbbKZH2Z (ORCPT ); Thu, 26 Nov 2015 02:28:25 -0500 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=permerror action=none header.from=amd.com; X-WSS-ID: 0NYEVF9-07-F3E-02 X-M-MSG: From: Xiangliang Yu To: , , CC: , Xiangliang Yu Subject: [PATCH 1/1] AHCI: Fix softreset failed issue of Port Multiplier Date: Thu, 26 Nov 2015 20:27:02 +0800 Message-ID: <1448540822-24175-1-git-send-email-Xiangliang.Yu@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(229853001)(50226001)(105586002)(106466001)(586003)(92566002)(97736004)(5003600100002)(5001770100001)(87936001)(5003940100001)(77096005)(47776003)(48376002)(101416001)(50466002)(2201001)(53416004)(86362001)(50986999)(5008740100001)(1220700001)(1096002)(36756003)(19580395003)(19580405001)(11100500001)(189998001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR12MB0855;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0855;2:p7CAev2XxJ06n1c9y3aq49HUUM6iJUNjGQIGk7BnbMU07Vc4ozK9TZHZR1HDgfQItyInVYsSpk5CLshcu+eK1aKzNEusUx9+tWdImed6Q0SP71Te1/GM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mFirdgrig0prIGo6Qy1nDMB96dI53xQ4muidamDH54weFtADwNByOAQkH0BJVcuAWGdHD4Lln0DOY/xuWSfn+EcC316MY;4:oJWpg3YMe72SpXIxDb3jQjFmHSy8/vOXR8UAFXjSWM83HMgPP4eR5+3I/evGAte/B1EuIOZUVtI/y13WqSB9tJQGo8nx9aqW9oMyamud60ilEorNx/mVtI8H+tzv2AhdcZPqQFbS5pLNDAqEhTYo2hkasmWCjuKEC1csnhre1XTMrHM/1kNqtGy2dztpRNQ3esPnqSvTEo/7xigtD+OwHWDl8LcDzd8fqe1ZJUESVt+5Xy9YHNgmYJGGaj191BCAT7gvUTn1DHuH9aWhI78p+AjOjTzR8P75E0EC/XjKcWgY4fdMHtDVVNUgZiHj0iBCNqTf0m4h2i/1Wb4/wsxd7wndIDbUCFnhi4y64YdSdO0GOlEqRu8nIPMLHlF987eEY3C1d0AV0oMHiavw4BQUWICeWFTaeGk89UxFGA3oq/0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001);SRVR:CY1PR12MB0855;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0855; X-Forefront-PRVS: 0772E5DAD5 X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0855;23:VXijEqHVD9Y0f7dphfSgr1qTZly6lysWSOuun/uU2DxmSGxrd/LiVlcjmqqDH45SlDiyJdobkkOLTotm9kxoyyHX2rCG61NBCZjm8HSaLRFgLNjZO1lrm5w4Ex5igy/OMu/jmFB21YQIT8FfTAlB3Y8IHHaORNQUDngXwMzeAN7ejYTecz0cWJcYVNd9JcoA1UVcr0cSG8cpG6tO6MO94wehkCxS/pJIka1ipegdB0B4Uh2xOkvRahpOUVomGyQ6cLc7PfKPwRAlYG9BTJKbQIWt1+5Y7/eInH0vkVue83iCrWAu3W3F7l7EthHJwSbUfTa7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sTPM6faO3wzY/VkC2dqaEEOy8/Mcgj/tTCVNER0AqA+TcTMvpUnxKVgjaeFEaibst6XtMtNdWjlVeyOkU+TLVFQpOOeWnK0 SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2015 07:28:22.4005 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0855 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1536 Lines: 44 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 --- drivers/ata/libahci.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 096064c..4665512 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -1273,6 +1273,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); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/