1 /* ASB2364 initialisation
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <linux/kernel.h>
13 #include <linux/param.h>
14 #include <linux/init.h>
15 #include <linux/device.h>
16 #include <linux/delay.h>
19 #include <asm/setup.h>
20 #include <asm/processor.h>
22 #include <asm/intctl-regs.h>
23 #include <asm/serial-regs.h>
24 #include <unit/fpga-regs.h>
25 #include <unit/serial.h>
26 #include <unit/smsc911x.h>
28 #define TTYS0_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 2, u8)
29 #define LAN_IRQ_CFG __SYSREG(SMSC911X_BASE + 0x54, u32)
30 #define LAN_INT_EN __SYSREG(SMSC911X_BASE + 0x5c, u32)
33 * initialise some of the unit hardware before gdbstub is set up
35 asmlinkage
void __init
unit_init(void)
37 /* Make sure we aren't going to get unexpected interrupts */
46 /* Attempt to reset the FPGA attached peripherals */
47 ASB2364_FPGA_REG_RESET_LAN
= 0x0000;
49 ASB2364_FPGA_REG_RESET_UART
= 0x0000;
51 ASB2364_FPGA_REG_RESET_I2C
= 0x0000;
53 ASB2364_FPGA_REG_RESET_USB
= 0x0000;
55 ASB2364_FPGA_REG_RESET_AV
= 0x0000;
58 /* set up the external interrupts */
60 /* XIRQ[0]: NAND RXBY */
61 /* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */
63 /* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */
64 SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL
);
66 /* XIRQ[2]: Extend Slot 1-9 */
67 /* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */
69 #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) && \
70 defined(CONFIG_ETHERNET_IRQ_LEVEL) && \
71 (CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL)
72 # error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL
75 #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL)
76 set_intr_level(XIRQ1
, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL
));
77 #elif defined(CONFIG_ETHERNET_IRQ_LEVEL)
78 set_intr_level(XIRQ1
, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL
));
83 * initialise the rest of the unit hardware after gdbstub is ready
85 asmlinkage
void __init
unit_setup(void)
87 /* Release the reset on the SMSC911X so that it is ready by the time we
89 ASB2364_FPGA_REG_RESET_LAN
= 0x0001;
91 ASB2364_FPGA_REG_RESET_UART
= 0x0001;
93 ASB2364_FPGA_REG_RESET_I2C
= 0x0001;
95 ASB2364_FPGA_REG_RESET_USB
= 0x0001;
97 ASB2364_FPGA_REG_RESET_AV
= 0x0001;
100 /* Make sure the ethernet chipset isn't going to give us an interrupt
101 * storm from stuff it was doing pre-reset */
107 * initialise the external interrupts used by a unit of this type
109 void __init
unit_init_IRQ(void)
113 for (extnum
= 0 ; extnum
< NR_XIRQS
; extnum
++) {
114 switch (GET_XIRQ_TRIGGER(extnum
)) {
115 /* LEVEL triggered interrupts should be made
116 * post-ACK'able as they hold their lines until
119 case XIRQ_TRIGGER_HILEVEL
:
120 case XIRQ_TRIGGER_LOWLEVEL
:
121 mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum
));
128 #define IRQCTL __SYSREG(0xd5000090, u32)