From patchwork Tue Dec 19 22:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756355 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 030CF3D0AB; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TMt0yOSA" Received: by smtp.kernel.org (Postfix) with ESMTPS id 96835C433CA; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023395; bh=lDrIpv+Vvy4Ng5UqEvwvmrUkOjepCnMUtodLTS55HZA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TMt0yOSA2ChLdtbzRtR3zH4/2WypieBzeoWx7IHwppusG3yhkaK+Dw8f7uKfEYqmK gnN74o79GFRchP/W5OC4Z3chhiFe1Pedqjx8blexGhok3iur64PvZqrNN+M80h5eoM u0deXzqToMrcOaV5ihiM/RcbE/l6a8Kb+mS9S4jtucjkBmnyU8sFXp2ZZcQXzP8S9l tYg6nT3jtAN7hzO2lYaK836nsBNU/kQyvLBb7s04zG2wIUvhiDVRGpA4Te+4legrRH f+QnQh+sOYTeWi8GNyMmyXdPCqksKTr+AB1cEj43uNx+6PBw31anH1YMcsYR/CzTvW Z27yaD/CmgWRA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EF60C46CD8; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:08 +0100 Subject: [PATCH 03/27] sparc32: Drop floppy support Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-3-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=19846; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=m2/MK/BLIa9J3uhewvzMgBnAlbjpMCNEJ46bs8VF1tI=; =?utf-8?q?b=3DQQHSeD7dzx5z?= =?utf-8?q?Nx2DaDp4DRmMy1ul1LaTvsCpPx2/Sb6NSMaJxtz2iFFdVbr93lQ1q+rr7qQPXWlB?= DZS+bQsTCrzV43KdmnNFm5TRtEJriBvaGBAwpf1IaFFvczniCXMQ X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg LEON do not have floppy support so we can drop it Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/Kconfig | 2 +- arch/sparc/include/asm/floppy.h | 2 - arch/sparc/include/asm/floppy_32.h | 393 ------------------------------------- arch/sparc/kernel/entry.S | 137 ------------- arch/sparc/kernel/irq.h | 3 - arch/sparc/kernel/irq_32.c | 93 --------- arch/sparc/kernel/kernel.h | 2 - 7 files changed, 1 insertion(+), 631 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..54c91431724b 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -195,7 +195,7 @@ config GENERIC_CALIBRATE_DELAY config ARCH_MAY_HAVE_PC_FDC bool - default y + default y if SPARC64 config EMULATED_CMPXCHG bool diff --git a/arch/sparc/include/asm/floppy.h b/arch/sparc/include/asm/floppy.h index 4b315802e635..c89f719a18e9 100644 --- a/arch/sparc/include/asm/floppy.h +++ b/arch/sparc/include/asm/floppy.h @@ -3,7 +3,5 @@ #define ___ASM_SPARC_FLOPPY_H #if defined(__sparc__) && defined(__arch64__) #include -#else -#include #endif #endif diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h deleted file mode 100644 index 836f6575aa1d..000000000000 --- a/arch/sparc/include/asm/floppy_32.h +++ /dev/null @@ -1,393 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* asm/floppy.h: Sparc specific parts of the Floppy driver. - * - * Copyright (C) 1995 David S. Miller (davem@davemloft.net) - */ - -#ifndef __ASM_SPARC_FLOPPY_H -#define __ASM_SPARC_FLOPPY_H - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* We don't need no stinkin' I/O port allocation crap. */ -#undef release_region -#undef request_region -#define release_region(X, Y) do { } while(0) -#define request_region(X, Y, Z) (1) - -/* References: - * 1) Netbsd Sun floppy driver. - * 2) NCR 82077 controller manual - * 3) Intel 82077 controller manual - */ -struct sun_flpy_controller { - volatile unsigned char status_82072; /* Main Status reg. */ -#define dcr_82072 status_82072 /* Digital Control reg. */ -#define status1_82077 status_82072 /* Auxiliary Status reg. 1 */ - - volatile unsigned char data_82072; /* Data fifo. */ -#define status2_82077 data_82072 /* Auxiliary Status reg. 2 */ - - volatile unsigned char dor_82077; /* Digital Output reg. */ - volatile unsigned char tapectl_82077; /* What the? Tape control reg? */ - - volatile unsigned char status_82077; /* Main Status Register. */ -#define drs_82077 status_82077 /* Digital Rate Select reg. */ - - volatile unsigned char data_82077; /* Data fifo. */ - volatile unsigned char ___unused; - volatile unsigned char dir_82077; /* Digital Input reg. */ -#define dcr_82077 dir_82077 /* Config Control reg. */ -}; - -/* You'll only ever find one controller on a SparcStation anyways. */ -static struct sun_flpy_controller *sun_fdc = NULL; - -struct sun_floppy_ops { - unsigned char (*fd_inb)(int port); - void (*fd_outb)(unsigned char value, int port); -}; - -static struct sun_floppy_ops sun_fdops; - -#define fd_inb(base, reg) sun_fdops.fd_inb(reg) -#define fd_outb(value, base, reg) sun_fdops.fd_outb(value, reg) -#define fd_enable_dma() sun_fd_enable_dma() -#define fd_disable_dma() sun_fd_disable_dma() -#define fd_request_dma() (0) /* nothing... */ -#define fd_free_dma() /* nothing... */ -#define fd_clear_dma_ff() /* nothing... */ -#define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode) -#define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr) -#define fd_set_dma_count(count) sun_fd_set_dma_count(count) -#define fd_enable_irq() /* nothing... */ -#define fd_disable_irq() /* nothing... */ -#define fd_request_irq() sun_fd_request_irq() -#define fd_free_irq() /* nothing... */ -#if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */ -#define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size)) -#define fd_dma_mem_free(addr,size) (vfree((void *)(addr))) -#endif - -/* XXX This isn't really correct. XXX */ -#define get_dma_residue(x) (0) - -#define FLOPPY0_TYPE 4 -#define FLOPPY1_TYPE 0 - -/* Super paranoid... */ -#undef HAVE_DISABLE_HLT - -/* Here is where we catch the floppy driver trying to initialize, - * therefore this is where we call the PROM device tree probing - * routine etc. on the Sparc. - */ -#define FDC1 sun_floppy_init() - -#define N_FDC 1 -#define N_DRIVE 8 - -/* No 64k boundary crossing problems on the Sparc. */ -#define CROSS_64KB(a,s) (0) - -/* Routines unique to each controller type on a Sun. */ -static void sun_set_dor(unsigned char value, int fdc_82077) -{ - if (fdc_82077) - sun_fdc->dor_82077 = value; -} - -static unsigned char sun_read_dir(void) -{ - return sun_fdc->dir_82077; -} - -static unsigned char sun_82072_fd_inb(int port) -{ - udelay(5); - switch (port) { - default: - printk("floppy: Asked to read unknown port %d\n", port); - panic("floppy: Port bolixed."); - case FD_STATUS: - return sun_fdc->status_82072 & ~STATUS_DMA; - case FD_DATA: - return sun_fdc->data_82072; - case FD_DIR: - return sun_read_dir(); - } - panic("sun_82072_fd_inb: How did I get here?"); -} - -static void sun_82072_fd_outb(unsigned char value, int port) -{ - udelay(5); - switch (port) { - default: - printk("floppy: Asked to write to unknown port %d\n", port); - panic("floppy: Port bolixed."); - case FD_DOR: - sun_set_dor(value, 0); - break; - case FD_DATA: - sun_fdc->data_82072 = value; - break; - case FD_DCR: - sun_fdc->dcr_82072 = value; - break; - case FD_DSR: - sun_fdc->status_82072 = value; - break; - } - return; -} - -static unsigned char sun_82077_fd_inb(int port) -{ - udelay(5); - switch (port) { - default: - printk("floppy: Asked to read unknown port %d\n", port); - panic("floppy: Port bolixed."); - case FD_SRA: - return sun_fdc->status1_82077; - case FD_SRB: - return sun_fdc->status2_82077; - case FD_DOR: - return sun_fdc->dor_82077; - case FD_TDR: - return sun_fdc->tapectl_82077; - case FD_STATUS: - return sun_fdc->status_82077 & ~STATUS_DMA; - case FD_DATA: - return sun_fdc->data_82077; - case FD_DIR: - return sun_read_dir(); - } - panic("sun_82077_fd_inb: How did I get here?"); -} - -static void sun_82077_fd_outb(unsigned char value, int port) -{ - udelay(5); - switch (port) { - default: - printk("floppy: Asked to write to unknown port %d\n", port); - panic("floppy: Port bolixed."); - case FD_DOR: - sun_set_dor(value, 1); - break; - case FD_DATA: - sun_fdc->data_82077 = value; - break; - case FD_DCR: - sun_fdc->dcr_82077 = value; - break; - case FD_DSR: - sun_fdc->status_82077 = value; - break; - case FD_TDR: - sun_fdc->tapectl_82077 = value; - break; - } - return; -} - -/* For pseudo-dma (Sun floppy drives have no real DMA available to - * them so we must eat the data fifo bytes directly ourselves) we have - * three state variables. doing_pdma tells our inline low-level - * assembly floppy interrupt entry point whether it should sit and eat - * bytes from the fifo or just transfer control up to the higher level - * floppy interrupt c-code. I tried very hard but I could not get the - * pseudo-dma to work in c-code without getting many overruns and - * underruns. If non-zero, doing_pdma encodes the direction of - * the transfer for debugging. 1=read 2=write - */ - -/* Common routines to all controller types on the Sparc. */ -static inline void virtual_dma_init(void) -{ - /* nothing... */ -} - -static inline void sun_fd_disable_dma(void) -{ - doing_pdma = 0; - pdma_base = NULL; -} - -static inline void sun_fd_set_dma_mode(int mode) -{ - switch(mode) { - case DMA_MODE_READ: - doing_pdma = 1; - break; - case DMA_MODE_WRITE: - doing_pdma = 2; - break; - default: - printk("Unknown dma mode %d\n", mode); - panic("floppy: Giving up..."); - } -} - -static inline void sun_fd_set_dma_addr(char *buffer) -{ - pdma_vaddr = buffer; -} - -static inline void sun_fd_set_dma_count(int length) -{ - pdma_size = length; -} - -static inline void sun_fd_enable_dma(void) -{ - pdma_base = pdma_vaddr; - pdma_areasize = pdma_size; -} - -int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler); - -static int sun_fd_request_irq(void) -{ - static int once = 0; - - if (!once) { - once = 1; - return sparc_floppy_request_irq(FLOPPY_IRQ, floppy_interrupt); - } else { - return 0; - } -} - -static struct linux_prom_registers fd_regs[2]; - -static int sun_floppy_init(void) -{ - struct platform_device *op; - struct device_node *dp; - struct resource r; - char state[128]; - phandle fd_node; - phandle tnode; - int num_regs; - - use_virtual_dma = 1; - - /* Forget it if we aren't on a machine that could possibly - * ever have a floppy drive. - */ - if (sparc_cpu_model != sun4m) { - /* We certainly don't have a floppy controller. */ - goto no_sun_fdc; - } - /* Well, try to find one. */ - tnode = prom_getchild(prom_root_node); - fd_node = prom_searchsiblings(tnode, "obio"); - if (fd_node != 0) { - tnode = prom_getchild(fd_node); - fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo"); - } else { - fd_node = prom_searchsiblings(tnode, "fd"); - } - if (fd_node == 0) { - goto no_sun_fdc; - } - - /* The sun4m lets us know if the controller is actually usable. */ - if (prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) { - if(!strcmp(state, "disabled")) { - goto no_sun_fdc; - } - } - num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs)); - num_regs = (num_regs / sizeof(fd_regs[0])); - prom_apply_obio_ranges(fd_regs, num_regs); - memset(&r, 0, sizeof(r)); - r.flags = fd_regs[0].which_io; - r.start = fd_regs[0].phys_addr; - sun_fdc = of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); - - /* Look up irq in platform_device. - * We try "SUNW,fdtwo" and "fd" - */ - op = NULL; - for_each_node_by_name(dp, "SUNW,fdtwo") { - op = of_find_device_by_node(dp); - if (op) - break; - } - if (!op) { - for_each_node_by_name(dp, "fd") { - op = of_find_device_by_node(dp); - if (op) - break; - } - } - if (!op) - goto no_sun_fdc; - - FLOPPY_IRQ = op->archdata.irqs[0]; - - /* Last minute sanity check... */ - if (sun_fdc->status_82072 == 0xff) { - sun_fdc = NULL; - goto no_sun_fdc; - } - - sun_fdops.fd_inb = sun_82077_fd_inb; - sun_fdops.fd_outb = sun_82077_fd_outb; - fdc_status = &sun_fdc->status_82077; - - if (sun_fdc->dor_82077 == 0x80) { - sun_fdc->dor_82077 = 0x02; - if (sun_fdc->dor_82077 == 0x80) { - sun_fdops.fd_inb = sun_82072_fd_inb; - sun_fdops.fd_outb = sun_82072_fd_outb; - fdc_status = &sun_fdc->status_82072; - } - } - - /* Success... */ - allowed_drive_mask = 0x01; - return (int) sun_fdc; - -no_sun_fdc: - return -1; -} - -static int sparc_eject(void) -{ - set_dor(0x00, 0xff, 0x90); - udelay(500); - set_dor(0x00, 0x6f, 0x00); - udelay(500); - return 0; -} - -#define fd_eject(drive) sparc_eject() - -#define EXTRA_FLOPPY_PARAMS - -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 /* !(__ASM_SPARC_FLOPPY_H) */ diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index a3fdee4cd6fa..c6a5cb949381 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S @@ -55,143 +55,6 @@ arch_kgdb_breakpoint: .size arch_kgdb_breakpoint,.-arch_kgdb_breakpoint #endif -#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) - .align 4 - .globl floppy_hardint -floppy_hardint: - /* - * This code cannot touch registers %l0 %l1 and %l2 - * because SAVE_ALL depends on their values. It depends - * on %l3 also, but we regenerate it before a call. - * Other registers are: - * %l3 -- base address of fdc registers - * %l4 -- pdma_vaddr - * %l5 -- scratch for ld/st address - * %l6 -- pdma_size - * %l7 -- scratch [floppy byte, ld/st address, aux. data] - */ - - /* Do we have work to do? */ - sethi %hi(doing_pdma), %l7 - ld [%l7 + %lo(doing_pdma)], %l7 - cmp %l7, 0 - be floppy_dosoftint - nop - - /* Load fdc register base */ - sethi %hi(fdc_status), %l3 - ld [%l3 + %lo(fdc_status)], %l3 - - /* Setup register addresses */ - sethi %hi(pdma_vaddr), %l5 ! transfer buffer - ld [%l5 + %lo(pdma_vaddr)], %l4 - sethi %hi(pdma_size), %l5 ! bytes to go - ld [%l5 + %lo(pdma_size)], %l6 -next_byte: - ldub [%l3], %l7 - - andcc %l7, 0x80, %g0 ! Does fifo still have data - bz floppy_fifo_emptied ! fifo has been emptied... - andcc %l7, 0x20, %g0 ! in non-dma mode still? - bz floppy_overrun ! nope, overrun - andcc %l7, 0x40, %g0 ! 0=write 1=read - bz floppy_write - sub %l6, 0x1, %l6 - - /* Ok, actually read this byte */ - ldub [%l3 + 1], %l7 - orcc %g0, %l6, %g0 - stb %l7, [%l4] - bne next_byte - add %l4, 0x1, %l4 - - b floppy_tdone - nop - -floppy_write: - /* Ok, actually write this byte */ - ldub [%l4], %l7 - orcc %g0, %l6, %g0 - stb %l7, [%l3 + 1] - bne next_byte - add %l4, 0x1, %l4 - - /* fall through... */ -floppy_tdone: - sethi %hi(pdma_vaddr), %l5 - st %l4, [%l5 + %lo(pdma_vaddr)] - sethi %hi(pdma_size), %l5 - st %l6, [%l5 + %lo(pdma_size)] - /* Flip terminal count pin */ - set auxio_register, %l7 - ld [%l7], %l7 - - ldub [%l7], %l5 - - or %l5, 0xc2, %l5 - stb %l5, [%l7] - andn %l5, 0x02, %l5 - -2: - /* Kill some time so the bits set */ - WRITE_PAUSE - WRITE_PAUSE - - stb %l5, [%l7] - - /* Prevent recursion */ - sethi %hi(doing_pdma), %l7 - b floppy_dosoftint - st %g0, [%l7 + %lo(doing_pdma)] - - /* We emptied the FIFO, but we haven't read everything - * as of yet. Store the current transfer address and - * bytes left to read so we can continue when the next - * fast IRQ comes in. - */ -floppy_fifo_emptied: - sethi %hi(pdma_vaddr), %l5 - st %l4, [%l5 + %lo(pdma_vaddr)] - sethi %hi(pdma_size), %l7 - st %l6, [%l7 + %lo(pdma_size)] - - /* Restore condition codes */ - wr %l0, 0x0, %psr - WRITE_PAUSE - - jmp %l1 - rett %l2 - -floppy_overrun: - sethi %hi(pdma_vaddr), %l5 - st %l4, [%l5 + %lo(pdma_vaddr)] - sethi %hi(pdma_size), %l5 - st %l6, [%l5 + %lo(pdma_size)] - /* Prevent recursion */ - sethi %hi(doing_pdma), %l7 - st %g0, [%l7 + %lo(doing_pdma)] - - /* fall through... */ -floppy_dosoftint: - rd %wim, %l3 - SAVE_ALL - - /* Set all IRQs off. */ - or %l0, PSR_PIL, %l4 - wr %l4, 0x0, %psr - WRITE_PAUSE - wr %l4, PSR_ET, %psr - WRITE_PAUSE - - mov 11, %o0 ! floppy irq level (unused anyway) - mov %g0, %o1 ! devid is not used in fast interrupts - call sparc_floppy_irq - add %sp, STACKFRAME_SZ, %o2 ! struct pt_regs *regs - - RESTORE_ALL - -#endif /* (CONFIG_BLK_DEV_FD) */ - /* Bad trap handler */ .globl bad_trap_handler bad_trap_handler: diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h index b02026ad6e34..0d9b740725b4 100644 --- a/arch/sparc/kernel/irq.h +++ b/arch/sparc/kernel/irq.h @@ -83,9 +83,6 @@ void handler_irq(unsigned int pil, struct pt_regs *regs); unsigned long leon_get_irqmask(unsigned int irq); -/* irq_32.c */ -void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs); - /* sun4m_irq.c */ void sun4m_nmi(struct pt_regs *regs); diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index e8452be5123b..510184c3aa17 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -235,99 +235,6 @@ void handler_irq(unsigned int pil, struct pt_regs *regs) set_irq_regs(old_regs); } -#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) -static unsigned int floppy_irq; - -int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler) -{ - unsigned int cpu_irq; - int err; - - - err = request_irq(irq, irq_handler, 0, "floppy", NULL); - if (err) - return -1; - - /* Save for later use in floppy interrupt handler */ - floppy_irq = irq; - - cpu_irq = (irq & (NR_IRQS - 1)); - - /* Dork with trap table if we get this far. */ -#define INSTANTIATE(table) \ - table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \ - table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \ - SPARC_BRANCH((unsigned long) floppy_hardint, \ - (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\ - table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \ - table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP; - - INSTANTIATE(sparc_ttable) - -#if defined CONFIG_SMP - if (sparc_cpu_model != sparc_leon) { - struct tt_entry *trap_table; - - trap_table = &trapbase_cpu1; - INSTANTIATE(trap_table) - trap_table = &trapbase_cpu2; - INSTANTIATE(trap_table) - trap_table = &trapbase_cpu3; - INSTANTIATE(trap_table) - } -#endif -#undef INSTANTIATE - /* - * XXX Correct thing whould be to flush only I- and D-cache lines - * which contain the handler in question. But as of time of the - * writing we have no CPU-neutral interface to fine-grained flushes. - */ - flush_cache_all(); - return 0; -} -EXPORT_SYMBOL(sparc_floppy_request_irq); - -/* - * These variables are used to access state from the assembler - * interrupt handler, floppy_hardint, so we cannot put these in - * the floppy driver image because that would not work in the - * modular case. - */ -volatile unsigned char *fdc_status; -EXPORT_SYMBOL(fdc_status); - -char *pdma_vaddr; -EXPORT_SYMBOL(pdma_vaddr); - -unsigned long pdma_size; -EXPORT_SYMBOL(pdma_size); - -volatile int doing_pdma; -EXPORT_SYMBOL(doing_pdma); - -char *pdma_base; -EXPORT_SYMBOL(pdma_base); - -unsigned long pdma_areasize; -EXPORT_SYMBOL(pdma_areasize); - -/* Use the generic irq support to call floppy_interrupt - * which was setup using request_irq() in sparc_floppy_request_irq(). - * We only have one floppy interrupt so we do not need to check - * for additional handlers being wired up by irq_link() - */ -void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) -{ - struct pt_regs *old_regs; - - old_regs = set_irq_regs(regs); - irq_enter(); - generic_handle_irq(floppy_irq); - irq_exit(); - set_irq_regs(old_regs); -} -#endif - /* djhr * This could probably be made indirect too and assigned in the CPU * bits of the code. That would be much nicer I think and would also diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 15da3c0597a5..ef5579496088 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -151,8 +151,6 @@ extern unsigned int real_irq_entry[]; extern unsigned int smp4d_ticker[]; extern unsigned int patchme_maybe_smp_msg[]; -void floppy_hardint(void); - /* trampoline_32.S */ extern unsigned long sun4m_cpu_startup; extern unsigned long sun4d_cpu_startup; From patchwork Tue Dec 19 22:03:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756356 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 030953D0A7; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tk3vhMhv" Received: by smtp.kernel.org (Postfix) with ESMTPS id A0E10C433CD; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023395; bh=PvOL9owNF2Ng6LxW7GH7pqhSC0pz/LAIOTcjgaK0OH4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=tk3vhMhvqHmOnXWItGr8nAQvwmYbUhB3feES7BPxAn8Hcie4cRM1hYReHXfQjXaKT tEOhRGzwg8CS8+PTABIuRcFS1AxYb2J0YA0frp/bH1Fi7VK/LnTSX/VgDTErEkgy0h uIc8Usem7yKoHIMfSdZYIh4JdGhT06fj3wEpJffC2zPN/F5kAieNgB/qaYeJANEfwH JuV3tTk1XWyf1vlVbpqsPBrDsDWuNJMGpEB93ZxdgbrHgJLaVM56thLRNBFFHzTcZY 8dMzLa9dhpKpYgvqLNDmRUO0dajPof1OmPIUbKVRGM4Hr5lM+IoAZQ4g65ZaiUf45n tjeX79QI4MuoQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A399C46CD7; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:09 +0100 Subject: [PATCH 04/27] sparc32: Drop sun4m specific led driver Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-4-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=5266; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=w/RBrmmZ8Yg5ZhjQjAlbJAmo7mwa0rCWWJGIHV2crps=; =?utf-8?q?b=3DTeV6xXOFygK5?= =?utf-8?q?5e17IwhpcZDv8UodKRmHjUsOo5OdOB31c5kiG9eX2d59myzar3EODv/zPQnrG0Nr?= easM3BasDDyIMfs3BRDC5uRzyD9VOZoN+HRnA+lB7XfHNrrOW/MI X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg The led driver is only relevant for the sun4m machines. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/Kconfig | 9 --- arch/sparc/kernel/Makefile | 1 - arch/sparc/kernel/led.c | 146 --------------------------------------------- 3 files changed, 156 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 54c91431724b..1520f68e944a 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -331,15 +331,6 @@ config SUN_PM Enable power management and CPU standby features on supported SPARC platforms. -config SPARC_LED - tristate "Sun4m LED driver" - depends on SPARC32 - help - This driver toggles the front-panel LED on sun4m systems - in a user-specifiable manner. Its state can be probed - by reading /proc/led and its blinking mode can be changed - via writes to /proc/led - config SERIAL_CONSOLE bool depends on SPARC32 diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 0984bb6f0f17..95687af45d20 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -90,7 +90,6 @@ obj-y += termios.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_MODULES) += sparc_ksyms.o -obj-$(CONFIG_SPARC_LED) += led.o obj-$(CONFIG_KGDB) += kgdb_$(BITS).o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c deleted file mode 100644 index ab657b359789..000000000000 --- a/arch/sparc/kernel/led.c +++ /dev/null @@ -1,146 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define LED_MAX_LENGTH 8 /* maximum chars written to proc file */ - -static inline void led_toggle(void) -{ - unsigned char val = get_auxio(); - unsigned char on, off; - - if (val & AUXIO_LED) { - on = 0; - off = AUXIO_LED; - } else { - on = AUXIO_LED; - off = 0; - } - - set_auxio(on, off); -} - -static struct timer_list led_blink_timer; -static unsigned long led_blink_timer_timeout; - -static void led_blink(struct timer_list *unused) -{ - unsigned long timeout = led_blink_timer_timeout; - - led_toggle(); - - /* reschedule */ - if (!timeout) { /* blink according to load */ - led_blink_timer.expires = jiffies + - ((1 + (avenrun[0] >> FSHIFT)) * HZ); - } else { /* blink at user specified interval */ - led_blink_timer.expires = jiffies + (timeout * HZ); - } - add_timer(&led_blink_timer); -} - -#ifdef CONFIG_PROC_FS -static int led_proc_show(struct seq_file *m, void *v) -{ - if (get_auxio() & AUXIO_LED) - seq_puts(m, "on\n"); - else - seq_puts(m, "off\n"); - return 0; -} - -static int led_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, led_proc_show, NULL); -} - -static ssize_t led_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *ppos) -{ - char *buf = NULL; - - if (count > LED_MAX_LENGTH) - count = LED_MAX_LENGTH; - - buf = memdup_user_nul(buffer, count); - if (IS_ERR(buf)) - return PTR_ERR(buf); - - /* work around \n when echo'ing into proc */ - if (buf[count - 1] == '\n') - buf[count - 1] = '\0'; - - /* before we change anything we want to stop any running timers, - * otherwise calls such as on will have no persistent effect - */ - del_timer_sync(&led_blink_timer); - - if (!strcmp(buf, "on")) { - auxio_set_led(AUXIO_LED_ON); - } else if (!strcmp(buf, "toggle")) { - led_toggle(); - } else if ((*buf > '0') && (*buf <= '9')) { - led_blink_timer_timeout = simple_strtoul(buf, NULL, 10); - led_blink(&led_blink_timer); - } else if (!strcmp(buf, "load")) { - led_blink_timer_timeout = 0; - led_blink(&led_blink_timer); - } else { - auxio_set_led(AUXIO_LED_OFF); - } - - kfree(buf); - - return count; -} - -static const struct proc_ops led_proc_ops = { - .proc_open = led_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = single_release, - .proc_write = led_proc_write, -}; -#endif - -#define LED_VERSION "0.1" - -static int __init led_init(void) -{ - timer_setup(&led_blink_timer, led_blink, 0); - -#ifdef CONFIG_PROC_FS - if (!proc_create("led", 0, NULL, &led_proc_ops)) - return -ENOMEM; -#endif - printk(KERN_INFO - "led: version %s, Lars Kotthoff \n", - LED_VERSION); - - return 0; -} - -static void __exit led_exit(void) -{ - remove_proc_entry("led", NULL); - del_timer_sync(&led_blink_timer); -} - -module_init(led_init); -module_exit(led_exit); - -MODULE_AUTHOR("Lars Kotthoff "); -MODULE_DESCRIPTION("Provides control of the front LED on SPARC systems."); -MODULE_LICENSE("GPL"); -MODULE_VERSION(LED_VERSION); From patchwork Tue Dec 19 22:03:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756354 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 498B93D0D8; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UUvylM7r" Received: by smtp.kernel.org (Postfix) with ESMTPS id AF230C43391; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023395; bh=i8P0wIY8MHNR0IMtWcJ3lmr2A2+O0+vGlp41TmDW9Ws=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=UUvylM7rIglGvj739qnp45YIczwIDgMAS6sj4ktXX+qZAcpZL9Jp1WoQr6g87GoMT pLUhCNvqCas0JWFfGHFTPAygsN3pkDyof2ZD0Ie1cnVS7fE4uG5xZWfbpciFCCK0r0 X/+AcDWmp8fqzdAGPwGGogrZ/Yh62oz0c7A+S0BAUOJYmpfoytBo1c3tRFK1GCGhXK 2oyRge7VChXNjdfCAYqNHhk+0E250TKp/K5PHy+efwk3TGep784q+1SrFcVi/YD1pG 1F4waGytTQygWFsvPn1iiw2nuN703RGjG5ylwG1Bwj8/qSHLSms/M7YFWmzgFJONgq aeiEdjRwgQh9A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98D24C46CCD; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:10 +0100 Subject: [PATCH 05/27] sparc32: Drop sun specific power management drivers Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-5-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=8689; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=fThpDz4+PMLtttr9htY2gCawX85PeqZND9L6UPVn/AU=; =?utf-8?q?b=3DOtsYhDQL2gfc?= =?utf-8?q?36sjUQEkqHM5Gpi2qOmZo9mUeeInVwO/EiodJOjzL2CLQ6HIKMCVVNmZbBU88Oyw?= 1xqlbiSlCV4/vr/mH/KffmBQTiaOxktZzxxr8w0r28UXQfg8ZBhV X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Drop the two sun specific apc and pmc drivers. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/Kconfig | 7 -- arch/sparc/kernel/Makefile | 1 - arch/sparc/kernel/apc.c | 196 --------------------------------------------- arch/sparc/kernel/pmc.c | 100 ----------------------- 4 files changed, 304 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 1520f68e944a..55a9e67c482e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -324,13 +324,6 @@ config CMDLINE NOTE: This option WILL override the PROM bootargs setting! -config SUN_PM - bool - default y if SPARC32 - help - Enable power management and CPU standby features on supported - SPARC platforms. - config SERIAL_CONSOLE bool depends on SPARC32 diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 95687af45d20..ab47823f8b4e 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -84,7 +84,6 @@ obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o obj-$(CONFIG_SPARC64_SMP) += hvtramp.o obj-y += auxio_$(BITS).o -obj-$(CONFIG_SUN_PM) += apc.o pmc.o obj-y += termios.o diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c deleted file mode 100644 index d44725d37e30..000000000000 --- a/arch/sparc/kernel/apc.c +++ /dev/null @@ -1,196 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* apc - Driver implementation for power management functions - * of Aurora Personality Chip (APC) on SPARCstation-4/5 and - * derivatives. - * - * Copyright (c) 2002 Eric Brower (ebrower@usa.net) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* Debugging - * - * #define APC_DEBUG_LED - */ - -#define APC_MINOR MISC_DYNAMIC_MINOR -#define APC_OBPNAME "power-management" -#define APC_DEVNAME "apc" - -static u8 __iomem *regs; -static int apc_no_idle = 0; - -#define apc_readb(offs) (sbus_readb(regs+offs)) -#define apc_writeb(val, offs) (sbus_writeb(val, regs+offs)) - -/* Specify "apc=noidle" on the kernel command line to - * disable APC CPU standby support. Certain prototype - * systems (SPARCstation-Fox) do not play well with APC - * CPU idle, so disable this if your system has APC and - * crashes randomly. - */ -static int __init apc_setup(char *str) -{ - if(!strncmp(str, "noidle", strlen("noidle"))) { - apc_no_idle = 1; - return 1; - } - return 0; -} -__setup("apc=", apc_setup); - -/* - * CPU idle callback function - * See .../arch/sparc/kernel/process.c - */ -static void apc_swift_idle(void) -{ -#ifdef APC_DEBUG_LED - set_auxio(0x00, AUXIO_LED); -#endif - - apc_writeb(apc_readb(APC_IDLE_REG) | APC_IDLE_ON, APC_IDLE_REG); - -#ifdef APC_DEBUG_LED - set_auxio(AUXIO_LED, 0x00); -#endif -} - -static inline void apc_free(struct platform_device *op) -{ - of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0])); -} - -static int apc_open(struct inode *inode, struct file *f) -{ - return 0; -} - -static int apc_release(struct inode *inode, struct file *f) -{ - return 0; -} - -static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) -{ - __u8 inarg, __user *arg = (__u8 __user *) __arg; - - switch (cmd) { - case APCIOCGFANCTL: - if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) - return -EFAULT; - break; - - case APCIOCGCPWR: - if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) - return -EFAULT; - break; - - case APCIOCGBPORT: - if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) - return -EFAULT; - break; - - case APCIOCSFANCTL: - if (get_user(inarg, arg)) - return -EFAULT; - apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); - break; - - case APCIOCSCPWR: - if (get_user(inarg, arg)) - return -EFAULT; - apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); - break; - - case APCIOCSBPORT: - if (get_user(inarg, arg)) - return -EFAULT; - apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); - break; - - default: - return -EINVAL; - } - - return 0; -} - -static const struct file_operations apc_fops = { - .unlocked_ioctl = apc_ioctl, - .open = apc_open, - .release = apc_release, - .llseek = noop_llseek, -}; - -static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; - -static int apc_probe(struct platform_device *op) -{ - int err; - - regs = of_ioremap(&op->resource[0], 0, - resource_size(&op->resource[0]), APC_OBPNAME); - if (!regs) { - printk(KERN_ERR "%s: unable to map registers\n", APC_DEVNAME); - return -ENODEV; - } - - err = misc_register(&apc_miscdev); - if (err) { - printk(KERN_ERR "%s: unable to register device\n", APC_DEVNAME); - apc_free(op); - return -ENODEV; - } - - /* Assign power management IDLE handler */ - if (!apc_no_idle) - sparc_idle = apc_swift_idle; - - printk(KERN_INFO "%s: power management initialized%s\n", - APC_DEVNAME, apc_no_idle ? " (CPU idle disabled)" : ""); - - return 0; -} - -static const struct of_device_id apc_match[] = { - { - .name = APC_OBPNAME, - }, - {}, -}; -MODULE_DEVICE_TABLE(of, apc_match); - -static struct platform_driver apc_driver = { - .driver = { - .name = "apc", - .of_match_table = apc_match, - }, - .probe = apc_probe, -}; - -static int __init apc_init(void) -{ - return platform_driver_register(&apc_driver); -} - -/* This driver is not critical to the boot process - * and is easiest to ioremap when SBus is already - * initialized, so we install ourselves thusly: - */ -__initcall(apc_init); diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c deleted file mode 100644 index 69a0206e56f0..000000000000 --- a/arch/sparc/kernel/pmc.c +++ /dev/null @@ -1,100 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* pmc - Driver implementation for power management functions - * of Power Management Controller (PMC) on SPARCstation-Voyager. - * - * Copyright (c) 2002 Eric Brower (ebrower@usa.net) - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* Debug - * - * #define PMC_DEBUG_LED - * #define PMC_NO_IDLE - */ - -#define PMC_OBPNAME "SUNW,pmc" -#define PMC_DEVNAME "pmc" - -#define PMC_IDLE_REG 0x00 -#define PMC_IDLE_ON 0x01 - -static u8 __iomem *regs; - -#define pmc_readb(offs) (sbus_readb(regs+offs)) -#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs)) - -/* - * CPU idle callback function - * See .../arch/sparc/kernel/process.c - */ -static void pmc_swift_idle(void) -{ -#ifdef PMC_DEBUG_LED - set_auxio(0x00, AUXIO_LED); -#endif - - pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG); - -#ifdef PMC_DEBUG_LED - set_auxio(AUXIO_LED, 0x00); -#endif -} - -static int pmc_probe(struct platform_device *op) -{ - regs = of_ioremap(&op->resource[0], 0, - resource_size(&op->resource[0]), PMC_OBPNAME); - if (!regs) { - printk(KERN_ERR "%s: unable to map registers\n", PMC_DEVNAME); - return -ENODEV; - } - -#ifndef PMC_NO_IDLE - /* Assign power management IDLE handler */ - sparc_idle = pmc_swift_idle; -#endif - - printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME); - return 0; -} - -static const struct of_device_id pmc_match[] = { - { - .name = PMC_OBPNAME, - }, - {}, -}; -MODULE_DEVICE_TABLE(of, pmc_match); - -static struct platform_driver pmc_driver = { - .driver = { - .name = "pmc", - .of_match_table = pmc_match, - }, - .probe = pmc_probe, -}; - -static int __init pmc_init(void) -{ - return platform_driver_register(&pmc_driver); -} - -/* This driver is not critical to the boot process - * and is easiest to ioremap when SBus is already - * initialized, so we install ourselves thusly: - */ -__initcall(pmc_init); From patchwork Tue Dec 19 22:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756353 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4987E3D0D7; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G2BkP+F5" Received: by smtp.kernel.org (Postfix) with ESMTPS id E3280C433B7; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=dPoo+AINKLeP5Efd7MtnZlrrldEPs+bj3GLO9LBEIe0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=G2BkP+F5V4ZuY8TS/JofbF+KQB5DShx/rOTGH2l0s4jFRvs+8KaXrCU/+LAE83Pci 7Xfs4WfZVdc820gL8PP1h42xjPp1vCGKTpX66xlSbGP/GvPOJQFeri+CnAtijsdeGU Y6+lG65cOSpI2RqZ5OTX+QSeJ5YqKN0kE+nv0bjYURCAtsSKI0IAsvvoukvZlZmqGZ nDxvnSxpf9zHm7yElsEeMFO5WZJXmxqYQ42ZttSg9A4Zp2GVEQ5av72/Ogg6z1yCYs LpHNhKsfW4/Ng2pRymbnFQARmAZ9T3AJjrIKiB3/qwp4R+2k7/bct7PVn7xbIsP+tZ cxzCZXL+uLDzA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2135C46CD8; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:14 +0100 Subject: [PATCH 09/27] sparc32: Drop sun4m/sun4d specific irq handling Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-9-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=25181; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=ynlMEn9iRcDzCTi1pnE+WBuIxgKhE0AuVtaOUYmMGzE=; =?utf-8?q?b=3Dv9v9PCjUbI5A?= =?utf-8?q?jUhyyixpQA9X+6j/woKOwTrk0K0Gq9jl17yhryY6+qqiqzmXYMmgDRYiWUmTf42X?= o2x7eKAGAekDWweDUgXgX3CMOp07eLRZ1VGaMv024O6yLvyoCBF9 X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Some of the sun4m irq infrastructure is used by LEON too, so keep that and drop the rest. The patch include a few extra fixes fix the build after the removal of the irq support. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/include/asm/irq_32.h | 2 - arch/sparc/kernel/Makefile | 2 +- arch/sparc/kernel/irq_32.c | 30 +-- arch/sparc/kernel/kernel.h | 13 -- arch/sparc/kernel/sun4d_irq.c | 494 ---------------------------------------- arch/sparc/kernel/sun4d_smp.c | 4 - arch/sparc/kernel/sun4m_irq.c | 240 ------------------- arch/sparc/mm/io-unit.c | 2 - 8 files changed, 2 insertions(+), 785 deletions(-) diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h index 6ee48321cbc2..c402c81b85a7 100644 --- a/arch/sparc/include/asm/irq_32.h +++ b/arch/sparc/include/asm/irq_32.h @@ -17,8 +17,6 @@ #define irq_canonicalize(irq) (irq) -void __init sun4d_init_sbi_irq(void); - #define NO_IRQ 0xffffffff #endif diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 577cb57c588a..e79ef2049ea2 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -29,7 +29,7 @@ obj-y += traps_$(BITS).o # IRQ obj-y += irq_$(BITS).o -obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4d_irq.o +obj-$(CONFIG_SPARC32) += sun4m_irq.o obj-y += process_$(BITS).o obj-y += process.o diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index 510184c3aa17..135170f362c1 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -235,36 +235,8 @@ void handler_irq(unsigned int pil, struct pt_regs *regs) set_irq_regs(old_regs); } -/* djhr - * This could probably be made indirect too and assigned in the CPU - * bits of the code. That would be much nicer I think and would also - * fit in with the idea of being able to tune your kernel for your machine - * by removing unrequired machine and device support. - * - */ - void __init init_IRQ(void) { - switch (sparc_cpu_model) { - case sun4m: - pcic_probe(); - if (pcic_present()) - sun4m_pci_init_IRQ(); - else - sun4m_init_IRQ(); - break; - - case sun4d: - sun4d_init_IRQ(); - break; - - case sparc_leon: - leon_init_IRQ(); - break; - - default: - prom_printf("Cannot initialize IRQs on this Sun machine..."); - break; - } + leon_init_IRQ(); } diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 85a3c3d1195e..f090d34a2f56 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -93,7 +93,6 @@ extern spinlock_t irq_action_lock; void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); /* sun4m_irq.c */ -void sun4m_init_IRQ(void); void sun4m_unmask_profile_irq(void); void sun4m_clear_profile_irq(int cpu); @@ -106,18 +105,6 @@ void __init smp4m_smp_done(void); void smp4m_cross_call_irq(void); void smp4m_percpu_timer_interrupt(struct pt_regs *regs); -/* sun4d_irq.c */ -extern spinlock_t sun4d_imsk_lock; - -void sun4d_init_IRQ(void); -int sun4d_request_irq(unsigned int irq, - irq_handler_t handler, - unsigned long irqflags, - const char *devname, void *dev_id); -int show_sun4d_interrupts(struct seq_file *, void *); -void sun4d_distribute_irqs(void); -void sun4d_free_irq(unsigned int irq, void *dev_id); - /* sun4d_smp.c */ void sun4d_cpu_pre_starting(void *arg); void sun4d_cpu_pre_online(void *arg); diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c deleted file mode 100644 index 7140cff04b54..000000000000 --- a/arch/sparc/kernel/sun4d_irq.c +++ /dev/null @@ -1,494 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * SS1000/SC2000 interrupt handling. - * - * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Heavily based on arch/sparc/kernel/irq.c. - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kernel.h" -#include "irq.h" - -/* Sun4d interrupts fall roughly into two categories. SBUS and - * cpu local. CPU local interrupts cover the timer interrupts - * and whatnot, and we encode those as normal PILs between - * 0 and 15. - * SBUS interrupts are encodes as a combination of board, level and slot. - */ - -struct sun4d_handler_data { - unsigned int cpuid; /* target cpu */ - unsigned int real_irq; /* interrupt level */ -}; - - -static unsigned int sun4d_encode_irq(int board, int lvl, int slot) -{ - return (board + 1) << 5 | (lvl << 2) | slot; -} - -struct sun4d_timer_regs { - u32 l10_timer_limit; - u32 l10_cur_countx; - u32 l10_limit_noclear; - u32 ctrl; - u32 l10_cur_count; -}; - -static struct sun4d_timer_regs __iomem *sun4d_timers; - -#define SUN4D_TIMER_IRQ 10 - -/* Specify which cpu handle interrupts from which board. - * Index is board - value is cpu. - */ -static unsigned char board_to_cpu[32]; - -static int pil_to_sbus[] = { - 0, - 0, - 1, - 2, - 0, - 3, - 0, - 4, - 0, - 5, - 0, - 6, - 0, - 7, - 0, - 0, -}; - -/* Exported for sun4d_smp.c */ -DEFINE_SPINLOCK(sun4d_imsk_lock); - -/* SBUS interrupts are encoded integers including the board number - * (plus one), the SBUS level, and the SBUS slot number. Sun4D - * IRQ dispatch is done by: - * - * 1) Reading the BW local interrupt table in order to get the bus - * interrupt mask. - * - * This table is indexed by SBUS interrupt level which can be - * derived from the PIL we got interrupted on. - * - * 2) For each bus showing interrupt pending from #1, read the - * SBI interrupt state register. This will indicate which slots - * have interrupts pending for that SBUS interrupt level. - * - * 3) Call the genreric IRQ support. - */ -static void sun4d_sbus_handler_irq(int sbusl) -{ - unsigned int bus_mask; - unsigned int sbino, slot; - unsigned int sbil; - - bus_mask = bw_get_intr_mask(sbusl) & 0x3ffff; - bw_clear_intr_mask(sbusl, bus_mask); - - sbil = (sbusl << 2); - /* Loop for each pending SBI */ - for (sbino = 0; bus_mask; sbino++, bus_mask >>= 1) { - unsigned int idx, mask; - - if (!(bus_mask & 1)) - continue; - /* XXX This seems to ACK the irq twice. acquire_sbi() - * XXX uses swap, therefore this writes 0xf << sbil, - * XXX then later release_sbi() will write the individual - * XXX bits which were set again. - */ - mask = acquire_sbi(SBI2DEVID(sbino), 0xf << sbil); - mask &= (0xf << sbil); - - /* Loop for each pending SBI slot */ - slot = (1 << sbil); - for (idx = 0; mask != 0; idx++, slot <<= 1) { - unsigned int pil; - struct irq_bucket *p; - - if (!(mask & slot)) - continue; - - mask &= ~slot; - pil = sun4d_encode_irq(sbino, sbusl, idx); - - p = irq_map[pil]; - while (p) { - struct irq_bucket *next; - - next = p->next; - generic_handle_irq(p->irq); - p = next; - } - release_sbi(SBI2DEVID(sbino), slot); - } - } -} - -void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs) -{ - struct pt_regs *old_regs; - /* SBUS IRQ level (1 - 7) */ - int sbusl = pil_to_sbus[pil]; - - /* FIXME: Is this necessary?? */ - cc_get_ipen(); - - cc_set_iclr(1 << pil); - -#ifdef CONFIG_SMP - /* - * Check IPI data structures after IRQ has been cleared. Hard and Soft - * IRQ can happen at the same time, so both cases are always handled. - */ - if (pil == SUN4D_IPI_IRQ) - sun4d_ipi_interrupt(); -#endif - - old_regs = set_irq_regs(regs); - irq_enter(); - if (sbusl == 0) { - /* cpu interrupt */ - struct irq_bucket *p; - - p = irq_map[pil]; - while (p) { - struct irq_bucket *next; - - next = p->next; - generic_handle_irq(p->irq); - p = next; - } - } else { - /* SBUS interrupt */ - sun4d_sbus_handler_irq(sbusl); - } - irq_exit(); - set_irq_regs(old_regs); -} - - -static void sun4d_mask_irq(struct irq_data *data) -{ - struct sun4d_handler_data *handler_data = irq_data_get_irq_handler_data(data); - unsigned int real_irq; -#ifdef CONFIG_SMP - int cpuid = handler_data->cpuid; - unsigned long flags; -#endif - real_irq = handler_data->real_irq; -#ifdef CONFIG_SMP - spin_lock_irqsave(&sun4d_imsk_lock, flags); - cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) | (1 << real_irq)); - spin_unlock_irqrestore(&sun4d_imsk_lock, flags); -#else - cc_set_imsk(cc_get_imsk() | (1 << real_irq)); -#endif -} - -static void sun4d_unmask_irq(struct irq_data *data) -{ - struct sun4d_handler_data *handler_data = irq_data_get_irq_handler_data(data); - unsigned int real_irq; -#ifdef CONFIG_SMP - int cpuid = handler_data->cpuid; - unsigned long flags; -#endif - real_irq = handler_data->real_irq; - -#ifdef CONFIG_SMP - spin_lock_irqsave(&sun4d_imsk_lock, flags); - cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) & ~(1 << real_irq)); - spin_unlock_irqrestore(&sun4d_imsk_lock, flags); -#else - cc_set_imsk(cc_get_imsk() & ~(1 << real_irq)); -#endif -} - -static unsigned int sun4d_startup_irq(struct irq_data *data) -{ - irq_link(data->irq); - sun4d_unmask_irq(data); - return 0; -} - -static void sun4d_shutdown_irq(struct irq_data *data) -{ - sun4d_mask_irq(data); - irq_unlink(data->irq); -} - -static struct irq_chip sun4d_irq = { - .name = "sun4d", - .irq_startup = sun4d_startup_irq, - .irq_shutdown = sun4d_shutdown_irq, - .irq_unmask = sun4d_unmask_irq, - .irq_mask = sun4d_mask_irq, -}; - -#ifdef CONFIG_SMP -/* Setup IRQ distribution scheme. */ -void __init sun4d_distribute_irqs(void) -{ - struct device_node *dp; - - int cpuid = cpu_logical_map(1); - - if (cpuid == -1) - cpuid = cpu_logical_map(0); - for_each_node_by_name(dp, "sbi") { - int devid = of_getintprop_default(dp, "device-id", 0); - int board = of_getintprop_default(dp, "board#", 0); - board_to_cpu[board] = cpuid; - set_sbi_tid(devid, cpuid << 3); - } - printk(KERN_ERR "All sbus IRQs directed to CPU%d\n", cpuid); -} -#endif - -static void sun4d_clear_clock_irq(void) -{ - sbus_readl(&sun4d_timers->l10_timer_limit); -} - -static void sun4d_load_profile_irq(int cpu, unsigned int limit) -{ - unsigned int value = limit ? timer_value(limit) : 0; - bw_set_prof_limit(cpu, value); -} - -static void __init sun4d_load_profile_irqs(void) -{ - int cpu = 0, mid; - - while (!cpu_find_by_instance(cpu, NULL, &mid)) { - sun4d_load_profile_irq(mid >> 3, 0); - cpu++; - } -} - -static unsigned int _sun4d_build_device_irq(unsigned int real_irq, - unsigned int pil, - unsigned int board) -{ - struct sun4d_handler_data *handler_data; - unsigned int irq; - - irq = irq_alloc(real_irq, pil); - if (irq == 0) { - prom_printf("IRQ: allocate for %d %d %d failed\n", - real_irq, pil, board); - goto err_out; - } - - handler_data = irq_get_handler_data(irq); - if (unlikely(handler_data)) - goto err_out; - - handler_data = kzalloc(sizeof(struct sun4d_handler_data), GFP_ATOMIC); - if (unlikely(!handler_data)) { - prom_printf("IRQ: kzalloc(sun4d_handler_data) failed.\n"); - prom_halt(); - } - handler_data->cpuid = board_to_cpu[board]; - handler_data->real_irq = real_irq; - irq_set_chip_and_handler_name(irq, &sun4d_irq, - handle_level_irq, "level"); - irq_set_handler_data(irq, handler_data); - -err_out: - return irq; -} - - - -static unsigned int sun4d_build_device_irq(struct platform_device *op, - unsigned int real_irq) -{ - struct device_node *dp = op->dev.of_node; - struct device_node *board_parent, *bus = dp->parent; - char *bus_connection; - const struct linux_prom_registers *regs; - unsigned int pil; - unsigned int irq; - int board, slot; - int sbusl; - - irq = real_irq; - while (bus) { - if (of_node_name_eq(bus, "sbi")) { - bus_connection = "io-unit"; - break; - } - - if (of_node_name_eq(bus, "bootbus")) { - bus_connection = "cpu-unit"; - break; - } - - bus = bus->parent; - } - if (!bus) - goto err_out; - - regs = of_get_property(dp, "reg", NULL); - if (!regs) - goto err_out; - - slot = regs->which_io; - - /* - * If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit - * lacks a "board#" property, something is very wrong. - */ - if (!of_node_name_eq(bus->parent, bus_connection)) { - printk(KERN_ERR "%pOF: Error, parent is not %s.\n", - bus, bus_connection); - goto err_out; - } - board_parent = bus->parent; - board = of_getintprop_default(board_parent, "board#", -1); - if (board == -1) { - printk(KERN_ERR "%pOF: Error, lacks board# property.\n", - board_parent); - goto err_out; - } - - sbusl = pil_to_sbus[real_irq]; - if (sbusl) - pil = sun4d_encode_irq(board, sbusl, slot); - else - pil = real_irq; - - irq = _sun4d_build_device_irq(real_irq, pil, board); -err_out: - return irq; -} - -static unsigned int sun4d_build_timer_irq(unsigned int board, - unsigned int real_irq) -{ - return _sun4d_build_device_irq(real_irq, real_irq, board); -} - - -static void __init sun4d_init_timers(void) -{ - struct device_node *dp; - struct resource res; - unsigned int irq; - const u32 *reg; - int err; - int board; - - dp = of_find_node_by_name(NULL, "cpu-unit"); - if (!dp) { - prom_printf("sun4d_init_timers: Unable to find cpu-unit\n"); - prom_halt(); - } - - /* Which cpu-unit we use is arbitrary, we can view the bootbus timer - * registers via any cpu's mapping. The first 'reg' property is the - * bootbus. - */ - reg = of_get_property(dp, "reg", NULL); - if (!reg) { - prom_printf("sun4d_init_timers: No reg property\n"); - prom_halt(); - } - - board = of_getintprop_default(dp, "board#", -1); - if (board == -1) { - prom_printf("sun4d_init_timers: No board# property on cpu-unit\n"); - prom_halt(); - } - - of_node_put(dp); - - res.start = reg[1]; - res.end = reg[2] - 1; - res.flags = reg[0] & 0xff; - sun4d_timers = of_ioremap(&res, BW_TIMER_LIMIT, - sizeof(struct sun4d_timer_regs), "user timer"); - if (!sun4d_timers) { - prom_printf("sun4d_init_timers: Can't map timer regs\n"); - prom_halt(); - } - -#ifdef CONFIG_SMP - sparc_config.cs_period = SBUS_CLOCK_RATE * 2; /* 2 seconds */ -#else - sparc_config.cs_period = SBUS_CLOCK_RATE / HZ; /* 1/HZ sec */ - sparc_config.features |= FEAT_L10_CLOCKEVENT; -#endif - sparc_config.features |= FEAT_L10_CLOCKSOURCE; - sbus_writel(timer_value(sparc_config.cs_period), - &sun4d_timers->l10_timer_limit); - - master_l10_counter = &sun4d_timers->l10_cur_count; - - irq = sun4d_build_timer_irq(board, SUN4D_TIMER_IRQ); - err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL); - if (err) { - prom_printf("sun4d_init_timers: request_irq() failed with %d\n", - err); - prom_halt(); - } - sun4d_load_profile_irqs(); -} - -void __init sun4d_init_sbi_irq(void) -{ - struct device_node *dp; - int target_cpu; - - target_cpu = boot_cpu_id; - for_each_node_by_name(dp, "sbi") { - int devid = of_getintprop_default(dp, "device-id", 0); - int board = of_getintprop_default(dp, "board#", 0); - unsigned int mask; - - set_sbi_tid(devid, target_cpu << 3); - board_to_cpu[board] = target_cpu; - - /* Get rid of pending irqs from PROM */ - mask = acquire_sbi(devid, 0xffffffff); - if (mask) { - printk(KERN_ERR "Clearing pending IRQs %08x on SBI %d\n", - mask, board); - release_sbi(devid, mask); - } - } -} - -void __init sun4d_init_IRQ(void) -{ - local_irq_disable(); - - sparc_config.init_timers = sun4d_init_timers; - sparc_config.build_device_irq = sun4d_build_device_irq; - sparc_config.clock_rate = SBUS_CLOCK_RATE; - sparc_config.clear_clock_irq = sun4d_clear_clock_irq; - sparc_config.load_profile_irq = sun4d_load_profile_irq; - - /* Cannot enable interrupts until OBP ticker is disabled. */ -} diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index be5bcbee1af4..7f49a8fa3e3a 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -65,7 +65,6 @@ void sun4d_cpu_pre_starting(void *arg) void sun4d_cpu_pre_online(void *arg) { - unsigned long flags; int cpuid; cpuid = hard_smp_processor_id(); @@ -103,9 +102,7 @@ void sun4d_cpu_pre_online(void *arg) while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) barrier(); - spin_lock_irqsave(&sun4d_imsk_lock, flags); cc_set_imsk(cc_get_imsk() & ~0x4000); /* Allow PIL 14 as well */ - spin_unlock_irqrestore(&sun4d_imsk_lock, flags); } /* @@ -177,7 +174,6 @@ void __init smp4d_smp_done(void) /* Ok, they are spinning and ready to go. */ smp_processors_ready = 1; - sun4d_distribute_irqs(); } /* Memory structure giving interrupt handler information about IPI generated */ diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c index 1079638986b5..1a220a2b9ac3 100644 --- a/arch/sparc/kernel/sun4m_irq.c +++ b/arch/sparc/kernel/sun4m_irq.c @@ -187,103 +187,6 @@ static unsigned long sun4m_imask[0x50] = { 0, SUN4M_INT_VME(6), 0, 0 }; -static void sun4m_mask_irq(struct irq_data *data) -{ - struct sun4m_handler_data *handler_data; - int cpu = smp_processor_id(); - - handler_data = irq_data_get_irq_handler_data(data); - if (handler_data->mask) { - unsigned long flags; - - local_irq_save(flags); - if (handler_data->percpu) { - sbus_writel(handler_data->mask, &sun4m_irq_percpu[cpu]->set); - } else { - sbus_writel(handler_data->mask, &sun4m_irq_global->mask_set); - } - local_irq_restore(flags); - } -} - -static void sun4m_unmask_irq(struct irq_data *data) -{ - struct sun4m_handler_data *handler_data; - int cpu = smp_processor_id(); - - handler_data = irq_data_get_irq_handler_data(data); - if (handler_data->mask) { - unsigned long flags; - - local_irq_save(flags); - if (handler_data->percpu) { - sbus_writel(handler_data->mask, &sun4m_irq_percpu[cpu]->clear); - } else { - sbus_writel(handler_data->mask, &sun4m_irq_global->mask_clear); - } - local_irq_restore(flags); - } -} - -static unsigned int sun4m_startup_irq(struct irq_data *data) -{ - irq_link(data->irq); - sun4m_unmask_irq(data); - return 0; -} - -static void sun4m_shutdown_irq(struct irq_data *data) -{ - sun4m_mask_irq(data); - irq_unlink(data->irq); -} - -static struct irq_chip sun4m_irq = { - .name = "sun4m", - .irq_startup = sun4m_startup_irq, - .irq_shutdown = sun4m_shutdown_irq, - .irq_mask = sun4m_mask_irq, - .irq_unmask = sun4m_unmask_irq, -}; - - -static unsigned int sun4m_build_device_irq(struct platform_device *op, - unsigned int real_irq) -{ - struct sun4m_handler_data *handler_data; - unsigned int irq; - unsigned int pil; - - if (real_irq >= OBP_INT_LEVEL_VME) { - prom_printf("Bogus sun4m IRQ %u\n", real_irq); - prom_halt(); - } - pil = (real_irq & 0xf); - irq = irq_alloc(real_irq, pil); - - if (irq == 0) - goto out; - - handler_data = irq_get_handler_data(irq); - if (unlikely(handler_data)) - goto out; - - handler_data = kzalloc(sizeof(struct sun4m_handler_data), GFP_ATOMIC); - if (unlikely(!handler_data)) { - prom_printf("IRQ: kzalloc(sun4m_handler_data) failed.\n"); - prom_halt(); - } - - handler_data->mask = sun4m_imask[real_irq]; - handler_data->percpu = real_irq < OBP_INT_LEVEL_ONBOARD; - irq_set_chip_and_handler_name(irq, &sun4m_irq, - handle_level_irq, "level"); - irq_set_handler_data(irq, handler_data); - -out: - return irq; -} - struct sun4m_timer_percpu { u32 l14_limit; u32 l14_count; @@ -293,21 +196,6 @@ struct sun4m_timer_percpu { static struct sun4m_timer_percpu __iomem *timers_percpu[SUN4M_NCPUS]; -struct sun4m_timer_global { - u32 l10_limit; - u32 l10_count; - u32 l10_limit_noclear; - u32 reserved; - u32 timer_config; -}; - -static struct sun4m_timer_global __iomem *timers_global; - -static void sun4m_clear_clock_irq(void) -{ - sbus_readl(&timers_global->l10_limit); -} - void sun4m_nmi(struct pt_regs *regs) { unsigned long afsr, afar, si; @@ -348,131 +236,3 @@ void sun4m_clear_profile_irq(int cpu) { sbus_readl(&timers_percpu[cpu]->l14_limit); } - -static void sun4m_load_profile_irq(int cpu, unsigned int limit) -{ - unsigned int value = limit ? timer_value(limit) : 0; - sbus_writel(value, &timers_percpu[cpu]->l14_limit); -} - -static void __init sun4m_init_timers(void) -{ - struct device_node *dp = of_find_node_by_name(NULL, "counter"); - int i, err, len, num_cpu_timers; - unsigned int irq; - const u32 *addr; - - if (!dp) { - printk(KERN_ERR "sun4m_init_timers: No 'counter' node.\n"); - return; - } - - addr = of_get_property(dp, "address", &len); - of_node_put(dp); - if (!addr) { - printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n"); - return; - } - - num_cpu_timers = (len / sizeof(u32)) - 1; - for (i = 0; i < num_cpu_timers; i++) { - timers_percpu[i] = (void __iomem *) - (unsigned long) addr[i]; - } - timers_global = (void __iomem *) - (unsigned long) addr[num_cpu_timers]; - - /* Every per-cpu timer works in timer mode */ - sbus_writel(0x00000000, &timers_global->timer_config); - -#ifdef CONFIG_SMP - sparc_config.cs_period = SBUS_CLOCK_RATE * 2; /* 2 seconds */ - sparc_config.features |= FEAT_L14_ONESHOT; -#else - sparc_config.cs_period = SBUS_CLOCK_RATE / HZ; /* 1/HZ sec */ - sparc_config.features |= FEAT_L10_CLOCKEVENT; -#endif - sparc_config.features |= FEAT_L10_CLOCKSOURCE; - sbus_writel(timer_value(sparc_config.cs_period), - &timers_global->l10_limit); - - master_l10_counter = &timers_global->l10_count; - - irq = sun4m_build_device_irq(NULL, SUN4M_TIMER_IRQ); - - err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL); - if (err) { - printk(KERN_ERR "sun4m_init_timers: Register IRQ error %d.\n", - err); - return; - } - - for (i = 0; i < num_cpu_timers; i++) - sbus_writel(0, &timers_percpu[i]->l14_limit); - if (num_cpu_timers == 4) - sbus_writel(SUN4M_INT_E14, &sun4m_irq_global->mask_set); - -#ifdef CONFIG_SMP - { - unsigned long flags; - struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (14 - 1)]; - - /* For SMP we use the level 14 ticker, however the bootup code - * has copied the firmware's level 14 vector into the boot cpu's - * trap table, we must fix this now or we get squashed. - */ - local_irq_save(flags); - trap_table->inst_one = lvl14_save[0]; - trap_table->inst_two = lvl14_save[1]; - trap_table->inst_three = lvl14_save[2]; - trap_table->inst_four = lvl14_save[3]; - local_ops->cache_all(); - local_irq_restore(flags); - } -#endif -} - -void __init sun4m_init_IRQ(void) -{ - struct device_node *dp = of_find_node_by_name(NULL, "interrupt"); - int len, i, mid, num_cpu_iregs; - const u32 *addr; - - if (!dp) { - printk(KERN_ERR "sun4m_init_IRQ: No 'interrupt' node.\n"); - return; - } - - addr = of_get_property(dp, "address", &len); - of_node_put(dp); - if (!addr) { - printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n"); - return; - } - - num_cpu_iregs = (len / sizeof(u32)) - 1; - for (i = 0; i < num_cpu_iregs; i++) { - sun4m_irq_percpu[i] = (void __iomem *) - (unsigned long) addr[i]; - } - sun4m_irq_global = (void __iomem *) - (unsigned long) addr[num_cpu_iregs]; - - local_irq_disable(); - - sbus_writel(~SUN4M_INT_MASKALL, &sun4m_irq_global->mask_set); - for (i = 0; !cpu_find_by_instance(i, NULL, &mid); i++) - sbus_writel(~0x17fff, &sun4m_irq_percpu[mid]->clear); - - if (num_cpu_iregs == 4) - sbus_writel(0, &sun4m_irq_global->interrupt_target); - - sparc_config.init_timers = sun4m_init_timers; - sparc_config.build_device_irq = sun4m_build_device_irq; - sparc_config.clock_rate = SBUS_CLOCK_RATE; - sparc_config.clear_clock_irq = sun4m_clear_clock_irq; - sparc_config.load_profile_irq = sun4m_load_profile_irq; - - - /* Cannot enable interrupts until OBP ticker is disabled. */ -} diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index d8376f61b4d0..d94d7868feb9 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -86,8 +86,6 @@ static int __init iounit_init(void) of_propagate_archdata(op); } - sun4d_init_sbi_irq(); - return 0; } From patchwork Tue Dec 19 22:03:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756351 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49C3E3D0DB; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dUTwfWie" Received: by smtp.kernel.org (Postfix) with ESMTPS id EE041C433B9; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=huiMpkwCPA0+47L18G3Y37vOB9/Ge54twJwxwyUgUhU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dUTwfWieToIdTv+xnLgNLoFuHf6lnx785460CtvnNOLZdiNRx4gMQeFyrKdgXvmH0 cviiHmNhk6IiLpWyGADYhOfRAtag3qHW3pKNms2DZ8moox5UrH7SRBE8ky8utlaZy4 iPCjz5wvm3xDkFmqDY+QK6yeXyBnikl9L1QqCsg7c1r+UEEMvWiSNioTsoI+ndBTvu FrSA+sKlKSOMcirWVH6Cm1fjoX4DxcGVI7MSwGCAwsQRMTnGKCuTo/jLSdeyhZcrFH sxli0js2yAJEJh5JuwETwvXKoI3IdIxsfmCRMMP+NgPgwrUeGRKubqdRBeWhlNfjHX qlg2180y+7CcA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD735C46CD2; Tue, 19 Dec 2023 22:03:15 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:15 +0100 Subject: [PATCH 10/27] sparc32: Drop sun4d/sun4m smp support Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-10-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=23433; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=ME/4X/PQGX067nF09Gwhl6gdZaaSxbz9WLxv9vfSrNo=; =?utf-8?q?b=3DmjLegQQ1mua0?= =?utf-8?q?A7ha8sR4MDlj0nGXvbhG6WmoBYEmjlvBGP2t0DnzISA1Kqpgeszjj+i+iLeYi+5n?= JJ/sZA72Brs42o34CI0Zdtu6MWCD5htPz13y2rr/edCqp50j9pYe X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Drop the sun4m and sun4d smp support code. The sparc32 kernel will not boot unless this is a LEON system, so drop checks for other systems as they will not trigger. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/kernel/Makefile | 2 +- arch/sparc/kernel/kernel.h | 18 -- arch/sparc/kernel/smp_32.c | 102 +---------- arch/sparc/kernel/sun4d_smp.c | 408 ------------------------------------------ arch/sparc/kernel/sun4m_smp.c | 275 ---------------------------- arch/sparc/mm/srmmu.c | 10 +- 6 files changed, 8 insertions(+), 807 deletions(-) diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index e79ef2049ea2..386bbb30fff2 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -80,7 +80,7 @@ obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o obj-$(CONFIG_SPARC_GRPCI1)+= leon_pci_grpci1.o obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o -obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o +obj-$(CONFIG_SPARC32_SMP) += leon_smp.o obj-$(CONFIG_SPARC64_SMP) += hvtramp.o obj-$(CONFIG_SPARC64) += auxio_64.o diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index f090d34a2f56..ff8f412e3153 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -96,24 +96,6 @@ void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); void sun4m_unmask_profile_irq(void); void sun4m_clear_profile_irq(int cpu); -/* sun4m_smp.c */ -void sun4m_cpu_pre_starting(void *arg); -void sun4m_cpu_pre_online(void *arg); -void __init smp4m_boot_cpus(void); -int smp4m_boot_one_cpu(int i, struct task_struct *idle); -void __init smp4m_smp_done(void); -void smp4m_cross_call_irq(void); -void smp4m_percpu_timer_interrupt(struct pt_regs *regs); - -/* sun4d_smp.c */ -void sun4d_cpu_pre_starting(void *arg); -void sun4d_cpu_pre_online(void *arg); -void __init smp4d_boot_cpus(void); -int smp4d_boot_one_cpu(int i, struct task_struct *idle); -void __init smp4d_smp_done(void); -void smp4d_cross_call_irq(void); -void smp4d_percpu_timer_interrupt(struct pt_regs *regs); - /* leon_smp.c */ void leon_cpu_pre_starting(void *arg); void leon_cpu_pre_online(void *arg); diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c index 87eaa7719fa2..42fb90577a82 100644 --- a/arch/sparc/kernel/smp_32.c +++ b/arch/sparc/kernel/smp_32.c @@ -87,29 +87,7 @@ void __init smp_cpus_done(unsigned int max_cpus) num, bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); - switch(sparc_cpu_model) { - case sun4m: - smp4m_smp_done(); - break; - case sun4d: - smp4d_smp_done(); - break; - case sparc_leon: - leon_smp_done(); - break; - case sun4e: - printk("SUN4E\n"); - BUG(); - break; - case sun4u: - printk("SUN4U\n"); - BUG(); - break; - default: - printk("UNKNOWN!\n"); - BUG(); - break; - } + leon_smp_done(); } void cpu_panic(void) @@ -191,29 +169,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) smp_store_cpu_info(boot_cpu_id); - switch(sparc_cpu_model) { - case sun4m: - smp4m_boot_cpus(); - break; - case sun4d: - smp4d_boot_cpus(); - break; - case sparc_leon: - leon_boot_cpus(); - break; - case sun4e: - printk("SUN4E\n"); - BUG(); - break; - case sun4u: - printk("SUN4U\n"); - BUG(); - break; - default: - printk("UNKNOWN!\n"); - BUG(); - break; - } + leon_boot_cpus(); } /* Set this up early so that things like the scheduler can init @@ -252,31 +208,7 @@ void __init smp_prepare_boot_cpu(void) int __cpu_up(unsigned int cpu, struct task_struct *tidle) { - int ret=0; - - switch(sparc_cpu_model) { - case sun4m: - ret = smp4m_boot_one_cpu(cpu, tidle); - break; - case sun4d: - ret = smp4d_boot_one_cpu(cpu, tidle); - break; - case sparc_leon: - ret = leon_boot_one_cpu(cpu, tidle); - break; - case sun4e: - printk("SUN4E\n"); - BUG(); - break; - case sun4u: - printk("SUN4U\n"); - BUG(); - break; - default: - printk("UNKNOWN!\n"); - BUG(); - break; - } + int ret = leon_boot_one_cpu(cpu, tidle); if (!ret) { cpumask_set_cpu(cpu, &smp_commenced_mask); @@ -291,19 +223,7 @@ static void arch_cpu_pre_starting(void *arg) local_ops->cache_all(); local_ops->tlb_all(); - switch(sparc_cpu_model) { - case sun4m: - sun4m_cpu_pre_starting(arg); - break; - case sun4d: - sun4d_cpu_pre_starting(arg); - break; - case sparc_leon: - leon_cpu_pre_starting(arg); - break; - default: - BUG(); - } + leon_cpu_pre_starting(arg); } static void arch_cpu_pre_online(void *arg) @@ -318,19 +238,7 @@ static void arch_cpu_pre_online(void *arg) local_ops->cache_all(); local_ops->tlb_all(); - switch(sparc_cpu_model) { - case sun4m: - sun4m_cpu_pre_online(arg); - break; - case sun4d: - sun4d_cpu_pre_online(arg); - break; - case sparc_leon: - leon_cpu_pre_online(arg); - break; - default: - BUG(); - } + leon_cpu_pre_online(arg); } static void sparc_start_secondary(void *arg) diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c deleted file mode 100644 index 7f49a8fa3e3a..000000000000 --- a/arch/sparc/kernel/sun4d_smp.c +++ /dev/null @@ -1,408 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Sparc SS1000/SC2000 SMP support. - * - * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * - * Based on sun4m's smp.c, which is: - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "kernel.h" -#include "irq.h" - -#define IRQ_CROSS_CALL 15 - -static volatile int smp_processors_ready; -static int smp_highest_cpu; - -static inline unsigned long sun4d_swap(volatile unsigned long *ptr, unsigned long val) -{ - __asm__ __volatile__("swap [%1], %0\n\t" : - "=&r" (val), "=&r" (ptr) : - "0" (val), "1" (ptr)); - return val; -} - -static void smp4d_ipi_init(void); - -static unsigned char cpu_leds[32]; - -static inline void show_leds(int cpuid) -{ - cpuid &= 0x1e; - __asm__ __volatile__ ("stba %0, [%1] %2" : : - "r" ((cpu_leds[cpuid] << 4) | cpu_leds[cpuid+1]), - "r" (ECSR_BASE(cpuid) | BB_LEDS), - "i" (ASI_M_CTL)); -} - -void sun4d_cpu_pre_starting(void *arg) -{ - int cpuid = hard_smp_processor_id(); - - /* Show we are alive */ - cpu_leds[cpuid] = 0x6; - show_leds(cpuid); - - /* Enable level15 interrupt, disable level14 interrupt for now */ - cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000); -} - -void sun4d_cpu_pre_online(void *arg) -{ - int cpuid; - - cpuid = hard_smp_processor_id(); - - /* Unblock the master CPU _only_ when the scheduler state - * of all secondary CPUs will be up-to-date, so after - * the SMP initialization the master will be just allowed - * to call the scheduler code. - */ - sun4d_swap((unsigned long *)&cpu_callin_map[cpuid], 1); - local_ops->cache_all(); - local_ops->tlb_all(); - - while ((unsigned long)current_set[cpuid] < PAGE_OFFSET) - barrier(); - - while (current_set[cpuid]->cpu != cpuid) - barrier(); - - /* Fix idle thread fields. */ - __asm__ __volatile__("ld [%0], %%g6\n\t" - : : "r" (¤t_set[cpuid]) - : "memory" /* paranoid */); - - cpu_leds[cpuid] = 0x9; - show_leds(cpuid); - - /* Attach to the address space of init_task. */ - mmgrab(&init_mm); - current->active_mm = &init_mm; - - local_ops->cache_all(); - local_ops->tlb_all(); - - while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) - barrier(); - - cc_set_imsk(cc_get_imsk() & ~0x4000); /* Allow PIL 14 as well */ -} - -/* - * Cycle through the processors asking the PROM to start each one. - */ -void __init smp4d_boot_cpus(void) -{ - smp4d_ipi_init(); - if (boot_cpu_id) - current_set[0] = NULL; - local_ops->cache_all(); -} - -int smp4d_boot_one_cpu(int i, struct task_struct *idle) -{ - unsigned long *entry = &sun4d_cpu_startup; - int timeout; - int cpu_node; - - cpu_find_by_instance(i, &cpu_node, NULL); - current_set[i] = task_thread_info(idle); - /* - * Initialize the contexts table - * Since the call to prom_startcpu() trashes the structure, - * we need to re-initialize it for each cpu - */ - smp_penguin_ctable.which_io = 0; - smp_penguin_ctable.phys_addr = (unsigned int) srmmu_ctx_table_phys; - smp_penguin_ctable.reg_size = 0; - - /* whirrr, whirrr, whirrrrrrrrr... */ - printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); - local_ops->cache_all(); - prom_startcpu(cpu_node, - &smp_penguin_ctable, 0, (char *)entry); - - printk(KERN_INFO "prom_startcpu returned :)\n"); - - /* wheee... it's going... */ - for (timeout = 0; timeout < 10000; timeout++) { - if (cpu_callin_map[i]) - break; - udelay(200); - } - - if (!(cpu_callin_map[i])) { - printk(KERN_ERR "Processor %d is stuck.\n", i); - return -ENODEV; - - } - local_ops->cache_all(); - return 0; -} - -void __init smp4d_smp_done(void) -{ - int i, first; - int *prev; - - /* setup cpu list for irq rotation */ - first = 0; - prev = &first; - for_each_online_cpu(i) { - *prev = i; - prev = &cpu_data(i).next; - } - *prev = first; - local_ops->cache_all(); - - /* Ok, they are spinning and ready to go. */ - smp_processors_ready = 1; -} - -/* Memory structure giving interrupt handler information about IPI generated */ -struct sun4d_ipi_work { - int single; - int msk; - int resched; -}; - -static DEFINE_PER_CPU_SHARED_ALIGNED(struct sun4d_ipi_work, sun4d_ipi_work); - -/* Initialize IPIs on the SUN4D SMP machine */ -static void __init smp4d_ipi_init(void) -{ - int cpu; - struct sun4d_ipi_work *work; - - printk(KERN_INFO "smp4d: setup IPI at IRQ %d\n", SUN4D_IPI_IRQ); - - for_each_possible_cpu(cpu) { - work = &per_cpu(sun4d_ipi_work, cpu); - work->single = work->msk = work->resched = 0; - } -} - -void sun4d_ipi_interrupt(void) -{ - struct sun4d_ipi_work *work = this_cpu_ptr(&sun4d_ipi_work); - - if (work->single) { - work->single = 0; - smp_call_function_single_interrupt(); - } - if (work->msk) { - work->msk = 0; - smp_call_function_interrupt(); - } - if (work->resched) { - work->resched = 0; - smp_resched_interrupt(); - } -} - -/* +-------+-------------+-----------+------------------------------------+ - * | bcast | devid | sid | levels mask | - * +-------+-------------+-----------+------------------------------------+ - * 31 30 23 22 15 14 0 - */ -#define IGEN_MESSAGE(bcast, devid, sid, levels) \ - (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) - -static void sun4d_send_ipi(int cpu, int level) -{ - cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); -} - -static void sun4d_ipi_single(int cpu) -{ - struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); - - /* Mark work */ - work->single = 1; - - /* Generate IRQ on the CPU */ - sun4d_send_ipi(cpu, SUN4D_IPI_IRQ); -} - -static void sun4d_ipi_mask_one(int cpu) -{ - struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); - - /* Mark work */ - work->msk = 1; - - /* Generate IRQ on the CPU */ - sun4d_send_ipi(cpu, SUN4D_IPI_IRQ); -} - -static void sun4d_ipi_resched(int cpu) -{ - struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); - - /* Mark work */ - work->resched = 1; - - /* Generate IRQ on the CPU (any IRQ will cause resched) */ - sun4d_send_ipi(cpu, SUN4D_IPI_IRQ); -} - -static struct smp_funcall { - void *func; - unsigned long arg1; - unsigned long arg2; - unsigned long arg3; - unsigned long arg4; - unsigned long arg5; - unsigned char processors_in[NR_CPUS]; /* Set when ipi entered. */ - unsigned char processors_out[NR_CPUS]; /* Set when ipi exited. */ -} ccall_info __attribute__((aligned(8))); - -static DEFINE_SPINLOCK(cross_call_lock); - -/* Cross calls must be serialized, at least currently. */ -static void sun4d_cross_call(void *func, cpumask_t mask, unsigned long arg1, - unsigned long arg2, unsigned long arg3, - unsigned long arg4) -{ - if (smp_processors_ready) { - register int high = smp_highest_cpu; - unsigned long flags; - - spin_lock_irqsave(&cross_call_lock, flags); - - { - /* - * If you make changes here, make sure - * gcc generates proper code... - */ - register void *f asm("i0") = func; - register unsigned long a1 asm("i1") = arg1; - register unsigned long a2 asm("i2") = arg2; - register unsigned long a3 asm("i3") = arg3; - register unsigned long a4 asm("i4") = arg4; - register unsigned long a5 asm("i5") = 0; - - __asm__ __volatile__( - "std %0, [%6]\n\t" - "std %2, [%6 + 8]\n\t" - "std %4, [%6 + 16]\n\t" : : - "r"(f), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), - "r" (&ccall_info.func)); - } - - /* Init receive/complete mapping, plus fire the IPI's off. */ - { - register int i; - - cpumask_clear_cpu(smp_processor_id(), &mask); - cpumask_and(&mask, cpu_online_mask, &mask); - for (i = 0; i <= high; i++) { - if (cpumask_test_cpu(i, &mask)) { - ccall_info.processors_in[i] = 0; - ccall_info.processors_out[i] = 0; - sun4d_send_ipi(i, IRQ_CROSS_CALL); - } - } - } - - { - register int i; - - i = 0; - do { - if (!cpumask_test_cpu(i, &mask)) - continue; - while (!ccall_info.processors_in[i]) - barrier(); - } while (++i <= high); - - i = 0; - do { - if (!cpumask_test_cpu(i, &mask)) - continue; - while (!ccall_info.processors_out[i]) - barrier(); - } while (++i <= high); - } - - spin_unlock_irqrestore(&cross_call_lock, flags); - } -} - -/* Running cross calls. */ -void smp4d_cross_call_irq(void) -{ - void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, - unsigned long) = ccall_info.func; - int i = hard_smp_processor_id(); - - ccall_info.processors_in[i] = 1; - func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, - ccall_info.arg5); - ccall_info.processors_out[i] = 1; -} - -void smp4d_percpu_timer_interrupt(struct pt_regs *regs) -{ - struct pt_regs *old_regs; - int cpu = hard_smp_processor_id(); - struct clock_event_device *ce; - static int cpu_tick[NR_CPUS]; - static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; - - old_regs = set_irq_regs(regs); - bw_get_prof_limit(cpu); - bw_clear_intr_mask(0, 1); /* INTR_TABLE[0] & 1 is Profile IRQ */ - - cpu_tick[cpu]++; - if (!(cpu_tick[cpu] & 15)) { - if (cpu_tick[cpu] == 0x60) - cpu_tick[cpu] = 0; - cpu_leds[cpu] = led_mask[cpu_tick[cpu] >> 4]; - show_leds(cpu); - } - - ce = &per_cpu(sparc32_clockevent, cpu); - - irq_enter(); - ce->event_handler(ce); - irq_exit(); - - set_irq_regs(old_regs); -} - -static const struct sparc32_ipi_ops sun4d_ipi_ops = { - .cross_call = sun4d_cross_call, - .resched = sun4d_ipi_resched, - .single = sun4d_ipi_single, - .mask_one = sun4d_ipi_mask_one, -}; - -void __init sun4d_init_smp(void) -{ - int i; - - sparc32_ipi_ops = &sun4d_ipi_ops; - - for (i = 0; i < NR_CPUS; i++) { - ccall_info.processors_in[i] = 1; - ccall_info.processors_out[i] = 1; - } -} diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c deleted file mode 100644 index 056df034e79e..000000000000 --- a/arch/sparc/kernel/sun4m_smp.c +++ /dev/null @@ -1,275 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * sun4m SMP support. - * - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "irq.h" -#include "kernel.h" - -#define IRQ_IPI_SINGLE 12 -#define IRQ_IPI_MASK 13 -#define IRQ_IPI_RESCHED 14 -#define IRQ_CROSS_CALL 15 - -static inline unsigned long -swap_ulong(volatile unsigned long *ptr, unsigned long val) -{ - __asm__ __volatile__("swap [%1], %0\n\t" : - "=&r" (val), "=&r" (ptr) : - "0" (val), "1" (ptr)); - return val; -} - -void sun4m_cpu_pre_starting(void *arg) -{ -} - -void sun4m_cpu_pre_online(void *arg) -{ - int cpuid = hard_smp_processor_id(); - - /* Allow master to continue. The master will then give us the - * go-ahead by setting the smp_commenced_mask and will wait without - * timeouts until our setup is completed fully (signified by - * our bit being set in the cpu_online_mask). - */ - swap_ulong(&cpu_callin_map[cpuid], 1); - - /* XXX: What's up with all the flushes? */ - local_ops->cache_all(); - local_ops->tlb_all(); - - /* Fix idle thread fields. */ - __asm__ __volatile__("ld [%0], %%g6\n\t" - : : "r" (¤t_set[cpuid]) - : "memory" /* paranoid */); - - /* Attach to the address space of init_task. */ - mmgrab(&init_mm); - current->active_mm = &init_mm; - - while (!cpumask_test_cpu(cpuid, &smp_commenced_mask)) - mb(); -} - -/* - * Cycle through the processors asking the PROM to start each one. - */ -void __init smp4m_boot_cpus(void) -{ - sun4m_unmask_profile_irq(); - local_ops->cache_all(); -} - -int smp4m_boot_one_cpu(int i, struct task_struct *idle) -{ - unsigned long *entry = &sun4m_cpu_startup; - int timeout; - int cpu_node; - - cpu_find_by_mid(i, &cpu_node); - current_set[i] = task_thread_info(idle); - - /* See trampoline.S for details... */ - entry += ((i - 1) * 3); - - /* - * Initialize the contexts table - * Since the call to prom_startcpu() trashes the structure, - * we need to re-initialize it for each cpu - */ - smp_penguin_ctable.which_io = 0; - smp_penguin_ctable.phys_addr = (unsigned int) srmmu_ctx_table_phys; - smp_penguin_ctable.reg_size = 0; - - /* whirrr, whirrr, whirrrrrrrrr... */ - printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); - local_ops->cache_all(); - prom_startcpu(cpu_node, &smp_penguin_ctable, 0, (char *)entry); - - /* wheee... it's going... */ - for (timeout = 0; timeout < 10000; timeout++) { - if (cpu_callin_map[i]) - break; - udelay(200); - } - - if (!(cpu_callin_map[i])) { - printk(KERN_ERR "Processor %d is stuck.\n", i); - return -ENODEV; - } - - local_ops->cache_all(); - return 0; -} - -void __init smp4m_smp_done(void) -{ - int i, first; - int *prev; - - /* setup cpu list for irq rotation */ - first = 0; - prev = &first; - for_each_online_cpu(i) { - *prev = i; - prev = &cpu_data(i).next; - } - *prev = first; - local_ops->cache_all(); - - /* Ok, they are spinning and ready to go. */ -} - -static void sun4m_send_ipi(int cpu, int level) -{ - sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->set); -} - -static void sun4m_ipi_resched(int cpu) -{ - sun4m_send_ipi(cpu, IRQ_IPI_RESCHED); -} - -static void sun4m_ipi_single(int cpu) -{ - sun4m_send_ipi(cpu, IRQ_IPI_SINGLE); -} - -static void sun4m_ipi_mask_one(int cpu) -{ - sun4m_send_ipi(cpu, IRQ_IPI_MASK); -} - -static struct smp_funcall { - void *func; - unsigned long arg1; - unsigned long arg2; - unsigned long arg3; - unsigned long arg4; - unsigned long arg5; - unsigned long processors_in[SUN4M_NCPUS]; /* Set when ipi entered. */ - unsigned long processors_out[SUN4M_NCPUS]; /* Set when ipi exited. */ -} ccall_info; - -static DEFINE_SPINLOCK(cross_call_lock); - -/* Cross calls must be serialized, at least currently. */ -static void sun4m_cross_call(void *func, cpumask_t mask, unsigned long arg1, - unsigned long arg2, unsigned long arg3, - unsigned long arg4) -{ - register int ncpus = SUN4M_NCPUS; - unsigned long flags; - - spin_lock_irqsave(&cross_call_lock, flags); - - /* Init function glue. */ - ccall_info.func = func; - ccall_info.arg1 = arg1; - ccall_info.arg2 = arg2; - ccall_info.arg3 = arg3; - ccall_info.arg4 = arg4; - ccall_info.arg5 = 0; - - /* Init receive/complete mapping, plus fire the IPI's off. */ - { - register int i; - - cpumask_clear_cpu(smp_processor_id(), &mask); - cpumask_and(&mask, cpu_online_mask, &mask); - for (i = 0; i < ncpus; i++) { - if (cpumask_test_cpu(i, &mask)) { - ccall_info.processors_in[i] = 0; - ccall_info.processors_out[i] = 0; - sun4m_send_ipi(i, IRQ_CROSS_CALL); - } else { - ccall_info.processors_in[i] = 1; - ccall_info.processors_out[i] = 1; - } - } - } - - { - register int i; - - i = 0; - do { - if (!cpumask_test_cpu(i, &mask)) - continue; - while (!ccall_info.processors_in[i]) - barrier(); - } while (++i < ncpus); - - i = 0; - do { - if (!cpumask_test_cpu(i, &mask)) - continue; - while (!ccall_info.processors_out[i]) - barrier(); - } while (++i < ncpus); - } - spin_unlock_irqrestore(&cross_call_lock, flags); -} - -/* Running cross calls. */ -void smp4m_cross_call_irq(void) -{ - void (*func)(unsigned long, unsigned long, unsigned long, unsigned long, - unsigned long) = ccall_info.func; - int i = smp_processor_id(); - - ccall_info.processors_in[i] = 1; - func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, ccall_info.arg4, - ccall_info.arg5); - ccall_info.processors_out[i] = 1; -} - -void smp4m_percpu_timer_interrupt(struct pt_regs *regs) -{ - struct pt_regs *old_regs; - struct clock_event_device *ce; - int cpu = smp_processor_id(); - - old_regs = set_irq_regs(regs); - - ce = &per_cpu(sparc32_clockevent, cpu); - - if (clockevent_state_periodic(ce)) - sun4m_clear_profile_irq(cpu); - else - sparc_config.load_profile_irq(cpu, 0); /* Is this needless? */ - - irq_enter(); - ce->event_handler(ce); - irq_exit(); - - set_irq_regs(old_regs); -} - -static const struct sparc32_ipi_ops sun4m_ipi_ops = { - .cross_call = sun4m_cross_call, - .resched = sun4m_ipi_resched, - .single = sun4m_ipi_single, - .mask_one = sun4m_ipi_mask_one, -}; - -void __init sun4m_init_smp(void) -{ - sparc32_ipi_ops = &sun4m_ipi_ops; -} diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 8393faa3e596..b00683d65592 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1816,14 +1816,8 @@ void __init load_mmu(void) &smp_cachetlb_ops; #endif - if (sparc_cpu_model != sun4d) - ld_mmu_iommu(); + ld_mmu_iommu(); #ifdef CONFIG_SMP - if (sparc_cpu_model == sun4d) - sun4d_init_smp(); - else if (sparc_cpu_model == sparc_leon) - leon_init_smp(); - else - sun4m_init_smp(); + leon_init_smp(); #endif } From patchwork Tue Dec 19 22:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756352 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DED63D3A0; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MHVtZ4qZ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 19DB3C433C9; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=dKuKJfEimO4hO2eTnf/PpJF3R3m4iQkMndh7L8fiYrs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=MHVtZ4qZQ8E3mUQMuKCLTEtCDPUaHv6SF8UKHdl9yuT9I/06tRXi3gq90f9vVDI36 dswz38mvMB1QYCRuT3ZzDUJ5fIpY4Y7V46/gnayZhNjw6TgesvdHPmLJdyGOVsfVE0 WshGnmwFR1+T+YUs2kiG4+M/Y6YOOyjWx1KxkSbVtMn/+q2Ot4++aeCqy0Dcn/yBPA XX6/6ABxnL7QapDoLgON0+ZxY/uOn6Ka30mBDfoM3Hrq6m+PP34Ru9rGXI5vxQS3A5 z19Gc37+2WLq97fEw2WAE1USrFZLx/r0oWOzpaMmsgKfTx60RyDllwX0NbtCh5CJ6N atn3yQ+jmNpSg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AD9BC4706D; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:18 +0100 Subject: [PATCH 13/27] sparc32: Drop unused function __get_{phys,iospace} Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-13-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=1970; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=E0Vh64/XjG0Um8pqx4pfsGK0FeX+R72wUc/BzUbmKDY=; =?utf-8?q?b=3DwcpWwsTyWY02?= =?utf-8?q?ja6To5kFELiblsY7eCvn92LTyIteU8JScRw9rKK4BLrishuuIo6zaZGwblJuujCO?= W7KiPfkCDAA5sPkUC1yGvZPC9BwmwtiJohyPHsK3jjTfRswBiRbl X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Not used and references stuff that will be dropped later. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/include/asm/pgtable_32.h | 24 ------------------------ arch/sparc/include/asm/pgtsrmmu.h | 11 ----------- 2 files changed, 35 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 9e85d57ac3f2..92b063531d5c 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -368,30 +368,6 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) return __pte(pte_val(pte) & ~SRMMU_SWP_EXCLUSIVE); } -static inline unsigned long -__get_phys (unsigned long addr) -{ - switch (sparc_cpu_model){ - case sun4m: - case sun4d: - return ((srmmu_get_pte (addr) & 0xffffff00) << 4); - default: - return 0; - } -} - -static inline int -__get_iospace (unsigned long addr) -{ - switch (sparc_cpu_model){ - case sun4m: - case sun4d: - return (srmmu_get_pte (addr) >> 28); - default: - return -1; - } -} - /* * For sparc32&64, the pfn in io_remap_pfn_range() carries in * its high 4 bits. These macros/functions put it there or get it from there. diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h index 18e68d43f036..7cb5cbc83211 100644 --- a/arch/sparc/include/asm/pgtsrmmu.h +++ b/arch/sparc/include/asm/pgtsrmmu.h @@ -125,17 +125,6 @@ static inline void srmmu_flush_whole_tlb(void) } -static inline int -srmmu_get_pte (unsigned long addr) -{ - register unsigned long entry; - - __asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" : - "=r" (entry): - "r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE)); - return entry; -} - #endif /* !(__ASSEMBLY__) */ #endif /* !(_SPARC_PGTSRMMU_H) */ From patchwork Tue Dec 19 22:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756347 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 719A33FB03; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UXuy/jSM" Received: by smtp.kernel.org (Postfix) with ESMTPS id 36FE9C43140; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=nyYkYuiVqyCR04RXBg22IyXtbGaFXThr3PFMPOtukLY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=UXuy/jSMfjZCEjI1VdiOpjbZNymmaGaZhoOoagGsQ+pQP8OJ3fP0KAdX8ghCvrgyd Uj7a9TILRU24l6U+RHL/ccTCXFXIvNRXuuh79zfg6itRoE0IqJC+UNJ5XZPb9ms8Ls jx60yVpc8iMbmxG9mKZxsF4mRICoLSMMnoKTJtEZcVeQUlpOIEanoAIZ3SrbDxW/gg J3vBaou45/oc5LOIgrbjKyn1kV0oK48e3NawBkC4fK3xx47Pdu1L3837WqFUDw1MLc JPKENcH9MEVeNWxHjC0FdOUjYoOod4Amx5GoFmlTEwKlrVlZr7g5ptURvmLSnHWnYn s8v4UvThze6wQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25E3FC46CD8; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:20 +0100 Subject: [PATCH 15/27] sparc32: Drop check for sparc_model Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-15-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=7589; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=Ug/1kUk7xzX48rBhZcKGw3mgqlUZBCpZ4RMKG+8KP+I=; =?utf-8?q?b=3DbXvVFC5D/ZOI?= =?utf-8?q?dS61qfHNUW1erQ8hUNKMVTRiVKdXtTQ08Rg2XH2GNL3zQHM+NUQrelsZTxUS4hc3?= I2b/ASr1AO20iUlMauOuxsmyi1k/Ey2dEm/cRlWtL7nX9bePme1x X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg sparc32 is always LEON, so no need to check for the model. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/include/asm/cpu_type.h | 18 --------- arch/sparc/include/asm/io_32.h | 4 +- arch/sparc/include/asm/pgtsrmmu.h | 1 - arch/sparc/kernel/devices.c | 7 +--- arch/sparc/kernel/ioport.c | 4 +- arch/sparc/kernel/leon_pmc.c | 16 ++++---- arch/sparc/kernel/setup_32.c | 79 +-------------------------------------- 7 files changed, 12 insertions(+), 117 deletions(-) diff --git a/arch/sparc/include/asm/cpu_type.h b/arch/sparc/include/asm/cpu_type.h index 2b59799859d1..3e0154c3f41d 100644 --- a/arch/sparc/include/asm/cpu_type.h +++ b/arch/sparc/include/asm/cpu_type.h @@ -2,28 +2,10 @@ #ifndef __ASM_CPU_TYPE_H #define __ASM_CPU_TYPE_H -/* - * Sparc (general) CPU types - */ -enum sparc_cpu { - sun4m = 0x00, - sun4d = 0x01, - sun4e = 0x02, - sun4u = 0x03, /* V8 ploos ploos */ - sun_unknown = 0x04, - ap1000 = 0x05, /* almost a sun4m */ - sparc_leon = 0x06, /* Leon SoC */ -}; - #ifdef CONFIG_SPARC32 -extern enum sparc_cpu sparc_cpu_model; #define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ -#else - -#define sparc_cpu_model sun4u - #endif #endif /* __ASM_CPU_TYPE_H */ diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index 549f0a72280d..83abe709d120 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h @@ -138,11 +138,11 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *); static inline int sbus_can_dma_64bit(void) { - return 0; /* actually, sparc_cpu_model==sun4d */ + return 0; } static inline int sbus_can_burst64(void) { - return 0; /* actually, sparc_cpu_model==sun4d */ + return 0; } struct device; void sbus_set_sbus64(struct device *, int); diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h index 7cb5cbc83211..664d4bba1bcb 100644 --- a/arch/sparc/include/asm/pgtsrmmu.h +++ b/arch/sparc/include/asm/pgtsrmmu.h @@ -124,7 +124,6 @@ static inline void srmmu_flush_whole_tlb(void) "i" (ASI_M_FLUSH_PROBE) : "memory"); } - #endif /* !(__ASSEMBLY__) */ #endif /* !(_SPARC_PGTSRMMU_H) */ diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index b3c2d51b22c4..2963e89611a3 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c @@ -26,8 +26,6 @@ static char *cpu_mid_prop(void) { - if (sparc_cpu_model == sun4d) - return "cpu-id"; return "mid"; } @@ -40,8 +38,6 @@ static int check_cpu_node(phandle nd, int *cur_inst, *prom_node = nd; if (mid) { *mid = prom_getintdefault(nd, cpu_mid_prop(), 0); - if (sparc_cpu_model == sun4m) - *mid &= 3; } return 0; } @@ -92,8 +88,7 @@ static int cpu_mid_compare(phandle nd, int instance, void *_arg) int this_mid; this_mid = prom_getintdefault(nd, cpu_mid_prop(), 0); - if (this_mid == desired_mid - || (sparc_cpu_model == sun4m && (this_mid & 3) == desired_mid)) + if (this_mid == desired_mid) return 0; return -ENODEV; } diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 5ebca5c7af1e..cf0ace29704a 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -309,9 +309,7 @@ arch_initcall(sparc_register_ioport); void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, enum dma_data_direction dir) { - if (dir != DMA_TO_DEVICE && - sparc_cpu_model == sparc_leon && - !sparc_leon3_snooping_enabled()) + if (dir != DMA_TO_DEVICE && !sparc_leon3_snooping_enabled()) leon_flush_dcache_all(); } diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c index 6c00cbad7fb5..d4a2d49f941c 100644 --- a/arch/sparc/kernel/leon_pmc.c +++ b/arch/sparc/kernel/leon_pmc.c @@ -79,15 +79,13 @@ static void pmc_leon_idle(void) /* Install LEON Power Down function */ static int __init leon_pmc_install(void) { - if (sparc_cpu_model == sparc_leon) { - /* Assign power management IDLE handler */ - if (pmc_leon_need_fixup()) - sparc_idle = pmc_leon_idle_fixup; - else - sparc_idle = pmc_leon_idle; - - printk(KERN_INFO "leon: power management initialized\n"); - } + /* Assign power management IDLE handler */ + if (pmc_leon_need_fixup()) + sparc_idle = pmc_leon_idle_fixup; + else + sparc_idle = pmc_leon_idle; + + printk(KERN_INFO "leon: power management initialized\n"); return 0; } diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 5a497140c52a..cb981f2794b3 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -189,30 +189,12 @@ static void __init per_cpu_patch(void) { struct cpuid_patch_entry *p; - if (sparc_cpu_model == sun4m) { - /* Nothing to do, this is what the unpatched code - * targets. - */ - return; - } - p = &__cpuid_patch; while (p < &__cpuid_patch_end) { unsigned long addr = p->addr; unsigned int *insns; - switch (sparc_cpu_model) { - case sun4d: - insns = &p->sun4d[0]; - break; - - case sparc_leon: - insns = &p->leon[0]; - break; - default: - prom_printf("Unknown cpu type, halting.\n"); - prom_halt(); - } + insns = &p->leon[0]; *(unsigned int *) (addr + 0) = insns[0]; flushi(addr + 0); *(unsigned int *) (addr + 4) = insns[1]; @@ -224,31 +206,9 @@ static void __init per_cpu_patch(void) } } -struct leon_1insn_patch_entry { - unsigned int addr; - unsigned int insn; -}; - -enum sparc_cpu sparc_cpu_model; -EXPORT_SYMBOL(sparc_cpu_model); - static __init void leon_patch(void) { - struct leon_1insn_patch_entry *start = (void *)__leon_1insn_patch; - struct leon_1insn_patch_entry *end = (void *)__leon_1insn_patch_end; - /* Default instruction is leon - no patching */ - if (sparc_cpu_model == sparc_leon) - return; - - while (start < end) { - unsigned long addr = start->addr; - - *(unsigned int *)(addr) = start->insn; - flushi(addr); - - start++; - } } struct tt_entry *sparc_ttable; @@ -259,22 +219,6 @@ struct tt_entry *sparc_ttable; void __init sparc32_start_kernel(struct linux_romvec *rp) { prom_init(rp); - - /* Set sparc_cpu_model */ - sparc_cpu_model = sun_unknown; - if (!strcmp(&cputypval[0], "sun4m")) - sparc_cpu_model = sun4m; - if (!strcmp(&cputypval[0], "sun4s")) - sparc_cpu_model = sun4m; /* CP-1200 with PROM 2.30 -E */ - if (!strcmp(&cputypval[0], "sun4d")) - sparc_cpu_model = sun4d; - if (!strcmp(&cputypval[0], "sun4e")) - sparc_cpu_model = sun4e; - if (!strcmp(&cputypval[0], "sun4u")) - sparc_cpu_model = sun4u; - if (!strncmp(&cputypval[0], "leon" , 4)) - sparc_cpu_model = sparc_leon; - leon_patch(); start_kernel(); } @@ -295,27 +239,6 @@ void __init setup_arch(char **cmdline_p) register_console(&prom_early_console); - switch(sparc_cpu_model) { - case sun4m: - pr_info("ARCH: SUN4M\n"); - break; - case sun4d: - pr_info("ARCH: SUN4D\n"); - break; - case sun4e: - pr_info("ARCH: SUN4E\n"); - break; - case sun4u: - pr_info("ARCH: SUN4U\n"); - break; - case sparc_leon: - pr_info("ARCH: LEON\n"); - break; - default: - pr_info("ARCH: UNKNOWN!\n"); - break; - } - idprom_init(); load_mmu(); From patchwork Tue Dec 19 22:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756350 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71A4A3FB04; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RqHa9edS" Received: by smtp.kernel.org (Postfix) with ESMTPS id 56423C4163C; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=hUeer878kHfZToHNcJoRPcV1xECdXnEhs/Nyvz2zVvc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=RqHa9edS2lcZtGxaOHUorag9ZUWw2PIcweiVofAtU8YbY/pchL+SZ/W+rYqqrFjnF pRgQeVUTBRCT8Adp2alKxKZ4q2Sp9F1R8FJFTm4i02eeCQYRV7mkKPPrbPLYhAt4kf d0nAbVNmBHunwFW1rUgTRCqmPYemUEgeJ1GVtfKciQZ11lsHh7H1EKJyLhEqcIImU2 /5/ysjo3gcHNxGbHjWSs+MWhdQT7p+vYfM7kkLjWi7Tssbb+ICBrnE+Oq+QY5DDCcX 5Wqwc9Q3RCIAprb0ATOImyHP2LfzLUG/cJln+p3thVI8IxXq7hj8Mq2q/SKf7dD1V8 uQSijh84etlKA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47AEEC4706E; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:23 +0100 Subject: [PATCH 18/27] sparc32: Drop support for 7 register windows Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-18-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=15090; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=ihMG1Y5AtoVjy/gldPt3VrNpQv5kvVGjd8vY2r8DSK8=; =?utf-8?q?b=3DtitO9Jm1CDCe?= =?utf-8?q?qX4B3E34NGwQ5uja4Jo/TcmtNONt1AhdQWk3eRRbOAgRwXBHfA/BxOvXa7PR5r93?= GziGgtPkCqF1zmfel+mEKYviAW1/tiKSdY2RHp574D9dVDMaCNzu X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Some older SPARC CPUs had support for only 7 register windows. To support this run-time patching was used. LEON demand 8 register windows for use with Linux so there is no need to support the 7 window configuration. The complexity of the assembler code is reduced when dropping the run-time patching, thus increasing the maintainability. Signed-off-by: Sam Ravnborg Cc: Sam Ravnborg Cc: "David S. Miller" Cc: Andreas Larsson --- arch/sparc/include/asm/switch_to_32.h | 1 - arch/sparc/kernel/entry.S | 28 ++++----------- arch/sparc/kernel/etrap_32.S | 35 +++++-------------- arch/sparc/kernel/head_32.S | 65 ----------------------------------- arch/sparc/kernel/rtrap_32.S | 55 +++++++++++++---------------- arch/sparc/kernel/wof.S | 43 ++++++++--------------- arch/sparc/kernel/wuf.S | 20 +++-------- 7 files changed, 57 insertions(+), 190 deletions(-) diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h index 42eeafcb8a41..7aaaf31c09b4 100644 --- a/arch/sparc/include/asm/switch_to_32.h +++ b/arch/sparc/include/asm/switch_to_32.h @@ -37,7 +37,6 @@ extern struct thread_info *current_set[NR_CPUS]; #define prepare_arch_switch(next) do { \ __asm__ __volatile__( \ - ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ "save %sp, -0x40, %sp\n\t" \ diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index 9cf8f87e8c42..078a8f7f8383 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S @@ -384,11 +384,8 @@ do_flush_windows: RESTORE_ALL - .globl flush_patch_one - /* We get these for debugging routines using __builtin_return_address() */ dfw_kernel: -flush_patch_one: FLUSH_ALL_KERNEL_WINDOWS /* Advance over the trap instruction. */ @@ -558,10 +555,9 @@ sys_rt_sigreturn: * XXX code just like on sparc64... -DaveM */ .align 4 - .globl sys_fork, flush_patch_two + .globl sys_fork sys_fork: mov %o7, %l5 -flush_patch_two: FLUSH_ALL_KERNEL_WINDOWS; ld [%curptr + TI_TASK], %o4 rd %psr, %g4 @@ -574,10 +570,9 @@ flush_patch_two: mov %l5, %o7 /* Whee, kernel threads! */ - .globl sys_clone, flush_patch_three + .globl sys_clone sys_clone: mov %o7, %l5 -flush_patch_three: FLUSH_ALL_KERNEL_WINDOWS; ld [%curptr + TI_TASK], %o4 rd %psr, %g4 @@ -590,9 +585,8 @@ flush_patch_three: mov %l5, %o7 /* Whee, real vfork! */ - .globl sys_vfork, flush_patch_four + .globl sys_vfork sys_vfork: -flush_patch_four: FLUSH_ALL_KERNEL_WINDOWS; ld [%curptr + TI_TASK], %o4 rd %psr, %g4 @@ -909,17 +903,7 @@ breakpoint_trap: #endif .align 4 - .globl flush_patch_exception -flush_patch_exception: - FLUSH_ALL_KERNEL_WINDOWS; - ldd [%o0], %o6 - jmpl %o7 + 0xc, %g0 ! see asm-sparc/processor.h - mov 1, %g1 ! signal EFAULT condition - - .align 4 - .globl kill_user_windows, kuw_patch1_7win - .globl kuw_patch1 -kuw_patch1_7win: sll %o3, 6, %o3 + .globl kill_user_windows /* No matter how much overhead this routine has in the worst * case scenario, it is several times better than taking the @@ -939,11 +923,11 @@ kill_user_windows: be 4f ! yep, we are done rd %wim, %o3 ! get current wim srl %o3, 1, %o4 ! simulate a save -kuw_patch1: +kuw_next: sll %o3, 7, %o3 ! compute next wim or %o4, %o3, %o3 ! result andncc %o0, %o3, %o0 ! clean this bit in umask - bne kuw_patch1 ! not done yet + bne kuw_next ! not done yet srl %o3, 1, %o4 ! begin another save simulation wr %o3, 0x0, %wim ! set the new wim st %g0, [%g6 + TI_UWINMASK] ! clear uwinmask diff --git a/arch/sparc/kernel/etrap_32.S b/arch/sparc/kernel/etrap_32.S index bb222459f097..95dfdea1f36c 100644 --- a/arch/sparc/kernel/etrap_32.S +++ b/arch/sparc/kernel/etrap_32.S @@ -30,18 +30,6 @@ .text .align 4 - /* SEVEN WINDOW PATCH INSTRUCTIONS */ - .globl tsetup_7win_patch1, tsetup_7win_patch2 - .globl tsetup_7win_patch3, tsetup_7win_patch4 - .globl tsetup_7win_patch5, tsetup_7win_patch6 -tsetup_7win_patch1: sll %t_wim, 0x6, %t_wim -tsetup_7win_patch2: and %g2, 0x7f, %g2 -tsetup_7win_patch3: and %g2, 0x7f, %g2 -tsetup_7win_patch4: and %g1, 0x7f, %g1 -tsetup_7win_patch5: sll %t_wim, 0x6, %t_wim -tsetup_7win_patch6: and %g2, 0x7f, %g2 - /* END OF PATCH INSTRUCTIONS */ - /* At trap time, interrupts and all generic traps do the * following: * @@ -72,9 +60,7 @@ tsetup_7win_patch6: and %g2, 0x7f, %g2 * trap pc and npc, and %l3 contains the trap time %wim. */ - .globl trap_setup, tsetup_patch1, tsetup_patch2 - .globl tsetup_patch3, tsetup_patch4 - .globl tsetup_patch5, tsetup_patch6 + .globl trap_setup trap_setup: /* Calculate mask of trap window. See if from user * or kernel and branch conditionally. @@ -109,11 +95,10 @@ trap_setup_kernel_spill: * %wim and go. */ srl %t_wim, 0x1, %g2 ! begin computation of new %wim -tsetup_patch1: - sll %t_wim, 0x7, %t_wim ! patched on 7 window Sparcs + + sll %t_wim, 0x7, %t_wim or %t_wim, %g2, %g2 -tsetup_patch2: - and %g2, 0xff, %g2 ! patched on 7 window Sparcs + and %g2, 0xff, %g2 save %g0, %g0, %g0 @@ -185,8 +170,7 @@ trap_setup_from_user: sub %g2, 0x1, %g2 1: andn %g2, %t_twinmask, %g2 -tsetup_patch3: - and %g2, 0xff, %g2 ! patched on 7win Sparcs + and %g2, 0xff, %g2 st %g2, [%curptr + TI_UWINMASK] ! store new umask jmpl %t_retpc + 0x8, %g0 ! return to caller @@ -199,14 +183,11 @@ trap_setup_user_spill: * is in %g1 upon entry to here. */ -tsetup_patch4: - and %g1, 0xff, %g1 ! patched on 7win Sparcs, mask + and %g1, 0xff, %g1 srl %t_wim, 0x1, %g2 ! compute new %wim -tsetup_patch5: - sll %t_wim, 0x7, %t_wim ! patched on 7win Sparcs + sll %t_wim, 0x7, %t_wim or %t_wim, %g2, %g2 ! %g2 is new %wim -tsetup_patch6: - and %g2, 0xff, %g2 ! patched on 7win Sparcs + and %g2, 0xff, %g2 andn %g1, %g2, %g1 ! clear this bit in %g1 st %g1, [%curptr + TI_UWINMASK] diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S index 03dc232dd235..908c77cb456e 100644 --- a/arch/sparc/kernel/head_32.S +++ b/arch/sparc/kernel/head_32.S @@ -404,71 +404,6 @@ leon_init: wr %g1, 0x0, %wim ! make window 1 invalid WRITE_PAUSE - cmp %g3, 0x7 - bne 2f - nop - - /* Adjust our window handling routines to - * do things correctly on 7 window Sparcs. - */ - -#define PATCH_INSN(src, dest) \ - set src, %g5; \ - set dest, %g2; \ - ld [%g5], %g4; \ - st %g4, [%g2]; - - /* Patch for window spills... */ - PATCH_INSN(spnwin_patch1_7win, spnwin_patch1) - PATCH_INSN(spnwin_patch2_7win, spnwin_patch2) - PATCH_INSN(spnwin_patch3_7win, spnwin_patch3) - - /* Patch for window fills... */ - PATCH_INSN(fnwin_patch1_7win, fnwin_patch1) - PATCH_INSN(fnwin_patch2_7win, fnwin_patch2) - - /* Patch for trap entry setup... */ - PATCH_INSN(tsetup_7win_patch1, tsetup_patch1) - PATCH_INSN(tsetup_7win_patch2, tsetup_patch2) - PATCH_INSN(tsetup_7win_patch3, tsetup_patch3) - PATCH_INSN(tsetup_7win_patch4, tsetup_patch4) - PATCH_INSN(tsetup_7win_patch5, tsetup_patch5) - PATCH_INSN(tsetup_7win_patch6, tsetup_patch6) - - /* Patch for returning from traps... */ - PATCH_INSN(rtrap_7win_patch1, rtrap_patch1) - PATCH_INSN(rtrap_7win_patch2, rtrap_patch2) - PATCH_INSN(rtrap_7win_patch3, rtrap_patch3) - PATCH_INSN(rtrap_7win_patch4, rtrap_patch4) - PATCH_INSN(rtrap_7win_patch5, rtrap_patch5) - - /* Patch for killing user windows from the register file. */ - PATCH_INSN(kuw_patch1_7win, kuw_patch1) - - /* Now patch the kernel window flush sequences. - * This saves 2 traps on every switch and fork. - */ - set 0x01000000, %g4 - set flush_patch_one, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - set flush_patch_two, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - set flush_patch_three, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - set flush_patch_four, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - set flush_patch_exception, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - set flush_patch_switch, %g5 - st %g4, [%g5 + 0x18] - st %g4, [%g5 + 0x1c] - -2: sethi %hi(nwindows), %g4 st %g3, [%g4 + %lo(nwindows)] ! store final value sub %g3, 0x1, %g3 diff --git a/arch/sparc/kernel/rtrap_32.S b/arch/sparc/kernel/rtrap_32.S index a232b367c219..8383048c3b5e 100644 --- a/arch/sparc/kernel/rtrap_32.S +++ b/arch/sparc/kernel/rtrap_32.S @@ -23,15 +23,6 @@ #define glob_tmp g4 #define curptr g6 - /* 7 WINDOW SPARC PATCH INSTRUCTIONS */ - .globl rtrap_7win_patch1, rtrap_7win_patch2, rtrap_7win_patch3 - .globl rtrap_7win_patch4, rtrap_7win_patch5 -rtrap_7win_patch1: srl %t_wim, 0x6, %glob_tmp -rtrap_7win_patch2: and %glob_tmp, 0x7f, %glob_tmp -rtrap_7win_patch3: srl %g1, 7, %g2 -rtrap_7win_patch4: srl %g2, 6, %g2 -rtrap_7win_patch5: and %g1, 0x7f, %g1 - /* END OF PATCH INSTRUCTIONS */ /* We need to check for a few things which are: * 1) The need to call schedule() because this @@ -117,17 +108,17 @@ ret_trap_nobufwins: bne ret_trap_userwins_ok nop - /* Calculate new %wim, we have to pull a register - * window from the users stack. - */ + /* Calculate new %wim, we have to pull a register + * window from the users stack. + */ ret_trap_pull_one_window: - rd %wim, %t_wim - sll %t_wim, 0x1, %twin_tmp1 -rtrap_patch1: srl %t_wim, 0x7, %glob_tmp - or %glob_tmp, %twin_tmp1, %glob_tmp -rtrap_patch2: and %glob_tmp, 0xff, %glob_tmp + rd %wim, %t_wim + sll %t_wim, 0x1, %twin_tmp1 + srl %t_wim, 0x7, %glob_tmp + or %glob_tmp, %twin_tmp1, %glob_tmp + and %glob_tmp, 0xff, %glob_tmp - wr %glob_tmp, 0x0, %wim + wr %glob_tmp, 0x0, %wim /* Here comes the architecture specific * branch to the user stack checking routine @@ -174,20 +165,20 @@ ret_trap_unaligned_pc: ld [%curptr + TI_FLAGS], %g2 ret_trap_kernel: - /* Will the rett land us in the invalid window? */ - mov 2, %g1 - sll %g1, %t_psr, %g1 -rtrap_patch3: srl %g1, 8, %g2 - or %g1, %g2, %g1 - rd %wim, %g2 - andcc %g2, %g1, %g0 - be 1f ! Nope, just return from the trap - sll %g2, 0x1, %g1 - - /* We have to grab a window before returning. */ -rtrap_patch4: srl %g2, 7, %g2 - or %g1, %g2, %g1 -rtrap_patch5: and %g1, 0xff, %g1 + /* Will the rett land us in the invalid window? */ + mov 2, %g1 + sll %g1, %t_psr, %g1 + srl %g1, 8, %g2 + or %g1, %g2, %g1 + rd %wim, %g2 + andcc %g2, %g1, %g0 + be 1f ! Nope, just return from the trap + sll %g2, 0x1, %g1 + + /* We have to grab a window before returning. */ + srl %g2, 7, %g2 + or %g1, %g2, %g1 + and %g1, 0xff, %g1 wr %g1, 0x0, %wim diff --git a/arch/sparc/kernel/wof.S b/arch/sparc/kernel/wof.S index fe4cfd4abcd2..30c5ebdd035c 100644 --- a/arch/sparc/kernel/wof.S +++ b/arch/sparc/kernel/wof.S @@ -43,18 +43,6 @@ #define twin_tmp l4 /* Temp reg, only usable in trap window T */ #define glob_tmp g5 /* Global temporary reg, usable anywhere G */ - .text - .align 4 - /* BEGINNING OF PATCH INSTRUCTIONS */ - /* On a 7-window Sparc the boot code patches spnwin_* - * instructions with the following ones. - */ - .globl spnwin_patch1_7win, spnwin_patch2_7win, spnwin_patch3_7win -spnwin_patch1_7win: sll %t_wim, 6, %glob_tmp -spnwin_patch2_7win: and %glob_tmp, 0x7f, %glob_tmp -spnwin_patch3_7win: and %twin_tmp, 0x7f, %twin_tmp - /* END OF PATCH INSTRUCTIONS */ - /* The trap entry point has done the following: * * rd %psr, %l0 @@ -69,7 +57,6 @@ spnwin_patch3_7win: and %twin_tmp, 0x7f, %twin_tmp * will be all zeroes. */ .globl spill_window_entry - .globl spnwin_patch1, spnwin_patch2, spnwin_patch3 spill_window_entry: /* LOCATION: Trap Window */ @@ -81,10 +68,10 @@ spill_window_entry: * * newwim = ((%wim>>1) | (%wim<<(nwindows - 1))); */ - srl %t_wim, 0x1, %twin_tmp -spnwin_patch1: sll %t_wim, 7, %glob_tmp - or %glob_tmp, %twin_tmp, %glob_tmp -spnwin_patch2: and %glob_tmp, 0xff, %glob_tmp + srl %t_wim, 0x1, %twin_tmp + sll %t_wim, 7, %glob_tmp + or %glob_tmp, %twin_tmp, %glob_tmp + and %glob_tmp, 0xff, %glob_tmp /* The trap entry point has set the condition codes * up for us to see if this is from user or kernel. @@ -222,17 +209,17 @@ spwin_user_stack_is_bolixed: mov 1, %twin_tmp st %twin_tmp, [%curptr + TI_W_SAVED] - /* Compute new user window mask. What we are basically - * doing is taking two windows, the invalid one at trap - * time and the one we attempted to throw onto the users - * stack, and saying that everything else is an ok user - * window. umask = ((~(%t_wim | %wim)) & valid_wim_bits) - */ - rd %wim, %twin_tmp - or %twin_tmp, %t_wim, %twin_tmp - not %twin_tmp -spnwin_patch3: and %twin_tmp, 0xff, %twin_tmp ! patched on 7win Sparcs - st %twin_tmp, [%curptr + TI_UWINMASK] + /* Compute new user window mask. What we are basically + * doing is taking two windows, the invalid one at trap + * time and the one we attempted to throw onto the users + * stack, and saying that everything else is an ok user + * window. umask = ((~(%t_wim | %wim)) & valid_wim_bits) + */ + rd %wim, %twin_tmp + or %twin_tmp, %t_wim, %twin_tmp + not %twin_tmp + and %twin_tmp, 0xff, %twin_tmp + st %twin_tmp, [%curptr + TI_UWINMASK] #define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ) diff --git a/arch/sparc/kernel/wuf.S b/arch/sparc/kernel/wuf.S index 4c52b69d4b7a..dd2a539f92ff 100644 --- a/arch/sparc/kernel/wuf.S +++ b/arch/sparc/kernel/wuf.S @@ -68,27 +68,17 @@ * are done and return from trap if successful */ - /* BEGINNING OF PATCH INSTRUCTIONS */ - - /* On 7-window Sparc the boot code patches fnwin_patch1 - * with the following instruction. - */ - .globl fnwin_patch1_7win, fnwin_patch2_7win -fnwin_patch1_7win: srl %t_wim, 6, %twin_tmp2 -fnwin_patch2_7win: and %twin_tmp1, 0x7f, %twin_tmp1 - /* END OF PATCH INSTRUCTIONS */ - - .globl fill_window_entry, fnwin_patch1, fnwin_patch2 + .globl fill_window_entry fill_window_entry: /* LOCATION: Window 'T' */ /* Compute what the new %wim is going to be if we retrieve * the proper window off of the stack. */ - sll %t_wim, 1, %twin_tmp1 -fnwin_patch1: srl %t_wim, 7, %twin_tmp2 - or %twin_tmp1, %twin_tmp2, %twin_tmp1 -fnwin_patch2: and %twin_tmp1, 0xff, %twin_tmp1 + sll %t_wim, 1, %twin_tmp1 + srl %t_wim, 7, %twin_tmp2 + or %twin_tmp1, %twin_tmp2, %twin_tmp1 + and %twin_tmp1, 0xff, %twin_tmp1 wr %twin_tmp1, 0x0, %wim /* Make window 'I' invalid */ From patchwork Tue Dec 19 22:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756349 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92508405D6; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hiFZYARL" Received: by smtp.kernel.org (Postfix) with ESMTPS id 74334C116B3; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=bLoZlXD+uyujBiI2QIHjJyBWQ7WHglpOzYi0YEMALhI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hiFZYARLvw+cpesK+MbG5CFYiNTMuLIBzfQOKzXeuvXzZzQM1qg6OMJD5YXWDasX5 zJdVqmsufRiCvLG67nWP0AxNoWTK+GDBOHgkKDH9k12Oxi2O9haAV8gW8NX9kdY4nH 3ngMfjm56Ltl/gXRG67TIvkk8TPfvJTxF/h7ykgrpDbsSZYVxah5vlmrMHYGopjYlv 72sYg21txveDBj2hC0Up40rped7bdo69Q2p3inl4mVPmNvz7p9Qb+8VTCBBhjN2+SF VZdAopWgK4gxmjG3GVWyer30Fy5r9oNx7WRSRfdUKeohDqGv7btdHOUP3jf4mb92lT 7rygtWgpV4l7w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DA0CC41535; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:25 +0100 Subject: [PATCH 20/27] sparc32: Drop unused prom ranges support Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-20-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=6494; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=JWUMPYjeM7nZeaLhzjjM6ATuORPYfX7XPb+WWflq45I=; =?utf-8?q?b=3DpeEDLnJfNsDv?= =?utf-8?q?bMEUyLIfk5KCN4dAImCHU1GZ0JD0n/cOF0IpbTfq7Erj+RhLDOeOO0ivzmtmiCOY?= w+qPEBwLCvTPNLWgyuz3ImztuQA+VjR0A01A3WxdeMxU5GIypt81 X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Drop support for prom ranges - not used anymore. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/include/asm/oplib_32.h | 11 ---- arch/sparc/prom/Makefile | 1 - arch/sparc/prom/init_32.c | 2 - arch/sparc/prom/ranges.c | 114 -------------------------------------- 4 files changed, 128 deletions(-) diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index d1cf3a27a40d..4ef7f05978d3 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h @@ -163,17 +163,6 @@ int prom_setprop(phandle node, const char *prop_name, char *prop_value, phandle prom_inst2pkg(int); -/* Dorking with Bus ranges... */ - -/* Apply promlib probes OBIO ranges to registers. */ -void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); - -/* Apply ranges of any prom node (and optionally parent node as well) to registers. */ -void prom_apply_generic_ranges(phandle node, phandle parent, - struct linux_prom_registers *sbusregs, int nregs); - -void prom_ranges_init(void); - /* CPU probing helpers. */ int cpu_find_by_instance(int instance, phandle *prom_node, int *mid); int cpu_find_by_mid(int mid, phandle *prom_node); diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile index 397b79af77f7..6d94d8b28bcf 100644 --- a/arch/sparc/prom/Makefile +++ b/arch/sparc/prom/Makefile @@ -10,7 +10,6 @@ lib-y += init_$(BITS).o lib-$(CONFIG_SPARC32) += memory.o lib-y += misc_$(BITS).o lib-$(CONFIG_SPARC32) += mp.o -lib-$(CONFIG_SPARC32) += ranges.o lib-y += console_$(BITS).o lib-y += printf.o lib-y += tree_$(BITS).o diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c index d20470166cb1..1681f1f980d4 100644 --- a/arch/sparc/prom/init_32.c +++ b/arch/sparc/prom/init_32.c @@ -67,8 +67,6 @@ void __init prom_init(struct linux_romvec *rp) prom_meminit(); - prom_ranges_init(); - printk("PROMLIB: Sun Boot Prom Version %d Revision %d\n", romvec->pv_romvers, prom_rev); diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c deleted file mode 100644 index 20cb828bc5f4..000000000000 --- a/arch/sparc/prom/ranges.c +++ /dev/null @@ -1,114 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * ranges.c: Handle ranges in newer proms for obio/sbus. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ - -#include -#include - -#include -#include -#include - -static struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; -static int num_obio_ranges; - -/* Adjust register values based upon the ranges parameters. */ -static void prom_adjust_regs(struct linux_prom_registers *regp, int nregs, - struct linux_prom_ranges *rangep, int nranges) -{ - int regc, rngc; - - for (regc = 0; regc < nregs; regc++) { - for (rngc = 0; rngc < nranges; rngc++) - if (regp[regc].which_io == rangep[rngc].ot_child_space) - break; /* Fount it */ - if (rngc == nranges) /* oops */ - prom_printf("adjust_regs: Could not find range with matching bus type...\n"); - regp[regc].which_io = rangep[rngc].ot_parent_space; - regp[regc].phys_addr -= rangep[rngc].ot_child_base; - regp[regc].phys_addr += rangep[rngc].ot_parent_base; - } -} - -static void prom_adjust_ranges(struct linux_prom_ranges *ranges1, int nranges1, - struct linux_prom_ranges *ranges2, int nranges2) -{ - int rng1c, rng2c; - - for (rng1c = 0; rng1c < nranges1; rng1c++) { - for (rng2c = 0; rng2c < nranges2; rng2c++) - if (ranges1[rng1c].ot_parent_space == ranges2[rng2c].ot_child_space && - ranges1[rng1c].ot_parent_base >= ranges2[rng2c].ot_child_base && - ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size - ranges1[rng1c].ot_parent_base > 0U) - break; - if (rng2c == nranges2) /* oops */ - prom_printf("adjust_ranges: Could not find matching bus type...\n"); - else if (ranges1[rng1c].ot_parent_base + ranges1[rng1c].or_size > ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size) - ranges1[rng1c].or_size = ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size - ranges1[rng1c].ot_parent_base; - ranges1[rng1c].ot_parent_space = ranges2[rng2c].ot_parent_space; - ranges1[rng1c].ot_parent_base += ranges2[rng2c].ot_parent_base; - } -} - -/* Apply probed obio ranges to registers passed, if no ranges return. */ -void prom_apply_obio_ranges(struct linux_prom_registers *regs, int nregs) -{ - if (num_obio_ranges) - prom_adjust_regs(regs, nregs, promlib_obio_ranges, num_obio_ranges); -} -EXPORT_SYMBOL(prom_apply_obio_ranges); - -void __init prom_ranges_init(void) -{ - phandle node, obio_node; - int success; - - num_obio_ranges = 0; - - /* Check for obio and sbus ranges. */ - node = prom_getchild(prom_root_node); - obio_node = prom_searchsiblings(node, "obio"); - - if (obio_node) { - success = prom_getproperty(obio_node, "ranges", - (char *) promlib_obio_ranges, - sizeof(promlib_obio_ranges)); - if (success != -1) - num_obio_ranges = (success / sizeof(struct linux_prom_ranges)); - } - - if (num_obio_ranges) - prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); -} - -void prom_apply_generic_ranges(phandle node, phandle parent, - struct linux_prom_registers *regs, int nregs) -{ - int success; - int num_ranges; - struct linux_prom_ranges ranges[PROMREG_MAX]; - - success = prom_getproperty(node, "ranges", - (char *) ranges, - sizeof(ranges)); - if (success != -1) { - num_ranges = (success / sizeof(struct linux_prom_ranges)); - if (parent) { - struct linux_prom_ranges parent_ranges[PROMREG_MAX]; - int num_parent_ranges; - - success = prom_getproperty(parent, "ranges", - (char *) parent_ranges, - sizeof(parent_ranges)); - if (success != -1) { - num_parent_ranges = (success / sizeof(struct linux_prom_ranges)); - prom_adjust_ranges(ranges, num_ranges, parent_ranges, num_parent_ranges); - } - } - prom_adjust_regs(regs, nregs, ranges, num_ranges); - } -} From patchwork Tue Dec 19 22:03:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756344 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A527C40BED; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VUfJaGDb" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8530CC116B5; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=2X7o1Lt3H8IW+wJpA8JXoQ1HU5uCPMeWcMEAyMe088c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VUfJaGDbgC/phKWbtTMyOkQbePSPo3CsSs+H2orD28Z719yUfK+7LHFV/hRThkX7w OsvS//3ER6zAfdT1VqSZOjm4iaMeqdi8qByRpR+fhPwiUeYZyfKqQ5TbFj27PcUlmj Daf197WH/6FawzwaM/heVilGEUG3Zzgy6GUHVJTHI3bMa3Js00Swal4ICD8D59uccq 3Kwp/k/8up5rhpuZX3hqkkdre90Az9bI2b4pGu2EXj5lYHoTl0G765S1p67pEIYAIA XyQK0dXRrNhfjqSXbv4eeI7i0VRxUIiKnI/nKOUrcQTG2iCa7J5Yor+JXJZHD48X90 WTQauGJ4Uxjpw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75636C4706C; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:27 +0100 Subject: [PATCH 22/27] sparc32: Drop sun4m irq support Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-22-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=15199; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=X63koqqYTm+iT+PU2L8ElZACMgk19KzK8/hbmjfO82M=; =?utf-8?q?b=3DY47K421BJoVD?= =?utf-8?q?JiQyqLXXy+kXYVTcxLxP3mtpLEkxrpcdOqEP/44A9Qi/FHs7Gbzwk58sTzOQYVP/?= +zkvvSvwDmnEx9w4micBREbkE4aZpO5hthhR50uYPebTV00dO9TP X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg Drop all code uses to support sun4m irqs. Update entry.S to call the leon_nmi function. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/kernel/Makefile | 1 - arch/sparc/kernel/entry.S | 29 ++--- arch/sparc/kernel/irq.h | 47 +------- arch/sparc/kernel/irq_32.c | 6 +- arch/sparc/kernel/kernel.h | 4 - arch/sparc/kernel/leon_kernel.c | 10 +- arch/sparc/kernel/sun4m_irq.c | 238 ---------------------------------------- 7 files changed, 23 insertions(+), 312 deletions(-) diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 09577e39037c..1961d165b279 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile @@ -29,7 +29,6 @@ obj-y += traps_$(BITS).o # IRQ obj-y += irq_$(BITS).o -obj-$(CONFIG_SPARC32) += sun4m_irq.o obj-y += process_$(BITS).o obj-y += process.o diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index eecbe0be7bf6..fb6095aab9c2 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S @@ -427,36 +427,21 @@ setcc_trap_handler: jmp %l2 ! advance over trap instruction rett %l2 + 0x4 ! like this... -sun4m_nmi_error: +nmi_error: /* NMI async memory error handling. */ - sethi %hi(0x80000000), %l4 - sethi %hi(sun4m_irq_global), %o5 - ld [%o5 + %lo(sun4m_irq_global)], %l5 - st %l4, [%l5 + 0x0c] ! sun4m_irq_global->mask_set=0x80000000 - WRITE_PAUSE - ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending - WRITE_PAUSE +#ifndef CONFIG_SMP + .align 4 + .globl linux_trap_ipi15_leon +linux_trap_ipi15_leon: + SAVE_ALL or %l0, PSR_PIL, %l4 wr %l4, 0x0, %psr WRITE_PAUSE wr %l4, PSR_ET, %psr WRITE_PAUSE - call sun4m_nmi + call leon_nmi nop - st %l4, [%l5 + 0x08] ! sun4m_irq_global->mask_clear=0x80000000 - WRITE_PAUSE - ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending - WRITE_PAUSE RESTORE_ALL - -#ifndef CONFIG_SMP - .align 4 - .globl linux_trap_ipi15_leon -linux_trap_ipi15_leon: - SAVE_ALL - - ba sun4m_nmi_error - nop #endif /* CONFIG_SMP */ .align 4 diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h index 8a0b314c8299..9d15dbb9fe6f 100644 --- a/arch/sparc/kernel/irq.h +++ b/arch/sparc/kernel/irq.h @@ -10,39 +10,14 @@ struct irq_bucket { unsigned int pil; }; -#define SUN4M_HARD_INT(x) (0x000000001 << (x)) -#define SUN4M_SOFT_INT(x) (0x000010000 << (x)) - -#define SUN4D_MAX_BOARD 10 -#define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5) +#define MAX_BOARD 10 +#define MAX_IRQ ((MAX_BOARD + 2) << 5) /* Map between the irq identifier used in hw to the * irq_bucket. The map is sufficient large to hold * the sun4d hw identifiers. */ -extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ]; - - -/* sun4m specific type definitions */ - -/* This maps direct to CPU specific interrupt registers */ -struct sun4m_irq_percpu { - u32 pending; - u32 clear; - u32 set; -}; - -/* This maps direct to global interrupt registers */ -struct sun4m_irq_global { - u32 pending; - u32 mask; - u32 mask_clear; - u32 mask_set; - u32 interrupt_target; -}; - -extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; -extern struct sun4m_irq_global __iomem *sun4m_irq_global; +extern struct irq_bucket *irq_map[MAX_IRQ]; unsigned int irq_alloc(unsigned int real_irq, unsigned int pil); void irq_link(unsigned int irq); @@ -51,22 +26,8 @@ void handler_irq(unsigned int pil, struct pt_regs *regs); unsigned long leon_get_irqmask(unsigned int irq); -/* sun4m_irq.c */ -void sun4m_nmi(struct pt_regs *regs); - -/* sun4d_irq.c */ -void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs); - /* leon_kernel.c */ void leon_clear_clock_irq(void); void leon_load_profile_irq(int cpu, unsigned int limit); u32 leon_cycles_offset(void); - -#ifdef CONFIG_SMP - -/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ -#define SUN4D_IPI_IRQ 13 - -void sun4d_ipi_interrupt(void); - -#endif +void leon_nmi(struct pt_regs *regs); diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c index f76f57073323..5bd64828e8a0 100644 --- a/arch/sparc/kernel/irq_32.c +++ b/arch/sparc/kernel/irq_32.c @@ -111,7 +111,7 @@ static struct irq_bucket irq_table[NR_IRQS]; static DEFINE_SPINLOCK(irq_table_lock); /* Map between the irq identifier used in hw to the irq_bucket. */ -struct irq_bucket *irq_map[SUN4D_MAX_IRQ]; +struct irq_bucket *irq_map[MAX_IRQ]; /* Protect access to irq_map */ static DEFINE_SPINLOCK(irq_map_lock); @@ -162,7 +162,7 @@ void irq_link(unsigned int irq) p = &irq_table[irq]; pil = p->pil; - BUG_ON(pil >= SUN4D_MAX_IRQ); + BUG_ON(pil >= MAX_IRQ); p->next = irq_map[pil]; irq_map[pil] = p; @@ -179,7 +179,7 @@ void irq_unlink(unsigned int irq) spin_lock_irqsave(&irq_map_lock, flags); p = &irq_table[irq]; - BUG_ON(p->pil >= SUN4D_MAX_IRQ); + BUG_ON(p->pil >= MAX_IRQ); pnext = &irq_map[p->pil]; while (*pnext != p) pnext = &(*pnext)->next; diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index a14812903629..30adbec894f7 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -92,10 +92,6 @@ extern spinlock_t irq_action_lock; void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); -/* sun4m_irq.c */ -void sun4m_unmask_profile_irq(void); -void sun4m_clear_profile_irq(int cpu); - /* leon_smp.c */ void leon_cpu_pre_starting(void *arg); void leon_cpu_pre_online(void *arg); diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index fa9cdaffdc6b..1bdf08db3037 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -269,8 +270,15 @@ u32 leon_cycles_offset(void) return off; } -#ifdef CONFIG_SMP +/* NMI interrupt (15) */ +void leon_nmi(struct pt_regs *regs) +{ + printk(KERN_ERR "Aieee: NMI received!\n"); + show_regs(regs); + prom_halt(); +} +#ifdef CONFIG_SMP /* smp clockevent irq */ static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) { diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c deleted file mode 100644 index 1a220a2b9ac3..000000000000 --- a/arch/sparc/kernel/sun4m_irq.c +++ /dev/null @@ -1,238 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * sun4m irq support - * - * djhr: Hacked out of irq.c into a CPU dependent version. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) - * Copyright (C) 1995 Pete A. Zaitcev (zaitcev@yahoo.com) - * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk) - */ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "irq.h" -#include "kernel.h" - -/* Sample sun4m IRQ layout: - * - * 0x22 - Power - * 0x24 - ESP SCSI - * 0x26 - Lance ethernet - * 0x2b - Floppy - * 0x2c - Zilog uart - * 0x32 - SBUS level 0 - * 0x33 - Parallel port, SBUS level 1 - * 0x35 - SBUS level 2 - * 0x37 - SBUS level 3 - * 0x39 - Audio, Graphics card, SBUS level 4 - * 0x3b - SBUS level 5 - * 0x3d - SBUS level 6 - * - * Each interrupt source has a mask bit in the interrupt registers. - * When the mask bit is set, this blocks interrupt deliver. So you - * clear the bit to enable the interrupt. - * - * Interrupts numbered less than 0x10 are software triggered interrupts - * and unused by Linux. - * - * Interrupt level assignment on sun4m: - * - * level source - * ------------------------------------------------------------ - * 1 softint-1 - * 2 softint-2, VME/SBUS level 1 - * 3 softint-3, VME/SBUS level 2 - * 4 softint-4, onboard SCSI - * 5 softint-5, VME/SBUS level 3 - * 6 softint-6, onboard ETHERNET - * 7 softint-7, VME/SBUS level 4 - * 8 softint-8, onboard VIDEO - * 9 softint-9, VME/SBUS level 5, Module Interrupt - * 10 softint-10, system counter/timer - * 11 softint-11, VME/SBUS level 6, Floppy - * 12 softint-12, Keyboard/Mouse, Serial - * 13 softint-13, VME/SBUS level 7, ISDN Audio - * 14 softint-14, per-processor counter/timer - * 15 softint-15, Asynchronous Errors (broadcast) - * - * Each interrupt source is masked distinctly in the sun4m interrupt - * registers. The PIL level alone is therefore ambiguous, since multiple - * interrupt sources map to a single PIL. - * - * This ambiguity is resolved in the 'intr' property for device nodes - * in the OF device tree. Each 'intr' property entry is composed of - * two 32-bit words. The first word is the IRQ priority value, which - * is what we're intersted in. The second word is the IRQ vector, which - * is unused. - * - * The low 4 bits of the IRQ priority indicate the PIL, and the upper - * 4 bits indicate onboard vs. SBUS leveled vs. VME leveled. 0x20 - * means onboard, 0x30 means SBUS leveled, and 0x40 means VME leveled. - * - * For example, an 'intr' IRQ priority value of 0x24 is onboard SCSI - * whereas a value of 0x33 is SBUS level 2. Here are some sample - * 'intr' property IRQ priority values from ss4, ss5, ss10, ss20, and - * Tadpole S3 GX systems. - * - * esp: 0x24 onboard ESP SCSI - * le: 0x26 onboard Lance ETHERNET - * p9100: 0x32 SBUS level 1 P9100 video - * bpp: 0x33 SBUS level 2 BPP parallel port device - * DBRI: 0x39 SBUS level 5 DBRI ISDN audio - * SUNW,leo: 0x39 SBUS level 5 LEO video - * pcmcia: 0x3b SBUS level 6 PCMCIA controller - * uctrl: 0x3b SBUS level 6 UCTRL device - * modem: 0x3d SBUS level 7 MODEM - * zs: 0x2c onboard keyboard/mouse/serial - * floppy: 0x2b onboard Floppy - * power: 0x22 onboard power device (XXX unknown mask bit XXX) - */ - - -/* Code in entry.S needs to get at these register mappings. */ -struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; -struct sun4m_irq_global __iomem *sun4m_irq_global; - -struct sun4m_handler_data { - bool percpu; - long mask; -}; - -/* Dave Redman (djhr@tadpole.co.uk) - * The sun4m interrupt registers. - */ -#define SUN4M_INT_ENABLE 0x80000000 -#define SUN4M_INT_E14 0x00000080 -#define SUN4M_INT_E10 0x00080000 - -#define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */ -#define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */ -#define SUN4M_INT_M2S_WRITE_ERR 0x20000000 /* write buffer error */ -#define SUN4M_INT_ECC_ERR 0x10000000 /* ecc memory error */ -#define SUN4M_INT_VME_ERR 0x08000000 /* vme async error */ -#define SUN4M_INT_FLOPPY 0x00400000 /* floppy disk */ -#define SUN4M_INT_MODULE 0x00200000 /* module interrupt */ -#define SUN4M_INT_VIDEO 0x00100000 /* onboard video */ -#define SUN4M_INT_REALTIME 0x00080000 /* system timer */ -#define SUN4M_INT_SCSI 0x00040000 /* onboard scsi */ -#define SUN4M_INT_AUDIO 0x00020000 /* audio/isdn */ -#define SUN4M_INT_ETHERNET 0x00010000 /* onboard ethernet */ -#define SUN4M_INT_SERIAL 0x00008000 /* serial ports */ -#define SUN4M_INT_KBDMS 0x00004000 /* keyboard/mouse */ -#define SUN4M_INT_SBUSBITS 0x00003F80 /* sbus int bits */ -#define SUN4M_INT_VMEBITS 0x0000007F /* vme int bits */ - -#define SUN4M_INT_ERROR (SUN4M_INT_MODULE_ERR | \ - SUN4M_INT_M2S_WRITE_ERR | \ - SUN4M_INT_ECC_ERR | \ - SUN4M_INT_VME_ERR) - -#define SUN4M_INT_SBUS(x) (1 << (x+7)) -#define SUN4M_INT_VME(x) (1 << (x)) - -/* Interrupt levels used by OBP */ -#define OBP_INT_LEVEL_SOFT 0x10 -#define OBP_INT_LEVEL_ONBOARD 0x20 -#define OBP_INT_LEVEL_SBUS 0x30 -#define OBP_INT_LEVEL_VME 0x40 - -#define SUN4M_TIMER_IRQ (OBP_INT_LEVEL_ONBOARD | 10) -#define SUN4M_PROFILE_IRQ (OBP_INT_LEVEL_ONBOARD | 14) - -static unsigned long sun4m_imask[0x50] = { - /* 0x00 - SMP */ - 0, SUN4M_SOFT_INT(1), - SUN4M_SOFT_INT(2), SUN4M_SOFT_INT(3), - SUN4M_SOFT_INT(4), SUN4M_SOFT_INT(5), - SUN4M_SOFT_INT(6), SUN4M_SOFT_INT(7), - SUN4M_SOFT_INT(8), SUN4M_SOFT_INT(9), - SUN4M_SOFT_INT(10), SUN4M_SOFT_INT(11), - SUN4M_SOFT_INT(12), SUN4M_SOFT_INT(13), - SUN4M_SOFT_INT(14), SUN4M_SOFT_INT(15), - /* 0x10 - soft */ - 0, SUN4M_SOFT_INT(1), - SUN4M_SOFT_INT(2), SUN4M_SOFT_INT(3), - SUN4M_SOFT_INT(4), SUN4M_SOFT_INT(5), - SUN4M_SOFT_INT(6), SUN4M_SOFT_INT(7), - SUN4M_SOFT_INT(8), SUN4M_SOFT_INT(9), - SUN4M_SOFT_INT(10), SUN4M_SOFT_INT(11), - SUN4M_SOFT_INT(12), SUN4M_SOFT_INT(13), - SUN4M_SOFT_INT(14), SUN4M_SOFT_INT(15), - /* 0x20 - onboard */ - 0, 0, 0, 0, - SUN4M_INT_SCSI, 0, SUN4M_INT_ETHERNET, 0, - SUN4M_INT_VIDEO, SUN4M_INT_MODULE, - SUN4M_INT_REALTIME, SUN4M_INT_FLOPPY, - (SUN4M_INT_SERIAL | SUN4M_INT_KBDMS), - SUN4M_INT_AUDIO, SUN4M_INT_E14, SUN4M_INT_MODULE_ERR, - /* 0x30 - sbus */ - 0, 0, SUN4M_INT_SBUS(0), SUN4M_INT_SBUS(1), - 0, SUN4M_INT_SBUS(2), 0, SUN4M_INT_SBUS(3), - 0, SUN4M_INT_SBUS(4), 0, SUN4M_INT_SBUS(5), - 0, SUN4M_INT_SBUS(6), 0, 0, - /* 0x40 - vme */ - 0, 0, SUN4M_INT_VME(0), SUN4M_INT_VME(1), - 0, SUN4M_INT_VME(2), 0, SUN4M_INT_VME(3), - 0, SUN4M_INT_VME(4), 0, SUN4M_INT_VME(5), - 0, SUN4M_INT_VME(6), 0, 0 -}; - -struct sun4m_timer_percpu { - u32 l14_limit; - u32 l14_count; - u32 l14_limit_noclear; - u32 user_timer_start_stop; -}; - -static struct sun4m_timer_percpu __iomem *timers_percpu[SUN4M_NCPUS]; - -void sun4m_nmi(struct pt_regs *regs) -{ - unsigned long afsr, afar, si; - - printk(KERN_ERR "Aieee: sun4m NMI received!\n"); - /* XXX HyperSparc hack XXX */ - __asm__ __volatile__("mov 0x500, %%g1\n\t" - "lda [%%g1] 0x4, %0\n\t" - "mov 0x600, %%g1\n\t" - "lda [%%g1] 0x4, %1\n\t" : - "=r" (afsr), "=r" (afar)); - printk(KERN_ERR "afsr=%08lx afar=%08lx\n", afsr, afar); - si = sbus_readl(&sun4m_irq_global->pending); - printk(KERN_ERR "si=%08lx\n", si); - if (si & SUN4M_INT_MODULE_ERR) - printk(KERN_ERR "Module async error\n"); - if (si & SUN4M_INT_M2S_WRITE_ERR) - printk(KERN_ERR "MBus/SBus async error\n"); - if (si & SUN4M_INT_ECC_ERR) - printk(KERN_ERR "ECC memory error\n"); - if (si & SUN4M_INT_VME_ERR) - printk(KERN_ERR "VME async error\n"); - printk(KERN_ERR "you lose buddy boy...\n"); - show_regs(regs); - prom_halt(); -} - -void sun4m_unmask_profile_irq(void) -{ - unsigned long flags; - - local_irq_save(flags); - sbus_writel(sun4m_imask[SUN4M_PROFILE_IRQ], &sun4m_irq_global->mask_clear); - local_irq_restore(flags); -} - -void sun4m_clear_profile_irq(int cpu) -{ - sbus_readl(&timers_percpu[cpu]->l14_limit); -} From patchwork Tue Dec 19 22:03:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756348 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B856040C08; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VKJVj4Iz" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9B0C4C116B9; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=ZxiWPYjJNlwW0ZoUuTe7kh12NGJyutpG6BCChPYhLqM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VKJVj4Izenm3fSSO97yRxDQOQN0qwh7a4oiChirWK9a9NR1DOIYLaCNiaCBS55NuD rgJFBnkYqeph05C5GVKLVwYYRSh8sA4kSuuAbB9UTpzZO/5+xUxo4y3oDC7anUo7op HWUPRmVUdA1ETWGPkRz0+fhHMAvSfziCDWbk5K8jYfiVdbgputLzhd1ztkiBRseyzX 07AOVYP0cyRP3GX6v5Zlvf/NidVOBMAHCCxS4r4hkqYUYvovjmaX4YsO3AehXJzsMX Jz7Xl1L/486uV3XwlEmYQvd+QqHk8z/AF0gxPgDBylHdTaVhnTLApqyqKBKferscEC i5U0sPpIN3dOw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A002C46CCD; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:29 +0100 Subject: [PATCH 24/27] sparc32: Drop config SPARC_LEON Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-24-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=4414; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=yguXtsAztu+g6VS1K/Ca2l8EKOhlR4mQ7eIgq+RPLKI=; =?utf-8?q?b=3DFP777UvBaxp1?= =?utf-8?q?SiwfpSSLW9EamkRu8kUaC20yflmyMorWFySES8L/kN5EdEsA08eskSUyRrG/P6uB?= OnxjkQroDmvjESJ2jBLsRzy++IbHaFfo7eXfbWhpMLGU7cRhkzYF X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg The only support sparc32 CPU is LEON, so there is no need for a config option to select it. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- arch/sparc/Kconfig | 27 +++++++++------------------ arch/sparc/configs/sparc32_defconfig | 1 - drivers/usb/host/Kconfig | 2 +- drivers/usb/host/ehci-hcd.c | 4 ++-- drivers/usb/host/uhci-hcd.c | 2 +- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 7ae304bab2d8..0fc52c3c7487 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -9,6 +9,10 @@ config 64BIT Say yes to build a 64-bit kernel - formerly known as sparc64 Say no to build a 32-bit kernel - formerly known as sparc + The 32-bit kernel target the synthesizable LEON SPARC processor. + LEON is a part of the GRLIB collection of IP cores that are + distributed under GPL. GRLIB can be downloaded from www.gaisler.com. + You can download a sparc-linux cross-compilation toolchain at www.gaisler.com. config SPARC bool @@ -60,6 +64,10 @@ config SPARC32 select HAVE_UID16 select LOCK_MM_AND_FIND_VMA select OLD_SIGACTION + select USB_EHCI_BIG_ENDIAN_MMIO + select USB_EHCI_BIG_ENDIAN_DESC + select USB_UHCI_BIG_ENDIAN_MMIO + select USB_UHCI_BIG_ENDIAN_DESC select ZONE_DMA config SPARC64 @@ -348,22 +356,6 @@ config SERIAL_CONSOLE If unsure, say N. -config SPARC_LEON - bool "Sparc Leon processor family" - depends on SPARC32 - select USB_EHCI_BIG_ENDIAN_MMIO - select USB_EHCI_BIG_ENDIAN_DESC - select USB_UHCI_BIG_ENDIAN_MMIO - select USB_UHCI_BIG_ENDIAN_DESC - help - If you say Y here if you are running on a SPARC-LEON processor. - The LEON processor is a synthesizable VHDL model of the - SPARC-v8 standard. LEON is part of the GRLIB collection of - IP cores that are distributed under GPL. GRLIB can be downloaded - from www.gaisler.com. You can download a sparc-linux cross-compilation - toolchain at www.gaisler.com. - -if SPARC_LEON menu "U-Boot options" config UBOOT_LOAD_ADDR @@ -394,7 +386,6 @@ config UBOOT_ENTRY_ADDR Kernel. endmenu -endif endmenu @@ -416,7 +407,7 @@ config SUN_LDOMS config LEON_PCI bool - depends on PCI && SPARC_LEON + depends on PCI && SPARC32 default y config SPARC_GRPCI1 diff --git a/arch/sparc/configs/sparc32_defconfig b/arch/sparc/configs/sparc32_defconfig index 71273fc578bf..dfd326f20876 100644 --- a/arch/sparc/configs/sparc32_defconfig +++ b/arch/sparc/configs/sparc32_defconfig @@ -10,7 +10,6 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_ZSTD is not set CONFIG_SMP=y CONFIG_HZ_100=y -CONFIG_SPARC_LEON=y CONFIG_SUN_OPENPROMFS=y CONFIG_SUN_OPENPROMIO=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 4448d0ab06f0..c5f94c70482f 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -595,7 +595,7 @@ config USB_UHCI_HCD config USB_UHCI_SUPPORT_NON_PCI_HC bool - default y if (SPARC_LEON || USB_UHCI_PLATFORM) + default y if (SPARC32 || USB_UHCI_PLATFORM) config USB_UHCI_PLATFORM bool diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 802bfafb1012..5011bc8348bb 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1329,7 +1329,7 @@ MODULE_LICENSE ("GPL"); #include "ehci-xilinx-of.c" #endif -#ifdef CONFIG_SPARC_LEON +#ifdef CONFIG_SPARC32 #include "ehci-grlib.c" #endif @@ -1343,7 +1343,7 @@ static struct platform_driver * const platform_drivers[] = { #ifdef CONFIG_XPS_USB_HCD_XILINX &ehci_hcd_xilinx_of_driver, #endif -#ifdef CONFIG_SPARC_LEON +#ifdef CONFIG_SPARC32 &ehci_grlib_driver, #endif }; diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index fd2408b553cf..7cb820963988 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -846,7 +846,7 @@ static const char hcd_name[] = "uhci_hcd"; #define PCI_DRIVER uhci_pci_driver #endif -#ifdef CONFIG_SPARC_LEON +#ifdef CONFIG_SPARC32 #include "uhci-grlib.c" #define PLATFORM_DRIVER uhci_grlib_driver #endif From patchwork Tue Dec 19 22:03:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756346 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0E2E41234; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IbLmhewL" Received: by smtp.kernel.org (Postfix) with ESMTPS id B2DB6C116D3; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=QnND/gGVLF0OcIynd0NzBifJ9tXmmVVguZf1/YrvZlE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=IbLmhewLtb9NgYTBXxk9+pJ6F6O7GDiEkdRt39Jr3Df9jR9SdrXxyQiv/YFppNq+/ qwFsyX/0MfmyGAgH36Wy2pPGzJmTw+teedQBNRERXZ4W2rWDObtonhM+AMv2Yao+d1 yR82N7tifL04Y9kaq3FOQgGk85CTuE1Z1MXlZDn0aBstvd+3uHDrAbCpG8CeC5uGOE PAlpjf/C6trNHTxOyV1Y48Wd8Yk19tXOEaVEH1YdO4PBYyLoGbpmDu8MET/fIalXty Ag+55/7cM5j2c8RgEJjXtkktAop2o3eIT/v1eDJRAtW9rUJCRPm+rWMqIvGk3aOUaK ixrWwmUQ4z4XQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F18C46CD8; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:31 +0100 Subject: [PATCH 26/27] sbus: char: Drop now unused uctrl driver Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-26-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=13722; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=21mOYM4NXXv1JubhTtkzgWKnjnePccKISVDYYRtLAHM=; =?utf-8?q?b=3Da8Qe94bhAct6?= =?utf-8?q?6WlqV9dEh8/bwMD/3XMBirbscfDOp5PFd9jkoKkZv6zyzdaM5huRLWpwci0D96L4?= 2XW50tqDACwSfIRbQKO9Ax+KTn2XDF1zi8+EFnR2k6wbfPMiJ3/j X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg The uctrl driver is only relevant for the Sparcbook 3 machine, and with sun4m support removed this driver is no logner relevant. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson --- drivers/sbus/char/Kconfig | 8 - drivers/sbus/char/Makefile | 1 - drivers/sbus/char/uctrl.c | 435 --------------------------------------------- 3 files changed, 444 deletions(-) diff --git a/drivers/sbus/char/Kconfig b/drivers/sbus/char/Kconfig index 7c0a308e4959..8b80abc554ed 100644 --- a/drivers/sbus/char/Kconfig +++ b/drivers/sbus/char/Kconfig @@ -21,14 +21,6 @@ config OBP_FLASH The OpenBoot PROM on Ultra systems is flashable. If you want to be able to upgrade the OBP firmware, say Y here. -config TADPOLE_TS102_UCTRL - tristate "Tadpole TS102 Microcontroller support" - help - Say Y here to directly support the TS102 Microcontroller interface - on the Tadpole Sparcbook 3. This device handles power-management - events, and can also notice the attachment/detachment of external - monitors and mice. - config BBC_I2C tristate "UltraSPARC-III bootbus i2c controller driver" depends on PCI && SPARC64 diff --git a/drivers/sbus/char/Makefile b/drivers/sbus/char/Makefile index 44347c918f6b..9db2faabfae8 100644 --- a/drivers/sbus/char/Makefile +++ b/drivers/sbus/char/Makefile @@ -14,6 +14,5 @@ obj-$(CONFIG_ENVCTRL) += envctrl.o obj-$(CONFIG_DISPLAY7SEG) += display7seg.o obj-$(CONFIG_OBP_FLASH) += flash.o obj-$(CONFIG_SUN_OPENPROMIO) += openprom.o -obj-$(CONFIG_TADPOLE_TS102_UCTRL) += uctrl.o obj-$(CONFIG_BBC_I2C) += bbc.o obj-$(CONFIG_ORACLE_DAX) += oradax.o diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c deleted file mode 100644 index 0660425e3a5a..000000000000 --- a/drivers/sbus/char/uctrl.c +++ /dev/null @@ -1,435 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* uctrl.c: TS102 Microcontroller interface on Tadpole Sparcbook 3 - * - * Copyright 1999 Derrick J Brashear (shadow@dementia.org) - * Copyright 2008 David S. Miller (davem@davemloft.net) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define DEBUG 1 -#ifdef DEBUG -#define dprintk(x) printk x -#else -#define dprintk(x) -#endif - -struct uctrl_regs { - u32 uctrl_intr; - u32 uctrl_data; - u32 uctrl_stat; - u32 uctrl_xxx[5]; -}; - -struct ts102_regs { - u32 card_a_intr; - u32 card_a_stat; - u32 card_a_ctrl; - u32 card_a_xxx; - u32 card_b_intr; - u32 card_b_stat; - u32 card_b_ctrl; - u32 card_b_xxx; - u32 uctrl_intr; - u32 uctrl_data; - u32 uctrl_stat; - u32 uctrl_xxx; - u32 ts102_xxx[4]; -}; - -/* Bits for uctrl_intr register */ -#define UCTRL_INTR_TXE_REQ 0x01 /* transmit FIFO empty int req */ -#define UCTRL_INTR_TXNF_REQ 0x02 /* transmit FIFO not full int req */ -#define UCTRL_INTR_RXNE_REQ 0x04 /* receive FIFO not empty int req */ -#define UCTRL_INTR_RXO_REQ 0x08 /* receive FIFO overflow int req */ -#define UCTRL_INTR_TXE_MSK 0x10 /* transmit FIFO empty mask */ -#define UCTRL_INTR_TXNF_MSK 0x20 /* transmit FIFO not full mask */ -#define UCTRL_INTR_RXNE_MSK 0x40 /* receive FIFO not empty mask */ -#define UCTRL_INTR_RXO_MSK 0x80 /* receive FIFO overflow mask */ - -/* Bits for uctrl_stat register */ -#define UCTRL_STAT_TXE_STA 0x01 /* transmit FIFO empty status */ -#define UCTRL_STAT_TXNF_STA 0x02 /* transmit FIFO not full status */ -#define UCTRL_STAT_RXNE_STA 0x04 /* receive FIFO not empty status */ -#define UCTRL_STAT_RXO_STA 0x08 /* receive FIFO overflow status */ - -static DEFINE_MUTEX(uctrl_mutex); -static const char *uctrl_extstatus[16] = { - "main power available", - "internal battery attached", - "external battery attached", - "external VGA attached", - "external keyboard attached", - "external mouse attached", - "lid down", - "internal battery currently charging", - "external battery currently charging", - "internal battery currently discharging", - "external battery currently discharging", -}; - -/* Everything required for one transaction with the uctrl */ -struct uctrl_txn { - u8 opcode; - u8 inbits; - u8 outbits; - u8 *inbuf; - u8 *outbuf; -}; - -struct uctrl_status { - u8 current_temp; /* 0x07 */ - u8 reset_status; /* 0x0b */ - u16 event_status; /* 0x0c */ - u16 error_status; /* 0x10 */ - u16 external_status; /* 0x11, 0x1b */ - u8 internal_charge; /* 0x18 */ - u8 external_charge; /* 0x19 */ - u16 control_lcd; /* 0x20 */ - u8 control_bitport; /* 0x21 */ - u8 speaker_volume; /* 0x23 */ - u8 control_tft_brightness; /* 0x24 */ - u8 control_kbd_repeat_delay; /* 0x28 */ - u8 control_kbd_repeat_period; /* 0x29 */ - u8 control_screen_contrast; /* 0x2F */ -}; - -enum uctrl_opcode { - READ_SERIAL_NUMBER=0x1, - READ_ETHERNET_ADDRESS=0x2, - READ_HARDWARE_VERSION=0x3, - READ_MICROCONTROLLER_VERSION=0x4, - READ_MAX_TEMPERATURE=0x5, - READ_MIN_TEMPERATURE=0x6, - READ_CURRENT_TEMPERATURE=0x7, - READ_SYSTEM_VARIANT=0x8, - READ_POWERON_CYCLES=0x9, - READ_POWERON_SECONDS=0xA, - READ_RESET_STATUS=0xB, - READ_EVENT_STATUS=0xC, - READ_REAL_TIME_CLOCK=0xD, - READ_EXTERNAL_VGA_PORT=0xE, - READ_MICROCONTROLLER_ROM_CHECKSUM=0xF, - READ_ERROR_STATUS=0x10, - READ_EXTERNAL_STATUS=0x11, - READ_USER_CONFIGURATION_AREA=0x12, - READ_MICROCONTROLLER_VOLTAGE=0x13, - READ_INTERNAL_BATTERY_VOLTAGE=0x14, - READ_DCIN_VOLTAGE=0x15, - READ_HORIZONTAL_POINTER_VOLTAGE=0x16, - READ_VERTICAL_POINTER_VOLTAGE=0x17, - READ_INTERNAL_BATTERY_CHARGE_LEVEL=0x18, - READ_EXTERNAL_BATTERY_CHARGE_LEVEL=0x19, - READ_REAL_TIME_CLOCK_ALARM=0x1A, - READ_EVENT_STATUS_NO_RESET=0x1B, - READ_INTERNAL_KEYBOARD_LAYOUT=0x1C, - READ_EXTERNAL_KEYBOARD_LAYOUT=0x1D, - READ_EEPROM_STATUS=0x1E, - CONTROL_LCD=0x20, - CONTROL_BITPORT=0x21, - SPEAKER_VOLUME=0x23, - CONTROL_TFT_BRIGHTNESS=0x24, - CONTROL_WATCHDOG=0x25, - CONTROL_FACTORY_EEPROM_AREA=0x26, - CONTROL_KBD_TIME_UNTIL_REPEAT=0x28, - CONTROL_KBD_TIME_BETWEEN_REPEATS=0x29, - CONTROL_TIMEZONE=0x2A, - CONTROL_MARK_SPACE_RATIO=0x2B, - CONTROL_DIAGNOSTIC_MODE=0x2E, - CONTROL_SCREEN_CONTRAST=0x2F, - RING_BELL=0x30, - SET_DIAGNOSTIC_STATUS=0x32, - CLEAR_KEY_COMBINATION_TABLE=0x33, - PERFORM_SOFTWARE_RESET=0x34, - SET_REAL_TIME_CLOCK=0x35, - RECALIBRATE_POINTING_STICK=0x36, - SET_BELL_FREQUENCY=0x37, - SET_INTERNAL_BATTERY_CHARGE_RATE=0x39, - SET_EXTERNAL_BATTERY_CHARGE_RATE=0x3A, - SET_REAL_TIME_CLOCK_ALARM=0x3B, - READ_EEPROM=0x40, - WRITE_EEPROM=0x41, - WRITE_TO_STATUS_DISPLAY=0x42, - DEFINE_SPECIAL_CHARACTER=0x43, - DEFINE_KEY_COMBINATION_ENTRY=0x50, - DEFINE_STRING_TABLE_ENTRY=0x51, - DEFINE_STATUS_SCREEN_DISPLAY=0x52, - PERFORM_EMU_COMMANDS=0x64, - READ_EMU_REGISTER=0x65, - WRITE_EMU_REGISTER=0x66, - READ_EMU_RAM=0x67, - WRITE_EMU_RAM=0x68, - READ_BQ_REGISTER=0x69, - WRITE_BQ_REGISTER=0x6A, - SET_USER_PASSWORD=0x70, - VERIFY_USER_PASSWORD=0x71, - GET_SYSTEM_PASSWORD_KEY=0x72, - VERIFY_SYSTEM_PASSWORD=0x73, - POWER_OFF=0x82, - POWER_RESTART=0x83, -}; - -static struct uctrl_driver { - struct uctrl_regs __iomem *regs; - int irq; - int pending; - struct uctrl_status status; -} *global_driver; - -static void uctrl_get_event_status(struct uctrl_driver *); -static void uctrl_get_external_status(struct uctrl_driver *); - -static long -uctrl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - switch (cmd) { - default: - return -EINVAL; - } - return 0; -} - -static int -uctrl_open(struct inode *inode, struct file *file) -{ - mutex_lock(&uctrl_mutex); - uctrl_get_event_status(global_driver); - uctrl_get_external_status(global_driver); - mutex_unlock(&uctrl_mutex); - return 0; -} - -static irqreturn_t uctrl_interrupt(int irq, void *dev_id) -{ - return IRQ_HANDLED; -} - -static const struct file_operations uctrl_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .unlocked_ioctl = uctrl_ioctl, - .open = uctrl_open, -}; - -static struct miscdevice uctrl_dev = { - UCTRL_MINOR, - "uctrl", - &uctrl_fops -}; - -/* Wait for space to write, then write to it */ -#define WRITEUCTLDATA(value) \ -{ \ - unsigned int i; \ - for (i = 0; i < 10000; i++) { \ - if (UCTRL_STAT_TXNF_STA & sbus_readl(&driver->regs->uctrl_stat)) \ - break; \ - } \ - dprintk(("write data 0x%02x\n", value)); \ - sbus_writel(value, &driver->regs->uctrl_data); \ -} - -/* Wait for something to read, read it, then clear the bit */ -#define READUCTLDATA(value) \ -{ \ - unsigned int i; \ - value = 0; \ - for (i = 0; i < 10000; i++) { \ - if ((UCTRL_STAT_RXNE_STA & sbus_readl(&driver->regs->uctrl_stat)) == 0) \ - break; \ - udelay(1); \ - } \ - value = sbus_readl(&driver->regs->uctrl_data); \ - dprintk(("read data 0x%02x\n", value)); \ - sbus_writel(UCTRL_STAT_RXNE_STA, &driver->regs->uctrl_stat); \ -} - -static void uctrl_do_txn(struct uctrl_driver *driver, struct uctrl_txn *txn) -{ - int stat, incnt, outcnt, bytecnt, intr; - u32 byte; - - stat = sbus_readl(&driver->regs->uctrl_stat); - intr = sbus_readl(&driver->regs->uctrl_intr); - sbus_writel(stat, &driver->regs->uctrl_stat); - - dprintk(("interrupt stat 0x%x int 0x%x\n", stat, intr)); - - incnt = txn->inbits; - outcnt = txn->outbits; - byte = (txn->opcode << 8); - WRITEUCTLDATA(byte); - - bytecnt = 0; - while (incnt > 0) { - byte = (txn->inbuf[bytecnt] << 8); - WRITEUCTLDATA(byte); - incnt--; - bytecnt++; - } - - /* Get the ack */ - READUCTLDATA(byte); - dprintk(("ack was %x\n", (byte >> 8))); - - bytecnt = 0; - while (outcnt > 0) { - READUCTLDATA(byte); - txn->outbuf[bytecnt] = (byte >> 8); - dprintk(("set byte to %02x\n", byte)); - outcnt--; - bytecnt++; - } -} - -static void uctrl_get_event_status(struct uctrl_driver *driver) -{ - struct uctrl_txn txn; - u8 outbits[2]; - - txn.opcode = READ_EVENT_STATUS; - txn.inbits = 0; - txn.outbits = 2; - txn.inbuf = NULL; - txn.outbuf = outbits; - - uctrl_do_txn(driver, &txn); - - dprintk(("bytes %x %x\n", (outbits[0] & 0xff), (outbits[1] & 0xff))); - driver->status.event_status = - ((outbits[0] & 0xff) << 8) | (outbits[1] & 0xff); - dprintk(("ev is %x\n", driver->status.event_status)); -} - -static void uctrl_get_external_status(struct uctrl_driver *driver) -{ - struct uctrl_txn txn; - u8 outbits[2]; - int i, v; - - txn.opcode = READ_EXTERNAL_STATUS; - txn.inbits = 0; - txn.outbits = 2; - txn.inbuf = NULL; - txn.outbuf = outbits; - - uctrl_do_txn(driver, &txn); - - dprintk(("bytes %x %x\n", (outbits[0] & 0xff), (outbits[1] & 0xff))); - driver->status.external_status = - ((outbits[0] * 256) + (outbits[1])); - dprintk(("ex is %x\n", driver->status.external_status)); - v = driver->status.external_status; - for (i = 0; v != 0; i++, v >>= 1) { - if (v & 1) { - dprintk(("%s%s", " ", uctrl_extstatus[i])); - } - } - dprintk(("\n")); - -} - -static int uctrl_probe(struct platform_device *op) -{ - struct uctrl_driver *p; - int err = -ENOMEM; - - p = kzalloc(sizeof(*p), GFP_KERNEL); - if (!p) { - printk(KERN_ERR "uctrl: Unable to allocate device struct.\n"); - goto out; - } - - p->regs = of_ioremap(&op->resource[0], 0, - resource_size(&op->resource[0]), - "uctrl"); - if (!p->regs) { - printk(KERN_ERR "uctrl: Unable to map registers.\n"); - goto out_free; - } - - p->irq = op->archdata.irqs[0]; - err = request_irq(p->irq, uctrl_interrupt, 0, "uctrl", p); - if (err) { - printk(KERN_ERR "uctrl: Unable to register irq.\n"); - goto out_iounmap; - } - - err = misc_register(&uctrl_dev); - if (err) { - printk(KERN_ERR "uctrl: Unable to register misc device.\n"); - goto out_free_irq; - } - - sbus_writel(UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK, &p->regs->uctrl_intr); - printk(KERN_INFO "%pOF: uctrl regs[0x%p] (irq %d)\n", - op->dev.of_node, p->regs, p->irq); - uctrl_get_event_status(p); - uctrl_get_external_status(p); - - dev_set_drvdata(&op->dev, p); - global_driver = p; - -out: - return err; - -out_free_irq: - free_irq(p->irq, p); - -out_iounmap: - of_iounmap(&op->resource[0], p->regs, resource_size(&op->resource[0])); - -out_free: - kfree(p); - goto out; -} - -static int uctrl_remove(struct platform_device *op) -{ - struct uctrl_driver *p = dev_get_drvdata(&op->dev); - - if (p) { - misc_deregister(&uctrl_dev); - free_irq(p->irq, p); - of_iounmap(&op->resource[0], p->regs, resource_size(&op->resource[0])); - kfree(p); - } - return 0; -} - -static const struct of_device_id uctrl_match[] = { - { - .name = "uctrl", - }, - {}, -}; -MODULE_DEVICE_TABLE(of, uctrl_match); - -static struct platform_driver uctrl_driver = { - .driver = { - .name = "uctrl", - .of_match_table = uctrl_match, - }, - .probe = uctrl_probe, - .remove = uctrl_remove, -}; - - -module_platform_driver(uctrl_driver); - -MODULE_LICENSE("GPL"); From patchwork Tue Dec 19 22:03:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg via B4 Relay X-Patchwork-Id: 756345 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDF6E41753; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LXY5nwUu" Received: by smtp.kernel.org (Postfix) with ESMTPS id BA8DAC433A9; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703023396; bh=0D+ON4oeNZOeVZXfD0xqsLjuyAIQe7lSx7T2s4D02kg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LXY5nwUuWkFXcqJ0M4HhBKX8XcUbGbQqNdy/i6rWxP/2H9mffS6iZZdkz5ul6EAKM xUyTEfSMdKhMAWecD7Saffl1l7efnxUbjZW/CvH6+HogO1GFua6d5/Dhxav5u89V/s azI/YnZRzJaXn4H8iTni+QBIWOo6iieFo6ZeNaasGYVOP0rS8AoWC3bb73f0sGg2vA u8o62fZ92Xaj7mQiPs2Y71v2t+eMQFsrXyCOsWwqR0MOJj4qjm0rYu/kGsVJgxHDi2 v+krUBNwLjSt28vkT1dmQ9OaSU5vipcOt02eFXkUkHvF976bqTgIvxhb8PsDVMU+dU tYejJJPqrURmA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC88EC46CD2; Tue, 19 Dec 2023 22:03:16 +0000 (UTC) From: Sam Ravnborg via B4 Relay Date: Tue, 19 Dec 2023 23:03:32 +0100 Subject: [PATCH 27/27] fbdev/p9100: Drop now unused driver p9100 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231219-sam-sparc32-sunset-v3-v1-27-64bb44b598c5@ravnborg.org> References: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> In-Reply-To: <20231219-sam-sparc32-sunset-v3-v1-0-64bb44b598c5@ravnborg.org> To: "David S. Miller" , Arnd Bergmann , Andreas Larsson Cc: Helge Deller , Alexander Viro , Greg Kroah-Hartman , Alan Stern , Jaroslav Kysela , Takashi Iwai , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, Sam Ravnborg X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1703023392; l=11715; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=iA8JbwHY6fG7LBqaMIwOpi+rv8FIlfD/a+18lk+a/yg=; =?utf-8?q?b=3DxLx8QJT1DeN/?= =?utf-8?q?31Tp0n1Pwf61zbQdWjbuL9/LAngB/OMqRezOKwU12aE8l2/DawT+XUglCsLZwYk5?= uBsoLHkbA8MMLhEwcKYYskx/v8q/PkFcAgt9QkgeNdcf0z4sU+Va X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Relay for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: From: Sam Ravnborg The p9100 driver is only relevant for the Sparcbook 3 machine, and with sun4m support removed this driver is no longer relevant. Signed-off-by: Sam Ravnborg Cc: "David S. Miller" Cc: Arnd Bergmann Cc: Andreas Larsson Cc: Helge Deller --- drivers/video/fbdev/Kconfig | 8 - drivers/video/fbdev/Makefile | 1 - drivers/video/fbdev/p9100.c | 372 ------------------------------------------- 3 files changed, 381 deletions(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 94f6dca5856f..ebcc3815c7a5 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -576,14 +576,6 @@ config FB_CG14 This is the frame buffer device driver for the CGfourteen frame buffer on Desktop SPARCsystems with the SX graphics option. -config FB_P9100 - bool "P9100 (Sparcbook 3 only) support" - depends on FB_SBUS - select FB_SBUS_HELPERS - help - This is the frame buffer device driver for the P9100 card - supported on Sparcbook 3 machines. - config FB_LEO bool "Leo (ZX) support" depends on FB_SBUS diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 8e15220152bd..bc9b24648347 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -51,7 +51,6 @@ obj-$(CONFIG_FB_CG6) += cg6.o obj-$(CONFIG_FB_CG3) += cg3.o obj-$(CONFIG_FB_BW2) += bw2.o obj-$(CONFIG_FB_CG14) += cg14.o -obj-$(CONFIG_FB_P9100) += p9100.o obj-$(CONFIG_FB_TCX) += tcx.o obj-$(CONFIG_FB_LEO) += leo.o obj-$(CONFIG_FB_ACORN) += acornfb.o diff --git a/drivers/video/fbdev/p9100.c b/drivers/video/fbdev/p9100.c deleted file mode 100644 index e1356f8a866e..000000000000 --- a/drivers/video/fbdev/p9100.c +++ /dev/null @@ -1,372 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* p9100.c: P9100 frame buffer driver - * - * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) - * Copyright 1999 Derrick J Brashear (shadow@dementia.org) - * - * Driver layout based loosely on tgafb.c, see that file for credits. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "sbuslib.h" - -/* - * Local functions. - */ - -static int p9100_setcolreg(unsigned, unsigned, unsigned, unsigned, - unsigned, struct fb_info *); -static int p9100_blank(int, struct fb_info *); - -static int p9100_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma); -static int p9100_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); - -/* - * Frame buffer operations - */ - -static const struct fb_ops p9100_ops = { - .owner = THIS_MODULE, - FB_DEFAULT_SBUS_OPS(p9100), - .fb_setcolreg = p9100_setcolreg, - .fb_blank = p9100_blank, -}; - -/* P9100 control registers */ -#define P9100_SYSCTL_OFF 0x0UL -#define P9100_VIDEOCTL_OFF 0x100UL -#define P9100_VRAMCTL_OFF 0x180UL -#define P9100_RAMDAC_OFF 0x200UL -#define P9100_VIDEOCOPROC_OFF 0x400UL - -/* P9100 command registers */ -#define P9100_CMD_OFF 0x0UL - -/* P9100 framebuffer memory */ -#define P9100_FB_OFF 0x0UL - -/* 3 bits: 2=8bpp 3=16bpp 5=32bpp 7=24bpp */ -#define SYS_CONFIG_PIXELSIZE_SHIFT 26 - -#define SCREENPAINT_TIMECTL1_ENABLE_VIDEO 0x20 /* 0 = off, 1 = on */ - -struct p9100_regs { - /* Registers for the system control */ - u32 sys_base; - u32 sys_config; - u32 sys_intr; - u32 sys_int_ena; - u32 sys_alt_rd; - u32 sys_alt_wr; - u32 sys_xxx[58]; - - /* Registers for the video control */ - u32 vid_base; - u32 vid_hcnt; - u32 vid_htotal; - u32 vid_hsync_rise; - u32 vid_hblank_rise; - u32 vid_hblank_fall; - u32 vid_hcnt_preload; - u32 vid_vcnt; - u32 vid_vlen; - u32 vid_vsync_rise; - u32 vid_vblank_rise; - u32 vid_vblank_fall; - u32 vid_vcnt_preload; - u32 vid_screenpaint_addr; - u32 vid_screenpaint_timectl1; - u32 vid_screenpaint_qsfcnt; - u32 vid_screenpaint_timectl2; - u32 vid_xxx[15]; - - /* Registers for the video control */ - u32 vram_base; - u32 vram_memcfg; - u32 vram_refresh_pd; - u32 vram_refresh_cnt; - u32 vram_raslo_max; - u32 vram_raslo_cur; - u32 pwrup_cfg; - u32 vram_xxx[25]; - - /* Registers for IBM RGB528 Palette */ - u32 ramdac_cmap_wridx; - u32 ramdac_palette_data; - u32 ramdac_pixel_mask; - u32 ramdac_palette_rdaddr; - u32 ramdac_idx_lo; - u32 ramdac_idx_hi; - u32 ramdac_idx_data; - u32 ramdac_idx_ctl; - u32 ramdac_xxx[1784]; -}; - -struct p9100_cmd_parameng { - u32 parameng_status; - u32 parameng_bltcmd; - u32 parameng_quadcmd; -}; - -struct p9100_par { - spinlock_t lock; - struct p9100_regs __iomem *regs; - - u32 flags; -#define P9100_FLAG_BLANKED 0x00000001 - - unsigned long which_io; -}; - -/** - * p9100_setcolreg - Optional function. Sets a color register. - * @regno: boolean, 0 copy local, 1 get_user() function - * @red: frame buffer colormap structure - * @green: The green value which can be up to 16 bits wide - * @blue: The blue value which can be up to 16 bits wide. - * @transp: If supported the alpha value which can be up to 16 bits wide. - * @info: frame buffer info structure - */ -static int p9100_setcolreg(unsigned regno, - unsigned red, unsigned green, unsigned blue, - unsigned transp, struct fb_info *info) -{ - struct p9100_par *par = (struct p9100_par *) info->par; - struct p9100_regs __iomem *regs = par->regs; - unsigned long flags; - - if (regno >= 256) - return 1; - - red >>= 8; - green >>= 8; - blue >>= 8; - - spin_lock_irqsave(&par->lock, flags); - - sbus_writel((regno << 16), ®s->ramdac_cmap_wridx); - sbus_writel((red << 16), ®s->ramdac_palette_data); - sbus_writel((green << 16), ®s->ramdac_palette_data); - sbus_writel((blue << 16), ®s->ramdac_palette_data); - - spin_unlock_irqrestore(&par->lock, flags); - - return 0; -} - -/** - * p9100_blank - Optional function. Blanks the display. - * @blank: the blank mode we want. - * @info: frame buffer structure that represents a single frame buffer - */ -static int -p9100_blank(int blank, struct fb_info *info) -{ - struct p9100_par *par = (struct p9100_par *) info->par; - struct p9100_regs __iomem *regs = par->regs; - unsigned long flags; - u32 val; - - spin_lock_irqsave(&par->lock, flags); - - switch (blank) { - case FB_BLANK_UNBLANK: /* Unblanking */ - val = sbus_readl(®s->vid_screenpaint_timectl1); - val |= SCREENPAINT_TIMECTL1_ENABLE_VIDEO; - sbus_writel(val, ®s->vid_screenpaint_timectl1); - par->flags &= ~P9100_FLAG_BLANKED; - break; - - case FB_BLANK_NORMAL: /* Normal blanking */ - case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ - case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ - case FB_BLANK_POWERDOWN: /* Poweroff */ - val = sbus_readl(®s->vid_screenpaint_timectl1); - val &= ~SCREENPAINT_TIMECTL1_ENABLE_VIDEO; - sbus_writel(val, ®s->vid_screenpaint_timectl1); - par->flags |= P9100_FLAG_BLANKED; - break; - } - - spin_unlock_irqrestore(&par->lock, flags); - - return 0; -} - -static struct sbus_mmap_map p9100_mmap_map[] = { - { CG3_MMAP_OFFSET, 0, SBUS_MMAP_FBSIZE(1) }, - { 0, 0, 0 } -}; - -static int p9100_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma) -{ - struct p9100_par *par = (struct p9100_par *)info->par; - - return sbusfb_mmap_helper(p9100_mmap_map, - info->fix.smem_start, info->fix.smem_len, - par->which_io, vma); -} - -static int p9100_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) -{ - /* Make it look like a cg3. */ - return sbusfb_ioctl_helper(cmd, arg, info, - FBTYPE_SUN3COLOR, 8, info->fix.smem_len); -} - -/* - * Initialisation - */ - -static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) -{ - snprintf(info->fix.id, sizeof(info->fix.id), "%pOFn", dp); - - info->fix.type = FB_TYPE_PACKED_PIXELS; - info->fix.visual = FB_VISUAL_PSEUDOCOLOR; - - info->fix.line_length = linebytes; - - info->fix.accel = FB_ACCEL_SUN_CGTHREE; -} - -static int p9100_probe(struct platform_device *op) -{ - struct device_node *dp = op->dev.of_node; - struct fb_info *info; - struct p9100_par *par; - int linebytes, err; - - info = framebuffer_alloc(sizeof(struct p9100_par), &op->dev); - - err = -ENOMEM; - if (!info) - goto out_err; - par = info->par; - - spin_lock_init(&par->lock); - - /* This is the framebuffer and the only resource apps can mmap. */ - info->fix.smem_start = op->resource[2].start; - par->which_io = op->resource[2].flags & IORESOURCE_BITS; - - sbusfb_fill_var(&info->var, dp, 8); - info->var.red.length = 8; - info->var.green.length = 8; - info->var.blue.length = 8; - - linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); - info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); - - par->regs = of_ioremap(&op->resource[0], 0, - sizeof(struct p9100_regs), "p9100 regs"); - if (!par->regs) - goto out_release_fb; - - info->fbops = &p9100_ops; - info->screen_base = of_ioremap(&op->resource[2], 0, - info->fix.smem_len, "p9100 ram"); - if (!info->screen_base) - goto out_unmap_regs; - - p9100_blank(FB_BLANK_UNBLANK, info); - - if (fb_alloc_cmap(&info->cmap, 256, 0)) - goto out_unmap_screen; - - p9100_init_fix(info, linebytes, dp); - - err = register_framebuffer(info); - if (err < 0) - goto out_dealloc_cmap; - - fb_set_cmap(&info->cmap, info); - - dev_set_drvdata(&op->dev, info); - - printk(KERN_INFO "%pOF: p9100 at %lx:%lx\n", - dp, - par->which_io, info->fix.smem_start); - - return 0; - -out_dealloc_cmap: - fb_dealloc_cmap(&info->cmap); - -out_unmap_screen: - of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); - -out_unmap_regs: - of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs)); - -out_release_fb: - framebuffer_release(info); - -out_err: - return err; -} - -static void p9100_remove(struct platform_device *op) -{ - struct fb_info *info = dev_get_drvdata(&op->dev); - struct p9100_par *par = info->par; - - unregister_framebuffer(info); - fb_dealloc_cmap(&info->cmap); - - of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs)); - of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); - - framebuffer_release(info); -} - -static const struct of_device_id p9100_match[] = { - { - .name = "p9100", - }, - {}, -}; -MODULE_DEVICE_TABLE(of, p9100_match); - -static struct platform_driver p9100_driver = { - .driver = { - .name = "p9100", - .of_match_table = p9100_match, - }, - .probe = p9100_probe, - .remove_new = p9100_remove, -}; - -static int __init p9100_init(void) -{ - if (fb_get_options("p9100fb", NULL)) - return -ENODEV; - - return platform_driver_register(&p9100_driver); -} - -static void __exit p9100_exit(void) -{ - platform_driver_unregister(&p9100_driver); -} - -module_init(p9100_init); -module_exit(p9100_exit); - -MODULE_DESCRIPTION("framebuffer driver for P9100 chipsets"); -MODULE_AUTHOR("David S. Miller "); -MODULE_VERSION("2.0"); -MODULE_LICENSE("GPL");