Commit 56f0b750 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmutil: add helper function to format board revision

The board revision that is available in hardware can be translated
so it matches the labelling on the board. This is accomplished by
this helper function.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 87dd2d76
...@@ -261,6 +261,21 @@ struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, ...@@ -261,6 +261,21 @@ struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp,
} }
EXPORT_SYMBOL(brcmu_pktq_mdeq); EXPORT_SYMBOL(brcmu_pktq_mdeq);
/* Produce a human-readable string for boardrev */
char *brcmu_boardrev_str(u32 brev, char *buf)
{
char c;
if (brev < 0x100) {
snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf);
} else {
c = (brev & 0xf000) == 0x1000 ? 'P' : 'A';
snprintf(buf, 8, "%c%03x", c, brev & 0xfff);
}
return buf;
}
EXPORT_SYMBOL(brcmu_boardrev_str);
#if defined(DEBUG) #if defined(DEBUG)
/* pretty hex print a pkt buffer chain */ /* pretty hex print a pkt buffer chain */
void brcmu_prpkt(const char *msg, struct sk_buff *p0) void brcmu_prpkt(const char *msg, struct sk_buff *p0)
...@@ -292,4 +307,5 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...) ...@@ -292,4 +307,5 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size); print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size);
} }
EXPORT_SYMBOL(brcmu_dbg_hex_dump); EXPORT_SYMBOL(brcmu_dbg_hex_dump);
#endif /* defined(DEBUG) */ #endif /* defined(DEBUG) */
...@@ -218,4 +218,6 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...) ...@@ -218,4 +218,6 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
} }
#endif #endif
char *brcmu_boardrev_str(u32 brev, char *buf);
#endif /* _BRCMU_UTILS_H_ */ #endif /* _BRCMU_UTILS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment