diff options
| author | Geert Uytterhoeven <geert@linux-m68k.org> | 2009-04-05 06:40:41 -0400 |
|---|---|---|
| committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2010-05-17 15:37:42 -0400 |
| commit | 0d305464aefff342c85b4db8b3d7a4345246e5a1 (patch) | |
| tree | c3cd06f58d7cf126500258d0a8fc531bd3ed4da2 | |
| parent | bf54a2b3c0dbf76136f00ff785bf6d8f6291311d (diff) | |
m68k: amiga - Zorro host bridge platform device conversion
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
| -rw-r--r-- | arch/m68k/amiga/Makefile | 2 | ||||
| -rw-r--r-- | arch/m68k/amiga/platform.c | 58 | ||||
| -rw-r--r-- | drivers/zorro/proc.c | 6 | ||||
| -rw-r--r-- | drivers/zorro/zorro.c | 243 | ||||
| -rw-r--r-- | include/linux/zorro.h | 9 |
5 files changed, 190 insertions, 128 deletions
diff --git a/arch/m68k/amiga/Makefile b/arch/m68k/amiga/Makefile index 6a0d7650f980..11dd30b16b3b 100644 --- a/arch/m68k/amiga/Makefile +++ b/arch/m68k/amiga/Makefile | |||
| @@ -2,6 +2,6 @@ | |||
| 2 | # Makefile for Linux arch/m68k/amiga source directory | 2 | # Makefile for Linux arch/m68k/amiga source directory |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y := config.o amiints.o cia.o chipram.o amisound.o | 5 | obj-y := config.o amiints.o cia.o chipram.o amisound.o platform.o |
| 6 | 6 | ||
| 7 | obj-$(CONFIG_AMIGA_PCMCIA) += pcmcia.o | 7 | obj-$(CONFIG_AMIGA_PCMCIA) += pcmcia.o |
diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c new file mode 100644 index 000000000000..33a7669b4415 --- /dev/null +++ b/arch/m68k/amiga/platform.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2009 Geert Uytterhoeven | ||
| 3 | * | ||
| 4 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 5 | * License. See the file COPYING in the main directory of this archive | ||
| 6 | * for more details. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/init.h> | ||
| 10 | #include <linux/platform_device.h> | ||
| 11 | #include <linux/zorro.h> | ||
| 12 | |||
| 13 | #include <asm/amigahw.h> | ||
| 14 | |||
| 15 | |||
| 16 | #ifdef CONFIG_ZORRO | ||
| 17 | |||
| 18 | static const struct resource zorro_resources[] __initconst = { | ||
| 19 | /* Zorro II regions (on Zorro II/III) */ | ||
| 20 | { | ||
| 21 | .name = "Zorro II exp", | ||
| 22 | .start = 0x00e80000, | ||
| 23 | .end = 0x00efffff, | ||
| 24 | .flags = IORESOURCE_MEM, | ||
| 25 | }, { | ||
| 26 | .name = "Zorro II mem", | ||
| 27 | .start = 0x00200000, | ||
| 28 | .end = 0x009fffff, | ||
| 29 | .flags = IORESOURCE_MEM, | ||
| 30 | }, | ||
| 31 | /* Zorro III regions (on Zorro III only) */ | ||
| 32 | { | ||
| 33 | .name = "Zorro III exp", | ||
| 34 | .start = 0xff000000, | ||
| 35 | .end = 0xffffffff, | ||
| 36 | .flags = IORESOURCE_MEM, | ||
| 37 | }, { | ||
| 38 | .name = "Zorro III cfg", | ||
| 39 | .start = 0x40000000, | ||
| 40 | .end = 0x7fffffff, | ||
| 41 | .flags = IORESOURCE_MEM, | ||
| 42 | } | ||
| 43 | }; | ||
| 44 | |||
| 45 | |||
| 46 | static int __init amiga_init_bus(void) | ||
| 47 | { | ||
| 48 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) | ||
| 49 | return -ENODEV; | ||
| 50 | |||
| 51 | platform_device_register_simple("amiga-zorro", -1, zorro_resources, | ||
| 52 | AMIGAHW_PRESENT(ZORRO3) ? 4 : 2); | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | subsys_initcall(amiga_init_bus); | ||
| 57 | |||
| 58 | #endif /* CONFIG_ZORRO */ | ||
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index d47c47fc048f..3c7046d79654 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
| @@ -97,7 +97,7 @@ static void zorro_seq_stop(struct seq_file *m, void *v) | |||
| 97 | 97 | ||
| 98 | static int zorro_seq_show(struct seq_file *m, void *v) | 98 | static int zorro_seq_show(struct seq_file *m, void *v) |
| 99 | { | 99 | { |
| 100 | u_int slot = *(loff_t *)v; | 100 | unsigned int slot = *(loff_t *)v; |
| 101 | struct zorro_dev *z = &zorro_autocon[slot]; | 101 | struct zorro_dev *z = &zorro_autocon[slot]; |
| 102 | 102 | ||
| 103 | seq_printf(m, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, z->id, | 103 | seq_printf(m, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, z->id, |
| @@ -129,7 +129,7 @@ static const struct file_operations zorro_devices_proc_fops = { | |||
| 129 | 129 | ||
| 130 | static struct proc_dir_entry *proc_bus_zorro_dir; | 130 | static struct proc_dir_entry *proc_bus_zorro_dir; |
| 131 | 131 | ||
| 132 | static int __init zorro_proc_attach_device(u_int slot) | 132 | static int __init zorro_proc_attach_device(unsigned int slot) |
| 133 | { | 133 | { |
| 134 | struct proc_dir_entry *entry; | 134 | struct proc_dir_entry *entry; |
| 135 | char name[4]; | 135 | char name[4]; |
| @@ -146,7 +146,7 @@ static int __init zorro_proc_attach_device(u_int slot) | |||
| 146 | 146 | ||
| 147 | static int __init zorro_proc_init(void) | 147 | static int __init zorro_proc_init(void) |
| 148 | { | 148 | { |
| 149 | u_int slot; | 149 | unsigned int slot; |
| 150 | 150 | ||
| 151 | if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { | 151 | if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { |
| 152 | proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); | 152 | proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); |
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c index d45fb34e2d23..6455f3a244c5 100644 --- a/drivers/zorro/zorro.c +++ b/drivers/zorro/zorro.c | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #include <linux/zorro.h> | 15 | #include <linux/zorro.h> |
| 16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
| 17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 18 | #include <linux/platform_device.h> | ||
| 19 | #include <linux/slab.h> | ||
| 18 | 20 | ||
| 19 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
| 20 | #include <asm/amigahw.h> | 22 | #include <asm/amigahw.h> |
| @@ -26,24 +28,17 @@ | |||
| 26 | * Zorro Expansion Devices | 28 | * Zorro Expansion Devices |
| 27 | */ | 29 | */ |
| 28 | 30 | ||
| 29 | u_int zorro_num_autocon = 0; | 31 | unsigned int zorro_num_autocon; |
| 30 | struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO]; | 32 | struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO]; |
| 31 | 33 | ||
| 32 | 34 | ||
| 33 | /* | 35 | /* |
| 34 | * Single Zorro bus | 36 | * Zorro bus |
| 35 | */ | 37 | */ |
| 36 | 38 | ||
| 37 | struct zorro_bus zorro_bus = {\ | 39 | struct zorro_bus { |
| 38 | .resources = { | 40 | struct list_head devices; /* list of devices on this bus */ |
| 39 | /* Zorro II regions (on Zorro II/III) */ | 41 | struct device dev; |
| 40 | { .name = "Zorro II exp", .start = 0x00e80000, .end = 0x00efffff }, | ||
| 41 | { .name = "Zorro II mem", .start = 0x00200000, .end = 0x009fffff }, | ||
| 42 | /* Zorro III regions (on Zorro III only) */ | ||
| 43 | { .name = "Zorro III exp", .start = 0xff000000, .end = 0xffffffff }, | ||
| 44 | { .name = "Zorro III cfg", .start = 0x40000000, .end = 0x7fffffff } | ||
| 45 | }, | ||
| 46 | .name = "Zorro bus" | ||
| 47 | }; | 42 | }; |
| 48 | 43 | ||
| 49 | 44 | ||
| @@ -53,18 +48,19 @@ struct zorro_bus zorro_bus = {\ | |||
| 53 | 48 | ||
| 54 | struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from) | 49 | struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from) |
| 55 | { | 50 | { |
| 56 | struct zorro_dev *z; | 51 | struct zorro_dev *z; |
| 57 | 52 | ||
| 58 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) | 53 | if (!zorro_num_autocon) |
| 59 | return NULL; | 54 | return NULL; |
| 60 | 55 | ||
| 61 | for (z = from ? from+1 : &zorro_autocon[0]; | 56 | for (z = from ? from+1 : &zorro_autocon[0]; |
| 62 | z < zorro_autocon+zorro_num_autocon; | 57 | z < zorro_autocon+zorro_num_autocon; |
| 63 | z++) | 58 | z++) |
| 64 | if (id == ZORRO_WILDCARD || id == z->id) | 59 | if (id == ZORRO_WILDCARD || id == z->id) |
| 65 | return z; | 60 | return z; |
| 66 | return NULL; | 61 | return NULL; |
| 67 | } | 62 | } |
| 63 | EXPORT_SYMBOL(zorro_find_device); | ||
| 68 | 64 | ||
| 69 | 65 | ||
| 70 | /* | 66 | /* |
| @@ -83,121 +79,138 @@ struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from) | |||
| 83 | */ | 79 | */ |
| 84 | 80 | ||
| 85 | DECLARE_BITMAP(zorro_unused_z2ram, 128); | 81 | DECLARE_BITMAP(zorro_unused_z2ram, 128); |
| 82 | EXPORT_SYMBOL(zorro_unused_z2ram); | ||
| 86 | 83 | ||
| 87 | 84 | ||
| 88 | static void __init mark_region(unsigned long start, unsigned long end, | 85 | static void __init mark_region(unsigned long start, unsigned long end, |
| 89 | int flag) | 86 | int flag) |
| 90 | { | 87 | { |
| 91 | if (flag) | ||
