First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / mips / alchemy / devboards / db1x00 / board_setup.c
blobde30d8ea7176d3a706b828f0b63d936a57eb6bf4
1 /*
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Db1x00 board setup.
6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include <linux/gpio.h>
31 #include <linux/init.h>
33 #include <asm/mach-au1x00/au1000.h>
34 #include <asm/mach-db1x00/db1x00.h>
36 #include <prom.h>
39 static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
41 const char *get_system_type(void)
43 #ifdef CONFIG_MIPS_BOSPORUS
44 return "Alchemy Bosporus Gateway Reference";
45 #else
46 return "Alchemy Db1x00";
47 #endif
50 void board_reset(void)
52 /* Hit BCSR.SW_RESET[RESET] */
53 bcsr->swreset = 0x0000;
56 void __init board_setup(void)
58 u32 pin_func = 0;
59 char *argptr;
61 argptr = prom_getcmdline();
62 #ifdef CONFIG_SERIAL_8250_CONSOLE
63 argptr = strstr(argptr, "console=");
64 if (argptr == NULL) {
65 argptr = prom_getcmdline();
66 strcat(argptr, " console=ttyS0,115200");
68 #endif
70 #ifdef CONFIG_FB_AU1100
71 argptr = strstr(argptr, "video=");
72 if (argptr == NULL) {
73 argptr = prom_getcmdline();
74 /* default panel */
75 /*strcat(argptr, " video=au1100fb:panel:Sharp_320x240_16");*/
77 #endif
79 #if defined(CONFIG_SOUND_AU1X00) && !defined(CONFIG_SOC_AU1000)
80 /* au1000 does not support vra, au1500 and au1100 do */
81 strcat(argptr, " au1000_audio=vra");
82 argptr = prom_getcmdline();
83 #endif
85 /* Not valid for Au1550 */
86 #if defined(CONFIG_IRDA) && \
87 (defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100))
88 /* Set IRFIRSEL instead of GPIO15 */
89 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
90 au_writel(pin_func, SYS_PINFUNC);
91 /* Power off until the driver is in use */
92 bcsr->resets &= ~BCSR_RESETS_IRDA_MODE_MASK;
93 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
94 au_sync();
95 #endif
96 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
98 /* Enable GPIO[31:0] inputs */
99 alchemy_gpio1_input_enable();
101 #ifdef CONFIG_MIPS_MIRAGE
102 /* GPIO[20] is output */
103 alchemy_gpio_direction_output(20, 0);
105 /* Set GPIO[210:208] instead of SSI_0 */
106 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
108 /* Set GPIO[215:211] for LEDs */
109 pin_func |= 5 << 2;
111 /* Set GPIO[214:213] for more LEDs */
112 pin_func |= 5 << 12;
114 /* Set GPIO[207:200] instead of PCMCIA/LCD */
115 pin_func |= SYS_PF_LCD | SYS_PF_PC;
116 au_writel(pin_func, SYS_PINFUNC);
119 * Enable speaker amplifier. This should
120 * be part of the audio driver.
122 alchemy_gpio_direction_output(209, 1);
123 #endif
125 au_sync();
127 #ifdef CONFIG_MIPS_DB1000
128 printk(KERN_INFO "AMD Alchemy Au1000/Db1000 Board\n");
129 #endif
130 #ifdef CONFIG_MIPS_DB1500
131 printk(KERN_INFO "AMD Alchemy Au1500/Db1500 Board\n");
132 #endif
133 #ifdef CONFIG_MIPS_DB1100
134 printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n");
135 #endif
136 #ifdef CONFIG_MIPS_BOSPORUS
137 printk(KERN_INFO "AMD Alchemy Bosporus Board\n");
138 #endif
139 #ifdef CONFIG_MIPS_MIRAGE
140 printk(KERN_INFO "AMD Alchemy Mirage Board\n");
141 #endif
142 #ifdef CONFIG_MIPS_DB1550
143 printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
144 #endif