1 /****************************************************************************
2  * Support for the Synopsys MAC 10/100/1000 on-chip Ethernet controllers
3  *
4  * Copyright (C) 2007-2009  STMicroelectronics Ltd
5  *
6  * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License version 2 as published
10  * by the Free Software Foundation, incorporated herein by reference.
11  */
12 
13 #include <stdio.h>
14 #include <string.h>
15 #include "internal.h"
16 
17 #define MAC100_DMA_REG_NUM	9
18 #define GMAC_REG_NUM		55
19 #define GMAC_DMA_REG_NUM	23
20 
st_mac100_dump_regs(struct ethtool_drvinfo * info maybe_unused,struct ethtool_regs * regs)21 int st_mac100_dump_regs(struct ethtool_drvinfo *info maybe_unused,
22 			struct ethtool_regs *regs)
23 {
24 	int i;
25 	unsigned int *stmmac_reg = (unsigned int *)regs->data;
26 
27 	fprintf(stdout, "ST MAC 10/100 Registers\n");
28 	fprintf(stdout, "control reg  0x%08X\n", *stmmac_reg++);
29 	fprintf(stdout, "addr HI 0x%08X\n", *stmmac_reg++);
30 	fprintf(stdout, "addr LO 0x%08X\n", *stmmac_reg++);
31 	fprintf(stdout, "multicast hash HI 0x%08X\n", *stmmac_reg++);
32 	fprintf(stdout, "multicast hash LO 0x%08X\n", *stmmac_reg++);
33 	fprintf(stdout, "MII addr 0x%08X\n", *stmmac_reg++);
34 	fprintf(stdout, "MII data %08X\n", *stmmac_reg++);
35 	fprintf(stdout, "flow control 0x%08X\n", *stmmac_reg++);
36 	fprintf(stdout, "VLAN1 tag 0x%08X\n", *stmmac_reg++);
37 	fprintf(stdout, "VLAN2 tag 0x%08X\n", *stmmac_reg++);
38 	fprintf(stdout, "mac wakeup frame 0x%08X\n", *stmmac_reg++);
39 	fprintf(stdout, "mac wakeup crtl 0x%08X\n", *stmmac_reg++);
40 
41 	fprintf(stdout, "\n");
42 	fprintf(stdout, "DMA Registers\n");
43 	for (i = 0; i < MAC100_DMA_REG_NUM; i++)
44 		fprintf(stdout, "CSR%d  0x%08X\n", i, *stmmac_reg++);
45 
46 	fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
47 	fprintf(stdout, "DMA cur rx buf addr 0x%08X\n", *stmmac_reg++);
48 
49 	fprintf(stdout, "\n");
50 
51 	return 0;
52 }
53 
st_gmac_dump_regs(struct ethtool_drvinfo * info maybe_unused,struct ethtool_regs * regs)54 int st_gmac_dump_regs(struct ethtool_drvinfo *info maybe_unused,
55 		      struct ethtool_regs *regs)
56 {
57 	int i;
58 	unsigned int *stmmac_reg = (unsigned int *)regs->data;
59 
60 	fprintf(stdout, "ST GMAC Registers\n");
61 	fprintf(stdout, "GMAC Registers\n");
62 	for (i = 0; i < GMAC_REG_NUM; i++)
63 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
64 
65 	fprintf(stdout, "\n");
66 	fprintf(stdout, "DMA Registers\n");
67 	for (i = 0; i < GMAC_DMA_REG_NUM; i++)
68 		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);
69 
70 	return 0;
71 }
72