1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright © 2017 Broadcom 4 */ 5 6 #include <linux/amba/clcd-regs.h> 7 #include <linux/seq_file.h> 8 #include <drm/drm_debugfs.h> 9 #include <drm/drmP.h> 10 #include "pl111_drm.h" 11 12 #define REGDEF(reg) { reg, #reg } 13 static const struct { 14 u32 reg; 15 const char *name; 16 } pl111_reg_defs[] = { 17 REGDEF(CLCD_TIM0), 18 REGDEF(CLCD_TIM1), 19 REGDEF(CLCD_TIM2), 20 REGDEF(CLCD_TIM3), 21 REGDEF(CLCD_UBAS), 22 REGDEF(CLCD_LBAS), 23 REGDEF(CLCD_PL111_CNTL), 24 REGDEF(CLCD_PL111_IENB), 25 REGDEF(CLCD_PL111_RIS), 26 REGDEF(CLCD_PL111_MIS), 27 REGDEF(CLCD_PL111_ICR), 28 REGDEF(CLCD_PL111_UCUR), 29 REGDEF(CLCD_PL111_LCUR), 30 }; 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 39 for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) { 40 seq_printf(m, "%s (0x%04x): 0x%08x\n", 41 pl111_reg_defs[i].name, pl111_reg_defs[i].reg, 42 readl(priv->regs + pl111_reg_defs[i].reg)); 43 } 44 45 return 0; 46 } 47 48 static const struct drm_info_list pl111_debugfs_list[] = { 49 {"regs", pl111_debugfs_regs, 0}, 50 }; 51 52 int 53 pl111_debugfs_init(struct drm_minor *minor) 54 { 55 return drm_debugfs_create_files(pl111_debugfs_list, 56 ARRAY_SIZE(pl111_debugfs_list), 57 minor->debugfs_root, minor); 58 } 59