Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750940AbdCNL7j (ORCPT ); Tue, 14 Mar 2017 07:59:39 -0400 Received: from mail-sn1nam02on0068.outbound.protection.outlook.com ([104.47.36.68]:61982 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750771AbdCNL7h (ORCPT ); Tue, 14 Mar 2017 07:59:37 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Anurag Kumar Vulisha To: Tejun Heo , Hans de Goede CC: , , , Anurag Kumar Vulisha Subject: [RFC PATCH] drivers: ata: Add [save|restore]_initial_config override functions Date: Tue, 14 Mar 2017 17:29:21 +0530 Message-ID: <1489492761-815-1-git-send-email-anuragku@xilinx.com> X-Mailer: git-send-email 2.1.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22940.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(39410400002)(39860400002)(39450400003)(39840400002)(39850400002)(2980300002)(438002)(199003)(189002)(9170700003)(33646002)(106466001)(63266004)(8936002)(2906002)(103686003)(50226002)(189998001)(52956003)(8676002)(81166006)(50986999)(36756003)(90966002)(42186005)(5660300001)(4326008)(305945005)(356003)(45336002)(107886003)(6266002)(54906002)(38730400002)(46386002)(47776003)(48376002)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR02MB1380;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT016;1:GBcJN0OOo9e0O7jkOXugW10IM+olc5qJIsjoRibfr9FKpla+3V4ArQP9qpWAICkzCiT1hjj2QwqGqhhSUOhvluTd5mzpb8fB9iDgeOn39+Lih87OMk2zpoH0TpkPxEnIIuici2soDjaDHcN9V3RqUZUz80Z8B7FgJxkAW1EbA6AB4CDWm7At4vZXoVY3cc1l/poLHiJv7DIAggafVlsdfsN3h0j3/rbOHXJ0/PmLJ3QqkTrs4aaT2IM0pytk9z+lHJDbTiHv1gDyNfLLt9k/OQRx96wz6Y/AWpannBC+tUBZPpaQjSC7Upy6g2RHlkbm4q1ugSKezHbRuhDxp2j5rVVLnQJvZgN1NOqzo62JeEt7CJ0iEERgUnbNp8qXYaWfGA2CN+xtomPUAJtfYgWcM1Kg9f/NP44+z2YpOAP0RskVpu/j1LB5PMPgfh68ULL0SmaOJRATa+OBdVg9RdhtDquUyhWn0wsGAP/eiphmN+/WNAu7tMMEAjKXouZC9UdNzWzOoZ4DTA18k5WT7/8rk0c0h0iw2popH8T8YOivdhxuBpU9gBRTD2AZ7/Ypdia6u8Pm6Od0HAIPGMINY0fleA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0861ae4f-a530-450b-d360-08d46ad1910d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:BY2PR02MB1380; X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1380;3:rx2+UrQ/oZwLY8qkulJnPqS4UylQdOk3c7QsS2JUke5bC5YAJOll9olSvxvtMXuGjN24G0T4PneFePsXeULXTt7QqvRW59yP65ob9oJ33ZlJkDQPhDFa4iAieJn8wuIYcnDrpQdhz2MJh2d/XD3eXwma/fN/0jnsIZ1u69qUwhNJzkKU3TI05UxLl2ocDhEWaijHbTwc+/jqkzb24KuUwtWbJZsfFXvMJdw8f0k/ZJ6eDWF761t6bwt1N8lQvFCgkVNCVOsA02yPMW6fwz9qNyg575bVaDj4LjPo/cr/aS5u1Cftwv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CivOBcJJSi8vZK8Mwrb6iRpZYhzF55Bzwon2i7FIggqIQRQAsT/uS1ijgzHBIwKRkpQL0fXBo/rnN9+XTElWl3TlYIngVefCW99SGiDu870a5IySYO7GUnWbVhTS1j9oiZQgQoucxTK/xJvANgi6Ut/Cc8cCii55mPxIJ66zWkPRlgKfXSHtnVurBPDiqVXijynSdXxC/u4lIal945++9P2fkp3C8aNvNTgWLiQbx6nvVmIXtpuxgKoKTCYg27EruOfoIlpnwLZ157qWC9WDfVpfLLLZ48cl6XZbBuTV6EdcexUUpgptKPjBzNmUOVdgB/bIiHjrHu1AXEqS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13015025)(5005006)(8121501046)(13017025)(13018025)(13023025)(13024025)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(20161123558025)(6072148);SRVR:BY2PR02MB1380;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB1380; X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1380;4:EKs3aUQDauwdX7H9i4qNrYMAodhDdMAyFERh3/hwxf5Xjgq8XlnsfUSsRWHA+0xjESySmoSA5RB0k6ZDS6EJea/wgP5hT7GFGRLKFx1u5DbtlCvbwRjpwwlrO6D+RFBws2Brmmlb5F9pawbbbUerqb/U72fP2ONSN8UnuUiSHQ6sv61YLeez19MmI36mujtLbnXKjxPxnZSoUXY+MnDc936RWmp9S3fuTudLKD5vK4Ctg/RMnoIzl3e4uJgDO2r9znU3n9pw0z5GrbkwJpn+Etcor9NnHHypk5hR7MN6hgUWSHb68JwRBr/8frEU2f+Vp6sQ+rgGNutf5wqAImjMIjjEC05V3Or4DXmvkulJcTtCoaJDWekz6aSh23PfHwakjeFg5/b0Nh1joVI1xcB/k4Oju9JnkOQ3LXe1Jy2xk4nx0PNT1G3uwOEhAwAe4eZ4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8MBJmoO9fWYIeuUosrXtJandGxkwSX5H8FP7G18HhmL91fR65ov4FXfTVHQYdJ8cUlWzxrc8VzZzDuZoZmpFrBvtkw3cWaQnVoBRkr29dDQnV2erKPABq5JFw==;24:5EbddWWSkHAAoaHl+kXArzmMyV/6URGFxANzPIkorAka+pgO1LjH+yiQgqw5mRfObcamRadQws/AHDT7sMi/FdEjkqeR8kepZ5ee79T9Bxk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1380;7:gZ0XMigrZvzjfH6YYtUc0PLgKmyxEVJZZPuahdtHBsTRr/2sWb+vF739qnPO6mcuIz3wwdfARzi9QwHd+yF4KrMQ+iiPCmTvYM6B0IYtaELMixE4vfCvVSHpx4uNDLTPE4CzqvhbA6DLQ15Q1QprD+NvDFGOENaPonB3RVZRBJKofxJ6Mc4Ey6PyROixqS5PGfSYsIaF0uCl9jBs7O7D9wDXLypQc1cS+q5xeIASD1INlWpE9psL6x2WWWwGcZXmVDsAvFswFWvr3GZTzDqySfcjy/jY0Ea90XCjUiuhTR0qWnd6VAsZsoHsjHMgzD9Deq4ZzyNKILf5v/yD25I8aQ== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2017 11:59:27.7549 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB1380 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3612 Lines: 103 Since there are SATA controllers that configure vendor specific registers for AXI bus, OOB timing, threshold related settings. These settings may get reset to the default values on resetting the SATA controller. So this patch adds the support for adding [save|restore]_initial_config override functions for saving and restoring controller values from the driver instead of doing it in AHCI stack Signed-off-by: Anurag Kumar Vulisha --- drivers/ata/ahci.c | 5 ++++- drivers/ata/ahci.h | 9 +++++++++ drivers/ata/libahci.c | 5 ++++- drivers/ata/libahci_platform.c | 5 ++++- drivers/ata/sata_highbank.c | 6 ++++-- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 2fc5240..ed76c9e 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -613,7 +613,10 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev, "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); } - ahci_save_initial_config(&pdev->dev, hpriv); + if (hpriv->save_initial_config == NULL) + ahci_save_initial_config(dev, hpriv); + else + hpriv->save_initial_config(dev, hpriv); } static int ahci_pci_reset_controller(struct ata_host *host) diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 5db6ab2..2929e27 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -363,6 +363,15 @@ struct ahci_host_priv { /* only required for per-port MSI(-X) support */ int (*get_irq_vector)(struct ata_host *host, int port); + + /* + * Optional ahci_save_initial_config & ahci_restore_initial_config + * override, if not set then default ahci_save_initial_config and + * ahci_restore_initial_config in libahci.c will be used + */ + void (*save_initial_config)(struct device *dev, + struct ahci_host_priv *hpriv); + void (*restore_initial_config)(struct ata_host *host); }; extern int ahci_ignore_sss; diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 3159f9e..fb57525 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -940,7 +940,10 @@ int ahci_reset_controller(struct ata_host *host) /* Some registers might be cleared on reset. Restore * initial values. */ - ahci_restore_initial_config(host); + if (hpriv->restore_initial_config == NULL) + ahci_restore_initial_config(host); + else + hpriv->restore_initial_config(host); } else dev_info(host->dev, "skipping global host reset\n"); diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index aaa761b..15ba5f8 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -523,7 +523,10 @@ int ahci_platform_init_host(struct platform_device *pdev, /* prepare host */ pi.private_data = (void *)(unsigned long)hpriv->flags; - ahci_save_initial_config(dev, hpriv); + if (hpriv->save_initial_config == NULL) + ahci_save_initial_config(dev, hpriv); + else + hpriv->save_initial_config(dev, hpriv); if (hpriv->cap & HOST_CAP_NCQ) pi.flags |= ATA_FLAG_NCQ; diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c index aafb8cc..61af3c6 100644 --- a/drivers/ata/sata_highbank.c +++ b/drivers/ata/sata_highbank.c @@ -512,8 +512,10 @@ static int ahci_highbank_probe(struct platform_device *pdev) if (rc) return rc; - - ahci_save_initial_config(dev, hpriv); + if (hpriv->save_initial_config == NULL) + ahci_save_initial_config(dev, hpriv); + else + hpriv->save_initial_config(dev, hpriv); /* prepare host */ if (hpriv->cap & HOST_CAP_NCQ) -- 2.1.1