All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: zynqmp: Add support for SVD devices
@ 2021-05-19  8:44 Michal Simek
  2021-05-31  8:26 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2021-05-19  8:44 UTC (permalink / raw)
  To: u-boot

SVD (Software Virtual Devices) are using different name which can't be
handled via zynqmp_devices structure. That's why introduce
zynqmp_detect_svd_name() which checks ID code for these devices and show
proper name for them.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/zynqmp/zynqmp.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index d05f0b2e1202..6e353e3b0a57 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -185,6 +185,32 @@ static const struct {
 	},
 };
 
+static const struct {
+	u32 id;
+	char *name;
+} zynqmp_svd_devices[] = {
+	{
+		.id = 0x04714093,
+		.name = "xck24"
+	},
+	{
+		.id = 0x04724093,
+		.name = "xck26",
+	},
+};
+
+static char *zynqmp_detect_svd_name(u32 idcode)
+{
+	u32 i;
+
+	for (i = 0; i < ARRAY_SIZE(zynqmp_svd_devices); i++) {
+		if (zynqmp_svd_devices[i].id == (idcode & 0x0FFFFFFF))
+			return zynqmp_svd_devices[i].name;
+	}
+
+	return "unknown";
+}
+
 static char *zynqmp_get_silicon_idcode_name(void)
 {
 	u32 i;
@@ -219,7 +245,7 @@ static char *zynqmp_get_silicon_idcode_name(void)
 	}
 
 	if (i >= ARRAY_SIZE(zynqmp_devices))
-		return "unknown";
+		return zynqmp_detect_svd_name(idcode);
 
 	/* Add device prefix to the name */
 	ret = snprintf(name, ZYNQMP_VERSION_SIZE, "zu%d",
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: zynqmp: Add support for SVD devices
  2021-05-19  8:44 [PATCH] arm64: zynqmp: Add support for SVD devices Michal Simek
@ 2021-05-31  8:26 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2021-05-31  8:26 UTC (permalink / raw)
  To: U-Boot, git

st 19. 5. 2021 v 10:45 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> SVD (Software Virtual Devices) are using different name which can't be
> handled via zynqmp_devices structure. That's why introduce
> zynqmp_detect_svd_name() which checks ID code for these devices and show
> proper name for them.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/zynqmp/zynqmp.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index d05f0b2e1202..6e353e3b0a57 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -185,6 +185,32 @@ static const struct {
>         },
>  };
>
> +static const struct {
> +       u32 id;
> +       char *name;
> +} zynqmp_svd_devices[] = {
> +       {
> +               .id = 0x04714093,
> +               .name = "xck24"
> +       },
> +       {
> +               .id = 0x04724093,
> +               .name = "xck26",
> +       },
> +};
> +
> +static char *zynqmp_detect_svd_name(u32 idcode)
> +{
> +       u32 i;
> +
> +       for (i = 0; i < ARRAY_SIZE(zynqmp_svd_devices); i++) {
> +               if (zynqmp_svd_devices[i].id == (idcode & 0x0FFFFFFF))
> +                       return zynqmp_svd_devices[i].name;
> +       }
> +
> +       return "unknown";
> +}
> +
>  static char *zynqmp_get_silicon_idcode_name(void)
>  {
>         u32 i;
> @@ -219,7 +245,7 @@ static char *zynqmp_get_silicon_idcode_name(void)
>         }
>
>         if (i >= ARRAY_SIZE(zynqmp_devices))
> -               return "unknown";
> +               return zynqmp_detect_svd_name(idcode);
>
>         /* Add device prefix to the name */
>         ret = snprintf(name, ZYNQMP_VERSION_SIZE, "zu%d",
> --
> 2.31.1
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-31  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  8:44 [PATCH] arm64: zynqmp: Add support for SVD devices Michal Simek
2021-05-31  8:26 ` Michal Simek

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.