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