Linux 2.6.25.3
[linux/fpc-iii.git] / arch / mips / au1000 / pb1200 / board_setup.c
blobb98bebfa87c6acd7c50e835b98c74f48ba8a3548
1 /*
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1200/Db1200 board setup.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <linux/init.h>
27 #include <linux/sched.h>
28 #include <linux/ioport.h>
29 #include <linux/mm.h>
30 #include <linux/console.h>
31 #include <linux/mc146818rtc.h>
32 #include <linux/delay.h>
34 #if defined(CONFIG_BLK_DEV_IDE_AU1XXX)
35 #include <linux/ide.h>
36 #endif
38 #include <asm/cpu.h>
39 #include <asm/bootinfo.h>
40 #include <asm/irq.h>
41 #include <asm/mipsregs.h>
42 #include <asm/reboot.h>
43 #include <asm/pgtable.h>
45 #include <au1000.h>
46 #include <au1xxx_dbdma.h>
47 #include <prom.h>
49 #ifdef CONFIG_MIPS_PB1200
50 #include <asm/mach-pb1x00/pb1200.h>
51 #endif
53 #ifdef CONFIG_MIPS_DB1200
54 #include <asm/mach-db1x00/db1200.h>
55 #define PB1200_ETH_INT DB1200_ETH_INT
56 #define PB1200_IDE_INT DB1200_IDE_INT
57 #endif
59 extern void _board_init_irq(void);
60 extern void (*board_init_irq)(void);
62 void board_reset(void)
64 bcsr->resets = 0;
65 bcsr->system = 0;
68 void __init board_setup(void)
70 char *argptr = NULL;
72 #if 0
74 u32 pin_func;
76 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver,
77 * but it is board specific code, so put it here.
79 pin_func = au_readl(SYS_PINFUNC);
80 au_sync();
81 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
82 au_writel(pin_func, SYS_PINFUNC);
84 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */
85 au_sync();
87 #endif
89 #if defined(CONFIG_I2C_AU1550)
91 u32 freq0, clksrc;
92 u32 pin_func;
94 /* Select SMBUS in CPLD */
95 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX);
97 pin_func = au_readl(SYS_PINFUNC);
98 au_sync();
99 pin_func &= ~(3<<17 | 1<<4);
100 /* Set GPIOs correctly */
101 pin_func |= 2<<17;
102 au_writel(pin_func, SYS_PINFUNC);
103 au_sync();
105 /* The i2c driver depends on 50Mhz clock */
106 freq0 = au_readl(SYS_FREQCTRL0);
107 au_sync();
108 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1);
109 freq0 |= (3<<SYS_FC_FRDIV1_BIT);
110 /* 396Mhz / (3+1)*2 == 49.5Mhz */
111 au_writel(freq0, SYS_FREQCTRL0);
112 au_sync();
113 freq0 |= SYS_FC_FE1;
114 au_writel(freq0, SYS_FREQCTRL0);
115 au_sync();
117 clksrc = au_readl(SYS_CLKSRC);
118 au_sync();
119 clksrc &= ~0x01f00000;
120 /* bit 22 is EXTCLK0 for PSC0 */
121 clksrc |= (0x3 << 22);
122 au_writel(clksrc, SYS_CLKSRC);
123 au_sync();
125 #endif
127 #ifdef CONFIG_FB_AU1200
128 argptr = prom_getcmdline();
129 #ifdef CONFIG_MIPS_PB1200
130 strcat(argptr, " video=au1200fb:panel:bs");
131 #endif
132 #ifdef CONFIG_MIPS_DB1200
133 strcat(argptr, " video=au1200fb:panel:bs");
134 #endif
135 #endif
137 /* The Pb1200 development board uses external MUX for PSC0 to
138 support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
140 #ifdef CONFIG_I2C_AU1550
141 bcsr->resets &= (~BCSR_RESETS_PCS0MUX);
142 #endif
143 au_sync();
145 #ifdef CONFIG_MIPS_PB1200
146 printk("AMD Alchemy Pb1200 Board\n");
147 #endif
148 #ifdef CONFIG_MIPS_DB1200
149 printk("AMD Alchemy Db1200 Board\n");
150 #endif
152 /* Setup Pb1200 External Interrupt Controller */
153 board_init_irq = _board_init_irq;
157 board_au1200fb_panel(void)
159 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
160 int p;
162 p = bcsr->switches;
163 p >>= 8;
164 p &= 0x0F;
165 return p;
169 board_au1200fb_panel_init(void)
171 /* Apply power */
172 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
173 bcsr->board |= (BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL);
174 /*printk("board_au1200fb_panel_init()\n"); */
175 return 0;
179 board_au1200fb_panel_shutdown(void)
181 /* Remove power */
182 BCSR *bcsr = (BCSR *)BCSR_KSEG1_ADDR;
183 bcsr->board &= ~(BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD | BCSR_BOARD_LCDBL);
184 /*printk("board_au1200fb_panel_shutdown()\n"); */
185 return 0;