mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-19 15:18:13 +01:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
79 lines
1.8 KiB
C
79 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Xilinx Versal NET SOC driver
|
|
*
|
|
* Copyright (C) 2022, Advanced Micro Devices, Inc.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <soc.h>
|
|
#include <zynqmp_firmware.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/hardware.h>
|
|
|
|
#include <linux/bitfield.h>
|
|
|
|
/*
|
|
* v1 -> 0x10 - ES1
|
|
* v2 -> 0x20 - Production
|
|
*/
|
|
static const char versal_family[] = "Versal NET";
|
|
|
|
struct soc_xilinx_versal_net_priv {
|
|
const char *family;
|
|
char revision;
|
|
};
|
|
|
|
static int soc_xilinx_versal_net_get_family(struct udevice *dev, char *buf, int size)
|
|
{
|
|
struct soc_xilinx_versal_net_priv *priv = dev_get_priv(dev);
|
|
|
|
return snprintf(buf, size, "%s", priv->family);
|
|
}
|
|
|
|
static int soc_xilinx_versal_net_get_revision(struct udevice *dev, char *buf, int size)
|
|
{
|
|
struct soc_xilinx_versal_net_priv *priv = dev_get_priv(dev);
|
|
|
|
return snprintf(buf, size, "v%d", priv->revision);
|
|
}
|
|
|
|
static const struct soc_ops soc_xilinx_versal_net_ops = {
|
|
.get_family = soc_xilinx_versal_net_get_family,
|
|
.get_revision = soc_xilinx_versal_net_get_revision,
|
|
};
|
|
|
|
static int soc_xilinx_versal_net_probe(struct udevice *dev)
|
|
{
|
|
struct soc_xilinx_versal_net_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,
|
|
ret_payload);
|
|
if (ret)
|
|
return ret;
|
|
} else {
|
|
ret_payload[2] = readl(PMC_TAP_VERSION);
|
|
if (!ret_payload[2])
|
|
return -EINVAL;
|
|
}
|
|
|
|
priv->revision = FIELD_GET(PS_VERSION_MASK, ret_payload[2]);
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_DRIVER(soc_xilinx_versal_net) = {
|
|
.name = "soc_xilinx_versal_net",
|
|
.id = UCLASS_SOC,
|
|
.ops = &soc_xilinx_versal_net_ops,
|
|
.probe = soc_xilinx_versal_net_probe,
|
|
.priv_auto = sizeof(struct soc_xilinx_versal_net_priv),
|
|
.flags = DM_FLAG_PRE_RELOC,
|
|
};
|