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@xxxxxxxxxxx>
Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@xxxxxxxxxxx>
Signed-off-by: Viken Dadhaniya <quic_vdadhani@xxxxxxxxxxx>
---
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"
+<snip>
/**
* 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