Re: [PATCH 06/31] swim: Configure parameter memory
Laurent Vivier <[email protected]> Mon, 20 Jul 2026 20:31:03 +0200
| Newsgroups | org.kernel.vger.linux-m68k,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Le 16/07/2026 =C3=A0 12:02, Finn Thain a =C3=A9crit=C2=A0:
> 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.
>=20
> 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.
>=20
> Fixes: 8852ecd97488 ("m68k: mac - Add SWIM floppy support")
> Signed-off-by: Finn Thain <[email protected]>
> ---
> drivers/block/swim.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>=20
Reviewed-by: Laurent Vivier <[email protected]>
> diff --git a/drivers/block/swim.c b/drivers/block/swim.c
> index 7499ff250ca7..481fb1e63ac1 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);
> }
> =20
> +static void swim_set_parameters(struct swim __iomem *base)
> +{
> + unsigned int i;
> + static const u8 mem[] =3D { 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 =3D 0; i < 16; ++i)
> + swim_write(base, parameter, mem[i]);
> +}
> +
> static int swim_floppy_init(struct swim_priv *swd)
> {
> struct queue_limits lim =3D {
> @@ -805,6 +816,8 @@ static int swim_floppy_init(struct swim_priv *swd)
> int drive;
> struct swim __iomem *base =3D swd->base;
> =20
> + swim_set_parameters(base);
> +
> /* scan floppy drives */
> =20
> swim_drive(base, INTERNAL_DRIVE);