Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5060132imu; Tue, 25 Dec 2018 16:48:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN7SfUk/aP/n+Cp8OMv+k5lqK5/Kn7z0ZWHRhgSqCBAMGnc1OvqC/BDYEu3s7ESnhp7p3r05 X-Received: by 2002:a17:902:968d:: with SMTP id n13mr18168484plp.109.1545785314020; Tue, 25 Dec 2018 16:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545785313; cv=none; d=google.com; s=arc-20160816; b=GVdmo1uZwiM4FX6HONKZ2TNrK/ugpZLXgZ435A789Qmi7DoVwJDaj1iV5LIu2WdkTW vahA6OuQ7c7L1yc+i9Ayn+p0o7os8yKwPyCq2+2eu31RVUK2Is4tRaLyRBsIsA5BUtex lJ0gRtkOPklaquOXKi7DbuPiEeyhE9brTqHVgqm50f9DAz1wZxBg+mAD+pzJURfCdFDd 1vhQfXdbtY2/p31uNk+S27tW+Gs6Csy5b7d8rHjYD0X7hk+pTk3KdgC23vYV8ihpXuu7 nAifG5j5iiqTPShhf6QdOz1k/JWbZTtWkR4KC5UcEbPvafTGt2UV1bTZmqXKljVKK/Aq TKBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=V4QNPtzzSj+OuBEDMLd3SiEru0bDEIAgW/z04zAvXuw=; b=E13dsZB/A8r4MyWXp8yE9lfFr3WBpTn4ViLWJzAGw1jqunGrf5u0TmtdQufNydTQEI 1oWOjPVOqpFcusYH57Lfz6hVu6Vwuzcs3tBE/HzaEE5fUNxi2iqRKUnmXJ2kVFrGse6f PWY6+y9WBXOdmrmyaR4mmU516/s/BVwOsYMssA2IEAJ+Qx/Aul32Ok0C78A2duuT/HRO 2vuBnhjFwuxel660vKTOMAVZfMYAc3byqOp8HBkeTT0TQpR9/8q2joddtiytklxbp8TU 9tVG3uttmbHP61dGtGEddlFB7aT7Uh/eJ/VU1ih5OgDfYYyJUwysEN00HBKZlgxnTTBT uJBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si29892711plp.323.2018.12.25.16.48.19; Tue, 25 Dec 2018 16:48:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729860AbeLZAqG (ORCPT + 99 others); Tue, 25 Dec 2018 19:46:06 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:57338 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725982AbeLZAn7 (ORCPT ); Tue, 25 Dec 2018 19:43:59 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 19C3A2951F; Tue, 25 Dec 2018 19:43:56 -0500 (EST) To: Arnd Bergmann , Greg Kroah-Hartman , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org Message-Id: In-Reply-To: References: From: Finn Thain Subject: [PATCH v8 09/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS Date: Wed, 26 Dec 2018 11:37:59 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Atari RTC NVRAM has a checksum so implement the remaining arch_nvram_ops methods for the set_checksum and initialize ioctls. Enable CONFIG_HAVE_ARCH_NVRAM_OPS. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven --- Changed since v7: - Changed the default for CONFIG_NVRAM, because "select NVRAM" was removed from ATARI_SCSI in patch 1. --- arch/m68k/Kconfig | 3 +++ arch/m68k/Kconfig.machine | 1 + arch/m68k/atari/nvram.c | 24 ++++++++++++++++++++++++ drivers/char/Kconfig | 3 ++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 1bc9f1ba759a..79e545f2520a 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -70,6 +70,9 @@ config ZONE_DMA bool default y +config HAVE_ARCH_NVRAM_OPS + bool + config HZ int default 1000 if CLEOPATRA diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine index 64a641467736..0c8c4c7982c1 100644 --- a/arch/m68k/Kconfig.machine +++ b/arch/m68k/Kconfig.machine @@ -16,6 +16,7 @@ config ATARI bool "Atari support" depends on MMU select MMU_MOTOROLA if MMU + select HAVE_ARCH_NVRAM_OPS help This option enables support for the 68000-based Atari series of computers (including the TT, Falcon and Medusa). If you plan to use diff --git a/arch/m68k/atari/nvram.c b/arch/m68k/atari/nvram.c index bafc9dc32830..4b27f1683a37 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 nvram_set_checksum(void) +{ + spin_lock_irq(&rtc_lock); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_lock); + return 0; +} + +static long 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 nvram_read(char *buf, size_t count, loff_t *ppos) { char *p = buf; @@ -120,6 +140,8 @@ static ssize_t nvram_write(char *buf, size_t count, loff_t *ppos) static ssize_t nvram_get_size(void) { + if (!MACH_IS_ATARI) + return -ENODEV; return NVRAM_BYTES; } @@ -127,6 +149,8 @@ const struct nvram_ops arch_nvram_ops = { .read = nvram_read, .write = nvram_write, .get_size = nvram_get_size, + .set_checksum = nvram_set_checksum, + .initialize = nvram_initialize, }; EXPORT_SYMBOL(arch_nvram_ops); diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 5b54595dfe30..f9960bd65481 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -236,7 +236,8 @@ source "drivers/char/hw_random/Kconfig" config NVRAM tristate "/dev/nvram support" - depends on X86 || GENERIC_NVRAM + depends on X86 || GENERIC_NVRAM || HAVE_ARCH_NVRAM_OPS + default M68K ---help--- 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"), -- 2.19.2