Commit 666047fe authored by Finn Thain's avatar Finn Thain Committed by Greg Kroah-Hartman

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 109b3a89
...@@ -701,6 +701,9 @@ config HAVE_ARCH_HASH ...@@ -701,6 +701,9 @@ config HAVE_ARCH_HASH
file which provides platform-specific implementations of some file which provides platform-specific implementations of some
functions in <linux/hash.h> or fs/namei.c. functions in <linux/hash.h> or fs/namei.c.
config HAVE_ARCH_NVRAM_OPS
bool
config ISA_BUS_API config ISA_BUS_API
def_bool ISA def_bool ISA
......
...@@ -16,6 +16,7 @@ config ATARI ...@@ -16,6 +16,7 @@ config ATARI
bool "Atari support" bool "Atari support"
depends on MMU depends on MMU
select MMU_MOTOROLA if MMU select MMU_MOTOROLA if MMU
select HAVE_ARCH_NVRAM_OPS
help help
This option enables support for the 68000-based Atari series of This option enables support for the 68000-based Atari series of
computers (including the TT, Falcon and Medusa). If you plan to use computers (including the TT, Falcon and Medusa). If you plan to use
......
...@@ -74,6 +74,26 @@ static void __nvram_set_checksum(void) ...@@ -74,6 +74,26 @@ static void __nvram_set_checksum(void)
__nvram_write_byte(sum, ATARI_CKS_LOC + 1); __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) static ssize_t atari_nvram_read(char *buf, size_t count, loff_t *ppos)
{ {
char *p = buf; char *p = buf;
...@@ -113,6 +133,8 @@ static ssize_t atari_nvram_write(char *buf, size_t count, loff_t *ppos) ...@@ -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) static ssize_t atari_nvram_get_size(void)
{ {
if (!MACH_IS_ATARI)
return -ENODEV;
return NVRAM_BYTES; return NVRAM_BYTES;
} }
...@@ -120,6 +142,8 @@ const struct nvram_ops arch_nvram_ops = { ...@@ -120,6 +142,8 @@ const struct nvram_ops arch_nvram_ops = {
.read = atari_nvram_read, .read = atari_nvram_read,
.write = atari_nvram_write, .write = atari_nvram_write,
.get_size = atari_nvram_get_size, .get_size = atari_nvram_get_size,
.set_checksum = atari_nvram_set_checksum,
.initialize = atari_nvram_initialize,
}; };
EXPORT_SYMBOL(arch_nvram_ops); EXPORT_SYMBOL(arch_nvram_ops);
......
...@@ -244,7 +244,8 @@ source "drivers/char/hw_random/Kconfig" ...@@ -244,7 +244,8 @@ source "drivers/char/hw_random/Kconfig"
config NVRAM config NVRAM
tristate "/dev/nvram support" tristate "/dev/nvram support"
depends on X86 || GENERIC_NVRAM depends on X86 || GENERIC_NVRAM || HAVE_ARCH_NVRAM_OPS
default M68K
---help--- ---help---
If you say Y here and create a character special file /dev/nvram If you say Y here and create a character special file /dev/nvram
with major number 10 and minor number 144 using mknod ("man mknod"), with major number 10 and minor number 144 using mknod ("man mknod"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment