forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/powerpc/platforms/chrp/nvram.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * c 2001 PPC 64 Team, IBM Corp
34 *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
8
- *
95 * /dev/nvram driver for PPC
10
- *
116 */
127
138 #include <linux/kernel.h>
....@@ -24,7 +19,7 @@
2419 static unsigned char nvram_buf[4];
2520 static DEFINE_SPINLOCK(nvram_lock);
2621
27
-static unsigned char chrp_nvram_read(int addr)
22
+static unsigned char chrp_nvram_read_val(int addr)
2823 {
2924 unsigned int done;
3025 unsigned long flags;
....@@ -46,7 +41,7 @@
4641 return ret;
4742 }
4843
49
-static void chrp_nvram_write(int addr, unsigned char val)
44
+static void chrp_nvram_write_val(int addr, unsigned char val)
5045 {
5146 unsigned int done;
5247 unsigned long flags;
....@@ -62,6 +57,11 @@
6257 __pa(nvram_buf), 1) != 0) || 1 != done)
6358 printk(KERN_DEBUG "rtas IO error storing 0x%02x at %d", val, addr);
6459 spin_unlock_irqrestore(&nvram_lock, flags);
60
+}
61
+
62
+static ssize_t chrp_nvram_size(void)
63
+{
64
+ return nvram_size;
6565 }
6666
6767 void __init chrp_nvram_init(void)
....@@ -85,8 +85,9 @@
8585 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
8686 of_node_put(nvram);
8787
88
- ppc_md.nvram_read_val = chrp_nvram_read;
89
- ppc_md.nvram_write_val = chrp_nvram_write;
88
+ ppc_md.nvram_read_val = chrp_nvram_read_val;
89
+ ppc_md.nvram_write_val = chrp_nvram_write_val;
90
+ ppc_md.nvram_size = chrp_nvram_size;
9091
9192 return;
9293 }