Skip to content

Commit d980e1c

Browse files
asullerogabbay
authored andcommitted
accel/habanalabs: report 3 instances of Infineon second stage
Infineon controller second stage has 3 instances that their version need to be reported by driver. Signed-off-by: Ariel Suller <asuller@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
1 parent 7259eb7 commit d980e1c

File tree

1 file changed

+18
-2
lines changed
  • drivers/accel/habanalabs/common

1 file changed

+18
-2
lines changed

drivers/accel/habanalabs/common/sysfs.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "habanalabs.h"
99

1010
#include <linux/pci.h>
11+
#include <linux/types.h>
1112

1213
static ssize_t clk_max_freq_mhz_show(struct device *dev, struct device_attribute *attr, char *buf)
1314
{
@@ -80,12 +81,27 @@ static ssize_t vrm_ver_show(struct device *dev, struct device_attribute *attr, c
8081
{
8182
struct hl_device *hdev = dev_get_drvdata(dev);
8283
struct cpucp_info *cpucp_info;
84+
u32 infineon_second_stage_version;
85+
u32 infineon_second_stage_first_instance;
86+
u32 infineon_second_stage_second_instance;
87+
u32 infineon_second_stage_third_instance;
88+
u32 mask = 0xff;
8389

8490
cpucp_info = &hdev->asic_prop.cpucp_info;
8591

92+
infineon_second_stage_version = le32_to_cpu(cpucp_info->infineon_second_stage_version);
93+
infineon_second_stage_first_instance = infineon_second_stage_version & mask;
94+
infineon_second_stage_second_instance =
95+
(infineon_second_stage_version >> 8) & mask;
96+
infineon_second_stage_third_instance =
97+
(infineon_second_stage_version >> 16) & mask;
98+
8699
if (cpucp_info->infineon_second_stage_version)
87-
return sprintf(buf, "%#04x %#04x\n", le32_to_cpu(cpucp_info->infineon_version),
88-
le32_to_cpu(cpucp_info->infineon_second_stage_version));
100+
return sprintf(buf, "%#04x %#04x:%#04x:%#04x\n",
101+
le32_to_cpu(cpucp_info->infineon_version),
102+
infineon_second_stage_first_instance,
103+
infineon_second_stage_second_instance,
104+
infineon_second_stage_third_instance);
89105
else
90106
return sprintf(buf, "%#04x\n", le32_to_cpu(cpucp_info->infineon_version));
91107
}

0 commit comments

Comments
 (0)