All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/7] firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.
Date: Tue, 11 May 2021 10:19:40 +0530	[thread overview]
Message-ID: <8b5bc4db-7f9a-2d43-855d-f08a002c5527@ti.com> (raw)
In-Reply-To: <20210510172442.11146-4-vigneshr@ti.com>



On 10/05/21 10:54 pm, Vignesh Raghavendra wrote:
> On J721e and J7200, MCU R5 core (boot master) itself would run Device
> Manager (DM) Firmware and interact with TI Foundational Security (TIFS)
> firmware to enable DMA and such other Resource Management (RM) services.
> So, during R5 SPL stage there is no such RM service available and ti_sci
> driver will have to directly interact with TIFS using DM to DMSC
> channels to request RM resources.

So, PM services are also not available at R5 and I do not see a new compatible
for PM services. Can you help me understand why we cannot follow the same as
being done in PM services.

One of my worry is ti_sci driver already needs a heavy cleanup. Now adding more
stuff to it will just keep increase the burden

Thanks and regards,
Lokesh

> 
> Therefore add DT binding and driver for the same. This driver will
> handle Resource Management services at R5 SPL stage.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  .../firmware/ti,j721e-dm-sci.txt              | 32 +++++++
>  drivers/firmware/ti_sci.c                     | 91 +++++++++++++++++--
>  2 files changed, 113 insertions(+), 10 deletions(-)
>  create mode 100644 doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
> 
> diff --git a/doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt b/doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
> new file mode 100644
> index 0000000000..0217341f0c
> --- /dev/null
> +++ b/doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
> @@ -0,0 +1,32 @@
> +Bindings for Texas Instruments System Control Interface (TI-SCI) Message
> +Protocol for Device Manager(DM) to TI Foundational Security(TIFS)
> +Firmware communication
> +
> +Required properties:
> +--------------------
> +- compatible: should be "ti,j721e-dm-sci"
> +- mbox-names:
> +	"rx" - Mailbox corresponding to receive path
> +	"tx" - Mailbox corresponding to transmit path
> +
> +- mboxes: Mailboxes corresponding to the mbox-names. Each value of the mboxes
> +	  property should contain a phandle to the mailbox controller device
> +	  node and an args specifier that will be the phandle to the intended
> +	  sub-mailbox child node to be used for communication.
> +
> +- ti,host-id: Host ID to use for communication.
> +
> +Optional Properties:
> +--------------------
> +- ti,secure-host: If the host is defined as secure.
> +
> +Example:
> +--------
> +	dm_tifs: dm-tifs {
> +		compatible = "ti,j721e-dm-sci";
> +		ti,host-id = <3>;
> +		ti,secure-host;
> +		mbox-names = "rx", "tx";
> +		mboxes= <&mcu_secproxy 21>,
> +			<&mcu_secproxy 23>;
> +	};
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index c27fbc682a..f75ad5db67 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -1669,8 +1669,9 @@ fail:
>  }
>  
>  static int __maybe_unused
> -ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
> -				 u16 *range_num)
> +ti_sci_cmd_get_resource_range_static(const struct ti_sci_handle *handle,
> +				     u32 dev_id, u8 subtype,
> +				     u16 *range_start, u16 *range_num)
>  {
>  	struct ti_sci_resource_static_data *data;
>  	int i = 0;
> @@ -1711,11 +1712,6 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
>  					 u32 dev_id, u8 subtype,
>  					 u16 *range_start, u16 *range_num)
>  {
> -	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
> -		return ti_sci_get_resource_range_static(dev_id, subtype,
> -							range_start,
> -							range_num);
> -
>  	return ti_sci_get_resource_range(handle, dev_id, subtype,
>  					 TI_SCI_IRQ_SECONDARY_HOST_INVALID,
>  					 range_start, range_num);
> @@ -1739,9 +1735,6 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
>  					     u32 dev_id, u8 subtype, u8 s_host,
>  					     u16 *range_start, u16 *range_num)
>  {
> -	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
> -		return -EINVAL;
> -
>  	return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
>  					 range_start, range_num);
>  }
> @@ -3051,6 +3044,58 @@ static int ti_sci_probe(struct udevice *dev)
>  	return ret;
>  }
>  
> +/**
> + * ti_sci_dm_probe() - Basic probe for DM to TIFS SCI
> + * @dev:	corresponding system controller interface device
> + *
> + * Return: 0 if all goes good, else appropriate error message.
> + */
> +static __maybe_unused int ti_sci_dm_probe(struct udevice *dev)
> +{
> +	struct ti_sci_rm_core_ops *rm_core_ops;
> +	struct ti_sci_rm_udmap_ops *udmap_ops;
> +	struct ti_sci_rm_ringacc_ops *rops;
> +	struct ti_sci_rm_psil_ops *psilops;
> +	struct ti_sci_ops *ops;
> +	struct ti_sci_info *info;
> +	int ret;
> +
> +	debug("%s(dev=%p)\n", __func__, dev);
> +
> +	info = dev_get_priv(dev);
> +	info->desc = (void *)dev_get_driver_data(dev);
> +
> +	ret = ti_sci_of_to_info(dev, info);
> +	if (ret) {
> +		dev_err(dev, "%s: Probe failed with error %d\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	info->dev = dev;
> +	info->seq = 0xA;
> +
> +	list_add_tail(&info->list, &ti_sci_list);
> +
> +	ops = &info->handle.ops;
> +
> +	rm_core_ops = &ops->rm_core_ops;
> +	rm_core_ops->get_range = ti_sci_cmd_get_resource_range_static;
> +
> +	rops = &ops->rm_ring_ops;
> +	rops->config = ti_sci_cmd_ring_config;
> +
> +	psilops = &ops->rm_psil_ops;
> +	psilops->pair = ti_sci_cmd_rm_psil_pair;
> +	psilops->unpair = ti_sci_cmd_rm_psil_unpair;
> +
> +	udmap_ops = &ops->rm_udmap_ops;
> +	udmap_ops->tx_ch_cfg = ti_sci_cmd_rm_udmap_tx_ch_cfg;
> +	udmap_ops->rx_ch_cfg = ti_sci_cmd_rm_udmap_rx_ch_cfg;
> +	udmap_ops->rx_flow_cfg = ti_sci_cmd_rm_udmap_rx_flow_cfg;
> +
> +	return ret;
> +}
> +
>  /*
>   * ti_sci_get_free_resource() - Get a free resource from TISCI resource.
>   * @res:	Pointer to the TISCI resource
> @@ -3188,6 +3233,14 @@ static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
>  	.max_msg_size = 60,
>  };
>  
> +/* Description for J721e DM to DMSC communication */
> +static const struct ti_sci_desc ti_sci_dm_j721e_desc = {
> +	.default_host_id = 3,
> +	.max_rx_timeout_ms = 10000,
> +	.max_msgs = 20,
> +	.max_msg_size = 60,
> +};
> +
>  static const struct udevice_id ti_sci_ids[] = {
>  	{
>  		.compatible = "ti,k2g-sci",
> @@ -3200,6 +3253,14 @@ static const struct udevice_id ti_sci_ids[] = {
>  	{ /* Sentinel */ },
>  };
>  
> +static __maybe_unused const struct udevice_id ti_sci_dm_ids[] = {
> +	{
> +		.compatible = "ti,j721e-dm-sci",
> +		.data = (ulong)&ti_sci_dm_j721e_desc
> +	},
> +	{ /* Sentinel */ },
> +};
> +
>  U_BOOT_DRIVER(ti_sci) = {
>  	.name = "ti_sci",
>  	.id = UCLASS_FIRMWARE,
> @@ -3207,3 +3268,13 @@ U_BOOT_DRIVER(ti_sci) = {
>  	.probe = ti_sci_probe,
>  	.priv_auto	= sizeof(struct ti_sci_info),
>  };
> +
> +#if IS_ENABLED(CONFIG_K3_DM_FW)
> +U_BOOT_DRIVER(ti_sci_dm) = {
> +	.name = "ti_sci_dm",
> +	.id = UCLASS_FIRMWARE,
> +	.of_match = ti_sci_dm_ids,
> +	.probe = ti_sci_dm_probe,
> +	.priv_auto = sizeof(struct ti_sci_info),
> +};
> +#endif
> 

  reply	other threads:[~2021-05-11  4:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 17:24 [PATCH 0/7] J72xx: R5 SPL DMA support post HSM Rearch Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 1/7] mailbox: k3-sec-proxy: Add DM to DMSC communication thread Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 2/7] firmware: ti_sci: Implement GET_RANGE with static data Vignesh Raghavendra
2021-05-11  4:42   ` Lokesh Vutla
2021-05-11  5:54     ` Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 3/7] firmware: ti_sci: Add support for Resoure Management at R5 SPL stage Vignesh Raghavendra
2021-05-11  4:49   ` Lokesh Vutla [this message]
2021-05-11  6:20     ` Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 4/7] ARM: dts: j72xx-r5-common-proc-board: Add DM firmware node Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 5/7] ARM: dts: k3: Add cfg register space for ringacc and udmap Vignesh Raghavendra
2021-05-11  4:51   ` Lokesh Vutla
2021-05-11  6:04     ` Vignesh Raghavendra
2021-05-12  6:10       ` Lokesh Vutla
2021-05-12  6:20         ` Vignesh Raghavendra
2021-05-12  6:39           ` Lokesh Vutla
2021-05-10 17:24 ` [PATCH 6/7] soc: ti: k3-navss-ringacc: Add support for native configuration of rings Vignesh Raghavendra
2021-05-10 17:24 ` [PATCH 7/7] dma: ti: k3-udma: Add support for native configuration of chan/flow Vignesh Raghavendra
2021-05-11 16:22 ` [PATCH 0/7] J72xx: R5 SPL DMA support post HSM Rearch Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b5bc4db-7f9a-2d43-855d-f08a002c5527@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.