[PATCH 12/13] MIPS: drop unused pic32.h header

Brian Masney posted 13 patches 1 month ago
There is a newer version of this series
[PATCH 12/13] MIPS: drop unused pic32.h header
Posted by Brian Masney 1 month ago
All users of the MIPS pic32.h asm header have been migrated to
linux/platform_data/pic32.h, so let's go ahead and drop the unused asm
variant.

Signed-off-by: Brian Masney <bmasney@redhat.com>

---
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/mips/include/asm/mach-pic32/pic32.h | 36 --------------------------------
 1 file changed, 36 deletions(-)

diff --git a/arch/mips/include/asm/mach-pic32/pic32.h b/arch/mips/include/asm/mach-pic32/pic32.h
deleted file mode 100644
index 53918a671a4c39dba2a22121187cdd73e1935b24..0000000000000000000000000000000000000000
--- a/arch/mips/include/asm/mach-pic32/pic32.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Joshua Henderson <joshua.henderson@microchip.com>
- * Copyright (C) 2015 Microchip Technology Inc.  All rights reserved.
- */
-#ifndef _ASM_MACH_PIC32_H
-#define _ASM_MACH_PIC32_H
-
-#include <linux/io.h>
-
-/*
- * PIC32 register offsets for SET/CLR/INV where supported.
- */
-#define PIC32_CLR(_reg)		((_reg) + 0x04)
-#define PIC32_SET(_reg)		((_reg) + 0x08)
-#define PIC32_INV(_reg)		((_reg) + 0x0C)
-
-/*
- * PIC32 Base Register Offsets
- */
-#define PIC32_BASE_CONFIG	0x1f800000
-#define PIC32_BASE_OSC		0x1f801200
-#define PIC32_BASE_RESET	0x1f801240
-#define PIC32_BASE_PPS		0x1f801400
-#define PIC32_BASE_UART		0x1f822000
-#define PIC32_BASE_PORT		0x1f860000
-#define PIC32_BASE_DEVCFG2	0x1fc4ff44
-
-/*
- * Register unlock sequence required for some register access.
- */
-void pic32_syskey_unlock_debug(const char *fn, const ulong ln);
-#define pic32_syskey_unlock()	\
-	pic32_syskey_unlock_debug(__func__, __LINE__)
-
-#endif /* _ASM_MACH_PIC32_H */

-- 
2.52.0
Re: [PATCH 12/13] MIPS: drop unused pic32.h header
Posted by Claudiu Beznea 4 weeks, 1 day ago
Hi, Brian,

On 1/9/26 18:41, Brian Masney wrote:
> All users of the MIPS pic32.h asm header have been migrated to
> linux/platform_data/pic32.h, so let's go ahead and drop the unused asm
> variant.
> 
> Signed-off-by: Brian Masney<bmasney@redhat.com>
> 
> ---
> To: Thomas Bogendoerfer<tsbogend@alpha.franken.de>
> Cc:linux-mips@vger.kernel.org
> Cc:linux-kernel@vger.kernel.org
> ---
>   arch/mips/include/asm/mach-pic32/pic32.h | 36 --------------------------------
>   1 file changed, 36 deletions(-)
> 
> diff --git a/arch/mips/include/asm/mach-pic32/pic32.h b/arch/mips/include/asm/mach-pic32/pic32.h
> deleted file mode 100644
> index 53918a671a4c39dba2a22121187cdd73e1935b24..0000000000000000000000000000000000000000
> --- a/arch/mips/include/asm/mach-pic32/pic32.h
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/*
> - * Joshua Henderson<joshua.henderson@microchip.com>
> - * Copyright (C) 2015 Microchip Technology Inc.  All rights reserved.
> - */
> -#ifndef _ASM_MACH_PIC32_H
> -#define _ASM_MACH_PIC32_H
> -
> -#include <linux/io.h>
> -

There are compilation errors when building pic32mzda_defconfig (see 
below) and I presume those are related to the fact that this include was 
dropped from include/linux/platform_data/pic32.h:

../arch/mips/pic32/common/reset.c: In function 'pic32_machine_restart':
../arch/mips/pic32/common/reset.c:27:17: error: implicit declaration of 
function 'ioremap' [-Wimplicit-function-declaration]
    27 |                 ioremap(PIC32_BASE_RESET + PIC32_RSWRST, 
sizeof(u32));
       |                 ^~~~~~~
