diff options
author | Laurent Vivier <laurent@lvivier.info> | 2008-11-15 16:10:10 +0100 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2009-03-26 21:15:27 +0100 |
commit | 8852ecd97488249ca7fe2c0d3eb44cae95886881 (patch) | |
tree | bc23ec6db412733952809ebc5307535ed043c4a0 /arch/m68k/mac/config.c | |
parent | 7ad93b42bd135641ddc2c298f030132aca7aeca3 (diff) |
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>
Diffstat (limited to 'arch/m68k/mac/config.c')
-rw-r--r-- | arch/m68k/mac/config.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 3a1c0b2862e..be017984a45 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -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); |