2018-04-01 01:43:46

by Finn Thain

[permalink] [raw]
Subject: [PATCH 00/12] SWIM driver fixes

This patch series has fixes for bugs in the SWIM floppy disk controller
driver, including an oops and a soft lockup.

There are also patches to add support for SWIM devices connected to IOPs.

Geert, would you please take this series through the m68k tree once the
necessary "acked-by" tags arrive?

Jens, I've Cc'd you too because there's no official maintainer for
drivers/block/swim.c and none for the drivers/block/ directory either.

The series could be separated into m68k patches and block driver patches
and sent through different trees if that's preferred.

I did not do so because "acked-by" tags would still be needed and because
separating patches 4 and 5 didn't make much sense.


Finn Thain (12):
m68k/mac: Revisit floppy disc controller base addresses
m68k/mac: Fix SWIM memory resource end address
m68k/mac: Don't remap SWIM MMIO region
m68k/mac: Place ISM IOP in bypass mode
block/swim: Use HEDSEL bit in ISM mode register
block/swim: Fix array bounds check
block/swim: Remove extra put_disk() call from error path
block/swim: Don't log an error message for an invalid ioctl
block/swim: Rename macros to avoid inconsistent inverted logic
block/swim: Check drive type
block/swim: Fix IO error at end of medium
block/swim: Select appropriate drive on device open

arch/m68k/include/asm/macintosh.h | 10 +--
arch/m68k/mac/config.c | 126 ++++++++++++++++++++------------------
arch/m68k/mac/iop.c | 8 ++-
drivers/block/swim.c | 69 +++++++++++----------
drivers/block/swim3.c | 6 +-
5 files changed, 118 insertions(+), 101 deletions(-)

--
2.16.1



2018-04-01 01:42:53

by Finn Thain

[permalink] [raw]
Subject: [PATCH 02/12] m68k/mac: Fix SWIM memory resource end address

The resource size is 0x2000 == end - start + 1.
Therefore end == start + 0x2000 - 1.

Cc: Laurent Vivier <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
arch/m68k/mac/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 54f3a8421afc..1aba633b7268 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -1007,7 +1007,7 @@ int __init mac_platform_init(void)
struct resource swim_rsrc = {
.flags = IORESOURCE_MEM,
.start = (resource_size_t)swim_base,
- .end = (resource_size_t)swim_base + 0x2000,
+ .end = (resource_size_t)swim_base + 0x1FFF,
};

platform_device_register_simple("swim", -1, &swim_rsrc, 1);
--
2.16.1


2018-04-01 01:43:02

by Finn Thain

[permalink] [raw]
Subject: [PATCH 12/12] block/swim: Select appropriate drive on device open

Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index c4eb54575574..64226c56ffb2 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -660,7 +660,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
swim_write(base, setup, S_IBM_DRIVE | S_FCLK_DIV2);

udelay(10);
- swim_drive(base, INTERNAL_DRIVE);
+ swim_drive(base, fs->location);
swim_motor(base, ON);
swim_action(base, SETMFM);
if (fs->ejected)
--
2.16.1


2018-04-01 01:43:27

by Finn Thain

[permalink] [raw]
Subject: [PATCH 11/12] block/swim: Fix IO error at end of medium

