diff options
Diffstat (limited to 'arch/mips/txx9/rbtx4938/setup.c')
-rw-r--r-- | arch/mips/txx9/rbtx4938/setup.c | 124 |
1 files changed, 17 insertions, 107 deletions
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c index 6c2b99bb8af6..9ab48dec0fe8 100644 --- a/arch/mips/txx9/rbtx4938/setup.c +++ b/arch/mips/txx9/rbtx4938/setup.c | |||
@@ -13,9 +13,6 @@ | |||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/ioport.h> | 14 | #include <linux/ioport.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/console.h> | ||
18 | #include <linux/pm.h> | ||
19 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
20 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
21 | 18 | ||
@@ -28,33 +25,14 @@ | |||
28 | #include <asm/txx9/spi.h> | 25 | #include <asm/txx9/spi.h> |
29 | #include <asm/txx9pio.h> | 26 | #include <asm/txx9pio.h> |
30 | 27 | ||
31 | static void rbtx4938_machine_halt(void) | ||
32 | { | ||
33 | printk(KERN_NOTICE "System Halted\n"); | ||
34 | local_irq_disable(); | ||
35 | |||
36 | while (1) | ||
37 | __asm__(".set\tmips3\n\t" | ||
38 | "wait\n\t" | ||
39 | ".set\tmips0"); | ||
40 | } | ||
41 | |||
42 | static void rbtx4938_machine_power_off(void) | ||
43 | { | ||
44 | rbtx4938_machine_halt(); | ||
45 | /* no return */ | ||
46 | } | ||
47 | |||
48 | static void rbtx4938_machine_restart(char *command) | 28 | static void rbtx4938_machine_restart(char *command) |
49 | { | 29 | { |
50 | local_irq_disable(); | 30 | local_irq_disable(); |
51 | |||
52 | printk("Rebooting..."); | ||
53 | writeb(1, rbtx4938_softresetlock_addr); | 31 | writeb(1, rbtx4938_softresetlock_addr); |
54 | writeb(1, rbtx4938_sfvol_addr); | 32 | writeb(1, rbtx4938_sfvol_addr); |
55 | writeb(1, rbtx4938_softreset_addr); | 33 | writeb(1, rbtx4938_softreset_addr); |
56 | while(1) | 34 | /* fallback */ |
57 | ; | 35 | (*_machine_halt)(); |
58 | } | 36 | } |
59 | 37 | ||
60 | static void __init rbtx4938_pci_setup(void) | 38 | static void __init rbtx4938_pci_setup(void) |
@@ -121,6 +99,7 @@ static void __init rbtx4938_pci_setup(void) | |||
121 | register_pci_controller(c); | 99 | register_pci_controller(c); |
122 | tx4927_pcic_setup(tx4938_pcic1ptr, c, 0); | 100 | tx4927_pcic_setup(tx4938_pcic1ptr, c, 0); |
123 | } | 101 | } |
102 | tx4938_setup_pcierr_irq(); | ||
124 | #endif /* CONFIG_PCI */ | 103 | #endif /* CONFIG_PCI */ |
125 | } | 104 | } |
126 | 105 | ||
@@ -151,19 +130,7 @@ static int __init rbtx4938_ethaddr_init(void) | |||
151 | if (sum) | 130 | if (sum) |
152 | printk(KERN_WARNING "seeprom: bad checksum.\n"); | 131 | printk(KERN_WARNING "seeprom: bad checksum.\n"); |
153 | } | 132 | } |
154 | for (i = 0; i < 2; i++) { | 133 | tx4938_ethaddr_init(&dat[4], &dat[4 + 6]); |
155 | unsigned int id = | ||
156 | TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0); | ||
157 | struct platform_device *pdev; | ||
158 | if (!(__raw_readq(&tx4938_ccfgptr->pcfg) & | ||
159 | (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL))) | ||
160 | continue; | ||
161 | pdev = platform_device_alloc("tc35815-mac", id); | ||
162 | if (!pdev || | ||
163 | platform_device_add_data(pdev, &dat[4 + 6 * i], 6) || | ||
164 | platform_device_add(pdev)) | ||
165 | platform_device_put(pdev); | ||
166 | } | ||
167 | #endif /* CONFIG_PCI */ | 134 | #endif /* CONFIG_PCI */ |
168 | return 0; | 135 | return 0; |
169 | } | 136 | } |
@@ -193,51 +160,36 @@ static void __init rbtx4938_mem_setup(void) | |||
193 | 160 | ||
194 | #ifdef CONFIG_PCI | 161 | #ifdef CONFIG_PCI |
195 | txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0); | 162 | txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0); |
163 | txx9_board_pcibios_setup = tx4927_pcibios_setup; | ||
196 | #else | 164 | #else |
197 | set_io_port_base(RBTX4938_ETHER_BASE); | 165 | set_io_port_base(RBTX4938_ETHER_BASE); |
198 | #endif | 166 | #endif |
199 | 167 | ||
200 | tx4938_setup_serial(); | 168 | tx4938_sio_init(7372800, 0); |
201 | #ifdef CONFIG_SERIAL_TXX9_CONSOLE | 169 | #ifdef CONFIG_SERIAL_TXX9_CONSOLE |
202 | argptr = prom_getcmdline(); | 170 | argptr = prom_getcmdline(); |
203 | if (strstr(argptr, "console=") == NULL) { | 171 | if (!strstr(argptr, "console=")) |
204 | strcat(argptr, " console=ttyS0,38400"); | 172 | strcat(argptr, " console=ttyS0,38400"); |
205 | } | ||
206 | #endif | 173 | #endif |
207 | 174 | ||
208 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61 | 175 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61 |
209 | printk("PIOSEL: disabling both ata and nand selection\n"); | 176 | printk(KERN_INFO "PIOSEL: disabling both ata and nand selection\n"); |
210 | local_irq_disable(); | ||
211 | txx9_clear64(&tx4938_ccfgptr->pcfg, | 177 | txx9_clear64(&tx4938_ccfgptr->pcfg, |
212 | TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL); | 178 | TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL); |
213 | #endif | 179 | #endif |
214 | 180 | ||
215 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND | 181 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND |
216 | printk("PIOSEL: enabling nand selection\n"); | 182 | printk(KERN_INFO "PIOSEL: enabling nand selection\n"); |
217 | txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); | 183 | txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); |
218 | txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); | 184 | txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); |
219 | #endif | 185 | #endif |
220 | 186 | ||
221 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA | 187 | #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA |
222 | printk("PIOSEL: enabling ata selection\n"); | 188 | printk(KERN_INFO "PIOSEL: enabling ata selection\n"); |
223 | txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); | 189 | txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); |
224 | txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); | 190 | txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); |
225 | #endif | 191 | #endif |
226 | 192 | ||
227 | #ifdef CONFIG_IP_PNP | ||
228 | argptr = prom_getcmdline(); | ||
229 | if (strstr(argptr, "ip=") == NULL) { | ||
230 | strcat(argptr, " ip=any"); | ||
231 | } | ||
232 | #endif | ||
233 | |||
234 | |||
235 | #ifdef CONFIG_FB | ||
236 | { | ||
237 | conswitchp = &dummy_con; | ||
238 | } | ||
239 | #endif | ||
240 | |||
241 | rbtx4938_spi_setup(); | 193 | rbtx4938_spi_setup(); |
242 | pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */ | 194 | pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */ |
243 | /* fixup piosel */ | 195 | /* fixup piosel */ |
@@ -258,11 +210,9 @@ static void __init rbtx4938_mem_setup(void) | |||
258 | rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff; | 210 | rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff; |
259 | rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 211 | rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
260 | if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource)) | 212 | if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource)) |
261 | printk("request resource for fpga failed\n"); | 213 | printk(KERN_ERR "request resource for fpga failed\n"); |
262 | 214 | ||
263 | _machine_restart = rbtx4938_machine_restart; | 215 | _machine_restart = rbtx4938_machine_restart; |
264 | _machine_halt = rbtx4938_machine_halt; | ||
265 | pm_power_off = rbtx4938_machine_power_off; | ||
266 | 216 | ||
267 | writeb(0xff, rbtx4938_led_addr); | 217 | writeb(0xff, rbtx4938_led_addr); |
268 | printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", | 218 | printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", |
@@ -270,7 +220,7 @@ static void __init rbtx4938_mem_setup(void) | |||
270 | readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr)); | 220 | readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr)); |
271 | } | 221 | } |
272 | 222 | ||
273 | static int __init rbtx4938_ne_init(void) | 223 | static void __init rbtx4938_ne_init(void) |
274 | { | 224 | { |
275 | struct resource res[] = { | 225 | struct resource res[] = { |
276 | { | 226 | { |
@@ -282,10 +232,7 @@ static int __init rbtx4938_ne_init(void) | |||
282 | .flags = IORESOURCE_IRQ, | 232 | .flags = IORESOURCE_IRQ, |
283 | } | 233 | } |
284 | }; | 234 | }; |
285 | struct platform_device *dev = | 235 | platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res)); |
286 | platform_device_register_simple("ne", -1, | ||
287 | res, ARRAY_SIZE(res)); | ||
288 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
289 | } | 236 | } |
290 | 237 | ||
291 | static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock); | 238 | static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock); |
@@ -321,24 +268,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = { | |||
321 | .ngpio = 3, | 268 | .ngpio = 3, |
322 | }; | 269 | }; |
323 | 270 | ||
324 | /* SPI support */ | ||
325 | |||
326 | static void __init txx9_spi_init(unsigned long base, int irq) | ||
327 | { | ||
328 | struct resource res[] = { | ||
329 | { | ||
330 | .start = base, | ||
331 | .end = base + 0x20 - 1, | ||
332 | .flags = IORESOURCE_MEM, | ||
333 | }, { | ||
334 | .start = irq, | ||
335 | .flags = IORESOURCE_IRQ, | ||
336 | }, | ||
337 | }; | ||
338 | platform_device_register_simple("spi_txx9", 0, | ||
339 | res, ARRAY_SIZE(res)); | ||
340 | } | ||
341 | |||
342 | static int __init rbtx4938_spi_init(void) | 271 | static int __init rbtx4938_spi_init(void) |
343 | { | 272 | { |
344 | struct spi_board_info srtc_info = { | 273 | struct spi_board_info srtc_info = { |
@@ -361,7 +290,7 @@ static int __init rbtx4938_spi_init(void) | |||
361 | gpio_direction_output(16 + SEEPROM2_CS, 1); | 290 | gpio_direction_output(16 + SEEPROM2_CS, 1); |
362 | gpio_request(16 + SEEPROM3_CS, "seeprom3"); | 291 | gpio_request(16 + SEEPROM3_CS, "seeprom3"); |
363 | gpio_direction_output(16 + SEEPROM3_CS, 1); | 292 | gpio_direction_output(16 + SEEPROM3_CS, 1); |
364 | txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI); | 293 | tx4938_spi_init(0); |
365 | return 0; | 294 | return 0; |
366 | } | 295 | } |
367 | 296 | ||
@@ -372,30 +301,11 @@ static void __init rbtx4938_arch_init(void) | |||
372 | rbtx4938_spi_init(); | 301 | rbtx4938_spi_init(); |
373 | } | 302 | } |
374 | 303 | ||
375 | /* Watchdog support */ | ||
376 | |||
377 | static int __init txx9_wdt_init(unsigned long base) | ||
378 | { | ||
379 | struct resource res = { | ||
380 | .start = base, | ||
381 | .end = base + 0x100 - 1, | ||
382 | .flags = IORESOURCE_MEM, | ||
383 | }; | ||
384 | struct platform_device *dev = | ||
385 | platform_device_register_simple("txx9wdt", -1, &res, 1); | ||
386 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
387 | } | ||
388 | |||
389 | static int __init rbtx4938_wdt_init(void) | ||
390 | { | ||
391 | return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL); | ||
392 | } | ||
393 | |||
394 | static void __init rbtx4938_device_init(void) | 304 | static void __init rbtx4938_device_init(void) |
395 | { | 305 | { |
396 | rbtx4938_ethaddr_init(); | 306 | rbtx4938_ethaddr_init(); |
397 | rbtx4938_ne_init(); | 307 | rbtx4938_ne_init(); |
398 | rbtx4938_wdt_init(); | 308 | tx4938_wdt_init(); |
399 | } | 309 | } |
400 | 310 | ||
401 | struct txx9_board_vec rbtx4938_vec __initdata = { | 311 | struct txx9_board_vec rbtx4938_vec __initdata = { |