diff options
Diffstat (limited to 'arch/mn10300/unit-asb2364')
-rw-r--r-- | arch/mn10300/unit-asb2364/Makefile | 10 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/include/unit/clock.h | 29 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/include/unit/fpga-regs.h | 50 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/include/unit/leds.h | 54 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/include/unit/serial.h | 151 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/include/unit/timex.h | 125 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/leds.c | 98 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2364/unit-init.c | 85 |
8 files changed, 602 insertions, 0 deletions
diff --git a/arch/mn10300/unit-asb2364/Makefile b/arch/mn10300/unit-asb2364/Makefile new file mode 100644 index 000000000000..6dd27d65877a --- /dev/null +++ b/arch/mn10300/unit-asb2364/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | # Note! Dependencies are done automagically by 'make dep', which also | ||
5 | # removes any old dependencies. DON'T put your own dependencies here | ||
6 | # unless it's something special (ie not a .c file). | ||
7 | # | ||
8 | # Note 2! The CFLAGS definitions are now in the main makefile... | ||
9 | |||
10 | obj-y := unit-init.o leds.o | ||
diff --git a/arch/mn10300/unit-asb2364/include/unit/clock.h b/arch/mn10300/unit-asb2364/include/unit/clock.h new file mode 100644 index 000000000000..d34ac9a7508b --- /dev/null +++ b/arch/mn10300/unit-asb2364/include/unit/clock.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* clock.h: unit-specific clocks | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * Modified by Matsushita Electric Industrial Co., Ltd. | ||
7 | * Modifications: | ||
8 | * 23-Feb-2007 MEI Add define for watchdog timer. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef _ASM_UNIT_CLOCK_H | ||
17 | #define _ASM_UNIT_CLOCK_H | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | |||
21 | #define MN10300_IOCLK 100000000UL /* for DDR800 */ | ||
22 | /*#define MN10300_IOCLK 83333333UL */ /* for DDR667 */ | ||
23 | #define MN10300_IOBCLK MN10300_IOCLK /* IOBCLK is equal to IOCLK */ | ||
24 | |||
25 | #endif /* !__ASSEMBLY__ */ | ||
26 | |||
27 | #define MN10300_WDCLK 27000000UL | ||
28 | |||
29 | #endif /* _ASM_UNIT_CLOCK_H */ | ||
diff --git a/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h b/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h new file mode 100644 index 000000000000..a039a50c91db --- /dev/null +++ b/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* ASB2364 FPGA registers | ||
2 | */ | ||
3 | |||
4 | #ifndef _ASM_UNIT_FPGA_REGS_H | ||
5 | #define _ASM_UNIT_FPGA_REGS_H | ||
6 | |||
7 | #include <asm/cpu-regs.h> | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | |||
11 | #define ASB2364_FPGA_REG_RESET_LAN __SYSREG(0xa9001300, u16) | ||
12 | #define ASB2364_FPGA_REG_RESET_UART __SYSREG(0xa9001304, u16) | ||
13 | #define ASB2364_FPGA_REG_RESET_I2C __SYSREG(0xa9001308, u16) | ||
14 | #define ASB2364_FPGA_REG_RESET_USB __SYSREG(0xa900130c, u16) | ||
15 | #define ASB2364_FPGA_REG_RESET_AV __SYSREG(0xa9001310, u16) | ||
16 | |||
17 | #define ASB2364_FPGA_REG_IRQ_LAN __SYSREG(0xa9001510, u16) | ||
18 | #define ASB2364_FPGA_REG_IRQ_UART __SYSREG(0xa9001514, u16) | ||
19 | #define ASB2364_FPGA_REG_IRQ_I2C __SYSREG(0xa9001518, u16) | ||
20 | #define ASB2364_FPGA_REG_IRQ_USB __SYSREG(0xa900151c, u16) | ||
21 | #define ASB2364_FPGA_REG_IRQ_FPGA __SYSREG(0xa9001524, u16) | ||
22 | |||
23 | #define ASB2364_FPGA_REG_MASK_LAN __SYSREG(0xa9001590, u16) | ||
24 | #define ASB2364_FPGA_REG_MASK_UART __SYSREG(0xa9001594, u16) | ||
25 | #define ASB2364_FPGA_REG_MASK_I2C __SYSREG(0xa9001598, u16) | ||
26 | #define ASB2364_FPGA_REG_MASK_USB __SYSREG(0xa900159c, u16) | ||
27 | #define ASB2364_FPGA_REG_MASK_FPGA __SYSREG(0xa90015a4, u16) | ||
28 | |||
29 | #define ASB2364_FPGA_REG_CPLD5_SET1 __SYSREG(0xa9002500, u16) | ||
30 | #define ASB2364_FPGA_REG_CPLD5_SET2 __SYSREG(0xa9002504, u16) | ||
31 | #define ASB2364_FPGA_REG_CPLD6_SET1 __SYSREG(0xa9002600, u16) | ||
32 | #define ASB2364_FPGA_REG_CPLD6_SET2 __SYSREG(0xa9002604, u16) | ||
33 | #define ASB2364_FPGA_REG_CPLD7_SET1 __SYSREG(0xa9002700, u16) | ||
34 | #define ASB2364_FPGA_REG_CPLD7_SET2 __SYSREG(0xa9002704, u16) | ||
35 | #define ASB2364_FPGA_REG_CPLD8_SET1 __SYSREG(0xa9002800, u16) | ||
36 | #define ASB2364_FPGA_REG_CPLD8_SET2 __SYSREG(0xa9002804, u16) | ||
37 | #define ASB2364_FPGA_REG_CPLD9_SET1 __SYSREG(0xa9002900, u16) | ||
38 | #define ASB2364_FPGA_REG_CPLD9_SET2 __SYSREG(0xa9002904, u16) | ||
39 | #define ASB2364_FPGA_REG_CPLD10_SET1 __SYSREG(0xa9002a00, u16) | ||
40 | #define ASB2364_FPGA_REG_CPLD10_SET2 __SYSREG(0xa9002a04, u16) | ||
41 | |||
42 | #define SyncExBus() \ | ||
43 | do { \ | ||
44 | unsigned short w; \ | ||
45 | w = *(volatile short *)0xa9000000; \ | ||
46 | } while (0) | ||
47 | |||
48 | #endif /* __KERNEL__ */ | ||
49 | |||
50 | #endif /* _ASM_UNIT_FPGA_REGS_H */ | ||
diff --git a/arch/mn10300/unit-asb2364/include/unit/leds.h b/arch/mn10300/unit-asb2364/include/unit/leds.h new file mode 100644 index 000000000000..03a3933ad323 --- /dev/null +++ b/arch/mn10300/unit-asb2364/include/unit/leds.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* Unit-specific leds | ||
2 | * | ||
3 | * Copyright (C) 2005 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 License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_UNIT_LEDS_H | ||
13 | #define _ASM_UNIT_LEDS_H | ||
14 | |||
15 | #include <asm/pio-regs.h> | ||
16 | #include <asm/cpu-regs.h> | ||
17 | #include <asm/exceptions.h> | ||
18 | |||
19 | #define MN10300_USE_7SEGLEDS 0 | ||
20 | |||
21 | #define ASB2364_7SEGLEDS __SYSREG(0xA9001630, u32) | ||
22 | |||
23 | /* | ||
24 | * use the 7-segment LEDs to indicate states | ||
25 | */ | ||
26 | |||
27 | #if MN10300_USE_7SEGLEDS | ||
28 | /* flip the 7-segment LEDs between "Gdb-" and "----" */ | ||
29 | #define mn10300_set_gdbleds(ONOFF) \ | ||
30 | do { \ | ||
31 | ASB2364_7SEGLEDS = (ONOFF) ? 0x8543077f : 0x7f7f7f7f; \ | ||
32 | } while (0) | ||
33 | #else | ||
34 | #define mn10300_set_gdbleds(ONOFF) do {} while (0) | ||
35 | #endif | ||
36 | |||
37 | #if MN10300_USE_7SEGLEDS | ||
38 | /* indicate double-fault by displaying "db-f" on the LEDs */ | ||
39 | #define mn10300_set_dbfleds \ | ||
40 | mov 0x43077f1d,d0 ; \ | ||
41 | mov d0,(ASB2364_7SEGLEDS) | ||
42 | #else | ||
43 | #define mn10300_set_dbfleds | ||
44 | #endif | ||
45 | |||
46 | #ifndef __ASSEMBLY__ | ||
47 | extern void peripheral_leds_display_exception(enum exception_code); | ||
48 | extern void peripheral_leds_led_chase(void); | ||
49 | extern void peripheral_leds7x4_display_dec(unsigned int, unsigned int); | ||
50 | extern void peripheral_leds7x4_display_hex(unsigned int, unsigned int); | ||
51 | extern void debug_to_serial(const char *, int); | ||
52 | #endif /* __ASSEMBLY__ */ | ||
53 | |||
54 | #endif /* _ASM_UNIT_LEDS_H */ | ||
diff --git a/arch/mn10300/unit-asb2364/include/unit/serial.h b/arch/mn10300/unit-asb2364/include/unit/serial.h new file mode 100644 index 000000000000..7f048bbfdfd7 --- /dev/null +++ b/arch/mn10300/unit-asb2364/include/unit/serial.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* Unit-specific 8250 serial ports | ||
2 | * | ||
3 | * Copyright (C) 2005 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 License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_UNIT_SERIAL_H | ||
13 | #define _ASM_UNIT_SERIAL_H | ||
14 | |||
15 | #include <asm/cpu-regs.h> | ||
16 | #include <proc/irq.h> | ||
17 | #include <unit/fpga-regs.h> | ||
18 | #include <linux/serial_reg.h> | ||
19 | |||
20 | #define SERIAL_PORT0_BASE_ADDRESS 0xA8200000 | ||
21 | |||
22 | #define SERIAL_IRQ XIRQ1 /* single serial (TL16C550C) (Lo) */ | ||
23 | |||
24 | /* | ||
25 | * The ASB2364 has an 12.288 MHz clock | ||
26 | * for your UART. | ||
27 | * | ||
28 | * It'd be nice if someone built a serial card with a 24.576 MHz | ||
29 | * clock, since the 16550A is capable of handling a top speed of 1.5 | ||
30 | * megabits/second; but this requires the faster clock. | ||
31 | */ | ||
32 | #define BASE_BAUD (12288000 / 16) | ||
33 | |||
34 | /* | ||
35 | * dispose of the /dev/ttyS0 and /dev/ttyS1 serial ports | ||
36 | */ | ||
37 | #ifndef CONFIG_GDBSTUB_ON_TTYSx | ||
38 | |||
39 | #define SERIAL_PORT_DFNS \ | ||
40 | { \ | ||
41 | .baud_base = BASE_BAUD, \ | ||
42 | .irq = SERIAL_IRQ, \ | ||
43 | .flags = STD_COM_FLAGS, \ | ||
44 | .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \ | ||
45 | .iomem_reg_shift = 1, \ | ||
46 | .io_type = SERIAL_IO_MEM, \ | ||
47 | }, | ||
48 | |||
49 | #ifndef __ASSEMBLY__ | ||
50 | |||
51 | static inline void __debug_to_serial(const char *p, int n) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | #endif /* !__ASSEMBLY__ */ | ||
56 | |||
57 | #else /* CONFIG_GDBSTUB_ON_TTYSx */ | ||
58 | |||
59 | #define SERIAL_PORT_DFNS /* stolen by gdb-stub */ | ||
60 | |||
61 | #if defined(CONFIG_GDBSTUB_ON_TTYS0) | ||
62 | #define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8) | ||
63 | #define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8) | ||
64 | #define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8) | ||
65 | #define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8) | ||
66 | #define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8) | ||
67 | #define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8) | ||
68 | #define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8) | ||
69 | #define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8) | ||
70 | #define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8) | ||
71 | #define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8) | ||
72 | #define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8) | ||
73 | #define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8) | ||
74 | #define GDBPORT_SERIAL_IRQ SERIAL_IRQ | ||
75 | |||
76 | #elif defined(CONFIG_GDBSTUB_ON_TTYS1) | ||
77 | #error The ASB2364 does not have a /dev/ttyS1 | ||
78 | #endif | ||
79 | |||
80 | #ifndef __ASSEMBLY__ | ||
81 | |||
82 | static inline void __debug_to_serial(const char *p, int n) | ||
83 | { | ||
84 | char ch; | ||
85 | |||
86 | #define LSR_WAIT_FOR(STATE) \ | ||
87 | do {} while (!(GDBPORT_SERIAL_LSR & UART_LSR_##STATE)) | ||
88 | #define FLOWCTL_QUERY(LINE) \ | ||
89 | ({ GDBPORT_SERIAL_MSR & UART_MSR_##LINE; }) | ||
90 | #define FLOWCTL_WAIT_FOR(LINE) \ | ||
91 | do {} while (!(GDBPORT_SERIAL_MSR & UART_MSR_##LINE)) | ||
92 | #define FLOWCTL_CLEAR(LINE) \ | ||
93 | do { GDBPORT_SERIAL_MCR &= ~UART_MCR_##LINE; } while (0) | ||
94 | #define FLOWCTL_SET(LINE) \ | ||
95 | do { GDBPORT_SERIAL_MCR |= UART_MCR_##LINE; } while (0) | ||
96 | |||
97 | FLOWCTL_SET(DTR); | ||
98 | |||
99 | for (; n > 0; n--) { | ||
100 | LSR_WAIT_FOR(THRE); | ||
101 | FLOWCTL_WAIT_FOR(CTS); | ||
102 | |||
103 | ch = *p++; | ||
104 | if (ch == 0x0a) { | ||
105 | GDBPORT_SERIAL_TX = 0x0d; | ||
106 | LSR_WAIT_FOR(THRE); | ||
107 | FLOWCTL_WAIT_FOR(CTS); | ||
108 | } | ||
109 | GDBPORT_SERIAL_TX = ch; | ||
110 | } | ||
111 | |||
112 | FLOWCTL_CLEAR(DTR); | ||
113 | } | ||
114 | |||
115 | #endif /* !__ASSEMBLY__ */ | ||
116 | |||
117 | #endif /* CONFIG_GDBSTUB_ON_TTYSx */ | ||
118 | |||
119 | #define SERIAL_INITIALIZE \ | ||
120 | do { \ | ||
121 | /* release reset */ \ | ||
122 | ASB2364_FPGA_REG_RESET_UART = 0x0001; \ | ||
123 | SyncExBus(); \ | ||
124 | } while (0) | ||
125 | |||
126 | #define SERIAL_CHECK_INTERRUPT \ | ||
127 | do { \ | ||
128 | if ((ASB2364_FPGA_REG_IRQ_UART & 0x0001) == 0x0001) { \ | ||
129 | return IRQ_NONE; \ | ||
130 | } \ | ||
131 | } while (0) | ||
132 | |||
133 | #define SERIAL_CLEAR_INTERRUPT \ | ||
134 | do { \ | ||
135 | ASB2364_FPGA_REG_IRQ_UART = 0x0001; \ | ||
136 | SyncExBus(); \ | ||
137 | } while (0) | ||
138 | |||
139 | #define SERIAL_SET_INT_MASK \ | ||
140 | do { \ | ||
141 | ASB2364_FPGA_REG_MASK_UART = 0x0001; \ | ||
142 | SyncExBus(); \ | ||
143 | } while (0) | ||
144 | |||
145 | #define SERIAL_CLEAR_INT_MASK \ | ||
146 | do { \ | ||
147 | ASB2364_FPGA_REG_MASK_UART = 0x0000; \ | ||
148 | SyncExBus(); \ | ||
149 | } while (0) | ||
150 | |||
151 | #endif /* _ASM_UNIT_SERIAL_H */ | ||
diff --git a/arch/mn10300/unit-asb2364/include/unit/timex.h b/arch/mn10300/unit-asb2364/include/unit/timex.h new file mode 100644 index 000000000000..b5223f705ef8 --- /dev/null +++ b/arch/mn10300/unit-asb2364/include/unit/timex.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* timex.h: MN2WS0038 architecture timer specifications | ||
2 | * | ||
3 | * Copyright (C) 2002 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 License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef _ASM_UNIT_TIMEX_H | ||
12 | #define _ASM_UNIT_TIMEX_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <linux/irq.h> | ||
16 | #endif /* __ASSEMBLY__ */ | ||
17 | |||
18 | #include <asm/timer-regs.h> | ||
19 | #include <unit/clock.h> | ||
20 | #include <asm/param.h> | ||
21 | |||
22 | /* | ||
23 | * jiffies counter specifications | ||
24 | */ | ||
25 | |||
26 | #define TMJCBR_MAX 0xffffff /* 24bit */ | ||
27 | #define TMJCBC TMTBC | ||
28 | |||
29 | #define TMJCMD TMTMD | ||
30 | #define TMJCBR TMTBR | ||
31 | #define TMJCIRQ TMTIRQ | ||
32 | #define TMJCICR TMTICR | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | #define MN10300_SRC_IOBCLK MN10300_IOBCLK | ||
37 | |||
38 | #ifndef HZ | ||
39 | # error HZ undeclared. | ||
40 | #endif /* !HZ */ | ||
41 | |||
42 | #define MN10300_JCCLK (MN10300_SRC_IOBCLK) | ||
43 | #define MN10300_TSCCLK (MN10300_SRC_IOBCLK) | ||
44 | |||
45 | #define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) | ||
46 | #define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) | ||
47 | |||
48 | /* Check bit width of MTM interval value that sets base register */ | ||
49 | #if (MN10300_JC_PER_HZ - 1) > TMJCBR_MAX | ||
50 | # error MTM tick timer interval value is overflow. | ||
51 | #endif | ||
52 | |||
53 | |||
54 | static inline void startup_jiffies_counter(void) | ||
55 | { | ||
56 | u32 sync; | ||
57 | |||
58 | TMJCBR = MN10300_JC_PER_HZ - 1; | ||
59 | sync = TMJCBR; | ||
60 | |||
61 | TMJCMD = TMTMD_TMTLDE; | ||
62 | TMJCMD = TMTMD_TMTCNE; | ||
63 | sync = TMJCMD; | ||
64 | |||
65 | TMJCICR |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; | ||
66 | sync = TMJCICR; | ||
67 | } | ||
68 | |||
69 | static inline void shutdown_jiffies_counter(void) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | #endif /* !__ASSEMBLY__ */ | ||
74 | |||
75 | |||
76 | /* | ||
77 | * timestamp counter specifications | ||
78 | */ | ||
79 | |||
80 | #define TMTSCBR_MAX 0xffffffff | ||
81 | #define TMTSCMD TMSMD | ||
82 | #define TMTSCBR TMSBR | ||
83 | #define TMTSCBC TMSBC | ||
84 | #define TMTSCICR TMSICR | ||
85 | |||
86 | #ifndef __ASSEMBLY__ | ||
87 | |||
88 | static inline void startup_timestamp_counter(void) | ||
89 | { | ||
90 | u32 sync; | ||
91 | |||
92 | /* set up TMS(Timestamp) 32bit timer register to count real time | ||
93 | * - count down from 4Gig-1 to 0 and wrap at IOBCLK rate | ||
94 | */ | ||
95 | |||
96 | TMTSCBR = TMTSCBR_MAX; | ||
97 | sync = TMTSCBR; | ||
98 | |||
99 | TMTSCICR = 0; | ||
100 | sync = TMTSCICR; | ||
101 | |||
102 | TMTSCMD = TMTMD_TMTLDE; | ||
103 | TMTSCMD = TMTMD_TMTCNE; | ||
104 | sync = TMTSCMD; | ||
105 | } | ||
106 | |||
107 | static inline void shutdown_timestamp_counter(void) | ||
108 | { | ||
109 | TMTSCMD = 0; | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * we use a cascaded pair of 16-bit down-counting timers to count I/O | ||
114 | * clock cycles for the purposes of time keeping | ||
115 | */ | ||
116 | typedef unsigned long cycles_t; | ||
117 | |||
118 | static inline cycles_t read_timestamp_counter(void) | ||
119 | { | ||
120 | return (cycles_t)TMTSCBC; | ||
121 | } | ||
122 | |||
123 | #endif /* !__ASSEMBLY__ */ | ||
124 | |||
125 | #endif /* _ASM_UNIT_TIMEX_H */ | ||
diff --git a/arch/mn10300/unit-asb2364/leds.c b/arch/mn10300/unit-asb2364/leds.c new file mode 100644 index 000000000000..1ff830c372b3 --- /dev/null +++ b/arch/mn10300/unit-asb2364/leds.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* leds.c: ASB2364 peripheral 7seg LEDs x4 support | ||
2 | * | ||
3 | * Copyright (C) 2002 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 License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/param.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include <asm/io.h> | ||
17 | #include <asm/processor.h> | ||
18 | #include <asm/intctl-regs.h> | ||
19 | #include <asm/rtc-regs.h> | ||
20 | #include <unit/leds.h> | ||
21 | |||
22 | #if MN10300_USE_7SEGLEDS | ||
23 | static const u8 asb2364_led_hex_tbl[16] = { | ||
24 | 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, | ||
25 | 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c | ||
26 | }; | ||
27 | |||
28 | static const u32 asb2364_led_chase_tbl[6] = { | ||
29 | ~0x02020202, /* top - segA */ | ||
30 | ~0x04040404, /* right top - segB */ | ||
31 | ~0x08080808, /* right bottom - segC */ | ||
32 | ~0x10101010, /* bottom - segD */ | ||
33 | ~0x20202020, /* left bottom - segE */ | ||
34 | ~0x40404040, /* left top - segF */ | ||
35 | }; | ||
36 | |||
37 | static unsigned asb2364_led_chase; | ||
38 | |||
39 | void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) | ||
40 | { | ||
41 | u32 leds; | ||
42 | |||
43 | leds = asb2364_led_hex_tbl[(val/1000) % 10]; | ||
44 | leds <<= 8; | ||
45 | leds |= asb2364_led_hex_tbl[(val/100) % 10]; | ||
46 | leds <<= 8; | ||
47 | leds |= asb2364_led_hex_tbl[(val/10) % 10]; | ||
48 | leds <<= 8; | ||
49 | leds |= asb2364_led_hex_tbl[val % 10]; | ||
50 | leds |= points^0x01010101; | ||
51 | |||
52 | ASB2364_7SEGLEDS = leds; | ||
53 | } | ||
54 | |||
55 | void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) | ||
56 | { | ||
57 | u32 leds; | ||
58 | |||
59 | leds = asb2364_led_hex_tbl[(val/1000) % 10]; | ||
60 | leds <<= 8; | ||
61 | leds |= asb2364_led_hex_tbl[(val/100) % 10]; | ||
62 | leds <<= 8; | ||
63 | leds |= asb2364_led_hex_tbl[(val/10) % 10]; | ||
64 | leds <<= 8; | ||
65 | leds |= asb2364_led_hex_tbl[val % 10]; | ||
66 | leds |= points^0x01010101; | ||
67 | |||
68 | ASB2364_7SEGLEDS = leds; | ||
69 | } | ||
70 | |||
71 | /* display triple horizontal bar and exception code */ | ||
72 | void peripheral_leds_display_exception(enum exception_code code) | ||
73 | { | ||
74 | u32 leds; | ||
75 | |||
76 | leds = asb2364_led_hex_tbl[(code/0x100) % 0x10]; | ||
77 | leds <<= 8; | ||
78 | leds |= asb2364_led_hex_tbl[(code/0x10) % 0x10]; | ||
79 | leds <<= 8; | ||
80 | leds |= asb2364_led_hex_tbl[code % 0x10]; | ||
81 | leds |= 0x6d010101; | ||
82 | |||
83 | ASB2364_7SEGLEDS = leds; | ||
84 | } | ||
85 | |||
86 | void peripheral_leds_led_chase(void) | ||
87 | { | ||
88 | ASB2364_7SEGLEDS = asb2364_led_chase_tbl[asb2364_led_chase]; | ||
89 | asb2364_led_chase++; | ||
90 | if (asb2364_led_chase >= 6) | ||
91 | asb2364_led_chase = 0; | ||
92 | } | ||
93 | #else /* MN10300_USE_7SEGLEDS */ | ||
94 | void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) { } | ||
95 | void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) { } | ||
96 | void peripheral_leds_display_exception(enum exception_code code) { } | ||
97 | void peripheral_leds_led_chase(void) { } | ||
98 | #endif /* MN10300_USE_7SEGLEDS */ | ||
diff --git a/arch/mn10300/unit-asb2364/unit-init.c b/arch/mn10300/unit-asb2364/unit-init.c new file mode 100644 index 000000000000..a3fc09b43f84 --- /dev/null +++ b/arch/mn10300/unit-asb2364/unit-init.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /* ASB2364 initialisation | ||
2 | * | ||
3 | * Copyright (C) 2002 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 License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
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> | ||
17 | |||
18 | #include <asm/io.h> | ||
19 | #include <asm/setup.h> | ||
20 | #include <asm/processor.h> | ||
21 | #include <asm/irq.h> | ||
22 | #include <asm/intctl-regs.h> | ||
23 | |||
24 | /* | ||
25 | * initialise some of the unit hardware before gdbstub is set up | ||
26 | */ | ||
27 | asmlinkage void __init unit_init(void) | ||
28 | { | ||
29 | /* set up the external interrupts */ | ||
30 | |||
31 | /* XIRQ[0]: NAND RXBY */ | ||
32 | /* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */ | ||
33 | |||
34 | /* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */ | ||
35 | SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL); | ||
36 | |||
37 | /* XIRQ[2]: Extend Slot 1-9 */ | ||
38 | /* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */ | ||
39 | |||
40 | #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) && \ | ||
41 | defined(CONFIG_ETHERNET_IRQ_LEVEL) && \ | ||
42 | (CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL) | ||
43 | # error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL | ||
44 | #endif | ||
45 | |||
46 | #if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) | ||
47 | set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); | ||
48 | #elif defined(CONFIG_ETHERNET_IRQ_LEVEL) | ||
49 | set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL)); | ||
50 | #endif | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * initialise the rest of the unit hardware after gdbstub is ready | ||
55 | */ | ||
56 | asmlinkage void __init unit_setup(void) | ||
57 | { | ||
58 | |||
59 | } | ||
60 | |||
61 | /* | ||
62 | * initialise the external interrupts used by a unit of this type | ||
63 | */ | ||
64 | void __init unit_init_IRQ(void) | ||
65 | { | ||
66 | unsigned int extnum; | ||
67 | |||
68 | for (extnum = 0 ; extnum < NR_XIRQS ; extnum++) { | ||
69 | switch (GET_XIRQ_TRIGGER(extnum)) { | ||
70 | /* LEVEL triggered interrupts should be made | ||
71 | * post-ACK'able as they hold their lines until | ||
72 | * serviced | ||
73 | */ | ||
74 | case XIRQ_TRIGGER_HILEVEL: | ||
75 | case XIRQ_TRIGGER_LOWLEVEL: | ||
76 | mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); | ||
77 | break; | ||
78 | default: | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | #define IRQCTL __SYSREG(0xd5000090, u32) | ||
84 | IRQCTL |= 0x02; | ||
85 | } | ||