Path: blob/master/arch/mn10300/unit-asb2364/unit-init.c
10817 views
/* ASB2364 initialisation1*2* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#include <linux/kernel.h>12#include <linux/param.h>13#include <linux/init.h>14#include <linux/device.h>15#include <linux/delay.h>1617#include <asm/io.h>18#include <asm/setup.h>19#include <asm/processor.h>20#include <asm/irq.h>21#include <asm/intctl-regs.h>22#include <asm/serial-regs.h>23#include <unit/fpga-regs.h>24#include <unit/serial.h>25#include <unit/smsc911x.h>2627#define TTYS0_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 2, u8)28#define LAN_IRQ_CFG __SYSREG(SMSC911X_BASE + 0x54, u32)29#define LAN_INT_EN __SYSREG(SMSC911X_BASE + 0x5c, u32)3031/*32* initialise some of the unit hardware before gdbstub is set up33*/34asmlinkage void __init unit_init(void)35{36/* Make sure we aren't going to get unexpected interrupts */37TTYS0_SERIAL_IER = 0;38SC0RXICR = 0;39SC0TXICR = 0;40SC1RXICR = 0;41SC1TXICR = 0;42SC2RXICR = 0;43SC2TXICR = 0;4445/* Attempt to reset the FPGA attached peripherals */46ASB2364_FPGA_REG_RESET_LAN = 0x0000;47SyncExBus();48ASB2364_FPGA_REG_RESET_UART = 0x0000;49SyncExBus();50ASB2364_FPGA_REG_RESET_I2C = 0x0000;51SyncExBus();52ASB2364_FPGA_REG_RESET_USB = 0x0000;53SyncExBus();54ASB2364_FPGA_REG_RESET_AV = 0x0000;55SyncExBus();5657/* set up the external interrupts */5859/* XIRQ[0]: NAND RXBY */60/* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */6162/* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */63SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL);6465/* XIRQ[2]: Extend Slot 1-9 */66/* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */6768#if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) && \69defined(CONFIG_ETHERNET_IRQ_LEVEL) && \70(CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL)71# error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL72#endif7374#if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL)75set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL));76#elif defined(CONFIG_ETHERNET_IRQ_LEVEL)77set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL));78#endif79}8081/*82* initialise the rest of the unit hardware after gdbstub is ready83*/84asmlinkage void __init unit_setup(void)85{86/* Release the reset on the SMSC911X so that it is ready by the time we87* need it */88ASB2364_FPGA_REG_RESET_LAN = 0x0001;89SyncExBus();90ASB2364_FPGA_REG_RESET_UART = 0x0001;91SyncExBus();92ASB2364_FPGA_REG_RESET_I2C = 0x0001;93SyncExBus();94ASB2364_FPGA_REG_RESET_USB = 0x0001;95SyncExBus();96ASB2364_FPGA_REG_RESET_AV = 0x0001;97SyncExBus();9899/* Make sure the ethernet chipset isn't going to give us an interrupt100* storm from stuff it was doing pre-reset */101LAN_IRQ_CFG = 0;102LAN_INT_EN = 0;103}104105/*106* initialise the external interrupts used by a unit of this type107*/108void __init unit_init_IRQ(void)109{110unsigned int extnum;111112for (extnum = 0 ; extnum < NR_XIRQS ; extnum++) {113switch (GET_XIRQ_TRIGGER(extnum)) {114/* LEVEL triggered interrupts should be made115* post-ACK'able as they hold their lines until116* serviced117*/118case XIRQ_TRIGGER_HILEVEL:119case XIRQ_TRIGGER_LOWLEVEL:120mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum));121break;122default:123break;124}125}126127#define IRQCTL __SYSREG(0xd5000090, u32)128IRQCTL |= 0x02;129130irq_fpga_init();131}132133134