pl111_debugfs.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_PL111_CNTL),
  24. REGDEF(CLCD_PL111_IENB),
  25. };
  26. int pl111_debugfs_regs(struct seq_file *m, void *unused)
  27. {
  28. struct drm_info_node *node = (struct drm_info_node *)m->private;
  29. struct drm_device *dev = node->minor->dev;
  30. struct pl111_drm_dev_private *priv = dev->dev_private;
  31. int i;
  32. for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) {
  33. seq_printf(m, "%s (0x%04x): 0x%08x\n",
  34. pl111_reg_defs[i].name, pl111_reg_defs[i].reg,
  35. readl(priv->regs + pl111_reg_defs[i].reg));
  36. }
  37. return 0;
  38. }
  39. static const struct drm_info_list pl111_debugfs_list[] = {
  40. {"regs", pl111_debugfs_regs, 0},
  41. };
  42. int
  43. pl111_debugfs_init(struct drm_minor *minor)
  44. {
  45. return drm_debugfs_create_files(pl111_debugfs_list,
  46. ARRAY_SIZE(pl111_debugfs_list),
  47. minor->debugfs_root, minor);
  48. }