[PATCH RESEND 00/10] Replace via-maciisi with via-cuda driver

2016-12-31 Thread Finn Thain
This patch series has some improvements for the the Cuda driver: cleanup, bug fixes and new functionality. The broken via-maciisi driver is then replaced by via-cuda. This eliminates over 600 LoC. Thanks to Stan Johnson for testing these patches on a Mac LC III and a PowerMac G3. Finn Thain (10

[PATCH RESEND 04/10] via-cuda: Prevent read buffer overflow

2016-12-31 Thread Finn Thain
If the Cuda driver does not enter the 'read_done' state for some reason, it may continue in the 'reading' state until the buffer overflows. Add a bounds check to prevent this. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-cuda.c | 8 +++- 1 file changed, 7 inse

[PATCH RESEND 02/10] via-cuda: Remove redundant temporary variable

2016-12-31 Thread Finn Thain
There is no possibility that current_req can change during execution of cuda_start(). This can be confirmed by inspection: cuda_lock is always held whenever cuda_start() is called or current_req is modified. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-cuda.c | 8

[PATCH RESEND 03/10] via-cuda: Add TREQ, TIP and TACK signal helpers

2016-12-31 Thread Finn Thain
Introduce some helpers for handling the signalling between VIA and Cuda. This abstraction will be used to add support for Egret devices, which utilize slightly different signalling. Don't invert the sense of the Cuda's active-low signals when storing them in the 'status' variable. Just assert, neg

[PATCH RESEND 01/10] via-cuda: Cleanup printk calls

2016-12-31 Thread Finn Thain
Add missing log message severity, remove old debug messages and replace printk() loop with print_hex_dump() call. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-cuda.c | 26 ++ 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/dr

[PATCH RESEND 06/10] via-cuda: Avoid TREQ race condition

2016-12-31 Thread Finn Thain
When a read transaction completes, one of several things will happen: a new transfer is started by the driver, a new transfer request is raised by the Cuda (i.e. TREQ asserted), or both happen at once. When both happen at once, there is a race condition between the TREQ test in the read_done state

[PATCH RESEND 08/10] via-cuda: Initialize data_index early and increment consistently

2016-12-31 Thread Finn Thain
Initialize data_index where appropriate to improve readability and assist debugging. This change doesn't affect driver behaviour. I prefer to see current_req->data[data_index++] in place of current_req->data[0] or current_req->data[1] inasmuchas it becomes obvious what the

[PATCH RESEND 05/10] via-cuda: Fix re-initialization of reply_ptr and reading_reply

2016-12-31 Thread Finn Thain
When reading_reply is set, reply_ptr points into an adb_request struct. Conversely, when reply_ptr instead points into the global cuda_rbuf, reading_reply must be false. Unfortunately, this rule can be violated because re-initialization of reply_ptr and reading_reply presently depends on the TREQ

[PATCH RESEND 07/10] via-cuda: Use spinlock_irq_save/restore instead of enable/disable_irq

2016-12-31 Thread Finn Thain
The cuda_start() function uses spinlock_irq_save/restore for mutual exclusion. Let's have cuda_poll() do the same when polling the VIA interrupt. The benefit to disabling local irqs when the interrupt is being polled is that the interrupt handler now has the same timing properties regardless of wh

[PATCH RESEND 09/10] via-cuda: Add support for Egret system controller

2016-12-31 Thread Finn Thain
The Egret system controller was the predecessor to the Cuda and the differences are minor. On Cuda, byte acknowledgement requires one transition of the TACK signal; on Egret two are needed. On Cuda, TIP is active low; on Egret it is active high. And Cuda raises certain interrupts that Egret omits.

[PATCH RESEND 10/10] m68k/mac: Replace via-maciisi driver with via-cuda driver

2016-12-31 Thread Finn Thain
Change the device probe test in the via-cuda.c driver so it will load on Egret-based machines too. Remove the now redundant via-maciisi.c driver. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- arch/m68k/include/asm/macintosh.h | 2 +- arch/m68k/mac/config.c| 18 +- arch/m6