struct net_device *netdev;
struct dwmac *dwmac;
union dwmac_mac mac;
+ uint32_t version;
int rc;
/* Allocate and initialise net device */
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 ) {
/** 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 )