remoteproc: qcom-common: Extract non-mdt related helper
Subsystems (2)
PATCH 1/3 remoteproc: qcom-common: Extract non-mdt related helper
In preparation for moving the mdt loader out of remoteproc let's move the somewhat unrelated resource table dummy helper to a Qualcomm "common" file.
Signed-off-by Bjorn Andersson <[email protected]>
--- drivers/remoteproc/Kconfig | 6 +++++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_adsp_pil.c | 1 + drivers/remoteproc/qcom_common.c | 46 ++++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 11 +++++++++ drivers/remoteproc/qcom_mdt_loader.c | 19 --------------- drivers/remoteproc/qcom_mdt_loader.h | 1 - drivers/remoteproc/qcom_q6v5_pil.c | 1 + drivers/remoteproc/qcom_wcnss.c | 1 + 9 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 drivers/remoteproc/qcom_common.c create mode 100644 drivers/remoteproc/qcom_common.h
drivers/remoteproc/Kconfig +6 -0
@@ -78,11 +78,15 @@ config QCOM_ADSP_PIL depends on QCOM_SMEM select MFD_SYSCON select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the TrustZone based Peripherial Image Loader for the Qualcomm ADSP remote processors. +config QCOM_RPROC_COMMON + tristate + config QCOM_MDT_LOADER tristate
@@ -93,6 +97,7 @@ config QCOM_Q6V5_PIL depends on REMOTEPROC select MFD_SYSCON select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the Qualcomm Peripherial Image Loader for the
@@ -105,6 +110,7 @@ config QCOM_WCNSS_PIL depends on QCOM_SMEM depends on REMOTEPROC select QCOM_MDT_LOADER + select QCOM_RPROC_COMMON select QCOM_SCM help Say y here to support the Peripheral Image Loader for the Qualcomm
drivers/remoteproc/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o obj-$(CONFIG_QCOM_ADSP_PIL) += qcom_adsp_pil.o obj-$(CONFIG_QCOM_MDT_LOADER) += qcom_mdt_loader.o +obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o qcom_wcnss_pil-y += qcom_wcnss.o
drivers/remoteproc/qcom_adsp_pil.c +1 -0
@@ -29,6 +29,7 @@#include <linux/soc/qcom/smem.h> #include <linux/soc/qcom/smem_state.h> +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include "remoteproc_internal.h"
drivers/remoteproc/qcom_common.c new file +46 -0
46 lines not on this page · raw message
drivers/remoteproc/qcom_common.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __RPROC_QCOM_COMMON_H__ +#define __RPROC_QCOM_COMMON_H__ + +struct resource_table ; +struct rproc ; + +struct resource_table *qcom_mdt_find_rsc_table (struct rproc *rproc, +const struct firmware *fw, +int *tablesz); + +#endif
drivers/remoteproc/qcom_mdt_loader.c +0 -19
@@ -27,25 +27,6 @@#include "qcom_mdt_loader.h" /** -* qcom_mdt_find_rsc_table() - provide dummy resource table for remoteproc -* @rproc: remoteproc handle -* @fw: firmware header -* @tablesz: outgoing size of the table -* -* Returns a dummy table. -*/ -struct resource_table *qcom_mdt_find_rsc_table (struct rproc *rproc, -const struct firmware *fw, -int *tablesz) -{ -static struct resource_table table = { .ver =1 , }; - - *tablesz =sizeof (table); -return &table; -} -EXPORT_SYMBOL_GPL (qcom_mdt_find_rsc_table); - -/** * qcom_mdt_parse() - extract useful parameters from the mdt header * @fw: firmware handle * @fw_addr: optional reference for base of the firmware's memory region
drivers/remoteproc/qcom_mdt_loader.h +0 -1
@@ -5,7 +5,6 @@#define QCOM_MDT_TYPE_HASH (2 << 24)#define QCOM_MDT_RELOCATABLE BIT(27) -struct resource_table *qcom_mdt_find_rsc_table (struct rproc *rproc,const struct firmware *fw,int *tablesz);int qcom_mdt_load (struct rproc *rproc,const struct firmware *fw,const char *fw_name);int qcom_mdt_parse (const struct firmware *fw,phys_addr_t *fw_addr,size_t *fw_size,bool *fw_relocate);
drivers/remoteproc/qcom_q6v5_pil.c +1 -0
@@ -33,6 +33,7 @@#include <linux/soc/qcom/smem_state.h> #include "remoteproc_internal.h" +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include <linux/qcom_scm.h>
drivers/remoteproc/qcom_wcnss.c +1 -0
@@ -32,6 +32,7 @@#include <linux/soc/qcom/smem_state.h> #include <linux/rpmsg/qcom_smd.h> +#include "qcom_common.h" #include "qcom_mdt_loader.h" #include "remoteproc_internal.h" #include "qcom_wcnss.h"
Signature · 1 line
2.11.0
PATCH 2/3 remoteproc: qcom: wcnss: Make SMD handling common
Move the SMD edge handling to the Qualcomm common file to make it reusable for other Qualcomm remoteproc drivers.
Signed-off-by Bjorn Andersson <[email protected]>
--- drivers/remoteproc/qcom_common.c | 50 ++++++++++++++++++++++++++++++++++++++++ drivers/remoteproc/qcom_common.h | 15 ++++++++++-- drivers/remoteproc/qcom_wcnss.c | 28 ++++------------------ 3 files changed, 67 insertions(+), 26 deletions(-)
drivers/remoteproc/qcom_common.c +50 -0
@@ -19,10 +19,13 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/remoteproc.h> +#include <linux/rpmsg/qcom_smd.h> #include "remoteproc_internal.h" #include "qcom_common.h" +#define to_smd_subdev (d) container_of(d, struct qcom_rproc_subdev, subdev) +/** * qcom_mdt_find_rsc_table() - provide dummy resource table for remoteproc * @rproc: remoteproc handle
@@ -42,5 +45,52 @@ struct resource_table *qcom_mdt_find_rsc_table(struct rproc *rproc, }EXPORT_SYMBOL_GPL (qcom_mdt_find_rsc_table); +static int smd_subdev_probe (struct rproc_subdev *subdev) +{ +struct qcom_rproc_subdev *smd =to_smd_subdev (subdev); + + smd->edge =qcom_smd_register_edge (smd->dev, smd->node); + +return IS_ERR (smd->edge) ?PTR_ERR (smd->edge) :0 ; +} + +static void smd_subdev_remove (struct rproc_subdev *subdev) +{ +struct qcom_rproc_subdev *smd =to_smd_subdev (subdev); + +qcom_smd_unregister_edge (smd->edge); + smd->edge =NULL ; +} + +/** +* qcom_add_smd_subdev() - try to add a SMD subdevice to rproc +* @rproc: rproc handle to parent the subdevice +* @smd: reference to a Qualcomm subdev context +*/ +void qcom_add_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd) +{ +struct device *dev = &rproc->dev; + + smd->node =of_get_child_by_name (dev->parent->of_node,"smd-edge" ); +if (!smd->node) +return ; + + smd->dev = dev; +rproc_add_subdev (rproc, &smd->subdev, smd_subdev_probe, smd_subdev_remove); +} +EXPORT_SYMBOL_GPL (qcom_add_smd_subdev); + +/** +* qcom_remove_smd_subdev() - remove the smd subdevice from rproc +* @rproc: rproc handle +* @smd: the SMD subdevice to remove +*/ +void qcom_remove_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd) +{ +rproc_remove_subdev (rproc, &smd->subdev); +of_node_put (smd->node); +} +EXPORT_SYMBOL_GPL (qcom_remove_smd_subdev); +MODULE_DESCRIPTION ("Qualcomm Remoteproc helper driver" );MODULE_LICENSE ("GPL v2" );
drivers/remoteproc/qcom_common.h +13 -2
@@ -1,11 +1,22 @@#ifndef __RPROC_QCOM_COMMON_H__#define __RPROC_QCOM_COMMON_H__ -struct resource_table ; -struct rproc ; +#include <linux/remoteproc.h> +#include "remoteproc_internal.h" + +struct qcom_rproc_subdev { +struct rproc_subdev subdev; + +struct device *dev; +struct device_node *node; +struct qcom_smd_edge *edge; +};struct resource_table *qcom_mdt_find_rsc_table (struct rproc *rproc,const struct firmware *fw,int *tablesz); +void qcom_add_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd); +void qcom_remove_smd_subdev (struct rproc *rproc,struct qcom_rproc_subdev *smd); +#endif
drivers/remoteproc/qcom_wcnss.c +4 -24
@@ -97,9 +97,7 @@ struct qcom_wcnss {void *mem_region;size_t mem_size; -struct device_node *smd_node; -struct qcom_smd_edge *smd_edge; -struct rproc_subdev smd_subdev; +struct qcom_rproc_subdev smd_subdev; };static const struct wcnss_data riva_data = {
@@ -401,23 +399,6 @@ static irqreturn_t wcnss_stop_ack_interrupt(int irq, void *dev)return IRQ_HANDLED ; } -static int wcnss_smd_probe (struct rproc_subdev *subdev) -{ - struct qcom_wcnss *wcnss = container_of(subdev, struct qcom_wcnss, smd_subdev); - - wcnss->smd_edge =qcom_smd_register_edge (wcnss->dev, wcnss->smd_node); - -return IS_ERR (wcnss->smd_edge) ?PTR_ERR (wcnss->smd_edge) :0 ; -} - -static void wcnss_smd_remove (struct rproc_subdev *subdev) -{ - struct qcom_wcnss *wcnss = container_of(subdev, struct qcom_wcnss, smd_subdev); - -qcom_smd_unregister_edge (wcnss->smd_edge); - wcnss->smd_edge =NULL ; -} -static int wcnss_init_regulators (struct qcom_wcnss *wcnss,const struct wcnss_vreg_info *info,int num_vregs)
@@ -600,9 +581,7 @@ static int wcnss_probe(struct platform_device *pdev) } } - wcnss->smd_node =of_get_child_by_name (pdev->dev.of_node,"smd-edge" ); -if (wcnss->smd_node) -rproc_add_subdev (rproc, &wcnss->smd_subdev, wcnss_smd_probe, wcnss_smd_remove); +qcom_add_smd_subdev (rproc, &wcnss->smd_subdev); ret =rproc_add (rproc);if (ret)
@@ -622,9 +601,10 @@ static int wcnss_remove(struct platform_device *pdev)of_platform_depopulate (&pdev->dev); -of_node_put (wcnss->smd_node);qcom_smem_state_put (wcnss->state);rproc_del (wcnss->rproc); + +qcom_remove_smd_subdev (wcnss->rproc, &wcnss->smd_subdev);rproc_free (wcnss->rproc);return 0 ;
Signature · 1 line
2.11.0
PATCH 3/3 remoteproc: qcom: Use common SMD edge handler
In reply to Bjorn AnderssonCall the common SMD edge handler to instantiate subdevices to bring associated SMD edges up and down as the remoteproc is started and stopped.
Signed-off-by Bjorn Andersson <[email protected]>
--- drivers/remoteproc/Kconfig | 2 ++ drivers/remoteproc/qcom_adsp_pil.c | 6 ++++++ drivers/remoteproc/qcom_q6v5_pil.c | 6 ++++++ 3 files changed, 14 insertions(+)
drivers/remoteproc/Kconfig +2 -0
@@ -76,6 +76,7 @@ config QCOM_ADSP_PIL depends on OF && ARCH_QCOM depends on REMOTEPROC depends on QCOM_SMEM + depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) select MFD_SYSCON select QCOM_MDT_LOADER select QCOM_RPROC_COMMON
@@ -95,6 +96,7 @@ config QCOM_Q6V5_PIL depends on OF && ARCH_QCOM depends on QCOM_SMEM depends on REMOTEPROC + depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) select MFD_SYSCON select QCOM_MDT_LOADER select QCOM_RPROC_COMMON
drivers/remoteproc/qcom_adsp_pil.c +6 -0
@@ -61,6 +61,8 @@ struct qcom_adsp {phys_addr_t mem_reloc;void *mem_region;size_t mem_size; + +struct qcom_rproc_subdev smd_subdev; };static int adsp_load (struct rproc *rproc,const struct firmware *fw)
@@ -385,6 +387,8 @@ static int adsp_probe(struct platform_device *pdev) goto free_rproc; } +qcom_add_smd_subdev (rproc, &adsp->smd_subdev); + ret =rproc_add (rproc);if (ret) goto free_rproc;
@@ -403,6 +407,8 @@ static int adsp_remove(struct platform_device *pdev)qcom_smem_state_put (adsp->state);rproc_del (adsp->rproc); + +qcom_remove_smd_subdev (adsp->rproc, &adsp->smd_subdev);rproc_free (adsp->rproc);return 0 ;
drivers/remoteproc/qcom_q6v5_pil.c +6 -0
@@ -153,6 +153,8 @@ struct q6v5 {phys_addr_t mpss_reloc;void *mpss_region;size_t mpss_size; + +struct qcom_rproc_subdev smd_subdev; }; static int q6v5_regulator_init(struct device *dev, struct reg_info *regs,
@@ -998,6 +1000,8 @@ static int q6v5_probe(struct platform_device *pdev) goto free_rproc; } +qcom_add_smd_subdev (rproc, &qproc->smd_subdev); + ret =rproc_add (rproc);if (ret) goto free_rproc;
@@ -1015,6 +1019,8 @@ static int q6v5_remove(struct platform_device *pdev)struct q6v5 *qproc =platform_get_drvdata (pdev);rproc_del (qproc->rproc); + +qcom_remove_smd_subdev (qproc->rproc, &qproc->smd_subdev);rproc_free (qproc->rproc);return 0 ;
Signature · 1 line
2.11.0