bdc_dbg.c 3.2 KB

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