swim: Configure parameter memory

The original SWIM chip has a 16 byte memory to store parameters which
control read/write timing. The SWIM 2 chip retains the last 4 parameters
which control write pre-compensation, but omits the first 12. Hence
SWIM 2 can perform reads without any parameter memory setup but SWIM 1
cannot.

Configure the SWIM parameter memory with the appropriate values so that
SWIM 1 can read too. The parameters used here were observed in SWIM chip
memory, using Macsbug, while MacOS was reading from an MFM floppy disk.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Fixes: 8852ecd974 ("m68k: mac - Add SWIM floppy support")
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Tested-by: Stan Johnson <userm57@yahoo.com>
Link: https://patch.msgid.link/eccb76911fd255330b05eb3174ac15c29bb41a23.1788513996.git.fthain@linux-m68k.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Finn Thain 2026-09-04 19:26:36 +10:00 committed by Jens Axboe
parent 52981bb358
commit 994a778d96

View File

@ -796,6 +796,17 @@ static void swim_cleanup_floppy_disk(struct floppy_state *fs)
blk_mq_free_tag_set(&fs->tag_set);
}
static void swim_set_parameters(struct swim __iomem *base)
{
unsigned int i;
static const u8 mem[] = { 0x18, 0x41, 0x2e, 0x2e, 0x18, 0x18, 0x1b, 0x1b,
0x2f, 0x2f, 0x19, 0x19, 0x97, 0x1b, 0x57, 0x3b, };
swim_write(base, mode0, 0); /* reset parameter memory index */
for (i = 0; i < 16; ++i)
swim_write(base, parameter, mem[i]);
}
static int swim_floppy_init(struct swim_priv *swd)
{
struct queue_limits lim = {
@ -805,6 +816,8 @@ static int swim_floppy_init(struct swim_priv *swd)
int drive;
struct swim __iomem *base = swd->base;
swim_set_parameters(base);
/* scan floppy drives */
swim_drive(base, INTERNAL_DRIVE);