From patchwork Fri Apr 24 13:44:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 11507909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 124BA1575 for ; Fri, 24 Apr 2020 13:45:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF1F120776 for ; Fri, 24 Apr 2020 13:45:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="DtZIrkwL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:45410 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id DFC044049F; Fri, 24 Apr 2020 13:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1587735904; bh=SPjxNuDzWiud56RftbTam+lOBwj9rLiqknpfyq50zzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=DtZIrkwLnemlp38puCnXFuzpplsedzEhq1AFwnwSmjzFL3R8Eazwg2wuctQBzUGpr emtLbUqiUpV7xVkUc/NIZ8nqEaWq8xImzWUwpUf4vZHx4nssZTJwojEt6fgeCh+n96 04I4vFgA8ofGlUnC4eRF5FeoX4vAR4AzfyEfyBlklZtZBr13hP9mVYZbByDFbuDZy1 GNbM806znl5h2eTj3pF2idJLZawMt1x/9/dLLcoHIbJFmKcK40SovQiz0DPfIR9QWk WnZNDsSIjWO4Qog9eTdl7hYaTkN8RY/L7fTPtYHy6gVkV0JJ7vjc65SNbqDhUCG/Ef J2Dv7De53bw/Q== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id B167DA005C; Fri, 24 Apr 2020 13:45:02 +0000 (UTC) From: Jose Abreu To: linux-scsi@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Joao Lima , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] scsi: ufs: Allow UFS 3.0 as a valid version Date: Fri, 24 Apr 2020 15:44:45 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add a define for UFS version 3.0 and do not print an error message upon probe when using this version. Reviewed-by: Alim Akhtar Signed-off-by: Joao Lima Signed-off-by: Jose Abreu --- Cc: Joao Lima Cc: Jose Abreu Cc: Alim Akhtar Cc: Avri Altman Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/scsi/ufs/ufshcd.c | 3 ++- drivers/scsi/ufs/ufshci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7d1fa1349d40..2e5c200e915b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8441,7 +8441,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) if ((hba->ufs_version != UFSHCI_VERSION_10) && (hba->ufs_version != UFSHCI_VERSION_11) && (hba->ufs_version != UFSHCI_VERSION_20) && - (hba->ufs_version != UFSHCI_VERSION_21)) + (hba->ufs_version != UFSHCI_VERSION_21) && + (hba->ufs_version != UFSHCI_VERSION_30)) dev_err(hba->dev, "invalid UFS version 0x%x\n", hba->ufs_version); diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index c2961d37cc1c..f2ee81669b00 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h @@ -104,6 +104,7 @@ enum { UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */ UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */ UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */ + UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */ }; /* From patchwork Fri Apr 24 13:44:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 11507903 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4ABBF1575 for ; Fri, 24 Apr 2020 13:45:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25C1720776 for ; Fri, 24 Apr 2020 13:45:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="Ph4cWv0I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbgDXNpP (ORCPT ); Fri, 24 Apr 2020 09:45:15 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:45444 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726813AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 00C9E404AE; Fri, 24 Apr 2020 13:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1587735904; bh=uRk0X0rm7KgesI5uQb/AysnrnHYdIYjGBa5Zkq8LlyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Ph4cWv0InLhlTG9JtKHWNcUwOuoz4i3j5s3BwWJ0TX325ixImdVayHvfNmgbBB0YT hYFBKVuoatIZLfi4h6xLsKPVRpZoGRpT+D5yjEg3Z1PsSoTjiTWuhrDEnLa7mk0SUo dkU8lB40+lZzGr6pF+3eqtfMA3W+sXjwYy5K5yvjPlNfx2pq41KJI1Rnnqx8SpRoMa IJiZgSvA74oahoQzCbYxawmgK1zDPfWv/Il4hGs03Cvc2Dk5LOoDJhcHxHEqYMAIA7 gpO2v7DfFlV2KKJG4RG+WiiyS4HIBiMt827amWYtlIvEOc9LBvNUn+pm+1xPR7aH8R PfwWw1skidUhw== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id B7FA5A0063; Fri, 24 Apr 2020 13:45:02 +0000 (UTC) From: Jose Abreu To: linux-scsi@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Joao Lima , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] scsi: ufs: Rename tc-dwc-g210 -> tc-dwc Date: Fri, 24 Apr 2020 15:44:46 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In preparation for the addition of new Synopsys Test Chips versions we remove all G210 mentions in files and Kconfig entries so that we can re-use the same driver for different Test Chips. As the PCI ID for these chips is different and as we will have different DT bindings, there is no reason to add new drivers for them and we can just re-use the existing ones. No functional change. Signed-off-by: Jose Abreu --- Cc: Joao Lima Cc: Jose Abreu Cc: Alim Akhtar Cc: Avri Altman Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/scsi/ufs/Kconfig | 4 +- drivers/scsi/ufs/Makefile | 4 +- .../scsi/ufs/{tc-dwc-g210-pci.c => tc-dwc-pci.c} | 70 +++++++++++----------- .../ufs/{tc-dwc-g210-pltfrm.c => tc-dwc-pltfrm.c} | 37 ++++++------ drivers/scsi/ufs/{tc-dwc-g210.c => tc-dwc.c} | 6 +- drivers/scsi/ufs/{tc-dwc-g210.h => tc-dwc.h} | 6 +- 6 files changed, 64 insertions(+), 63 deletions(-) rename drivers/scsi/ufs/{tc-dwc-g210-pci.c => tc-dwc-pci.c} (60%) rename drivers/scsi/ufs/{tc-dwc-g210-pltfrm.c => tc-dwc-pltfrm.c} (70%) rename drivers/scsi/ufs/{tc-dwc-g210.c => tc-dwc.c} (98%) rename drivers/scsi/ufs/{tc-dwc-g210.h => tc-dwc.h} (78%) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index e2005aeddc2d..d0b73b1dec18 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -62,7 +62,7 @@ config SCSI_UFSHCD_PCI If unsure, say N. config SCSI_UFS_DWC_TC_PCI - tristate "DesignWare pci support using a G210 Test Chip" + tristate "DesignWare PCI support using a Synopsys Test Chip" depends on SCSI_UFSHCD_PCI ---help--- Synopsys Test Chip is a PHY for prototyping purposes. @@ -89,7 +89,7 @@ config SCSI_UFS_CDNS_PLATFORM If unsure, say N. config SCSI_UFS_DWC_TC_PLATFORM - tristate "DesignWare platform support using a G210 Test Chip" + tristate "DesignWare platform support using a Synopsys Test Chip" depends on SCSI_UFSHCD_PLATFORM ---help--- Synopsys Test Chip is a PHY for prototyping purposes. diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index 94c6c5d7334b..2005307b2934 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # UFSHCD makefile -obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o -obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o +obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-pci.o ufshcd-dwc.o tc-dwc.o +obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-pltfrm.o ufshcd-dwc.o tc-dwc.o obj-$(CONFIG_SCSI_UFS_CDNS_PLATFORM) += cdns-pltfrm.o obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o diff --git a/drivers/scsi/ufs/tc-dwc-g210-pci.c b/drivers/scsi/ufs/tc-dwc-pci.c similarity index 60% rename from drivers/scsi/ufs/tc-dwc-g210-pci.c rename to drivers/scsi/ufs/tc-dwc-pci.c index 67a6a61154b7..aeb11f7f0c91 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pci.c +++ b/drivers/scsi/ufs/tc-dwc-pci.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Synopsys G210 Test Chip driver + * Synopsys Test Chip driver * * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com) * @@ -9,7 +9,7 @@ #include "ufshcd.h" #include "ufshcd-dwc.h" -#include "tc-dwc-g210.h" +#include "tc-dwc.h" #include #include @@ -23,27 +23,27 @@ static int tc_type = TC_G210_INV; module_param(tc_type, int, 0); MODULE_PARM_DESC(tc_type, "Test Chip Type (20 = 20-bit, 40 = 40-bit)"); -static int tc_dwc_g210_pci_suspend(struct device *dev) +static int tc_dwc_pci_suspend(struct device *dev) { return ufshcd_system_suspend(dev_get_drvdata(dev)); } -static int tc_dwc_g210_pci_resume(struct device *dev) +static int tc_dwc_pci_resume(struct device *dev) { return ufshcd_system_resume(dev_get_drvdata(dev)); } -static int tc_dwc_g210_pci_runtime_suspend(struct device *dev) +static int tc_dwc_pci_runtime_suspend(struct device *dev) { return ufshcd_runtime_suspend(dev_get_drvdata(dev)); } -static int tc_dwc_g210_pci_runtime_resume(struct device *dev) +static int tc_dwc_pci_runtime_resume(struct device *dev) { return ufshcd_runtime_resume(dev_get_drvdata(dev)); } -static int tc_dwc_g210_pci_runtime_idle(struct device *dev) +static int tc_dwc_pci_runtime_idle(struct device *dev) { return ufshcd_runtime_idle(dev_get_drvdata(dev)); } @@ -51,26 +51,26 @@ static int tc_dwc_g210_pci_runtime_idle(struct device *dev) /* * struct ufs_hba_dwc_vops - UFS DWC specific variant operations */ -static struct ufs_hba_variant_ops tc_dwc_g210_pci_hba_vops = { - .name = "tc-dwc-g210-pci", +static struct ufs_hba_variant_ops tc_dwc_pci_hba_vops = { + .name = "tc-dwc-pci", .link_startup_notify = ufshcd_dwc_link_startup_notify, }; /** - * tc_dwc_g210_pci_shutdown - main function to put the controller in reset state + * tc_dwc_pci_shutdown - main function to put the controller in reset state * @pdev: pointer to PCI device handle */ -static void tc_dwc_g210_pci_shutdown(struct pci_dev *pdev) +static void tc_dwc_pci_shutdown(struct pci_dev *pdev) { ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev)); } /** - * tc_dwc_g210_pci_remove - de-allocate PCI/SCSI host and host memory space + * tc_dwc_pci_remove - de-allocate PCI/SCSI host and host memory space * data structure memory * @pdev: pointer to PCI handle */ -static void tc_dwc_g210_pci_remove(struct pci_dev *pdev) +static void tc_dwc_pci_remove(struct pci_dev *pdev) { struct ufs_hba *hba = pci_get_drvdata(pdev); @@ -80,14 +80,14 @@ static void tc_dwc_g210_pci_remove(struct pci_dev *pdev) } /** - * tc_dwc_g210_pci_probe - probe routine of the driver + * tc_dwc_pci_probe - probe routine of the driver * @pdev: pointer to PCI device handle * @id: PCI device id * * Returns 0 on success, non-zero value on failure */ static int -tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +tc_dwc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct ufs_hba *hba; void __iomem *mmio_base; @@ -95,10 +95,10 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Check Test Chip type and set the specific setup routine */ if (tc_type == TC_G210_20BIT) { - tc_dwc_g210_pci_hba_vops.phy_initialization = + tc_dwc_pci_hba_vops.phy_initialization = tc_dwc_g210_config_20_bit; } else if (tc_type == TC_G210_40BIT) { - tc_dwc_g210_pci_hba_vops.phy_initialization = + tc_dwc_pci_hba_vops.phy_initialization = tc_dwc_g210_config_40_bit; } else { dev_err(&pdev->dev, "test chip version not specified\n"); @@ -127,7 +127,7 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return err; } - hba->vops = &tc_dwc_g210_pci_hba_vops; + hba->vops = &tc_dwc_pci_hba_vops; err = ufshcd_init(hba, mmio_base, pdev->irq); if (err) { @@ -142,35 +142,35 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return 0; } -static const struct dev_pm_ops tc_dwc_g210_pci_pm_ops = { - .suspend = tc_dwc_g210_pci_suspend, - .resume = tc_dwc_g210_pci_resume, - .runtime_suspend = tc_dwc_g210_pci_runtime_suspend, - .runtime_resume = tc_dwc_g210_pci_runtime_resume, - .runtime_idle = tc_dwc_g210_pci_runtime_idle, +static const struct dev_pm_ops tc_dwc_pci_pm_ops = { + .suspend = tc_dwc_pci_suspend, + .resume = tc_dwc_pci_resume, + .runtime_suspend = tc_dwc_pci_runtime_suspend, + .runtime_resume = tc_dwc_pci_runtime_resume, + .runtime_idle = tc_dwc_pci_runtime_idle, }; -static const struct pci_device_id tc_dwc_g210_pci_tbl[] = { +static const struct pci_device_id tc_dwc_pci_tbl[] = { { PCI_VENDOR_ID_SYNOPSYS, 0xB101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_SYNOPSYS, 0xB102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { } /* terminate list */ }; -MODULE_DEVICE_TABLE(pci, tc_dwc_g210_pci_tbl); +MODULE_DEVICE_TABLE(pci, tc_dwc_pci_tbl); -static struct pci_driver tc_dwc_g210_pci_driver = { - .name = "tc-dwc-g210-pci", - .id_table = tc_dwc_g210_pci_tbl, - .probe = tc_dwc_g210_pci_probe, - .remove = tc_dwc_g210_pci_remove, - .shutdown = tc_dwc_g210_pci_shutdown, +static struct pci_driver tc_dwc_pci_driver = { + .name = "tc-dwc-pci", + .id_table = tc_dwc_pci_tbl, + .probe = tc_dwc_pci_probe, + .remove = tc_dwc_pci_remove, + .shutdown = tc_dwc_pci_shutdown, .driver = { - .pm = &tc_dwc_g210_pci_pm_ops + .pm = &tc_dwc_pci_pm_ops }, }; -module_pci_driver(tc_dwc_g210_pci_driver); +module_pci_driver(tc_dwc_pci_driver); MODULE_AUTHOR("Joao Pinto "); -MODULE_DESCRIPTION("Synopsys Test Chip G210 PCI glue driver"); +MODULE_DESCRIPTION("Synopsys Test Chip PCI glue driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c b/drivers/scsi/ufs/tc-dwc-pltfrm.c similarity index 70% rename from drivers/scsi/ufs/tc-dwc-g210-pltfrm.c rename to drivers/scsi/ufs/tc-dwc-pltfrm.c index a1268e4f44d6..7a561ee21586 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c +++ b/drivers/scsi/ufs/tc-dwc-pltfrm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Synopsys G210 Test Chip driver + * Synopsys Test Chip driver * * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com) * @@ -15,7 +15,7 @@ #include "ufshcd-pltfrm.h" #include "ufshcd-dwc.h" -#include "tc-dwc-g210.h" +#include "tc-dwc.h" /* * UFS DWC specific variant operations @@ -32,7 +32,7 @@ static struct ufs_hba_variant_ops tc_dwc_g210_40bit_pltfm_hba_vops = { .phy_initialization = tc_dwc_g210_config_40_bit, }; -static const struct of_device_id tc_dwc_g210_pltfm_match[] = { +static const struct of_device_id tc_dwc_pltfm_match[] = { { .compatible = "snps,g210-tc-6.00-20bit", .data = &tc_dwc_g210_20bit_pltfm_hba_vops, @@ -43,21 +43,21 @@ static const struct of_device_id tc_dwc_g210_pltfm_match[] = { }, { }, }; -MODULE_DEVICE_TABLE(of, tc_dwc_g210_pltfm_match); +MODULE_DEVICE_TABLE(of, tc_dwc_pltfm_match); /** - * tc_dwc_g210_pltfm_probe() + * tc_dwc_pltfm_probe() * @pdev: pointer to platform device structure * */ -static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev) +static int tc_dwc_pltfm_probe(struct platform_device *pdev) { int err; const struct of_device_id *of_id; struct ufs_hba_variant_ops *vops; struct device *dev = &pdev->dev; - of_id = of_match_node(tc_dwc_g210_pltfm_match, dev->of_node); + of_id = of_match_node(tc_dwc_pltfm_match, dev->of_node); vops = (struct ufs_hba_variant_ops *)of_id->data; /* Perform generic probe */ @@ -69,11 +69,11 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev) } /** - * tc_dwc_g210_pltfm_remove() + * tc_dwc_pltfm_remove() * @pdev: pointer to platform device structure * */ -static int tc_dwc_g210_pltfm_remove(struct platform_device *pdev) +static int tc_dwc_pltfm_remove(struct platform_device *pdev) { struct ufs_hba *hba = platform_get_drvdata(pdev); @@ -83,7 +83,7 @@ static int tc_dwc_g210_pltfm_remove(struct platform_device *pdev) return 0; } -static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = { +static const struct dev_pm_ops tc_dwc_pltfm_pm_ops = { .suspend = ufshcd_pltfrm_suspend, .resume = ufshcd_pltfrm_resume, .runtime_suspend = ufshcd_pltfrm_runtime_suspend, @@ -91,20 +91,21 @@ static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = { .runtime_idle = ufshcd_pltfrm_runtime_idle, }; -static struct platform_driver tc_dwc_g210_pltfm_driver = { - .probe = tc_dwc_g210_pltfm_probe, - .remove = tc_dwc_g210_pltfm_remove, +static struct platform_driver tc_dwc_pltfm_driver = { + .probe = tc_dwc_pltfm_probe, + .remove = tc_dwc_pltfm_remove, .shutdown = ufshcd_pltfrm_shutdown, .driver = { - .name = "tc-dwc-g210-pltfm", - .pm = &tc_dwc_g210_pltfm_pm_ops, - .of_match_table = of_match_ptr(tc_dwc_g210_pltfm_match), + .name = "tc-dwc-pltfm", + .pm = &tc_dwc_pltfm_pm_ops, + .of_match_table = of_match_ptr(tc_dwc_pltfm_match), }, }; -module_platform_driver(tc_dwc_g210_pltfm_driver); +module_platform_driver(tc_dwc_pltfm_driver); MODULE_ALIAS("platform:tc-dwc-g210-pltfm"); -MODULE_DESCRIPTION("Synopsys Test Chip G210 platform glue driver"); +MODULE_ALIAS("platform:tc-dwc-pltfm"); +MODULE_DESCRIPTION("Synopsys Test Chip platform glue driver"); MODULE_AUTHOR("Joao Pinto "); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/scsi/ufs/tc-dwc-g210.c b/drivers/scsi/ufs/tc-dwc.c similarity index 98% rename from drivers/scsi/ufs/tc-dwc-g210.c rename to drivers/scsi/ufs/tc-dwc.c index f954a68f6b4c..d67b5b4b4b17 100644 --- a/drivers/scsi/ufs/tc-dwc-g210.c +++ b/drivers/scsi/ufs/tc-dwc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Synopsys G210 Test Chip driver + * Synopsys Test Chip driver * * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com) * @@ -12,7 +12,7 @@ #include "ufshcd-dwc.h" #include "ufshci-dwc.h" -#include "tc-dwc-g210.h" +#include "tc-dwc.h" /** * tc_dwc_g210_setup_40bit_rmmi() @@ -313,5 +313,5 @@ int tc_dwc_g210_config_20_bit(struct ufs_hba *hba) EXPORT_SYMBOL(tc_dwc_g210_config_20_bit); MODULE_AUTHOR("Joao Pinto "); -MODULE_DESCRIPTION("Synopsys G210 Test Chip driver"); +MODULE_DESCRIPTION("Synopsys Test Chip driver"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/scsi/ufs/tc-dwc-g210.h b/drivers/scsi/ufs/tc-dwc.h similarity index 78% rename from drivers/scsi/ufs/tc-dwc-g210.h rename to drivers/scsi/ufs/tc-dwc.h index 5a506da03f4a..e3c28a21a993 100644 --- a/drivers/scsi/ufs/tc-dwc-g210.h +++ b/drivers/scsi/ufs/tc-dwc.h @@ -1,14 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Synopsys G210 Test Chip driver + * Synopsys Test Chip driver * * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com) * * Authors: Joao Pinto */ -#ifndef _TC_DWC_G210_H -#define _TC_DWC_G210_H +#ifndef _TC_DWC_H +#define _TC_DWC_H int tc_dwc_g210_config_40_bit(struct ufs_hba *hba); int tc_dwc_g210_config_20_bit(struct ufs_hba *hba); From patchwork Fri Apr 24 13:44:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 11507905 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB71B1575 for ; Fri, 24 Apr 2020 13:45:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E63E2166E for ; Fri, 24 Apr 2020 13:45:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="KWXwb1gY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbgDXNpR (ORCPT ); Fri, 24 Apr 2020 09:45:17 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:45454 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 0C251404B6; Fri, 24 Apr 2020 13:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1587735904; bh=JwK+rd4eKzzIt8cqna9j4dEcQEMTpAfxKj9SeaP4h+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=KWXwb1gYt4ioueSNvprp50XXuY8d/bJRxuoP07/XWsJGckluZ+4N4tO9gCDT7iDtt npTy/BGkFcHyJWQPs8+I1Zvx0SAoYZTnghsG1RHXqaQR/aSopzd4H1tphyVsDyqQx2 gQZqbrLSn309II6mNokyhxPQCUy2/i3CnnGqBKUT/2+I35XO+7CTKZU6xmfEWYT2yO jwnbHQgC4HbR0dbOsgXW5YN0Af5560Rm/SlLHzb/dWF2sI1yYmCxZDMTIv755t6uRK Tjb6X19IVEQuT07IV0gb7RrrTZXnwL3lahrQYkafeC5fxvASMFc0IDkHTyyB++NA18 ZzF5TcB09RZnQ== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id CAF60A0067; Fri, 24 Apr 2020 13:45:02 +0000 (UTC) From: Jose Abreu To: linux-scsi@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Joao Lima , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] scsi: ufs: tc-dwc-pci: Use PDI ID to match Test Chip type Date: Fri, 24 Apr 2020 15:44:47 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In preparation for the addition of new Test Chips, we re-arrange the initialization sequence so that we rely on PCI ID to match for given Test Chip type. Signed-off-by: Jose Abreu --- Cc: Joao Lima Cc: Jose Abreu Cc: Alim Akhtar Cc: Avri Altman Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/scsi/ufs/tc-dwc-pci.c | 68 ++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/ufs/tc-dwc-pci.c b/drivers/scsi/ufs/tc-dwc-pci.c index aeb11f7f0c91..74a2d80d32bd 100644 --- a/drivers/scsi/ufs/tc-dwc-pci.c +++ b/drivers/scsi/ufs/tc-dwc-pci.c @@ -14,6 +14,11 @@ #include #include +struct tc_dwc_data { + struct ufs_hba_variant_ops ops; + int (*setup)(struct pci_dev *pdev, struct tc_dwc_data *data); +}; + /* Test Chip type expected values */ #define TC_G210_20BIT 20 #define TC_G210_40BIT 40 @@ -23,6 +28,20 @@ static int tc_type = TC_G210_INV; module_param(tc_type, int, 0); MODULE_PARM_DESC(tc_type, "Test Chip Type (20 = 20-bit, 40 = 40-bit)"); +static int tc_dwc_g210_set_config(struct pci_dev *pdev, struct tc_dwc_data *data) +{ + if (tc_type == TC_G210_20BIT) { + data->ops.phy_initialization = tc_dwc_g210_config_20_bit; + } else if (tc_type == TC_G210_40BIT) { + data->ops.phy_initialization = tc_dwc_g210_config_40_bit; + } else { + dev_err(&pdev->dev, "test chip version not specified\n"); + return -EPERM; + } + + return 0; +} + static int tc_dwc_pci_suspend(struct device *dev) { return ufshcd_system_suspend(dev_get_drvdata(dev)); @@ -48,14 +67,6 @@ static int tc_dwc_pci_runtime_idle(struct device *dev) return ufshcd_runtime_idle(dev_get_drvdata(dev)); } -/* - * struct ufs_hba_dwc_vops - UFS DWC specific variant operations - */ -static struct ufs_hba_variant_ops tc_dwc_pci_hba_vops = { - .name = "tc-dwc-pci", - .link_startup_notify = ufshcd_dwc_link_startup_notify, -}; - /** * tc_dwc_pci_shutdown - main function to put the controller in reset state * @pdev: pointer to PCI device handle @@ -89,22 +100,11 @@ static void tc_dwc_pci_remove(struct pci_dev *pdev) static int tc_dwc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct ufs_hba *hba; + struct tc_dwc_data *data = (struct tc_dwc_data *)id->driver_data; void __iomem *mmio_base; + struct ufs_hba *hba; int err; - /* Check Test Chip type and set the specific setup routine */ - if (tc_type == TC_G210_20BIT) { - tc_dwc_pci_hba_vops.phy_initialization = - tc_dwc_g210_config_20_bit; - } else if (tc_type == TC_G210_40BIT) { - tc_dwc_pci_hba_vops.phy_initialization = - tc_dwc_g210_config_40_bit; - } else { - dev_err(&pdev->dev, "test chip version not specified\n"); - return -EPERM; - } - err = pcim_enable_device(pdev); if (err) { dev_err(&pdev->dev, "pcim_enable_device failed\n"); @@ -127,7 +127,16 @@ tc_dwc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return err; } - hba->vops = &tc_dwc_pci_hba_vops; + /* Check Test Chip type and set the specific setup routine */ + if (data && data->setup) { + err = data->setup(pdev, data); + if (err) + return err; + } else { + return -ENOENT; + } + + hba->vops = &data->ops; err = ufshcd_init(hba, mmio_base, pdev->irq); if (err) { @@ -150,9 +159,20 @@ static const struct dev_pm_ops tc_dwc_pci_pm_ops = { .runtime_idle = tc_dwc_pci_runtime_idle, }; +static struct tc_dwc_data tc_dwc_g210_data = { + .setup = tc_dwc_g210_set_config, + .ops = { + .name = "tc-dwc-g210-pci", + .link_startup_notify = ufshcd_dwc_link_startup_notify, + }, +}; + +#define PCI_DEVICE_ID_SYNOPSYS_TC_G210_1 0xB101 +#define PCI_DEVICE_ID_SYNOPSYS_TC_G210_2 0xB102 + static const struct pci_device_id tc_dwc_pci_tbl[] = { - { PCI_VENDOR_ID_SYNOPSYS, 0xB101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_SYNOPSYS, 0xB102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_DEVICE_DATA(SYNOPSYS, TC_G210_1, &tc_dwc_g210_data) }, + { PCI_DEVICE_DATA(SYNOPSYS, TC_G210_2, &tc_dwc_g210_data) }, { } /* terminate list */ }; From patchwork Fri Apr 24 13:44:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 11507901 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C699D92A for ; Fri, 24 Apr 2020 13:45:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEDB52087E for ; Fri, 24 Apr 2020 13:45:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="CcR/fbO+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbgDXNpF (ORCPT ); Fri, 24 Apr 2020 09:45:05 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:45434 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726806AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 16AFF404B8; Fri, 24 Apr 2020 13:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1587735904; bh=ydPoZRUelRe6CU9Hp1tIyZfCVvTrM8j0ovTLVduK/no=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=CcR/fbO+1ynLZ+XgLl9RKEwMBPx3k2p+IozSw0SuIipGu7/WSWhsSetuXK4B/J3Px 6PMVkh0O6dlv+7IDAwcl0pw03IytWG4dvGybSv/8zvMuaEWtM1w+f/8sc+q/7Z6Vdf flJMUOqywAlxpBX2WThzcKVQS0Pfa7oRB86eI/6ocA8mj+u6Lr2NKw891yQS6JO6AI lqmItRU/XhIboGanh2n3/gowCnldmkn7UuUXm1LcIMLuZyZDvru2Ozhnt88a3DrfAD 1VRN5yNJaK6ErApH4tQwgvxrIljPZexHJMJgJ3qNHVRP7y1XKEzc3PM5YrVA8B9HrJ Ha3ZtWrPrIf7w== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id D1994A006C; Fri, 24 Apr 2020 13:45:02 +0000 (UTC) From: Jose Abreu To: linux-scsi@vger.kernel.org Cc: Joao Pinto , Jose Abreu , "Winkler, Tomas" , Joao Lima , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] scsi: ufs: tc-dwc-pci: Allow for MSI interrupt type Date: Fri, 24 Apr 2020 15:44:48 +0200 Message-Id: <05ba98b7a98520e3ac3884037ee481da460d0dcc.1587735561.git.Jose.Abreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Newer Test Chips boards have MSI support. It does no harm to try to request it as the function will fallback to legacy interrupts if MSI is not supported. Signed-off-by: Jose Abreu --- Changes from v1: - Do not try to request MSIX vectors (Tomas) - Add missing call to pci_free_irq_vectors() (Tomas) Cc: "Winkler, Tomas" Cc: Joao Lima Cc: Jose Abreu Cc: Alim Akhtar Cc: Avri Altman Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/scsi/ufs/tc-dwc-pci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/tc-dwc-pci.c b/drivers/scsi/ufs/tc-dwc-pci.c index 74a2d80d32bd..78dc6c484e84 100644 --- a/drivers/scsi/ufs/tc-dwc-pci.c +++ b/drivers/scsi/ufs/tc-dwc-pci.c @@ -88,6 +88,7 @@ static void tc_dwc_pci_remove(struct pci_dev *pdev) pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); ufshcd_remove(hba); + pci_free_irq_vectors(pdev); } /** @@ -136,11 +137,18 @@ tc_dwc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) return -ENOENT; } + err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY | PCI_IRQ_MSI); + if (err < 0) { + dev_err(&pdev->dev, "Allocation failed\n"); + return err; + } + hba->vops = &data->ops; - err = ufshcd_init(hba, mmio_base, pdev->irq); + err = ufshcd_init(hba, mmio_base, pci_irq_vector(pdev, 0)); if (err) { dev_err(&pdev->dev, "Initialization failed\n"); + pci_free_irq_vectors(pdev); return err; } From patchwork Fri Apr 24 13:44:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 11507907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E30D992A for ; Fri, 24 Apr 2020 13:45:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C28CC2168B for ; Fri, 24 Apr 2020 13:45:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="OTA05kRr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgDXNpQ (ORCPT ); Fri, 24 Apr 2020 09:45:16 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:45458 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727039AbgDXNpE (ORCPT ); Fri, 24 Apr 2020 09:45:04 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 2424E404BA; Fri, 24 Apr 2020 13:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1587735904; bh=t1u/b9URLHxzkXkdDqsLLKlZ2VysHQq+blYp3IVJB48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=OTA05kRrzzsVQQxWr7A0imT0RKZK8GWjYnRZxzkYHZp+W57Wo+jfPyRZ4JKYqHk5w vL/ExVV0pr3HiAo/+7y/ovocBqGtRc4aF8V0P8uMtjwWtRbzNELCJ8ixvwCsuZpccj Y5Z1w04GDVx17DTJHjBWn5FxF9pVnjnowLwnRU5CPrxSHZGmWpjqEZpq573aKbkc81 U8cgjcSO197f2daKtlMcFFEbP9BP+YgQP+DhXEC1VKEAG3fXk4e9Dzz7QLoAzT4iLf 3I3/DgVjN6s0RPxUOhkxwfmQAoDVPkEXuY0GlOaf+a0WLKcupCXmQ4KWd6KQ7o5q7e mttiyz7GnAqIg== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id D7DA1A0070; Fri, 24 Apr 2020 13:45:02 +0000 (UTC) From: Jose Abreu To: linux-scsi@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Joao Lima , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] MAINTAINERS: Change Maintainers for SCSI UFS DWC Drivers Date: Fri, 24 Apr 2020 15:44:49 +0200 Message-Id: <87a6895ad799438b96682f18756b50ab081cf00d.1587735561.git.Jose.Abreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Pedro Sousa is no longer with Synopsys. Joao Lima and me have been working internally with our UFS Controller so we are able to help and we are volunteering as Maintainers for UFS DWC Drivers. Signed-off-by: Jose Abreu --- Cc: Joao Lima Cc: Jose Abreu Cc: linux-kernel@vger.kernel.org --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index e64e5db31497..61c6579e7d80 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17307,7 +17307,8 @@ F: Documentation/scsi/ufs.rst F: drivers/scsi/ufs/ UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS -M: Pedro Sousa +M: Joao Lima +M: Jose Abreu L: linux-scsi@vger.kernel.org S: Supported F: drivers/scsi/ufs/*dwc*