Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8852ecd9 authored by Laurent Vivier's avatar Laurent Vivier Committed by Geert Uytterhoeven
Browse files

m68k: mac - Add SWIM floppy support



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: default avatarLaurent Vivier <Laurent@lvivier.info>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 7ad93b42
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -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>
@@ -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;
@@ -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 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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
@@ -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

drivers/block/swim.c

0 → 100644
+995 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading