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: Laurent Vivier <Laurent@lvivier.info>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Laurent Vivier
2008-11-15 16:10:10 +01:00
committed by Geert Uytterhoeven
parent 7ad93b42bd
commit 8852ecd974
6 changed files with 1305 additions and 0 deletions

View File

@@ -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);