All of lore.kernel.org
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Laurent Vivier <lvivier@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 05/12] block/swim: Use HEDSEL bit in ISM mode register
Date: Sat, 31 Mar 2018 21:41:05 -0400 (EDT)	[thread overview]
Message-ID: <98a06aa971599e04715a718abdd83eb5742a36da.1522546571.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1522546571.git.fthain@telegraphics.com.au>

The floppy drive 'HEDSEL' line is normally connected to VIA1 but some
models don't do this. According to 'The Guide to Macintosh Family
Hardware', on the Mac IIfx the SWIM device has to generate this
signal.

Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 arch/m68k/mac/iop.c  |  1 +
 drivers/block/swim.c | 20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 7864dcca5891..23cf89da0c2d 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -130,6 +130,7 @@
 /* Non-zero if the IOPs are present */
 
 int iop_scc_present, iop_ism_present;
+EXPORT_SYMBOL(iop_ism_present);
 
 /* structure for tracking channel listeners */
 
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index ef4361dc5b26..3e3e72b141d3 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -27,6 +27,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/mac_via.h>
+#include <asm/mac_iop.h>
 
 #define CARDNAME "swim"
 
@@ -135,7 +136,8 @@ struct iwm {
 
 /* bits in setup register */
 
-#define S_INV_WDATA	0x01
+#define S_Q3_OUTPUT	0x01 /* SWIM */
+#define S_INV_WDATA	0x01 /* SWIM 2 */
 #define S_3_5_SELECT	0x02
 #define S_GCR		0x04
 #define S_FCLK_DIV2	0x08
@@ -273,8 +275,13 @@ static inline void swim_select(struct swim __iomem *base, int sel)
 {
 	swim_write(base, phase, RELAX);
 
-	via1_set_head(sel & 0x100);
-
+	if (iop_ism_present) {
+		if (sel & 0x100)
+			swim_write(base, mode1, HEDSEL);
+		else
+			swim_write(base, mode0, HEDSEL);
+	} else
+		via1_set_head(sel & 0x100);
 	swim_write(base, phase, sel & CA_MASK);
 }
 
@@ -644,7 +651,12 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
 	else
 		fs->ref_count++;
 
-	swim_write(base, setup, S_IBM_DRIVE  | S_FCLK_DIV2);
+	if (iop_ism_present)
+		swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2 |
+			   S_Q3_OUTPUT);
+	else
+		swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2);
+
 	udelay(10);
 	swim_drive(base, INTERNAL_DRIVE);
 	swim_motor(base, ON);
-- 
2.16.1

  parent reply	other threads:[~2018-04-01  1:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  1:41 [PATCH 00/12] SWIM driver fixes Finn Thain
2018-04-01  1:41 ` [PATCH 04/12] m68k/mac: Place ISM IOP in bypass mode Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-01  1:41 ` [PATCH 02/12] m68k/mac: Fix SWIM memory resource end address Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-09 12:51   ` Geert Uytterhoeven
2018-04-01  1:41 ` [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-09 12:54   ` Geert Uytterhoeven
2018-04-09 15:17     ` Luc Van Oostenryck
2018-04-10  1:35     ` Finn Thain
2018-04-10  2:38     ` Michael Schmitz
2018-04-01  1:41 ` [PATCH 01/12] m68k/mac: Revisit floppy disc controller base addresses Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-01  1:41 ` [PATCH 10/12] block/swim: Check drive type Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-01  1:41 ` [PATCH 11/12] block/swim: Fix IO error at end of medium Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-01  1:41 ` [PATCH 07/12] block/swim: Remove extra put_disk() call from error path Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-09 13:11   ` Geert Uytterhoeven
2018-04-01  1:41 ` [PATCH 12/12] block/swim: Select appropriate drive on device open Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-01  1:41 ` [PATCH 08/12] block/swim: Don't log an error message for an invalid ioctl Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-09 13:14   ` Geert Uytterhoeven
2018-04-10  1:27     ` Finn Thain
2018-04-01  1:41 ` [PATCH 09/12] block/swim: Rename macros to avoid inconsistent inverted logic Finn Thain
2018-04-01  1:41   ` Finn Thain
2018-04-01  1:41 ` Finn Thain [this message]
2018-04-05  1:33   ` [PATCH 05/12] block/swim: Use HEDSEL bit in ISM mode register Sasha Levin
2018-04-01  1:41 ` [PATCH 06/12] block/swim: Fix array bounds check Finn Thain
2018-04-05  1:33   ` Sasha Levin
2018-04-09 13:08   ` Geert Uytterhoeven
2018-04-10  1:10     ` Finn Thain
2018-04-03 19:07 ` [PATCH 00/12] SWIM driver fixes Laurent Vivier
2018-04-03 22:53   ` Finn Thain
2018-04-03 23:32 ` Jens Axboe
2018-04-03 23:33   ` Jens Axboe
2018-04-05  1:33 ` Sasha Levin
2018-04-05  6:30   ` Greg KH
2018-04-05  6:40     ` Sasha Levin
2018-04-05  6:51       ` Greg KH
2018-04-07  0:14   ` Finn Thain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98a06aa971599e04715a718abdd83eb5742a36da.1522546571.git.fthain@telegraphics.com.au \
    --to=fthain@telegraphics.com.au \
    --cc=axboe@kernel.dk \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=lvivier@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.