diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-12 09:05:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-12 09:05:39 -0400 |
commit | a9b9e81c915e4a57ac3b21d1a7fa7ff184639780 (patch) | |
tree | 98304395fbb5b9c74fca35b196cd414c1949f280 /arch/mips/alchemy/mtx-1 | |
parent | a8b71a2810386a5ac8f43d2095fe3355f0d8db37 (diff) | |
parent | fd048088306656824958e7783ffcee27e241b361 (diff) |
Merge branch 'linus' into x86/memory-corruption-check
Diffstat (limited to 'arch/mips/alchemy/mtx-1')
-rw-r--r-- | arch/mips/alchemy/mtx-1/Makefile | 12 | ||||
-rw-r--r-- | arch/mips/alchemy/mtx-1/board_setup.c | 98 | ||||
-rw-r--r-- | arch/mips/alchemy/mtx-1/init.c | 60 | ||||
-rw-r--r-- | arch/mips/alchemy/mtx-1/irqmap.c | 52 | ||||
-rw-r--r-- | arch/mips/alchemy/mtx-1/platform.c | 149 |
5 files changed, 371 insertions, 0 deletions
diff --git a/arch/mips/alchemy/mtx-1/Makefile b/arch/mips/alchemy/mtx-1/Makefile new file mode 100644 index 000000000000..7c67b3d33bec --- /dev/null +++ b/arch/mips/alchemy/mtx-1/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # | ||
2 | # Copyright 2003 MontaVista Software Inc. | ||
3 | # Author: MontaVista Software, Inc. <source@mvista.com> | ||
4 | # Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
5 | # | ||
6 | # Makefile for 4G Systems MTX-1 board. | ||
7 | # | ||
8 | |||
9 | lib-y := init.o board_setup.o irqmap.o | ||
10 | obj-y := platform.o | ||
11 | |||
12 | EXTRA_CFLAGS += -Werror | ||
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c new file mode 100644 index 000000000000..3f8079186cf2 --- /dev/null +++ b/arch/mips/alchemy/mtx-1/board_setup.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * 4G Systems MTX-1 board setup. | ||
5 | * | ||
6 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | #include <linux/init.h> | ||
32 | |||
33 | #include <asm/mach-au1x00/au1000.h> | ||
34 | |||
35 | extern int (*board_pci_idsel)(unsigned int devsel, int assert); | ||
36 | int mtx1_pci_idsel(unsigned int devsel, int assert); | ||
37 | |||
38 | void board_reset(void) | ||
39 | { | ||
40 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ | ||
41 | au_writel(0x00000000, 0xAE00001C); | ||
42 | } | ||
43 | |||
44 | void __init board_setup(void) | ||
45 | { | ||
46 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
47 | /* Enable USB power switch */ | ||
48 | au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR); | ||
49 | au_writel(0x100000, GPIO2_OUTPUT); | ||
50 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | ||
51 | |||
52 | #ifdef CONFIG_PCI | ||
53 | #if defined(__MIPSEB__) | ||
54 | au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG); | ||
55 | #else | ||
56 | au_writel(0xf, Au1500_PCI_CFG); | ||
57 | #endif | ||
58 | #endif | ||
59 | |||
60 | /* Initialize sys_pinfunc */ | ||
61 | au_writel(SYS_PF_NI2, SYS_PINFUNC); | ||
62 | |||
63 | /* Initialize GPIO */ | ||
64 | au_writel(0xFFFFFFFF, SYS_TRIOUTCLR); | ||
65 | au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */ | ||
66 | au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */ | ||
67 | au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */ | ||
68 | au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */ | ||
69 | |||
70 | /* Enable LED and set it to green */ | ||
71 | au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR); | ||
72 | au_writel(0x18000800, GPIO2_OUTPUT); | ||
73 | |||
74 | board_pci_idsel = mtx1_pci_idsel; | ||
75 | |||
76 | printk(KERN_INFO "4G Systems MTX-1 Board\n"); | ||
77 | } | ||
78 | |||
79 | int | ||
80 | mtx1_pci_idsel(unsigned int devsel, int assert) | ||
81 | { | ||
82 | #define MTX_IDSEL_ONLY_0_AND_3 0 | ||
83 | #if MTX_IDSEL_ONLY_0_AND_3 | ||
84 | if (devsel != 0 && devsel != 3) { | ||
85 | printk(KERN_ERR "*** not 0 or 3\n"); | ||
86 | return 0; | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | if (assert && devsel != 0) | ||
91 | /* Suppress signal to Cardbus */ | ||
92 | au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */ | ||
93 | else | ||
94 | au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */ | ||
95 | au_sync_udelay(1); | ||
96 | return 1; | ||
97 | } | ||
98 | |||
diff --git a/arch/mips/alchemy/mtx-1/init.c b/arch/mips/alchemy/mtx-1/init.c new file mode 100644 index 000000000000..3bae13c28954 --- /dev/null +++ b/arch/mips/alchemy/mtx-1/init.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * | ||
3 | * BRIEF MODULE DESCRIPTION | ||
4 | * 4G Systems MTX-1 board setup | ||
5 | * | ||
6 | * Copyright 2003, 2008 MontaVista Software Inc. | ||
7 | * Author: MontaVista Software, Inc. <source@mvista.com> | ||
8 | * Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License along | ||
27 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
28 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/init.h> | ||
33 | |||
34 | #include <asm/bootinfo.h> | ||
35 | |||
36 | #include <prom.h> | ||
37 | |||
38 | const char *get_system_type(void) | ||
39 | { | ||
40 | return "MTX-1"; | ||
41 | } | ||
42 | |||
43 | void __init prom_init(void) | ||
44 | { | ||
45 | unsigned char *memsize_str; | ||
46 | unsigned long memsize; | ||
47 | |||
48 | prom_argc = fw_arg0; | ||
49 | prom_argv = (char **)fw_arg1; | ||
50 | prom_envp = (char **)fw_arg2; | ||
51 | |||
52 | prom_init_cmdline(); | ||
53 | |||
54 | memsize_str = prom_getenv("memsize"); | ||
55 | if (!memsize_str) | ||
56 | memsize = 0x04000000; | ||
57 | else | ||
58 | strict_strtol(memsize_str, 0, &memsize); | ||
59 | add_memory_region(0, memsize, BOOT_MEM_RAM); | ||
60 | } | ||
diff --git a/arch/mips/alchemy/mtx-1/irqmap.c b/arch/mips/alchemy/mtx-1/irqmap.c new file mode 100644 index 000000000000..f2bf02951e9c --- /dev/null +++ b/arch/mips/alchemy/mtx-1/irqmap.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * BRIEF MODULE DESCRIPTION | ||
3 | * Au1xxx irq map table | ||
4 | * | ||
5 | * Copyright 2003 Embedded Edge, LLC | ||
6 | * dan@embeddededge.com | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
16 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
19 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License along | ||
25 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
26 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | */ | ||
28 | |||
29 | #include <linux/init.h> | ||
30 | |||
31 | #include <asm/mach-au1x00/au1000.h> | ||
32 | |||
33 | char irq_tab_alchemy[][5] __initdata = { | ||
34 | [0] = { -1, INTA, INTA, INTX, INTX }, /* IDSEL 00 - AdapterA-Slot0 (top) */ | ||
35 | [1] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */ | ||
36 | [2] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 02 - AdapterB-Slot0 (top) */ | ||
37 | [3] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */ | ||
38 | [4] = { -1, INTA, INTB, INTX, INTX }, /* IDSEL 04 - AdapterC-Slot0 (top) */ | ||
39 | [5] = { -1, INTB, INTA, INTX, INTX }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */ | ||
40 | [6] = { -1, INTC, INTD, INTX, INTX }, /* IDSEL 06 - AdapterD-Slot0 (top) */ | ||
41 | [7] = { -1, INTD, INTC, INTX, INTX }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */ | ||
42 | }; | ||
43 | |||
44 | struct au1xxx_irqmap __initdata au1xxx_irq_map[] = { | ||
45 | { AU1500_GPIO_204, INTC_INT_HIGH_LEVEL, 0 }, | ||
46 | { AU1500_GPIO_201, INTC_INT_LOW_LEVEL, 0 }, | ||
47 | { AU1500_GPIO_202, INTC_INT_LOW_LEVEL, 0 }, | ||
48 | { AU1500_GPIO_203, INTC_INT_LOW_LEVEL, 0 }, | ||
49 | { AU1500_GPIO_205, INTC_INT_LOW_LEVEL, 0 }, | ||
50 | }; | ||
51 | |||
52 | int __initdata au1xxx_nr_irqs = ARRAY_SIZE(au1xxx_irq_map); | ||
diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c new file mode 100644 index 000000000000..8b5914d1241f --- /dev/null +++ b/arch/mips/alchemy/mtx-1/platform.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * MTX-1 platform devices registration | ||
3 | * | ||
4 | * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org> | ||
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 | #include <linux/leds.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <linux/gpio_keys.h> | ||
26 | #include <linux/input.h> | ||
27 | #include <linux/mtd/partitions.h> | ||
28 | #include <linux/mtd/physmap.h> | ||
29 | #include <mtd/mtd-abi.h> | ||
30 | |||
31 | static struct gpio_keys_button mtx1_gpio_button[] = { | ||
32 | { | ||
33 | .gpio = 207, | ||
34 | .code = BTN_0, | ||
35 | .desc = "System button", | ||
36 | } | ||
37 | }; | ||
38 | |||
39 | static struct gpio_keys_platform_data mtx1_buttons_data = { | ||
40 | .buttons = mtx1_gpio_button, | ||
41 | .nbuttons = ARRAY_SIZE(mtx1_gpio_button), | ||
42 | }; | ||
43 | |||
44 | static struct platform_device mtx1_button = { | ||
45 | .name = "gpio-keys", | ||
46 | .id = -1, | ||
47 | .dev = { | ||
48 | .platform_data = &mtx1_buttons_data, | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | static struct resource mtx1_wdt_res[] = { | ||
53 | [0] = { | ||
54 | .start = 15, | ||
55 | .end = 15, | ||
56 | .name = "mtx1-wdt-gpio", | ||
57 | .flags = IORESOURCE_IRQ, | ||
58 | } | ||
59 | }; | ||
60 | |||
61 | static struct platform_device mtx1_wdt = { | ||
62 | .name = "mtx1-wdt", | ||
63 | .id = 0, | ||
64 | .num_resources = ARRAY_SIZE(mtx1_wdt_res), | ||
65 | .resource = mtx1_wdt_res, | ||
66 | }; | ||
67 | |||
68 | static struct gpio_led default_leds[] = { | ||
69 | { | ||
70 | .name = "mtx1:green", | ||
71 | .gpio = 211, | ||
72 | }, { | ||
73 | .name = "mtx1:red", | ||
74 | .gpio = 212, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static struct gpio_led_platform_data mtx1_led_data = { | ||
79 | .num_leds = ARRAY_SIZE(default_leds), | ||
80 | .leds = default_leds, | ||
81 | }; | ||
82 | |||
83 | static struct platform_device mtx1_gpio_leds = { | ||
84 | .name = "leds-gpio", | ||
85 | .id = -1, | ||
86 | .dev = { | ||
87 | .platform_data = &mtx1_led_data, | ||
88 | } | ||
89 | }; | ||
90 | |||
91 | static struct mtd_partition mtx1_mtd_partitions[] = { | ||
92 | { | ||
93 | .name = "filesystem", | ||
94 | .size = 0x01C00000, | ||
95 | .offset = 0, | ||
96 | }, | ||
97 | { | ||
98 | .name = "yamon", | ||
99 | .size = 0x00100000, | ||
100 | .offset = MTDPART_OFS_APPEND, | ||
101 | .mask_flags = MTD_WRITEABLE, | ||
102 | }, | ||
103 | { | ||
104 | .name = "kernel", | ||
105 | .size = 0x002c0000, | ||
106 | .offset = MTDPART_OFS_APPEND, | ||
107 | }, | ||
108 | { | ||
109 | .name = "yamon env", | ||
110 | .size = 0x00040000, | ||
111 | .offset = MTDPART_OFS_APPEND, | ||
112 | }, | ||
113 | }; | ||
114 | |||
115 | static struct physmap_flash_data mtx1_flash_data = { | ||
116 | .width = 4, | ||
117 | .nr_parts = 4, | ||
118 | .parts = mtx1_mtd_partitions, | ||
119 | }; | ||
120 | |||
121 | static struct resource mtx1_mtd_resource = { | ||
122 | .start = 0x1e000000, | ||
123 | .end = 0x1fffffff, | ||
124 | .flags = IORESOURCE_MEM, | ||
125 | }; | ||
126 | |||
127 | static struct platform_device mtx1_mtd = { | ||
128 | .name = "physmap-flash", | ||
129 | .dev = { | ||
130 | .platform_data = &mtx1_flash_data, | ||
131 | }, | ||
132 | .num_resources = 1, | ||
133 | .resource = &mtx1_mtd_resource, | ||
134 | }; | ||
135 | |||
136 | static struct __initdata platform_device * mtx1_devs[] = { | ||
137 | &mtx1_gpio_leds, | ||
138 | &mtx1_wdt, | ||
139 | &mtx1_button, | ||
140 | &mtx1_mtd, | ||
141 | }; | ||
142 | |||
143 | static int __init mtx1_register_devices(void) | ||
144 | { | ||
145 | gpio_direction_input(207); | ||
146 | return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); | ||
147 | } | ||
148 | |||
149 | arch_initcall(mtx1_register_devices); | ||