Skip to content

Commit

Permalink
m68k: mac - Add SWIM floppy support
Browse files Browse the repository at this point in the history
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).

Signed-off-by: Laurent Vivier <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
  • Loading branch information
Laurent Vivier authored and geertu committed Mar 26, 2009
1 parent 7ad93b4 commit 8852ecd
Show file tree
Hide file tree
Showing 6 changed files with 1,305 additions and 0 deletions.
44 changes: 44 additions & 0 deletions arch/m68k/mac/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/* keyb */
#include <linux/init.h>
#include <linux/vt_kern.h>
#include <linux/platform_device.h>

#define BOOTINFO_COMPAT_1_0
#include <asm/setup.h>
Expand All @@ -43,6 +44,10 @@
#include <asm/mac_oss.h>
#include <asm/mac_psc.h>

/* platform device info */

#define SWIM_IO_SIZE 0x2000 /* SWIM IO resource size */

/* Mac bootinfo struct */

struct mac_booter_data mac_bi_data;
Expand Down Expand Up @@ -870,3 +875,42 @@ static void mac_get_model(char *str)
strcpy(str, "Macintosh ");
strcat(str, macintosh_config->name);
}

static struct resource swim_resources[1];

static struct platform_device swim_device = {
.name = "swim",
.id = -1,
.num_resources = ARRAY_SIZE(swim_resources),
.resource = swim_resources,
};

static struct platform_device *mac_platform_devices[] __initdata = {
&swim_device
};

int __init mac_platform_init(void)
{
u8 *swim_base;

switch (macintosh_config->floppy_type) {
case MAC_FLOPPY_SWIM_ADDR1:
swim_base = (u8 *)(VIA1_BASE + 0x1E000);
break;
case MAC_FLOPPY_SWIM_ADDR2:
swim_base = (u8 *)(VIA1_BASE + 0x16000);
break;
default:
return 0;
}

swim_resources[0].name = "swim-regs";
swim_resources[0].start = (resource_size_t)swim_base;
swim_resources[0].end = (resource_size_t)(swim_base + SWIM_IO_SIZE);
swim_resources[0].flags = IORESOURCE_MEM;

return platform_add_devices(mac_platform_devices,
ARRAY_SIZE(mac_platform_devices));
}

arch_initcall(mac_platform_init);
9 changes: 9 additions & 0 deletions arch/m68k/mac/via.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,3 +645,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);
7 changes: 7 additions & 0 deletions drivers/block/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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
Expand Down
3 changes: 3 additions & 0 deletions drivers/block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -33,3 +34,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
Loading

0 comments on commit 8852ecd

Please sign in to comment.