public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tanmay Shah <tanmay.shah@amd.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	andersson@kernel.org, mathieu.poirier@linaro.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, michal.simek@amd.com, ben.levinsky@amd.com
Cc: linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] drivers: remoteproc: add Versal and Versal-NET support
Date: Mon, 18 Mar 2024 20:06:37 -0500	[thread overview]
Message-ID: <a0cdfa4c-9257-49e7-b519-54e7fd0fb230@amd.com> (raw)
In-Reply-To: <db6f16af-e715-4ff5-84d6-2d85d62d7c0c@linaro.org>



On 3/17/24 1:55 PM, Krzysztof Kozlowski wrote:
> On 15/03/2024 22:15, Tanmay Shah wrote:
>> AMD-Xilinx Versal and Versal-NET are successor of ZynqMP platform. ZynqMP
>> remoteproc driver is mostly compatible with new platforms except few
>> platform specific differences.
>> 
>> Versal has same IP of cortex-R5 cores hence maintained compatible string
>> same as ZynqMP platform. However, hardcode TCM addresses are not
>> supported for new platforms and must be provided in device-tree as per
>> new bindings. This makes TCM representation data-driven and easy to
>> maintain. This check is provided in the driver.
>> 
>> For Versal-NET platform, TCM doesn't need to be configured in lockstep
>> mode or split mode. Hence that call to PMC firmware is avoided in the
>> driver for Versal-NET platform.
>> 
>> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
>> ---
>>  drivers/remoteproc/xlnx_r5_remoteproc.c | 19 +++++++++++++++----
>>  1 file changed, 15 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c
>> index d4a22caebaad..193bc159d1b4 100644
>> --- a/drivers/remoteproc/xlnx_r5_remoteproc.c
>> +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c
>> @@ -323,9 +323,12 @@ static int zynqmp_r5_set_mode(struct zynqmp_r5_core *r5_core,
>>  		return ret;
>>  	}
>>  
>> -	ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id, tcm_mode);
>> -	if (ret < 0)
>> -		dev_err(r5_core->dev, "failed to configure TCM\n");
>> +	/* TCM configuration is not needed in versal-net */
>> +	if (device_is_compatible(r5_core->dev, "xlnx,zynqmp-r5f")) {
>> +		ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id, tcm_mode);
>> +		if (ret < 0)
>> +			dev_err(r5_core->dev, "failed to configure TCM\n");
>> +	}
>>  
>>  	return ret;
>>  }
>> @@ -933,10 +936,17 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
>>  	int ret, i;
>>  
>>  	r5_core = cluster->r5_cores[0];
>> +
>> +	/*
>> +	 * New platforms must use device tree for TCM parsing.
>> +	 * Only ZynqMP uses hardcode TCM.
>> +	 */
>>  	if (of_find_property(r5_core->np, "reg", NULL))
>>  		ret = zynqmp_r5_get_tcm_node_from_dt(cluster);
>> -	else
>> +	else if (of_machine_is_compatible("xlnx,zynqmp"))
>>  		ret = zynqmp_r5_get_tcm_node(cluster);
> 
> That's poor code. Your drivers should not depend on platform. I don't
> understand why you need to do this and how is even related to this patch.

You are correct, ideally this shouldn't be needed. However, this driver contains
hardcode TCM addresses that were used before TCM bindings were designed and available in
device-tree. This check is provided to maintain backward compatibility with device-tree
where TCM isn't expected.

For new platforms (Versal and Versal-NET) TCM must be provided in device-tree and for
ZynqMP if it's not in device-tree then to maintain backward compatibility hardcode
addresses are used.

Thanks.


> 
> 
> Best regards,
> Krzysztof
> 


  reply	other threads:[~2024-03-19  1:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 21:15 [PATCH 0/3] Add Versal and Versal-NET platform support Tanmay Shah
2024-03-15 21:15 ` [PATCH 1/3] dt-bindings: remoteproc: add Versal " Tanmay Shah
2024-03-17 14:50   ` Conor Dooley
2024-03-17 14:52     ` Conor Dooley
2024-03-19  0:37     ` Tanmay Shah
2024-03-19  5:40       ` Krzysztof Kozlowski
2024-03-17 18:50   ` Krzysztof Kozlowski
2024-03-19  0:39     ` Tanmay Shah
2024-03-15 21:15 ` [PATCH 2/3] dt-bindings: remoteproc: add Versal-NET platform Tanmay Shah
2024-03-17 18:53   ` Krzysztof Kozlowski
2024-03-19  0:51     ` Tanmay Shah
2024-03-19  5:30       ` Krzysztof Kozlowski
2024-03-19 14:42         ` Tanmay Shah
2024-03-20  7:40           ` Krzysztof Kozlowski
2024-03-20 15:14             ` Tanmay Shah
2024-03-21  7:39               ` Krzysztof Kozlowski
2024-03-21 15:13                 ` Tanmay Shah
2024-03-22  5:44                   ` Krzysztof Kozlowski
2024-03-22 18:28                     ` Tanmay Shah
2024-03-15 21:15 ` [PATCH 3/3] drivers: remoteproc: add Versal and Versal-NET support Tanmay Shah
2024-03-17 18:55   ` Krzysztof Kozlowski
2024-03-19  1:06     ` Tanmay Shah [this message]
2024-03-19  5:25       ` Krzysztof Kozlowski
2024-03-19 14:50         ` Tanmay Shah

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=a0cdfa4c-9257-49e7-b519-54e7fd0fb230@amd.com \
    --to=tanmay.shah@amd.com \
    --cc=andersson@kernel.org \
    --cc=ben.levinsky@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox