David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* ASB2305 Initialisation |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/param.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/pci.h> |
| 15 | #include <asm/io.h> |
Geert Uytterhoeven | 325c117 | 2012-07-11 14:01:56 -0700 | [diff] [blame] | 16 | #include <asm/irq.h> |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 17 | #include <asm/setup.h> |
| 18 | #include <asm/processor.h> |
Al Viro | 07c706a | 2010-01-08 14:43:17 -0800 | [diff] [blame] | 19 | #include <asm/intctl-regs.h> |
| 20 | #include <asm/serial-regs.h> |
David Howells | 2f2a213 | 2009-04-10 14:33:48 +0100 | [diff] [blame] | 21 | #include <unit/serial.h> |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * initialise some of the unit hardware before gdbstub is set up |
| 25 | */ |
| 26 | asmlinkage void __init unit_init(void) |
| 27 | { |
| 28 | #ifndef CONFIG_GDBSTUB_ON_TTYSx |
| 29 | /* set the 16550 interrupt line to level 3 if not being used for GDB */ |
Akira Takeuchi | 368dd5a | 2010-10-27 17:28:55 +0100 | [diff] [blame] | 30 | #ifdef CONFIG_EXT_SERIAL_IRQ_LEVEL |
| 31 | set_intr_level(XIRQ0, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 32 | #endif |
Akira Takeuchi | 368dd5a | 2010-10-27 17:28:55 +0100 | [diff] [blame] | 33 | #endif /* CONFIG_GDBSTUB_ON_TTYSx */ |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | /* |
| 37 | * initialise the rest of the unit hardware after gdbstub is ready |
| 38 | */ |
| 39 | void __init unit_setup(void) |
| 40 | { |
| 41 | #ifdef CONFIG_PCI |
| 42 | unit_pci_init(); |
| 43 | #endif |
| 44 | } |
| 45 | |
| 46 | /* |
| 47 | * initialise the external interrupts used by a unit of this type |
| 48 | */ |
| 49 | void __init unit_init_IRQ(void) |
| 50 | { |
| 51 | unsigned int extnum; |
| 52 | |
| 53 | for (extnum = 0; extnum < NR_XIRQS; extnum++) { |
| 54 | switch (GET_XIRQ_TRIGGER(extnum)) { |
| 55 | case XIRQ_TRIGGER_HILEVEL: |
| 56 | case XIRQ_TRIGGER_LOWLEVEL: |
Akira Takeuchi | 368dd5a | 2010-10-27 17:28:55 +0100 | [diff] [blame] | 57 | mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 58 | break; |
| 59 | default: |
| 60 | break; |
| 61 | } |
| 62 | } |
| 63 | } |