diff options
| author | Finn Thain <fthain@linux-m68k.org> | 2026-09-04 19:26:36 +1000 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-09-23 05:14:06 -0600 |
| commit | 994a778d966592d0e211deaf6e436fcb21413935 (patch) | |
| tree | 57923e1aa0d9d6d3768801effb02270cabde2d6b /drivers/block | |
| parent | 52981bb358d1b5c38040b00f81e2cf973f9148ad (diff) | |
| download | linux-next-994a778d966592d0e211deaf6e436fcb21413935.tar.gz linux-next-994a778d966592d0e211deaf6e436fcb21413935.zip | |
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: 8852ecd97488 ("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>
Diffstat (limited to 'drivers/block')
| -rw-r--r-- | drivers/block/swim.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 190b2e1b5b0e..c2d7ad3f065c 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -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); |
