Add SWIM floppy support for m68k Macs.
Subsystems (3)
PATCH v3 2/2 Add SWIM floppy support for m68k Macs.
From: Laurent Vivier <[email protected]>
It allows to read data from a floppy, but not to write to, and to eject the floppy (useful on our Mac without eject button).
Changelog:
v2- use platform device infrastructure
v3- some cleanups, probe if chip supports SWIM mode
--- arch/m68k/mac/via.c | 9 + drivers/block/Kconfig | 7 + drivers/block/Makefile | 3 + drivers/block/swim.c | 921 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/block/swim_asm.S | 323 ++++++++++++++++ 5 files changed, 1263 insertions(+), 0 deletions(-)
arch/m68k/mac/via.c +9 -0
@@ -654,3 +654,12 @@ int via_irq_pending(int irq) }return 0 ; } + +void via1_set_head (int head) +{ +if (head ==0 ) + via1[vBufA] &= ~VIA1A_vHeadSel; +else + via1[vBufA] |= VIA1A_vHeadSel; +} +EXPORT_SYMBOL (via1_set_head);
drivers/block/Kconfig +7 -0
@@ -44,6 +44,13 @@ config MAC_FLOPPY If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) floppy controller, say Y here. Most commonly found in PowerMacs. +config BLK_DEV_SWIM + tristate "Support for SWIM Macintosh floppy" + depends on M68K && MAC + help + You should select this option if you want floppy support + and you don't have a II, IIfx, Q900, Q950 or AV series. + config AMIGA_Z2RAM tristate "Amiga Zorro II ramdisk support" depends on ZORRO
drivers/block/Makefile +3 -0
@@ -6,6 +6,7 @@ # obj-$(CONFIG_MAC_FLOPPY) += swim3.o +obj-$(CONFIG_BLK_DEV_SWIM) += swim_mod.o obj-$(CONFIG_BLK_DEV_FD) += floppy.o obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o obj-$(CONFIG_PS3_DISK) += ps3disk.o
@@ -32,3 +33,5 @@ obj-$(CONFIG_BLK_DEV_UB) += ub.o obj-$(CONFIG_BLK_DEV_HD) += hd.o obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o + +swim_mod-objs := swim.o swim_asm.o
drivers/block/swim.c new file +921 -0
921 lines not on this page · raw message
drivers/block/swim_asm.S new file +323 -0
323 lines not on this page · raw message
Signature · 1 line
1.4.4.4
Geert Uytterhoeven
maintainerdrivers/block/swim.c
Quoted 4 lines · Laurent Vivier
drivers/block/swim.c new file +1
-0+static struct platform_device *swim_device;
One global instance?
Quoted 19 lines
drivers/block/swim.c new file +19
-0+static int __devinit swim_probe (struct platform_device *dev) +{ +struct swim *swim_base; +struct swim_priv *swd; + +if (!MACH_IS_MAC ) +return -ENODEV ; + +switch (macintosh_config->floppy_type) { +case MAC_FLOPPY_SWIM_ADDR1 : + swim_base = (struct swim *)(VIA1_BASE +0x1E000 ); +break ; +case MAC_FLOPPY_SWIM_ADDR2 : + swim_base = (struct swim *)(VIA1_BASE +0x16000 ); +break ; +default : + swim_base = (struct swim *)base; +break ; + }
drivers/block/swim.c line 831
Quoted 10 lines
drivers/block/swim.c new file +10
-0+ +if (swim_base ==NULL ) +return -ENODEV ; + +printk (KERN_INFO "SWIM base adress 0x%p\n" , swim_base); + +/* probe device */ + +set_swim_mode (swim_base,1 ); +if (!get_swim_mode (swim_base)) {
get_swim_mode() is also written in assembly. Is plain C not fast enough? If speed matters, what about disabling interrupts here?
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
Quoted 7 lines · Geert Uytterhoeven
drivers/block/swim.c
Quoted 4 lines · Laurent Vivier
drivers/block/swim.c new file +1
-0+static struct platform_device *swim_device;One global instance?
Yes, why not ? Could you explain ?
Quoted 27 lines
Quoted 27 lines
drivers/block/swim.c new file +25
-0+static int __devinit swim_probe (struct platform_device *dev) +{ +struct swim *swim_base; +struct swim_priv *swd; + +if (!MACH_IS_MAC ) +return -ENODEV ; + +switch (macintosh_config->floppy_type) { +case MAC_FLOPPY_SWIM_ADDR1 : + swim_base = (struct swim *)(VIA1_BASE +0x1E000 ); +break ; +case MAC_FLOPPY_SWIM_ADDR2 : + swim_base = (struct swim *)(VIA1_BASE +0x16000 ); +break ; +default : + swim_base = (struct swim *)base; +break ; + } + +if (swim_base ==NULL ) +return -ENODEV ; + +printk (KERN_INFO "SWIM base adress 0x%p\n" , swim_base); +
Quoted 8 lines
drivers/block/swim.c line 831
Quoted 4 lines
drivers/block/swim.c new file +4
-0+/* probe device */ + +set_swim_mode (swim_base,1 ); +if (!get_swim_mode (swim_base)) {
get_swim_mode()is also written in assembly. Is plain C not fast enough?
If speed matters, what about disabling interrupts here?
I can rewrite it in C.
Regards,
Laurent
----------------------- Laurent Vivier ---------------------- "The best way to predict the future is to invent it."
- Alan Kay
--
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
Geert Uytterhoeven
maintainerQuoted 10 lines · Laurent Vivier
Le 9 nov. 08 � 17:19, Geert Uytterhoeven a �crit :
Quoted 7 lines · Laurent Vivier
drivers/block/swim.c
Quoted 4 lines
drivers/block/swim.c new file +1
-0+static struct platform_device *swim_device;One global instance?
Yes, why not ? Could you explain ?
It prevents the driver from working if you have multiple SWIM devices.
Didn't I read something about SWIM chips on expansion cards?
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
Quoted 6 lines · Geert Uytterhoeven
Quoted 5 lines · Laurent Vivier
Quoted 4 lines · Geert Uytterhoeven
Quoted 2 lines · Laurent Vivier
drivers/block/swim.c new file +0
-0
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+static struct
platform_device*swim_device;One global instance?
Yes, why not ? Could you explain ?
It prevents the driver from working if you have multiple SWIM devices.
If we have multiple SWIM devices the driver is only able to know the base address of the onboard controller.
So, it manages only one.
Quoted 2 lines
Didn't I read something about SWIM chips on expansion cards?
I think you speak about the expansion card for the MacII allowing to replace the WIM controller by a SWIM one, but what I understood is the SWIM replaces the WIM at the same base address. Moreover the SWIM has a WIM compatibility mode: it's why I've added the set_swim_mode() and get_swim_mode() to detect in which case we are. But there is only one controller at a time.
Regards,
Laurent
----------------------- Laurent Vivier ---------------------- "The best way to predict the future is to invent it."
- Alan Kay
--
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
Quoted 6 lines · Laurent Vivier
Quoted 1 line · Geert Uytterhoeven
It prevents the driver from working if you have multiple SWIM devices.
If we have multiple SWIM devices the driver is only able to know the base address of the onboard controller.
So, it manages only one.
There is never a second SWIM chip. However, there is one system (the unsupported Mac SE) that can have 3 floppy drives attached to a single SWIM chip. It's unlikely to ever be supported in Linux due to using a 68000 CPU rather than a 68020 or 68030.
Geert's suggestion would be the ideal thing in my opinion even though we know there are never multiple chips, but I think it's a low priority.
Quoted 8 lines
Quoted 1 line
Didn't I read something about SWIM chips on expansion cards?
I think you speak about the expansion card for the MacII allowing to replace the WIM controller by a SWIM one, but what I understood is the SWIM replaces the WIM at the same base address. Moreover the SWIM has a WIM compatibility mode: it's why I've added the
set_swim_mode()andget_swim_mode()to detect in which case we are. But there is only one controller at a time.
I think the discussion in question was the one about adding a nubus ESP driver for SCSI expansion cards. That was pretty recent.
You are right that there is just a single socket for the floppy controller on the Mac II and the upgrade replaces the old chip with a new one.
Brad Boyer
[email protected]
--
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