1141518d2SEric Anholt /* 2141518d2SEric Anholt * Copyright © 2017 Broadcom 3141518d2SEric Anholt * 4141518d2SEric Anholt * This program is free software; you can redistribute it and/or modify 5141518d2SEric Anholt * it under the terms of the GNU General Public License version 2 as 6141518d2SEric Anholt * published by the Free Software Foundation. 7141518d2SEric Anholt */ 8141518d2SEric Anholt 9141518d2SEric Anholt #include <linux/amba/clcd-regs.h> 10141518d2SEric Anholt #include <linux/seq_file.h> 1109a56fbeSSam Ravnborg 12141518d2SEric Anholt #include <drm/drm_debugfs.h> 1309a56fbeSSam Ravnborg #include <drm/drm_file.h> 1409a56fbeSSam Ravnborg 15141518d2SEric Anholt #include "pl111_drm.h" 16141518d2SEric Anholt 17141518d2SEric Anholt #define REGDEF(reg) { reg, #reg } 18141518d2SEric Anholt static const struct { 19141518d2SEric Anholt u32 reg; 20141518d2SEric Anholt const char *name; 21141518d2SEric Anholt } pl111_reg_defs[] = { 22141518d2SEric Anholt REGDEF(CLCD_TIM0), 23141518d2SEric Anholt REGDEF(CLCD_TIM1), 24141518d2SEric Anholt REGDEF(CLCD_TIM2), 25141518d2SEric Anholt REGDEF(CLCD_TIM3), 26141518d2SEric Anholt REGDEF(CLCD_UBAS), 27bcaf9ff4SLinus Walleij REGDEF(CLCD_LBAS), 28141518d2SEric Anholt REGDEF(CLCD_PL111_CNTL), 29141518d2SEric Anholt REGDEF(CLCD_PL111_IENB), 30bcaf9ff4SLinus Walleij REGDEF(CLCD_PL111_RIS), 31bcaf9ff4SLinus Walleij REGDEF(CLCD_PL111_MIS), 32bcaf9ff4SLinus Walleij REGDEF(CLCD_PL111_ICR), 33bcaf9ff4SLinus Walleij REGDEF(CLCD_PL111_UCUR), 34bcaf9ff4SLinus Walleij REGDEF(CLCD_PL111_LCUR), 35141518d2SEric Anholt }; 36141518d2SEric Anholt 37141518d2SEric Anholt int pl111_debugfs_regs(struct seq_file *m, void *unused) 38141518d2SEric Anholt { 39141518d2SEric Anholt struct drm_info_node *node = (struct drm_info_node *)m->private; 40141518d2SEric Anholt struct drm_device *dev = node->minor->dev; 41141518d2SEric Anholt struct pl111_drm_dev_private *priv = dev->dev_private; 42141518d2SEric Anholt int i; 43141518d2SEric Anholt 44141518d2SEric Anholt for (i = 0; i < ARRAY_SIZE(pl111_reg_defs); i++) { 45141518d2SEric Anholt seq_printf(m, "%s (0x%04x): 0x%08x\n", 46141518d2SEric Anholt pl111_reg_defs[i].name, pl111_reg_defs[i].reg, 47141518d2SEric Anholt readl(priv->regs + pl111_reg_defs[i].reg)); 48141518d2SEric Anholt } 49141518d2SEric Anholt 50141518d2SEric Anholt return 0; 51141518d2SEric Anholt } 52141518d2SEric Anholt 53141518d2SEric Anholt static const struct drm_info_list pl111_debugfs_list[] = { 54141518d2SEric Anholt {"regs", pl111_debugfs_regs, 0}, 55141518d2SEric Anholt }; 56141518d2SEric Anholt 57141518d2SEric Anholt int 58141518d2SEric Anholt pl111_debugfs_init(struct drm_minor *minor) 59141518d2SEric Anholt { 60141518d2SEric Anholt return drm_debugfs_create_files(pl111_debugfs_list, 61141518d2SEric Anholt ARRAY_SIZE(pl111_debugfs_list), 62141518d2SEric Anholt minor->debugfs_root, minor); 63141518d2SEric Anholt } 64