2 * bdc_dbg.c - BRCM BDC USB3.0 device controller debug functions
4 * Copyright (C) 2014 Broadcom Corporation
6 * Author: Ashwini Pahuja
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.
18 void bdc_dbg_regs(struct bdc
*bdc
)
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
);
39 void bdc_dump_epsts(struct bdc
*bdc
)
43 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS0(0));
44 dev_vdbg(bdc
->dev
, "BDC_EPSTS0:0x%08x\n", temp
);
46 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS1(0));
47 dev_vdbg(bdc
->dev
, "BDC_EPSTS1:0x%x\n", temp
);
49 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS2(0));
50 dev_vdbg(bdc
->dev
, "BDC_EPSTS2:0x%08x\n", temp
);
52 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS3(0));
53 dev_vdbg(bdc
->dev
, "BDC_EPSTS3:0x%08x\n", temp
);
55 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS4(0));
56 dev_vdbg(bdc
->dev
, "BDC_EPSTS4:0x%08x\n", temp
);
58 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS5(0));
59 dev_vdbg(bdc
->dev
, "BDC_EPSTS5:0x%08x\n", temp
);
61 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS6(0));
62 dev_vdbg(bdc
->dev
, "BDC_EPSTS6:0x%08x\n", temp
);
64 temp
= bdc_readl(bdc
->regs
, BDC_EPSTS7(0));
65 dev_vdbg(bdc
->dev
, "BDC_EPSTS7:0x%08x\n", temp
);
68 void bdc_dbg_srr(struct bdc
*bdc
, u32 srr_num
)
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]));
90 void bdc_dbg_bd_list(struct bdc
*bdc
, struct bdc_ep
*ep
)
92 struct bd_list
*bd_list
= &ep
->bd_list
;
93 struct bd_table
*bd_table
;
100 "Dump bd list for %s epnum:%d\n",
101 ep
->name
, ep
->ep_num
);
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
);
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
);
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]));
121 dev_vdbg(bdc
->dev
, "\n\n");