mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-22 18:01:29 +01:00
Currently xilinx_pm_request API supports four u32 payloads. However the legacy SMC format supports five u32 request payloads and extended SMC format supports six u32 request payloads. Add support for the same in xilinx_pm_request API. Also add two dummy arguments to all the callers of xilinx_pm_request. The TF-A always fills seven u32 return payload so add support for the same in xilinx_pm_request API. Signed-off-by: Naman Trivedi <naman.trivedimanojbhai@amd.com> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Acked-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/5ae6b560741f3ca8b89059c4ebb87acf75b4718e.1756388537.git.michal.simek@amd.com
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Xilinx Versal SOC driver
|
|
*
|
|
* Copyright (C) 2021 Xilinx, Inc.
|
|
*/
|
|
|
|
#include <dm.h>
|
|
#include <soc.h>
|
|
#include <zynqmp_firmware.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/hardware.h>
|
|
|
|
/*
|
|
* v1 -> 0x10 - ES1
|
|
* v2 -> 0x20 - Production
|
|
*/
|
|
static const char versal_family[] = "Versal";
|
|
|
|
struct soc_xilinx_versal_priv {
|
|
const char *family;
|
|
char revision;
|
|
};
|
|
|
|
static int soc_xilinx_versal_get_family(struct udevice *dev, char *buf, int size)
|
|
{
|
|
struct soc_xilinx_versal_priv *priv = dev_get_priv(dev);
|
|
|
|
return snprintf(buf, size, "%s", priv->family);
|
|
}
|
|
|
|
static int soc_xilinx_versal_get_revision(struct udevice *dev, char *buf, int size)
|
|
{
|
|
struct soc_xilinx_versal_priv *priv = dev_get_priv(dev);
|
|
|
|
return snprintf(buf, size, "v%d", priv->revision);
|
|
}
|
|
|
|
static const struct soc_ops soc_xilinx_versal_ops = {
|
|
.get_family = soc_xilinx_versal_get_family,
|
|
.get_revision = soc_xilinx_versal_get_revision,
|
|
};
|
|
|
|
static int soc_xilinx_versal_probe(struct udevice *dev)
|
|
{
|
|
struct soc_xilinx_versal_priv *priv = dev_get_priv(dev);
|
|
u32 ret_payload[PAYLOAD_ARG_CNT];
|
|
int ret;
|
|
|
|
priv->family = versal_family;
|
|
|
|
if (IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE)) {
|
|
ret = xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0,
|
|
0, 0, ret_payload);
|
|
if (ret)
|
|
return ret;
|
|
} else {
|
|
ret_payload[2] = readl(VERSAL_PS_PMC_VERSION);
|
|
if (!ret_payload[2])
|
|
return -EINVAL;
|
|
}
|
|
|
|
priv->revision = ret_payload[2] >> VERSAL_PS_VER_SHIFT;
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_DRIVER(soc_xilinx_versal) = {
|
|
.name = "soc_xilinx_versal",
|
|
.id = UCLASS_SOC,
|
|
.ops = &soc_xilinx_versal_ops,
|
|
.probe = soc_xilinx_versal_probe,
|
|
.priv_auto = sizeof(struct soc_xilinx_versal_priv),
|
|
.flags = DM_FLAG_PRE_RELOC,
|
|
};
|