From: Alexandru Ardelean <ardeleana...@gmail.com> Converts an MAC array of u8 to a u64 value.
Signed-off-by: Alexandru Ardelean <ardeleana...@gmail.com> --- target/linux/generic/files/drivers/net/phy/b53/b53_regs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h index ba50915..4379c58 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h @@ -20,6 +20,16 @@ #ifndef __B53_REGS_H #define __B53_REGS_H +/* Utility function for converting u8 arrays into u64 values to be written with b53_write */ +static inline u64 b53_mac_array_to_u64(const u8 *u8_arr) { + u64 mac = (*(const u64 *)u8_arr); +#ifdef __BIG_ENDIAN + return (mac >> 16); +#else + return (mac << 16); +#endif +} + /* Management Port (SMP) Page offsets */ #define B53_CTRL_PAGE 0x00 /* Control */ #define B53_STAT_PAGE 0x01 /* Status */ -- 2.1.2 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel