summaryrefslogtreecommitdiffstats
path: root/stmmac.c
blob: 58471200cd8069a5a8166d94c9834b4cc28e40e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/****************************************************************************
 * Support for the Synopsys MAC 10/100/1000 on-chip Ethernet controllers
 *
 * Copyright (C) 2007-2009  STMicroelectronics Ltd
 *
 * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation, incorporated herein by reference.
 */

#include <stdio.h>
#include <string.h>
#include "internal.h"

#define MAC100_DMA_REG_NUM	9
#define GMAC_REG_NUM		55
#define GMAC_DMA_REG_NUM	23

int st_mac100_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
			struct ethtool_regs *regs)
{
	int i;
	unsigned int *stmmac_reg = (unsigned int *)regs->data;

	fprintf(stdout, "ST MAC 10/100 Registers\n");
	fprintf(stdout, "control reg  0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "addr HI 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "addr LO 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "multicast hash HI 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "multicast hash LO 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "MII addr 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "MII data %08X\n", *stmmac_reg++);
	fprintf(stdout, "flow control 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "VLAN1 tag 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "VLAN2 tag 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "mac wakeup frame 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "mac wakeup crtl 0x%08X\n", *stmmac_reg++);

	fprintf(stdout, "\n");
	fprintf(stdout, "DMA Registers\n");
	for (i = 0; i < MAC100_DMA_REG_NUM; i++)
		fprintf(stdout, "CSR%d  0x%08X\n", i, *stmmac_reg++);

	fprintf(stdout, "DMA cur tx buf addr 0x%08X\n", *stmmac_reg++);
	fprintf(stdout, "DMA cur rx buf addr 0x%08X\n", *stmmac_reg++);

	fprintf(stdout, "\n");

	return 0;
}

int st_gmac_dump_regs(struct ethtool_drvinfo *info __maybe_unused,
		      struct ethtool_regs *regs)
{
	int i;
	unsigned int *stmmac_reg = (unsigned int *)regs->data;

	fprintf(stdout, "ST GMAC Registers\n");
	fprintf(stdout, "GMAC Registers\n");
	for (i = 0; i < GMAC_REG_NUM; i++)
		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);

	fprintf(stdout, "\n");
	fprintf(stdout, "DMA Registers\n");
	for (i = 0; i < GMAC_DMA_REG_NUM; i++)
		fprintf(stdout, "Reg%d  0x%08X\n", i, *stmmac_reg++);

	return 0;
}