[PATCH v3 75/77] ncr5380: Enable PDMA for DTC chips

2015-12-21 Thread Finn Thain
tware.org> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- Changes to Ondrej's version: - Rebased. --- drivers/scsi/g_NCR5380.c | 38 +++--- drivers/scsi/g_NCR5380.h |3 ++- 2 files changed, 33 insertions(+), 8 deletions(-) Index: linux/driver

[PATCH v3 71/77] ncr5380: Cleanup whitespace and parentheses

2015-12-21 Thread Finn Thain
Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 30 +++--- drivers/scsi/atari_NCR5380.c | 26 +- 2 files changed, 32 insertions(+), 24 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH v3 72/77] ncr5380: Fix pseudo DMA transfers on 53C400

2015-12-21 Thread Finn Thain
(Canon FG2-5202). Signed-off-by: Ondrej Zary <li...@rainbow-software.org> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/g_NCR5380.c |4 1 file changed, 4 insertions(+) Index: linux/driver

[PATCH v3 49/77] ncr5380: Remove redundant ICR_ARBITRATION_LOST test and eliminate FLAG_DTC3181E

2015-12-21 Thread Finn Thain
Arbitration Lost test. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 14 +- drivers/scsi/NCR5380.h |1 - drivers/scsi/atari_NCR5380.c |9 - drivers/scsi/dmx3191d.c |2 +- drivers/scsi/g_NCR5380.c

[PATCH v3 44/77] ncr5380: Fix off-by-one bug in extended_msg[] bounds check

2015-12-21 Thread Finn Thain
Fix the array bounds check when transferring an extended message from the target. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |3 ++- drivers/scsi/atari_NCR5380.c |4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) Index: linux/d

[PATCH v3 41/77] ncr5380: Replace redundant flags with FLAG_NO_DMA_FIXUP

2015-12-21 Thread Finn Thain
of the TCR_LAST_BYTE_SENT bit. Remove the old flags. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 68 +++ drivers/scsi/NCR5380.h |4 -- drivers/scsi/dtc.c |4 -- drivers/scsi/g_NCR5380.c |2 - 4

[PATCH v3 65/77] atari_scsi, sun3_scsi: Remove global Scsi_Host pointer

2015-12-21 Thread Finn Thain
This refactoring removes two global Scsi_Host pointers. This improves consistency with other ncr5380 drivers. Adopting the same conventions as the other drivers makes them easier to read. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/atari_NCR5380.c |5 +- d

[PATCH v3 60/77] ncr5380: Implement new eh_abort_handler

2015-12-21 Thread Finn Thain
is addressed in a subsequent patch. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 155 ++ drivers/scsi/atari_NCR5380.c | 157 ++- 2 files changed, 282 insertions(

[PATCH v3 61/77] ncr5380: Fix EH during arbitration and selection

2015-12-21 Thread Finn Thain
to track the command in arbitration or selection phase. Replace 'retain_dma_irq' with the new 'selecting' pointer, to bring atari_NCR5380.c into line with NCR5380.c. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH v3 46/77] ncr5380: Fix NDEBUG_NO_DATAOUT flag

2015-12-21 Thread Finn Thain
NDEBUG_NO_DATAOUT should not disable DATA IN phases too. Fix this. (This bug has long been fixed in atari_NCR5380.c.) Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux/drivers/scsi/NCR

[PATCH v3 51/77] ncr5380: Remove command list debug code

2015-12-21 Thread Finn Thain
for debugging, the easiest way to fix the discrepancy is simply remove this code. The only remaining users of NCR5380_show_info() and NCR5380_write_info() are drivers that define PSEUDO_DMA. The others have no use for the .show_info method, so don't initialize it. Signed-off-by: Finn Thain <

[PATCH v3 37/77] ncr5380: Standardize work queueing algorithm

2015-12-21 Thread Finn Thain
the information transfer state machine from queuecommand because, according to Documentation/scsi/scsi_mid_low_api.txt that could happen in soft irq context. Fix this. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.h |1 drivers/scsi/atari_NCR5380.c

[PATCH v3 45/77] ncr5380: Cleanup #include directives

2015-12-21 Thread Finn Thain
Remove unused includes (stat.h, signal.h, proc_fs.h) and move includes needed by the core drivers into the common header (delay.h etc). Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |2 -- drivers/scsi/NCR5380.h |4 drivers/sc

