Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-16 Thread Thomas Bogendoerfer
On Wed, 14 Mar 2018 11:58:25 -0400
"Martin K. Petersen"  wrote:

> I'm happy to keep things in the tree if they are:
> 
>   1) maintained and tested
>   2) actively used
>   3) not blocking removal of legacy interfaces

I own a MVME147, so if needed I could get it out of the closet and fix the 
driver for it.

Thomas.

-- 
SUSE Linux GmbH
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Geert Uytterhoeven
Hi Martin,

On Wed, Mar 14, 2018 at 4:58 PM, Martin K. Petersen
 wrote:
 IIRC, the Australian Navy may keep their MVME boxes running until
 close to Y2038.

>>> But surely not updating them to 4.17 or later?
>>
>> I don't know. Perhaps to prolong life until after Y2038 ;-)
>
> I'm happy to keep things in the tree if they are:
>
>   1) maintained and tested
>   2) actively used
>   3) not blocking removal of legacy interfaces

I'm aware and I do understand.

Lets wait for Adrian...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Martin K. Petersen

Geert,

>>> IIRC, the Australian Navy may keep their MVME boxes running until
>>> close to Y2038.
>>>
>> But surely not updating them to 4.17 or later?
>
> I don't know. Perhaps to prolong life until after Y2038 ;-)

I'm happy to keep things in the tree if they are:

  1) maintained and tested
  2) actively used
  3) not blocking removal of legacy interfaces

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Geert Uytterhoeven
Hi Hannes,

On Wed, Mar 14, 2018 at 4:26 PM, Hannes Reinecke  wrote:
> On 03/14/2018 02:25 PM, Geert Uytterhoeven wrote:
>> On Wed, Mar 14, 2018 at 2:16 PM, Christoph Hellwig  wrote:
>>> On Wed, Mar 14, 2018 at 12:56:31PM +0100, John Paul Adrian Glaubitz wrote:
 Ah, bummer. I wanted to keep the MVME drivers but I never managed to get 
 them ported to the new SCSI layer.

 Anyone out there who could help me with that?
>>>
>>> Here is how a trivial conversion should look like.  Probably doesn't
>>> even compile as-is but might be a good starting point:
>>
>> Thanks a lot!
>> IIRC, the Australian Navy may keep their MVME boxes running until close to
>> Y2038.
>>
> But surely not updating them to 4.17 or later?

I don't know. Perhaps to prolong life until after Y2038 ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Hannes Reinecke
On 03/14/2018 02:25 PM, Geert Uytterhoeven wrote:
> Hi Christoph,
> 
> On Wed, Mar 14, 2018 at 2:16 PM, Christoph Hellwig  wrote:
>> On Wed, Mar 14, 2018 at 12:56:31PM +0100, John Paul Adrian Glaubitz wrote:
>>> Ah, bummer. I wanted to keep the MVME drivers but I never managed to get 
>>> them ported to the new SCSI layer.
>>>
>>> Anyone out there who could help me with that?
>>
>> Here is how a trivial conversion should look like.  Probably doesn't
>> even compile as-is but might be a good starting point:
> 
> Thanks a lot!
> IIRC, the Australian Navy may keep their MVME boxes running until close to
> Y2038.
> 
But surely not updating them to 4.17 or later?

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Geert Uytterhoeven
Hi Christoph,

On Wed, Mar 14, 2018 at 2:16 PM, Christoph Hellwig  wrote:
> On Wed, Mar 14, 2018 at 12:56:31PM +0100, John Paul Adrian Glaubitz wrote:
>> Ah, bummer. I wanted to keep the MVME drivers but I never managed to get 
>> them ported to the new SCSI layer.
>>
>> Anyone out there who could help me with that?
>
> Here is how a trivial conversion should look like.  Probably doesn't
> even compile as-is but might be a good starting point:

Thanks a lot!
IIRC, the Australian Navy may keep their MVME boxes running until close to
Y2038.