Reading to the end of a 720K disk results in an IO error instead of EOF
because the block layer thinks the disk has 2880 sectors. (Partly this
is a result of inverted logic of the ONEMEG_MEDIA bit that's now fixed.)

Initialize the density and head count in swim_add_floppy() to agree
with the device size passed to set_capacity() during drive probe.

Call set_capacity() again upon device open, after refreshing the density
and head count values.

Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 6e3ebf5519e3..c4eb54575574 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -619,7 +619,6 @@ static void setup_medium(struct floppy_state *fs)
struct floppy_struct *g;
fs->disk_in = 1;
fs->write_protected = swim_readbit(base, WRITE_PROT);
- fs->type = swim_readbit(base, TWOMEG_MEDIA);

if (swim_track00(base))
printk(KERN_ERR
@@ -627,6 +626,9 @@ static void setup_medium(struct floppy_state *fs)

swim_track00(base);

+ fs->type = swim_readbit(base, TWOMEG_MEDIA) ?
+ HD_MEDIA : DD_MEDIA;
+ fs->head_number = swim_readbit(base, SINGLE_SIDED) ? 1 : 2;
get_floppy_geometry(fs, 0, &g);
fs->total_secs = g->size;
fs->secpercyl = g->head * g->sect;
@@ -668,6 +670,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
goto out;
}

+ set_capacity(fs->disk, fs->total_secs);
+
if (mode & FMODE_NDELAY)
return 0;

@@ -820,10 +824,9 @@ static int swim_add_floppy(struct swim_priv *swd, enum drive_location location)

swim_motor(base, OFF);

- if (swim_readbit(base, SINGLE_SIDED))
- fs->head_number = 1;
- else
- fs->head_number = 2;
+ fs->type = HD_MEDIA;
+ fs->head_number = 2;
+
fs->ref_count = 0;
fs->ejected = 1;

--
2.16.1


2018-04-01 01:43:41

by Finn Thain

[permalink] [raw]
Subject: [PATCH 04/12] m68k/mac: Place ISM IOP in bypass mode

Some Mac models have an IOP for offloading floppy disk IO. Linux once
had a driver for that but it got removed in commit b21a323710e7
("[PATCH] remove the broken BLK_DEV_SWIM_IOP driver").

Put the ISM IOP into bypass mode so that the existing 'swim_mod' driver
can access the controller directly. Use the appropriate macros for the
flag bits.

Cc: Laurent Vivier <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
arch/m68k/mac/iop.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 9bfa17015768..7864dcca5891 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -234,6 +234,7 @@ static struct iop_msg *iop_get_unused_msg(void)
* is to find and initialize the IOPs early in the boot sequence, so that
* the serial IOP can be placed into bypass mode _before_ we try to
* initialize the serial console.
+ * The ISM IOP is put into bypass mode for compatibility with the swim driver.
*/

void __init iop_preinit(void)
@@ -244,7 +245,8 @@ void __init iop_preinit(void)
} else {
iop_base[IOP_NUM_SCC] = (struct mac_iop *) SCC_IOP_BASE_QUADRA;
}
- iop_base[IOP_NUM_SCC]->status_ctrl = 0x87;
+ iop_base[IOP_NUM_SCC]->status_ctrl = IOP_BYPASS | IOP_AUTOINC |
+ IOP_RUN | IOP_DMAINACTIVE;
iop_scc_present = 1;
} else {
iop_base[IOP_NUM_SCC] = NULL;
@@ -256,7 +258,8 @@ void __init iop_preinit(void)
} else {
iop_base[IOP_NUM_ISM] = (struct mac_iop *) ISM_IOP_BASE_QUADRA;
}
- iop_base[IOP_NUM_ISM]->status_ctrl = 0;
+ iop_base[IOP_NUM_ISM]->status_ctrl = IOP_BYPASS | IOP_AUTOINC |
+ IOP_RUN | IOP_DMAINACTIVE;
iop_ism_present = 1;
} else {
iop_base[IOP_NUM_ISM] = NULL;
--
2.16.1


2018-04-01 01:44:00

by Finn Thain

[permalink] [raw]
Subject: [PATCH 05/12] block/swim: Use HEDSEL bit in ISM mode register

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 <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
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


2018-04-01 01:44:11

by Finn Thain

[permalink] [raw]
Subject: [PATCH 06/12] block/swim: Fix array bounds check

In the floppy_find() function in swim.c is a call to
get_disk(swd->unit[drive].disk). The actual parameter to this call
can be a NULL pointer when drive == swd->floppy_count. This causes
an oops in get_disk().

Data read fault at 0x00000198 in Super Data (pc=0x1be5b6)
BAD KERNEL BUSERR
Oops: 00000000
Modules linked in: swim_mod ipv6 mac8390
PC: [<001be5b6>] get_disk+0xc/0x76
SR: 2004 SP: 9a078bc1 a2: 0213ed90
d0: 00000000 d1: 00000000 d2: 00000000 d3: 000000ff
d4: 00000002 d5: 02983590 a0: 02332e00 a1: 022dfd64
Process dd (pid: 285, task=020ab25b)
Frame format=B ssw=074d isc=4a88 isb=6732 daddr=00000198 dobuf=00000000
baddr=001be5bc dibuf=bfffffff ver=f
Stack from 022dfca4:
00000000 0203fc00 0213ed90 022dfcc0 02982936 00000000 00200000 022dfd08
0020f85a 00200000 022dfd64 02332e00 004040fc 00000014 001be77e 022dfd64
00334e4a 001be3f8 0800001d 022dfd64 01c04b60 01c04b70 022aba80 029828f8
02332e00 022dfd2c 001be7ac 0203fc00 00200000 022dfd64 02103a00 01c04b60
01c04b60 0200e400 022dfd68 000e191a 00200000 022dfd64 02103a00 0800001d
00000000 00000003 000b89de 00500000 02103a00 01c04b60 02103a08 01c04c2e
Call Trace: [<02982936>] floppy_find+0x3e/0x4a [swim_mod]
[<00200000>] uart_remove_one_port+0x1a2/0x260
[<0020f85a>] kobj_lookup+0xde/0x132
[<00200000>] uart_remove_one_port+0x1a2/0x260
[<001be77e>] get_gendisk+0x0/0x130
[<00334e4a>] mutex_lock+0x0/0x2e
[<001be3f8>] disk_block_events+0x0/0x6c
[<029828f8>] floppy_find+0x0/0x4a [swim_mod]
[<001be7ac>] get_gendisk+0x2e/0x130
[<00200000>] uart_remove_one_port+0x1a2/0x260
[<000e191a>] __blkdev_get+0x32/0x45a
[<00200000>] uart_remove_one_port+0x1a2/0x260
[<000b89de>] complete_walk+0x0/0x8a
[<000e1e22>] blkdev_get+0xe0/0x29a
[<000e1fdc>] blkdev_open+0x0/0xb0
[<000b89de>] complete_walk+0x0/0x8a
[<000e1fdc>] blkdev_open+0x0/0xb0
[<000e01cc>] bd_acquire+0x74/0x8a
[<000e205c>] blkdev_open+0x80/0xb0
[<000e1fdc>] blkdev_open+0x0/0xb0
[<000abf24>] do_dentry_open+0x1a4/0x322
[<00020000>] __do_proc_douintvec+0x22/0x27e
[<000b89de>] complete_walk+0x0/0x8a
[<000baa62>] link_path_walk+0x0/0x48e
[<000ba3f8>] inode_permission+0x20/0x54
[<000ac0e4>] vfs_open+0x42/0x78
[<000bc372>] path_openat+0x2b2/0xeaa
[<000bc0c0>] path_openat+0x0/0xeaa
[<0004463e>] __irq_wake_thread+0x0/0x4e
[<0003a45a>] task_tick_fair+0x18/0xc8
[<000bd00a>] do_filp_open+0xa0/0xea
[<000abae0>] do_sys_open+0x11a/0x1ee
[<00020000>] __do_proc_douintvec+0x22/0x27e
[<000abbf4>] SyS_open+0x1e/0x22
[<00020000>] __do_proc_douintvec+0x22/0x27e
[<00002b40>] syscall+0x8/0xc
[<00020000>] __do_proc_douintvec+0x22/0x27e
[<0000c00b>] dyadic+0x1/0x28
Code: 4e5e 4e75 4e56 fffc 2f0b 2f02 266e 0008 <206b> 0198 4a88 6732 2428 002c 661e 486b 0058 4eb9 0032 0b96 588f 4a88 672c 2008
Disabling lock debugging due to kernel taint

Fix the array index bounds check to avoid this.

Fixes: 8852ecd97488 ("[PATCH] m68k: mac - Add SWIM floppy support")
Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 3e3e72b141d3..87c70fcce875 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -807,7 +807,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
struct swim_priv *swd = data;
int drive = (*part & 3);

- if (drive > swd->floppy_count)
+ if (drive >= swd->floppy_count)
return NULL;

*part = 0;
--
2.16.1


2018-04-01 01:44:26

by Finn Thain

[permalink] [raw]
Subject: [PATCH 07/12] block/swim: Remove extra put_disk() call from error path

Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 87c70fcce875..19d7d27468c7 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -873,7 +873,6 @@ static int swim_floppy_init(struct swim_priv *swd)
&swd->lock);
if (!swd->unit[drive].disk->queue) {
err = -ENOMEM;
- put_disk(swd->unit[drive].disk);
goto exit_put_disks;
}
blk_queue_bounce_limit(swd->unit[drive].disk->queue,
--
2.16.1


2018-04-01 01:44:48

by Finn Thain

[permalink] [raw]
Subject: [PATCH 08/12] block/swim: Don't log an error message for an invalid ioctl

The 'eject' shell command may send various different ioctl commands.
This leads to error messages on the console even though the FDEJECT
ioctl succeeds.

~# eject floppy
SWIM floppy_ioctl: unknown cmd 21257
SWIM floppy_ioctl: unknown cmd 1

Don't log an error message for an invalid ioctl, just do as the
swim3 driver does and return -ENOTTY.

Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 19d7d27468c7..8be0d92bc431 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -739,14 +739,9 @@ static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
if (copy_to_user((void __user *) param, (void *) &floppy_type,
sizeof(struct floppy_struct)))
return -EFAULT;
- break;
-
- default:
- printk(KERN_DEBUG "SWIM floppy_ioctl: unknown cmd %d\n",
- cmd);
- return -ENOSYS;
+ return 0;
}
- return 0;
+ return -ENOTTY;
}