[PATCH v3 19/77] ncr5380: Cleanup bogus {request,release}_region() calls

2015-12-21 Thread Finn Thain
region() calls in dtc.c, pas16.c and t128.c. Fix these issues. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/arm/cumana_1.c |6 -- drivers/scsi/dtc.c |2 -- drivers/scsi/pas16.c|2 -- drivers/scsi/t128.c |2 -- 4 files ch

[PATCH v3 27/77] ncr5380: Add missing lock in eh_abort_handler

2015-12-21 Thread Finn Thain
[ef885ea0] [c0046870] worker_thread+0x14c/0x430 [ef885ed0] [c004e4f4] kthread+0xd8/0xec [ef885f40] [c00124d4] ret_from_kernel_thread+0x5c/0x64 Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |9 - 1 file changed, 8 insertions(+), 1 de

[PATCH v3 43/77] ncr5380: Standardize reselection handling

2015-12-21 Thread Finn Thain
selection, don't interfere with the chip registers after a reselection interrupt intervenes. Clean up some trivial issues with code style, comments and printk. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH v3 33/77] atari_NCR5380: Set do_abort() timeouts

2015-12-21 Thread Finn Thain
Use timeouts in do_abort() in atari_NCR5380.c instead of infinite loops. Also fix the kernel-doc comment. Keep the two core driver forks in sync. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 26 +- drivers/scsi/atari_N

[PATCH v3 34/77] atari_NCR5380: Use arbitration timeout

2015-12-21 Thread Finn Thain
Allow target selection to fail with a timeout instead of waiting in infinite loops. This gets rid of the unused NCR_TIMEOUT macro, it is more defensive and has proved helpful in debugging. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH v3 38/77] ncr5380: Remove UNSAFE macro

2015-12-21 Thread Finn Thain
things because then we would have to handle the possibility of EH handler invocation during a PDMA transfer. The comments say that instead of using this macro, "you're going to be better off twiddling with transfersize". I agree. Remove this stuff. Signed-off-by: Finn

[PATCH v3 29/77] ncr5380: Remove references to linked commands

2015-12-21 Thread Finn Thain
From: Hannes Reinecke <h...@suse.de> Some old drivers partially implemented support for linked commands using a "proposed" next_link pointer in struct scsi_cmnd that never actually existed. Remove this code. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- This

[PATCH v3 57/77] ncr5380: Use standard list data structure

2015-12-21 Thread Finn Thain
nly be churn because the existing EH handlers don't work and get replaced in a subsequent patch. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- Changed since v2: - Fix NULL pointer dereference in NCR5380_reselect() when SUPPORT_TAGS is enabled in the atari_NCR5380.c co

[PATCH v3 36/77] ncr5380: Use work_struct instead of delayed_work

2015-12-21 Thread Finn Thain
Each host instance now has it's own work queue so the main() work item can sleep when necessary. That means we can use a simple work item rather than a delayed work item. This brings NCR5380.c closer to atari_NCR5380.c. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- driver

[PATCH v3 35/77] ncr5380: Dont wait for BUS FREE after disconnect

2015-12-21 Thread Finn Thain
eouts" and perhaps BUS FREE polling was somehow helpful back in Linux v0.99.14u, when it was introduced. The relevant timeout is presently 1 second (for bus arbitration). Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |7 --- drivers/scsi/atari_

[PATCH v3 39/77] ncr5380: Standardize interrupt handling

2015-12-21 Thread Finn Thain
e not. Before clearing the chip IRQ flag, clear all state that may cause it to be raised. That means clearing the DMA Mode and Busy Monitor bits in the Mode Register and clearing the host ID in the Select Enable register. Also clean up some printk's and some comments. Keep atari_NCR5380.c and NCR5380.c

[PATCH v3 55/77] ncr5380: Remove LIST and REMOVE macros

2015-12-21 Thread Finn Thain
Printing command pointers can be useful when debugging queues. Other than that, the LIST and REMOVE macros are just clutter. These macros are redundant now that NDEBUG_QUEUES causes pointers to be printed, so remove them. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- driver

[PATCH v3 47/77] ncr5380: Fix and cleanup scsi_host_template initializers

