diff mbox series

[v4,1/4] firmware: keembay: Add support for Arm Trusted Firmware Service call

Message ID 20201008020936.19894-2-muhammad.husaini.zulkifli@intel.com
State Superseded
Headers show
Series mmc: sdhci-of-arasan: Enable UHS-1 support for Keem Bay SOC | expand

Commit Message

Zulkifli, Muhammad Husaini Oct. 8, 2020, 2:09 a.m. UTC
From: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>

Add header file to handle API function for device driver to communicate
with Arm Trusted Firmware.

Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
 .../linux/firmware/intel/keembay_firmware.h   | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 include/linux/firmware/intel/keembay_firmware.h

Comments

Michal Simek Oct. 8, 2020, 7:35 a.m. UTC | #1
On 08. 10. 20 4:09, muhammad.husaini.zulkifli@intel.com wrote:
> From: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> 
> Add header file to handle API function for device driver to communicate
> with Arm Trusted Firmware.
> 
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---
>  .../linux/firmware/intel/keembay_firmware.h   | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 include/linux/firmware/intel/keembay_firmware.h
> 
> diff --git a/include/linux/firmware/intel/keembay_firmware.h b/include/linux/firmware/intel/keembay_firmware.h
> new file mode 100644
> index 000000000000..8a62abcdfead
> --- /dev/null
> +++ b/include/linux/firmware/intel/keembay_firmware.h
> @@ -0,0 +1,47 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + *  Intel Keembay SOC Firmware API Layer
> + *
> + *  Copyright (C) 2020-2021, Intel Corporation
> + *
> + *  Muhammad Husaini Zulkifli <Muhammad.Husaini.Zulkifli@intel.com>
> + */
> +
> +#ifndef __FIRMWARE_KEEMBAY_SMC_H__
> +#define __FIRMWARE_KEEMBAY_SMC_H__
> +
> +#include <linux/arm-smccc.h>
> +
> +/*
> + * This file defines API function that can be called by device driver in order to
> + * communicate with Arm Trusted Firmware.
> + */
> +
> +/* Setting for Keem Bay IO Pad Line Voltage Selection */
> +#define ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE		\
> +	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,		\
> +			   ARM_SMCCC_SMC_32,		\
> +			   ARM_SMCCC_OWNER_SIP,		\
> +			   0xFF26)
> +
> +#define KEEMBAY_SET_1V8_VOLT	1
> +#define KEEMBAY_SET_3V3_VOLT	0
> +
> +#if IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY)
> +static inline int keembay_sd_voltage_selection(int volt)
> +{
> +	struct arm_smccc_res res;
> +
> +	arm_smccc_1_1_invoke(ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE, volt, &res);
> +	if ((int)res.a0 < 0)
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +#else
> +static inline int keembay_sd_voltage_selection(int volt)
> +{
> +	return -ENODEV;
> +}
> +#endif
> +#endif /* __FIRMWARE_KEEMBAY_SMC_H__ */
> 

This looks good to me.

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal
Andy Shevchenko Oct. 8, 2020, 8:46 a.m. UTC | #2
On Thu, Oct 8, 2020 at 5:48 AM <muhammad.husaini.zulkifli@intel.com> wrote:
>
> From: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
>
> Add header file to handle API function for device driver to communicate
> with Arm Trusted Firmware.

Arm -> ARM ?

...

>  .../linux/firmware/intel/keembay_firmware.h   | 47 +++++++++++++++++++

Please, drop dup of 'firmware' in the filename.

...

> +/*
> + *  Intel Keembay SOC Firmware API Layer
> + *

> + *  Copyright (C) 2020-2021, Intel Corporation

Hello from the future?

> + *
> + *  Muhammad Husaini Zulkifli <Muhammad.Husaini.Zulkifli@intel.com>

Author: ...

> + */

...

> +/*
> + * This file defines API function that can be called by device driver in order to

an API
by a device

> + * communicate with Arm Trusted Firmware.

Arm -> ARM ?

> + */
Sudeep Holla Oct. 8, 2020, 9:45 a.m. UTC | #3
On Thu, Oct 08, 2020 at 10:09:33AM +0800, muhammad.husaini.zulkifli@intel.com wrote:
> From: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
>
> Add header file to handle API function for device driver to communicate
> with Arm Trusted Firmware.

[nit] Since it moved to trusted-firmware.org, it is no longer "Arm"
Trusted Firmware. It is now called Trusted Firmware - A profile(TF-A)
or Trusted Firmware - M profile (TF-M). Please update the subject and
the text above. I know it is silly but I am being asked to get this
fixed as it may create "confusion"(I don't know details, please don't
ask 😁)

Apart from various minor things Andy already pointed out, this looks
good. You can add by Ack once the above naming and all things pointed
by Andy are fixed.

--
Regards,
Sudeep
Zulkifli, Muhammad Husaini Oct. 8, 2020, 10:39 a.m. UTC | #4
Hi Andy,

Thanks for the feedback.

>-----Original Message-----

>From: Andy Shevchenko <andy.shevchenko@gmail.com>

>Sent: Thursday, October 8, 2020 4:46 PM

>To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>

>Cc: Hunter, Adrian <adrian.hunter@intel.com>; Michal Simek

><michal.simek@xilinx.com>; Shevchenko, Andriy

><andriy.shevchenko@intel.com>; Ulf Hansson <ulf.hansson@linaro.org>; linux-

>mmc <linux-mmc@vger.kernel.org>; linux-arm Mailing List <linux-arm-

>kernel@lists.infradead.org>; Linux Kernel Mailing List <linux-

>kernel@vger.kernel.org>; Raja Subramanian, Lakshmi Bai

><lakshmi.bai.raja.subramanian@intel.com>; Wan Mohamad, Wan Ahmad Zainie

><wan.ahmad.zainie.wan.mohamad@intel.com>; Arnd Bergmann

><arnd@arndb.de>

>Subject: Re: [PATCH v4 1/4] firmware: keembay: Add support for Arm Trusted

>Firmware Service call

>

>On Thu, Oct 8, 2020 at 5:48 AM <muhammad.husaini.zulkifli@intel.com> wrote:

>>

>> From: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>

>>

>> Add header file to handle API function for device driver to

>> communicate with Arm Trusted Firmware.

>

>Arm -> ARM ?

I will rename based on Sudeep's mentioned in latest thread
>

>...

>

>>  .../linux/firmware/intel/keembay_firmware.h   | 47 +++++++++++++++++++

>

>Please, drop dup of 'firmware' in the filename.

Noted. Will change to keembay.h
>

>...

>

>> +/*

>> + *  Intel Keembay SOC Firmware API Layer

>> + *

>

>> + *  Copyright (C) 2020-2021, Intel Corporation

>

>Hello from the future?

>

Will edit to Copyright (C) 2020, Intel Corporation
>> + *

>> + *  Muhammad Husaini Zulkifli <Muhammad.Husaini.Zulkifli@intel.com>

>

>Author: ...

>

>> + */

>

>...

>

>> +/*

>> + * This file defines API function that can be called by device driver

>> +in order to

>

>an API

>by a device

Noted 😊
>

>> + * communicate with Arm Trusted Firmware.

>

>Arm -> ARM ?

I will rename based on Sudeep's mentioned in latest thread
>

>> + */

>

>--

>With Best Regards,

>Andy Shevchenko
diff mbox series

Patch

diff --git a/include/linux/firmware/intel/keembay_firmware.h b/include/linux/firmware/intel/keembay_firmware.h
new file mode 100644
index 000000000000..8a62abcdfead
--- /dev/null
+++ b/include/linux/firmware/intel/keembay_firmware.h
@@ -0,0 +1,47 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Intel Keembay SOC Firmware API Layer
+ *
+ *  Copyright (C) 2020-2021, Intel Corporation
+ *
+ *  Muhammad Husaini Zulkifli <Muhammad.Husaini.Zulkifli@intel.com>
+ */
+
+#ifndef __FIRMWARE_KEEMBAY_SMC_H__
+#define __FIRMWARE_KEEMBAY_SMC_H__
+
+#include <linux/arm-smccc.h>
+
+/*
+ * This file defines API function that can be called by device driver in order to
+ * communicate with Arm Trusted Firmware.
+ */
+
+/* Setting for Keem Bay IO Pad Line Voltage Selection */
+#define ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE		\
+	ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,		\
+			   ARM_SMCCC_SMC_32,		\
+			   ARM_SMCCC_OWNER_SIP,		\
+			   0xFF26)
+
+#define KEEMBAY_SET_1V8_VOLT	1
+#define KEEMBAY_SET_3V3_VOLT	0
+
+#if IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY)
+static inline int keembay_sd_voltage_selection(int volt)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_1_1_invoke(ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE, volt, &res);
+	if ((int)res.a0 < 0)
+		return -EINVAL;
+
+	return 0;
+}
+#else
+static inline int keembay_sd_voltage_selection(int volt)
+{
+	return -ENODEV;
+}
+#endif
+#endif /* __FIRMWARE_KEEMBAY_SMC_H__ */