blob: 9c5d48dd7121ef029f030c398d2a70b90b971268 [file] [log] [blame]
Pete Popove3ad1c22005-03-01 06:33:16 +00001/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Alchemy Pb1200/Db1200 board setup.
5 *
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.
10 *
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.
21 *
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.
25 */
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/mm.h>
31#include <linux/console.h>
32#include <linux/mc146818rtc.h>
33#include <linux/delay.h>
34
35#if defined(CONFIG_BLK_DEV_IDE_AU1XXX)
36#include <linux/ide.h>
37#endif
38
39#include <asm/cpu.h>
40#include <asm/bootinfo.h>
41#include <asm/irq.h>
42#include <asm/mipsregs.h>
43#include <asm/reboot.h>
44#include <asm/pgtable.h>
45#include <asm/mach-au1x00/au1000.h>
46#include <asm/mach-au1x00/au1xxx_dbdma.h>
47
48#ifdef CONFIG_MIPS_PB1200
49#include <asm/mach-pb1x00/pb1200.h>
50#endif
51
52#ifdef CONFIG_MIPS_DB1200
53#include <asm/mach-db1x00/db1200.h>
54#define PB1200_ETH_INT DB1200_ETH_INT
55#define PB1200_IDE_INT DB1200_IDE_INT
56#endif
57
58extern void _board_init_irq(void);
59extern void (*board_init_irq)(void);
60
61#ifdef CONFIG_BLK_DEV_IDE_AU1XXX
Pete Popove3ad1c22005-03-01 06:33:16 +000062extern u32 au1xxx_ide_virtbase;
63extern u64 au1xxx_ide_physbase;
64extern int au1xxx_ide_irq;
65
66u32 led_base_addr;
67/* Ddma */
68chan_tab_t *ide_read_ch, *ide_write_ch;
69u32 au1xxx_ide_ddma_enable = 0, switch4ddma = 1; // PIO+ddma
70
71dbdev_tab_t new_dbdev_tab_element = { DSCR_CMD0_THROTTLE, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 };
72#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX */
73
74void board_reset (void)
75{
76 bcsr->resets = 0;
77}
78
79void __init board_setup(void)
80{
81 char *argptr = NULL;
82 u32 pin_func;
83
84#if 0
85 /* Enable PSC1 SYNC for AC97. Normaly done in audio driver,
86 * but it is board specific code, so put it here.
87 */
88 pin_func = au_readl(SYS_PINFUNC);
89 au_sync();
90 pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1;
91 au_writel(pin_func, SYS_PINFUNC);
92
93 au_writel(0, (u32)bcsr|0x10); /* turn off pcmcia power */
94 au_sync();
95#endif
96
97#if defined( CONFIG_I2C_ALGO_AU1550 )
98 {
99 u32 freq0, clksrc;
100
101 /* Select SMBUS in CPLD */
102 bcsr->resets &= ~(BCSR_RESETS_PCS0MUX);
103
104 pin_func = au_readl(SYS_PINFUNC);
105 au_sync();
106 pin_func &= ~(3<<17 | 1<<4);
107 /* Set GPIOs correctly */
108 pin_func |= 2<<17;
109 au_writel(pin_func, SYS_PINFUNC);
110 au_sync();
111
112 /* The i2c driver depends on 50Mhz clock */
113 freq0 = au_readl(SYS_FREQCTRL0);
114 au_sync();
115 freq0 &= ~(SYS_FC_FRDIV1_MASK | SYS_FC_FS1 | SYS_FC_FE1);
116 freq0 |= (3<<SYS_FC_FRDIV1_BIT);
117 /* 396Mhz / (3+1)*2 == 49.5Mhz */
118 au_writel(freq0, SYS_FREQCTRL0);
119 au_sync();
120 freq0 |= SYS_FC_FE1;
121 au_writel(freq0, SYS_FREQCTRL0);
122 au_sync();
123
124 clksrc = au_readl(SYS_CLKSRC);
125 au_sync();
126 clksrc &= ~0x01f00000;
127 /* bit 22 is EXTCLK0 for PSC0 */
128 clksrc |= (0x3 << 22);
129 au_writel(clksrc, SYS_CLKSRC);
130 au_sync();
131 }
132#endif
133
134#ifdef CONFIG_FB_AU1200
135 argptr = prom_getcmdline();
136#ifdef CONFIG_MIPS_PB1200
137 strcat(argptr, " video=au1200fb:panel:s11");
138#endif
139#ifdef CONFIG_MIPS_DB1200
140 strcat(argptr, " video=au1200fb:panel:s7");
141#endif
142#endif
143
144#if defined(CONFIG_BLK_DEV_IDE_AU1XXX)
145 /*
146 * Iniz IDE parameters
147 */
Pete Popove3ad1c22005-03-01 06:33:16 +0000148 au1xxx_ide_irq = PB1200_IDE_INT;
149 au1xxx_ide_physbase = AU1XXX_ATA_PHYS_ADDR;
150 au1xxx_ide_virtbase = KSEG1ADDR(AU1XXX_ATA_PHYS_ADDR);
151 /*
152 * change PIO or PIO+Ddma
153 * check the GPIO-5 pin condition. pb1200:s18_dot */
154 switch4ddma = (au_readl(SYS_PINSTATERD) & (1 << 5)) ? 1 : 0;
155#endif
156
157 /* The Pb1200 development board uses external MUX for PSC0 to
158 support SMB/SPI. bcsr->resets bit 12: 0=SMB 1=SPI
159 */
160#if defined(CONFIG_AU1550_PSC_SPI) && defined(CONFIG_I2C_ALGO_AU1550)
161 #error I2C and SPI are mutually exclusive. Both are physically connected to PSC0.\
162 Refer to Pb1200/Db1200 documentation.
163#elif defined( CONFIG_AU1550_PSC_SPI )
164 bcsr->resets |= BCSR_RESETS_PCS0MUX;
165#elif defined( CONFIG_I2C_ALGO_AU1550 )
166 bcsr->resets &= (~BCSR_RESETS_PCS0MUX);
167#endif
168 au_sync();
169
170#ifdef CONFIG_MIPS_PB1200
171 printk("AMD Alchemy Pb1200 Board\n");
172#endif
173#ifdef CONFIG_MIPS_DB1200
174 printk("AMD Alchemy Db1200 Board\n");
175#endif
Pete Popovebc7f122005-03-04 08:31:06 +0000176
Pete Popove3ad1c22005-03-01 06:33:16 +0000177 /* Setup Pb1200 External Interrupt Controller */
178 {
179 extern void (*board_init_irq)(void);
180 extern void _board_init_irq(void);
181 board_init_irq = _board_init_irq;
182 }
Pete Popove3ad1c22005-03-01 06:33:16 +0000183}