[PATCH v3 5/7] soc: xilinx: zynqmp: Use zynqmp_pm_get_chipid() to get chip revision

Michal Simek michal.simek at amd.com
Thu Jun 6 16:16:32 CEST 2024



On 6/4/24 16:27, lukas.funke-oss at weidmueller.com wrote:
> From: Lukas Funke <lukas.funke at weidmueller.com>
> 
> Use common zynqmp_pm_get_chipid() function to get the chip revision
> 
> Signed-off-by: Lukas Funke <lukas.funke at weidmueller.com>
> ---
> 
> (no changes since v1)
> 
>   drivers/soc/soc_xilinx_zynqmp.c | 21 +++++++++------------
>   1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/soc/soc_xilinx_zynqmp.c b/drivers/soc/soc_xilinx_zynqmp.c
> index d8b4f172a39..8a65810b7d7 100644
> --- a/drivers/soc/soc_xilinx_zynqmp.c
> +++ b/drivers/soc/soc_xilinx_zynqmp.c
> @@ -346,22 +346,21 @@ static const struct soc_ops soc_xilinx_zynqmp_ops = {
>   static int soc_xilinx_zynqmp_probe(struct udevice *dev)
>   {
>   	struct soc_xilinx_zynqmp_priv *priv = dev_get_priv(dev);
> -	u32 ret_payload[PAYLOAD_ARG_CNT];
> +	u32 idcode, version;
>   	int ret;
>   
>   	priv->family = zynqmp_family;
>   
> -	if (!IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE))
> -		ret = zynqmp_mmio_read(ZYNQMP_PS_VERSION, &ret_payload[2]);
> +	if (!CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE))
> +		ret = zynqmp_mmio_read(ZYNQMP_PS_VERSION, &version);
>   	else
> -		ret = xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0,
> -					ret_payload);
> +		ret = zynqmp_pm_get_chipid(&idcode, &version);
>   	if (ret < 0)
>   		return ret;
>   
> -	priv->revision = ret_payload[2] & ZYNQMP_PS_VER_MASK;
> +	priv->revision = version & ZYNQMP_PS_VER_MASK;
>   
> -	if (IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE)) {
> +	if (CONFIG_IS_ENABLED(ZYNQMP_FIRMWARE)) {
>   		/*
>   		 * Firmware returns:
>   		 * payload[0][31:0] = status of the operation
> @@ -370,11 +369,9 @@ static int soc_xilinx_zynqmp_probe(struct udevice *dev)
>   		 * payload[2][28:20] = EXTENDED_IDCODE
>   		 * payload[2][29] = PL_INIT
>   		 */
> -		u32 idcode = ret_payload[1];
> -		u32 idcode2 = ret_payload[2] >>
> -				   ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
> -		dev_dbg(dev, "IDCODE: 0x%0x, IDCODE2: 0x%0x\n", idcode,
> -			idcode2);
> +		u32 idcode2 = version >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
> +
> +		dev_dbg(dev, "IDCODE: 0x%0x, IDCODE2: 0x%0x\n", idcode, idcode2);
>   
>   		ret = soc_xilinx_zynqmp_detect_machine(dev, idcode, idcode2);
>   		if (ret)

Looks good.
Reviewed-by: Michal Simek <michal.simek at amd.com>

Thanks,
Michal


More information about the U-Boot mailing list