diff mbox series

[v1,1/2] soc: mediatek: add header for SiP service interface

Message ID 1575700748-28191-2-git-send-email-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs-mediatek: add device reset implementation | expand

Commit Message

Stanley Chu Dec. 7, 2019, 6:39 a.m. UTC
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

Comments

Florian Fainelli Dec. 7, 2019, 5:40 p.m. UTC | #1
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.
Stanley Chu Dec. 8, 2019, 5:37 a.m. UTC | #2
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
diff mbox series

Patch

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