../arch/mips/pic32/common/reset.c:27:17: error: initialization of 'void 
*' from 'int' makes pointer from integer without a cast [-Wint-conversion]
../arch/mips/pic32/common/reset.c:32:9: error: implicit declaration of 
function '__raw_writel'; did you mean '_raw_write_lock'? 
[-Wimplicit-function-declaration]
    32 |         __raw_writel(1, reg);
       |         ^~~~~~~~~~~~
       |         _raw_write_lock
   CC      fs/iomap/iter.o
../arch/mips/pic32/common/reset.c:33:15: error: implicit declaration of 
function '__raw_readl'; did you mean '_raw_read_lock'? 
[-Wimplicit-function-declaration]
    33 |         (void)__raw_readl(reg);
       |               ^~~~~~~~~~~
       |               _raw_read_lock
   CC      arch/mips/vdso/vgettimeofday.o
make[6]: *** [../scripts/Makefile.build:287: 
arch/mips/pic32/common/reset.o] Error 1
   CC      arch/mips/pic32/pic32mzda/early_clk.o
In file included from ../arch/mips/pic32/pic32mzda/early_clk.c:6:
../include/linux/platform_data/pic32.h:29:54: error: unknown type name 
'ulong'; did you mean 'long'?
    29 | void pic32_syskey_unlock_debug(const char *fn, const ulong ln);
       |                                                      ^~~~~
       |                                                      long
In file included from ../arch/mips/pic32/pic32mzda/early_clk.c:8:
../arch/mips/pic32/pic32mzda/pic32mzda.h:10:1: error: unknown type name 
'u32'
    10 | u32 pic32_get_pbclk(int bus);
       | ^~~
../arch/mips/pic32/pic32mzda/pic32mzda.h:11:1: error: unknown type name 
'u32'
    11 | u32 pic32_get_sysclk(void);
       | ^~~
../arch/mips/pic32/pic32mzda/pic32mzda.h:14:13: error: expected '=', 
',', ';', 'asm' or '__attribute__' before 'pic32_config_init'
    14 | void __init pic32_config_init(void);
       |             ^~~~~~~~~~~~~~~~~
../arch/mips/pic32/pic32mzda/pic32mzda.h:16:41: error: unknown type name 
'u32'
    16 | int pic32_set_sdhci_adma_fifo_threshold(u32 rthrs, u32 wthrs);
       |                                         ^~~
../arch/mips/pic32/pic32mzda/pic32mzda.h:16:52: error: unknown type name 
'u32'
    16 | int pic32_set_sdhci_adma_fifo_threshold(u32 rthrs, u32 wthrs);
       |                                                    ^~~
../arch/mips/pic32/pic32mzda/pic32mzda.h:17:1: error: unknown type name 
'u32'
    17 | u32 pic32_get_boot_status(void);
       | ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:28:1: error: unknown type name 
'u32'
    28 | u32 pic32_get_sysclk(void)
       | ^~~
../arch/mips/pic32/pic32mzda/early_clk.c: In function 'pic32_get_sysclk':
../arch/mips/pic32/pic32mzda/early_clk.c:30:9: error: unknown type name 
'u32'
    30 |         u32 osc_freq = 0;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:31:9: error: unknown type name 
'u32'
    31 |         u32 pllclk;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:32:9: error: unknown type name 
'u32'
    32 |         u32 frcdivn;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:33:9: error: unknown type name 
'u32'
    33 |         u32 osccon;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:34:9: error: unknown type name 
'u32'
    34 |         u32 spllcon;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:37:9: error: unknown type name 
'u32'
    37 |         u32 plliclk;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:38:9: error: unknown type name 
'u32'
    38 |         u32 pllidiv;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:39:9: error: unknown type name 
'u32'
    39 |         u32 pllodiv;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:40:9: error: unknown type name 
'u32'
    40 |         u32 pllmult;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:41:9: error: unknown type name 
'u32'
    41 |         u32 frcdiv;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:43:34: error: implicit 
declaration of function 'ioremap' [-Wimplicit-function-declaration]
    43 |         void __iomem *osc_base = ioremap(PIC32_BASE_OSC, 0x200);
       |                                  ^~~~~~~
../arch/mips/pic32/pic32mzda/early_clk.c:43:34: error: initialization of 
'void *' from 'int' makes pointer from integer without a cast 
[-Wint-conversion]
../arch/mips/pic32/pic32mzda/early_clk.c:45:18: error: implicit 
declaration of function '__raw_readl' [-Wimplicit-function-declaration]
    45 |         osccon = __raw_readl(osc_base + OSCCON);
       |                  ^~~~~~~~~~~