static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo)
--
2.16.1


2018-04-01 01:45:23

by Finn Thain

[permalink] [raw]
Subject: [PATCH 10/12] block/swim: Check drive type

The SWIM chip is compatible with GCR-mode Sony 400K/800K drives but
this driver only supports MFM mode. Therefore only Sony FDHD drives
are supported. Skip incompatible drives.

Cc: Laurent Vivier <[email protected]>
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index d69cc5dadbfc..6e3ebf5519e3 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -841,10 +841,12 @@ static int swim_floppy_init(struct swim_priv *swd)
/* scan floppy drives */

swim_drive(base, INTERNAL_DRIVE);
- if (swim_readbit(base, DRIVE_PRESENT))
+ if (swim_readbit(base, DRIVE_PRESENT) &&
+ !swim_readbit(base, ONEMEG_DRIVE))
swim_add_floppy(swd, INTERNAL_DRIVE);
swim_drive(base, EXTERNAL_DRIVE);
- if (swim_readbit(base, DRIVE_PRESENT))
+ if (swim_readbit(base, DRIVE_PRESENT) &&
+ !swim_readbit(base, ONEMEG_DRIVE))
swim_add_floppy(swd, EXTERNAL_DRIVE);

/* register floppy drives */
--
2.16.1


2018-04-01 01:45:41

by Finn Thain

