Re: [PATCH v1 02/13] sparc32: Drop floppy support

2020-12-18 Thread Sam Ravnborg
On Fri, Dec 18, 2020 at 09:57:47PM +0100, Arnd Bergmann wrote:
> On Fri, Dec 18, 2020 at 7:43 PM Sam Ravnborg  wrote:
> >
> > LEON do not have floppy support so we can drop it
> >
> > Signed-off-by: Sam Ravnborg 
> > Cc: "David S. Miller" 
> > Cc: Sam Ravnborg 
> > Cc: Mike Rapoport 
> > Cc: Andrew Morton 
> > Cc: Denis Efremov 
> > Cc: Willy Tarreau 
> > Cc: Christian Brauner 
> > Cc: sparcli...@vger.kernel.org
> > Cc: Arnd Bergmann 
> > Cc: Andreas Larsson 
> > ---
> >  arch/sparc/Kconfig |   2 +-
> >  arch/sparc/include/asm/floppy.h| 786 -
> >  arch/sparc/include/asm/floppy_32.h | 393 ---
> >  arch/sparc/include/asm/floppy_64.h | 779 
> 
> Rather than renaming the floppy_64.h to floppy.h, it might be easier to just
> remove the #else from floppy.h, similar to what asm/adi.h does.
That is what I had first but then thought it pointless with a wrapper
file. I will revert back to use floppy_64.h for now - we can always
consolidate header files later.

Sam


Re: [PATCH v1 02/13] sparc32: Drop floppy support

2020-12-18 Thread Arnd Bergmann
On Fri, Dec 18, 2020 at 7:43 PM Sam Ravnborg  wrote:
>
> LEON do not have floppy support so we can drop it
>
> Signed-off-by: Sam Ravnborg 
> Cc: "David S. Miller" 
> Cc: Sam Ravnborg 
> Cc: Mike Rapoport 
> Cc: Andrew Morton 
> Cc: Denis Efremov 
> Cc: Willy Tarreau 
> Cc: Christian Brauner 
> Cc: sparcli...@vger.kernel.org
> Cc: Arnd Bergmann 
> Cc: Andreas Larsson 
> ---
>  arch/sparc/Kconfig |   2 +-
>  arch/sparc/include/asm/floppy.h| 786 -
>  arch/sparc/include/asm/floppy_32.h | 393 ---
>  arch/sparc/include/asm/floppy_64.h | 779 

Rather than renaming the floppy_64.h to floppy.h, it might be easier to just
remove the #else from floppy.h, similar to what asm/adi.h does.

This might be helpful in the (unlikely) case that someone has patches for
this file and wants to rebase them.

   Arnd


[PATCH v1 02/13] sparc32: Drop floppy support

2020-12-18 Thread Sam Ravnborg
LEON do not have floppy support so we can drop it

Signed-off-by: Sam Ravnborg 
Cc: "David S. Miller" 
Cc: Sam Ravnborg 
Cc: Mike Rapoport 
Cc: Andrew Morton 
Cc: Denis Efremov 
Cc: Willy Tarreau 
Cc: Christian Brauner 
Cc: sparcli...@vger.kernel.org
Cc: Arnd Bergmann 
Cc: Andreas Larsson 
---
 arch/sparc/Kconfig |   2 +-
 arch/sparc/include/asm/floppy.h| 786 -
 arch/sparc/include/asm/floppy_32.h | 393 ---
 arch/sparc/include/asm/floppy_64.h | 779 
 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 -
 8 files changed, 779 insertions(+), 1416 deletions(-)
 delete mode 100644 arch/sparc/include/asm/floppy_32.h
 delete mode 100644 arch/sparc/include/asm/floppy_64.h

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c9c34dc52b7d..2c6d8d834f9a 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -200,7 +200,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..070c8c1f5c8f 100644
--- a/arch/sparc/include/asm/floppy.h
+++ b/arch/sparc/include/asm/floppy.h
@@ -1,9 +1,779 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#ifndef ___ASM_SPARC_FLOPPY_H
-#define ___ASM_SPARC_FLOPPY_H
-#if defined(__sparc__) && defined(__arch64__)
-#include 
-#else
-#include 
-#endif
-#endif
+/* floppy.h: Sparc specific parts of the Floppy driver.
+ *
+ * Copyright (C) 1996, 2007, 2008 David S. Miller (da...@davemloft.net)
+ * Copyright (C) 1997 Jakub Jelinek (j...@sunsite.mff.cuni.cz)
+ *
+ * Ultra/PCI support added: Sep 1997  Eddie C. Dost  (e...@skynet.be)
+ */
+
+#ifndef __ASM_SPARC64_FLOPPY_H
+#define __ASM_SPARC64_FLOPPY_H
+
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * Define this to enable exchanging drive 0 and 1 if only drive 1 is
+ * probed on PCI machines.
+ */
+#undef PCI_FDC_SWAP_DRIVES
+
+
+/* References:
+ * 1) Netbsd Sun floppy driver.
+ * 2) NCR 82077 controller manual
+ * 3) Intel 82077 controller manual
+ */
+struct sun_flpy_controller {
+   volatile unsigned char status1_82077; /* Auxiliary Status reg. 1 */
+   volatile unsigned char status2_82077; /* Auxiliary Status reg. 2 */
+   volatile unsigned char dor_82077; /* Digital Output reg. */
+   volatile unsigned char tapectl_82077; /* 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 an Ultra anyways. */
+static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
+unsigned long fdc_status;
+static struct platform_device *floppy_op = NULL;
+
+struct sun_floppy_ops {
+   unsigned char   (*fd_inb) (unsigned long port, unsigned int reg);
+   void(*fd_outb) (unsigned char value, unsigned long base,
+   unsigned int reg);
+   void(*fd_enable_dma) (void);
+   void(*fd_disable_dma) (void);
+   void(*fd_set_dma_mode) (int);
+   void(*fd_set_dma_addr) (char *);
+   void(*fd_set_dma_count) (int);
+   unsigned int(*get_dma_residue) (void);
+   int (*fd_request_irq) (void);
+   void(*fd_free_irq) (void);
+   int (*fd_eject) (int);
+};
+
+static struct sun_floppy_ops sun_fdops;
+
+#define fd_inb(base, reg) sun_fdops.fd_inb(base, reg)
+#define fd_outb(value, base, reg) sun_fdops.fd_outb(value, base, reg)
+#define fd_enable_dma()   sun_fdops.fd_enable_dma()
+#define fd_disable_dma()  sun_fdops.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_fdops.fd_set_dma_mode(mode)
+#define fd_set_dma_addr(addr) sun_fdops.fd_set_dma_addr(addr)
+#define fd_set_dma_count(count)   sun_fdops.fd_set_dma_count(count)
+#define get_dma_residue(x)sun_fdops.get_dma_residue()
+#define fd_request_irq()  sun_fdops.fd_request_irq()
+#define fd_free_irq() sun_fdops.fd_free_irq()
+#define fd_eject(drive)   sun_fdops.fd_eject(drive)
+
+/* Super paranoid... */
+#undef HAVE_DISABLE_HLT
+
+static int sun_floppy_types[2] = { 0, 0 };
+
+/* Here is where we catch the floppy driver trying to initialize,
+ *