../arch/mips/pic32/pic32mzda/early_clk.c:81:9: error: implicit 
declaration of function 'iounmap' [-Wimplicit-function-declaration]
    81 |         iounmap(osc_base);
       |         ^~~~~~~
../arch/mips/pic32/pic32mzda/early_clk.c: At top level:
../arch/mips/pic32/pic32mzda/early_clk.c:86:1: error: unknown type name 
'u32'
    86 | u32 pic32_get_pbclk(int bus)
       | ^~~
../arch/mips/pic32/pic32mzda/early_clk.c: In function 'pic32_get_pbclk':
../arch/mips/pic32/pic32mzda/early_clk.c:88:9: error: unknown type name 
'u32'
    88 |         u32 clk_freq;
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:89:34: error: initialization of 
'void *' from 'int' makes pointer from integer without a cast 
[-Wint-conversion]
    89 |         void __iomem *osc_base = ioremap(PIC32_BASE_OSC, 0x200);
       |                                  ^~~~~~~
../arch/mips/pic32/pic32mzda/early_clk.c:90:9: error: unknown type name 
'u32'
    90 |         u32 pbxdiv = PB1DIV + ((bus - 1) * 0x10);
       |         ^~~
../arch/mips/pic32/pic32mzda/early_clk.c:91:9: error: unknown type name 
'u32'
    91 |         u32 pbdiv = (__raw_readl(osc_base + pbxdiv) & PB_MASK) + 1;
       |         ^~~
make[6]: *** [../scripts/Makefile.build:287: 
arch/mips/pic32/pic32mzda/early_clk.o] Error 1


Thank you,
Claudiu
Re: [PATCH 12/13] MIPS: drop unused pic32.h header
Posted by Brian Masney 3 weeks, 6 days ago
Hi Claudiu,

On Sat, Jan 10, 2026 at 05:28:32PM +0200, Claudiu Beznea wrote:
> On 1/9/26 18:41, Brian Masney wrote:
> > All users of the MIPS pic32.h asm header have been migrated to
> > linux/platform_data/pic32.h, so let's go ahead and drop the unused asm
> > variant.
> > 
> > Signed-off-by: Brian Masney<bmasney@redhat.com>
> > 
> > ---
> > To: Thomas Bogendoerfer<tsbogend@alpha.franken.de>
> > Cc:linux-mips@vger.kernel.org
> > Cc:linux-kernel@vger.kernel.org
> > ---
> >   arch/mips/include/asm/mach-pic32/pic32.h | 36 --------------------------------
> >   1 file changed, 36 deletions(-)
> > 
> > diff --git a/arch/mips/include/asm/mach-pic32/pic32.h b/arch/mips/include/asm/mach-pic32/pic32.h
> > deleted file mode 100644
> > index 53918a671a4c39dba2a22121187cdd73e1935b24..0000000000000000000000000000000000000000
> > --- a/arch/mips/include/asm/mach-pic32/pic32.h
> > +++ /dev/null
> > @@ -1,36 +0,0 @@
> > -/* SPDX-License-Identifier: GPL-2.0-only */
> > -/*
> > - * Joshua Henderson<joshua.henderson@microchip.com>
> > - * Copyright (C) 2015 Microchip Technology Inc.  All rights reserved.
> > - */
> > -#ifndef _ASM_MACH_PIC32_H
> > -#define _ASM_MACH_PIC32_H
> > -
> > -#include <linux/io.h>
> > -
> 
> There are compilation errors when building pic32mzda_defconfig (see below)
> and I presume those are related to the fact that this include was dropped
> from include/linux/platform_data/pic32.h:
> 
> ../arch/mips/pic32/common/reset.c: In function 'pic32_machine_restart':
> ../arch/mips/pic32/common/reset.c:27:17: error: implicit declaration of
> function 'ioremap' [-Wimplicit-function-declaration]
>    27 |                 ioremap(PIC32_BASE_RESET + PIC32_RSWRST,
> sizeof(u32));

[snip]

I only tried compiling this on arm64, and that compiles fine. I setup
a mips cross compiler on a arm64 box and I can reproduce the compiler
errors.

So linux/io.h is not directly used by this header file. I think the
correct thing to do here is to update the files where it's actually
needed. There's 3 files that need linux/io.h, and one file needs
linux/types.h. I'll send a version two of this series with the cleanups.

Thanks,

Brian