[permalink] [raw]
Subject: [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region

For reasons I don't understand, calling ioremap() then iounmap() on
the SWIM MMIO region causes a hang on 68030 (but not on 68040).

~# modprobe swim_mod
SWIM floppy driver Version 0.2 (2008-10-30)
SWIM device not found !
watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [modprobe:285]
Modules linked in: swim_mod(+)
Format 00 Vector: 0064 PC: 000075aa Status: 2000 Not tainted
ORIG_D0: ffffffff D0: d00c0000 A2: 007c2370 A1: 003f810c
A0: 00040000 D5: d0096800 D4: d0097e00
D3: 00000001 D2: 00000003 D1: 00000000
Non-Maskable Interrupt
Modules linked in: swim_mod(+)
PC: [<000075ba>] __iounmap+0x24/0x10e
SR: 2000 SP: 007abc48 a2: 007c2370
d0: d00c0000 d1: 000001a0 d2: 00000019 d3: 00000001
d4: d0097e00 d5: d0096800 a0: 00040000 a1: 003f810c
Process modprobe (pid: 285, task=007c2370)
Frame format=0
Stack from 007abc7c:
ffffffed 00000000 006a4060 004712e0 007abca0 000076ea d0080000 00080000
010bb4b8 007abcd8 010ba542 d0096000 00000000 00000000 00000001 010bb59c
00000000 007abf30 010bb4b8 0047760a 0047763c 00477612 00616540 007abcec
0020a91a 00477600 0047760a 010bb4cc 007abd18 002092f2 0047760a 00333b06
007abd5c 00000000 0047760a 010bb4cc 00404f90 004776b8 00000001 007abd38
00209446 010bb4cc 0047760a 010bb4cc 0020938e 0031f8be 00616540 007abd64
Call Trace: [<000076ea>] iounmap+0x46/0x5a
[<00080000>] shrink_page_list+0x7f6/0xe06
[<010ba542>] swim_probe+0xe4/0x496 [swim_mod]
[<0020a91a>] platform_drv_probe+0x20/0x5e
[<002092f2>] driver_probe_device+0x21c/0x2b8
[<00333b06>] mutex_lock+0x0/0x2e
[<00209446>] __driver_attach+0xb8/0xce
[<0020938e>] __driver_attach+0x0/0xce
[<0031f8be>] klist_next+0x0/0xa0
[<00207562>] bus_for_each_dev+0x74/0xba
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<00333b06>] mutex_lock+0x0/0x2e
[<00208e44>] driver_attach+0x1a/0x1e
[<0020938e>] __driver_attach+0x0/0xce
[<00207e26>] bus_add_driver+0x188/0x234
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<00209894>] driver_register+0x58/0x104
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<010bd000>] swim_init+0x0/0x2c [swim_mod]
[<0020a7be>] __platform_driver_register+0x38/0x3c
[<010bd028>] swim_init+0x28/0x2c [swim_mod]
[<000020dc>] do_one_initcall+0x38/0x196
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<003331cc>] mutex_unlock+0x0/0x3e
[<00333b06>] mutex_lock+0x0/0x2e
[<003331cc>] mutex_unlock+0x0/0x3e
[<00333b06>] mutex_lock+0x0/0x2e
[<003331cc>] mutex_unlock+0x0/0x3e
[<00333b06>] mutex_lock+0x0/0x2e
[<003331cc>] mutex_unlock+0x0/0x3e
[<00333b06>] mutex_lock+0x0/0x2e
[<00075008>] __free_pages+0x0/0x38
[<000045c0>] mangle_kernel_stack+0x30/0xda
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<003331cc>] mutex_unlock+0x0/0x3e
[<00333b06>] mutex_lock+0x0/0x2e
[<0005ced4>] do_init_module+0x42/0x266
[<010bd000>] swim_init+0x0/0x2c [swim_mod]
[<000344c0>] blocking_notifier_call_chain+0x0/0x20
[<0005eda0>] load_module+0x1a30/0x1e70
[<0000465d>] mangle_kernel_stack+0xcd/0xda
[<00331c64>] __generic_copy_from_user+0x0/0x46
[<0033256e>] _cond_resched+0x0/0x32
[<00331b9c>] memset+0x0/0x98
[<0033256e>] _cond_resched+0x0/0x32
[<0005f25c>] SyS_init_module+0x7c/0x112
[<00002000>] _start+0x0/0x8
[<00002000>] _start+0x0/0x8
[<00331c82>] __generic_copy_from_user+0x1e/0x46
[<0005f2b2>] SyS_init_module+0xd2/0x112
[<0000465d>] mangle_kernel_stack+0xcd/0xda
[<00002b40>] syscall+0x8/0xc
[<0000465d>] mangle_kernel_stack+0xcd/0xda
[<0008c00c>] pcpu_balance_workfn+0xb2/0x40e
Code: 2200 7419 e4a9 e589 2841 d9fc 0000 1000 <2414> 7203 c282 7602 b681 6600 0096 0242 fe00 0482 0000 0000 e9c0 11c3 ed89 2642

There's no need to call ioremap() for the SWIM address range, as it lies
within the usual IO device region at 0x5000 0000, which is already mapped.

Remove the redundant ioremap() and iounmap() calls to fix the hang.

Cc: Laurent Vivier <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 84434d3ea19b..ef4361dc5b26 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -911,7 +911,7 @@ static int swim_probe(struct platform_device *dev)
goto out;
}

