Re: [PATCH v4] m68k/amiga - Amiga Zorro NCR53C9x boards: new zorro_esp.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

2018-03-17 2:16 GMT+01:00 Michael Schmitz <schmitzmic@xxxxxxxxx>:
> From: Michael Schmitz <schmitz@xxxxxxxxxx>
>
> New combined SCSI driver for all ESP based Zorro SCSI boards for
> m68k Amiga.
>
> Code largely based on board specific parts of the old drivers (blz1230.c,
> blz2060.c, cyberstorm.c, cyberstormII.c, fastlane.c which were removed
> after the 2.6 kernel series for lack of maintenance) with contributions
> by Tuomas Vainikka (TCQ bug tests and workaround) and Finn Thain (TCQ
> bugfix by use of PIO in extended message in transfer).
>
> New Kconfig option and Makefile entries for new Amiga Zorro ESP SCSI
> driver included in this patch.
>
> Use DMA transfers wherever possible, with board-specific DMA set-up
> functions copied from the old driver code. Three byte reselection messages
> do appear to cause DMA timeouts. So wire up a PIO transfer routine for
> these instead. esp_reselect_with_tag explicitly sets esp->cmd_block_dma as
> target address for the message bytes but PIO requires a virtual address.
> Substiute kernel virtual address esp->cmd_block in PIO transfer call if
> DMA address is esp->cmd_block_dma and phase is message in.
>
> PIO code taken from mac_esp.c where the reselection timeout issue was
> debugged and fixed first, with minor macro and function rename.
>
> Signed-off-by: Michael Schmitz <schmitzmic@xxxxxxxxx>
> Reviewed-by: Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx>
> ---
>
> Changes since v1:
>
> Fixed issues raised by Finn Thain in initial code review:
>
> - use KBUILD_MODNAME for driver name string.
> - use pr_fmt() for pr_* format prefix.
> - clean up DMA error reporting: clear error flag before each DMA
>   operation, set error flag on PIO error. Don't test phase in dma_err hook.
> - change confusing comment about semantics of read flag, add comments
>   indicating DMA direction to DMA setup hooks.
> - drop spurious braces around switch clauses.
> - lift cfreq setting out of ID switch clauses.
> - fix indentation.
> - fix error codes on probe fail.
> - drop check for board ID when unmapping DMA regs in error handling:
>   the ioaddr > 0xffffff test already catches all cases where the DMA
>   registers were ioremapped.
> - dynamically alloc zorro_private_data.
> - fix use of driver_data field (don't mix host and zorro_esp_priv
>   pointers). Note: require esp pointer in zorro_esp_priv to find host
>   pointer!
> - back out phase bits changes to pio_cmd !write branch introduced
>   to cope with ESP SELAS command. We don't use that code so keep
>   it in sync with Finn's version.
> - use esp_ops.dma_length_limit() to limit transfer size. After review
>   of old driver code, use 0xffffff max transfer size throughout.
>
> Fixed issues raised by Geert Uytterhoven:
>
> - dynamically alloc zorro_private_data, store as device drvdata.
> - store ctrl_data for CyberStormI in driver private data.
> - use dma_sync_single_for_device() instead of cache_push/clear.
> - handle case of duplicate board identity - check whether board is
>   Zorro III or Zorro II (use ROM resource data for this). Also fix
>   up DMA mask for Zorro II boards to 32 bits (these are really CPU
>   expansion slot boards).
> - remove zorro3 field from driver_data struct (now in private data).
> - add braces around ambiguous if - else construct.
> - use named structs instead of array for board config data.
> - use scsi_option driver data flag for boards with optional ESP.
>
> Other improvements and bugfixes
>
> - fix Zorro device table error (duplicate ID used, also raised
>   by Kars de Jong).
> - error code fixup in error handling path.
> - add separate DMA setup for Blizzard 1230 II board.
> - add support for Cyberstorm II board.
> - add register structs and DMA setup for Zorro III Fastlane board,
>   following logic from old fastlane.c driver. Wire up Fastlane DMA
>   and interrupt status routines, map the necessary low 24 bit board
>   address space used for DMA target address setting. Clean up DMA
>   register space ioremap() branch for Zorro III boards (currently
>   Fastlane only) to end confusion about what to do in error recovery.
> - use esp_ops.fastlane_esp_dma_invalidate() on Fastlane (and skip
>   fastlane_esp_reset_dma() in DMA setup).
> - credit Tuomas Vainikka for contributing Blizzard 1230 code (and
>   testing).
> - clarify comment about unsupported Oktagon SCSI board.
> - remove unused const definitions carried over from old driver.
>
> Changes since v2:
>
> - add SPDX-License-Identifier.
> - remove unused ratelimit.h.
> - drop phys_to_virt() in PIO transfer routine, after ensuring PIO is only
>   used for message in transfers to esp->command_block. This obviates any
>   need for finding the virtual address corresponding to a DMA handle.
> - drop BUG_ON(!(cmd & ESP_CMD_DMA)) assertion in DMA setup. Short of changes
>   to the core ESP driver, this can never trigger.
> - make ioremap() of DMA address range conditional on zep->zorro3 and use
>   that same condition to unmap in error handling and driver exit.
>   Omit board ID test as we only support a single Zorro III board, and add
>   comment on what to do when adding support for more boards.
> - free driver private data in driver exit.
> - various whitespace related cleanup.
>
> Changes since v3:
>
> Finn  Thain:
> - substitute esp->command_block for transfer address in each board DMA
>   set-up, instead of in PIO transfer function.
> - use kzalloc for struct zorro_esp_priv.
> - clarify comment regarding selecting between Blizzard 1230 II or
>   board (both share the ID with the Fastlane board).
> - use dev_get|set_drvdata instead of zorro_get|set_drvdata wrapper.
> - remove redundant comments.
>
> Geert Uytterhoeven:
> - use readb()/writeb() to access DMA registers, obviating the need for
>   declaring register structs volatile.
> - use const for board config and driver data table.
> - drop ZORRO_ESP_GET_PRIV macro.
> - add comments to clarify use of addr and fifo variables in PIO macros.
> - add braces to Zorro II branch (DMA mask fixup).
> - define board ops irq_pending, dma_invalidate and send_dma_cmd via
>   function pointers in driver data.
>
> Tuomas Vainikka:
> - fix wrong config description in Kconfig (from NCR7xx driver).
> ---
>  drivers/scsi/Kconfig     |   14 +
>  drivers/scsi/Makefile    |    1 +
>  drivers/scsi/zorro_esp.c | 1128 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 1143 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/scsi/zorro_esp.c
>
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index 8a739b7..ac3de9d 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -1462,6 +1462,20 @@ config SCSI_ZORRO7XX
>               accelerator card for the Amiga 1200,
>             - the SCSI controller on the GVP Turbo 040/060 accelerator.
>
> +config SCSI_ZORRO_ESP
> +       tristate "Zorro ESP SCSI support"
> +       depends on ZORRO && SCSI
> +       select SCSI_SPI_ATTRS
> +       help
> +         Support for various NCR53C9x (ESP) based SCSI controllers on Zorro
> +         expansion boards for the Amiga.
> +         This includes:
> +           - the Phase5 Blizzard 1320 II and IV SCSI controllers,

1230, not 1320...

> +           - the Phase5 Blizzard 2060 SCSI controller,
> +           - the Phase5 Blizzard Cyberstorm and Cyberstorm II SCSI
> +           - controllers,
> +           - the Fastlane Zorro III SCSI controller.
> +
>  config ATARI_SCSI
>         tristate "Atari native SCSI support"
>         depends on ATARI && SCSI

Kind regards,

Kars.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux