diff options
Diffstat (limited to 'arch/mips/au1000/pb1000/board_setup.c')
-rw-r--r-- | arch/mips/au1000/pb1000/board_setup.c | 117 |
1 files changed, 57 insertions, 60 deletions
diff --git a/arch/mips/au1000/pb1000/board_setup.c b/arch/mips/au1000/pb1000/board_setup.c index 33f15acc1b17..25df167a95b3 100644 --- a/arch/mips/au1000/pb1000/board_setup.c +++ b/arch/mips/au1000/pb1000/board_setup.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2000 MontaVista Software Inc. | 2 | * Copyright 2000, 2008 MontaVista Software Inc. |
3 | * Author: MontaVista Software, Inc. | 3 | * Author: MontaVista Software, Inc. <source@mvista.com> |
4 | * ppopov@mvista.com or source@mvista.com | ||
5 | * | 4 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 5 | * 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 | 6 | * under the terms of the GNU General Public License as published by the |
@@ -40,128 +39,126 @@ void __init board_setup(void) | |||
40 | u32 sys_freqctrl, sys_clksrc; | 39 | u32 sys_freqctrl, sys_clksrc; |
41 | u32 prid = read_c0_prid(); | 40 | u32 prid = read_c0_prid(); |
42 | 41 | ||
43 | // set AUX clock to 12MHz * 8 = 96 MHz | 42 | /* Set AUX clock to 12 MHz * 8 = 96 MHz */ |
44 | au_writel(8, SYS_AUXPLL); | 43 | au_writel(8, SYS_AUXPLL); |
45 | au_writel(0, SYS_PINSTATERD); | 44 | au_writel(0, SYS_PINSTATERD); |
46 | udelay(100); | 45 | udelay(100); |
47 | 46 | ||
48 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 47 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
49 | /* zero and disable FREQ2 */ | 48 | /* Zero and disable FREQ2 */ |
50 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | 49 | sys_freqctrl = au_readl(SYS_FREQCTRL0); |
51 | sys_freqctrl &= ~0xFFF00000; | 50 | sys_freqctrl &= ~0xFFF00000; |
52 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | 51 | au_writel(sys_freqctrl, SYS_FREQCTRL0); |
53 | 52 | ||
54 | /* zero and disable USBH/USBD clocks */ | 53 | /* Zero and disable USBH/USBD clocks */ |
55 | sys_clksrc = au_readl(SYS_CLKSRC); | 54 | sys_clksrc = au_readl(SYS_CLKSRC); |
56 | sys_clksrc &= ~0x00007FE0; | 55 | sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK | |
56 | SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK); | ||
57 | au_writel(sys_clksrc, SYS_CLKSRC); | 57 | au_writel(sys_clksrc, SYS_CLKSRC); |
58 | 58 | ||
59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); | 59 | sys_freqctrl = au_readl(SYS_FREQCTRL0); |
60 | sys_freqctrl &= ~0xFFF00000; | 60 | sys_freqctrl &= ~0xFFF00000; |
61 | 61 | ||
62 | sys_clksrc = au_readl(SYS_CLKSRC); | 62 | sys_clksrc = au_readl(SYS_CLKSRC); |
63 | sys_clksrc &= ~0x00007FE0; | 63 | sys_clksrc &= ~(SYS_CS_CUD | SYS_CS_DUD | SYS_CS_MUD_MASK | |
64 | SYS_CS_CUH | SYS_CS_DUH | SYS_CS_MUH_MASK); | ||
64 | 65 | ||
65 | switch (prid & 0x000000FF) | 66 | switch (prid & 0x000000FF) { |
66 | { | ||
67 | case 0x00: /* DA */ | 67 | case 0x00: /* DA */ |
68 | case 0x01: /* HA */ | 68 | case 0x01: /* HA */ |
69 | case 0x02: /* HB */ | 69 | case 0x02: /* HB */ |
70 | /* CPU core freq to 48MHz to slow it way down... */ | 70 | /* CPU core freq to 48 MHz to slow it way down... */ |
71 | au_writel(4, SYS_CPUPLL); | 71 | au_writel(4, SYS_CPUPLL); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Setup 48MHz FREQ2 from CPUPLL for USB Host | 74 | * Setup 48 MHz FREQ2 from CPUPLL for USB Host |
75 | */ | 75 | * FRDIV2 = 3 -> div by 8 of 384 MHz -> 48 MHz |
76 | /* FRDIV2=3 -> div by 8 of 384MHz -> 48MHz */ | 76 | */ |
77 | sys_freqctrl |= ((3<<22) | (1<<21) | (0<<20)); | 77 | sys_freqctrl |= (3 << SYS_FC_FRDIV2_BIT) | SYS_FC_FE2; |
78 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | 78 | au_writel(sys_freqctrl, SYS_FREQCTRL0); |
79 | 79 | ||
80 | /* CPU core freq to 384MHz */ | 80 | /* CPU core freq to 384 MHz */ |
81 | au_writel(0x20, SYS_CPUPLL); | 81 | au_writel(0x20, SYS_CPUPLL); |
82 | 82 | ||
83 | printk("Au1000: 48MHz OHCI workaround enabled\n"); | 83 | printk(KERN_INFO "Au1000: 48 MHz OHCI workaround enabled\n"); |
84 | break; | 84 | break; |
85 | 85 | ||
86 | default: /* HC and newer */ | 86 | default: /* HC and newer */ |
87 | // FREQ2 = aux/2 = 48 MHz | 87 | /* FREQ2 = aux / 2 = 48 MHz */ |
88 | sys_freqctrl |= ((0<<22) | (1<<21) | (1<<20)); | 88 | sys_freqctrl |= (0 << SYS_FC_FRDIV2_BIT) | |
89 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | 89 | SYS_FC_FE2 | SYS_FC_FS2; |
90 | au_writel(sys_freqctrl, SYS_FREQCTRL0); | ||
90 | break; | 91 | break; |
91 | } | 92 | } |
92 | 93 | ||
93 | /* | 94 | /* |
94 | * Route 48MHz FREQ2 into USB Host and/or Device | 95 | * Route 48 MHz FREQ2 into USB Host and/or Device |
95 | */ | 96 | */ |
96 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 97 | sys_clksrc |= SYS_CS_MUX_FQ2 << SYS_CS_MUH_BIT; |
97 | sys_clksrc |= ((4<<12) | (0<<11) | (0<<10)); | ||
98 | #endif | ||
99 | au_writel(sys_clksrc, SYS_CLKSRC); | 98 | au_writel(sys_clksrc, SYS_CLKSRC); |
100 | 99 | ||
101 | // configure pins GPIO[14:9] as GPIO | 100 | /* Configure pins GPIO[14:9] as GPIO */ |
102 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x8080); | 101 | pin_func = au_readl(SYS_PINFUNC) & ~(SYS_PF_UR3 | SYS_PF_USB); |
103 | 102 | ||
104 | // 2nd USB port is USB host | 103 | /* 2nd USB port is USB host */ |
105 | pin_func |= 0x8000; | 104 | pin_func |= SYS_PF_USB; |
106 | 105 | ||
107 | au_writel(pin_func, SYS_PINFUNC); | 106 | au_writel(pin_func, SYS_PINFUNC); |
108 | au_writel(0x2800, SYS_TRIOUTCLR); | 107 | au_writel(0x2800, SYS_TRIOUTCLR); |
109 | au_writel(0x0030, SYS_OUTPUTCLR); | 108 | au_writel(0x0030, SYS_OUTPUTCLR); |
110 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ | 109 | #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ |
111 | 110 | ||
112 | // make gpio 15 an input (for interrupt line) | 111 | /* Make GPIO 15 an input (for interrupt line) */ |
113 | pin_func = au_readl(SYS_PINFUNC) & (u32)(~0x100); | 112 | pin_func = au_readl(SYS_PINFUNC) & ~SYS_PF_IRF; |
114 | // we don't need I2S, so make it available for GPIO[31:29] | 113 | /* We don't need I2S, so make it available for GPIO[31:29] */ |
115 | pin_func |= (1<<5); | 114 | pin_func |= SYS_PF_I2S; |
116 | au_writel(pin_func, SYS_PINFUNC); | 115 | au_writel(pin_func, SYS_PINFUNC); |
117 | 116 | ||
118 | au_writel(0x8000, SYS_TRIOUTCLR); | 117 | au_writel(0x8000, SYS_TRIOUTCLR); |
119 | 118 | ||
120 | static_cfg0 = au_readl(MEM_STCFG0) & (u32)(~0xc00); | 119 | static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00; |
121 | au_writel(static_cfg0, MEM_STCFG0); | 120 | au_writel(static_cfg0, MEM_STCFG0); |
122 | 121 | ||
123 | // configure RCE2* for LCD | 122 | /* configure RCE2* for LCD */ |
124 | au_writel(0x00000004, MEM_STCFG2); | 123 | au_writel(0x00000004, MEM_STCFG2); |
125 | 124 | ||
126 | // MEM_STTIME2 | 125 | /* MEM_STTIME2 */ |
127 | au_writel(0x09000000, MEM_STTIME2); | 126 | au_writel(0x09000000, MEM_STTIME2); |
128 | 127 | ||
129 | // Set 32-bit base address decoding for RCE2* | 128 | /* Set 32-bit base address decoding for RCE2* */ |
130 | au_writel(0x10003ff0, MEM_STADDR2); | 129 | au_writel(0x10003ff0, MEM_STADDR2); |
131 | 130 | ||
132 | // PCI CPLD setup | 131 | /* |
133 | // expand CE0 to cover PCI | 132 | * PCI CPLD setup |
133 | * Expand CE0 to cover PCI | ||
134 | */ | ||
134 | au_writel(0x11803e40, MEM_STADDR1); | 135 | au_writel(0x11803e40, MEM_STADDR1); |
135 | 136 | ||
136 | // burst visibility on | 137 | /* Burst visibility on */ |
137 | au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); | 138 | au_writel(au_readl(MEM_STCFG0) | 0x1000, MEM_STCFG0); |
138 | 139 | ||
139 | au_writel(0x83, MEM_STCFG1); // ewait enabled, flash timing | 140 | au_writel(0x83, MEM_STCFG1); /* ewait enabled, flash timing */ |
140 | au_writel(0x33030a10, MEM_STTIME1); // slower timing for FPGA | 141 | au_writel(0x33030a10, MEM_STTIME1); /* slower timing for FPGA */ |
141 | 142 | ||
142 | /* setup the static bus controller */ | 143 | /* Setup the static bus controller */ |
143 | au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ | 144 | au_writel(0x00000002, MEM_STCFG3); /* type = PCMCIA */ |
144 | au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ | 145 | au_writel(0x280E3D07, MEM_STTIME3); /* 250ns cycle time */ |
145 | au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ | 146 | au_writel(0x10000000, MEM_STADDR3); /* any PCMCIA select */ |
146 | 147 | ||
147 | #ifdef CONFIG_PCI | 148 | /* |
148 | au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0 | 149 | * Enable Au1000 BCLK switching - note: sed1356 must not use |
149 | au_writel(0, SDRAM_MBAR); // set mbar to 0 | 150 | * its BCLK (Au1000 LCLK) for any timings |
150 | au_writel(0x2, SDRAM_CMD); // enable memory accesses | 151 | */ |
151 | au_sync_delay(1); | 152 | switch (prid & 0x000000FF) { |
152 | #endif | ||
153 | |||
154 | /* Enable Au1000 BCLK switching - note: sed1356 must not use | ||
155 | * its BCLK (Au1000 LCLK) for any timings */ | ||
156 | switch (prid & 0x000000FF) | ||
157 | { | ||
158 | case 0x00: /* DA */ | 153 | case 0x00: /* DA */ |
159 | case 0x01: /* HA */ | 154 | case 0x01: /* HA */ |
160 | case 0x02: /* HB */ | 155 | case 0x02: /* HB */ |
161 | break; | 156 | break; |
162 | default: /* HC and newer */ | 157 | default: /* HC and newer */ |
163 | /* Enable sys bus clock divider when IDLE state or no bus | 158 | /* |
164 | activity. */ | 159 | * Enable sys bus clock divider when IDLE state or no bus |
160 | * activity. | ||
161 | */ | ||
165 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); | 162 | au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); |
166 | break; | 163 | break; |
167 | } | 164 | } |