- swim_base = ioremap(res->start, resource_size(res));
+ swim_base = (struct swim __iomem *)res->start;
if (!swim_base) {
ret = -ENOMEM;
goto out_release_io;
@@ -923,7 +923,7 @@ static int swim_probe(struct platform_device *dev)
if (!get_swim_mode(swim_base)) {
printk(KERN_INFO "SWIM device not found !\n");
ret = -ENODEV;
- goto out_iounmap;
+ goto out_release_io;
}

/* set platform driver data */
@@ -931,7 +931,7 @@ static int swim_probe(struct platform_device *dev)
swd = kzalloc(sizeof(struct swim_priv), GFP_KERNEL);
if (!swd) {
ret = -ENOMEM;
- goto out_iounmap;
+ goto out_release_io;
}
platform_set_drvdata(dev, swd);

@@ -945,8 +945,6 @@ static int swim_probe(struct platform_device *dev)

out_kfree:
kfree(swd);
-out_iounmap:
- iounmap(swim_base);
out_release_io:
release_mem_region(res->start, resource_size(res));
out:
@@ -974,8 +972,6 @@ static int swim_remove(struct platform_device *dev)
for (drive = 0; drive < swd->floppy_count; drive++)
floppy_eject(&swd->unit[drive]);

- iounmap(swd->base);
-
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (res)
release_mem_region(res->start, resource_size(res));
--
2.16.1


2018-04-01 01:46:03

by Finn Thain

[permalink] [raw]
Subject: [PATCH 09/12] block/swim: Rename macros to avoid inconsistent inverted logic

The Sony drive status bits use active-low logic. The swim_readbit()
function converts that to 'C' logic for readability. Hence, the
sense of the names of the status bit macros should not be inverted.

Mostly they are correct. However, the TWOMEG_DRIVE, MFM_MODE and
TWOMEG_MEDIA macros have inverted sense (like MkLinux). Fix this
inconsistency and make the following patches less confusing.

The same problem affects swim3.c so fix that too.

No functional change.

The FDHD drive status bits are documented in sonydriv.cpp from MAME
and in swimiii.h from MkLinux.

Cc: Laurent Vivier <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: [email protected]
Cc: Jens Axboe <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
drivers/block/swim.c | 8 ++++----
drivers/block/swim3.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 8be0d92bc431..d69cc5dadbfc 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -111,7 +111,7 @@ struct iwm {
/* Select values for swim_select and swim_readbit */

#define READ_DATA_0 0x074
-#define TWOMEG_DRIVE 0x075
+#define ONEMEG_DRIVE 0x075
#define SINGLE_SIDED 0x076
#define DRIVE_PRESENT 0x077
#define DISK_IN 0x170
@@ -119,9 +119,9 @@ struct iwm {
#define TRACK_ZERO 0x172
#define TACHO 0x173
#define READ_DATA_1 0x174
-#define MFM_MODE 0x175
+#define GCR_MODE 0x175
#define SEEK_COMPLETE 0x176
-#define ONEMEG_MEDIA 0x177
+#define TWOMEG_MEDIA 0x177

/* Bits in handshake register */

@@ -619,7 +619,7 @@ static void setup_medium(struct floppy_state *fs)
struct floppy_struct *g;
fs->disk_in = 1;
fs->write_protected = swim_readbit(base, WRITE_PROT);
- fs->type = swim_readbit(base, ONEMEG_MEDIA);
+ fs->type = swim_readbit(base, TWOMEG_MEDIA);

if (swim_track00(base))
printk(KERN_ERR
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index af51015d056e..469541c1e51e 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -148,7 +148,7 @@ struct swim3 {
#define MOTOR_ON 2
#define RELAX 3 /* also eject in progress */
#define READ_DATA_0 4
-#define TWOMEG_DRIVE 5
+#define ONEMEG_DRIVE 5
#define SINGLE_SIDED 6 /* drive or diskette is 4MB type? */
#define DRIVE_PRESENT 7
#define DISK_IN 8
@@ -156,9 +156,9 @@ struct swim3 {
#define TRACK_ZERO 10
#define TACHO 11
#define READ_DATA_1 12
-#define MFM_MODE 13
+#define GCR_MODE 13
#define SEEK_COMPLETE 14
-#define ONEMEG_MEDIA 15
+#define TWOMEG_MEDIA 15

/* Definitions of values used in writing and formatting */
#define DATA_ESCAPE 0x99
--
2.16.1


2018-04-01 01:46:13

by Finn Thain

[permalink] [raw]
Subject: [PATCH 01/12] m68k/mac: Revisit floppy disc controller base addresses

Rename floppy_type macros to make them more consistent with the scsi_type
macros, which are named after classes of models with similar memory maps.

The documentation for LC-class machines has the IO devices at offsets
from $50F0 0000. Use these addresses (consistent with mac_scsi resources)
because they may not be aliased elsewhere in the memory map, e.g. at
offsets from $5000 0000.

Add comments with controller type information from 'Designing Cards and
Drivers for the Macintosh Family', relevant Developer Notes and
http://mess.redump.net/mess/driver_info/mac_technical_notes

Cc: Laurent Vivier <[email protected]>
Tested-by: Stan Johnson <[email protected]>
Signed-off-by: Finn Thain <[email protected]>
---
arch/m68k/include/asm/macintosh.h | 10 +--
arch/m68k/mac/config.c | 124 ++++++++++++++++++++------------------
2 files changed, 70 insertions(+), 64 deletions(-)

diff --git a/arch/m68k/include/asm/macintosh.h b/arch/m68k/include/asm/macintosh.h
index 9b840c03ebb7..a61ce06c0a54 100644
--- a/arch/m68k/include/asm/macintosh.h
+++ b/arch/m68k/include/asm/macintosh.h
@@ -79,11 +79,11 @@ struct mac_model
#define MAC_EXP_PDS_NUBUS 3 /* Accepts PDS card and/or NuBus card(s) */
#define MAC_EXP_PDS_COMM 4 /* Accepts PDS card or Comm Slot card */

-#define MAC_FLOPPY_IWM 0
-#define MAC_FLOPPY_SWIM_ADDR1 1
-#define MAC_FLOPPY_SWIM_ADDR2 2
-#define MAC_FLOPPY_SWIM_IOP 3
-#define MAC_FLOPPY_AV 4
+#define MAC_FLOPPY_UNSUPPORTED 0
+#define MAC_FLOPPY_QUADRA 1
+#define MAC_FLOPPY_OLD 2
+#define MAC_FLOPPY_IIFX 3
+#define MAC_FLOPPY_LC 4

extern struct mac_model *macintosh_config;

diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index d3d435248a24..54f3a8421afc 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -213,7 +213,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_IWM,
+ .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
},

/*
@@ -228,7 +228,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_IWM,
+ .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
}, {
.ident = MAC_MODEL_IIX,
.name = "IIx",
@@ -237,7 +237,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_IICX,
.name = "IIcx",
@@ -246,7 +246,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_SE30,
.name = "SE/30",
@@ -255,7 +255,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
},

/*
@@ -273,7 +273,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_IIFX,
.name = "IIfx",
@@ -282,7 +282,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_IIFX,
.scc_type = MAC_SCC_IOP,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_IOP,
+ .floppy_type = MAC_FLOPPY_IIFX, /* SWIM with IOP */
}, {
.ident = MAC_MODEL_IISI,
.name = "IIsi",
@@ -291,7 +291,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_IIVI,
.name = "IIvi",
@@ -300,7 +300,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
}, {
.ident = MAC_MODEL_IIVX,
.name = "IIvx",
@@ -309,7 +309,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
},

/*
@@ -323,7 +323,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_IICI,
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
}, {
.ident = MAC_MODEL_CCL,
.name = "Color Classic",
@@ -332,7 +332,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
}, {
.ident = MAC_MODEL_CCLII,
.name = "Color Classic II",
@@ -341,7 +341,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
},

/*
@@ -356,7 +356,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
}, {
.ident = MAC_MODEL_LCII,
.name = "LC II",
@@ -365,7 +365,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
}, {
.ident = MAC_MODEL_LCIII,
.name = "LC III",
@@ -374,7 +374,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
},

/*
@@ -395,7 +395,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_QUADRA,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_Q605_ACC,
.name = "Quadra 605",
@@ -404,7 +404,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_QUADRA,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_Q610,
.name = "Quadra 610",
@@ -414,7 +414,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_Q630,
.name = "Quadra 630",
@@ -424,7 +424,7 @@ static struct mac_model mac_data_table[] = {
.ide_type = MAC_IDE_QUADRA,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_PDS_COMM,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_Q650,
.name = "Quadra 650",
@@ -434,7 +434,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
},
/* The Q700 does have a NS Sonic */
{
@@ -446,7 +446,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
}, {
.ident = MAC_MODEL_Q800,
.name = "Quadra 800",
@@ -456,7 +456,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_Q840,
.name = "Quadra 840AV",
@@ -466,7 +466,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_PSC,
.ether_type = MAC_ETHER_MACE,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_AV,
+ .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
}, {
.ident = MAC_MODEL_Q900,
.name = "Quadra 900",
@@ -476,7 +476,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_IOP,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_IOP,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM with IOP */
}, {
.ident = MAC_MODEL_Q950,
.name = "Quadra 950",
@@ -486,7 +486,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_IOP,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_IOP,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM with IOP */
},

/*
@@ -501,7 +501,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
}, {
.ident = MAC_MODEL_P475,
.name = "Performa 475",
@@ -510,7 +510,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_QUADRA,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_P475F,
.name = "Performa 475",
@@ -519,7 +519,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_QUADRA,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_P520,
.name = "Performa 520",
@@ -528,7 +528,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
}, {
.ident = MAC_MODEL_P550,
.name = "Performa 550",
@@ -537,7 +537,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
},
/* These have the comm slot, and therefore possibly SONIC ethernet */
{
@@ -548,7 +548,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_QUADRA,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS_COMM,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_P588,
.name = "Performa 588",
@@ -558,7 +558,7 @@ static struct mac_model mac_data_table[] = {
.ide_type = MAC_IDE_QUADRA,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_PDS_COMM,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_TV,
.name = "TV",
@@ -566,7 +566,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_IICI,
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM II */
}, {
.ident = MAC_MODEL_P600,
.name = "Performa 600",
@@ -575,7 +575,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LC,
.scc_type = MAC_SCC_II,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_LC, /* SWIM */
},

/*
@@ -592,7 +592,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_C650,
.name = "Centris 650",
@@ -602,7 +602,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
+ .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM II */
}, {
.ident = MAC_MODEL_C660,
.name = "Centris 660AV",
@@ -612,7 +612,7 @@ static struct mac_model mac_data_table[] = {
.scc_type = MAC_SCC_PSC,
.ether_type = MAC_ETHER_MACE,
.expansion_type = MAC_EXP_PDS_NUBUS,
- .floppy_type = MAC_FLOPPY_AV,
+ .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
},

/*
@@ -628,7 +628,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB145,
.name = "PowerBook 145",
@@ -636,7 +636,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB150,
.name = "PowerBook 150",
@@ -645,7 +645,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_OLD,
.ide_type = MAC_IDE_PB,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB160,
.name = "PowerBook 160",
@@ -653,7 +653,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB165,
.name = "PowerBook 165",
@@ -661,7 +661,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB165C,
.name = "PowerBook 165c",
@@ -669,7 +669,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB170,
.name = "PowerBook 170",
@@ -677,7 +677,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB180,
.name = "PowerBook 180",
@@ -685,7 +685,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB180C,
.name = "PowerBook 180c",
@@ -693,7 +693,7 @@ static struct mac_model mac_data_table[] = {
.via_type = MAC_VIA_QUADRA,
.scsi_type = MAC_SCSI_OLD,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB190,
.name = "PowerBook 190",
@@ -702,7 +702,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LATE,
.ide_type = MAC_IDE_BABOON,
.scc_type = MAC_SCC_QUADRA,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM II */
}, {
.ident = MAC_MODEL_PB520,
.name = "PowerBook 520",
@@ -711,7 +711,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_LATE,
.scc_type = MAC_SCC_QUADRA,
.ether_type = MAC_ETHER_SONIC,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM II */
},

/*
@@ -728,7 +728,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB230,
.name = "PowerBook Duo 230",
@@ -737,7 +737,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB250,
.name = "PowerBook Duo 250",
@@ -746,7 +746,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB270C,
.name = "PowerBook Duo 270c",
@@ -755,7 +755,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB280,
.name = "PowerBook Duo 280",
@@ -764,7 +764,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
}, {
.ident = MAC_MODEL_PB280C,
.name = "PowerBook Duo 280c",
@@ -773,7 +773,7 @@ static struct mac_model mac_data_table[] = {
.scsi_type = MAC_SCSI_DUO,
.scc_type = MAC_SCC_QUADRA,
.expansion_type = MAC_EXP_NUBUS,
- .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
+ .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
},

/*
@@ -986,11 +986,17 @@ int __init mac_platform_init(void)
*/

switch (macintosh_config->floppy_type) {
- case MAC_FLOPPY_SWIM_ADDR1:
- swim_base = (u8 *)(VIA1_BASE + 0x1E000);
+ case MAC_FLOPPY_QUADRA:
+ swim_base = (u8 *)0x5001E000;
break;
- case MAC_FLOPPY_SWIM_ADDR2:
- swim_base = (u8 *)(VIA1_BASE + 0x16000);
+ case MAC_FLOPPY_OLD:
+ swim_base = (u8 *)0x50016000;
+ break;
+ case MAC_FLOPPY_LC:
+ swim_base = (u8 *)0x50F16000;
+ break;
+ case MAC_FLOPPY_IIFX:
+ swim_base = (u8 *)0x50012000;
break;
default:
swim_base = NULL;
--
2.16.1


2018-04-03 19:09:23

by Laurent Vivier

[permalink] [raw]
Subject: Re: [PATCH 00/12] SWIM driver fixes

On 01/04/2018 03:41, Finn Thain wrote:
> This patch series has fixes for bugs in the SWIM floppy disk controller
> driver, including an oops and a soft lockup.
>
> There are also patches to add support for SWIM devices connected to IOPs.
>
> Geert, would you please take this series through the m68k tree once the
> necessary "acked-by" tags arrive?
>
> Jens, I've Cc'd you too because there's no official maintainer for
> drivers/block/swim.c and none for the drivers/block/ directory either.
>
> The series could be separated into m68k patches and block driver patches
> and sent through different trees if that's preferred.
>
> I did not do so because "acked-by" tags would still be needed and because
> separating patches 4 and 5 didn't make much sense.
>
>
> Finn Thain (12):
> m68k/mac: Revisit floppy disc controller base addresses
> m68k/mac: Fix SWIM memory resource end address
> m68k/mac: Don't remap SWIM MMIO region
> m68k/mac: Place ISM IOP in bypass mode
> block/swim: Use HEDSEL bit in ISM mode register
> block/swim: Fix array bounds check
> block/swim: Remove extra put_disk() call from error path
> block/swim: Don't log an error message for an invalid ioctl
> block/swim: Rename macros to avoid inconsistent inverted logic
> block/swim: Check drive type
> block/swim: Fix IO error at end of medium
> block/swim: Select appropriate drive on device open
>
> arch/m68k/include/asm/macintosh.h | 10 +--
> arch/m68k/mac/config.c | 126 ++++++++++++++++++++------------------
> arch/m68k/mac/iop.c | 8 ++-
> drivers/block/swim.c | 69 +++++++++++----------
> drivers/block/swim3.c | 6 +-
> 5 files changed, 118 insertions(+), 101 deletions(-)
>

FWIW, for the series:

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

Thanks,
Laurent

2018-04-03 23:11:24

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 00/12] SWIM driver fixes


On Tue, 3 Apr 2018, Laurent Vivier wrote:

> FWIW, for the series:
>

FWIW,

https://en.wikipedia.org/wiki/Floppy_disk_hardware_emulator

;-)

2018-04-03 23:33:33

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH 00/12] SWIM driver fixes

On 3/31/18 7:41 PM, Finn Thain wrote:
> This patch series has fixes for bugs in the SWIM floppy disk controller
> driver, including an oops and a soft lockup.
>
> There are also patches to add support for SWIM devices connected to IOPs.
>
> Geert, would you please take this series through the m68k tree once the
> necessary "acked-by" tags arrive?
>
> Jens, I've Cc'd you too because there's no official maintainer for
> drivers/block/swim.c and none for the drivers/block/ directory either.

The latter should just be added to the BLOCK LAYER entry.

> The series could be separated into m68k patches and block driver patches
> and sent through different trees if that's preferred.

I can take the block bits.


--
Jens Axboe


2018-04-03 23:35:11

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH 00/12] SWIM driver fixes

On 4/3/18 5:32 PM, Jens Axboe wrote:
> On 3/31/18 7:41 PM, Finn Thain wrote:
>> This patch series has fixes for bugs in the SWIM floppy disk controller
>> driver, including an oops and a soft lockup.
>>
>> There are also patches to add support for SWIM devices connected to IOPs.
>>
>> Geert, would you please take this series through the m68k tree once the
>> necessary "acked-by" tags arrive?
>>
>> Jens, I've Cc'd you too because there's no official maintainer for
>> drivers/block/swim.c and none for the drivers/block/ directory either.
>
> The latter should just be added to the BLOCK LAYER entry.

Actually, when Linus takes the pull request, it will be there:


commit fc9de9a52e993829d928825d05fc9d3f41ce33fa
Author: Ross Zwisler <[email protected]>
Date: Fri Mar 9 09:38:26 2018 -0700

MAINTAINERS: add coverage for drivers/block

--
Jens Axboe


2018-04-09 12:55:29

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 02/12] m68k/mac: Fix SWIM memory resource end address

