All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] scsi: ufs-mediatek: add device reset implementation
@ 2019-12-07  6:39 ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: linux-mediatek, linux-arm-kernel, linux-kernel, beanhuo,
	kuohong.wang, peter.wang, chun-hung.wu, andy.teng, leon.chen,
	Stanley Chu

This patchset add implementation of UFS device reset vops in MediaTek UFS driver.

Stanley Chu (2):
  soc: mediatek: add header for SiP service interface
  scsi: ufs-mediatek: add device reset implementation

 drivers/scsi/ufs/ufs-mediatek.c          | 27 ++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h          |  7 ++++++
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 +++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

-- 
2.18.0

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v1 0/2] scsi: ufs-mediatek: add device reset implementation
@ 2019-12-07  6:39 ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

This patchset add implementation of UFS device reset vops in MediaTek UFS driver.

Stanley Chu (2):
  soc: mediatek: add header for SiP service interface
  scsi: ufs-mediatek: add device reset implementation

 drivers/scsi/ufs/ufs-mediatek.c          | 27 ++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h          |  7 ++++++
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 +++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v1 0/2] scsi: ufs-mediatek: add device reset implementation
@ 2019-12-07  6:39 ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

This patchset add implementation of UFS device reset vops in MediaTek UFS driver.

Stanley Chu (2):
  soc: mediatek: add header for SiP service interface
  scsi: ufs-mediatek: add device reset implementation

 drivers/scsi/ufs/ufs-mediatek.c          | 27 ++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h          |  7 ++++++
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 +++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
  2019-12-07  6:39 ` Stanley Chu
  (?)
@ 2019-12-07  6:39   ` Stanley Chu
  -1 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: linux-mediatek, linux-arm-kernel, linux-kernel, beanhuo,
	kuohong.wang, peter.wang, chun-hung.wu, andy.teng, leon.chen,
	Stanley Chu

Add a header for the SiP service interface defined to access
the UFSHCI controller handling secure commands in MediaTek Chipsets.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
new file mode 100644
index 000000000000..7b69aa06f58d
--- /dev/null
+++ b/include/linux/soc/mediatek/mtk_sip_svc.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ */
+
+#ifndef __MTK_SIP_SVC_H
+#define __MTK_SIP_SVC_H
+
+/* Error Code */
+#define SIP_SVC_E_SUCCESS               0
+#define SIP_SVC_E_NOT_SUPPORTED         -1
+#define SIP_SVC_E_INVALID_PARAMS        -2
+#define SIP_SVC_E_INVALID_RANGE         -3
+#define SIP_SVC_E_PERMISSION_DENIED     -4
+
+#ifdef CONFIG_ARM64
+#define MTK_SIP_SMC_AARCH_BIT           0x40000000
+#else
+#define MTK_SIP_SMC_AARCH_BIT           0x00000000
+#endif
+
+/* UFS related SMC call */
+#define MTK_SIP_UFS_CONTROL \
+	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
+
+#endif
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-07  6:39   ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

Add a header for the SiP service interface defined to access
the UFSHCI controller handling secure commands in MediaTek Chipsets.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
new file mode 100644
index 000000000000..7b69aa06f58d
--- /dev/null
+++ b/include/linux/soc/mediatek/mtk_sip_svc.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ */
+
+#ifndef __MTK_SIP_SVC_H
+#define __MTK_SIP_SVC_H
+
+/* Error Code */
+#define SIP_SVC_E_SUCCESS               0
+#define SIP_SVC_E_NOT_SUPPORTED         -1
+#define SIP_SVC_E_INVALID_PARAMS        -2
+#define SIP_SVC_E_INVALID_RANGE         -3
+#define SIP_SVC_E_PERMISSION_DENIED     -4
+
+#ifdef CONFIG_ARM64
+#define MTK_SIP_SMC_AARCH_BIT           0x40000000
+#else
+#define MTK_SIP_SMC_AARCH_BIT           0x00000000
+#endif
+
+/* UFS related SMC call */
+#define MTK_SIP_UFS_CONTROL \
+	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
+
+#endif
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-07  6:39   ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