2015-12-21 Thread Finn Thain
Add missing .module initializer. Use distinct .proc_name values for the g_NCR5380 and g_NCR5380_mmio modules. Remove pointless CAN_QUEUE and CMD_PER_LUN override macros. Cleanup whitespace and code style. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/atari_

[PATCH v3 52/77] ncr5380: Remove H_NO macro and introduce dsprintk

2015-12-21 Thread Finn Thain
of subsequent patches. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |9 --- drivers/scsi/NCR5380.h |5 +++ drivers/scsi/atari_NCR5380.c | 54 +-- 3 files changed, 38 insertions(+), 30 del

[PATCH v3 42/77] ncr5380: Replace READ_OVERRUNS macro with FLAG_NO_DMA_FIXUPS

2015-12-21 Thread Finn Thain
, to eliminate the READ_OVERRUNS macro. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH v3 32/77] ncr5380: Fix bus phase in do_abort()

2015-12-21 Thread Finn Thain
NCR5380_poll_politely() returns either 0 (success) or -ETIMEDOUT. However, in do_abort(), the return value is incorrectly taken to be the status register value. This means that the bus is put into DATA OUT phase instead of MESSAGE OUT. Fix this. Signed-off-by: Finn Thain <

[PATCH v3 40/77] ncr5380: Introduce NCR5380_poll_politely2

2015-12-21 Thread Finn Thain
SCSI bus protocol sometimes requires monitoring two related conditions simultaneously. Enhance NCR5380_poll_politely() for this purpose, and put it to use in the arbitration algorithm. It will also find use in pseudo DMA. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- driver

[PATCH v3 31/77] ncr5380: Fix !REQ timeout in do_abort()

2015-12-21 Thread Finn Thain
NCR5380_poll_politely() never returns -1. That means do_abort() can fail to handle a timeout after waiting for the target to negate REQ. Fix this and cleanup other NCR5380_poll_politely() call sites. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH v3 48/77] atari_NCR5380: Fix queue_size limit

2015-12-21 Thread Finn Thain
obsolete comments. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/atari_NCR5380.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) Index: linux/drivers/scsi/atari_NCR

[PATCH v3 04/77] ncr5380: Remove more pointless macros

2015-12-21 Thread Finn Thain
ASM macro is never defined. rtrc in pas16.c is not used. NCR5380_map_config, do_NCR5380_intr, do_t128_intr and do_pas16_intr are unused. NCR_NOT_SET harms readability. Remove them. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> Reviewed-by: Hannes Reinecke <h...@suse.com>

[PATCH v3 08/77] ncr5380: Move NCR53C400-specific code

2015-12-21 Thread Finn Thain
kinds of boards. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> Reviewed-by: Hannes Reinecke <h...@suse.com> --- Changed since v1: - Don't set FLAG_NO_PSEUDO_DMA when !defined(PSEUDO_DMA). It's pointless. --- drivers/scsi/NCR5380.c | 18 -- drivers/scsi

[PATCH v3 05/77] ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros

2015-12-21 Thread Finn Thain
for that purpose because the Scsi_Host struct has not yet been instantiated. Moreover, these macros were removed from atari_NCR5380.c long ago and now they constitute yet another discrepancy between the two core driver forks. Remove these "optimizations". Signed-off-by: Finn

[PATCH v3 03/77] ncr5380: Eliminate PDEBUG*, TDEBUG* and DTCDEBUG* macros

2015-12-21 Thread Finn Thain
Replace {P,T,DTC}DEBUG_INIT with NDEBUG_INIT. Remove dead debugging code, including code that's conditional upon *DEBUG_TRANSFER. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> Reviewed-by: Hannes Reinecke <h...@suse.com> --- drivers/scsi/dtc.c | 18 ++

[PATCH v3 01/77] atari_scsi: Fix SCSI host ID setting

2015-12-21 Thread Finn Thain
The NVRAM location of this byte is 16, as documented in http://toshyp.atari.org/en/004009.html This was confirmed by Michael Schmitz, by setting the SCSI host ID under EmuTOS and then checking the value in /proc/driver/nvram and /dev/nvram under Linux. Signed-off-by: Finn Thain <

[PATCH v3 30/77] ncr5380: Add missing break after case MESSAGE_REJECT