Adrian: Do you have hardware to test this?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Christoph Hellwig
On Wed, Mar 14, 2018 at 12:56:31PM +0100, John Paul Adrian Glaubitz wrote:
> Ah, bummer. I wanted to keep the MVME drivers but I never managed to get them 
> ported to the new SCSI layer.
> 
> Anyone out there who could help me with that?

Here is how a trivial conversion should look like.  Probably doesn't
even compile as-is but might be a good starting point:

---
>From e1a863426652c4db3254187c14ed718e78f3033d Mon Sep 17 00:00:00 2001
From: Christoph Hellwig 
Date: Wed, 14 Mar 2018 14:13:00 +0100
Subject: mvme147: stop using scsi_module.c

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/mvme147.c | 109 ++---
 1 file changed, 58 insertions(+), 51 deletions(-)

diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
index e6b2b681fda3..f8d8d9de394d 100644
--- a/drivers/scsi/mvme147.c
+++ b/drivers/scsi/mvme147.c
@@ -3,6 +3,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -14,9 +17,6 @@
 #include "wd33c93.h"
 #include "mvme147.h"
 
-#include 
-
-
 static irqreturn_t mvme147_intr(int irq, void *data)
 {
struct Scsi_Host *instance = data;
@@ -65,40 +65,57 @@ static void dma_stop(struct Scsi_Host *instance, struct 
scsi_cmnd *SCpnt,
m147_pcc->dma_cntrl = 0;
 }
 
-int mvme147_detect(struct scsi_host_template *tpnt)
+static struct scsi_host_template mvme147_host_template = {
+   .module = THIS_MODULE,
+   .proc_name  = "MVME147",
+   .name   = "MVME147 built-in SCSI",
+   .queuecommand   = wd33c93_queuecommand,
+   .eh_abort_handler   = wd33c93_abort,
+   .eh_host_reset_handler  = wd33c93_host_reset,
+   .show_info  = wd33c93_show_info,
+   .write_info = wd33c93_write_info,
+   .can_queue  = CAN_QUEUE,
+   .this_id= 7,
+   .sg_tablesize   = SG_ALL,
+   .cmd_per_lun= CMD_PER_LUN,
+   .use_clustering = ENABLE_CLUSTERING
+};
+
+static struct Scsi_Host *mvme147_shost;
+
+static int __init mvme147_init(void)
 {
-   static unsigned char called = 0;
-   struct Scsi_Host *instance;
wd33c93_regs regs;
struct WD33C93_hostdata *hdata;
+   int error = -ENOMEM;
 
-   if (!MACH_IS_MVME147 || called)
+   if (!MACH_IS_MVME147)
return 0;
-   called++;
 
-   tpnt->proc_name = "MVME147";
-   tpnt->show_info = wd33c93_show_info,
-   tpnt->write_info = wd33c93_write_info,
-
-   instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
-   if (!instance)
+   mvme147_shost = scsi_host_alloc(&mvme147_host_template,
+   sizeof(struct WD33C93_hostdata));
+   if (!mvme147_shost)
goto err_out;
+   mvme147_shost->base = 0xfffe4000;
+   mvme147_shost->irq = MVME147_IRQ_SCSI_PORT;
 
-   instance->base = 0xfffe4000;
-   instance->irq = MVME147_IRQ_SCSI_PORT;
regs.SASR = (volatile unsigned char *)0xfffe4000;
regs.SCMD = (volatile unsigned char *)0xfffe4001;
-   hdata = shost_priv(instance);
+
+   hdata = shost_priv(mvme147_shost);
hdata->no_sync = 0xff;
hdata->fast = 0;
hdata->dma_mode = CTRL_DMA;
-   wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
 
-   if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
-   "MVME147 SCSI PORT", instance))
+   wd33c93_init(mvme147_shost, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
+
+   error = request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
+   "MVME147 SCSI PORT", mvme147_shost);
+   if (error)
goto err_unregister;
-   if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
-   "MVME147 SCSI DMA", instance))
+   error = request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
+   "MVME147 SCSI DMA", mvme147_shost);
+   if (error)
goto err_free_irq;
 #if 0  /* Disabled; causes problems booting */
m147_pcc->scsi_interrupt = 0x10;/* Assert SCSI bus reset */
@@ -111,41 +128,31 @@ int mvme147_detect(struct scsi_host_template *tpnt)
 
m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */
m147_pcc->dma_intr = 0x89;  /* Ack and enable ints */
-
-   return 1;
+   
+   error = scsi_add_host(mvme147_shost, NULL);
+   if (error)
+   goto err_free_irq;
+   scsi_scan_host(mvme147_shost);
+   return 0;
 
 err_free_irq:
-   free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr);
+   free_irq(MVME147_IRQ_SCSI_PORT, mvme147_shost);
 err_unregister:
-   scsi_unregister(instance);
+   scsi_host_put(mvme147_shost);
 err_out:
-   return 0;
+   return error;
 }
 
-static struct scsi_host_template driver_template = {
-   .proc_name  = "MVME147",
-   .name

Re: [PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread John Paul Adrian Glaubitz
Ah, bummer. I wanted to keep the MVME drivers but I never managed to get them 
ported to the new SCSI layer.

Anyone out there who could help me with that?

Adrian

> On Mar 14, 2018, at 12:48 PM, Christoph Hellwig  wrote:
> 
> This driver hasn't seen any recent bug fixing and is one of the last
> drivers using the scsi_module.c infrastruture that has been deprecated
> 15 years ago.
> 
> Signed-off-by: Christoph Hellwig 
> ---
> drivers/scsi/Kconfig   |   8 ---
> drivers/scsi/Makefile  |   1 -
> drivers/scsi/mvme147.c | 151 -
> drivers/scsi/mvme147.h |  25 
> drivers/scsi/wd33c93.c |   5 --
> 5 files changed, 190 deletions(-)
> delete mode 100644 drivers/scsi/mvme147.c
> delete mode 100644 drivers/scsi/mvme147.h
> 
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index 11e89e56b865..a95084008fe0 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -1390,14 +1390,6 @@ config SCSI_MAC_ESP
>  To compile this driver as a module, choose M here: the module
>  will be called mac_esp.
> 
> -config MVME147_SCSI
> -bool "WD33C93 SCSI driver for MVME147"
> -depends on MVME147 && SCSI=y
> -select SCSI_SPI_ATTRS
> -help
> -  Support for the on-board SCSI controller on the Motorola MVME147
> -  single-board computer.
> -
> config MVME16x_SCSI
>tristate "NCR53C710 SCSI driver for MVME16x"
>depends on MVME16x && SCSI
> diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
> index d5135efbf9cd..9575f291acda 100644
> --- a/drivers/scsi/Makefile
> +++ b/drivers/scsi/Makefile
> @@ -51,7 +51,6 @@ obj-$(CONFIG_SCSI_ZORRO7XX)+= 53c700.ozorro7xx.o
> obj-$(CONFIG_A3000_SCSI)+= a3000.owd33c93.o
> obj-$(CONFIG_A2091_SCSI)+= a2091.owd33c93.o
> obj-$(CONFIG_GVP11_SCSI)+= gvp11.owd33c93.o
> -obj-$(CONFIG_MVME147_SCSI)+= mvme147.owd33c93.o
> obj-$(CONFIG_SGIWD93_SCSI)+= sgiwd93.owd33c93.o
> obj-$(CONFIG_ATARI_SCSI)+= atari_scsi.o
> obj-$(CONFIG_MAC_SCSI)+= mac_scsi.o
> diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
> deleted file mode 100644
> index e6b2b681fda3..
> --- a/drivers/scsi/mvme147.c
> +++ /dev/null
> @@ -1,151 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#include 
> -#include 
> -#include 
> -#include 
> -
> -#include 
> -#include 
> -#include 
> -#include 
> -
> -#include "scsi.h"
> -#include 
> -#include "wd33c93.h"
> -#include "mvme147.h"
> -
> -#include 
> -
> -
> -static irqreturn_t mvme147_intr(int irq, void *data)
> -{
> -struct Scsi_Host *instance = data;
> -
> -if (irq == MVME147_IRQ_SCSI_PORT)
> -wd33c93_intr(instance);
> -else
> -m147_pcc->dma_intr = 0x89;/* Ack and enable ints */
> -return IRQ_HANDLED;
> -}
> -
> -static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
> -{
> -struct Scsi_Host *instance = cmd->device->host;
> -struct WD33C93_hostdata *hdata = shost_priv(instance);
> -unsigned char flags = 0x01;
> -unsigned long addr = virt_to_bus(cmd->SCp.ptr);
> -
> -/* setup dma direction */
> -if (!dir_in)
> -flags |= 0x04;
> -
> -/* remember direction */
> -hdata->dma_dir = dir_in;
> -
> -if (dir_in) {
> -/* invalidate any cache */
> -cache_clear(addr, cmd->SCp.this_residual);
> -} else {
> -/* push any dirty cache */
> -cache_push(addr, cmd->SCp.this_residual);
> -}
> -
> -/* start DMA */
> -m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 << 24);
> -m147_pcc->dma_dadr = addr;
> -m147_pcc->dma_cntrl = flags;
> -
> -/* return success */
> -return 0;
> -}
> -
> -static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
> - int status)
> -{
> -m147_pcc->dma_cntrl = 0;
> -}
> -
> -int mvme147_detect(struct scsi_host_template *tpnt)
> -{
> -static unsigned char called = 0;
> -struct Scsi_Host *instance;
> -wd33c93_regs regs;
> -struct WD33C93_hostdata *hdata;
> -
> -if (!MACH_IS_MVME147 || called)
> -return 0;
> -called++;
> -
> -tpnt->proc_name = "MVME147";
> -tpnt->show_info = wd33c93_show_info,
> -tpnt->write_info = wd33c93_write_info,
> -
> -instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
> -if (!instance)
> -goto err_out;
> -
> -instance->base = 0xfffe4000;
> -instance->irq = MVME147_IRQ_SCSI_PORT;
> -regs.SASR = (volatile unsigned char *)0xfffe4000;
> -regs.SCMD = (volatile unsigned char *)0xfffe4001;
> -hdata = shost_priv(instance);
> -hdata->no_sync = 0xff;
> -hdata->fast = 0;
> -hdata->dma_mode = CTRL_DMA;
> -wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
> -
> -if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
> -"MVME147 SCSI PORT", instance))
> -goto err_unregister;
> -if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
> -"MVME147 S

