* [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds
@ 2024-02-23 19:36 Sam Ravnborg via B4 Relay
2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay
` (5 more replies)
0 siblings, 6 replies; 20+ messages in thread
From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw)
To: Miquel Raynal, Maciej W. Rozycki
Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson,
Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg,
Greg Kroah-Hartman, stable
This is a small set of patches that address build breakage with
allyesconfig / allmodconfig.
This solves some, but not all, build breakage.
The parport fix depends on the previous patch, the rest are independent
fixes.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Sam Ravnborg (6):
sparc32: Use generic cmpdi2/ucmpdi2 variants
sparc32: Fix build with trapbase
mtd: maps: sun_uflash: Declare uflash_devinit static
usb: host: uhci-grlib.c: Fix build, add platform_device
sparc32: Do not select GENERIC_ISA_DMA
sparc32: Fix parport build with sparc32
arch/sparc/Kconfig | 6 +-
arch/sparc/include/asm/parport.h | 259 +-----------------------------------
arch/sparc/include/asm/parport_64.h | 256 +++++++++++++++++++++++++++++++++++
arch/sparc/kernel/irq_32.c | 6 +-
arch/sparc/kernel/kernel.h | 8 +-
arch/sparc/kernel/kgdb_32.c | 4 +-
arch/sparc/kernel/leon_smp.c | 6 +-
arch/sparc/kernel/setup_32.c | 4 +-
arch/sparc/lib/Makefile | 4 +-
arch/sparc/lib/cmpdi2.c | 28 ----
arch/sparc/lib/ucmpdi2.c | 20 ---
drivers/mtd/maps/sun_uflash.c | 2 +-
drivers/usb/host/uhci-grlib.c | 1 +
13 files changed, 283 insertions(+), 321 deletions(-)
---
base-commit: 626db6ee8ee1edac206610db407114aa83b53fd3
change-id: 20240223-sam-fix-sparc32-all-builds-0a0403d6e1b3
Best regards,
--
Sam Ravnborg <sam@ravnborg.org>
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:27 ` Randy Dunlap 2024-02-24 2:54 ` Maciej W. Rozycki 2024-02-23 19:36 ` [PATCH 2/6] sparc32: Fix build with trapbase Sam Ravnborg via B4 Relay ` (4 subsequent siblings) 5 siblings, 2 replies; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg From: Sam Ravnborg <sam@ravnborg.org> Use the generic variants - the implementation is the same. As a nice side-effect fix the following warnings: cmpdi2.c: warning: no previous prototype for '__cmpdi2' [-Wmissing-prototypes] ucmpdi2.c: warning: no previous prototype for '__ucmpdi2' [-Wmissing-prototypes] Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> --- arch/sparc/Kconfig | 2 ++ arch/sparc/lib/Makefile | 4 ++-- arch/sparc/lib/cmpdi2.c | 28 ---------------------------- arch/sparc/lib/ucmpdi2.c | 20 -------------------- 4 files changed, 4 insertions(+), 50 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index b087d4fe00af..734f23daecca 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -57,6 +57,8 @@ config SPARC32 select CLZ_TAB select DMA_DIRECT_REMAP select GENERIC_ATOMIC64 + select GENERIC_LIB_CMPDI2 + select GENERIC_LIB_UCMPDI2 select HAVE_UID16 select LOCK_MM_AND_FIND_VMA select OLD_SIGACTION diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index 59669ebddd4e..ee5091dd67ed 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile @@ -14,7 +14,7 @@ lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o lib-$(CONFIG_SPARC32) += copy_user.o locks.o lib-$(CONFIG_SPARC64) += atomic_64.o lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o -lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o +lib-$(CONFIG_SPARC32) += muldi3.o bitext.o lib-$(CONFIG_SPARC64) += multi3.o lib-$(CONFIG_SPARC64) += fls.o lib-$(CONFIG_SPARC64) += fls64.o @@ -51,5 +51,5 @@ lib-$(CONFIG_SPARC64) += copy_in_user.o memmove.o lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o obj-$(CONFIG_SPARC64) += iomap.o -obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o +obj-$(CONFIG_SPARC32) += atomic32.o obj-$(CONFIG_SPARC64) += PeeCeeI.o diff --git a/arch/sparc/lib/cmpdi2.c b/arch/sparc/lib/cmpdi2.c deleted file mode 100644 index 333367fe7353..000000000000 --- a/arch/sparc/lib/cmpdi2.c +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/module.h> - -#include "libgcc.h" - -word_type __cmpdi2(long long a, long long b) -{ - const DWunion au = { - .ll = a - }; - const DWunion bu = { - .ll = b - }; - - if (au.s.high < bu.s.high) - return 0; - else if (au.s.high > bu.s.high) - return 2; - - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) - return 0; - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) - return 2; - - return 1; -} - -EXPORT_SYMBOL(__cmpdi2); diff --git a/arch/sparc/lib/ucmpdi2.c b/arch/sparc/lib/ucmpdi2.c deleted file mode 100644 index 82c1cccb1264..000000000000 --- a/arch/sparc/lib/ucmpdi2.c +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/module.h> -#include "libgcc.h" - -word_type __ucmpdi2(unsigned long long a, unsigned long long b) -{ - const DWunion au = {.ll = a}; - const DWunion bu = {.ll = b}; - - if ((unsigned int) au.s.high < (unsigned int) bu.s.high) - return 0; - else if ((unsigned int) au.s.high > (unsigned int) bu.s.high) - return 2; - if ((unsigned int) au.s.low < (unsigned int) bu.s.low) - return 0; - else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) - return 2; - return 1; -} -EXPORT_SYMBOL(__ucmpdi2); -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants 2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay @ 2024-02-24 0:27 ` Randy Dunlap 2024-02-24 2:54 ` Maciej W. Rozycki 1 sibling, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:27 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > Use the generic variants - the implementation is the same. > As a nice side-effect fix the following warnings: > > cmpdi2.c: warning: no previous prototype for '__cmpdi2' [-Wmissing-prototypes] > ucmpdi2.c: warning: no previous prototype for '__ucmpdi2' [-Wmissing-prototypes] > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Andreas Larsson <andreas@gaisler.com> Looks good. Thanks. Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested > --- > arch/sparc/Kconfig | 2 ++ > arch/sparc/lib/Makefile | 4 ++-- > arch/sparc/lib/cmpdi2.c | 28 ---------------------------- > arch/sparc/lib/ucmpdi2.c | 20 -------------------- > 4 files changed, 4 insertions(+), 50 deletions(-) > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants 2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay 2024-02-24 0:27 ` Randy Dunlap @ 2024-02-24 2:54 ` Maciej W. Rozycki 1 sibling, 0 replies; 20+ messages in thread From: Maciej W. Rozycki @ 2024-02-24 2:54 UTC (permalink / raw) To: Sam Ravnborg Cc: Miquel Raynal, sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel On Fri, 23 Feb 2024, Sam Ravnborg via B4 Relay wrote: > Use the generic variants - the implementation is the same. > As a nice side-effect fix the following warnings: > > cmpdi2.c: warning: no previous prototype for '__cmpdi2' [-Wmissing-prototypes] > ucmpdi2.c: warning: no previous prototype for '__ucmpdi2' [-Wmissing-prototypes] > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Andreas Larsson <andreas@gaisler.com> > --- LGTM. You may wish to add: Fixes: 0fcb70851fbf ("Makefile.extrawarn: turn on missing-prototypes globally") but otherwise: Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk> Tested-by: Maciej W. Rozycki <macro@orcam.me.uk> # build-tested Maciej ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/6] sparc32: Fix build with trapbase 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay 2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:29 ` Randy Dunlap 2024-02-23 19:36 ` [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static Sam Ravnborg via B4 Relay ` (3 subsequent siblings) 5 siblings, 1 reply; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg From: Sam Ravnborg <sam@ravnborg.org> Fix the following build errors: irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1] irq_32.c:271:14: error: assignment to 'struct tt_entry *' from incompatible pointer type 'struct tt_entry (*)[] trapbase is a pointer to an array of tt_entry, but the code declared it as a pointer so the compiler see a single entry and not an array. Fix this by modifyinf the declaration to be an array, and modify all users to take the address of the first member. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andreas Larsson <andreas@gaisler.com> Cc: "David S. Miller" <davem@davemloft.net> --- arch/sparc/kernel/irq_32.c | 6 +++--- arch/sparc/kernel/kernel.h | 8 ++++---- arch/sparc/kernel/kgdb_32.c | 4 ++-- arch/sparc/kernel/leon_smp.c | 6 +++--- arch/sparc/kernel/setup_32.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index e8452be5123b..8605dd710f3c 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -268,11 +268,11 @@ int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler) if (sparc_cpu_model != sparc_leon) { struct tt_entry *trap_table; - trap_table = &trapbase_cpu1; + trap_table = &trapbase_cpu1[0]; INSTANTIATE(trap_table) - trap_table = &trapbase_cpu2; + trap_table = &trapbase_cpu2[0]; INSTANTIATE(trap_table) - trap_table = &trapbase_cpu3; + trap_table = &trapbase_cpu3[0]; INSTANTIATE(trap_table) } #endif diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 15da3c0597a5..a8fb7c0bf053 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -138,10 +138,10 @@ extern unsigned int t_nmi[]; extern unsigned int linux_trap_ipi15_sun4d[]; extern unsigned int linux_trap_ipi15_sun4m[]; -extern struct tt_entry trapbase; -extern struct tt_entry trapbase_cpu1; -extern struct tt_entry trapbase_cpu2; -extern struct tt_entry trapbase_cpu3; +extern struct tt_entry trapbase[]; +extern struct tt_entry trapbase_cpu1[]; +extern struct tt_entry trapbase_cpu2[]; +extern struct tt_entry trapbase_cpu3[]; extern char cputypval[]; diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c index 58ad3f7de1fb..3b2c673ec627 100644 --- a/arch/sparc/kernel/kgdb_32.c +++ b/arch/sparc/kernel/kgdb_32.c @@ -37,7 +37,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) gdb_regs[GDB_Y] = regs->y; gdb_regs[GDB_PSR] = regs->psr; gdb_regs[GDB_WIM] = 0; - gdb_regs[GDB_TBR] = (unsigned long) &trapbase; + gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0]; gdb_regs[GDB_PC] = regs->pc; gdb_regs[GDB_NPC] = regs->npc; gdb_regs[GDB_FSR] = 0; @@ -72,7 +72,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) gdb_regs[GDB_PSR] = t->kpsr; gdb_regs[GDB_WIM] = t->kwim; - gdb_regs[GDB_TBR] = (unsigned long) &trapbase; + gdb_regs[GDB_TBR] = (unsigned long) &trapbase[0]; gdb_regs[GDB_PC] = t->kpc; gdb_regs[GDB_NPC] = t->kpc + 4; gdb_regs[GDB_FSR] = 0; diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 991e9ad3d3e8..1ee393abc463 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c @@ -245,13 +245,13 @@ void __init leon_smp_done(void) /* Free unneeded trap tables */ if (!cpu_present(1)) { - free_reserved_page(virt_to_page(&trapbase_cpu1)); + free_reserved_page(virt_to_page(&trapbase_cpu1[0])); } if (!cpu_present(2)) { - free_reserved_page(virt_to_page(&trapbase_cpu2)); + free_reserved_page(virt_to_page(&trapbase_cpu2[0])); } if (!cpu_present(3)) { - free_reserved_page(virt_to_page(&trapbase_cpu3)); + free_reserved_page(virt_to_page(&trapbase_cpu3[0])); } /* Ok, they are spinning and ready to go. */ smp_processors_ready = 1; diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index e3b72a7b46d3..704375c061e7 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -67,7 +67,7 @@ static void prom_sync_me(void) __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t" "nop\n\t" "nop\n\t" - "nop\n\t" : : "r" (&trapbase)); + "nop\n\t" : : "r" (&trapbase[0])); prom_printf("PROM SYNC COMMAND...\n"); show_mem(); @@ -285,7 +285,7 @@ void __init setup_arch(char **cmdline_p) int i; unsigned long highest_paddr; - sparc_ttable = &trapbase; + sparc_ttable = &trapbase[0]; /* Initialize PROM console and command line. */ *cmdline_p = prom_getbootargs(); -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/6] sparc32: Fix build with trapbase 2024-02-23 19:36 ` [PATCH 2/6] sparc32: Fix build with trapbase Sam Ravnborg via B4 Relay @ 2024-02-24 0:29 ` Randy Dunlap 0 siblings, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:29 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > Fix the following build errors: > irq_32.c:258:7: error: array subscript [16, 79] is outside array bounds of 'struct tt_entry[1] > irq_32.c:271:14: error: assignment to 'struct tt_entry *' from incompatible pointer type 'struct tt_entry (*)[] > > trapbase is a pointer to an array of tt_entry, but the code declared it > as a pointer so the compiler see a single entry and not an array. > Fix this by modifyinf the declaration to be an array, and modify all > users to take the address of the first member. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Thanks. > --- > arch/sparc/kernel/irq_32.c | 6 +++--- > arch/sparc/kernel/kernel.h | 8 ++++---- > arch/sparc/kernel/kgdb_32.c | 4 ++-- > arch/sparc/kernel/leon_smp.c | 6 +++--- > arch/sparc/kernel/setup_32.c | 4 ++-- > 5 files changed, 14 insertions(+), 14 deletions(-) > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay 2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay 2024-02-23 19:36 ` [PATCH 2/6] sparc32: Fix build with trapbase Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:30 ` Randy Dunlap 2024-02-23 19:36 ` [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device Sam Ravnborg via B4 Relay ` (2 subsequent siblings) 5 siblings, 1 reply; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg From: Sam Ravnborg <sam@ravnborg.org> This fixes the following warning: sun_uflash.c:50:5: error: no previous prototype for 'uflash_devinit' Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andreas Larsson <andreas@gaisler.com> Cc: "David S. Miller" <davem@davemloft.net> --- drivers/mtd/maps/sun_uflash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index f58cfb15d6e8..b69dade3f7ad 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c @@ -47,7 +47,7 @@ struct map_info uflash_map_templ = { .bankwidth = UFLASH_BUSWIDTH, }; -int uflash_devinit(struct platform_device *op, struct device_node *dp) +static int uflash_devinit(struct platform_device *op, struct device_node *dp) { struct uflash_dev *up; -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static 2024-02-23 19:36 ` [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static Sam Ravnborg via B4 Relay @ 2024-02-24 0:30 ` Randy Dunlap 0 siblings, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:30 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > This fixes the following warning: > sun_uflash.c:50:5: error: no previous prototype for 'uflash_devinit' > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: "David S. Miller" <davem@davemloft.net> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Thanks. > --- > drivers/mtd/maps/sun_uflash.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c > index f58cfb15d6e8..b69dade3f7ad 100644 > --- a/drivers/mtd/maps/sun_uflash.c > +++ b/drivers/mtd/maps/sun_uflash.c > @@ -47,7 +47,7 @@ struct map_info uflash_map_templ = { > .bankwidth = UFLASH_BUSWIDTH, > }; > > -int uflash_devinit(struct platform_device *op, struct device_node *dp) > +static int uflash_devinit(struct platform_device *op, struct device_node *dp) > { > struct uflash_dev *up; > > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay ` (2 preceding siblings ...) 2024-02-23 19:36 ` [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:31 ` Randy Dunlap 2024-02-23 19:36 ` [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay 2024-02-23 19:36 ` [PATCH 6/6] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay 5 siblings, 1 reply; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg, Greg Kroah-Hartman From: Sam Ravnborg <sam@ravnborg.org> Fix the followig build error: uhci-grlib.c:92:29: error: invalid use of undefined type 'struct platform_device' The fix was straightforward, and no attempt was made to understand why the build failed. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/host/uhci-grlib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c index ac3fc5970315..cfebb833668e 100644 --- a/drivers/usb/host/uhci-grlib.c +++ b/drivers/usb/host/uhci-grlib.c @@ -22,6 +22,7 @@ #include <linux/of_irq.h> #include <linux/of_address.h> #include <linux/of_platform.h> +#include <linux/platform_device.h> static int uhci_grlib_init(struct usb_hcd *hcd) { -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device 2024-02-23 19:36 ` [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device Sam Ravnborg via B4 Relay @ 2024-02-24 0:31 ` Randy Dunlap 0 siblings, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:31 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel, Greg Kroah-Hartman On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > Fix the followig build error: > uhci-grlib.c:92:29: error: invalid use of undefined type 'struct platform_device' > > The fix was straightforward, and no attempt was made to understand why > the build failed. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> This looks good but the same patch is already in linux-next, courtesy of Andreas. > --- > drivers/usb/host/uhci-grlib.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c > index ac3fc5970315..cfebb833668e 100644 > --- a/drivers/usb/host/uhci-grlib.c > +++ b/drivers/usb/host/uhci-grlib.c > @@ -22,6 +22,7 @@ > #include <linux/of_irq.h> > #include <linux/of_address.h> > #include <linux/of_platform.h> > +#include <linux/platform_device.h> > > static int uhci_grlib_init(struct usb_hcd *hcd) > { > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay ` (3 preceding siblings ...) 2024-02-23 19:36 ` [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:32 ` Randy Dunlap 2024-02-24 2:55 ` Maciej W. Rozycki 2024-02-23 19:36 ` [PATCH 6/6] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay 5 siblings, 2 replies; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg From: Sam Ravnborg <sam@ravnborg.org> sparc32 do not support generic isa dma, so do not select the symbol. Without this fix, the following patch would break the build with a missing prototype. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Andreas Larsson <andreas@gaisler.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Maciej W. Rozycki <macro@orcam.me.uk> Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") --- arch/sparc/Kconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 734f23daecca..d08a5662ea60 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -138,10 +138,6 @@ config HIGHMEM default y if SPARC32 select KMAP_LOCAL -config GENERIC_ISA_DMA - bool - default y if SPARC32 - config PGTABLE_LEVELS default 4 if 64BIT default 3 -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-23 19:36 ` [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay @ 2024-02-24 0:32 ` Randy Dunlap 2024-02-24 2:55 ` Maciej W. Rozycki 1 sibling, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:32 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > sparc32 do not support generic isa dma, so do not select the symbol. > Without this fix, the following patch would break the build with a > missing prototype. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Randy Dunlap <rdunlap@infradead.org> > Cc: Maciej W. Rozycki <macro@orcam.me.uk> > Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested > --- > arch/sparc/Kconfig | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig > index 734f23daecca..d08a5662ea60 100644 > --- a/arch/sparc/Kconfig > +++ b/arch/sparc/Kconfig > @@ -138,10 +138,6 @@ config HIGHMEM > default y if SPARC32 > select KMAP_LOCAL > > -config GENERIC_ISA_DMA > - bool > - default y if SPARC32 > - > config PGTABLE_LEVELS > default 4 if 64BIT > default 3 > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-23 19:36 ` [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay 2024-02-24 0:32 ` Randy Dunlap @ 2024-02-24 2:55 ` Maciej W. Rozycki 2024-02-24 5:29 ` Maciej W. Rozycki 1 sibling, 1 reply; 20+ messages in thread From: Maciej W. Rozycki @ 2024-02-24 2:55 UTC (permalink / raw) To: Sam Ravnborg Cc: Miquel Raynal, sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel On Fri, 23 Feb 2024, Sam Ravnborg via B4 Relay wrote: > sparc32 do not support generic isa dma, so do not select the symbol. > Without this fix, the following patch would break the build with a > missing prototype. Not according to my observations, kernel/dma.c is always built for GENERIC_ISA_DMA configurations, so: kernel/dma.c:70:5: error: no previous prototype for 'request_dma' [-Werror=missing-prototypes] 70 | int request_dma(unsigned int dmanr, const char * device_id) | ^~~~~~~~~~~ kernel/dma.c:88:6: error: no previous prototype for 'free_dma' [-Werror=missing-prototypes] 88 | void free_dma(unsigned int dmanr) | ^~~~~~~~ are issued regardless (and FAOD with PARPORT_PC unset). I can't speak for SPARC support for ISA DMA, but it seems to me like the second sentence would best be removed, as would the Fixes: tag (in favour to: Fixes: 0fcb70851fbf ("Makefile.extrawarn: turn on missing-prototypes globally") I presume), and possibly the messages quoted above included instead. Maciej ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-24 2:55 ` Maciej W. Rozycki @ 2024-02-24 5:29 ` Maciej W. Rozycki 2024-02-24 7:59 ` Sam Ravnborg 2024-02-24 11:24 ` Arnd Bergmann 0 siblings, 2 replies; 20+ messages in thread From: Maciej W. Rozycki @ 2024-02-24 5:29 UTC (permalink / raw) To: Sam Ravnborg Cc: Miquel Raynal, sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel On Sat, 24 Feb 2024, Maciej W. Rozycki wrote: > > sparc32 do not support generic isa dma, so do not select the symbol. > > Without this fix, the following patch would break the build with a > > missing prototype. > > Not according to my observations, kernel/dma.c is always built for > GENERIC_ISA_DMA configurations, so: > > kernel/dma.c:70:5: error: no previous prototype for 'request_dma' [-Werror=missing-prototypes] > 70 | int request_dma(unsigned int dmanr, const char * device_id) > | ^~~~~~~~~~~ > kernel/dma.c:88:6: error: no previous prototype for 'free_dma' [-Werror=missing-prototypes] > 88 | void free_dma(unsigned int dmanr) > | ^~~~~~~~ > > are issued regardless (and FAOD with PARPORT_PC unset). > > I can't speak for SPARC support for ISA DMA, but it seems to me like the > second sentence would best be removed, as would the Fixes: tag (in favour > to: > > Fixes: 0fcb70851fbf ("Makefile.extrawarn: turn on missing-prototypes globally") > > I presume), and possibly the messages quoted above included instead. Actually I think ZONE_DMA should go too (it's linked to GENERIC_ISA_DMA, isn't it? -- cf. commit 5ac6da669e24 ("[PATCH] Set CONFIG_ZONE_DMA for arches with GENERIC_ISA_DMA")), and the whole thing use: Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") The GENERIC_ISA_DMA option itself was added to arch/sparc/config.in with 2.5.31 as: define_bool CONFIG_GENERIC_ISA_DMA y despite of: define_bool CONFIG_ISA n for a reason not clear to me (BLK_DEV_FD? -- but on SPARC that uses some hacks to work in the absence of ISA DMA anyway). Am I missing anything here? Maciej ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-24 5:29 ` Maciej W. Rozycki @ 2024-02-24 7:59 ` Sam Ravnborg 2024-02-24 11:24 ` Arnd Bergmann 1 sibling, 0 replies; 20+ messages in thread From: Sam Ravnborg @ 2024-02-24 7:59 UTC (permalink / raw) To: Maciej W. Rozycki Cc: Miquel Raynal, sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel Hi Marciej, On Sat, Feb 24, 2024 at 05:29:43AM +0000, Maciej W. Rozycki wrote: > On Sat, 24 Feb 2024, Maciej W. Rozycki wrote: > > > > sparc32 do not support generic isa dma, so do not select the symbol. > > > Without this fix, the following patch would break the build with a > > > missing prototype. > > > > Not according to my observations, kernel/dma.c is always built for > > GENERIC_ISA_DMA configurations, so: > > > > kernel/dma.c:70:5: error: no previous prototype for 'request_dma' [-Werror=missing-prototypes] > > 70 | int request_dma(unsigned int dmanr, const char * device_id) > > | ^~~~~~~~~~~ > > kernel/dma.c:88:6: error: no previous prototype for 'free_dma' [-Werror=missing-prototypes] > > 88 | void free_dma(unsigned int dmanr) > > | ^~~~~~~~ > > > > are issued regardless (and FAOD with PARPORT_PC unset). > > > > I can't speak for SPARC support for ISA DMA, but it seems to me like the > > second sentence would best be removed, as would the Fixes: tag (in favour > > to: > > > > Fixes: 0fcb70851fbf ("Makefile.extrawarn: turn on missing-prototypes globally") > > > > I presume), and possibly the messages quoted above included instead. Thanks, I will update in v2. > > Actually I think ZONE_DMA should go too (it's linked to GENERIC_ISA_DMA, > isn't it? -- cf. commit 5ac6da669e24 ("[PATCH] Set CONFIG_ZONE_DMA for > arches with GENERIC_ISA_DMA")), and the whole thing use: > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > > The GENERIC_ISA_DMA option itself was added to arch/sparc/config.in with > 2.5.31 as: > > define_bool CONFIG_GENERIC_ISA_DMA y > > despite of: > > define_bool CONFIG_ISA n > > for a reason not clear to me (BLK_DEV_FD? -- but on SPARC that uses some > hacks to work in the absence of ISA DMA anyway). > > Am I missing anything here? Nice find - the code below conforms you are right: max_zone_pfn[ZONE_DMA] = max_low_pfn; max_zone_pfn[ZONE_NORMAL] = max_low_pfn; As they are set to the same value there is no smaller ZONE_DMA area. I will add an extra patch for this in v2. Sam ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-24 5:29 ` Maciej W. Rozycki 2024-02-24 7:59 ` Sam Ravnborg @ 2024-02-24 11:24 ` Arnd Bergmann 2024-02-24 17:14 ` Sam Ravnborg 1 sibling, 1 reply; 20+ messages in thread From: Arnd Bergmann @ 2024-02-24 11:24 UTC (permalink / raw) To: Maciej W. Rozycki, Sam Ravnborg Cc: Miquel Raynal, sparclinux, linux-parport, David S . Miller, Andreas Larsson, Randy Dunlap, linux-kernel On Sat, Feb 24, 2024, at 06:29, Maciej W. Rozycki wrote: > On Sat, 24 Feb 2024, Maciej W. Rozycki wrote: > > The GENERIC_ISA_DMA option itself was added to arch/sparc/config.in with > 2.5.31 as: > > define_bool CONFIG_GENERIC_ISA_DMA y > > despite of: > > define_bool CONFIG_ISA n I think I've seen any combination of CONFIG_ISA (the 62/98 pin slots), CONFIG_GENERIC_ISA_DMA (the request_dma() interface) and CONFIG_ISA_DMA_API (the set_dma_addr()/enable_dma() type interface), but I agree that sparc should have none of the three as both floppy and parport use some other interface. > for a reason not clear to me (BLK_DEV_FD? -- but on SPARC that uses some > hacks to work in the absence of ISA DMA anyway). > > Am I missing anything here? I think it was part of the ISA DMA lookalike that got removed in 334ae614772b ("sparc: Kill SBUS DVMA layer.") and should have been changed back then. Arnd ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA 2024-02-24 11:24 ` Arnd Bergmann @ 2024-02-24 17:14 ` Sam Ravnborg 0 siblings, 0 replies; 20+ messages in thread From: Sam Ravnborg @ 2024-02-24 17:14 UTC (permalink / raw) To: Arnd Bergmann Cc: Maciej W. Rozycki, Miquel Raynal, sparclinux, linux-parport, David S . Miller, Andreas Larsson, Randy Dunlap, linux-kernel Hi Arnd, On Sat, Feb 24, 2024 at 12:24:01PM +0100, Arnd Bergmann wrote: > On Sat, Feb 24, 2024, at 06:29, Maciej W. Rozycki wrote: > > On Sat, 24 Feb 2024, Maciej W. Rozycki wrote: > > > > The GENERIC_ISA_DMA option itself was added to arch/sparc/config.in with > > 2.5.31 as: > > > > define_bool CONFIG_GENERIC_ISA_DMA y > > > > despite of: > > > > define_bool CONFIG_ISA n > > I think I've seen any combination of CONFIG_ISA (the 62/98 pin slots), CONFIG_GENERIC_ISA_DMA (the request_dma() interface) and > CONFIG_ISA_DMA_API (the set_dma_addr()/enable_dma() type interface), > but I agree that sparc should have none of the three as both > floppy and parport use some other interface. > > > for a reason not clear to me (BLK_DEV_FD? -- but on SPARC that uses some > > hacks to work in the absence of ISA DMA anyway). > > > > Am I missing anything here? > > I think it was part of the ISA DMA lookalike that got removed > in 334ae614772b ("sparc: Kill SBUS DVMA layer.") and should > have been changed back then. Hmm, that may well be the case. I checked and sparc32 do not set any ISA symbols anymore so we should be OK now. I decided to just drop the Fixes: tag to not confuse anyone. Sam ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 6/6] sparc32: Fix parport build with sparc32 2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay ` (4 preceding siblings ...) 2024-02-23 19:36 ` [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 ` Sam Ravnborg via B4 Relay 2024-02-24 0:34 ` Randy Dunlap 2024-02-24 3:02 ` Maciej W. Rozycki 5 siblings, 2 replies; 20+ messages in thread From: Sam Ravnborg via B4 Relay @ 2024-02-23 19:36 UTC (permalink / raw) To: Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, Sam Ravnborg, stable From: Sam Ravnborg <sam@ravnborg.org> include/asm/parport.h is sparc64 specific. Rename it to parport_64.h and use the generic version for sparc32. This fixed all{mod,yes}config build errors like: parport_pc.c:(.text):undefined-reference-to-ebus_dma_enable parport_pc.c:(.text):undefined-reference-to-ebus_dma_irq_enable parport_pc.c:(.text):undefined-reference-to-ebus_dma_register The errors occur as the sparc32 build references sparc64 symbols. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Maciej W. Rozycki <macro@orcam.me.uk> Closes: https://lore.kernel.org/r/20230406160548.25721-1-rdunlap@infradead.org/ Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") Cc: stable@vger.kernel.org # v5.18+ --- arch/sparc/include/asm/parport.h | 259 +----------------------------------- arch/sparc/include/asm/parport_64.h | 256 +++++++++++++++++++++++++++++++++++ 2 files changed, 263 insertions(+), 252 deletions(-) diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h index 0a7ffcfd59cd..e2eed8f97665 100644 --- a/arch/sparc/include/asm/parport.h +++ b/arch/sparc/include/asm/parport.h @@ -1,256 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* parport.h: sparc64 specific parport initialization and dma. - * - * Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be) - */ +#ifndef ___ASM_SPARC_PARPORT_H +#define ___ASM_SPARC_PARPORT_H -#ifndef _ASM_SPARC64_PARPORT_H -#define _ASM_SPARC64_PARPORT_H 1 - -#include <linux/of.h> -#include <linux/platform_device.h> - -#include <asm/ebus_dma.h> -#include <asm/ns87303.h> -#include <asm/prom.h> - -#define PARPORT_PC_MAX_PORTS PARPORT_MAX - -/* - * While sparc64 doesn't have an ISA DMA API, we provide something that looks - * close enough to make parport_pc happy - */ -#define HAS_DMA - -#ifdef CONFIG_PARPORT_PC_FIFO -static DEFINE_SPINLOCK(dma_spin_lock); - -#define claim_dma_lock() \ -({ unsigned long flags; \ - spin_lock_irqsave(&dma_spin_lock, flags); \ - flags; \ -}) - -#define release_dma_lock(__flags) \ - spin_unlock_irqrestore(&dma_spin_lock, __flags); +#if defined(__sparc__) && defined(__arch64__) +#include <asm/parport_64.h> +#else +#include <asm-generic/parport.h> +#endif #endif -static struct sparc_ebus_info { - struct ebus_dma_info info; - unsigned int addr; - unsigned int count; - int lock; - - struct parport *port; -} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; - -static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); - -static inline int request_dma(unsigned int dmanr, const char *device_id) -{ - if (dmanr >= PARPORT_PC_MAX_PORTS) - return -EINVAL; - if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0) - return -EBUSY; - return 0; -} - -static inline void free_dma(unsigned int dmanr) -{ - if (dmanr >= PARPORT_PC_MAX_PORTS) { - printk(KERN_WARNING "Trying to free DMA%d\n", dmanr); - return; - } - if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) { - printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr); - return; - } -} - -static inline void enable_dma(unsigned int dmanr) -{ - ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); - - if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info, - sparc_ebus_dmas[dmanr].addr, - sparc_ebus_dmas[dmanr].count)) - BUG(); -} - -static inline void disable_dma(unsigned int dmanr) -{ - ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0); -} - -static inline void clear_dma_ff(unsigned int dmanr) -{ - /* nothing */ -} - -static inline void set_dma_mode(unsigned int dmanr, char mode) -{ - ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE)); -} - -static inline void set_dma_addr(unsigned int dmanr, unsigned int addr) -{ - sparc_ebus_dmas[dmanr].addr = addr; -} - -static inline void set_dma_count(unsigned int dmanr, unsigned int count) -{ - sparc_ebus_dmas[dmanr].count = count; -} - -static inline unsigned int get_dma_residue(unsigned int dmanr) -{ - return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); -} - -static int ecpp_probe(struct platform_device *op) -{ - unsigned long base = op->resource[0].start; - unsigned long config = op->resource[1].start; - unsigned long d_base = op->resource[2].start; - unsigned long d_len; - struct device_node *parent; - struct parport *p; - int slot, err; - - parent = op->dev.of_node->parent; - if (of_node_name_eq(parent, "dma")) { - p = parport_pc_probe_port(base, base + 0x400, - op->archdata.irqs[0], PARPORT_DMA_NOFIFO, - op->dev.parent->parent, 0); - if (!p) - return -ENOMEM; - dev_set_drvdata(&op->dev, p); - return 0; - } - - for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) { - if (!test_and_set_bit(slot, dma_slot_map)) - break; - } - err = -ENODEV; - if (slot >= PARPORT_PC_MAX_PORTS) - goto out_err; - - spin_lock_init(&sparc_ebus_dmas[slot].info.lock); - - d_len = (op->resource[2].end - d_base) + 1UL; - sparc_ebus_dmas[slot].info.regs = - of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA"); - - if (!sparc_ebus_dmas[slot].info.regs) - goto out_clear_map; - - sparc_ebus_dmas[slot].info.flags = 0; - sparc_ebus_dmas[slot].info.callback = NULL; - sparc_ebus_dmas[slot].info.client_cookie = NULL; - sparc_ebus_dmas[slot].info.irq = 0xdeadbeef; - strcpy(sparc_ebus_dmas[slot].info.name, "parport"); - if (ebus_dma_register(&sparc_ebus_dmas[slot].info)) - goto out_unmap_regs; - - ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1); - - /* Configure IRQ to Push Pull, Level Low */ - /* Enable ECP, set bit 2 of the CTR first */ - outb(0x04, base + 0x02); - ns87303_modify(config, PCR, - PCR_EPP_ENABLE | - PCR_IRQ_ODRAIN, - PCR_ECP_ENABLE | - PCR_ECP_CLK_ENA | - PCR_IRQ_POLAR); - - /* CTR bit 5 controls direction of port */ - ns87303_modify(config, PTR, - 0, PTR_LPT_REG_DIR); - - p = parport_pc_probe_port(base, base + 0x400, - op->archdata.irqs[0], - slot, - op->dev.parent, - 0); - err = -ENOMEM; - if (!p) - goto out_disable_irq; - - dev_set_drvdata(&op->dev, p); - - return 0; - -out_disable_irq: - ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); - ebus_dma_unregister(&sparc_ebus_dmas[slot].info); - -out_unmap_regs: - of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len); - -out_clear_map: - clear_bit(slot, dma_slot_map); - -out_err: - return err; -} - -static int ecpp_remove(struct platform_device *op) -{ - struct parport *p = dev_get_drvdata(&op->dev); - int slot = p->dma; - - parport_pc_unregister_port(p); - - if (slot != PARPORT_DMA_NOFIFO) { - unsigned long d_base = op->resource[2].start; - unsigned long d_len; - - d_len = (op->resource[2].end - d_base) + 1UL; - - ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); - ebus_dma_unregister(&sparc_ebus_dmas[slot].info); - of_iounmap(&op->resource[2], - sparc_ebus_dmas[slot].info.regs, - d_len); - clear_bit(slot, dma_slot_map); - } - - return 0; -} - -static const struct of_device_id ecpp_match[] = { - { - .name = "ecpp", - }, - { - .name = "parallel", - .compatible = "ecpp", - }, - { - .name = "parallel", - .compatible = "ns87317-ecpp", - }, - { - .name = "parallel", - .compatible = "pnpALI,1533,3", - }, - {}, -}; - -static struct platform_driver ecpp_driver = { - .driver = { - .name = "ecpp", - .of_match_table = ecpp_match, - }, - .probe = ecpp_probe, - .remove = ecpp_remove, -}; - -static int parport_pc_find_nonpci_ports(int autoirq, int autodma) -{ - return platform_driver_register(&ecpp_driver); -} - -#endif /* !(_ASM_SPARC64_PARPORT_H */ diff --git a/arch/sparc/include/asm/parport_64.h b/arch/sparc/include/asm/parport_64.h new file mode 100644 index 000000000000..0a7ffcfd59cd --- /dev/null +++ b/arch/sparc/include/asm/parport_64.h @@ -0,0 +1,256 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* parport.h: sparc64 specific parport initialization and dma. + * + * Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be) + */ + +#ifndef _ASM_SPARC64_PARPORT_H +#define _ASM_SPARC64_PARPORT_H 1 + +#include <linux/of.h> +#include <linux/platform_device.h> + +#include <asm/ebus_dma.h> +#include <asm/ns87303.h> +#include <asm/prom.h> + +#define PARPORT_PC_MAX_PORTS PARPORT_MAX + +/* + * While sparc64 doesn't have an ISA DMA API, we provide something that looks + * close enough to make parport_pc happy + */ +#define HAS_DMA + +#ifdef CONFIG_PARPORT_PC_FIFO +static DEFINE_SPINLOCK(dma_spin_lock); + +#define claim_dma_lock() \ +({ unsigned long flags; \ + spin_lock_irqsave(&dma_spin_lock, flags); \ + flags; \ +}) + +#define release_dma_lock(__flags) \ + spin_unlock_irqrestore(&dma_spin_lock, __flags); +#endif + +static struct sparc_ebus_info { + struct ebus_dma_info info; + unsigned int addr; + unsigned int count; + int lock; + + struct parport *port; +} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; + +static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); + +static inline int request_dma(unsigned int dmanr, const char *device_id) +{ + if (dmanr >= PARPORT_PC_MAX_PORTS) + return -EINVAL; + if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0) + return -EBUSY; + return 0; +} + +static inline void free_dma(unsigned int dmanr) +{ + if (dmanr >= PARPORT_PC_MAX_PORTS) { + printk(KERN_WARNING "Trying to free DMA%d\n", dmanr); + return; + } + if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) { + printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr); + return; + } +} + +static inline void enable_dma(unsigned int dmanr) +{ + ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); + + if (ebus_dma_request(&sparc_ebus_dmas[dmanr].info, + sparc_ebus_dmas[dmanr].addr, + sparc_ebus_dmas[dmanr].count)) + BUG(); +} + +static inline void disable_dma(unsigned int dmanr) +{ + ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 0); +} + +static inline void clear_dma_ff(unsigned int dmanr) +{ + /* nothing */ +} + +static inline void set_dma_mode(unsigned int dmanr, char mode) +{ + ebus_dma_prepare(&sparc_ebus_dmas[dmanr].info, (mode != DMA_MODE_WRITE)); +} + +static inline void set_dma_addr(unsigned int dmanr, unsigned int addr) +{ + sparc_ebus_dmas[dmanr].addr = addr; +} + +static inline void set_dma_count(unsigned int dmanr, unsigned int count) +{ + sparc_ebus_dmas[dmanr].count = count; +} + +static inline unsigned int get_dma_residue(unsigned int dmanr) +{ + return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); +} + +static int ecpp_probe(struct platform_device *op) +{ + unsigned long base = op->resource[0].start; + unsigned long config = op->resource[1].start; + unsigned long d_base = op->resource[2].start; + unsigned long d_len; + struct device_node *parent; + struct parport *p; + int slot, err; + + parent = op->dev.of_node->parent; + if (of_node_name_eq(parent, "dma")) { + p = parport_pc_probe_port(base, base + 0x400, + op->archdata.irqs[0], PARPORT_DMA_NOFIFO, + op->dev.parent->parent, 0); + if (!p) + return -ENOMEM; + dev_set_drvdata(&op->dev, p); + return 0; + } + + for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) { + if (!test_and_set_bit(slot, dma_slot_map)) + break; + } + err = -ENODEV; + if (slot >= PARPORT_PC_MAX_PORTS) + goto out_err; + + spin_lock_init(&sparc_ebus_dmas[slot].info.lock); + + d_len = (op->resource[2].end - d_base) + 1UL; + sparc_ebus_dmas[slot].info.regs = + of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA"); + + if (!sparc_ebus_dmas[slot].info.regs) + goto out_clear_map; + + sparc_ebus_dmas[slot].info.flags = 0; + sparc_ebus_dmas[slot].info.callback = NULL; + sparc_ebus_dmas[slot].info.client_cookie = NULL; + sparc_ebus_dmas[slot].info.irq = 0xdeadbeef; + strcpy(sparc_ebus_dmas[slot].info.name, "parport"); + if (ebus_dma_register(&sparc_ebus_dmas[slot].info)) + goto out_unmap_regs; + + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1); + + /* Configure IRQ to Push Pull, Level Low */ + /* Enable ECP, set bit 2 of the CTR first */ + outb(0x04, base + 0x02); + ns87303_modify(config, PCR, + PCR_EPP_ENABLE | + PCR_IRQ_ODRAIN, + PCR_ECP_ENABLE | + PCR_ECP_CLK_ENA | + PCR_IRQ_POLAR); + + /* CTR bit 5 controls direction of port */ + ns87303_modify(config, PTR, + 0, PTR_LPT_REG_DIR); + + p = parport_pc_probe_port(base, base + 0x400, + op->archdata.irqs[0], + slot, + op->dev.parent, + 0); + err = -ENOMEM; + if (!p) + goto out_disable_irq; + + dev_set_drvdata(&op->dev, p); + + return 0; + +out_disable_irq: + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); + +out_unmap_regs: + of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len); + +out_clear_map: + clear_bit(slot, dma_slot_map); + +out_err: + return err; +} + +static int ecpp_remove(struct platform_device *op) +{ + struct parport *p = dev_get_drvdata(&op->dev); + int slot = p->dma; + + parport_pc_unregister_port(p); + + if (slot != PARPORT_DMA_NOFIFO) { + unsigned long d_base = op->resource[2].start; + unsigned long d_len; + + d_len = (op->resource[2].end - d_base) + 1UL; + + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); + of_iounmap(&op->resource[2], + sparc_ebus_dmas[slot].info.regs, + d_len); + clear_bit(slot, dma_slot_map); + } + + return 0; +} + +static const struct of_device_id ecpp_match[] = { + { + .name = "ecpp", + }, + { + .name = "parallel", + .compatible = "ecpp", + }, + { + .name = "parallel", + .compatible = "ns87317-ecpp", + }, + { + .name = "parallel", + .compatible = "pnpALI,1533,3", + }, + {}, +}; + +static struct platform_driver ecpp_driver = { + .driver = { + .name = "ecpp", + .of_match_table = ecpp_match, + }, + .probe = ecpp_probe, + .remove = ecpp_remove, +}; + +static int parport_pc_find_nonpci_ports(int autoirq, int autodma) +{ + return platform_driver_register(&ecpp_driver); +} + +#endif /* !(_ASM_SPARC64_PARPORT_H */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 6/6] sparc32: Fix parport build with sparc32 2024-02-23 19:36 ` [PATCH 6/6] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay @ 2024-02-24 0:34 ` Randy Dunlap 2024-02-24 3:02 ` Maciej W. Rozycki 1 sibling, 0 replies; 20+ messages in thread From: Randy Dunlap @ 2024-02-24 0:34 UTC (permalink / raw) To: sam, Miquel Raynal, Maciej W. Rozycki Cc: sparclinux, linux-parport, David S. Miller, Andreas Larsson, Arnd Bergmann, linux-kernel, stable On 2/23/24 11:36, Sam Ravnborg via B4 Relay wrote: > From: Sam Ravnborg <sam@ravnborg.org> > > include/asm/parport.h is sparc64 specific. > Rename it to parport_64.h and use the generic version for sparc32. > > This fixed all{mod,yes}config build errors like: > > parport_pc.c:(.text):undefined-reference-to-ebus_dma_enable > parport_pc.c:(.text):undefined-reference-to-ebus_dma_irq_enable > parport_pc.c:(.text):undefined-reference-to-ebus_dma_register > > The errors occur as the sparc32 build references sparc64 symbols. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: Randy Dunlap <rdunlap@infradead.org> > Cc: Maciej W. Rozycki <macro@orcam.me.uk> > Closes: https://lore.kernel.org/r/20230406160548.25721-1-rdunlap@infradead.org/ > Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") > Cc: stable@vger.kernel.org # v5.18+ Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Thanks. > --- > arch/sparc/include/asm/parport.h | 259 +----------------------------------- > arch/sparc/include/asm/parport_64.h | 256 +++++++++++++++++++++++++++++++++++ > 2 files changed, 263 insertions(+), 252 deletions(-) > -- #Randy ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 6/6] sparc32: Fix parport build with sparc32 2024-02-23 19:36 ` [PATCH 6/6] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay 2024-02-24 0:34 ` Randy Dunlap @ 2024-02-24 3:02 ` Maciej W. Rozycki 1 sibling, 0 replies; 20+ messages in thread From: Maciej W. Rozycki @ 2024-02-24 3:02 UTC (permalink / raw) To: Sam Ravnborg Cc: Miquel Raynal, sparclinux, linux-parport, David S. Miller, Andreas Larsson, Randy Dunlap, Arnd Bergmann, linux-kernel, stable On Fri, 23 Feb 2024, Sam Ravnborg via B4 Relay wrote: > include/asm/parport.h is sparc64 specific. > Rename it to parport_64.h and use the generic version for sparc32. > > This fixed all{mod,yes}config build errors like: > > parport_pc.c:(.text):undefined-reference-to-ebus_dma_enable > parport_pc.c:(.text):undefined-reference-to-ebus_dma_irq_enable > parport_pc.c:(.text):undefined-reference-to-ebus_dma_register > > The errors occur as the sparc32 build references sparc64 symbols. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Andreas Larsson <andreas@gaisler.com> > Cc: Randy Dunlap <rdunlap@infradead.org> > Cc: Maciej W. Rozycki <macro@orcam.me.uk> > Closes: https://lore.kernel.org/r/20230406160548.25721-1-rdunlap@infradead.org/ > Fixes: 66bcd06099bb ("parport_pc: Also enable driver for PCI systems") > Cc: stable@vger.kernel.org # v5.18+ > --- LGTM, it relies on SPARC never to enable ISA. Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk> Tested-by: Maciej W. Rozycki <macro@orcam.me.uk> # build-tested The other changes in this patch series address issues that do not appear with my ad-hoc SPARC test configuration, so I have no immediate way to verify them. Maciej ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2024-02-24 17:15 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 19:36 [PATCH 0/6] sparc32: build fixes for all{yes,mod}config builds Sam Ravnborg via B4 Relay
2024-02-23 19:36 ` [PATCH 1/6] sparc32: Use generic cmpdi2/ucmpdi2 variants Sam Ravnborg via B4 Relay
2024-02-24 0:27 ` Randy Dunlap
2024-02-24 2:54 ` Maciej W. Rozycki
2024-02-23 19:36 ` [PATCH 2/6] sparc32: Fix build with trapbase Sam Ravnborg via B4 Relay
2024-02-24 0:29 ` Randy Dunlap
2024-02-23 19:36 ` [PATCH 3/6] mtd: maps: sun_uflash: Declare uflash_devinit static Sam Ravnborg via B4 Relay
2024-02-24 0:30 ` Randy Dunlap
2024-02-23 19:36 ` [PATCH 4/6] usb: host: uhci-grlib.c: Fix build, add platform_device Sam Ravnborg via B4 Relay
2024-02-24 0:31 ` Randy Dunlap
2024-02-23 19:36 ` [PATCH 5/6] sparc32: Do not select GENERIC_ISA_DMA Sam Ravnborg via B4 Relay
2024-02-24 0:32 ` Randy Dunlap
2024-02-24 2:55 ` Maciej W. Rozycki
2024-02-24 5:29 ` Maciej W. Rozycki
2024-02-24 7:59 ` Sam Ravnborg
2024-02-24 11:24 ` Arnd Bergmann
2024-02-24 17:14 ` Sam Ravnborg
2024-02-23 19:36 ` [PATCH 6/6] sparc32: Fix parport build with sparc32 Sam Ravnborg via B4 Relay
2024-02-24 0:34 ` Randy Dunlap
2024-02-24 3:02 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox