[PATCH v3 00/33] block/swim: Fixes and improvements

Finn Thain posted 33 patches 3 weeks ago
arch/m68k/mac/config.c   |  31 ++-
drivers/block/swim.c     | 451 ++++++++++++++++++++-------------------
drivers/block/swim_asm.S | 356 +++++++++++++++---------------
3 files changed, 452 insertions(+), 386 deletions(-)
[PATCH v3 00/33] block/swim: Fixes and improvements
Posted by Finn Thain 3 weeks ago
I recently had a need for the 'swim' driver but found that it was too buggy
to be useful for my purposes. I had two aims in mind--

Firstly, I needed this driver to help me test my new BMoW Floppy Emu for 
emulation correctness. Being that Linux is open source and MacOS is not,
this driver should be ideal for that.

Secondly, I needed to realign the heads in some disk drives. The swim driver
has most of the code needed for a feedback loop for manual re-alignment, so
I wrote the remaining code and pushed it to a repo here:
https://github.com/fthain/linux/commits/swim/

These patches fix all the bugs I found. They improve stability,
compatibility and performance. Additional patches improve source code
quality by removing redundant code and cleaning up a bit.

This patch series was successfully tested on the following systems.

Mac Quadra 650 - SWIM 2 with Mitsubishi FDD
Mac LC III     - SWIM 2 with Mitsubishi FDD and Sony FDD
Mac Quadra 700 - SWIM with Sony FDD
Mac IIvx       - SWIM with Sony FDD

---

Changed since v1:
 - Patches 1/31, 19/31, 23/31 were revised as per Laurent's remarks.
 - Some minor improvements to patches 9/31, 13/31 and 16/31.
 - Added patch 24/32 to fix a bug causing silent IO corruption instead
   of an IO error.

Changed since v2:
 - Reviewed-by tags were dropped from patches 1/32, 9/32, 13/32 and 16/32
   because of unreviewed changes.
 - Better assembly code in patch 13/32.
 - Patch 23/32 improved upon to reduce excessive interrupt latency when
   medium errors are encountered.
 - Patch 7/32 was split in two, and readability was improved as requested
   by Geert.
 - Geert's acked-by tag was added.

---

Finn Thain (33):
  swim: Assert strobe with stable outputs
  swim: Select appropriate drive once only
  swim: Enable the drive when probing
  swim: Don't disable drive after every sector
  swim: Perform ISM/IWM mode switching according to specs
  swim: Configure parameter memory
  swim: Refactor SWIM setup
  swim: Enable clock divider only where appropriate
  swim: Don't start motor until medium is present
  swim: Recalibrate when drive is probed
  swim: Add track zero recalibration delay
  swim: Handle FIFO timeout error
  swim: Simplify return value initialization
  swim: Check for CRC errors
  swim: Check error register during sector read
  swim: Don't use the mark register to read data
  swim: Fix buffer overflow
  swim: Convert to blocking queue
  swim: Remove redundant RELAX actions
  swim: Deduplicate polling loops
  swim: Check drive ready bit
  swim: Revisit delays
  swim: Remove pointless mode0 register write
  swim: Don't needlessly re-read sectors
  swim: Don't search beyond the first data mark
  swim: Remove pointless specifiers
  swim: Move swd initialization
  swim: Add some helpful references
  swim: Remove unused macro definitions
  swim: Clean up whitespace
  swim: Define macros for constants
  swim: Define symbols for constants
  swim: Unexport global symbols

 arch/m68k/mac/config.c   |  31 ++-
 drivers/block/swim.c     | 451 ++++++++++++++++++++-------------------
 drivers/block/swim_asm.S | 356 +++++++++++++++---------------
 3 files changed, 452 insertions(+), 386 deletions(-)

-- 
2.52.0
Re: [PATCH v3 00/33] block/swim: Fixes and improvements
Posted by Stanley J. Johnson 2 days, 20 hours ago
Tested-by: Stan Johnson <userm57@yahoo.com>

This patch series was successfully tested on a Mac IIci.

On 9/4/26 3:26 AM, Finn Thain wrote:
> I recently had a need for the 'swim' driver but found that it was too buggy
> to be useful for my purposes. I had two aims in mind--
> 
> Firstly, I needed this driver to help me test my new BMoW Floppy Emu for
> emulation correctness. Being that Linux is open source and MacOS is not,
> this driver should be ideal for that.
> 
> Secondly, I needed to realign the heads in some disk drives. The swim driver
> has most of the code needed for a feedback loop for manual re-alignment, so
> I wrote the remaining code and pushed it to a repo here:
> https://github.com/fthain/linux/commits/swim/
> 
> These patches fix all the bugs I found. They improve stability,
> compatibility and performance. Additional patches improve source code
> quality by removing redundant code and cleaning up a bit.
> 
> This patch series was successfully tested on the following systems.
> 
> Mac Quadra 650 - SWIM 2 with Mitsubishi FDD
> Mac LC III     - SWIM 2 with Mitsubishi FDD and Sony FDD
> Mac Quadra 700 - SWIM with Sony FDD
> Mac IIvx       - SWIM with Sony FDD
> 
> ---
> 
> Changed since v1:
>   - Patches 1/31, 19/31, 23/31 were revised as per Laurent's remarks.
>   - Some minor improvements to patches 9/31, 13/31 and 16/31.
>   - Added patch 24/32 to fix a bug causing silent IO corruption instead
>     of an IO error.
> 
> Changed since v2:
>   - Reviewed-by tags were dropped from patches 1/32, 9/32, 13/32 and 16/32
>     because of unreviewed changes.
>   - Better assembly code in patch 13/32.
>   - Patch 23/32 improved upon to reduce excessive interrupt latency when
>     medium errors are encountered.
>   - Patch 7/32 was split in two, and readability was improved as requested
>     by Geert.
>   - Geert's acked-by tag was added.
> 
> ---
> 
> Finn Thain (33):
>    swim: Assert strobe with stable outputs
>    swim: Select appropriate drive once only
>    swim: Enable the drive when probing
>    swim: Don't disable drive after every sector
>    swim: Perform ISM/IWM mode switching according to specs
>    swim: Configure parameter memory
>    swim: Refactor SWIM setup
>    swim: Enable clock divider only where appropriate
>    swim: Don't start motor until medium is present
>    swim: Recalibrate when drive is probed
>    swim: Add track zero recalibration delay
>    swim: Handle FIFO timeout error
>    swim: Simplify return value initialization
>    swim: Check for CRC errors
>    swim: Check error register during sector read
>    swim: Don't use the mark register to read data
>    swim: Fix buffer overflow
>    swim: Convert to blocking queue
>    swim: Remove redundant RELAX actions
>    swim: Deduplicate polling loops
>    swim: Check drive ready bit
>    swim: Revisit delays
>    swim: Remove pointless mode0 register write
>    swim: Don't needlessly re-read sectors
>    swim: Don't search beyond the first data mark
>    swim: Remove pointless specifiers
>    swim: Move swd initialization
>    swim: Add some helpful references
>    swim: Remove unused macro definitions
>    swim: Clean up whitespace
>    swim: Define macros for constants
>    swim: Define symbols for constants
>    swim: Unexport global symbols
> 
>   arch/m68k/mac/config.c   |  31 ++-
>   drivers/block/swim.c     | 451 ++++++++++++++++++++-------------------
>   drivers/block/swim_asm.S | 356 +++++++++++++++---------------
>   3 files changed, 452 insertions(+), 386 deletions(-)
>
Re: [PATCH v3 00/33] block/swim: Fixes and improvements
Posted by Jens Axboe 2 days, 17 hours ago
On Fri, 04 Sep 2026 19:26:36 +1000, Finn Thain wrote:
> I recently had a need for the 'swim' driver but found that it was too buggy
> to be useful for my purposes. I had two aims in mind--
> 
> Firstly, I needed this driver to help me test my new BMoW Floppy Emu for
> emulation correctness. Being that Linux is open source and MacOS is not,
> this driver should be ideal for that.
> 
> [...]

Applied, thanks!

[01/33] swim: Assert strobe with stable outputs
        commit: adcc410bfb41715fef198a0975db4ed594a49bb7