[PATCH 10/12] scsi: remove the mvme147 driver

2018-03-14 Thread Christoph Hellwig
This driver hasn't seen any recent bug fixing and is one of the last
drivers using the scsi_module.c infrastruture that has been deprecated
15 years ago.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/Kconfig   |   8 ---
 drivers/scsi/Makefile  |   1 -
 drivers/scsi/mvme147.c | 151 -
 drivers/scsi/mvme147.h |  25 
 drivers/scsi/wd33c93.c |   5 --
 5 files changed, 190 deletions(-)
 delete mode 100644 drivers/scsi/mvme147.c
 delete mode 100644 drivers/scsi/mvme147.h

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 11e89e56b865..a95084008fe0 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1390,14 +1390,6 @@ config SCSI_MAC_ESP
  To compile this driver as a module, choose M here: the module
  will be called mac_esp.
 
-config MVME147_SCSI
-   bool "WD33C93 SCSI driver for MVME147"
-   depends on MVME147 && SCSI=y
-   select SCSI_SPI_ATTRS
-   help
- Support for the on-board SCSI controller on the Motorola MVME147
- single-board computer.
-
 config MVME16x_SCSI
tristate "NCR53C710 SCSI driver for MVME16x"
depends on MVME16x && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index d5135efbf9cd..9575f291acda 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -51,7 +51,6 @@ obj-$(CONFIG_SCSI_ZORRO7XX)   += 53c700.o zorro7xx.o
 obj-$(CONFIG_A3000_SCSI)   += a3000.o  wd33c93.o
 obj-$(CONFIG_A2091_SCSI)   += a2091.o  wd33c93.o
 obj-$(CONFIG_GVP11_SCSI)   += gvp11.o  wd33c93.o
