From: Finn Thain <fthain@telegraphics.com.au>
To: linux-kernel@vger.kernel.org, linux-m68k@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: [RFC v4 14/25] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac
Date: Sun, 12 Jul 2015 20:25:41 +1000 [thread overview]
Message-ID: <20150712102530.775902562@telegraphics.com.au> (raw)
In-Reply-To: 20150712102527.356151908@telegraphics.com.au
[-- Attachment #1: fix-powerpc-machdep-inconsistencies --]
[-- Type: text/plain, Size: 3792 bytes --]
Add the nvram_size() function to those PowerPC platforms that don't already
have one: CHRP and PowerMac. This means that the ppc_md.nvram_size()
function can be used to implement arch_nvram_ops.get_size()
Since we are addressing inconsistencies here, also rename chrp_nvram_read
and chrp_nvram_write, which break the naming convention used across
PowerPC platforms for NVRAM accessor functions.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
arch/powerpc/platforms/chrp/nvram.c | 14 ++++++++++----
arch/powerpc/platforms/powermac/nvram.c | 9 +++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
Index: linux/arch/powerpc/platforms/chrp/nvram.c
===================================================================
--- linux.orig/arch/powerpc/platforms/chrp/nvram.c 2015-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/platforms/chrp/nvram.c 2015-07-12 20:25:09.000000000 +1000
@@ -23,7 +23,7 @@ static unsigned int nvram_size;
static unsigned char nvram_buf[4];
static DEFINE_SPINLOCK(nvram_lock);
-static unsigned char chrp_nvram_read(int addr)
+static unsigned char chrp_nvram_read_byte(int addr)
{
unsigned int done;
unsigned long flags;
@@ -45,7 +45,7 @@ static unsigned char chrp_nvram_read(int
return ret;
}
-static void chrp_nvram_write(int addr, unsigned char val)
+static void chrp_nvram_write_byte(int addr, unsigned char val)
{
unsigned int done;
unsigned long flags;
@@ -63,6 +63,11 @@ static void chrp_nvram_write(int addr, u
spin_unlock_irqrestore(&nvram_lock, flags);
}
+static ssize_t chrp_nvram_size(void)
+{
+ return nvram_size;
+}
+
void __init chrp_nvram_init(void)
{
struct device_node *nvram;
@@ -84,8 +89,9 @@ void __init chrp_nvram_init(void)
printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
of_node_put(nvram);
- ppc_md.nvram_read_val = chrp_nvram_read;
- ppc_md.nvram_write_val = chrp_nvram_write;
+ ppc_md.nvram_read_val = chrp_nvram_read_byte;
+ ppc_md.nvram_write_val = chrp_nvram_write_byte;
+ ppc_md.nvram_size = chrp_nvram_size;
return;
}
Index: linux/arch/powerpc/platforms/powermac/nvram.c
===================================================================
--- linux.orig/arch/powerpc/platforms/powermac/nvram.c 2015-07-12 20:24:53.000000000 +1000
+++ linux/arch/powerpc/platforms/powermac/nvram.c 2015-07-12 20:25:09.000000000 +1000
@@ -147,6 +147,11 @@ static ssize_t core99_nvram_size(void)
static volatile unsigned char __iomem *nvram_addr;
static int nvram_mult;
+static ssize_t ppc32_nvram_size(void)
+{
+ return NVRAM_SIZE;
+}
+
static unsigned char direct_nvram_read_byte(int addr)
{
return in_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]);
@@ -590,21 +595,25 @@ int __init pmac_nvram_init(void)
nvram_mult = 1;
ppc_md.nvram_read_val = direct_nvram_read_byte;
ppc_md.nvram_write_val = direct_nvram_write_byte;
+ ppc_md.nvram_size = ppc32_nvram_size;
} else if (nvram_naddrs == 1) {
nvram_data = ioremap(r1.start, s1);
nvram_mult = (s1 + NVRAM_SIZE - 1) / NVRAM_SIZE;
ppc_md.nvram_read_val = direct_nvram_read_byte;
ppc_md.nvram_write_val = direct_nvram_write_byte;
+ ppc_md.nvram_size = ppc32_nvram_size;
} else if (nvram_naddrs == 2) {
nvram_addr = ioremap(r1.start, s1);
nvram_data = ioremap(r2.start, s2);
ppc_md.nvram_read_val = indirect_nvram_read_byte;
ppc_md.nvram_write_val = indirect_nvram_write_byte;
+ ppc_md.nvram_size = ppc32_nvram_size;
} else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) {
#ifdef CONFIG_ADB_PMU
nvram_naddrs = -1;
ppc_md.nvram_read_val = pmu_nvram_read_byte;
ppc_md.nvram_write_val = pmu_nvram_write_byte;
+ ppc_md.nvram_size = ppc32_nvram_size;
#endif /* CONFIG_ADB_PMU */
} else {
printk(KERN_ERR "Incompatible type of NVRAM\n");
next prev parent reply other threads:[~2015-07-12 10:25 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-12 10:25 [RFC v4 00/25] Re-use nvram module Finn Thain
2015-07-12 10:25 ` [RFC v4 01/25] scsi/atari_scsi: Dont select CONFIG_NVRAM Finn Thain
2015-07-12 10:25 ` [RFC v4 02/25] char/nvram: Use bitwise OR to obtain Atari video mode data Finn Thain
2015-07-12 10:25 ` [RFC v4 03/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c Finn Thain
2015-07-13 18:13 ` Andreas Schwab
2015-07-14 8:17 ` Finn Thain
2015-07-14 8:23 ` Geert Uytterhoeven
2015-07-14 8:33 ` Andreas Schwab
2015-07-22 3:52 ` Michael Schmitz
2015-07-22 4:22 ` Finn Thain
2015-07-22 14:32 ` Christian T. Steigies
2015-07-22 23:46 ` Michael Schmitz
2015-07-23 0:49 ` Finn Thain
2015-07-23 9:21 ` Christian T. Steigies
2015-07-24 2:56 ` Michael Schmitz
2015-07-24 19:07 ` Christian T. Steigies
2015-07-25 0:35 ` Finn Thain
2015-07-25 1:00 ` Michael Ellerman
2015-07-25 7:38 ` Finn Thain
2015-07-26 1:37 ` Finn Thain
2015-07-25 0:51 ` Michael Schmitz
2015-07-25 7:27 ` Finn Thain
2015-07-26 1:02 ` Michael Schmitz
2015-07-26 1:19 ` Finn Thain
2015-07-27 2:23 ` Michael Schmitz
2015-07-27 5:51 ` Finn Thain
2015-07-12 10:25 ` [RFC v4 04/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops Finn Thain
2015-07-12 10:25 ` [RFC v4 05/25] char/nvram: Re-order functions to remove forward declarations and #ifdefs Finn Thain
2015-07-12 10:25 ` [RFC v4 06/25] char/nvram: Adopt arch_nvram_ops Finn Thain
2015-07-12 10:25 ` [RFC v4 07/25] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain
2015-07-12 10:25 ` [RFC v4 08/25] char/nvram: Allow the set_checksum and initialize ioctls to be omitted Finn Thain
2015-07-12 10:25 ` [RFC v4 09/25] char/nvram: Implement NVRAM read/write methods Finn Thain
2015-07-12 10:25 ` [RFC v4 10/25] char/nvram: Use generic fixed_size_llseek() Finn Thain
2015-07-12 10:25 ` [RFC v4 11/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain
2015-07-12 10:25 ` [RFC v4 12/25] char/nvram: Add "devname:nvram" module alias Finn Thain
2015-07-12 10:25 ` [RFC v4 13/25] powerpc: Cleanup nvram includes Finn Thain
2015-07-12 10:25 ` Finn Thain [this message]
2015-07-12 10:25 ` [RFC v4 15/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports Finn Thain
2015-07-12 10:25 ` [RFC v4 16/25] powerpc: Implement nvram sync ioctl Finn Thain
2015-07-12 10:25 ` [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte() Finn Thain
2015-07-14 7:58 ` Finn Thain
2015-07-14 11:52 ` Benjamin Herrenschmidt
2015-07-15 5:21 ` Finn Thain
2015-07-16 6:01 ` Finn Thain
2015-09-18 8:17 ` Finn Thain
2015-07-12 10:25 ` [RFC v4 18/25] nvram: Drop nvram_* symbol exports and prototypes Finn Thain
2015-07-12 10:25 ` [RFC v4 19/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS Finn Thain
2015-07-12 10:25 ` [RFC v4 20/25] char/generic_nvram: Remove as unused Finn Thain
2015-07-12 10:25 ` [RFC v4 21/25] powerpc: Adopt nvram module for PPC64 Finn Thain
2015-07-12 10:25 ` [RFC v4 22/25] m68k/mac: Adopt naming and calling conventions for PRAM routines Finn Thain
2015-07-12 10:25 ` [RFC v4 23/25] m68k/mac: Use macros for RTC accesses not magic numbers Finn Thain
2015-07-12 10:25 ` [RFC v4 24/25] m68k/mac: Fix PRAM accessors Finn Thain
2015-07-12 10:25 ` [RFC v4 25/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions Finn Thain
2015-07-13 7:55 ` [RFC v4 00/25] Re-use nvram module Geert Uytterhoeven
2015-07-14 7:57 ` Finn Thain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150712102530.775902562@telegraphics.com.au \
--to=fthain@telegraphics.com.au \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox