From 3ba23ab3060d1b373b1e51e3cde3f8d3147aa83b Mon Sep 17 00:00:00 2001 From: Yaniv Gardi Date: Wed, 3 Sep 2014 15:31:52 +0300 Subject: [PATCH] phy: relocate and rename phy ufs files This change contains: 1. Relocating the phy ufs files to reside under the phy driver since this is the location of any file that implements the APIs presented in the generic phy framework 2. Renaming ufs-msm-phy*.* files to be phy-qcom-ufs*.* files. Since UFS is not used strictly in a specific set of targets but rather its code is applicable to MSM, APQ, IPQ etc, any mentioning of "msm" in the file name should be changed to "qcom". Also, prefix of "phy-" is the naming convention of platform driver files that reside in the phy driver. 3. As a result of the relocation of files into the phy driver, a new path is created (include/linux/scsi/ufs) and there we expose ufs header files that are being used also from the drivers/scsi/ufs and from drivers/phy as well. Change-Id: Ie5cb47718911ff711d9401a389f56fa508fcddf3 Signed-off-by: Yaniv Gardi --- drivers/phy/Makefile | 3 ++ .../phy-qcom-ufs-qmp-20nm.c} | 4 +-- .../phy-qcom-ufs-qmp-20nm.h} | 2 +- .../phy-qcom-ufs-qmp-28nm.c} | 4 +-- .../phy-qcom-ufs-qmp-28nm.h} | 2 +- .../ufs/ufs-msm-phy.c => phy/phy-qcom-ufs.c} | 2 +- drivers/scsi/ufs/Makefile | 5 +--- drivers/scsi/ufs/debugfs.c | 3 +- drivers/scsi/ufs/debugfs.h | 4 +-- drivers/scsi/ufs/{ufs-msm.c => ufs-qcom.c} | 7 +++-- drivers/scsi/ufs/ufs_quirks.c | 5 ++-- drivers/scsi/ufs/ufs_test.c | 4 +-- drivers/scsi/ufs/ufshcd-pci.c | 2 +- drivers/scsi/ufs/ufshcd-pltfrm.c | 2 +- drivers/scsi/ufs/ufshcd.c | 23 +++++++++++++-- .../linux/phy/phy-qcom-ufs.h | 15 ++++++++-- .../linux/scsi/ufs/ufs-qcom.h | 9 ------ {drivers => include/linux}/scsi/ufs/ufs.h | 0 {drivers => include/linux}/scsi/ufs/ufshcd.h | 29 ++----------------- {drivers => include/linux}/scsi/ufs/unipro.h | 2 -- 20 files changed, 61 insertions(+), 66 deletions(-) rename drivers/{scsi/ufs/ufs-msm-phy-qmp-20nm.c => phy/phy-qcom-ufs-qmp-20nm.c} (98%) rename drivers/{scsi/ufs/ufs-msm-phy-qmp-20nm.h => phy/phy-qcom-ufs-qmp-20nm.h} (99%) rename drivers/{scsi/ufs/ufs-msm-phy-qmp-28nm.c => phy/phy-qcom-ufs-qmp-28nm.c} (99%) rename drivers/{scsi/ufs/ufs-msm-phy-qmp-28nm.h => phy/phy-qcom-ufs-qmp-28nm.h} (99%) rename drivers/{scsi/ufs/ufs-msm-phy.c => phy/phy-qcom-ufs.c} (99%) rename drivers/scsi/ufs/{ufs-msm.c => ufs-qcom.c} (99%) rename drivers/scsi/ufs/ufs-msm-phy.h => include/linux/phy/phy-qcom-ufs.h (97%) rename drivers/scsi/ufs/ufs-msm.h => include/linux/scsi/ufs/ufs-qcom.h (97%) rename {drivers => include/linux}/scsi/ufs/ufs.h (100%) rename {drivers => include/linux}/scsi/ufs/ufshcd.h (96%) rename {drivers => include/linux}/scsi/ufs/unipro.h (99%) diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f3ace083f7de..1a66807207d4 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -4,3 +4,6 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_PHY_MSM_SATA) += phy-msm-sata.o +obj-$(CONFIG_SCSI_UFS_QCOM) += phy-qcom-ufs.o +obj-$(CONFIG_SCSI_UFS_QCOM) += phy-qcom-ufs-qmp-28nm.o +obj-$(CONFIG_SCSI_UFS_QCOM) += phy-qcom-ufs-qmp-20nm.o diff --git a/drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.c b/drivers/phy/phy-qcom-ufs-qmp-20nm.c similarity index 98% rename from drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.c rename to drivers/phy/phy-qcom-ufs-qmp-20nm.c index 243bd40dc45e..954685242dcc 100644 --- a/drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.c +++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.c @@ -22,8 +22,8 @@ #include #include -#include "ufs-msm-phy.h" -#include "ufs-msm-phy-qmp-20nm.h" +#include +#include "phy-qcom-ufs-qmp-20nm.h" #define UFS_PHY_NAME "ufs_phy_qmp_20nm" diff --git a/drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.h b/drivers/phy/phy-qcom-ufs-qmp-20nm.h similarity index 99% rename from drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.h rename to drivers/phy/phy-qcom-ufs-qmp-20nm.h index e33f6d777384..189e0ed5b972 100644 --- a/drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.h +++ b/drivers/phy/phy-qcom-ufs-qmp-20nm.h @@ -15,7 +15,7 @@ #ifndef UFS_QCOM_PHY_QMP_20NM_H_ #define UFS_QCOM_PHY_QMP_20NM_H_ -#include "ufs-msm-phy.h" +#include /* QCOM UFS PHY control registers */ diff --git a/drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.c b/drivers/phy/phy-qcom-ufs-qmp-28nm.c similarity index 99% rename from drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.c rename to drivers/phy/phy-qcom-ufs-qmp-28nm.c index e45532f80567..dd27b4464d3c 100644 --- a/drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.c +++ b/drivers/phy/phy-qcom-ufs-qmp-28nm.c @@ -23,8 +23,8 @@ #include #include -#include "ufs-msm-phy.h" -#include "ufs-msm-phy-qmp-28nm.h" +#include +#include "phy-qcom-ufs-qmp-28nm.h" #define UFS_PHY_NAME "ufs_qcom_phy_qmp_28nm" diff --git a/drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.h b/drivers/phy/phy-qcom-ufs-qmp-28nm.h similarity index 99% rename from drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.h rename to drivers/phy/phy-qcom-ufs-qmp-28nm.h index 1a8bbc7167c7..b406d99fab3d 100644 --- a/drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.h +++ b/drivers/phy/phy-qcom-ufs-qmp-28nm.h @@ -15,7 +15,7 @@ #ifndef UFS_QCOM_PHY_QMP_28NM_H_ #define UFS_QCOM_PHY_QMP_28NM_H_ -#include "ufs-msm-phy.h" +#include /* QCOM UFS PHY control registers */ diff --git a/drivers/scsi/ufs/ufs-msm-phy.c b/drivers/phy/phy-qcom-ufs.c similarity index 99% rename from drivers/scsi/ufs/ufs-msm-phy.c rename to drivers/phy/phy-qcom-ufs.c index 9639b41bca43..4ae15fcfb66b 100644 --- a/drivers/scsi/ufs/ufs-msm-phy.c +++ b/drivers/phy/phy-qcom-ufs.c @@ -22,7 +22,7 @@ #include #include -#include "ufs-msm-phy.h" +#include int ufs_qcom_phy_calibrate(struct ufs_qcom_phy *ufs_qcom_phy, struct ufs_qcom_phy_calibration *tbl_A, diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index d49256aff19b..876877e602f5 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -1,8 +1,5 @@ # UFSHCD makefile -obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-msm.o -obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-msm-phy.o -obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-msm-phy-qmp-28nm.o -obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-msm-phy-qmp-20nm.o +obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o ufs_quirks.o obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o diff --git a/drivers/scsi/ufs/debugfs.c b/drivers/scsi/ufs/debugfs.c index 9309b3bd4b63..f7f4906ce2d3 100644 --- a/drivers/scsi/ufs/debugfs.c +++ b/drivers/scsi/ufs/debugfs.c @@ -19,7 +19,8 @@ #include #include "debugfs.h" -#include "unipro.h" +#include +#include "ufshci.h" enum field_width { BYTE = 1, diff --git a/drivers/scsi/ufs/debugfs.h b/drivers/scsi/ufs/debugfs.h index 17877cfe9bdb..0c481310921c 100644 --- a/drivers/scsi/ufs/debugfs.h +++ b/drivers/scsi/ufs/debugfs.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -21,7 +21,7 @@ #define _UFS_DEBUGFS_H #include -#include "ufshcd.h" +#include #ifdef CONFIG_DEBUG_FS void ufsdbg_add_debugfs(struct ufs_hba *hba); diff --git a/drivers/scsi/ufs/ufs-msm.c b/drivers/scsi/ufs/ufs-qcom.c similarity index 99% rename from drivers/scsi/ufs/ufs-msm.c rename to drivers/scsi/ufs/ufs-qcom.c index 83e1b60a431e..db3940a233e0 100644 --- a/drivers/scsi/ufs/ufs-msm.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -24,9 +24,10 @@ #include #include -#include "ufshcd.h" -#include "ufs-msm.h" -#include "ufs-msm-phy.h" +#include +#include +#include +#include "ufshci.h" static int ufs_qcom_get_speed_mode(struct ufs_pa_layer_attr *p, char *result); static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host, diff --git a/drivers/scsi/ufs/ufs_quirks.c b/drivers/scsi/ufs/ufs_quirks.c index 869c877f7f23..04197c61bdc2 100644 --- a/drivers/scsi/ufs/ufs_quirks.c +++ b/drivers/scsi/ufs/ufs_quirks.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. +/* + * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -10,7 +11,7 @@ * GNU General Public License for more details. */ -#include "ufshcd.h" +#include #include "ufs_quirks.h" diff --git a/drivers/scsi/ufs/ufs_test.c b/drivers/scsi/ufs/ufs_test.c index 34e6de229c55..15a766c17f17 100644 --- a/drivers/scsi/ufs/ufs_test.c +++ b/drivers/scsi/ufs/ufs_test.c @@ -23,8 +23,8 @@ #include #include #include -#include "ufshcd.h" -#include "ufs.h" +#include +#include #define MODULE_NAME "ufs_test" diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index f5e66c7f0f12..4031bd28f09e 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -33,7 +33,7 @@ * this program. */ -#include "ufshcd.h" +#include #include #include diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index e10c491764f6..28f9adaa094a 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -37,7 +37,7 @@ #include #include -#include "ufshcd.h" +#include static const struct of_device_id ufs_of_match[]; static struct ufs_hba_variant_ops *get_variant_ops(struct device *dev) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3d4c6572dfab..14b314c85ce2 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -42,8 +42,10 @@ #include #include -#include "ufshcd.h" -#include "unipro.h" +#include +#include +#include "ufshci.h" +#include "ufs_quirks.h" #include "debugfs.h" #define CREATE_TRACE_POINTS @@ -3063,6 +3065,23 @@ out: return err; } +/** + * ufshcd_hba_stop - Send controller to reset state + * @hba: per adapter instance + * @can_sleep: perform sleep or just spin + */ +static inline void ufshcd_hba_stop(struct ufs_hba *hba, bool can_sleep) +{ + int err; + + ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE); + err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE, + CONTROLLER_ENABLE, CONTROLLER_DISABLE, + 10, 1, can_sleep); + if (err) + dev_err(hba->dev, "%s: Controller disable failed\n", __func__); +} + /** * ufshcd_hba_enable - initialize the controller * @hba: per adapter instance diff --git a/drivers/scsi/ufs/ufs-msm-phy.h b/include/linux/phy/phy-qcom-ufs.h similarity index 97% rename from drivers/scsi/ufs/ufs-msm-phy.h rename to include/linux/phy/phy-qcom-ufs.h index d356b0ec31e4..dcebaf6ff4cb 100644 --- a/drivers/scsi/ufs/ufs-msm-phy.h +++ b/include/linux/phy/phy-qcom-ufs.h @@ -26,9 +26,9 @@ #include #include -#include "ufshcd.h" -#include "unipro.h" -#include "ufs-msm.h" +#include +#include +#include #define UFS_QCOM_PHY_CAL_ENTRY(reg, val) \ { \ @@ -38,6 +38,15 @@ #define UFS_QCOM_PHY_NAME_LEN 30 +enum { + MASK_SERDES_START = 0x1, + MASK_PCS_READY = 0x1, +}; + +enum { + OFFSET_SERDES_START = 0x0, +}; + struct ufs_qcom_phy_stored_attributes { u32 att; u32 value; diff --git a/drivers/scsi/ufs/ufs-msm.h b/include/linux/scsi/ufs/ufs-qcom.h similarity index 97% rename from drivers/scsi/ufs/ufs-msm.h rename to include/linux/scsi/ufs/ufs-qcom.h index c6d3689e8121..2bcb1edd53fa 100644 --- a/drivers/scsi/ufs/ufs-msm.h +++ b/include/linux/scsi/ufs/ufs-qcom.h @@ -139,15 +139,6 @@ struct ufs_qcom_host { #define ufs_qcom_is_link_active(hba) ufshcd_is_link_active(hba) #define ufs_qcom_is_link_hibern8(hba) ufshcd_is_link_hibern8(hba) -enum { - MASK_SERDES_START = 0x1, - MASK_PCS_READY = 0x1, -}; - -enum { - OFFSET_SERDES_START = 0x0, -}; - #define MAX_PROP_NAME 32 #define VDDA_PHY_MIN_UV 1000000 #define VDDA_PHY_MAX_UV 1000000 diff --git a/drivers/scsi/ufs/ufs.h b/include/linux/scsi/ufs/ufs.h similarity index 100% rename from drivers/scsi/ufs/ufs.h rename to include/linux/scsi/ufs/ufs.h diff --git a/drivers/scsi/ufs/ufshcd.h b/include/linux/scsi/ufs/ufshcd.h similarity index 96% rename from drivers/scsi/ufs/ufshcd.h rename to include/linux/scsi/ufs/ufshcd.h index 6ba941701fc0..cd1345eabf65 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/include/linux/scsi/ufs/ufshcd.h @@ -65,10 +65,7 @@ #include #include - #include "ufs.h" -#include "ufshci.h" -#include "ufs_quirks.h" #define UFSHCD "ufshcd" #define UFSHCD_DRIVER_VERSION "0.2" @@ -598,9 +595,9 @@ static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba) } #define ufshcd_writel(hba, val, reg) \ - writel((val), (hba)->mmio_base + (reg)) + writel_relaxed((val), (hba)->mmio_base + (reg)) #define ufshcd_readl(hba, reg) \ - readl((hba)->mmio_base + (reg)) + readl_relaxed((hba)->mmio_base + (reg)) /** * ufshcd_rmwl - read modify write into a register @@ -626,28 +623,6 @@ void ufshcd_remove(struct ufs_hba *); int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, u32 val, unsigned long interval_us, unsigned long timeout_ms, bool can_sleep); -/** - * ufshcd_hba_stop - Send controller to reset state - * @hba: per adapter instance - * @can_sleep: perform sleep or just spin - */ -static inline void ufshcd_hba_stop(struct ufs_hba *hba, bool can_sleep) -{ - int err; - - ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE); - err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE, - CONTROLLER_ENABLE, CONTROLLER_DISABLE, - 10, 1, can_sleep); - if (err) - dev_err(hba->dev, "%s: Controller disable failed\n", __func__); -} - -static inline void check_upiu_size(void) -{ - BUILD_BUG_ON(ALIGNED_UPIU_SIZE < - GENERAL_UPIU_REQUEST_SIZE + QUERY_DESC_MAX_SIZE); -} extern int ufshcd_runtime_suspend(struct ufs_hba *hba); extern int ufshcd_runtime_resume(struct ufs_hba *hba); diff --git a/drivers/scsi/ufs/unipro.h b/include/linux/scsi/ufs/unipro.h similarity index 99% rename from drivers/scsi/ufs/unipro.h rename to include/linux/scsi/ufs/unipro.h index 3fc3e21b746b..3c9512f5a5ab 100644 --- a/drivers/scsi/ufs/unipro.h +++ b/include/linux/scsi/ufs/unipro.h @@ -1,6 +1,4 @@ /* - * drivers/scsi/ufs/unipro.h - * * Copyright (C) 2013 Samsung Electronics Co., Ltd. * * This program is free software; you can redistribute it and/or modify