xref: /openbmc/linux/arch/mips/ralink/bootrom.c (revision 3213486f)
1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License version 2 as published
4  * by the Free Software Foundation.
5  *
6  * Copyright (C) 2013 John Crispin <john@phrozen.org>
7  */
8 
9 #include <linux/debugfs.h>
10 #include <linux/seq_file.h>
11 
12 #define BOOTROM_OFFSET	0x10118000
13 #define BOOTROM_SIZE	0x8000
14 
15 static void __iomem *membase = (void __iomem *) KSEG1ADDR(BOOTROM_OFFSET);
16 
17 static int bootrom_show(struct seq_file *s, void *unused)
18 {
19 	seq_write(s, membase, BOOTROM_SIZE);
20 
21 	return 0;
22 }
23 
24 static int bootrom_open(struct inode *inode, struct file *file)
25 {
26 	return single_open(file, bootrom_show, NULL);
27 }
28 
29 static const struct file_operations bootrom_file_ops = {
30 	.open		= bootrom_open,
31 	.read		= seq_read,
32 	.llseek		= seq_lseek,
33 	.release	= single_release,
34 };
35 
36 static int bootrom_setup(void)
37 {
38 	debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_file_ops);
39 	return 0;
40 }
41 
42 postcore_initcall(bootrom_setup);
43