remoteproc: k3: Merge ti_sci_dev and ti_sci_proc
v3 cover remoteproc: k3: Merge ti_sci_dev and ti_sci_proc
The previous version of the patch had a new header ti_sci_dev.h, that mirrors ti_sci_proc.h in terms of the struct decl and its helper function structure, with the goal of abstracting all ti_sci_handle's members like ti_sci_dev_ops from being invoked directly in the driver code.
Lore link to the v1 patch:
https://lore.kernel.org/all/[email protected]/
Lore link to the v2 patch:
https://lore.kernel.org/all/[email protected]/
Upon discussing in the original patch thread, it seemed better to combine ti_sci_proc.h and ti_sci_dev.h's structs and merge all their helpers into a single header. That is what ti_sci_ctrl.h aims to do: It has the union of tsd (ti_sci_dev) and tsp (ti_sci_proc) and both their helper functions are prefixed with ti_sci_ctrl_dev and ti_sci_ctrl_proc respectively.
The goal of the patch (v3) is to maintain a single source of origin for all ti_sci_dev/proc_ops call sites. Any stray calls to dev_ops/proc_ops function pointer members in driver code should eventually be abstracted through this header (ti_sci_ctrl.h).
In the future we can switch to pm runtime calls.
Siddharth Karanam (1):
remoteproc: k3: Merge ti_sci_dev and ti_sci_proc abstraction
drivers/remoteproc/ti_k3_common.c | 21 +-- drivers/remoteproc/ti_k3_common.h | 6 +- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 25 ++- drivers/remoteproc/ti_k3_m4_remoteproc.c | 23 ++- drivers/remoteproc/ti_k3_r5_remoteproc.c | 66 +++----- drivers/remoteproc/ti_sci_ctrl.h | 184 ++++++++++++++++++++++ drivers/remoteproc/ti_sci_proc.h | 130 --------------- 7 files changed, 239 insertions(+), 216 deletions(-) create mode 100644 drivers/remoteproc/ti_sci_ctrl.h delete mode 100644 drivers/remoteproc/ti_sci_proc.h
Signature · 1 line
2.55.0
PATCH v3 1/1 remoteproc: k3: Merge ti_sci_dev and ti_sci_proc abstraction
The goal of the patch is to maintain a single source
of origin for all ti_sci_dev/proc_ops call sites. Any stray calls to dev_ops/proc_ops function pointer members in driver code should eventually be abstracted through this header (ti_sci_ctrl.h).
In the future we could switch to pm runtime calls.
--- drivers/remoteproc/ti_k3_common.c | 21 +-- drivers/remoteproc/ti_k3_common.h | 6 +- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 25 ++- drivers/remoteproc/ti_k3_m4_remoteproc.c | 23 ++- drivers/remoteproc/ti_k3_r5_remoteproc.c | 66 +++----- drivers/remoteproc/ti_sci_ctrl.h | 184 ++++++++++++++++++++++ drivers/remoteproc/ti_sci_proc.h | 130 --------------- 7 files changed, 239 insertions(+), 216 deletions(-) create mode 100644 drivers/remoteproc/ti_sci_ctrl.h delete mode 100644 drivers/remoteproc/ti_sci_proc.h
drivers/remoteproc/ti_k3_common.c +8 -13
@@ -32,7 +32,7 @@#include "omap_remoteproc.h" #include "remoteproc_internal.h" -#include "ti_sci_proc.h" +#include "ti_sci_ctrl.h" #include "ti_k3_common.h" /**
@@ -114,8 +114,7 @@ int k3_rproc_reset(struct k3_rproc *kproc)if (ret)dev_err (dev,"local-reset assert failed (%pe)\n" ,ERR_PTR (ret)); }else { - ret = kproc->ti_sci->ops.dev_ops.put_device (kproc->ti_sci, - kproc->ti_sci_id); + ret =ti_sci_ctrl_dev_put_device (kproc->tsc);if (ret)dev_err (dev,"module-reset assert failed (%pe)\n" ,ERR_PTR (ret)); }
@@ -134,13 +133,11 @@ int k3_rproc_release(struct k3_rproc *kproc) ret =reset_control_deassert (kproc->reset);if (ret) {dev_err (dev,"local-reset deassert failed, (%pe)\n" ,ERR_PTR (ret)); -if (kproc->ti_sci->ops.dev_ops.put_device (kproc->ti_sci, - kproc->ti_sci_id)) +if (ti_sci_ctrl_dev_put_device (kproc->tsc))dev_warn (dev,"module-reset assert back failed\n" ); } }else { - ret = kproc->ti_sci->ops.dev_ops.get_device (kproc->ti_sci, - kproc->ti_sci_id); + ret =ti_sci_ctrl_dev_get_device (kproc->tsc);if (ret)dev_err (dev,"module-reset deassert failed (%pe)\n" ,ERR_PTR (ret)); }
@@ -217,8 +214,7 @@ int k3_rproc_prepare(struct rproc *rproc) } } - ret = kproc->ti_sci->ops.dev_ops.get_device (kproc->ti_sci, - kproc->ti_sci_id); + ret =ti_sci_ctrl_dev_get_device (kproc->tsc);if (ret) {dev_err (dev,"could not deassert module-reset for internal RAM loading\n" );return ret;
@@ -247,8 +243,7 @@ int k3_rproc_unprepare(struct rproc *rproc)if (rproc->state ==RPROC_DETACHED )return 0 ; - ret = kproc->ti_sci->ops.dev_ops.put_device (kproc->ti_sci, - kproc->ti_sci_id); + ret =ti_sci_ctrl_dev_put_device (kproc->tsc);if (ret) {dev_err (dev,"module-reset assert failed\n" );return ret;
@@ -526,9 +521,9 @@ EXPORT_SYMBOL_GPL(k3_reserved_mem_init);void k3_release_tsp (void *data) { -struct ti_sci_proc *tsp = data; +struct ti_sci_ctrl *tsc = data; -ti_sci_proc_release (tsp); +ti_sci_ctrl_proc_release (tsc); }EXPORT_SYMBOL_GPL (k3_release_tsp);
drivers/remoteproc/ti_k3_common.h +2 -4
@@ -75,9 +75,8 @@ struct k3_rproc_dev_data {* @num_rmems: number of reserved memory regions * @reset: reset control handle * @data: pointer to DSP-specific device data -* @tsp: TI-SCI processor control handle +* @tsc: TI-SCI control handle * @ti_sci: TI-SCI handle -* @ti_sci_id: TI-SCI device identifier * @mbox: mailbox channel handle * @client: mailbox client to request the mailbox channel * @priv: void pointer to carry any private data
@@ -91,9 +90,8 @@ struct k3_rproc {int num_rmems;struct reset_control *reset;const struct k3_rproc_dev_data *data; -struct ti_sci_proc *tsp; +struct ti_sci_ctrl *tsc;const struct ti_sci_handle *ti_sci; -u32 ti_sci_id;struct mbox_chan *mbox;struct mbox_client client;void *priv;
drivers/remoteproc/ti_k3_dsp_remoteproc.c +10 -15
@@ -16,7 +16,7 @@#include "omap_remoteproc.h" #include "remoteproc_internal.h" -#include "ti_sci_proc.h" +#include "ti_sci_ctrl.h" #include "ti_k3_common.h" /*
@@ -41,7 +41,7 @@ static int k3_dsp_rproc_start(struct rproc *rproc) }dev_dbg (dev,"booting DSP core using boot addr = 0x%x\n" , boot_addr); - ret =ti_sci_proc_set_config (kproc->tsp, boot_addr,0 ,0 ); + ret =ti_sci_ctrl_proc_set_config (kproc->tsc, boot_addr,0 ,0 );if (ret)return ret;
@@ -107,26 +107,22 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (kproc->ti_sci),"failed to get ti-sci handle\n" ); - ret =of_property_read_u32 (np,"ti,sci-dev-id" , &kproc->ti_sci_id); -if (ret) -return dev_err_probe (dev, ret,"missing 'ti,sci-dev-id' property\n" ); - kproc->reset =devm_reset_control_get_exclusive (dev,NULL );if (IS_ERR (kproc->reset))return dev_err_probe (dev,PTR_ERR (kproc->reset),"failed to get reset\n" ); - kproc->tsp =ti_sci_proc_of_get_tsp (dev, kproc->ti_sci); -if (IS_ERR (kproc->tsp)) -return dev_err_probe (dev,PTR_ERR (kproc->tsp), -"failed to construct ti-sci proc control\n" ); + kproc->tsc =ti_sci_ctrl_of_get (dev, kproc->ti_sci); +if (IS_ERR (kproc->tsc)) +return dev_err_probe (dev,PTR_ERR (kproc->tsc), +"failed to get construct ti-sci control\n" ); - ret =ti_sci_proc_request (kproc->tsp); + ret =ti_sci_ctrl_proc_request (kproc->tsc);if (ret <0 ) { -dev_err_probe (dev, ret,"ti_sci_proc_request failed\n" ); +dev_err_probe (dev, ret,"ti_sci_ctrl_proc_request failed\n" );return ret; } - ret =devm_add_action_or_reset (dev, k3_release_tsp, kproc->tsp); + ret =devm_add_action_or_reset (dev, k3_release_tsp, kproc->tsc);if (ret)return ret;
@@ -138,8 +134,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)if (ret)return dev_err_probe (dev, ret,"reserved memory init failed\n" ); - ret = kproc->ti_sci->ops.dev_ops.is_on (kproc->ti_sci, kproc->ti_sci_id, -NULL , &p_state); + ret =ti_sci_ctrl_dev_is_on (kproc->tsc,NULL , &p_state);if (ret)return dev_err_probe (dev, ret,"failed to get initial state, mode cannot be determined\n" );
drivers/remoteproc/ti_k3_m4_remoteproc.c +9 -14
@@ -16,7 +16,7 @@#include "omap_remoteproc.h" #include "remoteproc_internal.h" -#include "ti_sci_proc.h" +#include "ti_sci_ctrl.h" #include "ti_k3_common.h" static const struct rproc_ops k3_m4_rproc_ops = {
@@ -68,23 +68,19 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)return dev_err_probe (dev,PTR_ERR (kproc->ti_sci),"failed to get ti-sci handle\n" ); - ret =of_property_read_u32 (dev->of_node,"ti,sci-dev-id" , &kproc->ti_sci_id); -if (ret) -return dev_err_probe (dev, ret,"missing 'ti,sci-dev-id' property\n" ); - kproc->reset =devm_reset_control_get_exclusive (dev,NULL );if (IS_ERR (kproc->reset))return dev_err_probe (dev,PTR_ERR (kproc->reset),"failed to get reset\n" ); - kproc->tsp =ti_sci_proc_of_get_tsp (dev, kproc->ti_sci); -if (IS_ERR (kproc->tsp)) -return dev_err_probe (dev,PTR_ERR (kproc->tsp), -"failed to construct ti-sci proc control\n" ); + kproc->tsc =ti_sci_ctrl_of_get (dev, kproc->ti_sci); +if (IS_ERR (kproc->tsc)) +return dev_err_probe (dev,PTR_ERR (kproc->tsc), +"failed to construct ti-sci control\n" ); - ret =ti_sci_proc_request (kproc->tsp); + ret =ti_sci_ctrl_proc_request (kproc->tsc);if (ret <0 ) -return dev_err_probe (dev, ret,"ti_sci_proc_request failed\n" ); - ret =devm_add_action_or_reset (dev, k3_release_tsp, kproc->tsp); +return dev_err_probe (dev, ret,"ti_sci_ctrl_proc_request failed\n" ); + ret =devm_add_action_or_reset (dev, k3_release_tsp, kproc->tsc);if (ret)return ret;
@@ -96,8 +92,7 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)if (ret)return dev_err_probe (dev, ret,"reserved memory init failed\n" ); - ret = kproc->ti_sci->ops.dev_ops.is_on (kproc->ti_sci, kproc->ti_sci_id, - &r_state, &p_state); + ret =ti_sci_ctrl_dev_is_on (kproc->tsc, &r_state, &p_state);if (ret)return dev_err_probe (dev, ret,"failed to get initial state, mode cannot be determined\n" );
drivers/remoteproc/ti_k3_r5_remoteproc.c +31 -45
206 lines not on this page · raw message
drivers/remoteproc/ti_sci_ctrl.h new file +184 -0
184 lines not on this page · raw message
drivers/remoteproc/ti_sci_proc.h deleted +0 -130
130 lines not on this page · raw message
Signature · 1 line
2.55.0