All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/7] firmware: ti_sci: Implement GET_RANGE with static data
Date: Tue, 11 May 2021 10:12:17 +0530	[thread overview]
Message-ID: <23f555c4-9a15-61f1-914e-7acb1cb0d0f7@ti.com> (raw)
In-Reply-To: <20210510172442.11146-3-vigneshr@ti.com>



On 10/05/21 10:54 pm, Vignesh Raghavendra wrote:
> In case of R5 SPL, GET_RANGE API service is not available (as DM
> services are not yet up), therefore service such calls locally using
> per SoC static data.
> 
> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
> ---
>  drivers/firmware/ti_sci.c             | 36 +++++++++++
>  drivers/firmware/ti_sci_static_data.h | 92 +++++++++++++++++++++++++++
>  2 files changed, 128 insertions(+)
>  create mode 100644 drivers/firmware/ti_sci_static_data.h
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 2aec2e34d3..c27fbc682a 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -23,6 +23,7 @@
>  #include <linux/soc/ti/ti_sci_protocol.h>
>  
>  #include "ti_sci.h"
> +#include "ti_sci_static_data.h"
>  
>  /* List of all TI SCI devices active in system */
>  static LIST_HEAD(ti_sci_list);
> @@ -1667,6 +1668,33 @@ fail:
>  	return ret;
>  }
>  
> +static int __maybe_unused
> +ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
> +				 u16 *range_num)
> +{
> +	struct ti_sci_resource_static_data *data;
> +	int i = 0;
> +
> +	while (1) {
> +		data = &rm_static_data[i];
> +
> +		if (!data->dev_id)
> +			return -EINVAL;
> +
> +		if (data->dev_id != dev_id || data->subtype != subtype) {
> +			i++;
> +			continue;
> +		}
> +
> +		*range_start = data->range_start;
> +		*range_num = data->range_num;
> +
> +		return 0;
> +	}
> +
> +	return -EINVAL;
> +}
> +
>  /**
>   * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host
>   *				   that is same as ti sci interface host.
> @@ -1683,6 +1711,11 @@ 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);
> @@ -1706,6 +1739,9 @@ 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);
>  }
> diff --git a/drivers/firmware/ti_sci_static_data.h b/drivers/firmware/ti_sci_static_data.h
> new file mode 100644
> index 0000000000..2816cb2827
> --- /dev/null
> +++ b/drivers/firmware/ti_sci_static_data.h
> @@ -0,0 +1,92 @@
> +/* SPDX-License-Identifier: BSD-3-Clause */
> +/*
> + * Copyright (C)  2021 Texas Instruments Incorporated - http://www.ti.com/
> + *
> + */
> +
> +#ifndef __TI_SCI_STATIC_DATA_H
> +#define __TI_SCI_STATIC_DATA_H
> +
> +struct ti_sci_resource_static_data {
> +	u32 dev_id;
> +	u16 range_start;
> +	u16 range_num;
> +	u8 subtype;
> +};
> +
> +#if IS_ENABLED(CONFIG_K3_DM_FW)
> +
> +#ifdef CONFIG_TARGET_J721E_R5_EVM

want to be consistent across #if IS_ENABLED() or #ifdef?

> +static struct ti_sci_resource_static_data rm_static_data[] = {
> +	/* Free rings */
> +	{
> +		.dev_id = 235,
> +		.subtype = 1,
> +		.range_start = 124,
> +		.range_num = 32,
> +	},
> +	/* TX channels */
> +	{
> +		.dev_id = 236,
> +		.subtype = 13,
> +		.range_start = 6,
> +		.range_num = 2,
> +	},
> +	/* RX channels */
> +	{
> +		.dev_id = 236,
> +		.subtype = 10,
> +		.range_start = 6,
> +		.range_num = 2,
> +	},
> +	/* RX Free flows */
> +	{
> +		.dev_id = 236,
> +		.subtype = 0,
> +		.range_start = 60,
> +		.range_num = 8,
> +	},

For my understanding, does this need to be in sync with RM board config or this
can be independent?

Thanks and regards,
Lokesh

  reply	other threads:[~2021-05-11  4:42 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 [this message]
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
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=23f555c4-9a15-61f1-914e-7acb1cb0d0f7@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.