Add a header for the SiP service interface defined to access
the UFSHCI controller handling secure commands in MediaTek Chipsets.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h

diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
new file mode 100644
index 000000000000..7b69aa06f58d
--- /dev/null
+++ b/include/linux/soc/mediatek/mtk_sip_svc.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ */
+
+#ifndef __MTK_SIP_SVC_H
+#define __MTK_SIP_SVC_H
+
+/* Error Code */
+#define SIP_SVC_E_SUCCESS               0
+#define SIP_SVC_E_NOT_SUPPORTED         -1
+#define SIP_SVC_E_INVALID_PARAMS        -2
+#define SIP_SVC_E_INVALID_RANGE         -3
+#define SIP_SVC_E_PERMISSION_DENIED     -4
+
+#ifdef CONFIG_ARM64
+#define MTK_SIP_SMC_AARCH_BIT           0x40000000
+#else
+#define MTK_SIP_SMC_AARCH_BIT           0x00000000
+#endif
+
+/* UFS related SMC call */
+#define MTK_SIP_UFS_CONTROL \
+	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
+
+#endif
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v1 2/2] scsi: ufs-mediatek: add device reset implementation
  2019-12-07  6:39 ` Stanley Chu
  (?)
@ 2019-12-07  6:39   ` Stanley Chu
  -1 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: linux-mediatek, linux-arm-kernel, linux-kernel, beanhuo,
	kuohong.wang, peter.wang, chun-hung.wu, andy.teng, leon.chen,
	Stanley Chu

Add device reset vops implementation in MediaTek UFS driver.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 27 +++++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h |  7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 83e28edc3ac5..6a3ec11b16db 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -6,10 +6,12 @@
  *	Peter Wang <peter.wang@mediatek.com>
  */
 
+#include <linux/arm-smccc.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/soc/mediatek/mtk_sip_svc.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -269,6 +271,30 @@ static int ufs_mtk_link_startup_notify(struct ufs_hba *hba,
 	return ret;
 }
 
+static void ufs_mtk_device_reset(struct ufs_hba *hba)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      0, 0, 0, 0, 0, 0, &res);
+	/*
+	 * The reset signal is active low. UFS devices shall detect
+	 * more than or equal to 1us of positive or negative RST_n
+	 * pulse width.
+	 *
+	 * To be on safe side, keep the reset low for at least 10us.
+	 */
+	usleep_range(10, 15);
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      1, 0, 0, 0, 0, 0, &res);
+
+	/* Some devices may need time to respond to rst_n */
+	usleep_range(10000, 15000);
+
+	dev_info(hba->dev, "device reset done\n");
+}
+
 static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
 	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -303,6 +329,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
 	.pwr_change_notify   = ufs_mtk_pwr_change_notify,
 	.suspend             = ufs_mtk_suspend,
 	.resume              = ufs_mtk_resume,
+	.device_reset        = ufs_mtk_device_reset,
 };
 
 /**
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 19f8c42fe06f..b03f601d3a9e 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -6,6 +6,8 @@
 #ifndef _UFS_MEDIATEK_H
 #define _UFS_MEDIATEK_H
 
+#include <linux/bitops.h>
+
 /*
  * Vendor specific pre-defined parameters
  */
@@ -29,6 +31,11 @@
 #define VS_SAVEPOWERCONTROL         0xD0A6
 #define VS_UNIPROPOWERDOWNCONTROL   0xD0A8
 
+/*
+ * SiP commands
+ */
+#define UFS_MTK_SIP_DEVICE_RESET    BIT(1)
+
 /*
  * VS_DEBUGCLOCKENABLE
  */
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v1 2/2] scsi: ufs-mediatek: add device reset implementation
@ 2019-12-07  6:39   ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