2015-12-21 Thread Finn Thain
MESSAGE REJECT does not imply DISCONNECT: the target is about to enter MESSAGE IN or MESSAGE OUT phase. This bug fix comes from atari_NCR5380.c. Unfortunately it never made it into the original NCR5380.c core driver. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- driver

[PATCH v3 02/77] ncr5380: Remove redundant static variable initializers

2015-12-21 Thread Finn Thain
Signed-off-by: Finn Thain <fth...@telegraphics.com.au> Reviewed-by: Hannes Reinecke <h...@suse.com> --- drivers/scsi/NCR5380.c |2 +- drivers/scsi/dtc.c |4 ++-- drivers/scsi/g_NCR5380.c |4 ++-- drivers/scsi/pas16.c | 10 +- drivers/scsi/sun3_s

[PATCH v3 25/77] ncr5380: Rework disconnect versus poll logic

2015-12-21 Thread Finn Thain
for this discrepancy. The timing seems to have no relation to the type of adapter. Bizarrely, the timing in g_NCR5380 seems to relate only to one particular type of target device. This patch attempts to solve the problem for all NCR5380 drivers and all target devices. Signed-off-by: Finn Tha

[PATCH v3 20/77] ncr5380: Introduce unbound workqueue

2015-12-21 Thread Finn Thain
Allocate a work queue that will permit busy waiting and sleeping. This means NCR5380_init() can potentially fail, so add this error path. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- In subsequent patches, the work function adopts this work queue so it can sleep while p

[PATCH v3 26/77] ncr5380: Fix NCR5380_transfer_pio() result

2015-12-21 Thread Finn Thain
bits in STATUS_REG so that NCR5380_transfer_pio() can return the correct result. The return value is presently unused (perhaps because of bugs like this) but this change at least fixes the caller's phase variable, which is passed by reference. Signed-off-by: Finn Thain <fth...@telegraphics.com

[PATCH v3 69/77] ncr5380: Merge changes from atari_NCR5380.c

2015-12-21 Thread Finn Thain
the important ones, to facilitate reunification. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 155 +++-- 1 file changed, 87 insertions(+), 68 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH v3 70/77] atari_NCR5380: Merge changes from NCR5380.c

2015-12-21 Thread Finn Thain
the important ones, to facilitate reunification. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/atari_NCR5380.c | 108 +-- 1 file changed, 64 insertions(+), 44 deletions(-) Index: linux/drivers/scsi/atari_NCR

[PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp

2015-12-21 Thread Finn Thain
.c This removes some unimportant discrepancies between the two core driver forks so that 'diff' can be used to reveal the important ones, to facilitate reunification. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH v3 28/77] ncr5380: Drop DEF_SCSI_QCMD macro

2015-12-21 Thread Finn Thain
Remove the DEF_SCSI_QCMD macro (already removed from atari_NCR5380.c). The lock provided by DEF_SCSI_QCMD is only needed for queue data structures. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 30 +++--- driver

[PATCH v3 24/77] ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro

2015-12-21 Thread Finn Thain
. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/arm/cumana_1.c |3 +++ drivers/scsi/arm/oak.c |2 ++ drivers/scsi/atari_NCR5380.c |8 +--- drivers/scsi/dtc.c

[PATCH v3 22/77] ncr5380: Eliminate selecting state

2015-12-21 Thread Finn Thain
. We can sleep while polling now that we have a suitable workqueue. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 74 --- drivers/scsi/NCR5380.h |2 - drivers/scsi/atari_NCR5380.c

[PATCH v3 77/77] ncr5380: Add support for HP C2502

2015-12-21 Thread Finn Thain
; Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- Changes to Ondrej's versions: - Omit a redundant comment. - Throw an error if MMIO register locations are not known. - Avoid 'if (...) { ... continue; } else { ... }' - Fix "warning: 'port_idx' may be used uninitialized"

[PATCH v3 73/77] ncr5380: Use runtime register mapping

2015-12-21 Thread Finn Thain
.@rainbow-software.org> Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.h | 13 -- drivers/scsi/g_NCR5380.c | 88 +-- drivers/scsi/g_NCR5380.h | 12 -- 3 files changed, 49 insertions(+), 64 d

[PATCH v3 23/77] ncr5380: Always retry arbitration and selection

