diff options
author | Akira Takeuchi <takeuchi.akr@jp.panasonic.com> | 2010-10-27 12:28:55 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2010-10-27 12:28:55 -0400 |
commit | 368dd5acd154b09c043cc4392a74da01599b37d5 (patch) | |
tree | dd94ae3d044f6e774dec2437613515bd6b46dacb /arch/mn10300/unit-asb2305 | |
parent | 04157a6e7df99fd5ed64955233d6e00ab6613614 (diff) |
MN10300: And Panasonic AM34 subarch and implement SMP
Implement the Panasonic MN10300 AM34 CPU subarch and implement SMP support for
MN10300. Also implement support for the MN2WS0060 processor and the ASB2364
evaluation board which are AM34 based.
Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300/unit-asb2305')
-rw-r--r-- | arch/mn10300/unit-asb2305/include/unit/clock.h | 25 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/include/unit/serial.h | 5 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/include/unit/timex.h | 66 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 2 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/unit-init.c | 6 |
5 files changed, 56 insertions, 48 deletions
diff --git a/arch/mn10300/unit-asb2305/include/unit/clock.h b/arch/mn10300/unit-asb2305/include/unit/clock.h index 67be3f2eb18e..29e3425431cf 100644 --- a/arch/mn10300/unit-asb2305/include/unit/clock.h +++ b/arch/mn10300/unit-asb2305/include/unit/clock.h | |||
@@ -14,32 +14,11 @@ | |||
14 | 14 | ||
15 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
16 | 16 | ||
17 | #ifdef CONFIG_MN10300_RTC | ||
18 | |||
19 | extern unsigned long mn10300_ioclk; /* IOCLK (crystal speed) in HZ */ | ||
20 | extern unsigned long mn10300_iobclk; | ||
21 | extern unsigned long mn10300_tsc_per_HZ; | ||
22 | |||
23 | #define MN10300_IOCLK mn10300_ioclk | ||
24 | /* If this processors has a another clock, uncomment the below. */ | ||
25 | /* #define MN10300_IOBCLK mn10300_iobclk */ | ||
26 | |||
27 | #else /* !CONFIG_MN10300_RTC */ | ||
28 | |||
29 | #define MN10300_IOCLK 33333333UL | 17 | #define MN10300_IOCLK 33333333UL |
30 | /* #define MN10300_IOBCLK 66666666UL */ | 18 | /* #define MN10300_IOBCLK 66666666UL */ |
31 | 19 | ||
32 | #endif /* !CONFIG_MN10300_RTC */ | ||
33 | |||
34 | #define MN10300_JCCLK MN10300_IOCLK | ||
35 | #define MN10300_TSCCLK MN10300_IOCLK | ||
36 | |||
37 | #ifdef CONFIG_MN10300_RTC | ||
38 | #define MN10300_TSC_PER_HZ mn10300_tsc_per_HZ | ||
39 | #else /* !CONFIG_MN10300_RTC */ | ||
40 | #define MN10300_TSC_PER_HZ (MN10300_TSCCLK/HZ) | ||
41 | #endif /* !CONFIG_MN10300_RTC */ | ||
42 | |||
43 | #endif /* !__ASSEMBLY__ */ | 20 | #endif /* !__ASSEMBLY__ */ |
44 | 21 | ||
22 | #define MN10300_WDCLK MN10300_IOCLK | ||
23 | |||
45 | #endif /* _ASM_UNIT_CLOCK_H */ | 24 | #endif /* _ASM_UNIT_CLOCK_H */ |
diff --git a/arch/mn10300/unit-asb2305/include/unit/serial.h b/arch/mn10300/unit-asb2305/include/unit/serial.h index 8086cc092cec..88c08219315f 100644 --- a/arch/mn10300/unit-asb2305/include/unit/serial.h +++ b/arch/mn10300/unit-asb2305/include/unit/serial.h | |||
@@ -21,6 +21,11 @@ | |||
21 | #define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */ | 21 | #define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */ |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * The ASB2305 has an 18.432 MHz clock the UART | ||
25 | */ | ||
26 | #define BASE_BAUD (18432000 / 16) | ||
27 | |||
28 | /* | ||
24 | * dispose of the /dev/ttyS0 serial port | 29 | * dispose of the /dev/ttyS0 serial port |
25 | */ | 30 | */ |
26 | #ifndef CONFIG_GDBSTUB_ON_TTYSx | 31 | #ifndef CONFIG_GDBSTUB_ON_TTYSx |
diff --git a/arch/mn10300/unit-asb2305/include/unit/timex.h b/arch/mn10300/unit-asb2305/include/unit/timex.h index 0860186eedb2..cd8bc14e3ca3 100644 --- a/arch/mn10300/unit-asb2305/include/unit/timex.h +++ b/arch/mn10300/unit-asb2305/include/unit/timex.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ASB2305 timer specifcations | 1 | /* ASB2305-specific timer specifications |
2 | * | 2 | * |
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/timer-regs.h> | 18 | #include <asm/timer-regs.h> |
19 | #include <unit/clock.h> | 19 | #include <unit/clock.h> |
20 | #include <asm/param.h> | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * jiffies counter specifications | 23 | * jiffies counter specifications |
@@ -29,32 +30,43 @@ | |||
29 | #define TMJCBR TM01BR | 30 | #define TMJCBR TM01BR |
30 | #define TMJCIRQ TM1IRQ | 31 | #define TMJCIRQ TM1IRQ |
31 | #define TMJCICR TM1ICR | 32 | #define TMJCICR TM1ICR |
32 | #define TMJCICR_LEVEL GxICR_LEVEL_5 | ||
33 | 33 | ||
34 | #ifndef __ASSEMBLY__ | 34 | #ifndef __ASSEMBLY__ |
35 | 35 | ||
36 | #define MN10300_SRC_IOCLK MN10300_IOCLK | ||
37 | |||
38 | #ifndef HZ | ||
39 | # error HZ undeclared. | ||
40 | #endif /* !HZ */ | ||
41 | /* use as little prescaling as possible to avoid losing accuracy */ | ||
42 | #if (MN10300_SRC_IOCLK + HZ / 2) / HZ - 1 <= TMJCBR_MAX | ||
43 | # define IOCLK_PRESCALE 1 | ||
44 | # define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK | ||
45 | # define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK | ||
46 | #elif (MN10300_SRC_IOCLK / 8 + HZ / 2) / HZ - 1 <= TMJCBR_MAX | ||
47 | # define IOCLK_PRESCALE 8 | ||
48 | # define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_8 | ||
49 | # define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_8 | ||
50 | #elif (MN10300_SRC_IOCLK / 32 + HZ / 2) / HZ - 1 <= TMJCBR_MAX | ||
51 | # define IOCLK_PRESCALE 32 | ||
52 | # define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_32 | ||
53 | # define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_32 | ||
54 | #else | ||
55 | # error You lose. | ||
56 | #endif | ||
57 | |||
58 | #define MN10300_JCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) | ||
59 | #define MN10300_TSCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) | ||
60 | |||
61 | #define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) | ||
62 | #define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) | ||
63 | |||
36 | static inline void startup_jiffies_counter(void) | 64 | static inline void startup_jiffies_counter(void) |
37 | { | 65 | { |
38 | unsigned rate; | ||
39 | u16 md, t16; | 66 | u16 md, t16; |
40 | 67 | ||
41 | /* use as little prescaling as possible to avoid losing accuracy */ | 68 | md = JC_TIMER_CLKSRC; |
42 | md = TM0MD_SRC_IOCLK; | 69 | TMJCBR = MN10300_JC_PER_HZ - 1; |
43 | rate = MN10300_JCCLK / HZ; | ||
44 | |||
45 | if (rate > TMJCBR_MAX) { | ||
46 | md = TM0MD_SRC_IOCLK_8; | ||
47 | rate = MN10300_JCCLK / 8 / HZ; | ||
48 | |||
49 | if (rate > TMJCBR_MAX) { | ||
50 | md = TM0MD_SRC_IOCLK_32; | ||
51 | rate = MN10300_JCCLK / 32 / HZ; | ||
52 | |||
53 | BUG_ON(rate > TMJCBR_MAX); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | TMJCBR = rate - 1; | ||
58 | t16 = TMJCBR; | 70 | t16 = TMJCBR; |
59 | 71 | ||
60 | TMJCMD = | 72 | TMJCMD = |
@@ -93,29 +105,39 @@ static inline void shutdown_jiffies_counter(void) | |||
93 | 105 | ||
94 | static inline void startup_timestamp_counter(void) | 106 | static inline void startup_timestamp_counter(void) |
95 | { | 107 | { |
108 | u32 t32; | ||
109 | |||
96 | /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time | 110 | /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time |
97 | * - count down from 4Gig-1 to 0 and wrap at IOCLK rate | 111 | * - count down from 4Gig-1 to 0 and wrap at IOCLK rate |
98 | */ | 112 | */ |
99 | TM45BR = TMTSCBR_MAX; | 113 | TM45BR = TMTSCBR_MAX; |
114 | t32 = TM45BR; | ||
100 | 115 | ||
101 | TM4MD = TM4MD_SRC_IOCLK; | 116 | TM4MD = TSC_TIMER_CLKSRC; |
102 | TM4MD |= TM4MD_INIT_COUNTER; | 117 | TM4MD |= TM4MD_INIT_COUNTER; |
103 | TM4MD &= ~TM4MD_INIT_COUNTER; | 118 | TM4MD &= ~TM4MD_INIT_COUNTER; |
104 | TM4ICR = 0; | 119 | TM4ICR = 0; |
120 | t32 = TM4ICR; | ||
105 | 121 | ||
106 | TM5MD = TM5MD_SRC_TM4CASCADE; | 122 | TM5MD = TM5MD_SRC_TM4CASCADE; |
107 | TM5MD |= TM5MD_INIT_COUNTER; | 123 | TM5MD |= TM5MD_INIT_COUNTER; |
108 | TM5MD &= ~TM5MD_INIT_COUNTER; | 124 | TM5MD &= ~TM5MD_INIT_COUNTER; |
109 | TM5ICR = 0; | 125 | TM5ICR = 0; |
126 | t32 = TM5ICR; | ||
110 | 127 | ||
111 | TM5MD |= TM5MD_COUNT_ENABLE; | 128 | TM5MD |= TM5MD_COUNT_ENABLE; |
112 | TM4MD |= TM4MD_COUNT_ENABLE; | 129 | TM4MD |= TM4MD_COUNT_ENABLE; |
130 | t32 = TM5MD; | ||
131 | t32 = TM4MD; | ||
113 | } | 132 | } |
114 | 133 | ||
115 | static inline void shutdown_timestamp_counter(void) | 134 | static inline void shutdown_timestamp_counter(void) |
116 | { | 135 | { |
136 | u8 t8; | ||
117 | TM4MD = 0; | 137 | TM4MD = 0; |
118 | TM5MD = 0; | 138 | TM5MD = 0; |
139 | t8 = TM4MD; | ||
140 | t8 = TM5MD; | ||
119 | } | 141 | } |
120 | 142 | ||
121 | /* | 143 | /* |
@@ -126,7 +148,7 @@ typedef unsigned long cycles_t; | |||
126 | 148 | ||
127 | static inline cycles_t read_timestamp_counter(void) | 149 | static inline cycles_t read_timestamp_counter(void) |
128 | { | 150 | { |
129 | return (cycles_t) TMTSCBC; | 151 | return (cycles_t)TMTSCBC; |
130 | } | 152 | } |
131 | 153 | ||
132 | #endif /* !__ASSEMBLY__ */ | 154 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 6d8720a0a599..a4954fe82094 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -503,7 +503,7 @@ asmlinkage void __init unit_pci_init(void) | |||
503 | struct pci_ops *o = &pci_direct_ampci; | 503 | struct pci_ops *o = &pci_direct_ampci; |
504 | u32 x; | 504 | u32 x; |
505 | 505 | ||
506 | set_intr_level(XIRQ1, GxICR_LEVEL_3); | 506 | set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_PCI_IRQ_LEVEL)); |
507 | 507 | ||
508 | memset(&bus, 0, sizeof(bus)); | 508 | memset(&bus, 0, sizeof(bus)); |
509 | 509 | ||
diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c index a76c8e0ab90f..e1becd6b7571 100644 --- a/arch/mn10300/unit-asb2305/unit-init.c +++ b/arch/mn10300/unit-asb2305/unit-init.c | |||
@@ -26,8 +26,10 @@ asmlinkage void __init unit_init(void) | |||
26 | { | 26 | { |
27 | #ifndef CONFIG_GDBSTUB_ON_TTYSx | 27 | #ifndef CONFIG_GDBSTUB_ON_TTYSx |
28 | /* set the 16550 interrupt line to level 3 if not being used for GDB */ | 28 | /* set the 16550 interrupt line to level 3 if not being used for GDB */ |
29 | set_intr_level(XIRQ0, GxICR_LEVEL_3); | 29 | #ifdef CONFIG_EXT_SERIAL_IRQ_LEVEL |
30 | set_intr_level(XIRQ0, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); | ||
30 | #endif | 31 | #endif |
32 | #endif /* CONFIG_GDBSTUB_ON_TTYSx */ | ||
31 | } | 33 | } |
32 | 34 | ||
33 | /* | 35 | /* |
@@ -51,7 +53,7 @@ void __init unit_init_IRQ(void) | |||
51 | switch (GET_XIRQ_TRIGGER(extnum)) { | 53 | switch (GET_XIRQ_TRIGGER(extnum)) { |
52 | case XIRQ_TRIGGER_HILEVEL: | 54 | case XIRQ_TRIGGER_HILEVEL: |
53 | case XIRQ_TRIGGER_LOWLEVEL: | 55 | case XIRQ_TRIGGER_LOWLEVEL: |
54 | set_intr_postackable(XIRQ2IRQ(extnum)); | 56 | mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); |
55 | break; | 57 | break; |
56 | default: | 58 | default: |
57 | break; | 59 | break; |