Add device reset vops implementation in MediaTek UFS driver.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 27 +++++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h |  7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 83e28edc3ac5..6a3ec11b16db 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -6,10 +6,12 @@
  *	Peter Wang <peter.wang@mediatek.com>
  */
 
+#include <linux/arm-smccc.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/soc/mediatek/mtk_sip_svc.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -269,6 +271,30 @@ static int ufs_mtk_link_startup_notify(struct ufs_hba *hba,
 	return ret;
 }
 
+static void ufs_mtk_device_reset(struct ufs_hba *hba)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      0, 0, 0, 0, 0, 0, &res);
+	/*
+	 * The reset signal is active low. UFS devices shall detect
+	 * more than or equal to 1us of positive or negative RST_n
+	 * pulse width.
+	 *
+	 * To be on safe side, keep the reset low for at least 10us.
+	 */
+	usleep_range(10, 15);
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      1, 0, 0, 0, 0, 0, &res);
+
+	/* Some devices may need time to respond to rst_n */
+	usleep_range(10000, 15000);
+
+	dev_info(hba->dev, "device reset done\n");
+}
+
 static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
 	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -303,6 +329,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
 	.pwr_change_notify   = ufs_mtk_pwr_change_notify,
 	.suspend             = ufs_mtk_suspend,
 	.resume              = ufs_mtk_resume,
+	.device_reset        = ufs_mtk_device_reset,
 };
 
 /**
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 19f8c42fe06f..b03f601d3a9e 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -6,6 +6,8 @@
 #ifndef _UFS_MEDIATEK_H
 #define _UFS_MEDIATEK_H
 
+#include <linux/bitops.h>
+
 /*
  * Vendor specific pre-defined parameters
  */
@@ -29,6 +31,11 @@
 #define VS_SAVEPOWERCONTROL         0xD0A6
 #define VS_UNIPROPOWERDOWNCONTROL   0xD0A8
 
+/*
+ * SiP commands
+ */
+#define UFS_MTK_SIP_DEVICE_RESET    BIT(1)
+
 /*
  * VS_DEBUGCLOCKENABLE
  */
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v1 2/2] scsi: ufs-mediatek: add device reset implementation
@ 2019-12-07  6:39   ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-07  6:39 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, Stanley Chu, linux-arm-kernel,
	beanhuo

Add device reset vops implementation in MediaTek UFS driver.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 27 +++++++++++++++++++++++++++
 drivers/scsi/ufs/ufs-mediatek.h |  7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 83e28edc3ac5..6a3ec11b16db 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -6,10 +6,12 @@
  *	Peter Wang <peter.wang@mediatek.com>
  */
 
+#include <linux/arm-smccc.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/soc/mediatek/mtk_sip_svc.h>
 
 #include "ufshcd.h"
 #include "ufshcd-pltfrm.h"
@@ -269,6 +271,30 @@ static int ufs_mtk_link_startup_notify(struct ufs_hba *hba,
 	return ret;
 }
 
+static void ufs_mtk_device_reset(struct ufs_hba *hba)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      0, 0, 0, 0, 0, 0, &res);
+	/*
+	 * The reset signal is active low. UFS devices shall detect
+	 * more than or equal to 1us of positive or negative RST_n
+	 * pulse width.
+	 *
+	 * To be on safe side, keep the reset low for at least 10us.
+	 */
+	usleep_range(10, 15);
+
+	arm_smccc_smc(MTK_SIP_UFS_CONTROL, UFS_MTK_SIP_DEVICE_RESET,
+		      1, 0, 0, 0, 0, 0, &res);
+
+	/* Some devices may need time to respond to rst_n */
+	usleep_range(10000, 15000);
+
+	dev_info(hba->dev, "device reset done\n");
+}
+
 static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
 	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -303,6 +329,7 @@ static struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
 	.pwr_change_notify   = ufs_mtk_pwr_change_notify,
 	.suspend             = ufs_mtk_suspend,
 	.resume              = ufs_mtk_resume,
