Re: [PATCH 03/31] swim: Enable the drive when probing
Laurent Vivier <[email protected]> Mon, 20 Jul 2026 20:08:37 +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:
> According to the ISM spec, the MOTON bit "causes the Enable 1 and Enable=
2
> signals to be turned on to the drive." It doesn't actually turn on the
> motor. When selecting a drive, enable MOTON. Disable it upon eject or
> release. This fixes detection of the Sony FDHD drive.
>=20
> Fixes: 8852ecd97488 ("m68k: mac - Add SWIM floppy support")
> Signed-off-by: Finn Thain <[email protected]>
> ---
> drivers/block/swim.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>=20
Reviewed-by: Laurent Vivier <[email protected]>
> diff --git a/drivers/block/swim.c b/drivers/block/swim.c
> index 2c52a210f4a6..2a400e544959 100644
> --- a/drivers/block/swim.c
> +++ b/drivers/block/swim.c
> @@ -154,8 +154,9 @@ struct iwm {
> /*--------------------------------------------------------------------=
=2D-------*/
> =20
> enum drive_location {
> - INTERNAL_DRIVE =3D 0x02,
> - EXTERNAL_DRIVE =3D 0x04,
> + NO_DRIVE =3D 0,
> + INTERNAL_DRIVE =3D BIT(1),
> + EXTERNAL_DRIVE =3D BIT(2),
> };
> =20
> enum media_type {
> @@ -311,9 +312,15 @@ static inline void swim_drive(struct swim __iomem *=
base,
> if (location =3D=3D INTERNAL_DRIVE) {
> swim_write(base, mode0, EXTERNAL_DRIVE); /* clear drive 1 bit */
> swim_write(base, mode1, INTERNAL_DRIVE); /* set drive 0 bit */
> + swim_write(base, mode1, MOTON);
> } else if (location =3D=3D EXTERNAL_DRIVE) {
> swim_write(base, mode0, INTERNAL_DRIVE); /* clear drive 0 bit */
> swim_write(base, mode1, EXTERNAL_DRIVE); /* set drive 1 bit */
> + swim_write(base, mode1, MOTON);
> + } else {
> + swim_write(base, mode0, INTERNAL_DRIVE);
> + swim_write(base, mode0, EXTERNAL_DRIVE);
> + swim_write(base, mode0, MOTON);
> }
> }
> =20
> @@ -447,6 +454,7 @@ static int floppy_eject(struct floppy_state *fs)
> swim_drive(base, fs->location);
> swim_motor(base, OFF);
> swim_eject(base);
> + swim_drive(base, NO_DRIVE);
> =20
> fs->disk_in =3D 0;
> fs->ejected =3D 1;
> @@ -652,8 +660,10 @@ static int floppy_open(struct gendisk *disk, blk_mo=
de_t mode)
> else if (fs->ref_count > 0)
> --fs->ref_count;
> =20
> - if (fs->ref_count =3D=3D 0)
> + if (fs->ref_count =3D=3D 0) {
> swim_motor(base, OFF);
> + swim_drive(base, NO_DRIVE);
> + }
> return err;
> }
> =20
> @@ -682,6 +692,7 @@ static void floppy_release(struct gendisk *disk)
> if (fs->ref_count =3D=3D 0) {
> swim_drive(base, fs->location);
> swim_motor(base, OFF);
> + swim_drive(base, NO_DRIVE);
> }
> mutex_unlock(&swim_mutex);
> }
> @@ -804,6 +815,7 @@ static int swim_floppy_init(struct swim_priv *swd)
> if (swim_readbit(base, DRIVE_PRESENT) &&
> !swim_readbit(base, ONEMEG_DRIVE))
> swim_add_floppy(swd, EXTERNAL_DRIVE);
> + swim_drive(base, NO_DRIVE);
> =20
> /* register floppy drives */
> =20