mirror of
https://github.com/ipxe/ipxe
synced 2026-01-22 12:08:58 +03:00
[dwmac] Show core version in debug messages
Read and display the core version immediately after mapping the MMIO registers, to provide a basic sanity check that the registers have been correctly mapped and the core is not held in reset. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -552,6 +552,7 @@ static int dwmac_probe ( struct dt_device *dt, unsigned int offset ) {
|
||||
struct net_device *netdev;
|
||||
struct dwmac *dwmac;
|
||||
union dwmac_mac mac;
|
||||
uint32_t version;
|
||||
int rc;
|
||||
|
||||
/* Allocate and initialise net device */
|
||||
@@ -580,6 +581,12 @@ static int dwmac_probe ( struct dt_device *dt, unsigned int offset ) {
|
||||
rc = -ENODEV;
|
||||
goto err_ioremap;
|
||||
}
|
||||
version = readl ( dwmac->regs + DWMAC_VER );
|
||||
DBGC ( dwmac, "DWMAC %s version %x.%x (user %x.%x)\n", dwmac->name,
|
||||
DWMAC_VER_CORE_MAJOR ( version ),
|
||||
DWMAC_VER_CORE_MINOR ( version ),
|
||||
DWMAC_VER_USER_MAJOR ( version ),
|
||||
DWMAC_VER_USER_MINOR ( version ) );
|
||||
|
||||
/* Fetch devicetree MAC address */
|
||||
if ( ( rc = fdt_mac ( &sysfdt, offset, netdev ) ) != 0 ) {
|
||||
|
||||
@@ -38,6 +38,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Version register */
|
||||
#define DWMAC_VER DWMAC_MAC_REG ( 8 )
|
||||
#define DWMAC_VER_USER_MAJOR( x ) \
|
||||
( ( (x) >> 12 ) & 0xf ) /**< User major version */
|
||||
#define DWMAC_VER_USER_MINOR( x ) \
|
||||
( ( (x) >> 8 ) & 0xf ) /**< User minor version */
|
||||
#define DWMAC_VER_CORE_MAJOR( x ) \
|
||||
( ( (x) >> 4 ) & 0xf ) /**< Core major version */
|
||||
#define DWMAC_VER_CORE_MINOR( x ) \
|
||||
( ( (x) >> 0 ) & 0xf ) /**< Core minor version */
|
||||
|
||||
/** Debug register */
|
||||
#define DWMAC_DEBUG DWMAC_MAC_REG ( 9 )
|
||||
|
||||
Reference in New Issue
Block a user