+	.device_reset        = ufs_mtk_device_reset,
 };
 
 /**
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index 19f8c42fe06f..b03f601d3a9e 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -6,6 +6,8 @@
 #ifndef _UFS_MEDIATEK_H
 #define _UFS_MEDIATEK_H
 
+#include <linux/bitops.h>
+
 /*
  * Vendor specific pre-defined parameters
  */
@@ -29,6 +31,11 @@
 #define VS_SAVEPOWERCONTROL         0xD0A6
 #define VS_UNIPROPOWERDOWNCONTROL   0xD0A8
 
+/*
+ * SiP commands
+ */
+#define UFS_MTK_SIP_DEVICE_RESET    BIT(1)
+
 /*
  * VS_DEBUGCLOCKENABLE
  */
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
  2019-12-07  6:39   ` Stanley Chu
  (?)
@ 2019-12-07 17:40     ` Florian Fainelli
  -1 siblings, 0 replies; 15+ messages in thread
From: Florian Fainelli @ 2019-12-07 17:40 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, avri.altman,
	alim.akhtar, pedrom.sousa, jejb, matthias.bgg
  Cc: linux-mediatek, linux-arm-kernel, linux-kernel, beanhuo,
	kuohong.wang, peter.wang, chun-hung.wu, andy.teng, leon.chen



On 12/6/2019 10:39 PM, Stanley Chu wrote:
> Add a header for the SiP service interface defined to access
> the UFSHCI controller handling secure commands in MediaTek Chipsets.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>  include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h
> 
> diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
> new file mode 100644
> index 000000000000..7b69aa06f58d
> --- /dev/null
> +++ b/include/linux/soc/mediatek/mtk_sip_svc.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2019 MediaTek Inc.
> + */
> +
> +#ifndef __MTK_SIP_SVC_H
> +#define __MTK_SIP_SVC_H
> +
> +/* Error Code */
> +#define SIP_SVC_E_SUCCESS               0
> +#define SIP_SVC_E_NOT_SUPPORTED         -1
> +#define SIP_SVC_E_INVALID_PARAMS        -2
> +#define SIP_SVC_E_INVALID_RANGE         -3
> +#define SIP_SVC_E_PERMISSION_DENIED     -4
> +
> +#ifdef CONFIG_ARM64
> +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> +#else
> +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> +#endif

Cannot you use the definitions from include/linux/arm-smccc.h and use
ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?

> +
> +/* UFS related SMC call */
> +#define MTK_SIP_UFS_CONTROL \
> +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)

Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
does it have a different meaning (should not). Likewise bit 25 would be
ARM_SMMCCC_OWNER_SIP no?

That would leave us with only 0x276 which is a valid function number.
-- 
Florian

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-07 17:40     ` Florian Fainelli
  0 siblings, 0 replies; 15+ messages in thread
From: Florian Fainelli @ 2019-12-07 17:40 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, avri.altman,
	alim.akhtar, pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, linux-arm-kernel, beanhuo



On 12/6/2019 10:39 PM, Stanley Chu wrote:
> Add a header for the SiP service interface defined to access
> the UFSHCI controller handling secure commands in MediaTek Chipsets.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>  include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h
> 
> diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
> new file mode 100644
> index 000000000000..7b69aa06f58d
> --- /dev/null
> +++ b/include/linux/soc/mediatek/mtk_sip_svc.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2019 MediaTek Inc.
> + */
> +
> +#ifndef __MTK_SIP_SVC_H
> +#define __MTK_SIP_SVC_H
> +
> +/* Error Code */
> +#define SIP_SVC_E_SUCCESS               0
> +#define SIP_SVC_E_NOT_SUPPORTED         -1
> +#define SIP_SVC_E_INVALID_PARAMS        -2
> +#define SIP_SVC_E_INVALID_RANGE         -3
> +#define SIP_SVC_E_PERMISSION_DENIED     -4
> +
> +#ifdef CONFIG_ARM64
> +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> +#else
> +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> +#endif

Cannot you use the definitions from include/linux/arm-smccc.h and use
ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?

> +
> +/* UFS related SMC call */
> +#define MTK_SIP_UFS_CONTROL \
> +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)

Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
does it have a different meaning (should not). Likewise bit 25 would be
ARM_SMMCCC_OWNER_SIP no?

That would leave us with only 0x276 which is a valid function number.
-- 
Florian

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-07 17:40     ` Florian Fainelli
  0 siblings, 0 replies; 15+ messages in thread
From: Florian Fainelli @ 2019-12-07 17:40 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, avri.altman,
	alim.akhtar, pedrom.sousa, jejb, matthias.bgg
  Cc: leon.chen, andy.teng, chun-hung.wu, kuohong.wang, linux-kernel,
	linux-mediatek, peter.wang, linux-arm-kernel, beanhuo



On 12/6/2019 10:39 PM, Stanley Chu wrote:
> Add a header for the SiP service interface defined to access
> the UFSHCI controller handling secure commands in MediaTek Chipsets.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>  include/linux/soc/mediatek/mtk_sip_svc.h | 26 ++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 include/linux/soc/mediatek/mtk_sip_svc.h
> 
> diff --git a/include/linux/soc/mediatek/mtk_sip_svc.h b/include/linux/soc/mediatek/mtk_sip_svc.h
> new file mode 100644
> index 000000000000..7b69aa06f58d
> --- /dev/null
> +++ b/include/linux/soc/mediatek/mtk_sip_svc.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2019 MediaTek Inc.
> + */
> +
> +#ifndef __MTK_SIP_SVC_H
> +#define __MTK_SIP_SVC_H
> +
> +/* Error Code */
> +#define SIP_SVC_E_SUCCESS               0
> +#define SIP_SVC_E_NOT_SUPPORTED         -1
> +#define SIP_SVC_E_INVALID_PARAMS        -2
> +#define SIP_SVC_E_INVALID_RANGE         -3
> +#define SIP_SVC_E_PERMISSION_DENIED     -4
> +
> +#ifdef CONFIG_ARM64
> +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> +#else
> +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> +#endif

Cannot you use the definitions from include/linux/arm-smccc.h and use
ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?

> +
> +/* UFS related SMC call */
> +#define MTK_SIP_UFS_CONTROL \
> +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)

Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
does it have a different meaning (should not). Likewise bit 25 would be
ARM_SMMCCC_OWNER_SIP no?

