aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-08-27 06:01:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:02:28 -0400
commitc47a601d696e24f63f0429914b96f9cf10987e30 (patch)
treec5ec9403c702403c00dce49807e3367d54ebc6a1 /drivers
parente5cf1b75f5675c3169d638f914d1212a5b9071fa (diff)
Staging: et131x: quick tidy of the debug code
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/et131x/et131x_debug.c85
1 files changed, 38 insertions, 47 deletions
diff --git a/drivers/staging/et131x/et131x_debug.c b/drivers/staging/et131x/et131x_debug.c
index 61203c181557..779130b44a7d 100644
--- a/drivers/staging/et131x/et131x_debug.c
+++ b/drivers/staging/et131x/et131x_debug.c
@@ -1,4 +1,3 @@
1/*
2 * Agere Systems Inc. 1 * Agere Systems Inc.
3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs 2 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4 * 3 *
@@ -108,22 +107,22 @@ extern dbg_info_t *et131x_dbginfo;
108 * DumpTxQueueContents - Dump out the tx queue and the shadow pointers 107 * DumpTxQueueContents - Dump out the tx queue and the shadow pointers
109 * @etdev: pointer to our adapter structure 108 * @etdev: pointer to our adapter structure
110 */ 109 */
111void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev) 110void DumpTxQueueContents(int debug, struct et131x_adapter *etdev)
112{ 111{
113 MMC_t __iomem *mmc = &etdev->regs->mmc; 112 MMC_t __iomem *mmc = &etdev->regs->mmc;
114 uint32_t TxQueueAddr; 113 u32 txq_addr;
115 114
116 if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) { 115 if (DBG_FLAGS(et131x_dbginfo) & debug) {
117 for (TxQueueAddr = 0x200; TxQueueAddr < 0x3ff; TxQueueAddr++) { 116 for (txq_addr = 0x200; txq_addr < 0x3ff; txq_addr++) {
118 u32 sram_access = readl(&mmc->sram_access); 117 u32 sram_access = readl(&mmc->sram_access);
119 sram_access &= 0xFFFF; 118 sram_access &= 0xFFFF;
120 sram_access |= (TxQueueAddr << 16) | ET_SRAM_REQ_ACCESS; 119 sram_access |= (txq_addr << 16) | ET_SRAM_REQ_ACCESS;
121 writel(sram_access, &mmc->sram_access); 120 writel(sram_access, &mmc->sram_access);
122 121
123 DBG_PRINT("Addr 0x%x, Access 0x%08x\t" 122 DBG_PRINT("Addr 0x%x, Access 0x%08x\t"
124 "Value 1 0x%08x, Value 2 0x%08x, " 123 "Value 1 0x%08x, Value 2 0x%08x, "
125 "Value 3 0x%08x, Value 4 0x%08x, \n", 124 "Value 3 0x%08x, Value 4 0x%08x, \n",
126 TxQueueAddr, 125 txq_addr,
127 readl(&mmc->sram_access), 126 readl(&mmc->sram_access),
128 readl(&mmc->sram_word1), 127 readl(&mmc->sram_word1),
129 readl(&mmc->sram_word2), 128 readl(&mmc->sram_word2),
@@ -136,6 +135,12 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
136 } 135 }
137} 136}
138 137
138static const char *BlockNames[NUM_BLOCKS] = {
139 "Global", "Tx DMA", "Rx DMA", "Tx MAC",
140 "Rx MAC", "MAC", "MAC Stat", "MMC"
141};
142
143
139/** 144/**
140 * DumpDeviceBlock 145 * DumpDeviceBlock
141 * @etdev: pointer to our adapter 146 * @etdev: pointer to our adapter
@@ -144,30 +149,23 @@ void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *etdev)
144 * mapped to a new page, each page is 4096 bytes). 149 * mapped to a new page, each page is 4096 bytes).
145 */ 150 */
146#define NUM_BLOCKS 8 151#define NUM_BLOCKS 8
147void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev, 152void DumpDeviceBlock(int debug, struct et131x_adapter *etdev,
148 uint32_t Block) 153 u32 block)
149{ 154{
150 uint32_t Address1, Address2; 155 u32 addr1, addr2;
151 uint32_t __iomem *BigDevicePointer = 156 u32 __iomem *regs = (u32 __iomem *) etdev->regs;
152 (uint32_t __iomem *) etdev->regs;
153 const char *BlockNames[NUM_BLOCKS] = {
154 "Global", "Tx DMA", "Rx DMA", "Tx MAC",
155 "Rx MAC", "MAC", "MAC Stat", "MMC"
156 };
157 157
158 /* Output the debug counters to the debug terminal */ 158 /* Output the debug counters to the debug terminal */
159 if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) { 159 if (DBG_FLAGS(et131x_dbginfo) & debug) {
160 DBG_PRINT("%s block\n", BlockNames[Block]); 160 DBG_PRINT("%s block\n", BlockNames[block]);
161 BigDevicePointer += Block * 1024; 161 regs += block * 1024;
162 for (Address1 = 0; Address1 < 8; Address1++) { 162 for (addr1 = 0; addr1 < 8; addr1++) {
163 for (Address2 = 0; Address2 < 8; Address2++) { 163 for (addr2 = 0; addr2 < 8; addr2++) {
164 if (Block == 0 && 164 if (block == 0 &&
165 (Address1 * 8 + Address2) == 6) { 165 (addr1 * 8 + addr2) == 6)
166 DBG_PRINT(" ISR , "); 166 DBG_PRINT(" ISR , ");
167 } else { 167 else
168 DBG_PRINT("0x%08x, ", 168 DBG_PRINT("0x%08x, ", readl(regs++));
169 readl(BigDevicePointer++));
170 }
171 } 169 }
172 DBG_PRINT("\n"); 170 DBG_PRINT("\n");
173 } 171 }
@@ -182,29 +180,22 @@ void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *etdev,
182 * Dumps the first 64 regs of each block of the et-1310 (each block is 180 * Dumps the first 64 regs of each block of the et-1310 (each block is
183 * mapped to a new page, each page is 4096 bytes). 181 * mapped to a new page, each page is 4096 bytes).
184 */ 182 */
185void DumpDeviceReg(int dbgLvl, struct et131x_adapter *etdev) 183void DumpDeviceReg(int debug, struct et131x_adapter *etdev)
186{ 184{
187 uint32_t Address1, Address2; 185 u32 addr1, addr2;
188 uint32_t Block; 186 u32 block;
189 uint32_t __iomem *BigDevicePointer = 187 u32 __iomem *regs = (u32 __iomem *)etdev->regs;
190 (uint32_t __iomem *) etdev->regs; 188 u32 __iomem *p;
191 uint32_t __iomem *Pointer;
192 const char *BlockNames[NUM_BLOCKS] = {
193 "Global", "Tx DMA", "Rx DMA", "Tx MAC",
194 "Rx MAC", "MAC", "MAC Stat", "MMC"
195 };
196 189
197 /* Output the debug counters to the debug terminal */ 190 /* Output the debug counters to the debug terminal */
198 if (DBG_FLAGS(et131x_dbginfo) & dbgLvl) { 191 if (DBG_FLAGS(et131x_dbginfo) & debug) {
199 for (Block = 0; Block < NUM_BLOCKS; Block++) { 192 for (block = 0; block < NUM_BLOCKS; block++) {
200 DBG_PRINT("%s block\n", BlockNames[Block]); 193 DBG_PRINT("%s block\n", BlockNames[block]);
201 Pointer = BigDevicePointer + (Block * 1024); 194 p = regs + block * 1024;
202 195
203 for (Address1 = 0; Address1 < 8; Address1++) { 196 for (addr1 = 0; addr1 < 8; addr1++) {
204 for (Address2 = 0; Address2 < 8; Address2++) { 197 for (addr2 = 0; addr2 < 8; addr2++)
205 DBG_PRINT("0x%08x, ", 198 DBG_PRINT("0x%08x, ", readl(p++));
206 readl(Pointer++));
207 }
208 DBG_PRINT("\n"); 199 DBG_PRINT("\n");
209 } 200 }
210 DBG_PRINT("\n"); 201 DBG_PRINT("\n");