Skip to contentSkip to conversation

debugfs: Adding support to 16-bit regs and 8-bits regs

PATCH In review Christophe Leroy 2 participants 2 messages Nov 23, 2013 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 debugfs: Adding support to 16-bit regs and 8-bits regs

Many components still have 16 bits registers and several even have 8 bits registers. This patch adds structures and functions to deal with those registers.

include/linux/debugfs.h +50 -0
diff -urN a/include/linux/debugfs.h b/include/linux/debugfs.h
@@ -38,6 +38,28 @@
 	void __iomem *base;
 };
 
+struct debugfs_reg16 {
+	char *name;
+	unsigned long offset;
+};
+
+struct debugfs_regset16 {
+	const struct debugfs_reg16 *regs;
+	int nregs;
+	void __iomem *base;
+};
+
+struct debugfs_reg8 {
+	char *name;
+	unsigned long offset;
+};
+
+struct debugfs_regset8 {
+	const struct debugfs_reg8 *regs;
+	int nregs;
+	void __iomem *base;
+};
+
 extern struct dentry *arch_debugfs_dir;
 
 #if defined(CONFIG_DEBUG_FS)
@@ -95,6 +117,20 @@
 int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
 			 int nregs, void __iomem *base, char *prefix);
 
+struct dentry *debugfs_create_regset16(const char *name, umode_t mode,
+				     struct dentry *parent,
+				     struct debugfs_regset16 *regset);
+
+int debugfs_print_regs16(struct seq_file *s, const struct debugfs_reg16 *regs,
+			 int nregs, void __iomem *base, char *prefix);
+
+struct dentry *debugfs_create_regset8(const char *name, umode_t mode,
+				     struct dentry *parent,
+				     struct debugfs_regset8 *regset);
+
+int debugfs_print_regs8(struct seq_file *s, const struct debugfs_reg8 *regs,
+			 int nregs, void __iomem *base, char *prefix);
+
 struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
 					struct dentry *parent,
 					u32 *array, u32 elements);
@@ -227,6 +263,20 @@
 	return ERR_PTR(-ENODEV);
 }
 
+static inline struct dentry *debugfs_create_regset16(const char *name,
+				   umode_t mode, struct dentry *parent,
+				   struct debugfs_regset16 *regset)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline struct dentry *debugfs_create_regset8(const char *name,
+				   umode_t mode, struct dentry *parent,
+				   struct debugfs_regset8 *regset)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline bool debugfs_initialized(void)
 {
 	return false;
fs/debugfs/file.c +178 -0

182 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Christophe Leroy

Many components still have 16 bits registers and several even have 8 bits registers. This patch adds structures and functions to deal with those registers.

What code is going to call these functions? I don't want to add apis with no users, sorry.

thanks,

greg k-h