That would leave us with only 0x276 which is a valid function number.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
  2019-12-07 17:40     ` Florian Fainelli
  (?)
@ 2019-12-08  5:37       ` Stanley Chu
  -1 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-08  5:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb, matthias.bgg,
	Leon Chen (陳文鏘), Andy Teng ( ^[$B{}G!9(^[(B),
	Chun-Hung Wu (巫駿宏),
	Kuohong Wang (王國鴻),
	linux-kernel, linux-mediatek,
	Peter Wang (王信友),
	linux-arm-kernel, beanhuo

Hi Florian,

On Sun, 2019-12-08 at 01:40 +0800, Florian Fainelli wrote:

> > +#ifdef CONFIG_ARM64
> > +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> > +#else
> > +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> > +#endif
> 
> Cannot you use the definitions from include/linux/arm-smccc.h and use
> ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?
> 
> > +
> > +/* UFS related SMC call */
> > +#define MTK_SIP_UFS_CONTROL \
> > +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
> 
> Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
> does it have a different meaning (should not). Likewise bit 25 would be
> ARM_SMMCCC_OWNER_SIP no?
> 
> That would leave us with only 0x276 which is a valid function number.

Thanks so much for these comments.
I'll try to use suitable definitions instead in next version.

Stanley


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-08  5:37       ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-08  5:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-scsi, martin.petersen, Leon Chen (陳文鏘),
	Andy Teng (^[$B{}G!9(^[(B),
	jejb, Chun-Hung Wu (巫駿宏),
	Kuohong Wang (王國鴻),
	linux-kernel, avri.altman, linux-mediatek,
	Peter Wang (王信友),
	alim.akhtar, matthias.bgg, pedrom.sousa, linux-arm-kernel,
	beanhuo

Hi Florian,

On Sun, 2019-12-08 at 01:40 +0800, Florian Fainelli wrote:

> > +#ifdef CONFIG_ARM64
> > +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> > +#else
> > +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> > +#endif
> 
> Cannot you use the definitions from include/linux/arm-smccc.h and use
> ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?
> 
> > +
> > +/* UFS related SMC call */
> > +#define MTK_SIP_UFS_CONTROL \
> > +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
> 
> Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
> does it have a different meaning (should not). Likewise bit 25 would be
> ARM_SMMCCC_OWNER_SIP no?
> 
> That would leave us with only 0x276 which is a valid function number.

Thanks so much for these comments.
I'll try to use suitable definitions instead in next version.

Stanley

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v1 1/2] soc: mediatek: add header for SiP service interface
@ 2019-12-08  5:37       ` Stanley Chu
  0 siblings, 0 replies; 15+ messages in thread
From: Stanley Chu @ 2019-12-08  5:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-scsi, martin.petersen, Leon Chen (陳文鏘),
	Andy Teng (^[$B{}G!9(^[(B),
	jejb, Chun-Hung Wu (巫駿宏),
	Kuohong Wang (王國鴻),
	linux-kernel, avri.altman, linux-mediatek,
	Peter Wang (王信友),
	alim.akhtar, matthias.bgg, pedrom.sousa, linux-arm-kernel,
	beanhuo

Hi Florian,

On Sun, 2019-12-08 at 01:40 +0800, Florian Fainelli wrote:

> > +#ifdef CONFIG_ARM64
> > +#define MTK_SIP_SMC_AARCH_BIT           0x40000000
> > +#else
> > +#define MTK_SIP_SMC_AARCH_BIT           0x00000000
> > +#endif
> 
> Cannot you use the definitions from include/linux/arm-smccc.h and use
> ARM_SMCCC_CALL_CONV_SHIFT here and associated helpers?
> 
> > +
> > +/* UFS related SMC call */
> > +#define MTK_SIP_UFS_CONTROL \
> > +	(0x82000276 | MTK_SIP_SMC_AARCH_BIT)
> 
> Does bit 31 map to the fast vs. slow call of the ARM SMCCC convention or
> does it have a different meaning (should not). Likewise bit 25 would be
> ARM_SMMCCC_OWNER_SIP no?
> 
> That would leave us with only 0x276 which is a valid function number.

Thanks so much for these comments.
I'll try to use suitable definitions instead in next version.

Stanley

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-12-08  5:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-07  6:39 [PATCH v1 0/2] scsi: ufs-mediatek: add device reset implementation Stanley Chu
2019-12-07  6:39 ` Stanley Chu
2019-12-07  6:39 ` Stanley Chu
2019-12-07  6:39 ` [PATCH v1 1/2] soc: mediatek: add header for SiP service interface Stanley Chu
2019-12-07  6:39   ` Stanley Chu
2019-12-07  6:39   ` Stanley Chu
2019-12-07 17:40   ` Florian Fainelli
2019-12-07 17:40     ` Florian Fainelli
2019-12-07 17:40     ` Florian Fainelli
2019-12-08  5:37     ` Stanley Chu
2019-12-08  5:37       ` Stanley Chu
2019-12-08  5:37       ` Stanley Chu
2019-12-07  6:39 ` [PATCH v1 2/2] scsi: ufs-mediatek: add device reset implementation Stanley Chu
2019-12-07  6:39   ` Stanley Chu
2019-12-07  6:39   ` Stanley Chu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.