diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2009-10-04 08:55:28 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:52:51 -0500 |
commit | 27dd65ac9afabc8e67ab73f7c2f575eddbb47167 (patch) | |
tree | d8da508ceff4f2e69f8cc621a8bdebe83fef02e8 /arch/mips/alchemy/devboards | |
parent | 66213b3ccfc770704025ce9465fa3aaedde21b55 (diff) |
MIPS: Alchemy: devboards: wire up new PCMCIA driver.
Register the PCMCIA driver on all boards supported by it,
get rid of now-unused pcmcia macros in the board headers
(and subsequently empty pb1100/pb1500 ones).
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy/devboards')
-rw-r--r-- | arch/mips/alchemy/devboards/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/board_setup.c | 4 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/db1x00/platform.c | 84 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1100/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1100/board_setup.c | 1 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1100/platform.c | 43 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1200/platform.c | 55 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1500/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1500/board_setup.c | 4 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1500/platform.c | 42 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1550/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1550/board_setup.c | 8 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/pb1550/platform.c | 63 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/platform.c | 89 | ||||
-rw-r--r-- | arch/mips/alchemy/devboards/platform.h | 18 |
16 files changed, 412 insertions, 9 deletions
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile index adc6717d7688..cfda9721142b 100644 --- a/arch/mips/alchemy/devboards/Makefile +++ b/arch/mips/alchemy/devboards/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Alchemy Develboards | 2 | # Alchemy Develboards |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += prom.o bcsr.o | 5 | obj-y += prom.o bcsr.o platform.o |
6 | obj-$(CONFIG_PM) += pm.o | 6 | obj-$(CONFIG_PM) += pm.o |
7 | obj-$(CONFIG_MIPS_PB1000) += pb1000/ | 7 | obj-$(CONFIG_MIPS_PB1000) += pb1000/ |
8 | obj-$(CONFIG_MIPS_PB1100) += pb1100/ | 8 | obj-$(CONFIG_MIPS_PB1100) += pb1100/ |
diff --git a/arch/mips/alchemy/devboards/db1x00/Makefile b/arch/mips/alchemy/devboards/db1x00/Makefile index ce48d58920d0..613c0c0c8be9 100644 --- a/arch/mips/alchemy/devboards/db1x00/Makefile +++ b/arch/mips/alchemy/devboards/db1x00/Makefile | |||
@@ -5,4 +5,4 @@ | |||
5 | # Makefile for the Alchemy Semiconductor DBAu1xx0 boards. | 5 | # Makefile for the Alchemy Semiconductor DBAu1xx0 boards. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y := board_setup.o | 8 | obj-y := board_setup.o platform.o |
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c index 9a619aeeaf60..3b228a282b07 100644 --- a/arch/mips/alchemy/devboards/db1x00/board_setup.c +++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c | |||
@@ -187,8 +187,12 @@ static int __init db1x00_init_irq(void) | |||
187 | #if defined(CONFIG_MIPS_MIRAGE) | 187 | #if defined(CONFIG_MIPS_MIRAGE) |
188 | set_irq_type(AU1000_GPIO_7, IRQF_TRIGGER_RISING); /* TS pendown */ | 188 | set_irq_type(AU1000_GPIO_7, IRQF_TRIGGER_RISING); /* TS pendown */ |
189 | #elif defined(CONFIG_MIPS_DB1550) | 189 | #elif defined(CONFIG_MIPS_DB1550) |
190 | set_irq_type(AU1000_GPIO_0, IRQF_TRIGGER_LOW); /* CD0# */ | ||
191 | set_irq_type(AU1000_GPIO_1, IRQF_TRIGGER_LOW); /* CD1# */ | ||
190 | set_irq_type(AU1000_GPIO_3, IRQF_TRIGGER_LOW); /* CARD0# */ | 192 | set_irq_type(AU1000_GPIO_3, IRQF_TRIGGER_LOW); /* CARD0# */ |
191 | set_irq_type(AU1000_GPIO_5, IRQF_TRIGGER_LOW); /* CARD1# */ | 193 | set_irq_type(AU1000_GPIO_5, IRQF_TRIGGER_LOW); /* CARD1# */ |
194 | set_irq_type(AU1000_GPIO_21, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
195 | set_irq_type(AU1000_GPIO_22, IRQF_TRIGGER_LOW); /* STSCHG1# */ | ||
192 | #else | 196 | #else |
193 | set_irq_type(AU1000_GPIO_0, IRQF_TRIGGER_LOW); /* CD0# */ | 197 | set_irq_type(AU1000_GPIO_0, IRQF_TRIGGER_LOW); /* CD0# */ |
194 | set_irq_type(AU1000_GPIO_3, IRQF_TRIGGER_LOW); /* CD1# */ | 198 | set_irq_type(AU1000_GPIO_3, IRQF_TRIGGER_LOW); /* CD1# */ |
diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c new file mode 100644 index 000000000000..b762b790512a --- /dev/null +++ b/arch/mips/alchemy/devboards/db1x00/platform.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * DBAu1xxx board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | |||
24 | #include <asm/mach-au1x00/au1xxx.h> | ||
25 | #include "../platform.h" | ||
26 | |||
27 | #if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \ | ||
28 | defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) | ||
29 | #define DB1XXX_HAS_PCMCIA | ||
30 | #endif | ||
31 | |||
32 | /* DB1xxx PCMCIA interrupt sources: | ||
33 | * CD0/1 GPIO0/3 | ||
34 | * STSCHG0/1 GPIO1/4 | ||
35 | * CARD0/1 GPIO2/5 | ||
36 | * Db1550: 0/1, 21/22, 3/5 | ||
37 | */ | ||
38 | #ifndef CONFIG_MIPS_DB1550 | ||
39 | /* Db1000, Db1100, Db1500 */ | ||
40 | #define DB1XXX_PCMCIA_CD0 AU1000_GPIO_0 | ||
41 | #define DB1XXX_PCMCIA_STSCHG0 AU1000_GPIO_1 | ||
42 | #define DB1XXX_PCMCIA_CARD0 AU1000_GPIO_2 | ||
43 | #define DB1XXX_PCMCIA_CD1 AU1000_GPIO_3 | ||
44 | #define DB1XXX_PCMCIA_STSCHG1 AU1000_GPIO_4 | ||
45 | #define DB1XXX_PCMCIA_CARD1 AU1000_GPIO_5 | ||
46 | #else | ||
47 | #define DB1XXX_PCMCIA_CD0 AU1000_GPIO_0 | ||
48 | #define DB1XXX_PCMCIA_STSCHG0 AU1500_GPIO_21 | ||
49 | #define DB1XXX_PCMCIA_CARD0 AU1000_GPIO_3 | ||
50 | #define DB1XXX_PCMCIA_CD1 AU1000_GPIO_1 | ||
51 | #define DB1XXX_PCMCIA_STSCHG1 AU1500_GPIO_22 | ||
52 | #define DB1XXX_PCMCIA_CARD1 AU1000_GPIO_5 | ||
53 | #endif | ||
54 | |||
55 | static int __init db1xxx_dev_init(void) | ||
56 | { | ||
57 | #ifdef DB1XXX_HAS_PCMCIA | ||
58 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
59 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
60 | PCMCIA_MEM_PSEUDO_PHYS, | ||
61 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
62 | PCMCIA_IO_PSEUDO_PHYS, | ||
63 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
64 | DB1XXX_PCMCIA_CARD0, | ||
65 | DB1XXX_PCMCIA_CD0, | ||
66 | /*DB1XXX_PCMCIA_STSCHG0*/0, | ||
67 | 0, | ||
68 | 0); | ||
69 | |||
70 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00400000, | ||
71 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00440000 - 1, | ||
72 | PCMCIA_MEM_PSEUDO_PHYS + 0x00400000, | ||
73 | PCMCIA_MEM_PSEUDO_PHYS + 0x00440000 - 1, | ||
74 | PCMCIA_IO_PSEUDO_PHYS + 0x00400000, | ||
75 | PCMCIA_IO_PSEUDO_PHYS + 0x00401000 - 1, | ||
76 | DB1XXX_PCMCIA_CARD1, | ||
77 | DB1XXX_PCMCIA_CD1, | ||
78 | /*DB1XXX_PCMCIA_STSCHG1*/0, | ||
79 | 0, | ||
80 | 1); | ||
81 | #endif | ||
82 | return 0; | ||
83 | } | ||
84 | device_initcall(db1xxx_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1100/Makefile b/arch/mips/alchemy/devboards/pb1100/Makefile index c586dd7e91dc..7e3756c83fe5 100644 --- a/arch/mips/alchemy/devboards/pb1100/Makefile +++ b/arch/mips/alchemy/devboards/pb1100/Makefile | |||
@@ -5,4 +5,4 @@ | |||
5 | # Makefile for the Alchemy Semiconductor Pb1100 board. | 5 | # Makefile for the Alchemy Semiconductor Pb1100 board. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y := board_setup.o | 8 | obj-y := board_setup.o platform.o |
diff --git a/arch/mips/alchemy/devboards/pb1100/board_setup.c b/arch/mips/alchemy/devboards/pb1100/board_setup.c index aad424a5f45e..b282d93d1445 100644 --- a/arch/mips/alchemy/devboards/pb1100/board_setup.c +++ b/arch/mips/alchemy/devboards/pb1100/board_setup.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | 30 | ||
31 | #include <asm/mach-au1x00/au1000.h> | 31 | #include <asm/mach-au1x00/au1000.h> |
32 | #include <asm/mach-pb1x00/pb1100.h> | ||
33 | #include <asm/mach-db1x00/bcsr.h> | 32 | #include <asm/mach-db1x00/bcsr.h> |
34 | 33 | ||
35 | #include <prom.h> | 34 | #include <prom.h> |
diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c new file mode 100644 index 000000000000..8487da55a10c --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1100/platform.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Pb1100 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | |||
23 | #include <asm/mach-au1x00/au1000.h> | ||
24 | |||
25 | #include "../platform.h" | ||
26 | |||
27 | static int __init pb1100_dev_init(void) | ||
28 | { | ||
29 | /* PCMCIA. single socket, identical to Pb1500 */ | ||
30 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
31 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
32 | PCMCIA_MEM_PSEUDO_PHYS, | ||
33 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
34 | PCMCIA_IO_PSEUDO_PHYS, | ||
35 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
36 | AU1000_GPIO_11, /* card */ | ||
37 | AU1000_GPIO_9, /* insert */ | ||
38 | /*AU1000_GPIO_10*/0, /* stschg */ | ||
39 | 0, /* eject */ | ||
40 | 0); /* id */ | ||
41 | return 0; | ||
42 | } | ||
43 | device_initcall(pb1100_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c index dfdaabf77909..c8b7ae3f3253 100644 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ b/arch/mips/alchemy/devboards/pb1200/platform.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <asm/mach-au1x00/au1100_mmc.h> | 28 | #include <asm/mach-au1x00/au1100_mmc.h> |
29 | #include <asm/mach-db1x00/bcsr.h> | 29 | #include <asm/mach-db1x00/bcsr.h> |
30 | 30 | ||
31 | #include "../platform.h" | ||
32 | |||
31 | static int mmc_activity; | 33 | static int mmc_activity; |
32 | 34 | ||
33 | static void pb1200mmc0_set_power(void *mmc_host, int state) | 35 | static void pb1200mmc0_set_power(void *mmc_host, int state) |
@@ -170,8 +172,57 @@ static struct platform_device *board_platform_devices[] __initdata = { | |||
170 | 172 | ||
171 | static int __init board_register_devices(void) | 173 | static int __init board_register_devices(void) |
172 | { | 174 | { |
175 | #ifdef CONFIG_MIPS_PB1200 | ||
176 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
177 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
178 | PCMCIA_MEM_PSEUDO_PHYS, | ||
179 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
180 | PCMCIA_IO_PSEUDO_PHYS, | ||
181 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
182 | PB1200_PC0_INT, | ||
183 | PB1200_PC0_INSERT_INT, | ||
184 | /*PB1200_PC0_STSCHG_INT*/0, | ||
185 | PB1200_PC0_EJECT_INT, | ||
186 | 0); | ||
187 | |||
188 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00800000, | ||
189 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00840000 - 1, | ||
190 | PCMCIA_MEM_PSEUDO_PHYS + 0x00800000, | ||
191 | PCMCIA_MEM_PSEUDO_PHYS + 0x00840000 - 1, | ||
192 | PCMCIA_IO_PSEUDO_PHYS + 0x00800000, | ||
193 | PCMCIA_IO_PSEUDO_PHYS + 0x00801000 - 1, | ||
194 | PB1200_PC1_INT, | ||
195 | PB1200_PC1_INSERT_INT, | ||
196 | /*PB1200_PC1_STSCHG_INT*/0, | ||
197 | PB1200_PC1_EJECT_INT, | ||
198 | 1); | ||
199 | #else | ||
200 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
201 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
202 | PCMCIA_MEM_PSEUDO_PHYS, | ||
203 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
204 | PCMCIA_IO_PSEUDO_PHYS, | ||
205 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
206 | DB1200_PC0_INT, | ||
207 | DB1200_PC0_INSERT_INT, | ||
208 | /*DB1200_PC0_STSCHG_INT*/0, | ||
209 | DB1200_PC0_EJECT_INT, | ||
210 | 0); | ||
211 | |||
212 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00400000, | ||
213 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00440000 - 1, | ||
214 | PCMCIA_MEM_PSEUDO_PHYS + 0x00400000, | ||
215 | PCMCIA_MEM_PSEUDO_PHYS + 0x00440000 - 1, | ||
216 | PCMCIA_IO_PSEUDO_PHYS + 0x00400000, | ||
217 | PCMCIA_IO_PSEUDO_PHYS + 0x00401000 - 1, | ||
218 | DB1200_PC1_INT, | ||
219 | DB1200_PC1_INSERT_INT, | ||
220 | /*DB1200_PC1_STSCHG_INT*/0, | ||
221 | DB1200_PC1_EJECT_INT, | ||
222 | 1); | ||
223 | #endif | ||
224 | |||
173 | return platform_add_devices(board_platform_devices, | 225 | return platform_add_devices(board_platform_devices, |
174 | ARRAY_SIZE(board_platform_devices)); | 226 | ARRAY_SIZE(board_platform_devices)); |
175 | } | 227 | } |
176 | 228 | device_initcall(board_register_devices); | |
177 | arch_initcall(board_register_devices); | ||
diff --git a/arch/mips/alchemy/devboards/pb1500/Makefile b/arch/mips/alchemy/devboards/pb1500/Makefile index 173b419a7479..e83b151b5b63 100644 --- a/arch/mips/alchemy/devboards/pb1500/Makefile +++ b/arch/mips/alchemy/devboards/pb1500/Makefile | |||
@@ -5,4 +5,4 @@ | |||
5 | # Makefile for the Alchemy Semiconductor Pb1500 board. | 5 | # Makefile for the Alchemy Semiconductor Pb1500 board. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y := board_setup.o | 8 | obj-y := board_setup.o platform.o |
diff --git a/arch/mips/alchemy/devboards/pb1500/board_setup.c b/arch/mips/alchemy/devboards/pb1500/board_setup.c index bf8e14906ea4..a148802fa427 100644 --- a/arch/mips/alchemy/devboards/pb1500/board_setup.c +++ b/arch/mips/alchemy/devboards/pb1500/board_setup.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | 30 | ||
31 | #include <asm/mach-au1x00/au1000.h> | 31 | #include <asm/mach-au1x00/au1000.h> |
32 | #include <asm/mach-pb1x00/pb1500.h> | ||
33 | #include <asm/mach-db1x00/bcsr.h> | 32 | #include <asm/mach-db1x00/bcsr.h> |
34 | 33 | ||
35 | #include <prom.h> | 34 | #include <prom.h> |
@@ -156,6 +155,9 @@ void __init board_setup(void) | |||
156 | 155 | ||
157 | static int __init pb1500_init_irq(void) | 156 | static int __init pb1500_init_irq(void) |
158 | { | 157 | { |
158 | set_irq_type(AU1000_GPIO_9, IRQF_TRIGGER_LOW); /* CD0# */ | ||
159 | set_irq_type(AU1000_GPIO_10, IRQF_TRIGGER_LOW); /* CARD0 */ | ||
160 | set_irq_type(AU1000_GPIO_11, IRQF_TRIGGER_LOW); /* STSCHG0# */ | ||
159 | set_irq_type(AU1500_GPIO_204, IRQF_TRIGGER_HIGH); | 161 | set_irq_type(AU1500_GPIO_204, IRQF_TRIGGER_HIGH); |
160 | set_irq_type(AU1500_GPIO_201, IRQF_TRIGGER_LOW); | 162 | set_irq_type(AU1500_GPIO_201, IRQF_TRIGGER_LOW); |
161 | set_irq_type(AU1500_GPIO_202, IRQF_TRIGGER_LOW); | 163 | set_irq_type(AU1500_GPIO_202, IRQF_TRIGGER_LOW); |
diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c new file mode 100644 index 000000000000..6c00cbe529a2 --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1500/platform.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Pb1500 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | #include <asm/mach-au1x00/au1000.h> | ||
23 | |||
24 | #include "../platform.h" | ||
25 | |||
26 | static int __init pb1500_dev_init(void) | ||
27 | { | ||
28 | /* PCMCIA. single socket, identical to Pb1500 */ | ||
29 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
30 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
31 | PCMCIA_MEM_PSEUDO_PHYS, | ||
32 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
33 | PCMCIA_IO_PSEUDO_PHYS, | ||
34 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
35 | AU1000_GPIO_11, /* card */ | ||
36 | AU1000_GPIO_9, /* insert */ | ||
37 | /*AU1000_GPIO_10*/0, /* stschg */ | ||
38 | 0, /* eject */ | ||
39 | 0); /* id */ | ||
40 | return 0; | ||
41 | } | ||
42 | device_initcall(pb1500_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/pb1550/Makefile b/arch/mips/alchemy/devboards/pb1550/Makefile index cff95bcdb2ca..9661b6ec5dd3 100644 --- a/arch/mips/alchemy/devboards/pb1550/Makefile +++ b/arch/mips/alchemy/devboards/pb1550/Makefile | |||
@@ -5,4 +5,4 @@ | |||
5 | # Makefile for the Alchemy Semiconductor Pb1550 board. | 5 | # Makefile for the Alchemy Semiconductor Pb1550 board. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y := board_setup.o | 8 | obj-y := board_setup.o platform.o |
diff --git a/arch/mips/alchemy/devboards/pb1550/board_setup.c b/arch/mips/alchemy/devboards/pb1550/board_setup.c index 64f1ff9e0131..64a6fc4f1751 100644 --- a/arch/mips/alchemy/devboards/pb1550/board_setup.c +++ b/arch/mips/alchemy/devboards/pb1550/board_setup.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/mach-au1x00/au1000.h> | 33 | #include <asm/mach-au1x00/au1000.h> |
34 | #include <asm/mach-pb1x00/pb1550.h> | 34 | #include <asm/mach-pb1x00/pb1550.h> |
35 | #include <asm/mach-db1x00/bcsr.h> | 35 | #include <asm/mach-db1x00/bcsr.h> |
36 | #include <asm/mach-au1x00/gpio.h> | ||
36 | 37 | ||
37 | #include <prom.h> | 38 | #include <prom.h> |
38 | 39 | ||
@@ -70,6 +71,8 @@ void __init board_setup(void) | |||
70 | } | 71 | } |
71 | #endif | 72 | #endif |
72 | 73 | ||
74 | alchemy_gpio2_enable(); | ||
75 | |||
73 | /* | 76 | /* |
74 | * Enable PSC1 SYNC for AC'97. Normaly done in audio driver, | 77 | * Enable PSC1 SYNC for AC'97. Normaly done in audio driver, |
75 | * but it is board specific code, so put it here. | 78 | * but it is board specific code, so put it here. |
@@ -88,6 +91,11 @@ static int __init pb1550_init_irq(void) | |||
88 | { | 91 | { |
89 | set_irq_type(AU1000_GPIO_0, IRQF_TRIGGER_LOW); | 92 | set_irq_type(AU1000_GPIO_0, IRQF_TRIGGER_LOW); |
90 | set_irq_type(AU1000_GPIO_1, IRQF_TRIGGER_LOW); | 93 | set_irq_type(AU1000_GPIO_1, IRQF_TRIGGER_LOW); |
94 | set_irq_type(AU1500_GPIO_201_205, IRQF_TRIGGER_HIGH); | ||
95 | |||
96 | /* enable both PCMCIA card irqs in the shared line */ | ||
97 | alchemy_gpio2_enable_int(201); | ||
98 | alchemy_gpio2_enable_int(202); | ||
91 | 99 | ||
92 | return 0; | 100 | return 0; |
93 | } | 101 | } |
diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550/platform.c new file mode 100644 index 000000000000..aa5016c2e868 --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1550/platform.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Pb1550 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2009 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/init.h> | ||
22 | |||
23 | #include <asm/mach-au1x00/au1000.h> | ||
24 | #include <asm/mach-pb1x00/pb1550.h> | ||
25 | |||
26 | #include "../platform.h" | ||
27 | |||
28 | static int __init pb1550_dev_init(void) | ||
29 | { | ||
30 | /* Pb1550, like all others, also has statuschange irqs; however they're | ||
31 | * wired up on one of the Au1550's shared GPIO201_205 line, which also | ||
32 | * services the PCMCIA card interrupts. So we ignore statuschange and | ||
33 | * use the GPIO201_205 exclusively for card interrupts, since a) pcmcia | ||
34 | * drivers are used to shared irqs and b) statuschange isn't really use- | ||
35 | * ful anyway. | ||
36 | */ | ||
37 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS, | ||
38 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1, | ||
39 | PCMCIA_MEM_PSEUDO_PHYS, | ||
40 | PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1, | ||
41 | PCMCIA_IO_PSEUDO_PHYS, | ||
42 | PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1, | ||
43 | AU1500_GPIO_201_205, | ||
44 | AU1000_GPIO_0, | ||
45 | 0, | ||
46 | 0, | ||
47 | 0); | ||
48 | |||
49 | db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00800000, | ||
50 | PCMCIA_ATTR_PSEUDO_PHYS + 0x00840000 - 1, | ||
51 | PCMCIA_MEM_PSEUDO_PHYS + 0x00800000, | ||
52 | PCMCIA_MEM_PSEUDO_PHYS + 0x00840000 - 1, | ||
53 | PCMCIA_IO_PSEUDO_PHYS + 0x00800000, | ||
54 | PCMCIA_IO_PSEUDO_PHYS + 0x00801000 - 1, | ||
55 | AU1500_GPIO_201_205, | ||
56 | AU1000_GPIO_1, | ||
57 | 0, | ||
58 | 0, | ||
59 | 1); | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | device_initcall(pb1550_dev_init); | ||
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c new file mode 100644 index 000000000000..48c537cc8efb --- /dev/null +++ b/arch/mips/alchemy/devboards/platform.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * devoard misc stuff. | ||
3 | */ | ||
4 | |||
5 | #include <linux/init.h> | ||
6 | #include <linux/slab.h> | ||
7 | #include <linux/platform_device.h> | ||
8 | |||
9 | /* register a pcmcia socket */ | ||
10 | int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start, | ||
11 | unsigned long pseudo_attr_end, | ||
12 | unsigned long pseudo_mem_start, | ||
13 | unsigned long pseudo_mem_end, | ||
14 | unsigned long pseudo_io_start, | ||
15 | unsigned long pseudo_io_end, | ||
16 | int card_irq, | ||
17 | int cd_irq, | ||
18 | int stschg_irq, | ||
19 | int eject_irq, | ||
20 | int id) | ||
21 | { | ||
22 | int cnt, i, ret; | ||
23 | struct resource *sr; | ||
24 | struct platform_device *pd; | ||
25 | |||
26 | cnt = 5; | ||
27 | if (eject_irq) | ||
28 | cnt++; | ||
29 | if (stschg_irq) | ||
30 | cnt++; | ||
31 | |||
32 | sr = kzalloc(sizeof(struct resource) * cnt, GFP_KERNEL); | ||
33 | if (!sr) | ||
34 | return -ENOMEM; | ||
35 | |||
36 | pd = platform_device_alloc("db1xxx_pcmcia", id); | ||
37 | if (!pd) { | ||
38 | ret = -ENOMEM; | ||
39 | goto out; | ||
40 | } | ||
41 | |||
42 | sr[0].name = "pseudo-attr"; | ||
43 | sr[0].flags = IORESOURCE_MEM; | ||
44 | sr[0].start = pseudo_attr_start; | ||
45 | sr[0].end = pseudo_attr_end; | ||
46 | |||
47 | sr[1].name = "pseudo-mem"; | ||
48 | sr[1].flags = IORESOURCE_MEM; | ||
49 | sr[1].start = pseudo_mem_start; | ||
50 | sr[1].end = pseudo_mem_end; | ||
51 | |||
52 | sr[2].name = "pseudo-io"; | ||
53 | sr[2].flags = IORESOURCE_MEM; | ||
54 | sr[2].start = pseudo_io_start; | ||
55 | sr[2].end = pseudo_io_end; | ||
56 | |||
57 | sr[3].name = "insert"; | ||
58 | sr[3].flags = IORESOURCE_IRQ; | ||
59 | sr[3].start = sr[3].end = cd_irq; | ||
60 | |||
61 | sr[4].name = "card"; | ||
62 | sr[4].flags = IORESOURCE_IRQ; | ||
63 | sr[4].start = sr[4].end = card_irq; | ||
64 | |||
65 | i = 5; | ||
66 | if (stschg_irq) { | ||
67 | sr[i].name = "insert"; | ||
68 | sr[i].flags = IORESOURCE_IRQ; | ||
69 | sr[i].start = sr[i].end = cd_irq; | ||
70 | i++; | ||
71 | } | ||
72 | if (eject_irq) { | ||
73 | sr[i].name = "eject"; | ||
74 | sr[i].flags = IORESOURCE_IRQ; | ||
75 | sr[i].start = sr[i].end = eject_irq; | ||
76 | } | ||
77 | |||
78 | pd->resource = sr; | ||
79 | pd->num_resources = cnt; | ||
80 | |||
81 | ret = platform_device_add(pd); | ||
82 | if (!ret) | ||
83 | return 0; | ||
84 | |||
85 | platform_device_put(pd); | ||
86 | out: | ||
87 | kfree(sr); | ||
88 | return ret; | ||
89 | } | ||
diff --git a/arch/mips/alchemy/devboards/platform.h b/arch/mips/alchemy/devboards/platform.h new file mode 100644 index 000000000000..55ecf7e9258f --- /dev/null +++ b/arch/mips/alchemy/devboards/platform.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _DEVBOARD_PLATFORM_H_ | ||
2 | #define _DEVBOARD_PLATFORM_H_ | ||
3 | |||
4 | #include <linux/init.h> | ||
5 | |||
6 | int __init db1x_register_pcmcia_socket(unsigned long pseudo_attr_start, | ||
7 | unsigned long pseudo_attr_len, | ||
8 | unsigned long pseudo_mem_start, | ||
9 | unsigned long pseudo_mem_end, | ||
10 | unsigned long pseudo_io_start, | ||
11 | unsigned long pseudo_io_end, | ||
12 | int card_irq, | ||
13 | int cd_irq, | ||
14 | int stschg_irq, | ||
15 | int eject_irq, | ||
16 | int id); | ||
17 | |||
18 | #endif | ||