[PATCH v4 08/11] macintosh/via-pmu68k: Don't load driver on unsupported hardware

2018-07-02 Thread Finn Thain
Don't load the via-pmu68k driver on early PowerBooks. The M50753 PMU device found in those models was never supported by this driver. Attempting to load the driver usually causes a boot hang. Cc: Geert Uytterhoeven Signed-off-by: Finn Thain Reviewed-by: Michael Schmitz --- arch/m68k/mac

[PATCH v4 03/11] macintosh/via-pmu: Don't clear shift register interrupt flag twice

2018-07-02 Thread Finn Thain
The shift register interrupt flag gets cleared in via_pmu_interrupt() and once again in pmu_sr_intr(). Fix this theoretical race condition. Tested-by: Stan Johnson Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven --- drivers/macintosh/via-pmu.c | 1 - 1 file changed, 1 deletion

[PATCH v4 10/11] macintosh/via-pmu: Clean up interrupt statistics

2018-07-02 Thread Finn Thain
Replace an open-coded ffs() with the function call. Simplify an if-else cascade using a switch statement. Correct a typo and an indentation issue. Tested-by: Stan Johnson Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven --- drivers/macintosh/via-pmu.c | 39

[PATCH v4 09/11] macintosh/via-pmu: Replace via-pmu68k driver with via-pmu driver

2018-07-02 Thread Finn Thain
Now that the PowerMac via-pmu driver supports m68k PowerBooks, switch over to that driver and remove the via-pmu68k driver. Cc: Geert Uytterhoeven Tested-by: Stan Johnson Signed-off-by: Finn Thain --- arch/m68k/configs/mac_defconfig | 2 +- arch/m68k/configs/multi_defconfig | 2 +- arch

[PATCH v4 00/11] macintosh: Resolve various PMU driver problems

2018-07-02 Thread Finn Thain
/powerpc RTC code stabilizes. Finn Thain (11): macintosh/via-pmu: Fix section mismatch warning macintosh/via-pmu: Add missing mmio accessors macintosh/via-pmu: Don't clear shift register interrupt flag twice macintosh/via-pmu: Enhance state machine with new 'uninitialized' state

[PATCH v4 02/11] macintosh/via-pmu: Add missing mmio accessors

2018-07-02 Thread Finn Thain
: warning: dereference of noderef expression drivers/macintosh/via-pmu.c:1456:69: warning: dereference of noderef expression Tested-by: Stan Johnson Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven --- drivers/macintosh/via-pmu.c | 9 + 1 file changed, 5 insertions(+), 4 deletions

[PATCH v4 05/11] macintosh/via-pmu: Replace via pointer with via1 and via2 pointers

2018-07-02 Thread Finn Thain
this. For the CONFIG_PPC_PMAC case, set via1 = via2 so there is no change. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-pmu.c | 142 +--- 1 file changed, 69 insertions(+), 73 deletions(-) diff --git a/drivers/macintosh/via-pmu.c b/drivers

[PATCH v4 11/11] macintosh/via-pmu: Disambiguate interrupt statistics

2018-07-02 Thread Finn Thain
interrupts is by necessity visible in userland. However, packages which interact with the PMU (that is, pbbuttonsd, pmac-utils and pmud) don't open this file. AFAIK, user software has no need to poll these counters. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- The file now looks like

[PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning

2018-07-02 Thread Finn Thain
. Remove it to fix the warning, consistent with the other ADB drivers. Tested-by: Stan Johnson Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven --- drivers/macintosh/via-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/via-pmu.c b/drivers

[PATCH v4 07/11] macintosh/via-pmu: Explicitly specify CONFIG_PPC_PMAC dependencies

2018-07-02 Thread Finn Thain
At present, CONFIG_ADB_PMU depends on CONFIG_PPC_PMAC. When this gets relaxed to CONFIG_PPC_PMAC || CONFIG_MAC, those Kconfig symbols with implicit deps on PPC_PMAC will need explicit deps. Add them now. No functional change. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers

Re: [PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning

2018-07-02 Thread Finn Thain
On Mon, 2 Jul 2018, Mathieu Malaterre wrote: > On Mon, Jul 2, 2018 at 10:25 AM Finn Thain > wrote: > > > > The pmu_init() function has the __init qualifier, but the ops struct > > that holds a pointer to it does not. This causes a build warning. The > > driver

[PATCH 4/4] m68k/mac: Add mutual exclusion for IOP interrupt polling

2017-10-26 Thread Finn Thain
ed-off-by: Finn Thain <fth...@telegraphics.com.au> Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Cc: linuxppc-dev@lists.ozlabs.org --- arch/m68k/include/asm/mac_iop.h | 1 + arch/m68k/mac/iop.c | 9 + drivers/macintosh/adb-iop.c | 4 +--- 3 files changed, 1

[PATCH] macintosh/via-pmu68k: Initialize PMU driver with setup_arch and arch_initcall

2018-01-27 Thread Finn Thain
... arch_initcall via_pmu_start Bring via-pmu68k.c into line with via-pmu.c to fix this issue. Cc: Geert Uytterhoeven <ge...@linux-m68k.org> Tested-by: Stan Johnson <user...@yahoo.com> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- arch/m68k/mac/config.c

Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

2018-06-21 Thread Finn Thain
On Tue, 19 Jun 2018, Arnd Bergmann wrote: > The real-time clock on m68k (and powerpc) mac systems uses an unsigned > 32-bit value starting in 1904, which overflows in 2040, about two years > later than everyone else, but this gets wrapped around in the Linux code > in 2038 already because of

Re: linux-next: manual merge of the powerpc tree with the m68k tree

2018-08-04 Thread Finn Thain
On Thu, 2 Aug 2018, Geert Uytterhoeven wrote: > Hi Stephen, > > On Thu, Aug 2, 2018 at 1:42 AM Stephen Rothwell wrote: > > [forgot the conflict resolution ...] > > > > On Thu, 2 Aug 2018 09:27:20 +1000 Stephen Rothwell > > wrote: > > > > > > Today's linux-next merge of the powerpc tree got a

Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

2018-07-22 Thread Finn Thain
On Wed, 18 Jul 2018, I wrote: > On Wed, 18 Jul 2018, Arnd Bergmann wrote: > > > I'd suggest we do it like below to make it consistent with the rest > > again, using the 1904..2040 range of dates and no warning for invalid > > dates. > > > > If you agree, I'll send that as a proper patch. > >

Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

2018-07-18 Thread Finn Thain
On Wed, 18 Jul 2018, Geert Uytterhoeven wrote: > > Thanks for your patch! > > Applied and queued for v4.19, with the WARN_ON() dropped. > The patch you've committed to your for-v4.19 branch has this hunk: @@ -269,8 +275,12 @@ static long via_read_time(void)

Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

2018-07-18 Thread Finn Thain
On Wed, 18 Jul 2018, Arnd Bergmann wrote: > Hmm, apparently I forgot to update via_read_time(), that one > is indeed bogus and now inconsistent with the other functions. > > The change in via_write_time() seems at least consistent wtih what we do > elsewhere, and using __u32 makes this code

Re: v4.17 regression: PowerMac G3 won't boot, was Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()

2018-08-31 Thread Finn Thain
On Fri, 31 Aug 2018, Mac User wrote: > On 8/30/18 10:49 PM, Benjamin Herrenschmidt wrote: > > > On Fri, 2018-08-31 at 14:35 +1000, Benjamin Herrenschmidt wrote: > > > > ... > > Assuming you are using BootX (or miBoot), can you try this patch ? > > Yes, I'm using BootX. > > Thanks to Finn for

v4.17 regression: PowerMac G3 won't boot, was Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()

2018-08-29 Thread Finn Thain
Hi Frank, Linux v4.17 and later will no longer boot on a G3 PowerMac. The boot hangs very early, before any video driver loads. Stan and I were able to bisect the regression between v4.16 and v4.17 and arrived at commit 0b3ce78e90fc ("of: cache phandle nodes to reduce cost of

Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions

2018-07-09 Thread Finn Thain
On Mon, 9 Jul 2018, Arnd Bergmann wrote: > > The most likely explanation I have here is that the RTC was indeed set > to an incorrect date, either because of a depleted battery (not unlikely > for a ~15 year old box) or because it was previously stored incorrectly. The PowerMac stores the GMT

Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

2018-07-08 Thread Finn Thain
On Sun, 8 Jul 2018, Geert Uytterhoeven wrote: > On Fri, Jun 22, 2018 at 10:55 AM Arnd Bergmann wrote: > > I don't think anyone so far had a strong preference here, so I went > > with what Mathieu suggested and kept the original Mac behavior, but > > added the WARN_ON(). > > So, is this safe

[RFC] macintosh: Use common code to access RTC

2018-07-12 Thread Finn Thain
Once the 68k Mac port adopts the via-pmu driver, it must access the PMU RTC using the appropriate command format. The same code can then be used for both m68k and powerpc. Replace the RTC code that's duplicated in arch/powerpc and arch/m68k with common RTC accessors for Cuda and PMU devices.

[PATCH 0/7] Miscellaneous Macintosh fixes and clean up

2018-09-11 Thread Finn Thain
This series has some minor fixes and cleanups under drivers/macintosh, including a patch to rework recent printk changes in adb-hid.c. There's also a re-based RTC code de-duplication patch. Finn Thain (7): macintosh: Use common code to access RTC macintosh/adb: Rework printk output again

[PATCH 1/7] macintosh: Use common code to access RTC

2018-09-11 Thread Finn Thain
werpc/powermac: Fix rtc read/write functions"). Tested-by: Stan Johnson Signed-off-by: Finn Thain Cc: Geert Uytterhoeven Cc: Arnd Bergmann --- This patch has been regression tested on the following Mac models. Centris 660av (m68k, Cuda) PowerBook 190 (m68k, PMU) Beige G

[PATCH 6/7] macintosh/via-macii, macintosh/adb-iop: Modernize printk calls

2018-09-11 Thread Finn Thain
Add missing severity level to log messages. Signed-off-by: Finn Thain --- drivers/macintosh/adb-iop.c | 2 +- drivers/macintosh/via-macii.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c index ca623e6446e4

[PATCH 4/7] macintosh/via-macii: Remove BUG_ON assertions

2018-09-11 Thread Finn Thain
with a WARN_ON and an array bounds check. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 49 +++ 1 file changed, 7 insertions(+), 42 deletions(-) diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via

[PATCH 2/7] macintosh/adb: Rework printk output again

2018-09-11 Thread Finn Thain
hat commit also changed printk(KERN_DEBUG ...) to pr_debug(...), which hinders work on low-level ADB driver bugs. Revert that change. Cc: Andreas Schwab Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/adb.c| 8 --- d

Re: v4.17 regression: PowerMac G3 won't boot, was Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()

2018-09-11 Thread Finn Thain
[The Cc list got pruned so I'm forwarding Stan's reply for the benefit of the list archives and any other interested parties.] On Mon, 10 Sep 2018, Stan Johnson wrote: > On 9/10/18 6:53 AM, Rob Herring wrote: > > > ... > > Can you try this patch (w/o Ben's patch). I think the problem is if >

[PATCH 5/7] macintosh/via-macii: Simplify locking

2018-09-11 Thread Finn Thain
-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c index 7e0e32fa7eb2..6ed9ac91aca1 100644 --- a/drivers/macintosh/via-macii.c +++ b

[PATCH 3/7] macintosh/via-macii: Synchronous bus reset

2018-09-11 Thread Finn Thain
Make the reset operation synchronous, like the other ADB drivers. The reset request is static data but callers may not know that. This way the struct is not in use when the reset method returns. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 3 ++- 1 file

[PATCH 7/7] macintosh/via-macii, macintosh/adb-iop: Clean up whitespace

2018-09-11 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/macintosh/adb-iop.c | 48 --- drivers/macintosh/via-macii.c | 286 +- 2 files changed, 174 insertions(+), 160 deletions(-) diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c index

[PATCH] macintosh/adb: Use C99 initializers for struct adb_driver instances

2018-03-12 Thread Finn Thain
Hopefully this will make it easier for the next reader who needs to check these pointers. No change to object files. Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/macintosh/adb-iop.c| 14 +++

[PATCH v2 07/10] block/swim: Rename macros to avoid inconsistent inverted logic

2018-04-11 Thread Finn Thain
viv...@redhat.com> Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Cc: linuxppc-dev@lists.ozlabs.org Cc: Jens Axboe <ax...@kernel.dk> Cc: sta...@vger.kernel.org # v4.14+ Tested-by: Stan Johnson <user...@yahoo.com> Signed-off-by: Finn Thain <fth...@telegraphics.com.au>

[PATCH 09/12] block/swim: Rename macros to avoid inconsistent inverted logic

2018-03-31 Thread Finn Thain
viv...@redhat.com> Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Cc: linuxppc-dev@lists.ozlabs.org Cc: Jens Axboe <ax...@kernel.dk> Tested-by: Stan Johnson <user...@yahoo.com> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/block/swim.c | 8 -

[PATCH] macintosh/adb: Use C99 initializers for struct adb_driver instances

2018-03-28 Thread Finn Thain
No change to object files. Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/macintosh/adb-iop.c| 14 +++--- drivers/macintosh/macio-adb.c | 15 +++ drivers/macintosh/via-m

Re: [PATCH v3 00/12] macintosh: Resolve various PMU driver problems

2018-06-24 Thread Finn Thain
On Wed, 13 Jun 2018, I wrote: > Finn Thain (12): > macintosh/via-pmu: Fix section mismatch warning > macintosh/via-pmu: Add missing mmio accessors > macintosh/via-pmu: Don't clear shift register interrupt flag twice > macintosh/via-pmu: Enhance state machine with new

Re: [PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-31 Thread Finn Thain
On Mon, 31 Dec 2018, Arnd Bergmann wrote: > On Sun, Dec 30, 2018 at 12:43 AM Finn Thain > wrote: > > > > > Is there some benefit, or is that just personal taste? > > > > Avoiding changes to call sites avoids code review, but I think 1) the > > thinkpad_

Re: [PATCH v8 00/25] Re-use nvram module

2018-12-31 Thread Finn Thain
On Sun, 30 Dec 2018, I wrote: > > The rationale for the ops struct was that it offers introspection. > > [...] those platforms which need checksum validation always set > byte-at-a-time methods to NULL. > > [...] The NULL methods in the ops struct allow the nvram.c misc device > to avoid

Re: [PATCH v8 18/25] powerpc: Implement nvram sync ioctl

2018-12-31 Thread Finn Thain
On Mon, 31 Dec 2018, Arnd Bergmann wrote: > On Sun, Dec 30, 2018 at 8:25 AM Finn Thain wrote: > > > > On Sat, 29 Dec 2018, Arnd Bergmann wrote: > > > > > > --- a/drivers/char/nvram.c > > > > +++ b/drivers/char/nvram.c > > > >

Re: [PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

2018-12-31 Thread Finn Thain
On Mon, 31 Dec 2018, Arnd Bergmann wrote: > On Sun, Dec 30, 2018 at 4:29 AM Finn Thain wrote: > > > > On Sat, 29 Dec 2018, Arnd Bergmann wrote: > > > > > On Wed, Dec 26, 2018 at 1:43 AM Finn Thain > > > wrote: > > >

Re: [PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions

2018-12-29 Thread Finn Thain
On Sat, 29 Dec 2018, Arnd Bergmann wrote: > On Wed, Dec 26, 2018 at 1:43 AM Finn Thain wrote: > > > + > > +static ssize_t m68k_nvram_get_size(void) > > +{ > > + if (MACH_IS_ATARI) > > + return atari_nvram_get_size

Re: [PATCH v8 18/25] powerpc: Implement nvram sync ioctl

2018-12-29 Thread Finn Thain
On Sat, 29 Dec 2018, Arnd Bergmann wrote: > > --- a/drivers/char/nvram.c > > +++ b/drivers/char/nvram.c > > @@ -48,6 +48,10 @@ > > #include > > #include > > > > +#ifdef CONFIG_PPC > > +#include > > +#include > > +#endif > > > > static DEFINE_MUTEX(nvram_mutex); > > static

Re: [PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

2018-12-29 Thread Finn Thain
On Sat, 29 Dec 2018, Arnd Bergmann wrote: > On Wed, Dec 26, 2018 at 1:43 AM Finn Thain wrote: > > > +static ssize_t ppc_nvram_get_size(void) > > +{ > > + if (ppc_md.nvram_size) > > + return ppc_md.nvram_size(); > > + return

Re: [PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-29 Thread Finn Thain
On Sat, 29 Dec 2018, LEROY Christophe wrote: > Finn Thain a ?crit?: > > > Make use of arch_nvram_ops in device drivers so that the nvram_* function > > exports can be removed. > > > > Since they are no longer global symbols, rename the PPC32 nvram_* functions >

Re: [PATCH v8 00/25] Re-use nvram module

2018-12-29 Thread Finn Thain
On Sat, 29 Dec 2018, Arnd Bergmann wrote: > I had a look at the complete series now, and I think this is a great > cleanup. I replied with a couple of minor comments that you may or may > not want to address first. > Thanks for reviewing this. > The one thing I would like to see resolved (I

Re: [PATCH v8 18/25] powerpc: Implement nvram sync ioctl

2019-01-02 Thread Finn Thain
On Tue, 1 Jan 2019, I wrote: > > There are no [nvram] ioctls common to all architectures. So your example > becomes, > > static long nvram_misc_ioctl(struct file *file, unsigned int cmd, > unsigned long arg) > { > if (ops->ioctl) > return

Re: [PATCH v8 02/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c

2019-01-02 Thread Finn Thain
On Sat, 29 Dec 2018, I wrote: > On Fri, 28 Dec 2018, LEROY Christophe wrote: > > > > --- a/drivers/char/nvram.c > > > +++ b/drivers/char/nvram.c > > > @@ -21,13 +21,6 @@ > > > * ioctl(NVRAM_SETCKS) (doesn't change contents, just makes checksum > > > valid > > > * again; use with care!) > >

Re: [PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2019-01-05 Thread Finn Thain
On Sun, 30 Dec 2018, I wrote: > On Sat, 29 Dec 2018, LEROY Christophe wrote: > > > Finn Thain a ?crit?: > > > > > Make use of arch_nvram_ops in device drivers so that the nvram_* function > > > exports can be removed. > > > > > > Sin

[PATCH v9 03/22] char/nvram: Re-order functions to remove forward declarations and #ifdefs

2019-01-14 Thread Finn Thain
Also give functions more sensible names: nvram_misc_* for misc device ops, nvram_proc_* for proc file ops and nvram_module_* for init and exit functions. This prevents name collisions with nvram.h helper functions and improves readability. Signed-off-by: Finn Thain --- drivers/char/nvram.c

[PATCH v9 04/22] nvram: Replace nvram_* function exports with static functions

2019-01-14 Thread Finn Thain
-implemented in subsequent patches. Replace the sole validate-checksum-and-read-byte sequence with a call to nvram_read() which will gain the same semantics in subsequent patches. Remove unused exports. Acked-by: Geert Uytterhoeven Signed-off-by: Finn Thain --- arch/m68k/atari/nvram.c | 39

[PATCH v9 05/22] m68k/atari: Implement arch_nvram_ops struct

2019-01-14 Thread Finn Thain
By implementing an arch_nvram_ops struct, a platform can re-use the drivers/char/nvram.c module without needing any arch-specific code in that module. Atari does so here. Acked-by: Geert Uytterhoeven Signed-off-by: Finn Thain --- Changed since v8: - Added static inline wrapper functions

[PATCH v9 06/22] powerpc: Replace nvram_* extern declarations with standard header

2019-01-14 Thread Finn Thain
Remove the nvram_read_byte() and nvram_write_byte() declarations in powerpc/include/asm/nvram.h and use the cross-platform static functions in linux/nvram.h instead. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Changed since v8: - Added nvram_read_byte() and nvram_write_byte

[PATCH v9 11/22] m68k/mac: Adopt naming and calling conventions for PRAM routines

2019-01-14 Thread Finn Thain
-by: Finn Thain --- Changed since v7: - Removed some gratuitous function pointers. --- arch/m68k/mac/misc.c | 61 +--- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 71c4735a31ee..78c807025436

[PATCH v9 08/22] char/nvram: Allow the set_checksum and initialize ioctls to be omitted

2019-01-14 Thread Finn Thain
r codes so that a multi-platform kernel binary can do the right thing when running on hardware without a suitable NVRAM. Signed-off-by: Finn Thain --- Changed since v8: - Renamed nvram_* functions to avoid name collisions. --- drivers/char/nvram.c | 70 --- inc

[PATCH v9 14/22] macintosh/via-cuda: Don't rely on Cuda to end a transfer

2019-01-14 Thread Finn Thain
Certain Cuda transfers have to be ended by the driver. According to Apple's open source Cuda driver, as found in mkLinux and XNU, this applies to any "open ended request such as PRAM read". This fixes an infinite polling loop in cuda_pram_read_byte(). Tested-by: Stan Johnson Signed-of

[PATCH v9 01/22] scsi/atari_scsi: Don't select CONFIG_NVRAM

2019-01-14 Thread Finn Thain
form. In this patch and the subsequent fbdev driver patch, the convention is adopted across all relevant platforms whereby NVRAM functionality gets enabled in a given device driver when the nvram misc device is built-in or when both drivers are modules. Acked-by: Michael Schmitz Signed-off-by: Finn T

[PATCH v9 07/22] char/nvram: Adopt arch_nvram_ops

2019-01-14 Thread Finn Thain
the common wrapper functions, the nvram module and other drivers can make use of the available NVRAM functionality in a portable way. Signed-off-by: Finn Thain --- It might be nice if the NVRAM Kconfig symbol depended only on HAVE_ARCH_NVRAM_OPS and all the x86 code here were moved to arch/x86

[PATCH v9 20/22] powerpc: Enable HAVE_ARCH_NVRAM_OPS and disable GENERIC_NVRAM

2019-01-14 Thread Finn Thain
Switch PPC32 kernels from the generic_nvram module to the nvram module. Also fix a theoretical bug where CHRP omits the chrp_nvram_init() call when CONFIG_NVRAM_MODULE=m. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- The change in the name of the module is visible to userspace

[PATCH v9 21/22] char/generic_nvram: Remove as unused

2019-01-14 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/char/Makefile| 6 +- drivers/char/generic_nvram.c | 160 --- 2 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 drivers/char/generic_nvram.c diff --git a/drivers/char/Makefile b/drivers/char

[PATCH v9 18/22] powerpc: Implement nvram ioctls

2019-01-14 Thread Finn Thain
Add the powerpc-specific ioctls to the nvram module. This allows the nvram module to replace the generic_nvram module. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- On PPC32, the IOC_NVRAM_SYNC ioctl call always returns 0, even for those platforms that don't implement ppc_md.nvram_sync

[PATCH v9 22/22] powerpc: Adopt nvram module for PPC64

2019-01-14 Thread Finn Thain
d be in an error path for an IOC_NVRAM_GET_OFFSET ioctl syscall. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- BTW, the IOC_NVRAM_SYNC ioctl call returns an error on PPC64. This patch retains this behaviour though it might be better to actually perform a sync since both PPC64 and PP

[PATCH v9 02/22] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c

2019-01-14 Thread Finn Thain
Move the m68k-specific code out of the driver to make the driver generic. I've used 'SPDX-License-Identifier: GPL-2.0+' for the new file because the old file is covered by MODULE_LICENSE("GPL"). Acked-by: Geert Uytterhoeven Signed-off-by: Finn Thain --- Changed since v8: - Fixed

[PATCH v9 09/22] char/nvram: Implement NVRAM read/write methods

2019-01-14 Thread Finn Thain
but may be unavailable so fall back on the latter methods when necessary. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Changed since v8: - Renamed nvram_* functions to avoid name collisions. - Added nvram_read_bytes() and nvram_write_bytes() helpers for use by those platforms wh

[PATCH v9 13/22] m68k/mac: Fix PRAM accessors

2019-01-14 Thread Finn Thain
PMU-based m68k Macs pre-date PowerMac-style NVRAM. Use the appropriate PMU commands. Also implement the missing XPRAM accessors for VIA-based Macs. Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Changed since v7: - Revised PMU response decoding due to via

[PATCH v9 16/22] char/nvram: Add "devname:nvram" module alias

2019-01-14 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/char/nvram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index adcc213c331e..c9e295d73dc5 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -503,3 +503,4 @@ module_exit(nvram_module_exit

[PATCH v9 00/22] Re-use nvram module

2019-01-14 Thread Finn Thain
anged the CONFIG_NVRAM default to better approximate the present code. In particular, the CONFIG_GENERIC_NVRAM default and use of "select NVRAM". - Added more tested-by tags. For older change logs, please refer to, https://lore.kernel.org/lkml/20151101104202.301856...@telegraphics.com.au/

[PATCH v9 10/22] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS

2019-01-14 Thread Finn Thain
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 Signed-off-by: Finn Thain --- Changed since v8: - Moved the HAVE_ARCH_NVRAM_OPS symbol to common code

[PATCH v9 12/22] m68k/mac: Use macros for RTC accesses not magic numbers

2019-01-14 Thread Finn Thain
This is intended to improve code style and not affect code behaviour. Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson Signed-off-by: Finn Thain --- arch/m68k/mac/misc.c | 59 ++-- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/arch

[PATCH v9 15/22] m68k: Dispatch nvram_ops calls to Atari or Mac functions

2019-01-14 Thread Finn Thain
Signed-off-by: Finn Thain --- Changed since v8: - Adopted nvram_read_bytes() and nvram_write_bytes() where possible. --- arch/m68k/Kconfig.machine | 1 + arch/m68k/atari/nvram.c | 21 ++-- arch/m68k/include/asm/atarihw.h | 6 +++ arch/m68k/include/asm/macintosh.h | 4

[PATCH v9 17/22] powerpc: Define missing ppc_md.nvram_size for CHRP and PowerMac

2019-01-14 Thread Finn Thain
the naming convention used across powerpc platforms for NVRAM accessor functions. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- Changed since v8: - Renamed functions to correspond with ppc_md member names. --- arch/powerpc/platforms/chrp/nvram.c | 14 ++ arch/powerpc

[PATCH v9 19/22] powerpc, fbdev: Use NV_CMODE and NV_VMODE only when CONFIG_PPC32 && CONFIG_PPC_PMAC && CONFIG_NVRAM

2019-01-14 Thread Finn Thain
GetPreferredConfiguration and SavePreferredConfiguration in "Designing PCI Cards and Drivers for Power Macintosh Computers". ** See SetDefaultMode and GetDefaultMode in "Designing Cards and Drivers for the Macintosh Family". Signed-off-by: Finn Thain --- Changed since v8:

Re: [PATCH v9 00/22] Re-use nvram module

2019-01-22 Thread Finn Thain
On Tue, 22 Jan 2019, Greg Kroah-Hartman wrote: > On Tue, Jan 15, 2019 at 03:18:56PM +1100, Finn Thain wrote: > > The "generic" NVRAM module, drivers/char/generic_nvram.c, implements a > > /dev/nvram misc device. This module is used only by 32-bit PowerPC > > pl

[PATCH v8 10/25] m68k/mac: Adopt naming and calling conventions for PRAM routines

2018-12-25 Thread Finn Thain
Adopt the existing *_read_byte and *_write_byte naming convention. Rename via_pram_readbyte and via_pram_writebyte to avoid confusion. Adjust calling conventions of mac_pram_* functions to match the arch_nvram_ops struct methods. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested

[PATCH v8 04/25] char/nvram: Re-order functions to remove forward declarations and #ifdefs

2018-12-25 Thread Finn Thain
Also give functions more sensible names: nvram_misc_* for misc device ops, nvram_proc_* for proc file ops and nvram_module_* for init and exit functions. This helps to distinguish them from struct nvram_ops methods. Signed-off-by: Finn Thain --- drivers/char/nvram.c | 167

[PATCH v8 21/25] nvram: Drop nvram_* symbol exports and prototypes

2018-12-25 Thread Finn Thain
Drivers now use the arch_nvram_ops calls so remove the function exports and prototypes. nvram_check_checksum() is unused so remove it. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven --- arch/m68k/atari/nvram.c | 6 +++--- drivers/char/nvram.c| 27

[PATCH v8 06/25] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-25 Thread Finn Thain
Make use of arch_nvram_ops in the thinkpad_acpi driver so that the nvram_* function exports can be removed. Signed-off-by: Finn Thain Acked-by: Henrique de Moraes Holschuh Reviewed-by: Darren Hart --- I've tested this on a ThinkPad T43. --- drivers/platform/x86/thinkpad_acpi.c | 20

[PATCH v8 19/25] powerpc, fbdev: Use NV_CMODE and NV_VMODE only when CONFIG_PPC32 && CONFIG_PPC_PMAC && CONFIG_NVRAM

2018-12-25 Thread Finn Thain
ntosh Computers". ** See SetDefaultMode and GetDefaultMode in "Designing Cards and Drivers for the Macintosh Family". Signed-off-by: Finn Thain --- drivers/video/fbdev/Kconfig| 2 +- drivers/video/fbdev/imsttfb.c | 12 +--- drivers/video/fbdev/ma

[PATCH v8 09/25] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS

2018-12-25 Thread Finn Thain
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 "s

[PATCH v8 23/25] char/generic_nvram: Remove as unused

2018-12-25 Thread Finn Thain
Thereby eliminating some twisted CONFIG_NVRAM logic. Signed-off-by: Finn Thain --- drivers/char/Makefile| 6 +- drivers/char/generic_nvram.c | 160 --- 2 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 drivers/char/generic_nvram.c

[PATCH v8 14/25] char/nvram: Add "devname:nvram" module alias

2018-12-25 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/char/nvram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 889123ddace4..b77c27d68762 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -554,3 +554,4 @@ module_exit(nvram_module_exit

[PATCH v8 20/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2018-12-25 Thread Finn Thain
Make use of arch_nvram_ops in device drivers so that the nvram_* function exports can be removed. Since they are no longer global symbols, rename the PPC32 nvram_* functions appropriately. Signed-off-by: Finn Thain --- arch/powerpc/kernel/setup_32.c | 8 drivers/char

[PATCH v8 13/25] m68k: Dispatch nvram_ops calls to Atari or Mac functions

2018-12-25 Thread Finn Thain
A multi-platform kernel binary has to decide at run-time how to dispatch the arch_nvram_ops calls. Add a platform-independent arch_nvram_ops struct for this, to replace the atari-specific one. Enable CONFIG_HAVE_ARCH_NVRAM_OPS for Macs. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies

[PATCH v8 05/25] char/nvram: Adopt arch_nvram_ops

2018-12-25 Thread Finn Thain
and architectures. Signed-off-by: Finn Thain --- The procfs code here could be moved to arch/x86 (like the earlier patch did for m68k code that was here). The nvram_ops struct could be implemented and exported by the rtc-cmos driver instead, to eliminate the remaining #ifdefs. --- drivers/char

[PATCH v8 15/25] powerpc: Clean up nvram includes

2018-12-25 Thread Finn Thain
The nvram_read_byte() and nvram_write_byte() definitions in asm/nvram.h duplicate those in linux/nvram.h. Get rid of the former to prepare for adoption of struct arch_nvram_ops (which is defined in linux/nvram.h for general use). Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch

[PATCH v8 07/25] char/nvram: Allow the set_checksum and initialize ioctls to be omitted

2018-12-25 Thread Finn Thain
r codes so that a multi-platform kernel binary can do the right thing when running on hardware without suitable NVRAM. Signed-off-by: Finn Thain --- drivers/char/nvram.c | 70 --- include/linux/nvram.h | 2 ++ 2 files changed, 42 insertions(+), 30 deletions(-)

[PATCH v8 22/25] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS

2018-12-25 Thread Finn Thain
Switch PPC32 kernels from the generic_nvram module to the nvram module. Also fix a theoretical bug where CHRP omits the chrp_nvram_init() call when CONFIG_NVRAM_MODULE=m. Signed-off-by: Finn Thain Tested-by: Laurent Vivier Tested-by: Stan Johnson --- The change in the name of the module

[PATCH v8 03/25] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2018-12-25 Thread Finn Thain
l. Replace this validate-checksum-and-read-byte sequence with the equivalent rtc_nvram_ops.read() call and remove the now unused functions. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies Acked-by: Geert Uytterhoeven --- The advantage of the new ops struct over the old global nvram_*

[PATCH v8 18/25] powerpc: Implement nvram sync ioctl

2018-12-25 Thread Finn Thain
Add the powerpc-specific sync() method to struct nvram_ops and implement the corresponding ioctl in the nvram module. This allows the nvram module to replace the generic_nvram module. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- On PPC32, the IOC_NVRAM_SYNC ioctl call always returns 0

[PATCH v8 08/25] char/nvram: Implement NVRAM read/write methods

2018-12-25 Thread Finn Thain
iver prefers to use the former but will fall back on the latter. Signed-off-by: Finn Thain --- Changed since v7: - Use memdup_user(), like arch/powerpc/kernel/nvram_64.c. --- drivers/char/nvram.c | 149 ++- 1 file changed, 104 insertions(+), 45 deletions(-) dif

[PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

2018-12-25 Thread Finn Thain
syscall. Signed-off-by: Finn Thain Tested-by: Laurent Vivier Tested-by: Stan Johnson --- BTW, the IOC_NVRAM_SYNC ioctl call returns -EINVAL on PPC64. This patch retains this behaviour though it might be better to actually perform a sync. Both PPC64 and PPC32 kernels implement ppc_md.nvram_s

[PATCH v8 17/25] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports

2018-12-25 Thread Finn Thain
Implement arch_nvram_ops for PPC32 and make use of it in the generic_nvram misc device module so that the nvram_* function exports can be removed. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch/powerpc/include/asm/nvram.h | 3 --- arch/powerpc/kernel/setup_32.c | 10

[PATCH v8 25/25] powerpc: Remove pmac_xpram_{read,write} functions

2018-12-25 Thread Finn Thain
(). pmac_xpram_read() becomes unused as pmac_time_init() is converted to the arch_nvram_ops API. pmac_xpram_write() was already unused. As a bonus, drivers/char/nvram.c benefits from the API conversion by the removal of an #ifdef. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch/powerpc/include

[PATCH v8 02/25] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c

2018-12-25 Thread Finn Thain
Move the m68k-specific code out of the driver to make the driver generic. I've used 'SPDX-License-Identifier: GPL-2.0+' for the new file because the old file is covered by MODULE_LICENSE("GPL"). Signed-off-by: Finn Thain Tested-by: Christian T. Steigies Acked-by: Geert Uy

[PATCH v8 01/25] scsi/atari_scsi: Don't select CONFIG_NVRAM

2018-12-25 Thread Finn Thain
the valkyriefb driver with powerpc, and since that driver uses NVRAM, it is affected by CONFIG_ATARI_SCSI, because of the use of "select NVRAM". Adopt the powerpc convention on m68k to avoid surprises. Signed-off-by: Finn Thain Tested-by: Christian T. Steigies --- This patch temporaril

[PATCH v8 00/25] Re-use nvram module

2018-12-25 Thread Finn Thain
kernel.org/lkml/20151101104202.301856...@telegraphics.com.au/ Finn Thain (25): scsi/atari_scsi: Don't select CONFIG_NVRAM m68k/atari: Move Atari-specific code out of drivers/char/nvram.c m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops char/nvram: Re-order functions to rem

[PATCH v8 16/25] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac

2018-12-25 Thread Finn Thain
and chrp_nvram_write, which break the naming convention used across PowerPC platforms for NVRAM accessor functions. Signed-off-by: Finn Thain Tested-by: Stan Johnson --- arch/powerpc/platforms/chrp/nvram.c | 14 ++ arch/powerpc/platforms/powermac/nvram.c | 9 + 2 files changed, 19

[PATCH v8 11/25] m68k/mac: Use macros for RTC accesses not magic numbers

2018-12-25 Thread Finn Thain
This is intended to improve code style and not affect code behaviour. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson --- arch/m68k/mac/misc.c | 59 ++-- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/arch

[PATCH v8 12/25] m68k/mac: Fix PRAM accessors

2018-12-25 Thread Finn Thain
PMU-based m68k Macs pre-date PowerMac-style NVRAM. Use the appropriate PMU commands. Also implement the missing XPRAM accessors for VIA-based Macs. Signed-off-by: Finn Thain Acked-by: Geert Uytterhoeven Tested-by: Stan Johnson --- Changed since v7: - Updated PMU response decoding due to via

Re: [PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

2019-01-08 Thread Finn Thain
On Tue, 8 Jan 2019, Michael Ellerman wrote: > > The reason why that doesn't work boils down to introspection. (This > > was mentioned elsewhere in this email thread.) For example, we > > presently have code like this, > > > > ssize_t nvram_get_size(void) > > { > >if (ppc_md.nvram_size)

<    1   2   3   4   5   6   >