[PATCH v3 18/22] firmware: ti: ti_sci_device: Move device ops into its own file
Sebin Francis
sebin.francis at ti.com
Wed Dec 2 05:48:21 PST 2026
Hi Beleswar,
On 29/10/26 23:41, Beleswar Padhi wrote:
> From: Andrew Davis <afd at ti.com>
>
> Extract the device operations related functions and services from
> ti_sci_core.c into its own file. This breaks down the single large file
> into smaller logical files for better readability and maintenance.
>
> Signed-off-by: Andrew Davis <afd at ti.com>
> Signed-off-by: Beleswar Padhi <b-padhi at ti.com>
> ---
> v3: Changelog:
> 1. Update commit message to remove ti_sci_core.c file renaming as that
> is already done in [PATCH v3 16/22] now.
>
> Link to v2:
> https://lore.kernel.org/all/20260930160607.2674980-19-b-padhi@ti.com/
>
> v2: Changelog:
> 1. None to this patch.
>
> Link to v1:
> https://lore.kernel.org/all/20260929201746.4078803-19-b-padhi@ti.com/
>
> drivers/firmware/ti/Makefile | 1 +
> drivers/firmware/ti/ti_sci.h | 7 +
> drivers/firmware/ti/ti_sci_core.c | 378 +--------------------------
> drivers/firmware/ti/ti_sci_device.c | 388 ++++++++++++++++++++++++++++
> 4 files changed, 401 insertions(+), 373 deletions(-)
> create mode 100644 drivers/firmware/ti/ti_sci_device.c
>
> diff --git a/drivers/firmware/ti/Makefile b/drivers/firmware/ti/Makefile
> index ca54cd35eaef2..a3a056eedd9a5 100644
> --- a/drivers/firmware/ti/Makefile
> +++ b/drivers/firmware/ti/Makefile
> @@ -1,4 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
>
> ti_sci-y := ti_sci_core.o
> +ti_sci-y += ti_sci_device.o
> obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
> diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
> index f2f17bcac39e4..79f56699faf29 100644
> --- a/drivers/firmware/ti/ti_sci.h
> +++ b/drivers/firmware/ti/ti_sci.h
> @@ -1560,4 +1560,11 @@ struct ti_sci_msg_resp_get_status {
> u32 status_flags;
> } __packed;
>
> +int ti_sci_do_xfer(const struct ti_sci_handle *handle,
> + u16 msg_type, u32 msg_flags,
> + void *tx_message, size_t tx_message_size,
> + void *rx_message, size_t rx_message_size);
> +
> +void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops);
> +
> #endif /* __TI_SCI_H */
> diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
> index 5d3151571ac33..e98bf3c5f9dc1 100644
> --- a/drivers/firmware/ti/ti_sci_core.c
> +++ b/drivers/firmware/ti/ti_sci_core.c
> @@ -444,10 +444,10 @@ static inline bool ti_sci_is_response_ack(void *r)
> * corresponding error if transmit fails, or
> * return 0, if all goes well.
> */
> -static inline int ti_sci_do_xfer(const struct ti_sci_handle *handle,
> - u16 msg_type, u32 msg_flags,
> - void *tx_message, size_t tx_message_size,
> - void *rx_message, size_t rx_message_size)
> +int ti_sci_do_xfer(const struct ti_sci_handle *handle,
> + u16 msg_type, u32 msg_flags,
> + void *tx_message, size_t tx_message_size,
> + void *rx_message, size_t rx_message_size)
> {
> struct ti_sci_info *info;
> struct ti_sci_xfer *xfer;
> @@ -565,361 +565,6 @@ static int ti_sci_cmd_get_revision(struct ti_sci_info *info)
> return 0;
> }
>
> -/**
> - * ti_sci_set_device_state() - Set device state helper
> - * @handle: pointer to TI SCI handle
> - * @id: Device identifier
> - * @flags: flags to setup for the device
> - * @state: State to move the device to
> - *
> - * Return: 0 if all went well, else returns appropriate error value.
> - */
> -static int ti_sci_set_device_state(const struct ti_sci_handle *handle,
> - u32 id, u32 flags, u8 state)
> -{
> - struct ti_sci_msg_req_set_device_state req;
> - struct ti_sci_msg_hdr resp;
> - int ret = 0;
> -
> - req.id = id;
> - req.state = state;
> -
> - ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_DEVICE_STATE,
> - flags | TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
> - &req, sizeof(req),
> - &resp, sizeof(resp));
> - if (ret)
> - return ret;
> -
> - return 0;
> -}
> -
> -/**
> - * ti_sci_get_device_state() - Get device state helper
> - * @handle: Handle to the device
> - * @id: Device Identifier
> - * @clcnt: Pointer to Context Loss Count
> - * @resets: pointer to resets
> - * @p_state: pointer to p_state
> - * @c_state: pointer to c_state
> - *
> - * Return: 0 if all went fine, else return appropriate error.
> - */
> -static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
> - u32 id, u32 *clcnt, u32 *resets,
> - u8 *p_state, u8 *c_state)
Very minor: there is an extra space before c_state, resets
Sebin
> -{
> - struct ti_sci_msg_req_get_device_state req;
> - struct ti_sci_msg_resp_get_device_state resp;
> - int ret = 0;
> -
> - if (!clcnt && !resets && !p_state && !c_state)
> - return -EINVAL;
---
> +}
> +
> +/*
Minor
/** instead of /*
Sebin
> + * ti_sci_setup_device_ops() - Setup the device operations structures
> + * @dops: pointer to TISCI device ops structure
> + */
> +void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops)
> +{
> + dops->get_device = ti_sci_cmd_get_device;
> + dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive;
> + dops->idle_device = ti_sci_cmd_idle_device;
> + dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive;
> + dops->put_device = ti_sci_cmd_put_device;
> +
> + dops->is_valid = ti_sci_cmd_dev_is_valid;
> + dops->get_context_loss_count = ti_sci_cmd_dev_get_clcnt;
> + dops->is_idle = ti_sci_cmd_dev_is_idle;
> + dops->is_stop = ti_sci_cmd_dev_is_stop;
> + dops->is_on = ti_sci_cmd_dev_is_on;
> + dops->is_transitioning = ti_sci_cmd_dev_is_trans;
> + dops->set_device_resets = ti_sci_cmd_set_device_resets;
> + dops->get_device_resets = ti_sci_cmd_get_device_resets;
> +}
More information about the linux-arm-kernel
mailing list