Re: [PATCH 21/31] swim: Revisit delays

Laurent Vivier <[email protected]> Sun, 26 Jul 2026 16:50:36 +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:
> AFAIK, timing requirements for the various FDHD drive mechanisms aren't
> well documented. But we do have the UPD72070 spec and secondary sources
> like swim3.c and mkLinux source code. This patch is needed to satisfy
> the requirements in the UPD72070 spec and follows mkLinux.
>=20
> Change the LSTRB pulse to 2 microseconds, because this is what mkLinux
> does. Inside Macintosh says, "Hold LSTRB high for at least one usec but
> not more than one msec".
>=20
> When a disk is ejected, pause before de-asserting /ENBL. Wait 150 us aft=
er
> the STEP command for valid signalling. Pause for 1 us after setting the
> step direction before sending the STEP command.
>=20
> Fixes: 8852ecd97488 ("m68k: mac - Add SWIM floppy support")
> Signed-off-by: Finn Thain <[email protected]>
> ---
>   drivers/block/swim.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Laurent Vivier <[email protected]>

>=20
> diff --git a/drivers/block/swim.c b/drivers/block/swim.c
> index 77d7ac3765ae..44fe7a79059c 100644
> --- a/drivers/block/swim.c
> +++ b/drivers/block/swim.c
> @@ -290,7 +290,7 @@ static inline void swim_action(struct swim __iomem *=
base, int action)
>   	swim_select(base, action);
>   	udelay(1);
>   	swim_write(base, phase, action | LSTRB);
> -	udelay(1);
> +	udelay(2);
>   	swim_write(base, phase, action);
>   	udelay(1);
>  =20
> @@ -340,6 +340,7 @@ static inline void swim_drive(struct swim __iomem *b=
ase,
>   		swim_write(base, mode0, EXTERNAL_DRIVE);
>   		swim_write(base, mode0, MOTON);
>   	}
> +	udelay(1);
>   }
>  =20
>   static inline void swim_motor(struct swim __iomem *base,
> @@ -358,6 +359,7 @@ static inline void swim_eject(struct swim __iomem *b=
ase)
>   {
>   	swim_action(base, EJECT);
>   	swim_readbit_timeout(base, DISK_IN, false, 2000 * 1000);
> +	msleep(1);
>   }
>  =20
>   static inline void swim_head(struct swim __iomem *base, enum head head=
)
> @@ -371,6 +373,7 @@ static inline void swim_head(struct swim __iomem *ba=
se, enum head head)
>   static inline int swim_step(struct swim __iomem *base)
>   {
>   	swim_action(base, STEP);
> +	udelay(150);
>   	return swim_readbit_timeout_atomic(base, STEP, false, 20 * 1000);
>   }
>  =20
> @@ -401,6 +404,7 @@ static inline int swim_seek(struct swim __iomem *bas=
e, int step)
>   		step =3D -step;
>   	} else if (step > 0)
>   		swim_action(base, SEEK_POSITIVE);
> +	udelay(1);
>  =20
>   	swim_READY_timeout(base);
>  =20