1/* 2 * bdc_dbg.c - BRCM BDC USB3.0 device controller debug functions 3 * 4 * Copyright (C) 2014 Broadcom Corporation 5 * 6 * Author: Ashwini Pahuja 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 as published by the 10 * Free Software Foundation; either version 2 of the License, or (at your 11 * option) any later version. 12 * 13 */ 14 15#include "bdc.h" 16#include "bdc_dbg.h" 17 18void bdc_dbg_regs(struct bdc *bdc) 19{ 20 u32 temp; 21 22 dev_vdbg(bdc->dev, "bdc->regs:%p\n", bdc->regs); 23 temp = bdc_readl(bdc->regs, BDC_BDCCFG0); 24 dev_vdbg(bdc->dev, "bdccfg0:0x%08x\n", temp); 25 temp = bdc_readl(bdc->regs, BDC_BDCCFG1); 26 dev_vdbg(bdc->dev, "bdccfg1:0x%08x\n", temp); 27 temp = bdc_readl(bdc->regs, BDC_BDCCAP0); 28 dev_vdbg(bdc->dev, "bdccap0:0x%08x\n", temp); 29 temp = bdc_readl(bdc->regs, BDC_BDCCAP1); 30 dev_vdbg(bdc->dev, "bdccap1:0x%08x\n", temp); 31 temp = bdc_readl(bdc->regs, BDC_USPC); 32 dev_vdbg(bdc->dev, "uspc:0x%08x\n", temp); 33 temp = bdc_readl(bdc->regs, BDC_DVCSA); 34 dev_vdbg(bdc->dev, "dvcsa:0x%08x\n", temp); 35 temp = bdc_readl(bdc->regs, BDC_DVCSB); 36 dev_vdbg(bdc->dev, "dvcsb:0x%x08\n", temp); 37} 38 39void bdc_dump_epsts(struct bdc *bdc) 40{ 41 u32 temp; 42 43 temp = bdc_readl(bdc->regs, BDC_EPSTS0(0)); 44 dev_vdbg(bdc->dev, "BDC_EPSTS0:0x%08x\n", temp); 45 46 temp = bdc_readl(bdc->regs, BDC_EPSTS1(0)); 47 dev_vdbg(bdc->dev, "BDC_EPSTS1:0x%x\n", temp); 48 49 temp = bdc_readl(bdc->regs, BDC_EPSTS2(0)); 50 dev_vdbg(bdc->dev, "BDC_EPSTS2:0x%08x\n", temp); 51 52 temp = bdc_readl(bdc->regs, BDC_EPSTS3(0)); 53 dev_vdbg(bdc->dev, "BDC_EPSTS3:0x%08x\n", temp); 54 55 temp = bdc_readl(bdc->regs, BDC_EPSTS4(0)); 56 dev_vdbg(bdc->dev, "BDC_EPSTS4:0x%08x\n", temp); 57 58 temp = bdc_readl(bdc->regs, BDC_EPSTS5(0)); 59 dev_vdbg(bdc->dev, "BDC_EPSTS5:0x%08x\n", temp); 60 61 temp = bdc_readl(bdc->regs, BDC_EPSTS6(0)); 62 dev_vdbg(bdc->dev, "BDC_EPSTS6:0x%08x\n", temp); 63 64 temp = bdc_readl(bdc->regs, BDC_EPSTS7(0)); 65 dev_vdbg(bdc->dev, "BDC_EPSTS7:0x%08x\n", temp); 66} 67 68void bdc_dbg_srr(struct bdc *bdc, u32 srr_num) 69{ 70 struct bdc_sr *sr; 71 dma_addr_t addr; 72 int i; 73 74 sr = bdc->srr.sr_bds; 75 addr = bdc->srr.dma_addr; 76 dev_vdbg(bdc->dev, "bdc_dbg_srr sr:%p dqp_index:%d\n", 77 sr, bdc->srr.dqp_index); 78 for (i = 0; i < NUM_SR_ENTRIES; i++) { 79 sr = &bdc->srr.sr_bds[i]; 80 dev_vdbg(bdc->dev, "%llx %08x %08x %08x %08x\n", 81 (unsigned long long)addr, 82 le32_to_cpu(sr->offset[0]), 83 le32_to_cpu(sr->offset[1]), 84 le32_to_cpu(sr->offset[2]), 85 le32_to_cpu(sr->offset[3])); 86 addr += sizeof(*sr); 87 } 88} 89 90void bdc_dbg_bd_list(struct bdc *bdc, struct bdc_ep *ep) 91{ 92 struct bd_list *bd_list = &ep->bd_list; 93 struct bd_table *bd_table; 94 struct bdc_bd *bd; 95 int tbi, bdi, gbdi; 96 dma_addr_t dma; 97 98 gbdi = 0; 99 dev_vdbg(bdc->dev, 100 "Dump bd list for %s epnum:%d\n", 101 ep->name, ep->ep_num); 102 103 dev_vdbg(bdc->dev, 104 "tabs:%d max_bdi:%d eqp_bdi:%d hwd_bdi:%d num_bds_table:%d\n", 105 bd_list->num_tabs, bd_list->max_bdi, bd_list->eqp_bdi, 106 bd_list->hwd_bdi, bd_list->num_bds_table); 107 108 for (tbi = 0; tbi < bd_list->num_tabs; tbi++) { 109 bd_table = bd_list->bd_table_array[tbi]; 110 for (bdi = 0; bdi < bd_list->num_bds_table; bdi++) { 111 bd = bd_table->start_bd + bdi; 112 dma = bd_table->dma + (sizeof(struct bdc_bd) * bdi); 113 dev_vdbg(bdc->dev, 114 "tbi:%2d bdi:%2d gbdi:%2d virt:%p phys:%llx %08x %08x %08x %08x\n", 115 tbi, bdi, gbdi++, bd, (unsigned long long)dma, 116 le32_to_cpu(bd->offset[0]), 117 le32_to_cpu(bd->offset[1]), 118 le32_to_cpu(bd->offset[2]), 119 le32_to_cpu(bd->offset[3])); 120 } 121 dev_vdbg(bdc->dev, "\n\n"); 122 } 123} 124