bdc_dbg.c 3.5 KB

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