diff options
author | Laurent Vivier <laurent@lvivier.info> | 2008-11-15 10:10:10 -0500 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2009-03-26 16:15:27 -0400 |
commit | 8852ecd97488249ca7fe2c0d3eb44cae95886881 (patch) | |
tree | bc23ec6db412733952809ebc5307535ed043c4a0 /arch | |
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')
-rw-r--r-- | arch/m68k/mac/config.c | 44 | ||||
-rw-r--r-- | arch/m68k/mac/via.c | 9 |
2 files changed, 53 insertions, 0 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 3a1c0b2862ed..be017984a456 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -22,6 +22,7 @@ | |||
22 | /* keyb */ | 22 | /* keyb */ |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/vt_kern.h> | 24 | #include <linux/vt_kern.h> |
25 | #include <linux/platform_device.h> | ||
25 | 26 | ||
26 | #define BOOTINFO_COMPAT_1_0 | 27 | #define BOOTINFO_COMPAT_1_0 |
27 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
@@ -43,6 +44,10 @@ | |||
43 | #include <asm/mac_oss.h> | 44 | #include <asm/mac_oss.h> |
44 | #include <asm/mac_psc.h> | 45 | #include <asm/mac_psc.h> |
45 | 46 | ||
47 | /* platform device info */ | ||
48 | |||
49 | #define SWIM_IO_SIZE 0x2000 /* SWIM IO resource size */ | ||
50 | |||
46 | /* Mac bootinfo struct */ | 51 | /* Mac bootinfo struct */ |
47 | 52 | ||
48 | struct mac_booter_data mac_bi_data; | 53 | struct mac_booter_data mac_bi_data; |
@@ -870,3 +875,42 @@ static void mac_get_model(char *str) | |||
870 | strcpy(str, "Macintosh "); | 875 | strcpy(str, "Macintosh "); |
871 | strcat(str, macintosh_config->name); | 876 | strcat(str, macintosh_config->name); |
872 | } | 877 | } |
878 | |||
879 | static struct resource swim_resources[1]; | ||
880 | |||
881 | static struct platform_device swim_device = { | ||
882 | .name = "swim", | ||
883 | .id = -1, | ||
884 | .num_resources = ARRAY_SIZE(swim_resources), | ||
885 | .resource = swim_resources, | ||
886 | }; | ||
887 | |||
888 | static struct platform_device *mac_platform_devices[] __initdata = { | ||
889 | &swim_device | ||
890 | }; | ||
891 | |||
892 | int __init mac_platform_init(void) | ||
893 | { | ||
894 | u8 *swim_base; | ||
895 | |||
896 | switch (macintosh_config->floppy_type) { | ||
897 | case MAC_FLOPPY_SWIM_ADDR1: | ||
898 | swim_base = (u8 *)(VIA1_BASE + 0x1E000); | ||
899 | break; | ||
900 | case MAC_FLOPPY_SWIM_ADDR2: | ||
901 | swim_base = (u8 *)(VIA1_BASE + 0x16000); | ||
902 | break; | ||
903 | default: | ||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | swim_resources[0].name = "swim-regs"; | ||
908 | swim_resources[0].start = (resource_size_t)swim_base; | ||
909 | swim_resources[0].end = (resource_size_t)(swim_base + SWIM_IO_SIZE); | ||
910 | swim_resources[0].flags = IORESOURCE_MEM; | ||
911 | |||
912 | return platform_add_devices(mac_platform_devices, | ||
913 | ARRAY_SIZE(mac_platform_devices)); | ||
914 | } | ||
915 | |||
916 | arch_initcall(mac_platform_init); | ||
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c index 7d97ba54536e..11bce3cb6482 100644 --- a/arch/m68k/mac/via.c +++ b/arch/m68k/mac/via.c | |||
@@ -645,3 +645,12 @@ int via_irq_pending(int irq) | |||
645 | } | 645 | } |
646 | return 0; | 646 | return 0; |
647 | } | 647 | } |
648 | |||
649 | void via1_set_head(int head) | ||
650 | { | ||
651 | if (head == 0) | ||
652 | via1[vBufA] &= ~VIA1A_vHeadSel; | ||
653 | else | ||
654 | via1[vBufA] |= VIA1A_vHeadSel; | ||
655 | } | ||
656 | EXPORT_SYMBOL(via1_set_head); | ||