temp revert rk change
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-tegra / board-stingray-bootinfo.c
1 /*
2  * bootinfo.c: This code provides boot information via /proc/bootinfo.
3  * The information currently includes:
4  *      - the powerup reason
5  *      - the hardware revision
6  * All new user-space consumers of the powerup reason should use
7  * the /proc/bootinfo interface; all kernel-space consumers of the
8  * powerup reason should use the stingray_powerup_reason interface.
9  *
10  * Copyright (C) 2009 Motorola, Inc.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25  *
26  * Revision History:
27  *
28  * Date          Author Comment
29  * ----------   --------  -----------
30  * 30/06/2009   Motorola  Initialize version
31  * 25/10/2010   Motorola  Modified for stingray
32  * 30/10/2010   Motorola  Converted to seq_file interface
33  */
34
35 #include <linux/kernel.h>
36 #include <linux/init.h>
37 #include <linux/seq_file.h>
38 #include <linux/proc_fs.h>
39 #include <asm/setup.h>
40 #include "board-stingray.h"
41
42 static int bootinfo_show(struct seq_file *m, void *v)
43 {
44         seq_printf(m, "POWERUPREASON : 0x%08x\n",
45                 stingray_powerup_reason());
46
47         seq_printf(m, "BOARDREVISION : 0x%08x\n",
48                 stingray_revision());
49
50         return 0;
51 }
52
53 static int bootinfo_open(struct inode *inode, struct file *file)
54 {
55         return single_open(file, bootinfo_show, NULL);
56 }
57
58 static const struct file_operations bootinfo_operations = {
59         .open           = bootinfo_open,
60         .read           = seq_read,
61         .llseek         = seq_lseek,
62         .release        = single_release,
63 };
64
65 int __init bootinfo_init(void)
66 {
67         struct proc_dir_entry *pe;
68
69         pe = proc_create("bootinfo", S_IRUGO, NULL, &bootinfo_operations);
70         if (!pe)
71                 return -ENOMEM;
72
73         return 0;
74 }
75
76 device_initcall(bootinfo_init);