On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> The resource size is 0x2000 == end - start + 1.
> Therefore end == start + 0x2000 - 1.
>
> Cc: Laurent Vivier <[email protected]>
> Tested-by: Stan Johnson <[email protected]>
> Signed-off-by: Finn Thain <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2018-04-09 12:58:16

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region

Hi Finn,

On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> For reasons I don't understand, calling ioremap() then iounmap() on
> the SWIM MMIO region causes a hang on 68030 (but not on 68040).

Michael Schmitz also notices strange things with ioremap() on '030.

> There's no need to call ioremap() for the SWIM address range, as it lies
> within the usual IO device region at 0x5000 0000, which is already mapped.

by head.S, right?

> --- a/drivers/block/swim.c
> +++ b/drivers/block/swim.c
> @@ -911,7 +911,7 @@ static int swim_probe(struct platform_device *dev)
> goto out;
> }
>
> - swim_base = ioremap(res->start, resource_size(res));
> + swim_base = (struct swim __iomem *)res->start;

I guess you need a __force to please sparse?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2018-04-09 13:15:10

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 07/12] block/swim: Remove extra put_disk() call from error path

On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> Cc: Laurent Vivier <[email protected]>
> Cc: Jens Axboe <[email protected]>
> Tested-by: Stan Johnson <[email protected]>
> Signed-off-by: Finn Thain <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2018-04-09 13:15:36

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 06/12] block/swim: Fix array bounds check

