pl111_debugfs.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright © 2017 Broadcom
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/amba/clcd-regs.h>
  9. #include <linux/seq_file.h>
  10. #include <drm/drm_debugfs.h>
  11. #include <drm/drmP.h>
  12. #include "pl111_drm.h"
  13. #define REGDEF(reg) { reg, #reg }
  14. static const struct {
  15. u32 reg;
  16. const char *name;
  17. } pl111_reg_defs[] = {
  18. REGDEF(CLCD_TIM0),
  19. REGDEF(CLCD_TIM1),
  20. REGDEF(CLCD_TIM2),
  21. REGDEF(CLCD_TIM3),
  22. REGDEF(CLCD_UBAS),
  23. REGDEF(CLCD_LBAS),
  24. REGDEF(CLCD_PL111_CNTL),
  25. REGDEF(CLCD_PL111_IENB),
  26. REGDEF(CLCD_PL111_RIS),
  27. REGDEF(CLCD_PL111_MIS),
  28. REGDEF(CLCD_PL111_ICR),
  29. REGDEF(CLCD_PL111_UCUR),
  30. REGDEF(CLCD_PL111_LCUR),
  31. };
  32. int pl111_debugfs_regs(struct seq_file *m, void *unused)
  33. {
  34. struct drm_info_node *node = (struct drm_info_node *)m->private;
  35. struct drm_device *dev = node->minor->dev;
  36. struct pl111_drm_dev_private *priv = dev->dev_private;
  37. int i;
  38. for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
  39. seq_printf(m, "%s (0x%04x): 0x%08x\n",
  40. pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
  41. readl(priv->regs + pl111_reg_defs[i].reg));
  42. }
  43. return 0;
  44. }
  45. static const struct drm_info_list pl111_debugfs_list[] = {
  46. {"regs", pl111_debugfs_regs, 0},
  47. };
  48. int
  49. pl111_debugfs_init(struct drm_minor *minor)
  50. {
  51. return drm_debugfs_create_files(pl111_debugfs_list,
  52. ARRAY_SIZE(pl111_debugfs_list),
  53. minor->debugfs_root, minor);
  54. }