-obj-$(CONFIG_MVME147_SCSI) += mvme147.owd33c93.o
 obj-$(CONFIG_SGIWD93_SCSI) += sgiwd93.owd33c93.o
 obj-$(CONFIG_ATARI_SCSI)   += atari_scsi.o
 obj-$(CONFIG_MAC_SCSI) += mac_scsi.o
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
deleted file mode 100644
index e6b2b681fda3..
--- a/drivers/scsi/mvme147.c
+++ /dev/null
@@ -1,151 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include "scsi.h"
-#include 
-#include "wd33c93.h"
-#include "mvme147.h"
-
-#include 
-
-
-static irqreturn_t mvme147_intr(int irq, void *data)
-{
-   struct Scsi_Host *instance = data;
-
-   if (irq == MVME147_IRQ_SCSI_PORT)
-   wd33c93_intr(instance);
-   else
-   m147_pcc->dma_intr = 0x89;  /* Ack and enable ints */
-   return IRQ_HANDLED;
-}
-
-static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
-{
-   struct Scsi_Host *instance = cmd->device->host;
-   struct WD33C93_hostdata *hdata = shost_priv(instance);
-   unsigned char flags = 0x01;
-   unsigned long addr = virt_to_bus(cmd->SCp.ptr);
-
-   /* setup dma direction */
-   if (!dir_in)
-   flags |= 0x04;
-
-   /* remember direction */
-   hdata->dma_dir = dir_in;
-
-   if (dir_in) {
-   /* invalidate any cache */
-   cache_clear(addr, cmd->SCp.this_residual);
-   } else {
-   /* push any dirty cache */
-   cache_push(addr, cmd->SCp.this_residual);
-   }
-
-   /* start DMA */
-   m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 << 24);
-   m147_pcc->dma_dadr = addr;
-   m147_pcc->dma_cntrl = flags;
-
-   /* return success */
-   return 0;
-}
-
-static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
-int status)
-{
-   m147_pcc->dma_cntrl = 0;
-}
-
-int mvme147_detect(struct scsi_host_template *tpnt)
-{
-   static unsigned char called = 0;
-   struct Scsi_Host *instance;
-   wd33c93_regs regs;
-   struct WD33C93_hostdata *hdata;
-
-   if (!MACH_IS_MVME147 || called)
-   return 0;
-   called++;
-
-   tpnt->proc_name = "MVME147";
-   tpnt->show_info = wd33c93_show_info,
-   tpnt->write_info = wd33c93_write_info,
-
-   instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
-   if (!instance)
-   goto err_out;
-
-   instance->base = 0xfffe4000;
-   instance->irq = MVME147_IRQ_SCSI_PORT;
-   regs.SASR = (volatile unsigned char *)0xfffe4000;
-   regs.SCMD = (volatile unsigned char *)0xfffe4001;
-   hdata = shost_priv(instance);
-   hdata->no_sync = 0xff;
-   hdata->fast = 0;
-   hdata->dma_mode = CTRL_DMA;
-   wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
-
-   if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
-   "MVME147 SCSI PORT", instance))
-   goto err_unregister;
-   if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
-   "MVME147 SCSI DMA", instance))
-   goto err_free_irq;
-#if 0  /* Disabled; causes problems booting */
-   m147_pcc->scsi_interrupt = 0x10;/* Assert SCSI bus reset */
-   udelay(100);
-   m147_pcc->scsi_