Hi Finn,

On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> In the floppy_find() function in swim.c is a call to
> get_disk(swd->unit[drive].disk). The actual parameter to this call
> can be a NULL pointer when drive == swd->floppy_count. This causes
> an oops in get_disk().
>
> Data read fault at 0x00000198 in Super Data (pc=0x1be5b6)

[...]

> Fix the array index bounds check to avoid this.
>
> Fixes: 8852ecd97488 ("[PATCH] m68k: mac - Add SWIM floppy support")
> Cc: Laurent Vivier <[email protected]>
> Cc: Jens Axboe <[email protected]>
> Tested-by: Stan Johnson <[email protected]>
> Signed-off-by: Finn Thain <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Looks like amiflop.c:find_floppy() needs a check, too?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2018-04-09 13:18:45

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 08/12] block/swim: Don't log an error message for an invalid ioctl

On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> The 'eject' shell command may send various different ioctl commands.
> This leads to error messages on the console even though the FDEJECT
> ioctl succeeds.
>
> ~# eject floppy
> SWIM floppy_ioctl: unknown cmd 21257
> SWIM floppy_ioctl: unknown cmd 1
>
> Don't log an error message for an invalid ioctl, just do as the
> swim3 driver does and return -ENOTTY.
>
> Cc: Laurent Vivier <[email protected]>
> Cc: Jens Axboe <[email protected]>
> Tested-by: Stan Johnson <[email protected]>
> Signed-off-by: Finn Thain <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Looks like amiflop can use a similar fix.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2018-04-09 15:21:22