[02/33] swim: Select appropriate drive once only
        commit: a2d22b3f25c388f9fbce7bf36a45a8900dce4aa3
[03/33] swim: Enable the drive when probing
        commit: 57d88c8f4ea34a4dd7c5351bd026e225c7283f3f
[04/33] swim: Don't disable drive after every sector
        commit: 05a7c4b197279cfb3ec3df26146ce085a2438aec
[05/33] swim: Perform ISM/IWM mode switching according to specs
        commit: 52981bb358d1b5c38040b00f81e2cf973f9148ad
[06/33] swim: Configure parameter memory
        commit: 994a778d966592d0e211deaf6e436fcb21413935
[07/33] swim: Refactor SWIM setup
        commit: 62977e8ea98e99dbf86609e65930e6607398e1c5
[08/33] swim: Enable clock divider only where appropriate
        commit: 3c02a14c89962c88ed0abb3cce4101021c63149c
[09/33] swim: Don't start motor until medium is present
        commit: dbbaaae83cb277d76e70426c0f0ce289e867ed77
[10/33] swim: Recalibrate when drive is probed
        commit: ba087774a1493ade524f8a783461fa8be9c75039
[11/33] swim: Add track zero recalibration delay
        commit: b9c1095048537cc9563f12d0a24f2f0df129e4d5
[12/33] swim: Handle FIFO timeout error
        commit: 2e9bcbecee68431b689d16b23bc5529db686f8d4
[13/33] swim: Simplify return value initialization
        commit: 385a44e78702762e2fce796cf37b6f465d86a87f
[14/33] swim: Check for CRC errors
        commit: 01bff87152e6748fbac9ccd645d3d5f490d75ddc
[15/33] swim: Check error register during sector read
        commit: d66bdef0a3083fed1a0fc4f0ee1c85b26476b21c
[16/33] swim: Don't use the mark register to read data
        commit: cb7923133ec18e67e2d6718e29426a4423af6b73
[17/33] swim: Fix buffer overflow
        commit: a54870a4ae4962acf341eb6ca010cae02af1a6ea
[18/33] swim: Convert to blocking queue
        commit: 92353a04763726f70fea6be90957c50fc18215e0
[19/33] swim: Remove redundant RELAX actions
        commit: 04cb277e6841b55b950b42063fe11501b5d1676a
[20/33] swim: Deduplicate polling loops
        commit: b736189c93c9ad1056521a4229ec2f252b714b5a
[21/33] swim: Check drive ready bit
        commit: abae04f5bed924590e98fe1519566a6e0144e6b5
[22/33] swim: Revisit delays
        commit: bbcd3e38a4f355d6b0320f3f6916df96c109f2ad
[23/33] swim: Remove pointless mode0 register write
        commit: 151848934fa4696067a8ca861cef5efe7aa1e046
[24/33] swim: Don't needlessly re-read sectors
        commit: 22fbea97bc18fd099730572bf9aeba9879d62b02
[25/33] swim: Don't search beyond the first data mark
        commit: 79eafa4ccb74be023fd2cae87d75425d6eb903bb
[26/33] swim: Remove pointless specifiers
        commit: c516ded6f6da38b64ce9f69c88e65a65927296bb
[27/33] swim: Move swd initialization
        commit: c0862cf48fae35571489b79b1c84db16691f2ad8
[28/33] swim: Add some helpful references
        commit: bd4a21b8452d48be48cbc66693d27ff3c1f88d9b
[29/33] swim: Remove unused macro definitions
        commit: 7d7c6d91f5657b2979cae7c7dcb49d2523efd894
[30/33] swim: Clean up whitespace
        commit: e97cbb470cf94ce018558c899bcad387f69c99f5
[31/33] swim: Define macros for constants
        commit: d4b2519065d6db2eb7cd36d178591058452da3e0
[32/33] swim: Define symbols for constants
        commit: 75f47f0910f4f4289c11409398c05999aec19f37
[33/33] swim: Unexport global symbols
        commit: e7a6727deab0d300171ee059b7dbcdbdb3c46797

Best regards,
-- 
Jens Axboe