diff options
author | Finn Thain | 2019-01-15 15:18:56 +1100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-01-22 10:21:44 +0100 |
commit | 666047fe2a4c9e1bc255ca0549d825b40832886c (patch) | |
tree | a21b7111e9252529f9abcc756a373d8c199f1d1e /arch/m68k/atari | |
parent | 109b3a89a7c48405d61a05d7a1720581a4f1574c (diff) |
m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS
Atari RTC NVRAM uses a checksum so implement the remaining arch_nvram_ops
methods for the set_checksum and initialize ioctls. Enable
CONFIG_HAVE_ARCH_NVRAM_OPS.
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/m68k/atari')
-rw-r--r-- | arch/m68k/atari/nvram.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/m68k/atari/nvram.c b/arch/m68k/atari/nvram.c index e75adebe6e7d..c347fd206ddf 100644 --- a/arch/m68k/atari/nvram.c +++ b/arch/m68k/atari/nvram.c @@ -74,6 +74,26 @@ static void __nvram_set_checksum(void) __nvram_write_byte(sum, ATARI_CKS_LOC + 1); } +static long atari_nvram_set_checksum(void) +{ + spin_lock_irq(&rtc_lock); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_lock); + return 0; +} + +static long atari_nvram_initialize(void) +{ + loff_t i; + + spin_lock_irq(&rtc_lock); + for (i = 0; i < NVRAM_BYTES; ++i) + __nvram_write_byte(0, i); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_lock); + return 0; +} + static ssize_t atari_nvram_read(char *buf, size_t count, loff_t *ppos) { char *p = buf; @@ -113,6 +133,8 @@ static ssize_t atari_nvram_write(char *buf, size_t count, loff_t *ppos) static ssize_t atari_nvram_get_size(void) { + if (!MACH_IS_ATARI) + return -ENODEV; return NVRAM_BYTES; } @@ -120,6 +142,8 @@ const struct nvram_ops arch_nvram_ops = { .read = atari_nvram_read, .write = atari_nvram_write, .get_size = atari_nvram_get_size, + .set_checksum = atari_nvram_set_checksum, + .initialize = atari_nvram_initialize, }; EXPORT_SYMBOL(arch_nvram_ops); |