by Luc Van Oostenryck

[permalink] [raw]
Subject: Re: [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region

On Mon, Apr 09, 2018 at 02:54:30PM +0200, Geert Uytterhoeven wrote:
> >
> > - swim_base = ioremap(res->start, resource_size(res));
> > + swim_base = (struct swim __iomem *)res->start;
>
> I guess you need a __force to please sparse?

Hi,

Only pointer-to-pointer conversions may need __force.
The logic being if you use an integer type to hold an address
this address is typeless anyway and has no address-space, so
extra checking is not done in this case and the cast in itself
is enough.

Cheers,
-- Luc

2018-04-10 01:14:40

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 06/12] block/swim: Fix array bounds check

On Mon, 9 Apr 2018, Geert Uytterhoeven wrote:

> Looks like amiflop.c:find_floppy() needs a check, too?
>

AFAICS there is no array index bug in floppy_find() in amiflop.c.
The 'unit' array's size is FD_MAX_UNITS which is defined as 4 in
include/linux/amifd.h, and the array index is drive = *part & 3.

--

2018-04-10 01:31:48

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 08/12] block/swim: Don't log an error message for an invalid ioctl

On Mon, 9 Apr 2018, Geert Uytterhoeven wrote:

> On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
> > The 'eject' shell command may send various different ioctl commands.
> > This leads to error messages on the console even though the FDEJECT
> > ioctl succeeds.
> >
> > ~# eject floppy
> > SWIM floppy_ioctl: unknown cmd 21257
> > SWIM floppy_ioctl: unknown cmd 1
> >
> > Don't log an error message for an invalid ioctl, just do as the
> > swim3 driver does and return -ENOTTY.
> >
> > Cc: Laurent Vivier <[email protected]>
> > Cc: Jens Axboe <[email protected]>
> > Tested-by: Stan Johnson <[email protected]>
> > Signed-off-by: Finn Thain <[email protected]>
>
> Reviewed-by: Geert Uytterhoeven <[email protected]>
>
> Looks like amiflop can use a similar fix.
>

Right. I'll prepare a new patch for that and send it separately.

--

> Gr{oetje,eeting}s,
>
> Geert
>
>

2018-04-10 01:39:01

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region

On Mon, 9 Apr 2018, Geert Uytterhoeven wrote:

> Hi Finn,
>
> On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]>
> wrote:
> > For reasons I don't understand, calling ioremap() then iounmap() on
> > the SWIM MMIO region causes a hang on 68030 (but not on 68040).
>
> Michael Schmitz also notices strange things with ioremap() on '030.
>
> > There's no need to call ioremap() for the SWIM address range, as it
> > lies within the usual IO device region at 0x5000 0000, which is
> > already mapped.
>
> by head.S, right?
>

Right. I'll mention that in the commit log when I re-submit this series.

> > --- a/drivers/block/swim.c
> > +++ b/drivers/block/swim.c
> > @@ -911,7 +911,7 @@ static int swim_probe(struct platform_device *dev)
> > goto out;
> > }
> >
> > - swim_base = ioremap(res->start, resource_size(res));
> > + swim_base = (struct swim __iomem *)res->start;
>
> I guess you need a __force to please sparse?
>

No, sparse did not find any new issues. It appears there's an old issue
elsewhere in the driver though. I'll prepare a new patch for that.

--

> Gr{oetje,eeting}s,
>
> Geert
>
>

--

2018-04-10 02:41:43

by Michael Schmitz

[permalink] [raw]
Subject: Re: [PATCH 03/12] m68k/mac: Don't remap SWIM MMIO region

Hi Geert,

I haven't seen that weird behaviour in quite some time - we discussed
changing the arch_initcall to some later priority at that time but I
never got around to trying that. No change to mappings in head.S
either as far as I could see.

Was there any rearrangement of MM init relative to arch init since?

Cheers,

Michael


On Tue, Apr 10, 2018 at 12:54 AM, Geert Uytterhoeven
<[email protected]> wrote:
> Hi Finn,
>
> On Sun, Apr 1, 2018 at 3:41 AM, Finn Thain <[email protected]> wrote:
>> For reasons I don't understand, calling ioremap() then iounmap() on
>> the SWIM MMIO region causes a hang on 68030 (but not on 68040).
>
> Michael Schmitz also notices strange things with ioremap() on '030.
>
>> There's no need to call ioremap() for the SWIM address range, as it lies
>> within the usual IO device region at 0x5000 0000, which is already mapped.
>
> by head.S, right?
>
>> --- a/drivers/block/swim.c
>> +++ b/drivers/block/swim.c
>> @@ -911,7 +911,7 @@ static int swim_probe(struct platform_device *dev)
>> goto out;
>> }
>>
>> - swim_base = ioremap(res->start, resource_size(res));
>> + swim_base = (struct swim __iomem *)res->start;
>
> I guess you need a __force to please sparse?
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html