2015-12-21 Thread Finn Thain
or lost arbitration. The "else break" clause in NCR5380_main() that gets removed here appears to be a vestige of a long-gone loop that iterated over host instances. See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in history/history.git. Signed-off-by: Finn Thain <fth

[PATCH v3 21/77] ncr5380: Sleep when polling, if possible

2015-12-21 Thread Finn Thain
5380 hardware implementations. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- Changed since v1: - Don't rely on loops_per_jiffy to estimate register access speed, measure it instead. Changed since v2: - As suggested by Geert Uytterhoeven: calibration now begins when jiffies c

[PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers

2015-12-21 Thread Finn Thain
Like my previous work on the NCR5380 drivers, this patch series has bug fixes, code cleanup and modernization. These drivers suffer from mistakes, poor style and neglect and this long series addresses the worst of it, covering all ten wrapper drivers and both of the core driver forks. The

Re: [PATCH v3 18/77] ncr5380: Eliminate USLEEP_WAITLONG delay

2015-12-22 Thread Finn Thain
On Tue, 22 Dec 2015, Hannes Reinecke wrote: > On 12/22/2015 02:17 AM, Finn Thain wrote: > > Linux 2.1.105 introduced the USLEEP_WAITLONG delay, apparently "needed for > > Mustek scanners". It is intended to stall the issue queue for 5 seconds. > >

Re: [PATCH v3 20/77] ncr5380: Introduce unbound workqueue

2015-12-22 Thread Finn Thain
On Tue, 22 Dec 2015, Hannes Reinecke wrote: > On 12/22/2015 02:17 AM, Finn Thain wrote: > > Allocate a work queue that will permit busy waiting and sleeping. This > > means NCR5380_init() can potentially fail, so add this error path. > > > > Signed-off-by: Finn Thain

Re: [PATCH v3 66/77] ncr5380: Fix soft lockups

2015-12-22 Thread Finn Thain
On Tue, 22 Dec 2015, One Thousand Gnomes wrote: > On Tue, 22 Dec 2015 12:18:44 +1100 Finn Thain > <fth...@telegraphics.com.au> wrote: > > > Because of the rudimentary design of the chip, it is necessary to poll > > the SCSI bus signals during PIO and this tends to h

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-24 Thread Finn Thain
On Tue, 24 Nov 2015, Ondrej Zary wrote: > On Tuesday 24 November 2015 10:13:17 Finn Thain wrote: > > > > On Tue, 24 Nov 2015, Ondrej Zary wrote: > > > > > On Tuesday 24 November 2015, Finn Thain wrote: > > > > > > > > On Mon, 23 Nov 2015,

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-24 Thread Finn Thain
On Tue, 24 Nov 2015, Ondrej Zary wrote: > On Wednesday 18 November 2015 09:35:17 Finn Thain wrote: > > Linux v2.1.105 changed the algorithm for polling for the BSY signal > > in NCR5380_select() and NCR5380_main(). > > > > Presently, this code has a bug. Back then, NC

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-26 Thread Finn Thain
On Thu, 26 Nov 2015, Ondrej Zary wrote: > > [ 156.014234] scsi host2: Generic NCR5380/NCR53C400 SCSI, io_port 0x0, > n_io_port 0, base 0xd8000, irq 0, can_queue 16, cmd_per_lun 2, sg_tablesize > 128, this_id 7, flags { NO_DMA_FIXUP }, options { AUTOPROBE_IRQ PSEUDO_DMA } > [ 156.020369]

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-28 Thread Finn Thain
On Sun, 29 Nov 2015, Ondrej Zary wrote: > > [...] I think that this should solve the problem: > > Yes, it does! > > [ 48.119367] scsi host2: Generic NCR5380/NCR53C400 SCSI, io_port 0x0, > n_io_port 0, base 0xd8000, irq 0, can_queue 16, cmd_per_lun 2, sg_tablesize > 128, this_id 7, flags {

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-29 Thread Finn Thain
On Sun, 29 Nov 2015, Geert Uytterhoeven wrote: > This still heavily depends on the processing time spent in > NCR5380_read(). You should never use a value derived from > loops_per_jiffy for a non-empty loop, Sure but the time-out condition isn't supposed to be precise. Plus/minus a jiffy is

Re: [PATCH 00/71] More fixes, cleanup and modernization for NCR5380 drivers

2015-11-25 Thread Finn Thain
On Wed, 25 Nov 2015, Ondrej Zary wrote: > On Wednesday 25 November 2015, Finn Thain wrote: > > > > On Tue, 24 Nov 2015, Ondrej Zary wrote: > > > > > Instead of fixing split transfers, simply forced everything > > > non-modulo-128 to PIO: > > &

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-29 Thread Finn Thain
On Sun, 29 Nov 2015, Geert Uytterhoeven wrote: > If an ISA access takes 8 us, while the CPU runs at 1 GHz, i.e. 500M > loops/s, the difference will be huge. Ondrej showed that an ISA access can take about 1.6 us. I don't know what to make of the "8 uS" comment in the mainline driver. Maybe it

Re: [RFC PATCH 75/71] ncr5380: Remove FLAG_DTC3181E

2015-11-29 Thread Finn Thain
On Sun, 29 Nov 2015, Ondrej Zary wrote: > The FLAG_DTC3181E is used to activate a work-around for arbitration lost > condition that these chips see when ICR is written during arbitration. > > Move the ICR write (to set SEL and BSY) after the arbitration loss check > and remove FLAG_DTC3181E.

Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A

2015-11-30 Thread Finn Thain
On Sun, 29 Nov 2015, Ondrej Zary wrote: > Add I/O register mapping for NCR53C400A and enable PDMA mode to > improve performance and fix non-working IRQ. > > Tested with HP C2502 (and user-space enabler). > > Signed-off-by: Ondrej Zary > --- >

Re: [RFC PATCH 74/71] ncr5380: Enable PDMA for NCR53C400A

2015-11-30 Thread Finn Thain
On Sun, 29 Nov 2015, Ondrej Zary wrote: > Add I/O register mapping for NCR53C400A and enable PDMA mode to > improve performance and fix non-working IRQ. > Is CONFIG_SCSI_GENERIC_NCR53C400 is still needed? Can the driver be fully configured at runtime now? > Tested with HP C2502 (and

Re: [RFC PATCH 73/71] ncr5380: Use runtime register mapping

2015-11-30 Thread Finn Thain
On Sun, 29 Nov 2015, Ondrej Zary wrote: > Convert compile-time C400_ register mapping to runtime mapping. > This removes the weird negative register offsets and allows adding > additional mappings. > > Signed-off-by: Ondrej Zary > --- > drivers/scsi/NCR5380.h |

Re: [PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-26 Thread Finn Thain
On Wed, 25 Nov 2015, Ondrej Zary wrote: > On Wednesday 25 November 2015 04:17:09 Finn Thain wrote: > > > > On Tue, 24 Nov 2015, Ondrej Zary wrote: > > > > > > > > Bisecting slow module initialization pointed to this commit. > > > > >

[PATCH 25/71] ncr5380: Rework disconnect versus poll logic

2015-11-18 Thread Finn Thain
for this discrepancy. The timing seems to have no relation to the type of adapter. Bizarrely, the timing in g_NCR5380 seems to relate only to one particular type of target device. This patch attempts to solve the problem for all NCR5380 drivers and all target devices. Signed-off-by: Finn Tha

[PATCH 19/71] ncr5380: Cleanup bogus {request,release}_region() calls

2015-11-18 Thread Finn Thain
region() calls in dtc.c, pas16.c and t128.c. Fix these issues. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/arm/cumana_1.c |6 -- drivers/scsi/dtc.c |2 -- drivers/scsi/pas16.c|2 -- drivers/scsi/t128.c |2 -- 4 files ch

[PATCH 28/71] ncr5380: Drop DEF_SCSI_QCMD macro

2015-11-18 Thread Finn Thain
Remove the DEF_SCSI_QCMD macro (already removed from atari_NCR5380.c). The lock provided by DEF_SCSI_QCMD is only needed for queue data structures. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 30 +++--- driver

[PATCH 21/71] ncr5380: Sleep when polling, if possible

2015-11-18 Thread Finn Thain
When in process context, sleep during polling if doing so won't add significant latency. In interrupt context or if the lock is held, poll briefly then give up. Keep both core drivers in sync. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH 02/71] ncr5380: Remove redundant static variable initializers

2015-11-18 Thread Finn Thain
Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |2 +- drivers/scsi/dtc.c |4 ++-- drivers/scsi/g_NCR5380.c |4 ++-- drivers/scsi/pas16.c | 10 +- drivers/scsi/sun3_scsi.c |8 drivers/scsi/t128.c |4 +

[PATCH 57/71] ncr5380: Use standard list data structure

2015-11-18 Thread Finn Thain
nly be churn because the existing EH handlers don't work and get replaced in a subsequent patch. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 214 +--- drivers/scsi/NCR5380.h | 16 ++ drivers/scsi/arm/cumana_1.

[PATCH 53/71] ncr5380: Use shost_priv helper

2015-11-18 Thread Finn Thain
Make use of the shost_priv() helper. Remove HOSTDATA and SETUP_HOSTDATA macros because they harm readability. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 23 ++- drivers/scsi/atari_NCR5380.c | 20 +++- 2

[PATCH 52/71] ncr5380: Remove H_NO macro and introduce dsprintk

2015-11-18 Thread Finn Thain
of subsequent patches. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 11 +--- drivers/scsi/NCR5380.h |5 +++ drivers/scsi/atari_NCR5380.c | 57 +-- 3 files changed, 40 insertions(+), 33 del

[PATCH 58/71] ncr5380: Refactor command completion

2015-11-18 Thread Finn Thain
Implement a 'complete_cmd' function to complete commands. This is needed by the following patch; the new function provides a site for the logic needed to correctly handle REQUEST SENSE commands. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH 23/71] ncr5380: Always retry arbitration and selection

2015-11-18 Thread Finn Thain
or lost arbitration. The "else break" clause in NCR5380_main() that gets removed here appears to be a vestige of a long-gone loop that iterated over host instances. See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in history/history.git. Signed-off-by: Finn Thain <fth

[PATCH 16/71] ncr5380: Proceed with next command after NCR5380_select() calls scsi_done

2015-11-18 Thread Finn Thain
issue queue. Clarify this logic. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- Good code style would be, if (this) { /* do stuff */ } rather than, if (!this) { } else { /* do stuff */ } But I've used the

[PATCH 15/71] ncr5380: Always escalate bad target time-out in NCR5380_select()

2015-11-18 Thread Finn Thain
o a target that doesn't assert BSY. We need to handle these two cases differently; the latter case can be left to the SCSI ML. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 13 - drivers/scsi/NCR5380.h |6 -- drivers/scsi/atari_

[PATCH 13/71] ncr5380: Remove redundant register writes

2015-11-18 Thread Finn Thain
Remove the duplicate write to the Select Enable Register that appeared in v1.1.38. Also remove the redundant write to Initiator Command Register prior to calling do_abort(). Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c |2 -- driver

[PATCH 09/71] atari_NCR5380: Reset bus on driver initialization if required

2015-11-18 Thread Finn Thain
. They are indispensible. Keep the two implementations in sync. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 33 +++- drivers/scsi/atari_NCR5380.c | 113 +++ 2 files changed, 134 insertions(+), 12 del

[PATCH 14/71] ncr5380: Use return instead of goto in NCR5380_select()

2015-11-18 Thread Finn Thain
The "failed" label in NCR5380_select() is not helpful. Some failures return 0, others -1. Use return instead of goto to improve clarity and brevity, like atari_NCR5380.c does. Fix the relevant comments. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- driver

[PATCH 60/71] ncr5380: Implement new eh_abort_handler

2015-11-18 Thread Finn Thain
is addressed in a subsequent patch. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 155 ++ drivers/scsi/atari_NCR5380.c | 157 ++- 2 files changed, 282 insertions(

[PATCH 63/71] atari_NCR5380: Remove HOSTNO macro from printk() and seq_printf() calls

2015-11-18 Thread Finn Thain
Remove the HOSTNO macro that is peculiar to atari_NCR5380.c and contributes to the problem of divergence of the NCR5380 core drivers. Keep NCR5380.c in sync. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 17 + driver

[PATCH 24/71] ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro

2015-11-18 Thread Finn Thain
. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 32 +--- drivers/scsi/arm/cumana_1.c |3 +++ drivers/scsi/arm/oak.c |2 ++ drivers/scsi/atari_NCR5380.c |8 +--- drivers/scsi/dtc.c

[PATCH 42/71] ncr5380: Replace READ_OVERRUNS macro with FLAG_NO_DMA_FIXUPS

2015-11-18 Thread Finn Thain
, to eliminate the READ_OVERRUNS macro. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH 43/71] ncr5380: Standardize reselection handling

2015-11-18 Thread Finn Thain
selection, don't interfere with the chip registers after a reselection interrupt intervenes. Clean up some trivial issues with code style, comments and printk. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH 17/71] ncr5380: Keep BSY asserted when entering SELECTION phase

2015-11-18 Thread Finn Thain
NCR5380.c is not compliant with the SCSI-2 standard (at least, not with the draft revision 10L that I have to refer to). The selection algorithm in atari_NCR5380.c is correct, so use that. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- The NCR 5380 Family datasheet has a flow

[PATCH 50/71] ncr5380: Change instance->host_lock to hostdata->lock

2015-11-18 Thread Finn Thain
ck should be uncontested even when the SCSI bus is contested. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 83 - drivers/scsi/NCR5380.h |1 drivers/scsi/atari_NCR5380.c | 139 +

[PATCH 70/71] atari_NCR5380: Merge changes from NCR5380.c

2015-11-18 Thread Finn Thain
the important ones, to facilitate reunification. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/atari_NCR5380.c | 108 +-- 1 file changed, 64 insertions(+), 44 deletions(-) Index: linux/drivers/scsi/atari_NCR

[PATCH 56/71] ncr5380: Remove redundant volatile qualifiers

2015-11-18 Thread Finn Thain
The hostdata struct is now protected by a spin lock so the volatile qualifiers are redundant. Remove them. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.h | 12 ++-- drivers/scsi/atari_NCR5380.c |2 +- 2 files changed, 7 insertions

[PATCH 20/71] ncr5380: Introduce unbound workqueue

2015-11-18 Thread Finn Thain
Allocate a work queue that will permit busy waiting and sleeping. This means NCR5380_init() can potentially fail, so add this error path. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- In subsequent patches, the work function adopts this work queue so it can sleep while p

[PATCH 22/71] ncr5380: Eliminate selecting state

2015-11-18 Thread Finn Thain
. We can sleep while polling now that we have a suitable workqueue. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 74 --- drivers/scsi/NCR5380.h |2 - drivers/scsi/atari_NCR5380.c

[PATCH 69/71] ncr5380: Merge changes from atari_NCR5380.c

2015-11-18 Thread Finn Thain
the important ones, to facilitate reunification. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 157 +++-- 1 file changed, 89 insertions(+), 68 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH 71/71] ncr5380: Cleanup whitespace and parentheses

2015-11-18 Thread Finn Thain
Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c | 30 +++--- drivers/scsi/atari_NCR5380.c | 26 +- 2 files changed, 32 insertions(+), 24 deletions(-) Index: linux/drivers/scsi/NCR

[PATCH 34/71] atari_NCR5380: Use arbitration timeout

2015-11-18 Thread Finn Thain
Allow target selection to fail with a timeout instead of waiting in infinite loops. This gets rid of the unused NCR_TIMEOUT macro, it is more defensive and has proved helpful in debugging. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.c

[PATCH 37/71] ncr5380: Standardize work queueing algorithm

2015-11-18 Thread Finn Thain
the information transfer state machine from queuecommand because, according to Documentation/scsi/scsi_mid_low_api.txt that could happen in soft irq context. Fix this. Signed-off-by: Finn Thain <fth...@telegraphics.com.au> --- drivers/scsi/NCR5380.h |1 drivers/scsi/atari_NCR5380.c

[PATCH 39/71] ncr5380: Standardize interrupt handling

2015-11-18 Thread Finn Thain
e not. Before clearing the chip IRQ flag, clear all state that may cause it to be raised. That means clearing the DMA Mode and Busy Monitor bits in the Mode Register and clearing the host ID in the Select Enable register. Also clean up some printk's and some comments. Keep atari_NCR5380.c and NCR5380.c

[PATCH 26/71] ncr5380: Fix NCR5380_transfer_pio() result

2015-11-18 Thread Finn Thain
bits in STATUS_REG so that NCR5380_transfer_pio() can return the correct result. The return value is presently unused (perhaps because of bugs like this) but this change at least fixes the caller's phase variable, which is passed by reference. Signed-off-by: Finn Thain <fth...@telegraphics.com

<    1   2   3   4   5   6   7   8   9   >