diff options
Diffstat (limited to 'arch/mips/pmc-sierra')
-rw-r--r-- | arch/mips/pmc-sierra/yosemite/i2c-yosemite.h | 96 | ||||
-rw-r--r-- | arch/mips/pmc-sierra/yosemite/prom.c | 7 | ||||
-rw-r--r-- | arch/mips/pmc-sierra/yosemite/smp.c | 149 |
3 files changed, 89 insertions, 163 deletions
diff --git a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.h b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.h deleted file mode 100644 index 31c5523276fa..000000000000 --- a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.h +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* | ||
2 | * arch/mips/pmc-sierra/yosemite/i2c-yosemite.h | ||
3 | * | ||
4 | * Copyright (C) 2003 PMC-Sierra Inc. | ||
5 | * Author: Manish Lachwani (lachwani@pmc-sierra.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
13 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
14 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
15 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
18 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along | ||
24 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
25 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | |||
28 | #ifndef __I2C_YOSEMITE_H | ||
29 | #define __I2C_YOSEMITE_H | ||
30 | |||
31 | /* Read and Write operations to the chip */ | ||
32 | |||
33 | #define TITAN_I2C_BASE 0xbb000000 /* XXX Needs to change */ | ||
34 | |||
35 | #define TITAN_I2C_WRITE(offset, data) \ | ||
36 | *(volatile unsigned long *)(TITAN_I2C_BASE + offset) = data | ||
37 | |||
38 | #define TITAN_I2C_READ(offset) *(volatile unsigned long *)(TITAN_I2C_BASE + offset) | ||
39 | |||
40 | |||
41 | /* Local constansts*/ | ||
42 | #define TITAN_I2C_MAX_FILTER 15 | ||
43 | #define TITAN_I2C_MAX_CLK 1023 | ||
44 | #define TITAN_I2C_MAX_ARBF 15 | ||
45 | #define TITAN_I2C_MAX_NAK 15 | ||
46 | #define TITAN_I2C_MAX_MASTERCODE 7 | ||
47 | #define TITAN_I2C_MAX_WORDS_PER_RW 4 | ||
48 | #define TITAN_I2C_MAX_POLL 100 | ||
49 | |||
50 | /* Registers used for I2C work */ | ||
51 | #define TITAN_I2C_SCMB_CONTROL 0x0180 /* SCMB Control */ | ||
52 | #define TITAN_I2C_SCMB_CLOCK_A 0x0184 /* SCMB Clock A */ | ||
53 | #define TITAN_I2C_SCMB_CLOCK_B 0x0188 /* SCMB Clock B */ | ||
54 | #define TITAN_I2C_CONFIG 0x01A0 /* I2C Config */ | ||
55 | #define TITAN_I2C_COMMAND 0x01A4 /* I2C Command */ | ||
56 | #define TITAN_I2C_SLAVE_ADDRESS 0x01A8 /* I2C Slave Address */ | ||
57 | #define TITAN_I2C_DATA 0x01AC /* I2C Data [15:0] */ | ||
58 | #define TITAN_I2C_INTERRUPTS 0x01BC /* I2C Interrupts */ | ||
59 | |||
60 | /* Error */ | ||
61 | #define TITAN_I2C_ERR_ARB_LOST (-9220) | ||
62 | #define TITAN_I2C_ERR_NO_RESP (-9221) | ||
63 | #define TITAN_I2C_ERR_DATA_COLLISION (-9222) | ||
64 | #define TITAN_I2C_ERR_TIMEOUT (-9223) | ||
65 | #define TITAN_I2C_ERR_OK 0 | ||
66 | |||
67 | /* I2C Command Type */ | ||
68 | typedef enum { | ||
69 | TITAN_I2C_CMD_WRITE = 0, | ||
70 | TITAN_I2C_CMD_READ = 1, | ||
71 | TITAN_I2C_CMD_READ_WRITE = 2 | ||
72 | } titan_i2c_cmd_type; | ||
73 | |||
74 | /* I2C structures */ | ||
75 | typedef struct { | ||
76 | int filtera; /* Register 0x0184, bits 15 - 12 */ | ||
77 | int clka; /* Register 0x0184, bits 9 - 0 */ | ||
78 | int filterb; /* Register 0x0188, bits 15 - 12 */ | ||
79 | int clkb; /* Register 0x0188, bits 9 - 0 */ | ||
80 | } titan_i2c_config; | ||
81 | |||
82 | /* I2C command type */ | ||
83 | typedef struct { | ||
84 | titan_i2c_cmd_type type; /* Type of command */ | ||
85 | int num_arb; /* Register 0x01a0, bits 15 - 12 */ | ||
86 | int num_nak; /* Register 0x01a0, bits 11 - 8 */ | ||
87 | int addr_size; /* Register 0x01a0, bit 7 */ | ||
88 | int mst_code; /* Register 0x01a0, bits 6 - 4 */ | ||
89 | int arb_en; /* Register 0x01a0, bit 1 */ | ||
90 | int speed; /* Register 0x01a0, bit 0 */ | ||
91 | int slave_addr; /* Register 0x01a8 */ | ||
92 | int write_size; /* Register 0x01a4, bits 10 - 8 */ | ||
93 | unsigned int *data; /* Register 0x01ac */ | ||
94 | } titan_i2c_command; | ||
95 | |||
96 | #endif /* __I2C_YOSEMITE_H */ | ||
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c index 9b9936de6589..35dc435846a6 100644 --- a/arch/mips/pmc-sierra/yosemite/prom.c +++ b/arch/mips/pmc-sierra/yosemite/prom.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/reboot.h> | 21 | #include <asm/reboot.h> |
22 | #include <asm/smp-ops.h> | ||
22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
23 | #include <asm/bootinfo.h> | 24 | #include <asm/bootinfo.h> |
24 | #include <asm/pmon.h> | 25 | #include <asm/pmon.h> |
@@ -78,6 +79,8 @@ static void prom_halt(void) | |||
78 | __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0"); | 79 | __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0"); |
79 | } | 80 | } |
80 | 81 | ||
82 | extern struct plat_smp_ops yos_smp_ops; | ||
83 | |||
81 | /* | 84 | /* |
82 | * Init routine which accepts the variables from PMON | 85 | * Init routine which accepts the variables from PMON |
83 | */ | 86 | */ |
@@ -126,9 +129,9 @@ void __init prom_init(void) | |||
126 | env++; | 129 | env++; |
127 | } | 130 | } |
128 | 131 | ||
129 | mips_machtype = MACH_TITAN_YOSEMITE; | ||
130 | |||
131 | prom_grab_secondary(); | 132 | prom_grab_secondary(); |
133 | |||
134 | register_smp_ops(&yos_smp_ops); | ||
132 | } | 135 | } |
133 | 136 | ||
134 | void __init prom_free_prom_memory(void) | 137 | void __init prom_free_prom_memory(void) |
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c index b0f12cd2968a..653f3ec61cab 100644 --- a/arch/mips/pmc-sierra/yosemite/smp.c +++ b/arch/mips/pmc-sierra/yosemite/smp.c | |||
@@ -42,70 +42,6 @@ void __init prom_grab_secondary(void) | |||
42 | launchstack + LAUNCHSTACK_SIZE, 0); | 42 | launchstack + LAUNCHSTACK_SIZE, 0); |
43 | } | 43 | } |
44 | 44 | ||
45 | /* | ||
46 | * Detect available CPUs, populate phys_cpu_present_map before smp_init | ||
47 | * | ||
48 | * We don't want to start the secondary CPU yet nor do we have a nice probing | ||
49 | * feature in PMON so we just assume presence of the secondary core. | ||
50 | */ | ||
51 | void __init plat_smp_setup(void) | ||
52 | { | ||
53 | int i; | ||
54 | |||
55 | cpus_clear(phys_cpu_present_map); | ||
56 | |||
57 | for (i = 0; i < 2; i++) { | ||
58 | cpu_set(i, phys_cpu_present_map); | ||
59 | __cpu_number_map[i] = i; | ||
60 | __cpu_logical_map[i] = i; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | void __init plat_prepare_cpus(unsigned int max_cpus) | ||
65 | { | ||
66 | /* | ||
67 | * Be paranoid. Enable the IPI only if we're really about to go SMP. | ||
68 | */ | ||
69 | if (cpus_weight(cpu_possible_map)) | ||
70 | set_c0_status(STATUSF_IP5); | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * Firmware CPU startup hook | ||
75 | * Complicated by PMON's weird interface which tries to minimic the UNIX fork. | ||
76 | * It launches the next * available CPU and copies some information on the | ||
77 | * stack so the first thing we do is throw away that stuff and load useful | ||
78 | * values into the registers ... | ||
79 | */ | ||
80 | void __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle) | ||
81 | { | ||
82 | unsigned long gp = (unsigned long) task_thread_info(idle); | ||
83 | unsigned long sp = __KSTK_TOS(idle); | ||
84 | |||
85 | secondary_sp = sp; | ||
86 | secondary_gp = gp; | ||
87 | |||
88 | spin_unlock(&launch_lock); | ||
89 | } | ||
90 | |||
91 | /* Hook for after all CPUs are online */ | ||
92 | void prom_cpus_done(void) | ||
93 | { | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * After we've done initial boot, this function is called to allow the | ||
98 | * board code to clean up state, if needed | ||
99 | */ | ||
100 | void __cpuinit prom_init_secondary(void) | ||
101 | { | ||
102 | set_c0_status(ST0_CO | ST0_IE | ST0_IM); | ||
103 | } | ||
104 | |||
105 | void __cpuinit prom_smp_finish(void) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | void titan_mailbox_irq(void) | 45 | void titan_mailbox_irq(void) |
110 | { | 46 | { |
111 | int cpu = smp_processor_id(); | 47 | int cpu = smp_processor_id(); |
@@ -133,7 +69,7 @@ void titan_mailbox_irq(void) | |||
133 | /* | 69 | /* |
134 | * Send inter-processor interrupt | 70 | * Send inter-processor interrupt |
135 | */ | 71 | */ |
136 | void core_send_ipi(int cpu, unsigned int action) | 72 | static void yos_send_ipi_single(int cpu, unsigned int action) |
137 | { | 73 | { |
138 | /* | 74 | /* |
139 | * Generate an INTMSG so that it can be sent over to the | 75 | * Generate an INTMSG so that it can be sent over to the |
@@ -159,3 +95,86 @@ void core_send_ipi(int cpu, unsigned int action) | |||
159 | break; | 95 | break; |
160 | } | 96 | } |
161 | } | 97 | } |
98 | |||
99 | static void yos_send_ipi_mask(cpumask_t mask, unsigned int action) | ||
100 | { | ||
101 | unsigned int i; | ||
102 | |||
103 | for_each_cpu_mask(i, mask) | ||
104 | yos_send_ipi_single(i, action); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * After we've done initial boot, this function is called to allow the | ||
109 | * board code to clean up state, if needed | ||
110 | */ | ||
111 | static void __cpuinit yos_init_secondary(void) | ||
112 | { | ||
113 | set_c0_status(ST0_CO | ST0_IE | ST0_IM); | ||
114 | } | ||
115 | |||
116 | static void __cpuinit yos_smp_finish(void) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | /* Hook for after all CPUs are online */ | ||
121 | static void yos_cpus_done(void) | ||
122 | { | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * Firmware CPU startup hook | ||
127 | * Complicated by PMON's weird interface which tries to minimic the UNIX fork. | ||
128 | * It launches the next * available CPU and copies some information on the | ||
129 | * stack so the first thing we do is throw away that stuff and load useful | ||
130 | * values into the registers ... | ||
131 | */ | ||
132 | static void __cpuinit yos_boot_secondary(int cpu, struct task_struct *idle) | ||
133 | { | ||
134 | unsigned long gp = (unsigned long) task_thread_info(idle); | ||
135 | unsigned long sp = __KSTK_TOS(idle); | ||
136 | |||
137 | secondary_sp = sp; | ||
138 | secondary_gp = gp; | ||
139 | |||
140 | spin_unlock(&launch_lock); | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Detect available CPUs, populate phys_cpu_present_map before smp_init | ||
145 | * | ||
146 | * We don't want to start the secondary CPU yet nor do we have a nice probing | ||
147 | * feature in PMON so we just assume presence of the secondary core. | ||
148 | */ | ||
149 | static void __init yos_smp_setup(void) | ||
150 | { | ||
151 | int i; | ||
152 | |||
153 | cpus_clear(phys_cpu_present_map); | ||
154 | |||
155 | for (i = 0; i < 2; i++) { | ||
156 | cpu_set(i, phys_cpu_present_map); | ||
157 | __cpu_number_map[i] = i; | ||
158 | __cpu_logical_map[i] = i; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | static void __init yos_prepare_cpus(unsigned int max_cpus) | ||
163 | { | ||
164 | /* | ||
165 | * Be paranoid. Enable the IPI only if we're really about to go SMP. | ||
166 | */ | ||
167 | if (cpus_weight(cpu_possible_map)) | ||
168 | set_c0_status(STATUSF_IP5); | ||
169 | } | ||
170 | |||
171 | struct plat_smp_ops yos_smp_ops = { | ||
172 | .send_ipi_single = yos_send_ipi_single, | ||
173 | .send_ipi_mask = yos_send_ipi_mask, | ||
174 | .init_secondary = yos_init_secondary, | ||
175 | .smp_finish = yos_smp_finish, | ||
176 | .cpus_done = yos_cpus_done, | ||
177 | .boot_secondary = yos_boot_secondary, | ||
178 | .smp_setup = yos_smp_setup, | ||
179 | .prepare_cpus = yos_prepare_cpus, | ||
180 | }; | ||