Skip to contentSkip to conversation

mfd: intel-m10-bmc: add sysfs files for mac_address

PATCH In review Russ Weight 2 participants 3 messages Jan 14, 2021 – Jan 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover mfd: intel-m10-bmc: add sysfs files for mac_address

Add two sysfs nodes to the Intel MAX10 BMC driver: mac_address and mac_count. The mac_address provides the first of a series of sequential MAC addresses assigned to the FPGA card. The mac_count indicates how many MAC addresses are assigned to the card.

Changelog v3 -> v4:
- Changed local variables macaddr1 and macaddr2 to macaddr_low and macaddr_high
- Change macros M10BMC_MACADDR1 and M10BMC_MACADDR2 to M10BMC_MAC_LOW and M10BMC_MAC_HIGH

Changelog v2 -> v3:
- Updated Date and KernelVersion in ABI documentation

Changelog v1 -> v2:
- Updated the documentation for the mac_address and mac_count sysfs nodes to clearify their usage.
- Changed sysfs _show() functions to use sysfs_emit() instead of sprintf.

Russ Weight (1):
mfd: intel-m10-bmc: expose mac address and count

 .../ABI/testing/sysfs-driver-intel-m10-bmc    | 21 +++++++++
 drivers/mfd/intel-m10-bmc.c                   | 43 +++++++++++++++++++
 include/linux/mfd/intel-m10-bmc.h             |  9 ++++
 3 files changed, 73 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/1 mfd: intel-m10-bmc: expose mac address and count

Create two sysfs entries for exposing the MAC address and count from the MAX10 BMC register space. The MAC address is the first in a sequential block of MAC addresses reserved for the FPGA card. The MAC count is the number of MAC addresses in the reserved block.

---
v4:
- Changed local variables macaddr1 and macaddr2 to macaddr_low and macaddr_high
- Change macros M10BMC_MACADDR1 and M10BMC_MACADDR2 to M10BMC_MAC_LOW and M10BMC_MAC_HIGH
v3:
- Updated Date and KernelVersion in ABI documentation
v2:
- Updated the documentation for the mac_address and mac_count sysfs nodes to clarify their usage.
- Changed sysfs _show() functions to use sysfs_emit() instead of sprintf.

---
 .../ABI/testing/sysfs-driver-intel-m10-bmc    | 21 +++++++++
 drivers/mfd/intel-m10-bmc.c                   | 43 +++++++++++++++++++
 include/linux/mfd/intel-m10-bmc.h             |  9 ++++
 3 files changed, 73 insertions(+)
Documentation/ABI/testing/sysfs-driver-intel-m10-bmc +21 -0
index 979a2d62513f..9773925138af 100644
@@ -13,3 +13,24 @@ Contact:	Xu Yilun <[email protected]>
 Description:	Read only. Returns the firmware version of Intel MAX10
 		BMC chip.
 		Format: "0x%x".
+
+What:		/sys/bus/spi/devices/.../mac_address
+Date:		January 2021
+KernelVersion:  5.12
+Contact:	Russ Weight <[email protected]>
+Description:	Read only. Returns the first MAC address in a block
+		of sequential MAC addresses assigned to the board
+		that is managed by the Intel MAX10 BMC. It is stored in
+		FLASH storage and is mirrored in the MAX10 BMC register
+		space.
+		Format: "%02x:%02x:%02x:%02x:%02x:%02x".
+
+What:		/sys/bus/spi/devices/.../mac_count
+Date:		January 2021
+KernelVersion:  5.12
+Contact:	Russ Weight <[email protected]>
+Description:	Read only. Returns the number of sequential MAC
+		addresses assigned to the board managed by the Intel
+		MAX10 BMC. This value is stored in FLASH and is mirrored
+		in the MAX10 BMC register space.
+		Format: "%u".
drivers/mfd/intel-m10-bmc.c +43 -0

52 lines not on this page · raw message

include/linux/mfd/intel-m10-bmc.h +9 -0
index c8ef2f1654a4..74d4e193966a 100644
@@ -15,6 +15,15 @@
 
 /* Register offset of system registers */
 #define NIOS2_FW_VERSION		0x0
+#define M10BMC_MAC_LOW			0x10
+#define M10BMC_MAC_BYTE4		GENMASK(7, 0)
+#define M10BMC_MAC_BYTE3		GENMASK(15, 8)
+#define M10BMC_MAC_BYTE2		GENMASK(23, 16)
+#define M10BMC_MAC_BYTE1		GENMASK(31, 24)
+#define M10BMC_MAC_HIGH			0x14
+#define M10BMC_MAC_BYTE6		GENMASK(7, 0)
+#define M10BMC_MAC_BYTE5		GENMASK(15, 8)
+#define M10BMC_MAC_COUNT		GENMASK(23, 16)
 #define M10BMC_TEST_REG			0x3c
 #define M10BMC_BUILD_VER		0x68
 #define M10BMC_VER_MAJOR_MSK		GENMASK(23, 16)
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v4 1/1] mfd: intel-m10-bmc: expose mac address and count

Quoted 21 lines · Russ Weight

Create two sysfs entries for exposing the MAC address and count from the MAX10 BMC register space. The MAC address is the first in a sequential block of MAC addresses reserved for the FPGA card. The MAC count is the number of MAC addresses in the reserved block.

---
v4:
- Changed local variables macaddr1 and macaddr2 to macaddr_low and macaddr_high
- Change macros M10BMC_MACADDR1 and M10BMC_MACADDR2 to M10BMC_MAC_LOW and M10BMC_MAC_HIGH
v3:
- Updated Date and KernelVersion in ABI documentation
v2:
- Updated the documentation for the mac_address and mac_count sysfs nodes to clarify their usage.
- Changed sysfs _show() functions to use sysfs_emit() instead of sprintf.

Quoted 5 lines
---
 .../ABI/testing/sysfs-driver-intel-m10-bmc    | 21 +++++++++
 drivers/mfd/intel-m10-bmc.c                   | 43 +++++++++++++++++++
 include/linux/mfd/intel-m10-bmc.h             |  9 ++++
 3 files changed, 73 insertions(+)

Changed the subject line to start with an uppercase char and used more width in the commit message and applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog