Re: [PATCH v1 4/7] soc: qcom: geni-se:: Add support to load QUP SE Firmware via Linux subsystem

Viken Dadhaniya
2024-12-10T04:53:36Z

On 12/4/2024 8:54 PM, neil.armstrong@linaro.org wrote:
> Hi,
>
> On 04/12/2024 16:03, Viken Dadhaniya wrote:
>> Load the firmware to QUP SE based on the "qcom,load-firmware" property
>> specified in devicetree. Populate Serial engine and base address details
>> in the probe function of the protocol driver and pass to firmware load
>> routine.
>>
>> Skip the firmware loading if the firmware is already loaded in Serial
>> Engine's firmware memory area.
>>
>> Co-developed-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
>> Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>> ---
>>   drivers/soc/qcom/qcom-geni-se.c      | 445 +++++++++++++++++++++++++++
>>   include/linux/soc/qcom/geni-se.h     |  17 +
>>   include/linux/soc/qcom/qup-fw-load.h | 179 +++++++++++
>>   3 files changed, 641 insertions(+)
>>   create mode 100644 include/linux/soc/qcom/qup-fw-load.h
>>
>> diff --git a/drivers/soc/qcom/qcom-geni-se.c
>> b/drivers/soc/qcom/qcom-geni-se.c
>> index 4cb959106efa..423102fac3fc 100644
>> --- a/drivers/soc/qcom/qcom-geni-se.c
>> +++ b/drivers/soc/qcom/qcom-geni-se.c
>> @@ -1,5 +1,6 @@
>>   // SPDX-License-Identifier: GPL-2.0
>>   // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
>> +// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights
>> reserved.
>>   /* Disable MMIO tracing to prevent excessive logging of unwanted
>> MMIO traces */
>>   #define __DISABLE_TRACE_MMIO__
>> @@ -15,6 +16,7 @@
>>   #include <linux/pinctrl/consumer.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/soc/qcom/geni-se.h>
>> +#include <linux/soc/qcom/qup-fw-load.h>
>>   /**
>>    * DOC: Overview
>> @@ -97,6 +99,9 @@ struct geni_wrapper {
>>       unsigned int num_clks;
>>   };
>> +/* elf file should be at /lib/firmware/ */
>> +#define QUP_FW_ELF_FILE    "qupv3fw.elf"
>
> I supposed the qupv3fw.elf is SoC specific, so it should use
> /lib/firmware/qcom
> base path and also a SoC/platform specific path that should be specified
> with firmware-name in DT.
>
> With this property, "qcom,load-firmware" could be dropped.
>

Agree, will update in next patch.

>> +
>>   /**
>>    * struct geni_se_desc - Data structure to represent the QUP Wrapper
>> resources
>>    * @clks:        Name of the primary & optional secondary AHB clocks
>> @@ -110,6 +115,9 @@ struct geni_se_desc {
>>   static const char * const icc_path_names[] = {"qup-core", "qup-config",
>>                           "qup-memory"};
>> +static const char * const protocol_name[] = { "None", "SPI", "UART",
>> +                          "I2C", "I3C", "SPI SLAVE"};
>> +
>>   #define QUP_HW_VER_REG            0x4
> <snip>
>