diff options
53 files changed, 192 insertions, 2234 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 0c8614d9875c..3a05e9f93d42 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -668,7 +668,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ | |||
668 | /* Check current_thread_info()->flags */ | 668 | /* Check current_thread_info()->flags */ |
669 | rlwinm r9,r1,0,0,(31-THREAD_SHIFT) | 669 | rlwinm r9,r1,0,0,(31-THREAD_SHIFT) |
670 | lwz r9,TI_FLAGS(r9) | 670 | lwz r9,TI_FLAGS(r9) |
671 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED) | 671 | andi. r0,r9,_TIF_USER_WORK_MASK |
672 | bne do_work | 672 | bne do_work |
673 | 673 | ||
674 | restore_user: | 674 | restore_user: |
@@ -925,7 +925,7 @@ recheck: | |||
925 | lwz r9,TI_FLAGS(r9) | 925 | lwz r9,TI_FLAGS(r9) |
926 | andi. r0,r9,_TIF_NEED_RESCHED | 926 | andi. r0,r9,_TIF_NEED_RESCHED |
927 | bne- do_resched | 927 | bne- do_resched |
928 | andi. r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK | 928 | andi. r0,r9,_TIF_USER_WORK_MASK |
929 | beq restore_user | 929 | beq restore_user |
930 | do_user_signal: /* r10 contains MSR_KERNEL here */ | 930 | do_user_signal: /* r10 contains MSR_KERNEL here */ |
931 | ori r10,r10,MSR_EE | 931 | ori r10,r10,MSR_EE |
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index aefafc6330c9..721faef87095 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h | |||
@@ -272,7 +272,7 @@ label: | |||
272 | /* continue normal handling for a critical exception... */ \ | 272 | /* continue normal handling for a critical exception... */ \ |
273 | 2: mfspr r4,SPRN_DBSR; \ | 273 | 2: mfspr r4,SPRN_DBSR; \ |
274 | addi r3,r1,STACK_FRAME_OVERHEAD; \ | 274 | addi r3,r1,STACK_FRAME_OVERHEAD; \ |
275 | EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc) | 275 | EXC_XFER_TEMPLATE(DebugException, 0x2008, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc) |
276 | 276 | ||
277 | #define DEBUG_CRIT_EXCEPTION \ | 277 | #define DEBUG_CRIT_EXCEPTION \ |
278 | START_EXCEPTION(DebugCrit); \ | 278 | START_EXCEPTION(DebugCrit); \ |
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 1e656b43ad7f..827a5726a035 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -573,7 +573,7 @@ static int lparcfg_open(struct inode *inode, struct file *file) | |||
573 | return single_open(file, lparcfg_data, NULL); | 573 | return single_open(file, lparcfg_data, NULL); |
574 | } | 574 | } |
575 | 575 | ||
576 | const struct file_operations lparcfg_fops = { | 576 | static const struct file_operations lparcfg_fops = { |
577 | .owner = THIS_MODULE, | 577 | .owner = THIS_MODULE, |
578 | .read = seq_read, | 578 | .read = seq_read, |
579 | .write = lparcfg_write, | 579 | .write = lparcfg_write, |
@@ -581,7 +581,7 @@ const struct file_operations lparcfg_fops = { | |||
581 | .release = single_release, | 581 | .release = single_release, |
582 | }; | 582 | }; |
583 | 583 | ||
584 | int __init lparcfg_init(void) | 584 | static int __init lparcfg_init(void) |
585 | { | 585 | { |
586 | struct proc_dir_entry *ent; | 586 | struct proc_dir_entry *ent; |
587 | mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; | 587 | mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; |
@@ -601,7 +601,7 @@ int __init lparcfg_init(void) | |||
601 | return 0; | 601 | return 0; |
602 | } | 602 | } |
603 | 603 | ||
604 | void __exit lparcfg_cleanup(void) | 604 | static void __exit lparcfg_cleanup(void) |
605 | { | 605 | { |
606 | if (proc_ppc64_lparcfg) | 606 | if (proc_ppc64_lparcfg) |
607 | remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent); | 607 | remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent); |
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index 704375bda73a..631dfd614b21 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -158,7 +158,7 @@ void kexec_copy_flush(struct kimage *image) | |||
158 | * on calling the interrupts, but we would like to call it off irq level | 158 | * on calling the interrupts, but we would like to call it off irq level |
159 | * so that the interrupt controller is clean. | 159 | * so that the interrupt controller is clean. |
160 | */ | 160 | */ |
161 | void kexec_smp_down(void *arg) | 161 | static void kexec_smp_down(void *arg) |
162 | { | 162 | { |
163 | if (ppc_md.kexec_cpu_down) | 163 | if (ppc_md.kexec_cpu_down) |
164 | ppc_md.kexec_cpu_down(0, 1); | 164 | ppc_md.kexec_cpu_down(0, 1); |
@@ -249,7 +249,7 @@ static void kexec_prepare_cpus(void) | |||
249 | * We could use a smaller stack if we don't care about anything using | 249 | * We could use a smaller stack if we don't care about anything using |
250 | * current, but that audit has not been performed. | 250 | * current, but that audit has not been performed. |
251 | */ | 251 | */ |
252 | union thread_union kexec_stack | 252 | static union thread_union kexec_stack |
253 | __attribute__((__section__(".data.init_task"))) = { }; | 253 | __attribute__((__section__(".data.init_task"))) = { }; |
254 | 254 | ||
255 | /* Our assembly helper, in kexec_stub.S */ | 255 | /* Our assembly helper, in kexec_stub.S */ |
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c index c62d1012c013..3bb7d3dd28be 100644 --- a/arch/powerpc/kernel/msi.c +++ b/arch/powerpc/kernel/msi.c | |||
@@ -34,5 +34,5 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
34 | 34 | ||
35 | void arch_teardown_msi_irqs(struct pci_dev *dev) | 35 | void arch_teardown_msi_irqs(struct pci_dev *dev) |
36 | { | 36 | { |
37 | return ppc_md.teardown_msi_irqs(dev); | 37 | ppc_md.teardown_msi_irqs(dev); |
38 | } | 38 | } |
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index f9c6abc84a94..1be9fe38bcb5 100644 --- a/arch/powerpc/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
@@ -160,7 +160,7 @@ static int sensors_open(struct inode *inode, struct file *file) | |||
160 | return single_open(file, ppc_rtas_sensors_show, NULL); | 160 | return single_open(file, ppc_rtas_sensors_show, NULL); |
161 | } | 161 | } |
162 | 162 | ||
163 | const struct file_operations ppc_rtas_sensors_operations = { | 163 | static const struct file_operations ppc_rtas_sensors_operations = { |
164 | .open = sensors_open, | 164 | .open = sensors_open, |
165 | .read = seq_read, | 165 | .read = seq_read, |
166 | .llseek = seq_lseek, | 166 | .llseek = seq_lseek, |
@@ -172,7 +172,7 @@ static int poweron_open(struct inode *inode, struct file *file) | |||
172 | return single_open(file, ppc_rtas_poweron_show, NULL); | 172 | return single_open(file, ppc_rtas_poweron_show, NULL); |
173 | } | 173 | } |
174 | 174 | ||
175 | const struct file_operations ppc_rtas_poweron_operations = { | 175 | static const struct file_operations ppc_rtas_poweron_operations = { |
176 | .open = poweron_open, | 176 | .open = poweron_open, |
177 | .read = seq_read, | 177 | .read = seq_read, |
178 | .llseek = seq_lseek, | 178 | .llseek = seq_lseek, |
@@ -185,7 +185,7 @@ static int progress_open(struct inode *inode, struct file *file) | |||
185 | return single_open(file, ppc_rtas_progress_show, NULL); | 185 | return single_open(file, ppc_rtas_progress_show, NULL); |
186 | } | 186 | } |
187 | 187 | ||
188 | const struct file_operations ppc_rtas_progress_operations = { | 188 | static const struct file_operations ppc_rtas_progress_operations = { |
189 | .open = progress_open, | 189 | .open = progress_open, |
190 | .read = seq_read, | 190 | .read = seq_read, |
191 | .llseek = seq_lseek, | 191 | .llseek = seq_lseek, |
@@ -198,7 +198,7 @@ static int clock_open(struct inode *inode, struct file *file) | |||
198 | return single_open(file, ppc_rtas_clock_show, NULL); | 198 | return single_open(file, ppc_rtas_clock_show, NULL); |
199 | } | 199 | } |
200 | 200 | ||
201 | const struct file_operations ppc_rtas_clock_operations = { | 201 | static const struct file_operations ppc_rtas_clock_operations = { |
202 | .open = clock_open, | 202 | .open = clock_open, |
203 | .read = seq_read, | 203 | .read = seq_read, |
204 | .llseek = seq_lseek, | 204 | .llseek = seq_lseek, |
@@ -211,7 +211,7 @@ static int tone_freq_open(struct inode *inode, struct file *file) | |||
211 | return single_open(file, ppc_rtas_tone_freq_show, NULL); | 211 | return single_open(file, ppc_rtas_tone_freq_show, NULL); |
212 | } | 212 | } |
213 | 213 | ||
214 | const struct file_operations ppc_rtas_tone_freq_operations = { | 214 | static const struct file_operations ppc_rtas_tone_freq_operations = { |
215 | .open = tone_freq_open, | 215 | .open = tone_freq_open, |
216 | .read = seq_read, | 216 | .read = seq_read, |
217 | .llseek = seq_lseek, | 217 | .llseek = seq_lseek, |
@@ -224,7 +224,7 @@ static int tone_volume_open(struct inode *inode, struct file *file) | |||
224 | return single_open(file, ppc_rtas_tone_volume_show, NULL); | 224 | return single_open(file, ppc_rtas_tone_volume_show, NULL); |
225 | } | 225 | } |
226 | 226 | ||
227 | const struct file_operations ppc_rtas_tone_volume_operations = { | 227 | static const struct file_operations ppc_rtas_tone_volume_operations = { |
228 | .open = tone_volume_open, | 228 | .open = tone_volume_open, |
229 | .read = seq_read, | 229 | .read = seq_read, |
230 | .llseek = seq_lseek, | 230 | .llseek = seq_lseek, |
@@ -237,7 +237,7 @@ static int rmo_buf_open(struct inode *inode, struct file *file) | |||
237 | return single_open(file, ppc_rtas_rmo_buf_show, NULL); | 237 | return single_open(file, ppc_rtas_rmo_buf_show, NULL); |
238 | } | 238 | } |
239 | 239 | ||
240 | const struct file_operations ppc_rtas_rmo_buf_ops = { | 240 | static const struct file_operations ppc_rtas_rmo_buf_ops = { |
241 | .open = rmo_buf_open, | 241 | .open = rmo_buf_open, |
242 | .read = seq_read, | 242 | .read = seq_read, |
243 | .llseek = seq_lseek, | 243 | .llseek = seq_lseek, |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 34843c318419..2a60bd3e3afa 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -340,8 +340,8 @@ int rtas_get_error_log_max(void) | |||
340 | EXPORT_SYMBOL(rtas_get_error_log_max); | 340 | EXPORT_SYMBOL(rtas_get_error_log_max); |
341 | 341 | ||
342 | 342 | ||
343 | char rtas_err_buf[RTAS_ERROR_LOG_MAX]; | 343 | static char rtas_err_buf[RTAS_ERROR_LOG_MAX]; |
344 | int rtas_last_error_token; | 344 | static int rtas_last_error_token; |
345 | 345 | ||
346 | /** Return a copy of the detailed error text associated with the | 346 | /** Return a copy of the detailed error text associated with the |
347 | * most recent failed call to rtas. Because the error text | 347 | * most recent failed call to rtas. Because the error text |
@@ -484,7 +484,7 @@ unsigned int rtas_busy_delay(int status) | |||
484 | } | 484 | } |
485 | EXPORT_SYMBOL(rtas_busy_delay); | 485 | EXPORT_SYMBOL(rtas_busy_delay); |
486 | 486 | ||
487 | int rtas_error_rc(int rtas_rc) | 487 | static int rtas_error_rc(int rtas_rc) |
488 | { | 488 | { |
489 | int rc; | 489 | int rc; |
490 | 490 | ||
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 0a5e22b22729..09ded5c424a9 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -731,7 +731,7 @@ static const struct file_operations validate_flash_operations = { | |||
731 | .release = validate_flash_release, | 731 | .release = validate_flash_release, |
732 | }; | 732 | }; |
733 | 733 | ||
734 | int __init rtas_flash_init(void) | 734 | static int __init rtas_flash_init(void) |
735 | { | 735 | { |
736 | int rc; | 736 | int rc; |
737 | 737 | ||
@@ -817,7 +817,7 @@ cleanup: | |||
817 | return rc; | 817 | return rc; |
818 | } | 818 | } |
819 | 819 | ||
820 | void __exit rtas_flash_cleanup(void) | 820 | static void __exit rtas_flash_cleanup(void) |
821 | { | 821 | { |
822 | rtas_flash_term_hook = NULL; | 822 | rtas_flash_term_hook = NULL; |
823 | 823 | ||
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index 3ab88a9dc70d..589a2797eac2 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c | |||
@@ -155,12 +155,12 @@ static int rtas_pci_write_config(struct pci_bus *bus, | |||
155 | return PCIBIOS_DEVICE_NOT_FOUND; | 155 | return PCIBIOS_DEVICE_NOT_FOUND; |
156 | } | 156 | } |
157 | 157 | ||
158 | struct pci_ops rtas_pci_ops = { | 158 | static struct pci_ops rtas_pci_ops = { |
159 | .read = rtas_pci_read_config, | 159 | .read = rtas_pci_read_config, |
160 | .write = rtas_pci_write_config, | 160 | .write = rtas_pci_write_config, |
161 | }; | 161 | }; |
162 | 162 | ||
163 | int is_python(struct device_node *dev) | 163 | static int is_python(struct device_node *dev) |
164 | { | 164 | { |
165 | const char *model = of_get_property(dev, "model", NULL); | 165 | const char *model = of_get_property(dev, "model", NULL); |
166 | 166 | ||
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index a65a44fbe523..ad55488939c3 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -120,7 +120,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
120 | int ret; | 120 | int ret; |
121 | int is32 = is_32bit_task(); | 121 | int is32 = is_32bit_task(); |
122 | 122 | ||
123 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 123 | if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK) |
124 | oldset = ¤t->saved_sigmask; | 124 | oldset = ¤t->saved_sigmask; |
125 | else if (!oldset) | 125 | else if (!oldset) |
126 | oldset = ¤t->blocked; | 126 | oldset = ¤t->blocked; |
@@ -131,9 +131,10 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
131 | check_syscall_restart(regs, &ka, signr > 0); | 131 | check_syscall_restart(regs, &ka, signr > 0); |
132 | 132 | ||
133 | if (signr <= 0) { | 133 | if (signr <= 0) { |
134 | struct thread_info *ti = current_thread_info(); | ||
134 | /* No signal to deliver -- put the saved sigmask back */ | 135 | /* No signal to deliver -- put the saved sigmask back */ |
135 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 136 | if (ti->local_flags & _TLF_RESTORE_SIGMASK) { |
136 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 137 | ti->local_flags &= ~_TLF_RESTORE_SIGMASK; |
137 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 138 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
138 | } | 139 | } |
139 | return 0; /* no signals delivered */ | 140 | return 0; /* no signals delivered */ |
@@ -169,10 +170,9 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) | |||
169 | 170 | ||
170 | /* | 171 | /* |
171 | * A signal was successfully delivered; the saved sigmask is in | 172 | * A signal was successfully delivered; the saved sigmask is in |
172 | * its frame, and we can clear the TIF_RESTORE_SIGMASK flag. | 173 | * its frame, and we can clear the TLF_RESTORE_SIGMASK flag. |
173 | */ | 174 | */ |
174 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 175 | current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; |
175 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
176 | } | 176 | } |
177 | 177 | ||
178 | return ret; | 178 | return ret; |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index ad6943468ee9..4ae16d179803 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -243,7 +243,7 @@ long sys_sigsuspend(old_sigset_t mask) | |||
243 | 243 | ||
244 | current->state = TASK_INTERRUPTIBLE; | 244 | current->state = TASK_INTERRUPTIBLE; |
245 | schedule(); | 245 | schedule(); |
246 | set_thread_flag(TIF_RESTORE_SIGMASK); | 246 | set_restore_sigmask(); |
247 | return -ERESTARTNOHAND; | 247 | return -ERESTARTNOHAND; |
248 | } | 248 | } |
249 | 249 | ||
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 1457aa0a08f1..ba7989ffaeee 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -365,12 +365,8 @@ void smp_call_function_interrupt(void) | |||
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | extern struct gettimeofday_struct do_gtod; | ||
369 | |||
370 | struct thread_info *current_set[NR_CPUS]; | 368 | struct thread_info *current_set[NR_CPUS]; |
371 | 369 | ||
372 | DECLARE_PER_CPU(unsigned int, pvr); | ||
373 | |||
374 | static void __devinit smp_store_cpu_info(int id) | 370 | static void __devinit smp_store_cpu_info(int id) |
375 | { | 371 | { |
376 | per_cpu(pvr, id) = mfspr(SPRN_PVR); | 372 | per_cpu(pvr, id) = mfspr(SPRN_PVR); |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 73401e83739a..c73fc33aa817 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -129,7 +129,7 @@ static unsigned long __initdata iSeries_recal_titan; | |||
129 | static signed long __initdata iSeries_recal_tb; | 129 | static signed long __initdata iSeries_recal_tb; |
130 | 130 | ||
131 | /* Forward declaration is only needed for iSereis compiles */ | 131 | /* Forward declaration is only needed for iSereis compiles */ |
132 | void __init clocksource_init(void); | 132 | static void __init clocksource_init(void); |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | #define XSEC_PER_SEC (1024*1024) | 135 | #define XSEC_PER_SEC (1024*1024) |
@@ -150,8 +150,8 @@ u64 tb_to_xs; | |||
150 | unsigned tb_to_us; | 150 | unsigned tb_to_us; |
151 | 151 | ||
152 | #define TICKLEN_SCALE NTP_SCALE_SHIFT | 152 | #define TICKLEN_SCALE NTP_SCALE_SHIFT |
153 | u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ | 153 | static u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ |
154 | u64 ticklen_to_xs; /* 0.64 fraction */ | 154 | static u64 ticklen_to_xs; /* 0.64 fraction */ |
155 | 155 | ||
156 | /* If last_tick_len corresponds to about 1/HZ seconds, then | 156 | /* If last_tick_len corresponds to about 1/HZ seconds, then |
157 | last_tick_len << TICKLEN_SHIFT will be about 2^63. */ | 157 | last_tick_len << TICKLEN_SHIFT will be about 2^63. */ |
@@ -164,7 +164,7 @@ static u64 tb_to_ns_scale __read_mostly; | |||
164 | static unsigned tb_to_ns_shift __read_mostly; | 164 | static unsigned tb_to_ns_shift __read_mostly; |
165 | static unsigned long boot_tb __read_mostly; | 165 | static unsigned long boot_tb __read_mostly; |
166 | 166 | ||
167 | struct gettimeofday_struct do_gtod; | 167 | static struct gettimeofday_struct do_gtod; |
168 | 168 | ||
169 | extern struct timezone sys_tz; | 169 | extern struct timezone sys_tz; |
170 | static long timezone_offset; | 170 | static long timezone_offset; |
@@ -832,7 +832,7 @@ void update_vsyscall_tz(void) | |||
832 | ++vdso_data->tb_update_count; | 832 | ++vdso_data->tb_update_count; |
833 | } | 833 | } |
834 | 834 | ||
835 | void __init clocksource_init(void) | 835 | static void __init clocksource_init(void) |
836 | { | 836 | { |
837 | struct clocksource *clock; | 837 | struct clocksource *clock; |
838 | 838 | ||
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 0f2d239d94c4..bf5b6d7ed30f 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -120,7 +120,7 @@ static DEFINE_SPINLOCK(linear_map_hash_lock); | |||
120 | 120 | ||
121 | /* Pre-POWER4 CPUs (4k pages only) | 121 | /* Pre-POWER4 CPUs (4k pages only) |
122 | */ | 122 | */ |
123 | struct mmu_psize_def mmu_psize_defaults_old[] = { | 123 | static struct mmu_psize_def mmu_psize_defaults_old[] = { |
124 | [MMU_PAGE_4K] = { | 124 | [MMU_PAGE_4K] = { |
125 | .shift = 12, | 125 | .shift = 12, |
126 | .sllp = 0, | 126 | .sllp = 0, |
@@ -134,7 +134,7 @@ struct mmu_psize_def mmu_psize_defaults_old[] = { | |||
134 | * | 134 | * |
135 | * Support for 16Mb large pages | 135 | * Support for 16Mb large pages |
136 | */ | 136 | */ |
137 | struct mmu_psize_def mmu_psize_defaults_gp[] = { | 137 | static struct mmu_psize_def mmu_psize_defaults_gp[] = { |
138 | [MMU_PAGE_4K] = { | 138 | [MMU_PAGE_4K] = { |
139 | .shift = 12, | 139 | .shift = 12, |
140 | .sllp = 0, | 140 | .sllp = 0, |
@@ -533,8 +533,6 @@ void __init htab_initialize(void) | |||
533 | unsigned long base = 0, size = 0, limit; | 533 | unsigned long base = 0, size = 0, limit; |
534 | int i; | 534 | int i; |
535 | 535 | ||
536 | extern unsigned long tce_alloc_start, tce_alloc_end; | ||
537 | |||
538 | DBG(" -> htab_initialize()\n"); | 536 | DBG(" -> htab_initialize()\n"); |
539 | 537 | ||
540 | /* Initialize segment sizes */ | 538 | /* Initialize segment sizes */ |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 1952b4d3fa7f..45418590b6a9 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/btext.h> | 43 | #include <asm/btext.h> |
44 | #include <asm/tlb.h> | 44 | #include <asm/tlb.h> |
45 | #include <asm/sections.h> | 45 | #include <asm/sections.h> |
46 | #include <asm/system.h> | ||
46 | 47 | ||
47 | #include "mmu_decl.h" | 48 | #include "mmu_decl.h" |
48 | 49 | ||
@@ -76,8 +77,6 @@ void MMU_init(void); | |||
76 | /* XXX should be in current.h -- paulus */ | 77 | /* XXX should be in current.h -- paulus */ |
77 | extern struct task_struct *current_set[NR_CPUS]; | 78 | extern struct task_struct *current_set[NR_CPUS]; |
78 | 79 | ||
79 | extern int init_bootmem_done; | ||
80 | |||
81 | /* | 80 | /* |
82 | * this tells the system to map all of ram with the segregs | 81 | * this tells the system to map all of ram with the segregs |
83 | * (i.e. page tables) instead of the bats. | 82 | * (i.e. page tables) instead of the bats. |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 6aa65375abf5..6ef63caca682 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -185,7 +185,7 @@ void pgtable_cache_init(void) | |||
185 | * do this by hand as the proffered address may not be correctly aligned. | 185 | * do this by hand as the proffered address may not be correctly aligned. |
186 | * Subtraction of non-aligned pointers produces undefined results. | 186 | * Subtraction of non-aligned pointers produces undefined results. |
187 | */ | 187 | */ |
188 | unsigned long __meminit vmemmap_section_start(unsigned long page) | 188 | static unsigned long __meminit vmemmap_section_start(unsigned long page) |
189 | { | 189 | { |
190 | unsigned long offset = page - ((unsigned long)(vmemmap)); | 190 | unsigned long offset = page - ((unsigned long)(vmemmap)); |
191 | 191 | ||
@@ -198,7 +198,7 @@ unsigned long __meminit vmemmap_section_start(unsigned long page) | |||
198 | * which overlaps this vmemmap page is initialised then this page is | 198 | * which overlaps this vmemmap page is initialised then this page is |
199 | * initialised already. | 199 | * initialised already. |
200 | */ | 200 | */ |
201 | int __meminit vmemmap_populated(unsigned long start, int page_size) | 201 | static int __meminit vmemmap_populated(unsigned long start, int page_size) |
202 | { | 202 | { |
203 | unsigned long end = start + page_size; | 203 | unsigned long end = start + page_size; |
204 | 204 | ||
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c index efbbd13d93e5..60e6032a8088 100644 --- a/arch/powerpc/mm/stab.c +++ b/arch/powerpc/mm/stab.c | |||
@@ -30,8 +30,8 @@ struct stab_entry { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | #define NR_STAB_CACHE_ENTRIES 8 | 32 | #define NR_STAB_CACHE_ENTRIES 8 |
33 | DEFINE_PER_CPU(long, stab_cache_ptr); | 33 | static DEFINE_PER_CPU(long, stab_cache_ptr); |
34 | DEFINE_PER_CPU(long, stab_cache[NR_STAB_CACHE_ENTRIES]); | 34 | static DEFINE_PER_CPU(long, stab_cache[NR_STAB_CACHE_ENTRIES]); |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Create a segment table entry for the given esid/vsid pair. | 37 | * Create a segment table entry for the given esid/vsid pair. |
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c index e2d867ce1c7e..509bc560159b 100644 --- a/arch/powerpc/mm/tlb_64.c +++ b/arch/powerpc/mm/tlb_64.c | |||
@@ -37,8 +37,8 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | |||
37 | * include/asm-powerpc/tlb.h file -- tgall | 37 | * include/asm-powerpc/tlb.h file -- tgall |
38 | */ | 38 | */ |
39 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 39 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
40 | DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); | 40 | static DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); |
41 | unsigned long pte_freelist_forced_free; | 41 | static unsigned long pte_freelist_forced_free; |
42 | 42 | ||
43 | struct pte_freelist_batch | 43 | struct pte_freelist_batch |
44 | { | 44 | { |
@@ -47,9 +47,6 @@ struct pte_freelist_batch | |||
47 | pgtable_free_t tables[0]; | 47 | pgtable_free_t tables[0]; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); | ||
51 | unsigned long pte_freelist_forced_free; | ||
52 | |||
53 | #define PTE_FREELIST_SIZE \ | 50 | #define PTE_FREELIST_SIZE \ |
54 | ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ | 51 | ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ |
55 | / sizeof(pgtable_free_t)) | 52 | / sizeof(pgtable_free_t)) |
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 116babbaaf81..1ba7ce5aafae 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -63,13 +63,6 @@ static struct mpic *chrp_mpic; | |||
63 | DEFINE_PER_CPU(struct timer_list, heartbeat_timer); | 63 | DEFINE_PER_CPU(struct timer_list, heartbeat_timer); |
64 | unsigned long event_scan_interval; | 64 | unsigned long event_scan_interval; |
65 | 65 | ||
66 | /* | ||
67 | * XXX this should be in xmon.h, but putting it there means xmon.h | ||
68 | * has to include <linux/interrupt.h> (to get irqreturn_t), which | ||
69 | * causes all sorts of problems. -- paulus | ||
70 | */ | ||
71 | extern irqreturn_t xmon_irq(int, void *); | ||
72 | |||
73 | extern unsigned long loops_per_jiffy; | 66 | extern unsigned long loops_per_jiffy; |
74 | 67 | ||
75 | /* To be replaced by RTAS when available */ | 68 | /* To be replaced by RTAS when available */ |
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c index 9f7579b38c72..53bca132fb48 100644 --- a/arch/powerpc/platforms/maple/time.c +++ b/arch/powerpc/platforms/maple/time.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #define DBG(x...) | 41 | #define DBG(x...) |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | extern void GregorianDay(struct rtc_time * tm); | ||
45 | |||
46 | static int maple_rtc_addr; | 44 | static int maple_rtc_addr; |
47 | 45 | ||
48 | static int maple_clock_read(int addr) | 46 | static int maple_clock_read(int addr) |
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 829b8b02527b..6d149ae8ffa7 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
@@ -34,16 +34,10 @@ | |||
34 | #include <asm/time.h> | 34 | #include <asm/time.h> |
35 | #include <asm/pmac_feature.h> | 35 | #include <asm/pmac_feature.h> |
36 | #include <asm/mpic.h> | 36 | #include <asm/mpic.h> |
37 | #include <asm/xmon.h> | ||
37 | 38 | ||
38 | #include "pmac.h" | 39 | #include "pmac.h" |
39 | 40 | ||
40 | /* | ||
41 | * XXX this should be in xmon.h, but putting it there means xmon.h | ||
42 | * has to include <linux/interrupt.h> (to get irqreturn_t), which | ||
43 | * causes all sorts of problems. -- paulus | ||
44 | */ | ||
45 | extern irqreturn_t xmon_irq(int, void *); | ||
46 | |||
47 | #ifdef CONFIG_PPC32 | 41 | #ifdef CONFIG_PPC32 |
48 | struct pmac_irq_hw { | 42 | struct pmac_irq_hw { |
49 | unsigned int event; | 43 | unsigned int event; |
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index 9d3a40f45974..5a707da3f5c2 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
27 | #include <asm/udbg.h> | 27 | #include <asm/udbg.h> |
28 | 28 | ||
29 | #include "pseries.h" | ||
29 | 30 | ||
30 | typedef struct { | 31 | typedef struct { |
31 | unsigned long val; | 32 | unsigned long val; |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 176f1f39d2d5..9a12908510fb 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -135,9 +135,10 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, | |||
135 | u64 rpn; | 135 | u64 rpn; |
136 | long l, limit; | 136 | long l, limit; |
137 | 137 | ||
138 | if (npages == 1) | 138 | if (npages == 1) { |
139 | return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, | 139 | tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, direction); |
140 | direction); | 140 | return; |
141 | } | ||
141 | 142 | ||
142 | tcep = __get_cpu_var(tce_page); | 143 | tcep = __get_cpu_var(tce_page); |
143 | 144 | ||
@@ -147,9 +148,11 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, | |||
147 | if (!tcep) { | 148 | if (!tcep) { |
148 | tcep = (u64 *)__get_free_page(GFP_ATOMIC); | 149 | tcep = (u64 *)__get_free_page(GFP_ATOMIC); |
149 | /* If allocation fails, fall back to the loop implementation */ | 150 | /* If allocation fails, fall back to the loop implementation */ |
150 | if (!tcep) | 151 | if (!tcep) { |
151 | return tce_build_pSeriesLP(tbl, tcenum, npages, | 152 | tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, |
152 | uaddr, direction); | 153 | direction); |
154 | return; | ||
155 | } | ||
153 | __get_cpu_var(tce_page) = tcep; | 156 | __get_cpu_var(tce_page) = tcep; |
154 | } | 157 | } |
155 | 158 | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 2cbaedb17f3e..3b4651b6ee05 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(plpar_hcall_norets); | |||
52 | extern void pSeries_find_serial_port(void); | 52 | extern void pSeries_find_serial_port(void); |
53 | 53 | ||
54 | 54 | ||
55 | int vtermno; /* virtual terminal# for udbg */ | 55 | static int vtermno; /* virtual terminal# for udbg */ |
56 | 56 | ||
57 | #define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) | 57 | #define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) |
58 | static void udbg_hvsi_putc(char c) | 58 | static void udbg_hvsi_putc(char c) |
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index 2b548afd1003..d20b96e22c2e 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c | |||
@@ -55,7 +55,7 @@ | |||
55 | static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; | 55 | static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; |
56 | static DEFINE_SPINLOCK(ras_log_buf_lock); | 56 | static DEFINE_SPINLOCK(ras_log_buf_lock); |
57 | 57 | ||
58 | char mce_data_buf[RTAS_ERROR_LOG_MAX]; | 58 | static char mce_data_buf[RTAS_ERROR_LOG_MAX]; |
59 | 59 | ||
60 | static int ras_get_sensor_state_token; | 60 | static int ras_get_sensor_state_token; |
61 | static int ras_check_exception_token; | 61 | static int ras_check_exception_token; |
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 7d3e2b0bd4d2..c9ffd8c225f1 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | static DEFINE_SPINLOCK(rtasd_log_lock); | 33 | static DEFINE_SPINLOCK(rtasd_log_lock); |
34 | 34 | ||
35 | DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait); | 35 | static DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait); |
36 | 36 | ||
37 | static char *rtas_log_buf; | 37 | static char *rtas_log_buf; |
38 | static unsigned long rtas_log_start; | 38 | static unsigned long rtas_log_start; |
@@ -329,7 +329,7 @@ static unsigned int rtas_log_poll(struct file *file, poll_table * wait) | |||
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | 331 | ||
332 | const struct file_operations proc_rtas_log_operations = { | 332 | static const struct file_operations proc_rtas_log_operations = { |
333 | .read = rtas_log_read, | 333 | .read = rtas_log_read, |
334 | .poll = rtas_log_poll, | 334 | .poll = rtas_log_poll, |
335 | .open = rtas_log_open, | 335 | .open = rtas_log_open, |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index f5d29f5b13c1..90beb444e1dd 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -109,7 +109,7 @@ static void __init fwnmi_init(void) | |||
109 | fwnmi_active = 1; | 109 | fwnmi_active = 1; |
110 | } | 110 | } |
111 | 111 | ||
112 | void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc) | 112 | static void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc) |
113 | { | 113 | { |
114 | unsigned int cascade_irq = i8259_irq(); | 114 | unsigned int cascade_irq = i8259_irq(); |
115 | if (cascade_irq != NO_IRQ) | 115 | if (cascade_irq != NO_IRQ) |
@@ -482,7 +482,7 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus) | |||
482 | * possible with power button press. If ibm,power-off-ups token is used | 482 | * possible with power button press. If ibm,power-off-ups token is used |
483 | * it will allow auto poweron after power is restored. | 483 | * it will allow auto poweron after power is restored. |
484 | */ | 484 | */ |
485 | void pSeries_power_off(void) | 485 | static void pSeries_power_off(void) |
486 | { | 486 | { |
487 | int rc; | 487 | int rc; |
488 | int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups"); | 488 | int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups"); |
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c index d272a52ecd24..de3e5e8bc324 100644 --- a/arch/powerpc/sysdev/mpic_msi.c +++ b/arch/powerpc/sysdev/mpic_msi.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/hw_irq.h> | 16 | #include <asm/hw_irq.h> |
17 | #include <asm/ppc-pci.h> | 17 | #include <asm/ppc-pci.h> |
18 | 18 | ||
19 | #include <sysdev/mpic.h> | ||
19 | 20 | ||
20 | static void __mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq) | 21 | static void __mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq) |
21 | { | 22 | { |
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c index 33cbfb22ce3e..68aff6076675 100644 --- a/arch/powerpc/sysdev/mpic_pasemi_msi.c +++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c | |||
@@ -95,6 +95,7 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
95 | unsigned int virq; | 95 | unsigned int virq; |
96 | struct msi_desc *entry; | 96 | struct msi_desc *entry; |
97 | struct msi_msg msg; | 97 | struct msi_msg msg; |
98 | int ret; | ||
98 | 99 | ||
99 | pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", | 100 | pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", |
100 | pdev, nvec, type); | 101 | pdev, nvec, type); |
@@ -108,8 +109,9 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
108 | * few MSIs for someone, but restrictions will apply to how the | 109 | * few MSIs for someone, but restrictions will apply to how the |
109 | * sources can be changed independently. | 110 | * sources can be changed independently. |
110 | */ | 111 | */ |
111 | hwirq = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK); | 112 | ret = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK); |
112 | if (hwirq < 0) { | 113 | hwirq = ret; |
114 | if (ret < 0) { | ||
113 | pr_debug("pasemi_msi: failed allocating hwirq\n"); | 115 | pr_debug("pasemi_msi: failed allocating hwirq\n"); |
114 | return hwirq; | 116 | return hwirq; |
115 | } | 117 | } |
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c index 1d5a40899b74..6e2f8686fdfc 100644 --- a/arch/powerpc/sysdev/mpic_u3msi.c +++ b/arch/powerpc/sysdev/mpic_u3msi.c | |||
@@ -115,17 +115,19 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
115 | struct msi_desc *entry; | 115 | struct msi_desc *entry; |
116 | struct msi_msg msg; | 116 | struct msi_msg msg; |
117 | u64 addr; | 117 | u64 addr; |
118 | int ret; | ||
118 | 119 | ||
119 | addr = find_ht_magic_addr(pdev); | 120 | addr = find_ht_magic_addr(pdev); |
120 | msg.address_lo = addr & 0xFFFFFFFF; | 121 | msg.address_lo = addr & 0xFFFFFFFF; |
121 | msg.address_hi = addr >> 32; | 122 | msg.address_hi = addr >> 32; |
122 | 123 | ||
123 | list_for_each_entry(entry, &pdev->msi_list, list) { | 124 | list_for_each_entry(entry, &pdev->msi_list, list) { |
124 | hwirq = mpic_msi_alloc_hwirqs(msi_mpic, 1); | 125 | ret = mpic_msi_alloc_hwirqs(msi_mpic, 1); |
125 | if (hwirq < 0) { | 126 | if (ret < 0) { |
126 | pr_debug("u3msi: failed allocating hwirq\n"); | 127 | pr_debug("u3msi: failed allocating hwirq\n"); |
127 | return hwirq; | 128 | return ret; |
128 | } | 129 | } |
130 | hwirq = ret; | ||
129 | 131 | ||
130 | virq = irq_create_mapping(msi_mpic->irqhost, hwirq); | 132 | virq = irq_create_mapping(msi_mpic->irqhost, hwirq); |
131 | if (virq == NO_IRQ) { | 133 | if (virq == NO_IRQ) { |
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index a132e0de8ca5..32e0ad0ebea8 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/console.h> | 15 | #include <linux/console.h> |
16 | #include <linux/mv643xx.h> | 16 | #include <linux/mv643xx.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/of_platform.h> | ||
18 | 19 | ||
19 | #include <asm/prom.h> | 20 | #include <asm/prom.h> |
20 | 21 | ||
@@ -25,6 +26,11 @@ | |||
25 | * PowerPC of_platform_bus_type. They support platform_bus_type instead. | 26 | * PowerPC of_platform_bus_type. They support platform_bus_type instead. |
26 | */ | 27 | */ |
27 | 28 | ||
29 | static struct of_device_id __initdata of_mv64x60_devices[] = { | ||
30 | { .compatible = "marvell,mv64306-devctrl", }, | ||
31 | {} | ||
32 | }; | ||
33 | |||
28 | /* | 34 | /* |
29 | * Create MPSC platform devices | 35 | * Create MPSC platform devices |
30 | */ | 36 | */ |
@@ -484,6 +490,10 @@ static int __init mv64x60_device_setup(void) | |||
484 | of_node_put(np); | 490 | of_node_put(np); |
485 | } | 491 | } |
486 | 492 | ||
493 | /* Now add every node that is on the device bus */ | ||
494 | for_each_compatible_node(np, NULL, "marvell,mv64360") | ||
495 | of_platform_bus_probe(np, of_mv64x60_devices, NULL); | ||
496 | |||
487 | return 0; | 497 | return 0; |
488 | } | 498 | } |
489 | arch_initcall(mv64x60_device_setup); | 499 | arch_initcall(mv64x60_device_setup); |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 1702de9395ee..6726da07c065 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #define skipbl xmon_skipbl | 54 | #define skipbl xmon_skipbl |
55 | 55 | ||
56 | #ifdef CONFIG_SMP | 56 | #ifdef CONFIG_SMP |
57 | cpumask_t cpus_in_xmon = CPU_MASK_NONE; | 57 | static cpumask_t cpus_in_xmon = CPU_MASK_NONE; |
58 | static unsigned long xmon_taken = 1; | 58 | static unsigned long xmon_taken = 1; |
59 | static int xmon_owner; | 59 | static int xmon_owner; |
60 | static int xmon_gate; | 60 | static int xmon_gate; |
@@ -154,7 +154,7 @@ static int do_spu_cmd(void); | |||
154 | static void dump_tlb_44x(void); | 154 | static void dump_tlb_44x(void); |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | int xmon_no_auto_backtrace; | 157 | static int xmon_no_auto_backtrace; |
158 | 158 | ||
159 | extern void xmon_enter(void); | 159 | extern void xmon_enter(void); |
160 | extern void xmon_leave(void); | 160 | extern void xmon_leave(void); |
@@ -327,6 +327,11 @@ static void release_output_lock(void) | |||
327 | { | 327 | { |
328 | xmon_speaker = 0; | 328 | xmon_speaker = 0; |
329 | } | 329 | } |
330 | |||
331 | int cpus_are_in_xmon(void) | ||
332 | { | ||
333 | return !cpus_empty(cpus_in_xmon); | ||
334 | } | ||
330 | #endif | 335 | #endif |
331 | 336 | ||
332 | static int xmon_core(struct pt_regs *regs, int fromipi) | 337 | static int xmon_core(struct pt_regs *regs, int fromipi) |
@@ -593,7 +598,7 @@ static int xmon_iabr_match(struct pt_regs *regs) | |||
593 | { | 598 | { |
594 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) | 599 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) |
595 | return 0; | 600 | return 0; |
596 | if (iabr == 0) | 601 | if (iabr == NULL) |
597 | return 0; | 602 | return 0; |
598 | xmon_core(regs, 0); | 603 | xmon_core(regs, 0); |
599 | return 1; | 604 | return 1; |
@@ -1142,7 +1147,7 @@ bpt_cmds(void) | |||
1142 | } else { | 1147 | } else { |
1143 | /* assume a breakpoint address */ | 1148 | /* assume a breakpoint address */ |
1144 | bp = at_breakpoint(a); | 1149 | bp = at_breakpoint(a); |
1145 | if (bp == 0) { | 1150 | if (bp == NULL) { |
1146 | printf("No breakpoint at %x\n", a); | 1151 | printf("No breakpoint at %x\n", a); |
1147 | break; | 1152 | break; |
1148 | } | 1153 | } |
@@ -1370,7 +1375,7 @@ static void print_bug_trap(struct pt_regs *regs) | |||
1370 | #endif | 1375 | #endif |
1371 | } | 1376 | } |
1372 | 1377 | ||
1373 | void excprint(struct pt_regs *fp) | 1378 | static void excprint(struct pt_regs *fp) |
1374 | { | 1379 | { |
1375 | unsigned long trap; | 1380 | unsigned long trap; |
1376 | 1381 | ||
@@ -1408,7 +1413,7 @@ void excprint(struct pt_regs *fp) | |||
1408 | print_bug_trap(fp); | 1413 | print_bug_trap(fp); |
1409 | } | 1414 | } |
1410 | 1415 | ||
1411 | void prregs(struct pt_regs *fp) | 1416 | static void prregs(struct pt_regs *fp) |
1412 | { | 1417 | { |
1413 | int n, trap; | 1418 | int n, trap; |
1414 | unsigned long base; | 1419 | unsigned long base; |
@@ -1463,7 +1468,7 @@ void prregs(struct pt_regs *fp) | |||
1463 | printf("dar = "REG" dsisr = %.8lx\n", fp->dar, fp->dsisr); | 1468 | printf("dar = "REG" dsisr = %.8lx\n", fp->dar, fp->dsisr); |
1464 | } | 1469 | } |
1465 | 1470 | ||
1466 | void cacheflush(void) | 1471 | static void cacheflush(void) |
1467 | { | 1472 | { |
1468 | int cmd; | 1473 | int cmd; |
1469 | unsigned long nflush; | 1474 | unsigned long nflush; |
@@ -1495,7 +1500,7 @@ void cacheflush(void) | |||
1495 | catch_memory_errors = 0; | 1500 | catch_memory_errors = 0; |
1496 | } | 1501 | } |
1497 | 1502 | ||
1498 | unsigned long | 1503 | static unsigned long |
1499 | read_spr(int n) | 1504 | read_spr(int n) |
1500 | { | 1505 | { |
1501 | unsigned int instrs[2]; | 1506 | unsigned int instrs[2]; |
@@ -1533,7 +1538,7 @@ read_spr(int n) | |||
1533 | return ret; | 1538 | return ret; |
1534 | } | 1539 | } |
1535 | 1540 | ||
1536 | void | 1541 | static void |
1537 | write_spr(int n, unsigned long val) | 1542 | write_spr(int n, unsigned long val) |
1538 | { | 1543 | { |
1539 | unsigned int instrs[2]; | 1544 | unsigned int instrs[2]; |
@@ -1571,7 +1576,7 @@ static unsigned long regno; | |||
1571 | extern char exc_prolog; | 1576 | extern char exc_prolog; |
1572 | extern char dec_exc; | 1577 | extern char dec_exc; |
1573 | 1578 | ||
1574 | void super_regs(void) | 1579 | static void super_regs(void) |
1575 | { | 1580 | { |
1576 | int cmd; | 1581 | int cmd; |
1577 | unsigned long val; | 1582 | unsigned long val; |
@@ -1629,7 +1634,7 @@ void super_regs(void) | |||
1629 | /* | 1634 | /* |
1630 | * Stuff for reading and writing memory safely | 1635 | * Stuff for reading and writing memory safely |
1631 | */ | 1636 | */ |
1632 | int | 1637 | static int |
1633 | mread(unsigned long adrs, void *buf, int size) | 1638 | mread(unsigned long adrs, void *buf, int size) |
1634 | { | 1639 | { |
1635 | volatile int n; | 1640 | volatile int n; |
@@ -1666,7 +1671,7 @@ mread(unsigned long adrs, void *buf, int size) | |||
1666 | return n; | 1671 | return n; |
1667 | } | 1672 | } |
1668 | 1673 | ||
1669 | int | 1674 | static int |
1670 | mwrite(unsigned long adrs, void *buf, int size) | 1675 | mwrite(unsigned long adrs, void *buf, int size) |
1671 | { | 1676 | { |
1672 | volatile int n; | 1677 | volatile int n; |
@@ -1731,7 +1736,7 @@ static int handle_fault(struct pt_regs *regs) | |||
1731 | 1736 | ||
1732 | #define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t)) | 1737 | #define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t)) |
1733 | 1738 | ||
1734 | void | 1739 | static void |
1735 | byterev(unsigned char *val, int size) | 1740 | byterev(unsigned char *val, int size) |
1736 | { | 1741 | { |
1737 | int t; | 1742 | int t; |
@@ -1793,7 +1798,7 @@ static char *memex_subcmd_help_string = | |||
1793 | " x exit this mode\n" | 1798 | " x exit this mode\n" |
1794 | ""; | 1799 | ""; |
1795 | 1800 | ||
1796 | void | 1801 | static void |
1797 | memex(void) | 1802 | memex(void) |
1798 | { | 1803 | { |
1799 | int cmd, inc, i, nslash; | 1804 | int cmd, inc, i, nslash; |
@@ -1944,7 +1949,7 @@ memex(void) | |||
1944 | } | 1949 | } |
1945 | } | 1950 | } |
1946 | 1951 | ||
1947 | int | 1952 | static int |
1948 | bsesc(void) | 1953 | bsesc(void) |
1949 | { | 1954 | { |
1950 | int c; | 1955 | int c; |
@@ -1984,7 +1989,7 @@ static void xmon_rawdump (unsigned long adrs, long ndump) | |||
1984 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ | 1989 | #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ |
1985 | || ('a' <= (c) && (c) <= 'f') \ | 1990 | || ('a' <= (c) && (c) <= 'f') \ |
1986 | || ('A' <= (c) && (c) <= 'F')) | 1991 | || ('A' <= (c) && (c) <= 'F')) |
1987 | void | 1992 | static void |
1988 | dump(void) | 1993 | dump(void) |
1989 | { | 1994 | { |
1990 | int c; | 1995 | int c; |
@@ -2022,7 +2027,7 @@ dump(void) | |||
2022 | } | 2027 | } |
2023 | } | 2028 | } |
2024 | 2029 | ||
2025 | void | 2030 | static void |
2026 | prdump(unsigned long adrs, long ndump) | 2031 | prdump(unsigned long adrs, long ndump) |
2027 | { | 2032 | { |
2028 | long n, m, c, r, nr; | 2033 | long n, m, c, r, nr; |
@@ -2066,7 +2071,7 @@ prdump(unsigned long adrs, long ndump) | |||
2066 | 2071 | ||
2067 | typedef int (*instruction_dump_func)(unsigned long inst, unsigned long addr); | 2072 | typedef int (*instruction_dump_func)(unsigned long inst, unsigned long addr); |
2068 | 2073 | ||
2069 | int | 2074 | static int |
2070 | generic_inst_dump(unsigned long adr, long count, int praddr, | 2075 | generic_inst_dump(unsigned long adr, long count, int praddr, |
2071 | instruction_dump_func dump_func) | 2076 | instruction_dump_func dump_func) |
2072 | { | 2077 | { |
@@ -2104,7 +2109,7 @@ generic_inst_dump(unsigned long adr, long count, int praddr, | |||
2104 | return adr - first_adr; | 2109 | return adr - first_adr; |
2105 | } | 2110 | } |
2106 | 2111 | ||
2107 | int | 2112 | static int |
2108 | ppc_inst_dump(unsigned long adr, long count, int praddr) | 2113 | ppc_inst_dump(unsigned long adr, long count, int praddr) |
2109 | { | 2114 | { |
2110 | return generic_inst_dump(adr, count, praddr, print_insn_powerpc); | 2115 | return generic_inst_dump(adr, count, praddr, print_insn_powerpc); |
@@ -2126,7 +2131,7 @@ static unsigned long mval; /* byte value to set memory to */ | |||
2126 | static unsigned long mcount; /* # bytes to affect */ | 2131 | static unsigned long mcount; /* # bytes to affect */ |
2127 | static unsigned long mdiffs; /* max # differences to print */ | 2132 | static unsigned long mdiffs; /* max # differences to print */ |
2128 | 2133 | ||
2129 | void | 2134 | static void |
2130 | memops(int cmd) | 2135 | memops(int cmd) |
2131 | { | 2136 | { |
2132 | scanhex((void *)&mdest); | 2137 | scanhex((void *)&mdest); |
@@ -2152,7 +2157,7 @@ memops(int cmd) | |||
2152 | } | 2157 | } |
2153 | } | 2158 | } |
2154 | 2159 | ||
2155 | void | 2160 | static void |
2156 | memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr) | 2161 | memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr) |
2157 | { | 2162 | { |
2158 | unsigned n, prt; | 2163 | unsigned n, prt; |
@@ -2170,7 +2175,7 @@ memdiffs(unsigned char *p1, unsigned char *p2, unsigned nb, unsigned maxpr) | |||
2170 | static unsigned mend; | 2175 | static unsigned mend; |
2171 | static unsigned mask; | 2176 | static unsigned mask; |
2172 | 2177 | ||
2173 | void | 2178 | static void |
2174 | memlocate(void) | 2179 | memlocate(void) |
2175 | { | 2180 | { |
2176 | unsigned a, n; | 2181 | unsigned a, n; |
@@ -2203,7 +2208,7 @@ memlocate(void) | |||
2203 | static unsigned long mskip = 0x1000; | 2208 | static unsigned long mskip = 0x1000; |
2204 | static unsigned long mlim = 0xffffffff; | 2209 | static unsigned long mlim = 0xffffffff; |
2205 | 2210 | ||
2206 | void | 2211 | static void |
2207 | memzcan(void) | 2212 | memzcan(void) |
2208 | { | 2213 | { |
2209 | unsigned char v; | 2214 | unsigned char v; |
@@ -2230,7 +2235,7 @@ memzcan(void) | |||
2230 | printf("%.8x\n", a - mskip); | 2235 | printf("%.8x\n", a - mskip); |
2231 | } | 2236 | } |
2232 | 2237 | ||
2233 | void proccall(void) | 2238 | static void proccall(void) |
2234 | { | 2239 | { |
2235 | unsigned long args[8]; | 2240 | unsigned long args[8]; |
2236 | unsigned long ret; | 2241 | unsigned long ret; |
@@ -2388,7 +2393,7 @@ scanhex(unsigned long *vp) | |||
2388 | return 1; | 2393 | return 1; |
2389 | } | 2394 | } |
2390 | 2395 | ||
2391 | void | 2396 | static void |
2392 | scannl(void) | 2397 | scannl(void) |
2393 | { | 2398 | { |
2394 | int c; | 2399 | int c; |
@@ -2399,7 +2404,7 @@ scannl(void) | |||
2399 | c = inchar(); | 2404 | c = inchar(); |
2400 | } | 2405 | } |
2401 | 2406 | ||
2402 | int hexdigit(int c) | 2407 | static int hexdigit(int c) |
2403 | { | 2408 | { |
2404 | if( '0' <= c && c <= '9' ) | 2409 | if( '0' <= c && c <= '9' ) |
2405 | return c - '0'; | 2410 | return c - '0'; |
@@ -2430,13 +2435,13 @@ getstring(char *s, int size) | |||
2430 | static char line[256]; | 2435 | static char line[256]; |
2431 | static char *lineptr; | 2436 | static char *lineptr; |
2432 | 2437 | ||
2433 | void | 2438 | static void |
2434 | flush_input(void) | 2439 | flush_input(void) |
2435 | { | 2440 | { |
2436 | lineptr = NULL; | 2441 | lineptr = NULL; |
2437 | } | 2442 | } |
2438 | 2443 | ||
2439 | int | 2444 | static int |
2440 | inchar(void) | 2445 | inchar(void) |
2441 | { | 2446 | { |
2442 | if (lineptr == NULL || *lineptr == 0) { | 2447 | if (lineptr == NULL || *lineptr == 0) { |
@@ -2449,7 +2454,7 @@ inchar(void) | |||
2449 | return *lineptr++; | 2454 | return *lineptr++; |
2450 | } | 2455 | } |
2451 | 2456 | ||
2452 | void | 2457 | static void |
2453 | take_input(char *str) | 2458 | take_input(char *str) |
2454 | { | 2459 | { |
2455 | lineptr = str; | 2460 | lineptr = str; |
@@ -2618,7 +2623,8 @@ static void dump_tlb_44x(void) | |||
2618 | } | 2623 | } |
2619 | } | 2624 | } |
2620 | #endif /* CONFIG_44x */ | 2625 | #endif /* CONFIG_44x */ |
2621 | void xmon_init(int enable) | 2626 | |
2627 | static void xmon_init(int enable) | ||
2622 | { | 2628 | { |
2623 | #ifdef CONFIG_PPC_ISERIES | 2629 | #ifdef CONFIG_PPC_ISERIES |
2624 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | 2630 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index 5f3a5d068a5c..fcd830a292e2 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -647,7 +647,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ | |||
647 | /* Check current_thread_info()->flags */ | 647 | /* Check current_thread_info()->flags */ |
648 | rlwinm r9,r1,0,0,18 | 648 | rlwinm r9,r1,0,0,18 |
649 | lwz r9,TI_FLAGS(r9) | 649 | lwz r9,TI_FLAGS(r9) |
650 | andi. r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED) | 650 | andi. r0,r9,_TIF_USER_WORK_MASK |
651 | bne do_work | 651 | bne do_work |
652 | 652 | ||
653 | restore_user: | 653 | restore_user: |
@@ -898,7 +898,7 @@ recheck: | |||
898 | lwz r9,TI_FLAGS(r9) | 898 | lwz r9,TI_FLAGS(r9) |
899 | andi. r0,r9,_TIF_NEED_RESCHED | 899 | andi. r0,r9,_TIF_NEED_RESCHED |
900 | bne- do_resched | 900 | bne- do_resched |
901 | andi. r0,r9,_TIF_SIGPENDING | 901 | andi. r0,r9,_TIF_USER_WORK_MASK |
902 | beq restore_user | 902 | beq restore_user |
903 | do_user_signal: /* r10 contains MSR_KERNEL here */ | 903 | do_user_signal: /* r10 contains MSR_KERNEL here */ |
904 | ori r10,r10,MSR_EE | 904 | ori r10,r10,MSR_EE |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 44160d5ebca0..2f9759d625cc 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -675,12 +675,6 @@ static int hvc_poll(struct hvc_struct *hp) | |||
675 | return poll_mask; | 675 | return poll_mask; |
676 | } | 676 | } |
677 | 677 | ||
678 | #if defined(CONFIG_XMON) && defined(CONFIG_SMP) | ||
679 | extern cpumask_t cpus_in_xmon; | ||
680 | #else | ||
681 | static const cpumask_t cpus_in_xmon = CPU_MASK_NONE; | ||
682 | #endif | ||
683 | |||
684 | /* | 678 | /* |
685 | * This kthread is either polling or interrupt driven. This is determined by | 679 | * This kthread is either polling or interrupt driven. This is determined by |
686 | * calling hvc_poll() who determines whether a console adapter support | 680 | * calling hvc_poll() who determines whether a console adapter support |
@@ -698,7 +692,7 @@ static int khvcd(void *unused) | |||
698 | hvc_kicked = 0; | 692 | hvc_kicked = 0; |
699 | try_to_freeze(); | 693 | try_to_freeze(); |
700 | wmb(); | 694 | wmb(); |
701 | if (cpus_empty(cpus_in_xmon)) { | 695 | if (!cpus_are_in_xmon()) { |
702 | spin_lock(&hvc_structs_lock); | 696 | spin_lock(&hvc_structs_lock); |
703 | list_for_each_entry(hp, &hvc_structs, next) { | 697 | list_for_each_entry(hp, &hvc_structs, next) { |
704 | poll_mask |= hvc_poll(hp); | 698 | poll_mask |= hvc_poll(hp); |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 8c59818050e6..42ffb17e15df 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -60,4 +60,14 @@ extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, | |||
60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ | 60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ |
61 | extern int __devexit hvc_remove(struct hvc_struct *hp); | 61 | extern int __devexit hvc_remove(struct hvc_struct *hp); |
62 | 62 | ||
63 | |||
64 | #if defined(CONFIG_XMON) && defined(CONFIG_SMP) | ||
65 | #include <asm/xmon.h> | ||
66 | #else | ||
67 | static inline int cpus_are_in_xmon(void) | ||
68 | { | ||
69 | return 0; | ||
70 | } | ||
71 | #endif | ||
72 | |||
63 | #endif // HVC_CONSOLE_H | 73 | #endif // HVC_CONSOLE_H |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 112e5ef728f1..9e9453b58425 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
@@ -44,7 +44,7 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | |||
44 | struct of_device *ofdev = to_of_device(dev); | 44 | struct of_device *ofdev = to_of_device(dev); |
45 | int len; | 45 | int len; |
46 | 46 | ||
47 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE); | 47 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2); |
48 | 48 | ||
49 | buf[len] = '\n'; | 49 | buf[len] = '\n'; |
50 | buf[len+1] = 0; | 50 | buf[len+1] = 0; |
@@ -52,6 +52,15 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | |||
52 | return len+1; | 52 | return len+1; |
53 | } | 53 | } |
54 | 54 | ||
55 | static ssize_t devspec_show(struct device *dev, | ||
56 | struct device_attribute *attr, char *buf) | ||
57 | { | ||
58 | struct of_device *ofdev; | ||
59 | |||
60 | ofdev = to_of_device(dev); | ||
61 | return sprintf(buf, "%s\n", ofdev->node->full_name); | ||
62 | } | ||
63 | |||
55 | macio_config_of_attr (name, "%s\n"); | 64 | macio_config_of_attr (name, "%s\n"); |
56 | macio_config_of_attr (type, "%s\n"); | 65 | macio_config_of_attr (type, "%s\n"); |
57 | 66 | ||
@@ -60,5 +69,6 @@ struct device_attribute macio_dev_attrs[] = { | |||
60 | __ATTR_RO(type), | 69 | __ATTR_RO(type), |
61 | __ATTR_RO(compatible), | 70 | __ATTR_RO(compatible), |
62 | __ATTR_RO(modalias), | 71 | __ATTR_RO(modalias), |
72 | __ATTR_RO(devspec), | ||
63 | __ATTR_NULL | 73 | __ATTR_NULL |
64 | }; | 74 | }; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9f6cc8a56073..02d5165b147c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1884,7 +1884,6 @@ config NE_H8300 | |||
1884 | Say Y here if you want to use the NE2000 compatible | 1884 | Say Y here if you want to use the NE2000 compatible |
1885 | controller on the Renesas H8/300 processor. | 1885 | controller on the Renesas H8/300 processor. |
1886 | 1886 | ||
1887 | source "drivers/net/fec_8xx/Kconfig" | ||
1888 | source "drivers/net/fs_enet/Kconfig" | 1887 | source "drivers/net/fs_enet/Kconfig" |
1889 | 1888 | ||
1890 | endif # NET_ETHERNET | 1889 | endif # NET_ETHERNET |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index dcbfe8421154..9010e58da0f2 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -217,7 +217,6 @@ obj-$(CONFIG_SMC91X) += smc91x.o | |||
217 | obj-$(CONFIG_SMC911X) += smc911x.o | 217 | obj-$(CONFIG_SMC911X) += smc911x.o |
218 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o | 218 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o |
219 | obj-$(CONFIG_DM9000) += dm9000.o | 219 | obj-$(CONFIG_DM9000) += dm9000.o |
220 | obj-$(CONFIG_FEC_8XX) += fec_8xx/ | ||
221 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o | 220 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o |
222 | pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o | 221 | pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o |
223 | obj-$(CONFIG_MLX4_CORE) += mlx4/ | 222 | obj-$(CONFIG_MLX4_CORE) += mlx4/ |
diff --git a/drivers/net/fec_8xx/Kconfig b/drivers/net/fec_8xx/Kconfig deleted file mode 100644 index afb34ded26ee..000000000000 --- a/drivers/net/fec_8xx/Kconfig +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | config FEC_8XX | ||
2 | tristate "Motorola 8xx FEC driver" | ||
3 | depends on 8XX | ||
4 | select MII | ||
5 | |||
6 | config FEC_8XX_GENERIC_PHY | ||
7 | bool "Support any generic PHY" | ||
8 | depends on FEC_8XX | ||
9 | default y | ||
10 | |||
11 | config FEC_8XX_DM9161_PHY | ||
12 | bool "Support DM9161 PHY" | ||
13 | depends on FEC_8XX | ||
14 | default n | ||
15 | |||
16 | config FEC_8XX_LXT971_PHY | ||
17 | bool "Support LXT971/LXT972 PHY" | ||
18 | depends on FEC_8XX | ||
19 | default n | ||
20 | |||
diff --git a/drivers/net/fec_8xx/Makefile b/drivers/net/fec_8xx/Makefile deleted file mode 100644 index 70c54f8c48e5..000000000000 --- a/drivers/net/fec_8xx/Makefile +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the Motorola 8xx FEC ethernet controller | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_FEC_8XX) += fec_8xx.o | ||
6 | |||
7 | fec_8xx-objs := fec_main.o fec_mii.o | ||
8 | |||
9 | # the platform instantatiation objects | ||
10 | ifeq ($(CONFIG_NETTA),y) | ||
11 | fec_8xx-objs += fec_8xx-netta.o | ||
12 | endif | ||
diff --git a/drivers/net/fec_8xx/fec_8xx-netta.c b/drivers/net/fec_8xx/fec_8xx-netta.c deleted file mode 100644 index 79deee222e28..000000000000 --- a/drivers/net/fec_8xx/fec_8xx-netta.c +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * FEC instantatiation file for NETTA | ||
3 | */ | ||
4 | |||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/string.h> | ||
8 | #include <linux/ptrace.h> | ||
9 | #include <linux/errno.h> | ||
10 | #include <linux/ioport.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/netdevice.h> | ||
17 | #include <linux/etherdevice.h> | ||
18 | #include <linux/skbuff.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/mii.h> | ||
21 | #include <linux/ethtool.h> | ||
22 | #include <linux/bitops.h> | ||
23 | |||
24 | #include <asm/8xx_immap.h> | ||
25 | #include <asm/pgtable.h> | ||
26 | #include <asm/mpc8xx.h> | ||
27 | #include <asm/irq.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/cpm1.h> | ||
30 | |||
31 | #include "fec_8xx.h" | ||
32 | |||
33 | /*************************************************/ | ||
34 | |||
35 | static struct fec_platform_info fec1_info = { | ||
36 | .fec_no = 0, | ||
37 | .use_mdio = 1, | ||
38 | .phy_addr = 8, | ||
39 | .fec_irq = SIU_LEVEL1, | ||
40 | .phy_irq = CPM_IRQ_OFFSET + CPMVEC_PIO_PC6, | ||
41 | .rx_ring = 128, | ||
42 | .tx_ring = 16, | ||
43 | .rx_copybreak = 240, | ||
44 | .use_napi = 1, | ||
45 | .napi_weight = 17, | ||
46 | }; | ||
47 | |||
48 | static struct fec_platform_info fec2_info = { | ||
49 | .fec_no = 1, | ||
50 | .use_mdio = 1, | ||
51 | .phy_addr = 2, | ||
52 | .fec_irq = SIU_LEVEL3, | ||
53 | .phy_irq = CPM_IRQ_OFFSET + CPMVEC_PIO_PC7, | ||
54 | .rx_ring = 128, | ||
55 | .tx_ring = 16, | ||
56 | .rx_copybreak = 240, | ||
57 | .use_napi = 1, | ||
58 | .napi_weight = 17, | ||
59 | }; | ||
60 | |||
61 | static struct net_device *fec1_dev; | ||
62 | static struct net_device *fec2_dev; | ||
63 | |||
64 | /* XXX custom u-boot & Linux startup needed */ | ||
65 | extern const char *__fw_getenv(const char *var); | ||
66 | |||
67 | /* access ports */ | ||
68 | #define setbits32(_addr, _v) __fec_out32(&(_addr), __fec_in32(&(_addr)) | (_v)) | ||
69 | #define clrbits32(_addr, _v) __fec_out32(&(_addr), __fec_in32(&(_addr)) & ~(_v)) | ||
70 | |||
71 | #define setbits16(_addr, _v) __fec_out16(&(_addr), __fec_in16(&(_addr)) | (_v)) | ||
72 | #define clrbits16(_addr, _v) __fec_out16(&(_addr), __fec_in16(&(_addr)) & ~(_v)) | ||
73 | |||
74 | int fec_8xx_platform_init(void) | ||
75 | { | ||
76 | immap_t *immap = (immap_t *)IMAP_ADDR; | ||
77 | bd_t *bd = (bd_t *) __res; | ||
78 | const char *s; | ||
79 | char *e; | ||
80 | int i; | ||
81 | |||
82 | /* use MDC for MII */ | ||
83 | setbits16(immap->im_ioport.iop_pdpar, 0x0080); | ||
84 | clrbits16(immap->im_ioport.iop_pddir, 0x0080); | ||
85 | |||
86 | /* configure FEC1 pins */ | ||
87 | setbits16(immap->im_ioport.iop_papar, 0xe810); | ||
88 | setbits16(immap->im_ioport.iop_padir, 0x0810); | ||
89 | clrbits16(immap->im_ioport.iop_padir, 0xe000); | ||
90 | |||
91 | setbits32(immap->im_cpm.cp_pbpar, 0x00000001); | ||
92 | clrbits32(immap->im_cpm.cp_pbdir, 0x00000001); | ||
93 | |||
94 | setbits32(immap->im_cpm.cp_cptr, 0x00000100); | ||
95 | clrbits32(immap->im_cpm.cp_cptr, 0x00000050); | ||
96 | |||
97 | clrbits16(immap->im_ioport.iop_pcpar, 0x0200); | ||
98 | clrbits16(immap->im_ioport.iop_pcdir, 0x0200); | ||
99 | clrbits16(immap->im_ioport.iop_pcso, 0x0200); | ||
100 | setbits16(immap->im_ioport.iop_pcint, 0x0200); | ||
101 | |||
102 | /* configure FEC2 pins */ | ||
103 | setbits32(immap->im_cpm.cp_pepar, 0x00039620); | ||
104 | setbits32(immap->im_cpm.cp_pedir, 0x00039620); | ||
105 | setbits32(immap->im_cpm.cp_peso, 0x00031000); | ||
106 | clrbits32(immap->im_cpm.cp_peso, 0x00008620); | ||
107 | |||
108 | setbits32(immap->im_cpm.cp_cptr, 0x00000080); | ||
109 | clrbits32(immap->im_cpm.cp_cptr, 0x00000028); | ||
110 | |||
111 | clrbits16(immap->im_ioport.iop_pcpar, 0x0200); | ||
112 | clrbits16(immap->im_ioport.iop_pcdir, 0x0200); | ||
113 | clrbits16(immap->im_ioport.iop_pcso, 0x0200); | ||
114 | setbits16(immap->im_ioport.iop_pcint, 0x0200); | ||
115 | |||
116 | /* fill up */ | ||
117 | fec1_info.sys_clk = bd->bi_intfreq; | ||
118 | fec2_info.sys_clk = bd->bi_intfreq; | ||
119 | |||
120 | s = __fw_getenv("ethaddr"); | ||
121 | if (s != NULL) { | ||
122 | for (i = 0; i < 6; i++) { | ||
123 | fec1_info.macaddr[i] = simple_strtoul(s, &e, 16); | ||
124 | if (*e) | ||
125 | s = e + 1; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | s = __fw_getenv("eth1addr"); | ||
130 | if (s != NULL) { | ||
131 | for (i = 0; i < 6; i++) { | ||
132 | fec2_info.macaddr[i] = simple_strtoul(s, &e, 16); | ||
133 | if (*e) | ||
134 | s = e + 1; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | fec_8xx_init_one(&fec1_info, &fec1_dev); | ||
139 | fec_8xx_init_one(&fec2_info, &fec2_dev); | ||
140 | |||
141 | return fec1_dev != NULL && fec2_dev != NULL ? 0 : -1; | ||
142 | } | ||
143 | |||
144 | void fec_8xx_platform_cleanup(void) | ||
145 | { | ||
146 | if (fec2_dev != NULL) | ||
147 | fec_8xx_cleanup_one(fec2_dev); | ||
148 | |||
149 | if (fec1_dev != NULL) | ||
150 | fec_8xx_cleanup_one(fec1_dev); | ||
151 | } | ||
diff --git a/drivers/net/fec_8xx/fec_8xx.h b/drivers/net/fec_8xx/fec_8xx.h deleted file mode 100644 index f3b1c6fbba8b..000000000000 --- a/drivers/net/fec_8xx/fec_8xx.h +++ /dev/null | |||
@@ -1,220 +0,0 @@ | |||
1 | #ifndef FEC_8XX_H | ||
2 | #define FEC_8XX_H | ||
3 | |||
4 | #include <linux/mii.h> | ||
5 | #include <linux/netdevice.h> | ||
6 | |||
7 | #include <linux/types.h> | ||
8 | |||
9 | /* HW info */ | ||
10 | |||
11 | /* CRC polynomium used by the FEC for the multicast group filtering */ | ||
12 | #define FEC_CRC_POLY 0x04C11DB7 | ||
13 | |||
14 | #define MII_ADVERTISE_HALF (ADVERTISE_100HALF | \ | ||
15 | ADVERTISE_10HALF | ADVERTISE_CSMA) | ||
16 | #define MII_ADVERTISE_ALL (ADVERTISE_100FULL | \ | ||
17 | ADVERTISE_10FULL | MII_ADVERTISE_HALF) | ||
18 | |||
19 | /* Interrupt events/masks. | ||
20 | */ | ||
21 | #define FEC_ENET_HBERR 0x80000000U /* Heartbeat error */ | ||
22 | #define FEC_ENET_BABR 0x40000000U /* Babbling receiver */ | ||
23 | #define FEC_ENET_BABT 0x20000000U /* Babbling transmitter */ | ||
24 | #define FEC_ENET_GRA 0x10000000U /* Graceful stop complete */ | ||
25 | #define FEC_ENET_TXF 0x08000000U /* Full frame transmitted */ | ||
26 | #define FEC_ENET_TXB 0x04000000U /* A buffer was transmitted */ | ||
27 | #define FEC_ENET_RXF 0x02000000U /* Full frame received */ | ||
28 | #define FEC_ENET_RXB 0x01000000U /* A buffer was received */ | ||
29 | #define FEC_ENET_MII 0x00800000U /* MII interrupt */ | ||
30 | #define FEC_ENET_EBERR 0x00400000U /* SDMA bus error */ | ||
31 | |||
32 | #define FEC_ECNTRL_PINMUX 0x00000004 | ||
33 | #define FEC_ECNTRL_ETHER_EN 0x00000002 | ||
34 | #define FEC_ECNTRL_RESET 0x00000001 | ||
35 | |||
36 | #define FEC_RCNTRL_BC_REJ 0x00000010 | ||
37 | #define FEC_RCNTRL_PROM 0x00000008 | ||
38 | #define FEC_RCNTRL_MII_MODE 0x00000004 | ||
39 | #define FEC_RCNTRL_DRT 0x00000002 | ||
40 | #define FEC_RCNTRL_LOOP 0x00000001 | ||
41 | |||
42 | #define FEC_TCNTRL_FDEN 0x00000004 | ||
43 | #define FEC_TCNTRL_HBC 0x00000002 | ||
44 | #define FEC_TCNTRL_GTS 0x00000001 | ||
45 | |||
46 | /* values for MII phy_status */ | ||
47 | |||
48 | #define PHY_CONF_ANE 0x0001 /* 1 auto-negotiation enabled */ | ||
49 | #define PHY_CONF_LOOP 0x0002 /* 1 loopback mode enabled */ | ||
50 | #define PHY_CONF_SPMASK 0x00f0 /* mask for speed */ | ||
51 | #define PHY_CONF_10HDX 0x0010 /* 10 Mbit half duplex supported */ | ||
52 | #define PHY_CONF_10FDX 0x0020 /* 10 Mbit full duplex supported */ | ||
53 | #define PHY_CONF_100HDX 0x0040 /* 100 Mbit half duplex supported */ | ||
54 | #define PHY_CONF_100FDX 0x0080 /* 100 Mbit full duplex supported */ | ||
55 | |||
56 | #define PHY_STAT_LINK 0x0100 /* 1 up - 0 down */ | ||
57 | #define PHY_STAT_FAULT 0x0200 /* 1 remote fault */ | ||
58 | #define PHY_STAT_ANC 0x0400 /* 1 auto-negotiation complete */ | ||
59 | #define PHY_STAT_SPMASK 0xf000 /* mask for speed */ | ||
60 | #define PHY_STAT_10HDX 0x1000 /* 10 Mbit half duplex selected */ | ||
61 | #define PHY_STAT_10FDX 0x2000 /* 10 Mbit full duplex selected */ | ||
62 | #define PHY_STAT_100HDX 0x4000 /* 100 Mbit half duplex selected */ | ||
63 | #define PHY_STAT_100FDX 0x8000 /* 100 Mbit full duplex selected */ | ||
64 | |||
65 | typedef struct phy_info { | ||
66 | unsigned int id; | ||
67 | const char *name; | ||
68 | void (*startup) (struct net_device * dev); | ||
69 | void (*shutdown) (struct net_device * dev); | ||
70 | void (*ack_int) (struct net_device * dev); | ||
71 | } phy_info_t; | ||
72 | |||
73 | /* The FEC stores dest/src/type, data, and checksum for receive packets. | ||
74 | */ | ||
75 | #define MAX_MTU 1508 /* Allow fullsized pppoe packets over VLAN */ | ||
76 | #define MIN_MTU 46 /* this is data size */ | ||
77 | #define CRC_LEN 4 | ||
78 | |||
79 | #define PKT_MAXBUF_SIZE (MAX_MTU+ETH_HLEN+CRC_LEN) | ||
80 | #define PKT_MINBUF_SIZE (MIN_MTU+ETH_HLEN+CRC_LEN) | ||
81 | |||
82 | /* Must be a multiple of 4 */ | ||
83 | #define PKT_MAXBLR_SIZE ((PKT_MAXBUF_SIZE+3) & ~3) | ||
84 | /* This is needed so that invalidate_xxx wont invalidate too much */ | ||
85 | #define ENET_RX_FRSIZE L1_CACHE_ALIGN(PKT_MAXBUF_SIZE) | ||
86 | |||
87 | /* platform interface */ | ||
88 | |||
89 | struct fec_platform_info { | ||
90 | int fec_no; /* FEC index */ | ||
91 | int use_mdio; /* use external MII */ | ||
92 | int phy_addr; /* the phy address */ | ||
93 | int fec_irq, phy_irq; /* the irq for the controller */ | ||
94 | int rx_ring, tx_ring; /* number of buffers on rx */ | ||
95 | int sys_clk; /* system clock */ | ||
96 | __u8 macaddr[6]; /* mac address */ | ||
97 | int rx_copybreak; /* limit we copy small frames */ | ||
98 | int use_napi; /* use NAPI */ | ||
99 | int napi_weight; /* NAPI weight */ | ||
100 | }; | ||
101 | |||
102 | /* forward declaration */ | ||
103 | struct fec; | ||
104 | |||
105 | struct fec_enet_private { | ||
106 | spinlock_t lock; /* during all ops except TX pckt processing */ | ||
107 | spinlock_t tx_lock; /* during fec_start_xmit and fec_tx */ | ||
108 | struct net_device *dev; | ||
109 | struct napi_struct napi; | ||
110 | int fecno; | ||
111 | struct fec *fecp; | ||
112 | const struct fec_platform_info *fpi; | ||
113 | int rx_ring, tx_ring; | ||
114 | dma_addr_t ring_mem_addr; | ||
115 | void *ring_base; | ||
116 | struct sk_buff **rx_skbuff; | ||
117 | struct sk_buff **tx_skbuff; | ||
118 | cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ | ||
119 | cbd_t *tx_bd_base; | ||
120 | cbd_t *dirty_tx; /* ring entries to be free()ed. */ | ||
121 | cbd_t *cur_rx; | ||
122 | cbd_t *cur_tx; | ||
123 | int tx_free; | ||
124 | struct net_device_stats stats; | ||
125 | struct timer_list phy_timer_list; | ||
126 | const struct phy_info *phy; | ||
127 | unsigned int fec_phy_speed; | ||
128 | __u32 msg_enable; | ||
129 | struct mii_if_info mii_if; | ||
130 | }; | ||
131 | |||
132 | /***************************************************************************/ | ||
133 | |||
134 | void fec_restart(struct net_device *dev, int duplex, int speed); | ||
135 | void fec_stop(struct net_device *dev); | ||
136 | |||
137 | /***************************************************************************/ | ||
138 | |||
139 | int fec_mii_read(struct net_device *dev, int phy_id, int location); | ||
140 | void fec_mii_write(struct net_device *dev, int phy_id, int location, int value); | ||
141 | |||
142 | int fec_mii_phy_id_detect(struct net_device *dev); | ||
143 | void fec_mii_startup(struct net_device *dev); | ||
144 | void fec_mii_shutdown(struct net_device *dev); | ||
145 | void fec_mii_ack_int(struct net_device *dev); | ||
146 | |||
147 | void fec_mii_link_status_change_check(struct net_device *dev, int init_media); | ||
148 | |||
149 | /***************************************************************************/ | ||
150 | |||
151 | #define FEC1_NO 0x00 | ||
152 | #define FEC2_NO 0x01 | ||
153 | #define FEC3_NO 0x02 | ||
154 | |||
155 | int fec_8xx_init_one(const struct fec_platform_info *fpi, | ||
156 | struct net_device **devp); | ||
157 | int fec_8xx_cleanup_one(struct net_device *dev); | ||
158 | |||
159 | /***************************************************************************/ | ||
160 | |||
161 | #define DRV_MODULE_NAME "fec_8xx" | ||
162 | #define PFX DRV_MODULE_NAME ": " | ||
163 | #define DRV_MODULE_VERSION "0.1" | ||
164 | #define DRV_MODULE_RELDATE "May 6, 2004" | ||
165 | |||
166 | /***************************************************************************/ | ||
167 | |||
168 | int fec_8xx_platform_init(void); | ||
169 | void fec_8xx_platform_cleanup(void); | ||
170 | |||
171 | /***************************************************************************/ | ||
172 | |||
173 | /* FEC access macros */ | ||
174 | #if defined(CONFIG_8xx) | ||
175 | /* for a 8xx __raw_xxx's are sufficient */ | ||
176 | #define __fec_out32(addr, x) __raw_writel(x, addr) | ||
177 | #define __fec_out16(addr, x) __raw_writew(x, addr) | ||
178 | #define __fec_in32(addr) __raw_readl(addr) | ||
179 | #define __fec_in16(addr) __raw_readw(addr) | ||
180 | #else | ||
181 | /* for others play it safe */ | ||
182 | #define __fec_out32(addr, x) out_be32(addr, x) | ||
183 | #define __fec_out16(addr, x) out_be16(addr, x) | ||
184 | #define __fec_in32(addr) in_be32(addr) | ||
185 | #define __fec_in16(addr) in_be16(addr) | ||
186 | #endif | ||
187 | |||
188 | /* write */ | ||
189 | #define FW(_fecp, _reg, _v) __fec_out32(&(_fecp)->fec_ ## _reg, (_v)) | ||
190 | |||
191 | /* read */ | ||
192 | #define FR(_fecp, _reg) __fec_in32(&(_fecp)->fec_ ## _reg) | ||
193 | |||
194 | /* set bits */ | ||
195 | #define FS(_fecp, _reg, _v) FW(_fecp, _reg, FR(_fecp, _reg) | (_v)) | ||
196 | |||
197 | /* clear bits */ | ||
198 | #define FC(_fecp, _reg, _v) FW(_fecp, _reg, FR(_fecp, _reg) & ~(_v)) | ||
199 | |||
200 | /* buffer descriptor access macros */ | ||
201 | |||
202 | /* write */ | ||
203 | #define CBDW_SC(_cbd, _sc) __fec_out16(&(_cbd)->cbd_sc, (_sc)) | ||
204 | #define CBDW_DATLEN(_cbd, _datlen) __fec_out16(&(_cbd)->cbd_datlen, (_datlen)) | ||
205 | #define CBDW_BUFADDR(_cbd, _bufaddr) __fec_out32(&(_cbd)->cbd_bufaddr, (_bufaddr)) | ||
206 | |||
207 | /* read */ | ||
208 | #define CBDR_SC(_cbd) __fec_in16(&(_cbd)->cbd_sc) | ||
209 | #define CBDR_DATLEN(_cbd) __fec_in16(&(_cbd)->cbd_datlen) | ||
210 | #define CBDR_BUFADDR(_cbd) __fec_in32(&(_cbd)->cbd_bufaddr) | ||
211 | |||
212 | /* set bits */ | ||
213 | #define CBDS_SC(_cbd, _sc) CBDW_SC(_cbd, CBDR_SC(_cbd) | (_sc)) | ||
214 | |||
215 | /* clear bits */ | ||
216 | #define CBDC_SC(_cbd, _sc) CBDW_SC(_cbd, CBDR_SC(_cbd) & ~(_sc)) | ||
217 | |||
218 | /***************************************************************************/ | ||
219 | |||
220 | #endif | ||
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c deleted file mode 100644 index ca8d2e83ab03..000000000000 --- a/drivers/net/fec_8xx/fec_main.c +++ /dev/null | |||
@@ -1,1264 +0,0 @@ | |||
1 | /* | ||
2 | * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. | ||
3 | * | ||
4 | * Copyright (c) 2003 Intracom S.A. | ||
5 | * by Pantelis Antoniou <panto@intracom.gr> | ||
6 | * | ||
7 | * Heavily based on original FEC driver by Dan Malek <dan@embeddededge.com> | ||
8 | * and modifications by Joakim Tjernlund <joakim.tjernlund@lumentis.se> | ||
9 | * | ||
10 | * Released under the GPL | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/ptrace.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/netdevice.h> | ||
25 | #include <linux/etherdevice.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/mii.h> | ||
29 | #include <linux/ethtool.h> | ||
30 | #include <linux/bitops.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | |||
33 | #include <asm/8xx_immap.h> | ||
34 | #include <asm/pgtable.h> | ||
35 | #include <asm/mpc8xx.h> | ||
36 | #include <asm/irq.h> | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <asm/cpm1.h> | ||
39 | |||
40 | #include "fec_8xx.h" | ||
41 | |||
42 | /*************************************************/ | ||
43 | |||
44 | #define FEC_MAX_MULTICAST_ADDRS 64 | ||
45 | |||
46 | /*************************************************/ | ||
47 | |||
48 | static char version[] __devinitdata = | ||
49 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")" "\n"; | ||
50 | |||
51 | MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); | ||
52 | MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); | ||
53 | MODULE_LICENSE("GPL"); | ||
54 | |||
55 | int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ | ||
56 | module_param(fec_8xx_debug, int, 0); | ||
57 | MODULE_PARM_DESC(fec_8xx_debug, | ||
58 | "FEC 8xx bitmapped debugging message enable value"); | ||
59 | |||
60 | |||
61 | /*************************************************/ | ||
62 | |||
63 | /* | ||
64 | * Delay to wait for FEC reset command to complete (in us) | ||
65 | */ | ||
66 | #define FEC_RESET_DELAY 50 | ||
67 | |||
68 | /*****************************************************************************************/ | ||
69 | |||
70 | static void fec_whack_reset(fec_t * fecp) | ||
71 | { | ||
72 | int i; | ||
73 | |||
74 | /* | ||
75 | * Whack a reset. We should wait for this. | ||
76 | */ | ||
77 | FW(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET); | ||
78 | for (i = 0; | ||
79 | (FR(fecp, ecntrl) & FEC_ECNTRL_RESET) != 0 && i < FEC_RESET_DELAY; | ||
80 | i++) | ||
81 | udelay(1); | ||
82 | |||
83 | if (i == FEC_RESET_DELAY) | ||
84 | printk(KERN_WARNING "FEC Reset timeout!\n"); | ||
85 | |||
86 | } | ||
87 | |||
88 | /****************************************************************************/ | ||
89 | |||
90 | /* | ||
91 | * Transmitter timeout. | ||
92 | */ | ||
93 | #define TX_TIMEOUT (2*HZ) | ||
94 | |||
95 | /****************************************************************************/ | ||
96 | |||
97 | /* | ||
98 | * Returns the CRC needed when filling in the hash table for | ||
99 | * multicast group filtering | ||
100 | * pAddr must point to a MAC address (6 bytes) | ||
101 | */ | ||
102 | static __u32 fec_mulicast_calc_crc(char *pAddr) | ||
103 | { | ||
104 | u8 byte; | ||
105 | int byte_count; | ||
106 | int bit_count; | ||
107 | __u32 crc = 0xffffffff; | ||
108 | u8 msb; | ||
109 | |||
110 | for (byte_count = 0; byte_count < 6; byte_count++) { | ||
111 | byte = pAddr[byte_count]; | ||
112 | for (bit_count = 0; bit_count < 8; bit_count++) { | ||
113 | msb = crc >> 31; | ||
114 | crc <<= 1; | ||
115 | if (msb ^ (byte & 0x1)) { | ||
116 | crc ^= FEC_CRC_POLY; | ||
117 | } | ||
118 | byte >>= 1; | ||
119 | } | ||
120 | } | ||
121 | return (crc); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Set or clear the multicast filter for this adaptor. | ||
126 | * Skeleton taken from sunlance driver. | ||
127 | * The CPM Ethernet implementation allows Multicast as well as individual | ||
128 | * MAC address filtering. Some of the drivers check to make sure it is | ||
129 | * a group multicast address, and discard those that are not. I guess I | ||
130 | * will do the same for now, but just remove the test if you want | ||
131 | * individual filtering as well (do the upper net layers want or support | ||
132 | * this kind of feature?). | ||
133 | */ | ||
134 | static void fec_set_multicast_list(struct net_device *dev) | ||
135 | { | ||
136 | struct fec_enet_private *fep = netdev_priv(dev); | ||
137 | fec_t *fecp = fep->fecp; | ||
138 | struct dev_mc_list *pmc; | ||
139 | __u32 crc; | ||
140 | int temp; | ||
141 | __u32 csrVal; | ||
142 | int hash_index; | ||
143 | __u32 hthi, htlo; | ||
144 | unsigned long flags; | ||
145 | |||
146 | |||
147 | if ((dev->flags & IFF_PROMISC) != 0) { | ||
148 | |||
149 | spin_lock_irqsave(&fep->lock, flags); | ||
150 | FS(fecp, r_cntrl, FEC_RCNTRL_PROM); | ||
151 | spin_unlock_irqrestore(&fep->lock, flags); | ||
152 | |||
153 | /* | ||
154 | * Log any net taps. | ||
155 | */ | ||
156 | printk(KERN_WARNING DRV_MODULE_NAME | ||
157 | ": %s: Promiscuous mode enabled.\n", dev->name); | ||
158 | return; | ||
159 | |||
160 | } | ||
161 | |||
162 | if ((dev->flags & IFF_ALLMULTI) != 0 || | ||
163 | dev->mc_count > FEC_MAX_MULTICAST_ADDRS) { | ||
164 | /* | ||
165 | * Catch all multicast addresses, set the filter to all 1's. | ||
166 | */ | ||
167 | hthi = 0xffffffffU; | ||
168 | htlo = 0xffffffffU; | ||
169 | } else { | ||
170 | hthi = 0; | ||
171 | htlo = 0; | ||
172 | |||
173 | /* | ||
174 | * Now populate the hash table | ||
175 | */ | ||
176 | for (pmc = dev->mc_list; pmc != NULL; pmc = pmc->next) { | ||
177 | crc = fec_mulicast_calc_crc(pmc->dmi_addr); | ||
178 | temp = (crc & 0x3f) >> 1; | ||
179 | hash_index = ((temp & 0x01) << 4) | | ||
180 | ((temp & 0x02) << 2) | | ||
181 | ((temp & 0x04)) | | ||
182 | ((temp & 0x08) >> 2) | | ||
183 | ((temp & 0x10) >> 4); | ||
184 | csrVal = (1 << hash_index); | ||
185 | if (crc & 1) | ||
186 | hthi |= csrVal; | ||
187 | else | ||
188 | htlo |= csrVal; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | spin_lock_irqsave(&fep->lock, flags); | ||
193 | FC(fecp, r_cntrl, FEC_RCNTRL_PROM); | ||
194 | FW(fecp, hash_table_high, hthi); | ||
195 | FW(fecp, hash_table_low, htlo); | ||
196 | spin_unlock_irqrestore(&fep->lock, flags); | ||
197 | } | ||
198 | |||
199 | static int fec_set_mac_address(struct net_device *dev, void *addr) | ||
200 | { | ||
201 | struct sockaddr *mac = addr; | ||
202 | struct fec_enet_private *fep = netdev_priv(dev); | ||
203 | struct fec *fecp = fep->fecp; | ||
204 | int i; | ||
205 | __u32 addrhi, addrlo; | ||
206 | unsigned long flags; | ||
207 | |||
208 | /* Get pointer to SCC area in parameter RAM. */ | ||
209 | for (i = 0; i < 6; i++) | ||
210 | dev->dev_addr[i] = mac->sa_data[i]; | ||
211 | |||
212 | /* | ||
213 | * Set station address. | ||
214 | */ | ||
215 | addrhi = ((__u32) dev->dev_addr[0] << 24) | | ||
216 | ((__u32) dev->dev_addr[1] << 16) | | ||
217 | ((__u32) dev->dev_addr[2] << 8) | | ||
218 | (__u32) dev->dev_addr[3]; | ||
219 | addrlo = ((__u32) dev->dev_addr[4] << 24) | | ||
220 | ((__u32) dev->dev_addr[5] << 16); | ||
221 | |||
222 | spin_lock_irqsave(&fep->lock, flags); | ||
223 | FW(fecp, addr_low, addrhi); | ||
224 | FW(fecp, addr_high, addrlo); | ||
225 | spin_unlock_irqrestore(&fep->lock, flags); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | /* | ||
231 | * This function is called to start or restart the FEC during a link | ||
232 | * change. This only happens when switching between half and full | ||
233 | * duplex. | ||
234 | */ | ||
235 | void fec_restart(struct net_device *dev, int duplex, int speed) | ||
236 | { | ||
237 | #ifdef CONFIG_DUET | ||
238 | immap_t *immap = (immap_t *) IMAP_ADDR; | ||
239 | __u32 cptr; | ||
240 | #endif | ||
241 | struct fec_enet_private *fep = netdev_priv(dev); | ||
242 | struct fec *fecp = fep->fecp; | ||
243 | const struct fec_platform_info *fpi = fep->fpi; | ||
244 | cbd_t *bdp; | ||
245 | struct sk_buff *skb; | ||
246 | int i; | ||
247 | __u32 addrhi, addrlo; | ||
248 | |||
249 | fec_whack_reset(fep->fecp); | ||
250 | |||
251 | /* | ||
252 | * Set station address. | ||
253 | */ | ||
254 | addrhi = ((__u32) dev->dev_addr[0] << 24) | | ||
255 | ((__u32) dev->dev_addr[1] << 16) | | ||
256 | ((__u32) dev->dev_addr[2] << 8) | | ||
257 | (__u32) dev->dev_addr[3]; | ||
258 | addrlo = ((__u32) dev->dev_addr[4] << 24) | | ||
259 | ((__u32) dev->dev_addr[5] << 16); | ||
260 | FW(fecp, addr_low, addrhi); | ||
261 | FW(fecp, addr_high, addrlo); | ||
262 | |||
263 | /* | ||
264 | * Reset all multicast. | ||
265 | */ | ||
266 | FW(fecp, hash_table_high, 0); | ||
267 | FW(fecp, hash_table_low, 0); | ||
268 | |||
269 | /* | ||
270 | * Set maximum receive buffer size. | ||
271 | */ | ||
272 | FW(fecp, r_buff_size, PKT_MAXBLR_SIZE); | ||
273 | FW(fecp, r_hash, PKT_MAXBUF_SIZE); | ||
274 | |||
275 | /* | ||
276 | * Set receive and transmit descriptor base. | ||
277 | */ | ||
278 | FW(fecp, r_des_start, iopa((__u32) (fep->rx_bd_base))); | ||
279 | FW(fecp, x_des_start, iopa((__u32) (fep->tx_bd_base))); | ||
280 | |||
281 | fep->dirty_tx = fep->cur_tx = fep->tx_bd_base; | ||
282 | fep->tx_free = fep->tx_ring; | ||
283 | fep->cur_rx = fep->rx_bd_base; | ||
284 | |||
285 | /* | ||
286 | * Reset SKB receive buffers | ||
287 | */ | ||
288 | for (i = 0; i < fep->rx_ring; i++) { | ||
289 | if ((skb = fep->rx_skbuff[i]) == NULL) | ||
290 | continue; | ||
291 | fep->rx_skbuff[i] = NULL; | ||
292 | dev_kfree_skb(skb); | ||
293 | } | ||
294 | |||
295 | /* | ||
296 | * Initialize the receive buffer descriptors. | ||
297 | */ | ||
298 | for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) { | ||
299 | skb = dev_alloc_skb(ENET_RX_FRSIZE); | ||
300 | if (skb == NULL) { | ||
301 | printk(KERN_WARNING DRV_MODULE_NAME | ||
302 | ": %s Memory squeeze, unable to allocate skb\n", | ||
303 | dev->name); | ||
304 | fep->stats.rx_dropped++; | ||
305 | break; | ||
306 | } | ||
307 | fep->rx_skbuff[i] = skb; | ||
308 | skb->dev = dev; | ||
309 | CBDW_BUFADDR(bdp, dma_map_single(NULL, skb->data, | ||
310 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | ||
311 | DMA_FROM_DEVICE)); | ||
312 | CBDW_DATLEN(bdp, 0); /* zero */ | ||
313 | CBDW_SC(bdp, BD_ENET_RX_EMPTY | | ||
314 | ((i < fep->rx_ring - 1) ? 0 : BD_SC_WRAP)); | ||
315 | } | ||
316 | /* | ||
317 | * if we failed, fillup remainder | ||
318 | */ | ||
319 | for (; i < fep->rx_ring; i++, bdp++) { | ||
320 | fep->rx_skbuff[i] = NULL; | ||
321 | CBDW_SC(bdp, (i < fep->rx_ring - 1) ? 0 : BD_SC_WRAP); | ||
322 | } | ||
323 | |||
324 | /* | ||
325 | * Reset SKB transmit buffers. | ||
326 | */ | ||
327 | for (i = 0; i < fep->tx_ring; i++) { | ||
328 | if ((skb = fep->tx_skbuff[i]) == NULL) | ||
329 | continue; | ||
330 | fep->tx_skbuff[i] = NULL; | ||
331 | dev_kfree_skb(skb); | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * ...and the same for transmit. | ||
336 | */ | ||
337 | for (i = 0, bdp = fep->tx_bd_base; i < fep->tx_ring; i++, bdp++) { | ||
338 | fep->tx_skbuff[i] = NULL; | ||
339 | CBDW_BUFADDR(bdp, virt_to_bus(NULL)); | ||
340 | CBDW_DATLEN(bdp, 0); | ||
341 | CBDW_SC(bdp, (i < fep->tx_ring - 1) ? 0 : BD_SC_WRAP); | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * Enable big endian and don't care about SDMA FC. | ||
346 | */ | ||
347 | FW(fecp, fun_code, 0x78000000); | ||
348 | |||
349 | /* | ||
350 | * Set MII speed. | ||
351 | */ | ||
352 | FW(fecp, mii_speed, fep->fec_phy_speed); | ||
353 | |||
354 | /* | ||
355 | * Clear any outstanding interrupt. | ||
356 | */ | ||
357 | FW(fecp, ievent, 0xffc0); | ||
358 | FW(fecp, ivec, (fpi->fec_irq / 2) << 29); | ||
359 | |||
360 | /* | ||
361 | * adjust to speed (only for DUET & RMII) | ||
362 | */ | ||
363 | #ifdef CONFIG_DUET | ||
364 | cptr = in_be32(&immap->im_cpm.cp_cptr); | ||
365 | switch (fpi->fec_no) { | ||
366 | case 0: | ||
367 | /* | ||
368 | * check if in RMII mode | ||
369 | */ | ||
370 | if ((cptr & 0x100) == 0) | ||
371 | break; | ||
372 | |||
373 | if (speed == 10) | ||
374 | cptr |= 0x0000010; | ||
375 | else if (speed == 100) | ||
376 | cptr &= ~0x0000010; | ||
377 | break; | ||
378 | case 1: | ||
379 | /* | ||
380 | * check if in RMII mode | ||
381 | */ | ||
382 | if ((cptr & 0x80) == 0) | ||
383 | break; | ||
384 | |||
385 | if (speed == 10) | ||
386 | cptr |= 0x0000008; | ||
387 | else if (speed == 100) | ||
388 | cptr &= ~0x0000008; | ||
389 | break; | ||
390 | default: | ||
391 | break; | ||
392 | } | ||
393 | out_be32(&immap->im_cpm.cp_cptr, cptr); | ||
394 | #endif | ||
395 | |||
396 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
397 | /* | ||
398 | * adjust to duplex mode | ||
399 | */ | ||
400 | if (duplex) { | ||
401 | FC(fecp, r_cntrl, FEC_RCNTRL_DRT); | ||
402 | FS(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD enable */ | ||
403 | } else { | ||
404 | FS(fecp, r_cntrl, FEC_RCNTRL_DRT); | ||
405 | FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */ | ||
406 | } | ||
407 | |||
408 | /* | ||
409 | * Enable interrupts we wish to service. | ||
410 | */ | ||
411 | FW(fecp, imask, FEC_ENET_TXF | FEC_ENET_TXB | | ||
412 | FEC_ENET_RXF | FEC_ENET_RXB); | ||
413 | |||
414 | /* | ||
415 | * And last, enable the transmit and receive processing. | ||
416 | */ | ||
417 | FW(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
418 | FW(fecp, r_des_active, 0x01000000); | ||
419 | } | ||
420 | |||
421 | void fec_stop(struct net_device *dev) | ||
422 | { | ||
423 | struct fec_enet_private *fep = netdev_priv(dev); | ||
424 | fec_t *fecp = fep->fecp; | ||
425 | struct sk_buff *skb; | ||
426 | int i; | ||
427 | |||
428 | if ((FR(fecp, ecntrl) & FEC_ECNTRL_ETHER_EN) == 0) | ||
429 | return; /* already down */ | ||
430 | |||
431 | FW(fecp, x_cntrl, 0x01); /* Graceful transmit stop */ | ||
432 | for (i = 0; ((FR(fecp, ievent) & 0x10000000) == 0) && | ||
433 | i < FEC_RESET_DELAY; i++) | ||
434 | udelay(1); | ||
435 | |||
436 | if (i == FEC_RESET_DELAY) | ||
437 | printk(KERN_WARNING DRV_MODULE_NAME | ||
438 | ": %s FEC timeout on graceful transmit stop\n", | ||
439 | dev->name); | ||
440 | /* | ||
441 | * Disable FEC. Let only MII interrupts. | ||
442 | */ | ||
443 | FW(fecp, imask, 0); | ||
444 | FW(fecp, ecntrl, ~FEC_ECNTRL_ETHER_EN); | ||
445 | |||
446 | /* | ||
447 | * Reset SKB transmit buffers. | ||
448 | */ | ||
449 | for (i = 0; i < fep->tx_ring; i++) { | ||
450 | if ((skb = fep->tx_skbuff[i]) == NULL) | ||
451 | continue; | ||
452 | fep->tx_skbuff[i] = NULL; | ||
453 | dev_kfree_skb(skb); | ||
454 | } | ||
455 | |||
456 | /* | ||
457 | * Reset SKB receive buffers | ||
458 | */ | ||
459 | for (i = 0; i < fep->rx_ring; i++) { | ||
460 | if ((skb = fep->rx_skbuff[i]) == NULL) | ||
461 | continue; | ||
462 | fep->rx_skbuff[i] = NULL; | ||
463 | dev_kfree_skb(skb); | ||
464 | } | ||
465 | } | ||
466 | |||
467 | /* common receive function */ | ||
468 | static int fec_enet_rx_common(struct fec_enet_private *ep, | ||
469 | struct net_device *dev, int budget) | ||
470 | { | ||
471 | fec_t *fecp = fep->fecp; | ||
472 | const struct fec_platform_info *fpi = fep->fpi; | ||
473 | cbd_t *bdp; | ||
474 | struct sk_buff *skb, *skbn, *skbt; | ||
475 | int received = 0; | ||
476 | __u16 pkt_len, sc; | ||
477 | int curidx; | ||
478 | |||
479 | /* | ||
480 | * First, grab all of the stats for the incoming packet. | ||
481 | * These get messed up if we get called due to a busy condition. | ||
482 | */ | ||
483 | bdp = fep->cur_rx; | ||
484 | |||
485 | /* clear RX status bits for napi*/ | ||
486 | if (fpi->use_napi) | ||
487 | FW(fecp, ievent, FEC_ENET_RXF | FEC_ENET_RXB); | ||
488 | |||
489 | while (((sc = CBDR_SC(bdp)) & BD_ENET_RX_EMPTY) == 0) { | ||
490 | |||
491 | curidx = bdp - fep->rx_bd_base; | ||
492 | |||
493 | /* | ||
494 | * Since we have allocated space to hold a complete frame, | ||
495 | * the last indicator should be set. | ||
496 | */ | ||
497 | if ((sc & BD_ENET_RX_LAST) == 0) | ||
498 | printk(KERN_WARNING DRV_MODULE_NAME | ||
499 | ": %s rcv is not +last\n", | ||
500 | dev->name); | ||
501 | |||
502 | /* | ||
503 | * Check for errors. | ||
504 | */ | ||
505 | if (sc & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_CL | | ||
506 | BD_ENET_RX_NO | BD_ENET_RX_CR | BD_ENET_RX_OV)) { | ||
507 | fep->stats.rx_errors++; | ||
508 | /* Frame too long or too short. */ | ||
509 | if (sc & (BD_ENET_RX_LG | BD_ENET_RX_SH)) | ||
510 | fep->stats.rx_length_errors++; | ||
511 | /* Frame alignment */ | ||
512 | if (sc & (BD_ENET_RX_NO | BD_ENET_RX_CL)) | ||
513 | fep->stats.rx_frame_errors++; | ||
514 | /* CRC Error */ | ||
515 | if (sc & BD_ENET_RX_CR) | ||
516 | fep->stats.rx_crc_errors++; | ||
517 | /* FIFO overrun */ | ||
518 | if (sc & BD_ENET_RX_OV) | ||
519 | fep->stats.rx_crc_errors++; | ||
520 | |||
521 | skbn = fep->rx_skbuff[curidx]; | ||
522 | BUG_ON(skbn == NULL); | ||
523 | |||
524 | } else { | ||
525 | skb = fep->rx_skbuff[curidx]; | ||
526 | BUG_ON(skb == NULL); | ||
527 | |||
528 | /* | ||
529 | * Process the incoming frame. | ||
530 | */ | ||
531 | fep->stats.rx_packets++; | ||
532 | pkt_len = CBDR_DATLEN(bdp) - 4; /* remove CRC */ | ||
533 | fep->stats.rx_bytes += pkt_len + 4; | ||
534 | |||
535 | if (pkt_len <= fpi->rx_copybreak) { | ||
536 | /* +2 to make IP header L1 cache aligned */ | ||
537 | skbn = dev_alloc_skb(pkt_len + 2); | ||
538 | if (skbn != NULL) { | ||
539 | skb_reserve(skbn, 2); /* align IP header */ | ||
540 | skb_copy_from_linear_data(skb, | ||
541 | skbn->data, | ||
542 | pkt_len); | ||
543 | /* swap */ | ||
544 | skbt = skb; | ||
545 | skb = skbn; | ||
546 | skbn = skbt; | ||
547 | } | ||
548 | } else | ||
549 | skbn = dev_alloc_skb(ENET_RX_FRSIZE); | ||
550 | |||
551 | if (skbn != NULL) { | ||
552 | skb_put(skb, pkt_len); /* Make room */ | ||
553 | skb->protocol = eth_type_trans(skb, dev); | ||
554 | received++; | ||
555 | if (!fpi->use_napi) | ||
556 | netif_rx(skb); | ||
557 | else | ||
558 | netif_receive_skb(skb); | ||
559 | } else { | ||
560 | printk(KERN_WARNING DRV_MODULE_NAME | ||
561 | ": %s Memory squeeze, dropping packet.\n", | ||
562 | dev->name); | ||
563 | fep->stats.rx_dropped++; | ||
564 | skbn = skb; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | fep->rx_skbuff[curidx] = skbn; | ||
569 | CBDW_BUFADDR(bdp, dma_map_single(NULL, skbn->data, | ||
570 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | ||
571 | DMA_FROM_DEVICE)); | ||
572 | CBDW_DATLEN(bdp, 0); | ||
573 | CBDW_SC(bdp, (sc & ~BD_ENET_RX_STATS) | BD_ENET_RX_EMPTY); | ||
574 | |||
575 | /* | ||
576 | * Update BD pointer to next entry. | ||
577 | */ | ||
578 | if ((sc & BD_ENET_RX_WRAP) == 0) | ||
579 | bdp++; | ||
580 | else | ||
581 | bdp = fep->rx_bd_base; | ||
582 | |||
583 | /* | ||
584 | * Doing this here will keep the FEC running while we process | ||
585 | * incoming frames. On a heavily loaded network, we should be | ||
586 | * able to keep up at the expense of system resources. | ||
587 | */ | ||
588 | FW(fecp, r_des_active, 0x01000000); | ||
589 | |||
590 | if (received >= budget) | ||
591 | break; | ||
592 | |||
593 | } | ||
594 | |||
595 | fep->cur_rx = bdp; | ||
596 | |||
597 | if (fpi->use_napi) { | ||
598 | if (received < budget) { | ||
599 | netif_rx_complete(dev, &fep->napi); | ||
600 | |||
601 | /* enable RX interrupt bits */ | ||
602 | FS(fecp, imask, FEC_ENET_RXF | FEC_ENET_RXB); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | return received; | ||
607 | } | ||
608 | |||
609 | static void fec_enet_tx(struct net_device *dev) | ||
610 | { | ||
611 | struct fec_enet_private *fep = netdev_priv(dev); | ||
612 | cbd_t *bdp; | ||
613 | struct sk_buff *skb; | ||
614 | int dirtyidx, do_wake; | ||
615 | __u16 sc; | ||
616 | |||
617 | spin_lock(&fep->lock); | ||
618 | bdp = fep->dirty_tx; | ||
619 | |||
620 | do_wake = 0; | ||
621 | while (((sc = CBDR_SC(bdp)) & BD_ENET_TX_READY) == 0) { | ||
622 | |||
623 | dirtyidx = bdp - fep->tx_bd_base; | ||
624 | |||
625 | if (fep->tx_free == fep->tx_ring) | ||
626 | break; | ||
627 | |||
628 | skb = fep->tx_skbuff[dirtyidx]; | ||
629 | |||
630 | /* | ||
631 | * Check for errors. | ||
632 | */ | ||
633 | if (sc & (BD_ENET_TX_HB | BD_ENET_TX_LC | | ||
634 | BD_ENET_TX_RL | BD_ENET_TX_UN | BD_ENET_TX_CSL)) { | ||
635 | fep->stats.tx_errors++; | ||
636 | if (sc & BD_ENET_TX_HB) /* No heartbeat */ | ||
637 | fep->stats.tx_heartbeat_errors++; | ||
638 | if (sc & BD_ENET_TX_LC) /* Late collision */ | ||
639 | fep->stats.tx_window_errors++; | ||
640 | if (sc & BD_ENET_TX_RL) /* Retrans limit */ | ||
641 | fep->stats.tx_aborted_errors++; | ||
642 | if (sc & BD_ENET_TX_UN) /* Underrun */ | ||
643 | fep->stats.tx_fifo_errors++; | ||
644 | if (sc & BD_ENET_TX_CSL) /* Carrier lost */ | ||
645 | fep->stats.tx_carrier_errors++; | ||
646 | } else | ||
647 | fep->stats.tx_packets++; | ||
648 | |||
649 | if (sc & BD_ENET_TX_READY) | ||
650 | printk(KERN_WARNING DRV_MODULE_NAME | ||
651 | ": %s HEY! Enet xmit interrupt and TX_READY.\n", | ||
652 | dev->name); | ||
653 | |||
654 | /* | ||
655 | * Deferred means some collisions occurred during transmit, | ||
656 | * but we eventually sent the packet OK. | ||
657 | */ | ||
658 | if (sc & BD_ENET_TX_DEF) | ||
659 | fep->stats.collisions++; | ||
660 | |||
661 | /* | ||
662 | * Free the sk buffer associated with this last transmit. | ||
663 | */ | ||
664 | dev_kfree_skb_irq(skb); | ||
665 | fep->tx_skbuff[dirtyidx] = NULL; | ||
666 | |||
667 | /* | ||
668 | * Update pointer to next buffer descriptor to be transmitted. | ||
669 | */ | ||
670 | if ((sc & BD_ENET_TX_WRAP) == 0) | ||
671 | bdp++; | ||
672 | else | ||
673 | bdp = fep->tx_bd_base; | ||
674 | |||
675 | /* | ||
676 | * Since we have freed up a buffer, the ring is no longer | ||
677 | * full. | ||
678 | */ | ||
679 | if (!fep->tx_free++) | ||
680 | do_wake = 1; | ||
681 | } | ||
682 | |||
683 | fep->dirty_tx = bdp; | ||
684 | |||
685 | spin_unlock(&fep->lock); | ||
686 | |||
687 | if (do_wake && netif_queue_stopped(dev)) | ||
688 | netif_wake_queue(dev); | ||
689 | } | ||
690 | |||
691 | /* | ||
692 | * The interrupt handler. | ||
693 | * This is called from the MPC core interrupt. | ||
694 | */ | ||
695 | static irqreturn_t | ||
696 | fec_enet_interrupt(int irq, void *dev_id) | ||
697 | { | ||
698 | struct net_device *dev = dev_id; | ||
699 | struct fec_enet_private *fep; | ||
700 | const struct fec_platform_info *fpi; | ||
701 | fec_t *fecp; | ||
702 | __u32 int_events; | ||
703 | __u32 int_events_napi; | ||
704 | |||
705 | if (unlikely(dev == NULL)) | ||
706 | return IRQ_NONE; | ||
707 | |||
708 | fep = netdev_priv(dev); | ||
709 | fecp = fep->fecp; | ||
710 | fpi = fep->fpi; | ||
711 | |||
712 | /* | ||
713 | * Get the interrupt events that caused us to be here. | ||
714 | */ | ||
715 | while ((int_events = FR(fecp, ievent) & FR(fecp, imask)) != 0) { | ||
716 | |||
717 | if (!fpi->use_napi) | ||
718 | FW(fecp, ievent, int_events); | ||
719 | else { | ||
720 | int_events_napi = int_events & ~(FEC_ENET_RXF | FEC_ENET_RXB); | ||
721 | FW(fecp, ievent, int_events_napi); | ||
722 | } | ||
723 | |||
724 | if ((int_events & (FEC_ENET_HBERR | FEC_ENET_BABR | | ||
725 | FEC_ENET_BABT | FEC_ENET_EBERR)) != 0) | ||
726 | printk(KERN_WARNING DRV_MODULE_NAME | ||
727 | ": %s FEC ERROR(s) 0x%x\n", | ||
728 | dev->name, int_events); | ||
729 | |||
730 | if ((int_events & FEC_ENET_RXF) != 0) { | ||
731 | if (!fpi->use_napi) | ||
732 | fec_enet_rx_common(fep, dev, ~0); | ||
733 | else { | ||
734 | if (netif_rx_schedule_prep(dev, &fep->napi)) { | ||
735 | /* disable rx interrupts */ | ||
736 | FC(fecp, imask, FEC_ENET_RXF | FEC_ENET_RXB); | ||
737 | __netif_rx_schedule(dev, &fep->napi); | ||
738 | } else { | ||
739 | printk(KERN_ERR DRV_MODULE_NAME | ||
740 | ": %s driver bug! interrupt while in poll!\n", | ||
741 | dev->name); | ||
742 | FC(fecp, imask, FEC_ENET_RXF | FEC_ENET_RXB); | ||
743 | } | ||
744 | } | ||
745 | } | ||
746 | |||
747 | if ((int_events & FEC_ENET_TXF) != 0) | ||
748 | fec_enet_tx(dev); | ||
749 | } | ||
750 | |||
751 | return IRQ_HANDLED; | ||
752 | } | ||
753 | |||
754 | /* This interrupt occurs when the PHY detects a link change. */ | ||
755 | static irqreturn_t | ||
756 | fec_mii_link_interrupt(int irq, void *dev_id) | ||
757 | { | ||
758 | struct net_device *dev = dev_id; | ||
759 | struct fec_enet_private *fep; | ||
760 | const struct fec_platform_info *fpi; | ||
761 | |||
762 | if (unlikely(dev == NULL)) | ||
763 | return IRQ_NONE; | ||
764 | |||
765 | fep = netdev_priv(dev); | ||
766 | fpi = fep->fpi; | ||
767 | |||
768 | if (!fpi->use_mdio) | ||
769 | return IRQ_NONE; | ||
770 | |||
771 | /* | ||
772 | * Acknowledge the interrupt if possible. If we have not | ||
773 | * found the PHY yet we can't process or acknowledge the | ||
774 | * interrupt now. Instead we ignore this interrupt for now, | ||
775 | * which we can do since it is edge triggered. It will be | ||
776 | * acknowledged later by fec_enet_open(). | ||
777 | */ | ||
778 | if (!fep->phy) | ||
779 | return IRQ_NONE; | ||
780 | |||
781 | fec_mii_ack_int(dev); | ||
782 | fec_mii_link_status_change_check(dev, 0); | ||
783 | |||
784 | return IRQ_HANDLED; | ||
785 | } | ||
786 | |||
787 | |||
788 | /**********************************************************************************/ | ||
789 | |||
790 | static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
791 | { | ||
792 | struct fec_enet_private *fep = netdev_priv(dev); | ||
793 | fec_t *fecp = fep->fecp; | ||
794 | cbd_t *bdp; | ||
795 | int curidx; | ||
796 | unsigned long flags; | ||
797 | |||
798 | spin_lock_irqsave(&fep->tx_lock, flags); | ||
799 | |||
800 | /* | ||
801 | * Fill in a Tx ring entry | ||
802 | */ | ||
803 | bdp = fep->cur_tx; | ||
804 | |||
805 | if (!fep->tx_free || (CBDR_SC(bdp) & BD_ENET_TX_READY)) { | ||
806 | netif_stop_queue(dev); | ||
807 | spin_unlock_irqrestore(&fep->tx_lock, flags); | ||
808 | |||
809 | /* | ||
810 | * Ooops. All transmit buffers are full. Bail out. | ||
811 | * This should not happen, since the tx queue should be stopped. | ||
812 | */ | ||
813 | printk(KERN_WARNING DRV_MODULE_NAME | ||
814 | ": %s tx queue full!.\n", dev->name); | ||
815 | return 1; | ||
816 | } | ||
817 | |||
818 | curidx = bdp - fep->tx_bd_base; | ||
819 | /* | ||
820 | * Clear all of the status flags. | ||
821 | */ | ||
822 | CBDC_SC(bdp, BD_ENET_TX_STATS); | ||
823 | |||
824 | /* | ||
825 | * Save skb pointer. | ||
826 | */ | ||
827 | fep->tx_skbuff[curidx] = skb; | ||
828 | |||
829 | fep->stats.tx_bytes += skb->len; | ||
830 | |||
831 | /* | ||
832 | * Push the data cache so the CPM does not get stale memory data. | ||
833 | */ | ||
834 | CBDW_BUFADDR(bdp, dma_map_single(NULL, skb->data, | ||
835 | skb->len, DMA_TO_DEVICE)); | ||
836 | CBDW_DATLEN(bdp, skb->len); | ||
837 | |||
838 | dev->trans_start = jiffies; | ||
839 | |||
840 | /* | ||
841 | * If this was the last BD in the ring, start at the beginning again. | ||
842 | */ | ||
843 | if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0) | ||
844 | fep->cur_tx++; | ||
845 | else | ||
846 | fep->cur_tx = fep->tx_bd_base; | ||
847 | |||
848 | if (!--fep->tx_free) | ||
849 | netif_stop_queue(dev); | ||
850 | |||
851 | /* | ||
852 | * Trigger transmission start | ||
853 | */ | ||
854 | CBDS_SC(bdp, BD_ENET_TX_READY | BD_ENET_TX_INTR | | ||
855 | BD_ENET_TX_LAST | BD_ENET_TX_TC); | ||
856 | FW(fecp, x_des_active, 0x01000000); | ||
857 | |||
858 | spin_unlock_irqrestore(&fep->tx_lock, flags); | ||
859 | |||
860 | return 0; | ||
861 | } | ||
862 | |||
863 | static void fec_timeout(struct net_device *dev) | ||
864 | { | ||
865 | struct fec_enet_private *fep = netdev_priv(dev); | ||
866 | |||
867 | fep->stats.tx_errors++; | ||
868 | |||
869 | if (fep->tx_free) | ||
870 | netif_wake_queue(dev); | ||
871 | |||
872 | /* check link status again */ | ||
873 | fec_mii_link_status_change_check(dev, 0); | ||
874 | } | ||
875 | |||
876 | static int fec_enet_open(struct net_device *dev) | ||
877 | { | ||
878 | struct fec_enet_private *fep = netdev_priv(dev); | ||
879 | const struct fec_platform_info *fpi = fep->fpi; | ||
880 | unsigned long flags; | ||
881 | |||
882 | napi_enable(&fep->napi); | ||
883 | |||
884 | /* Install our interrupt handler. */ | ||
885 | if (request_irq(fpi->fec_irq, fec_enet_interrupt, 0, "fec", dev) != 0) { | ||
886 | printk(KERN_ERR DRV_MODULE_NAME | ||
887 | ": %s Could not allocate FEC IRQ!", dev->name); | ||
888 | napi_disable(&fep->napi); | ||
889 | return -EINVAL; | ||
890 | } | ||
891 | |||
892 | /* Install our phy interrupt handler */ | ||
893 | if (fpi->phy_irq != -1 && | ||
894 | request_irq(fpi->phy_irq, fec_mii_link_interrupt, 0, "fec-phy", | ||
895 | dev) != 0) { | ||
896 | printk(KERN_ERR DRV_MODULE_NAME | ||
897 | ": %s Could not allocate PHY IRQ!", dev->name); | ||
898 | free_irq(fpi->fec_irq, dev); | ||
899 | napi_disable(&fep->napi); | ||
900 | return -EINVAL; | ||
901 | } | ||
902 | |||
903 | if (fpi->use_mdio) { | ||
904 | fec_mii_startup(dev); | ||
905 | netif_carrier_off(dev); | ||
906 | fec_mii_link_status_change_check(dev, 1); | ||
907 | } else { | ||
908 | spin_lock_irqsave(&fep->lock, flags); | ||
909 | fec_restart(dev, 1, 100); /* XXX this sucks */ | ||
910 | spin_unlock_irqrestore(&fep->lock, flags); | ||
911 | |||
912 | netif_carrier_on(dev); | ||
913 | netif_start_queue(dev); | ||
914 | } | ||
915 | return 0; | ||
916 | } | ||
917 | |||
918 | static int fec_enet_close(struct net_device *dev) | ||
919 | { | ||
920 | struct fec_enet_private *fep = netdev_priv(dev); | ||
921 | const struct fec_platform_info *fpi = fep->fpi; | ||
922 | unsigned long flags; | ||
923 | |||
924 | netif_stop_queue(dev); | ||
925 | napi_disable(&fep->napi); | ||
926 | netif_carrier_off(dev); | ||
927 | |||
928 | if (fpi->use_mdio) | ||
929 | fec_mii_shutdown(dev); | ||
930 | |||
931 | spin_lock_irqsave(&fep->lock, flags); | ||
932 | fec_stop(dev); | ||
933 | spin_unlock_irqrestore(&fep->lock, flags); | ||
934 | |||
935 | /* release any irqs */ | ||
936 | if (fpi->phy_irq != -1) | ||
937 | free_irq(fpi->phy_irq, dev); | ||
938 | free_irq(fpi->fec_irq, dev); | ||
939 | |||
940 | return 0; | ||
941 | } | ||
942 | |||
943 | static struct net_device_stats *fec_enet_get_stats(struct net_device *dev) | ||
944 | { | ||
945 | struct fec_enet_private *fep = netdev_priv(dev); | ||
946 | return &fep->stats; | ||
947 | } | ||
948 | |||
949 | static int fec_enet_poll(struct napi_struct *napi, int budget) | ||
950 | { | ||
951 | struct fec_enet_private *fep = container_of(napi, struct fec_enet_private, napi); | ||
952 | struct net_device *dev = fep->dev; | ||
953 | |||
954 | return fec_enet_rx_common(fep, dev, budget); | ||
955 | } | ||
956 | |||
957 | /*************************************************************************/ | ||
958 | |||
959 | static void fec_get_drvinfo(struct net_device *dev, | ||
960 | struct ethtool_drvinfo *info) | ||
961 | { | ||
962 | strcpy(info->driver, DRV_MODULE_NAME); | ||
963 | strcpy(info->version, DRV_MODULE_VERSION); | ||
964 | } | ||
965 | |||
966 | static int fec_get_regs_len(struct net_device *dev) | ||
967 | { | ||
968 | return sizeof(fec_t); | ||
969 | } | ||
970 | |||
971 | static void fec_get_regs(struct net_device *dev, struct ethtool_regs *regs, | ||
972 | void *p) | ||
973 | { | ||
974 | struct fec_enet_private *fep = netdev_priv(dev); | ||
975 | unsigned long flags; | ||
976 | |||
977 | if (regs->len < sizeof(fec_t)) | ||
978 | return; | ||
979 | |||
980 | regs->version = 0; | ||
981 | spin_lock_irqsave(&fep->lock, flags); | ||
982 | memcpy_fromio(p, fep->fecp, sizeof(fec_t)); | ||
983 | spin_unlock_irqrestore(&fep->lock, flags); | ||
984 | } | ||
985 | |||
986 | static int fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
987 | { | ||
988 | struct fec_enet_private *fep = netdev_priv(dev); | ||
989 | unsigned long flags; | ||
990 | int rc; | ||
991 | |||
992 | spin_lock_irqsave(&fep->lock, flags); | ||
993 | rc = mii_ethtool_gset(&fep->mii_if, cmd); | ||
994 | spin_unlock_irqrestore(&fep->lock, flags); | ||
995 | |||
996 | return rc; | ||
997 | } | ||
998 | |||
999 | static int fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1000 | { | ||
1001 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1002 | unsigned long flags; | ||
1003 | int rc; | ||
1004 | |||
1005 | spin_lock_irqsave(&fep->lock, flags); | ||
1006 | rc = mii_ethtool_sset(&fep->mii_if, cmd); | ||
1007 | spin_unlock_irqrestore(&fep->lock, flags); | ||
1008 | |||
1009 | return rc; | ||
1010 | } | ||
1011 | |||
1012 | static int fec_nway_reset(struct net_device *dev) | ||
1013 | { | ||
1014 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1015 | return mii_nway_restart(&fep->mii_if); | ||
1016 | } | ||
1017 | |||
1018 | static __u32 fec_get_msglevel(struct net_device *dev) | ||
1019 | { | ||
1020 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1021 | return fep->msg_enable; | ||
1022 | } | ||
1023 | |||
1024 | static void fec_set_msglevel(struct net_device *dev, __u32 value) | ||
1025 | { | ||
1026 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1027 | fep->msg_enable = value; | ||
1028 | } | ||
1029 | |||
1030 | static const struct ethtool_ops fec_ethtool_ops = { | ||
1031 | .get_drvinfo = fec_get_drvinfo, | ||
1032 | .get_regs_len = fec_get_regs_len, | ||
1033 | .get_settings = fec_get_settings, | ||
1034 | .set_settings = fec_set_settings, | ||
1035 | .nway_reset = fec_nway_reset, | ||
1036 | .get_link = ethtool_op_get_link, | ||
1037 | .get_msglevel = fec_get_msglevel, | ||
1038 | .set_msglevel = fec_set_msglevel, | ||
1039 | .set_tx_csum = ethtool_op_set_tx_csum, /* local! */ | ||
1040 | .set_sg = ethtool_op_set_sg, | ||
1041 | .get_regs = fec_get_regs, | ||
1042 | }; | ||
1043 | |||
1044 | static int fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
1045 | { | ||
1046 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1047 | struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data; | ||
1048 | unsigned long flags; | ||
1049 | int rc; | ||
1050 | |||
1051 | if (!netif_running(dev)) | ||
1052 | return -EINVAL; | ||
1053 | |||
1054 | spin_lock_irqsave(&fep->lock, flags); | ||
1055 | rc = generic_mii_ioctl(&fep->mii_if, mii, cmd, NULL); | ||
1056 | spin_unlock_irqrestore(&fep->lock, flags); | ||
1057 | return rc; | ||
1058 | } | ||
1059 | |||
1060 | int fec_8xx_init_one(const struct fec_platform_info *fpi, | ||
1061 | struct net_device **devp) | ||
1062 | { | ||
1063 | immap_t *immap = (immap_t *) IMAP_ADDR; | ||
1064 | static int fec_8xx_version_printed = 0; | ||
1065 | struct net_device *dev = NULL; | ||
1066 | struct fec_enet_private *fep = NULL; | ||
1067 | fec_t *fecp = NULL; | ||
1068 | int i; | ||
1069 | int err = 0; | ||
1070 | int registered = 0; | ||
1071 | __u32 siel; | ||
1072 | |||
1073 | *devp = NULL; | ||
1074 | |||
1075 | switch (fpi->fec_no) { | ||
1076 | case 0: | ||
1077 | fecp = &((immap_t *) IMAP_ADDR)->im_cpm.cp_fec; | ||
1078 | break; | ||
1079 | #ifdef CONFIG_DUET | ||
1080 | case 1: | ||
1081 | fecp = &((immap_t *) IMAP_ADDR)->im_cpm.cp_fec2; | ||
1082 | break; | ||
1083 | #endif | ||
1084 | default: | ||
1085 | return -EINVAL; | ||
1086 | } | ||
1087 | |||
1088 | if (fec_8xx_version_printed++ == 0) | ||
1089 | printk(KERN_INFO "%s", version); | ||
1090 | |||
1091 | i = sizeof(*fep) + (sizeof(struct sk_buff **) * | ||
1092 | (fpi->rx_ring + fpi->tx_ring)); | ||
1093 | |||
1094 | dev = alloc_etherdev(i); | ||
1095 | if (!dev) { | ||
1096 | err = -ENOMEM; | ||
1097 | goto err; | ||
1098 | } | ||
1099 | |||
1100 | fep = netdev_priv(dev); | ||
1101 | fep->dev = dev; | ||
1102 | |||
1103 | /* partial reset of FEC */ | ||
1104 | fec_whack_reset(fecp); | ||
1105 | |||
1106 | /* point rx_skbuff, tx_skbuff */ | ||
1107 | fep->rx_skbuff = (struct sk_buff **)&fep[1]; | ||
1108 | fep->tx_skbuff = fep->rx_skbuff + fpi->rx_ring; | ||
1109 | |||
1110 | fep->fecp = fecp; | ||
1111 | fep->fpi = fpi; | ||
1112 | |||
1113 | /* init locks */ | ||
1114 | spin_lock_init(&fep->lock); | ||
1115 | spin_lock_init(&fep->tx_lock); | ||
1116 | |||
1117 | /* | ||
1118 | * Set the Ethernet address. | ||
1119 | */ | ||
1120 | for (i = 0; i < 6; i++) | ||
1121 | dev->dev_addr[i] = fpi->macaddr[i]; | ||
1122 | |||
1123 | fep->ring_base = dma_alloc_coherent(NULL, | ||
1124 | (fpi->tx_ring + fpi->rx_ring) * | ||
1125 | sizeof(cbd_t), &fep->ring_mem_addr, | ||
1126 | GFP_KERNEL); | ||
1127 | if (fep->ring_base == NULL) { | ||
1128 | printk(KERN_ERR DRV_MODULE_NAME | ||
1129 | ": %s dma alloc failed.\n", dev->name); | ||
1130 | err = -ENOMEM; | ||
1131 | goto err; | ||
1132 | } | ||
1133 | |||
1134 | /* | ||
1135 | * Set receive and transmit descriptor base. | ||
1136 | */ | ||
1137 | fep->rx_bd_base = fep->ring_base; | ||
1138 | fep->tx_bd_base = fep->rx_bd_base + fpi->rx_ring; | ||
1139 | |||
1140 | /* initialize ring size variables */ | ||
1141 | fep->tx_ring = fpi->tx_ring; | ||
1142 | fep->rx_ring = fpi->rx_ring; | ||
1143 | |||
1144 | /* SIU interrupt */ | ||
1145 | if (fpi->phy_irq != -1 && | ||
1146 | (fpi->phy_irq >= SIU_IRQ0 && fpi->phy_irq < SIU_LEVEL7)) { | ||
1147 | |||
1148 | siel = in_be32(&immap->im_siu_conf.sc_siel); | ||
1149 | if ((fpi->phy_irq & 1) == 0) | ||
1150 | siel |= (0x80000000 >> fpi->phy_irq); | ||
1151 | else | ||
1152 | siel &= ~(0x80000000 >> (fpi->phy_irq & ~1)); | ||
1153 | out_be32(&immap->im_siu_conf.sc_siel, siel); | ||
1154 | } | ||
1155 | |||
1156 | /* | ||
1157 | * The FEC Ethernet specific entries in the device structure. | ||
1158 | */ | ||
1159 | dev->open = fec_enet_open; | ||
1160 | dev->hard_start_xmit = fec_enet_start_xmit; | ||
1161 | dev->tx_timeout = fec_timeout; | ||
1162 | dev->watchdog_timeo = TX_TIMEOUT; | ||
1163 | dev->stop = fec_enet_close; | ||
1164 | dev->get_stats = fec_enet_get_stats; | ||
1165 | dev->set_multicast_list = fec_set_multicast_list; | ||
1166 | dev->set_mac_address = fec_set_mac_address; | ||
1167 | netif_napi_add(dev, &fec->napi, | ||
1168 | fec_enet_poll, fpi->napi_weight); | ||
1169 | |||
1170 | dev->ethtool_ops = &fec_ethtool_ops; | ||
1171 | dev->do_ioctl = fec_ioctl; | ||
1172 | |||
1173 | fep->fec_phy_speed = | ||
1174 | ((((fpi->sys_clk + 4999999) / 2500000) / 2) & 0x3F) << 1; | ||
1175 | |||
1176 | init_timer(&fep->phy_timer_list); | ||
1177 | |||
1178 | /* partial reset of FEC so that only MII works */ | ||
1179 | FW(fecp, mii_speed, fep->fec_phy_speed); | ||
1180 | FW(fecp, ievent, 0xffc0); | ||
1181 | FW(fecp, ivec, (fpi->fec_irq / 2) << 29); | ||
1182 | FW(fecp, imask, 0); | ||
1183 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
1184 | FW(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
1185 | |||
1186 | netif_carrier_off(dev); | ||
1187 | |||
1188 | err = register_netdev(dev); | ||
1189 | if (err != 0) | ||
1190 | goto err; | ||
1191 | registered = 1; | ||
1192 | |||
1193 | if (fpi->use_mdio) { | ||
1194 | fep->mii_if.dev = dev; | ||
1195 | fep->mii_if.mdio_read = fec_mii_read; | ||
1196 | fep->mii_if.mdio_write = fec_mii_write; | ||
1197 | fep->mii_if.phy_id_mask = 0x1f; | ||
1198 | fep->mii_if.reg_num_mask = 0x1f; | ||
1199 | fep->mii_if.phy_id = fec_mii_phy_id_detect(dev); | ||
1200 | } | ||
1201 | |||
1202 | *devp = dev; | ||
1203 | |||
1204 | return 0; | ||
1205 | |||
1206 | err: | ||
1207 | if (dev != NULL) { | ||
1208 | if (fecp != NULL) | ||
1209 | fec_whack_reset(fecp); | ||
1210 | |||
1211 | if (registered) | ||
1212 | unregister_netdev(dev); | ||
1213 | |||
1214 | if (fep != NULL) { | ||
1215 | if (fep->ring_base) | ||
1216 | dma_free_coherent(NULL, | ||
1217 | (fpi->tx_ring + | ||
1218 | fpi->rx_ring) * | ||
1219 | sizeof(cbd_t), fep->ring_base, | ||
1220 | fep->ring_mem_addr); | ||
1221 | } | ||
1222 | free_netdev(dev); | ||
1223 | } | ||
1224 | return err; | ||
1225 | } | ||
1226 | |||
1227 | int fec_8xx_cleanup_one(struct net_device *dev) | ||
1228 | { | ||
1229 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1230 | fec_t *fecp = fep->fecp; | ||
1231 | const struct fec_platform_info *fpi = fep->fpi; | ||
1232 | |||
1233 | fec_whack_reset(fecp); | ||
1234 | |||
1235 | unregister_netdev(dev); | ||
1236 | |||
1237 | dma_free_coherent(NULL, (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), | ||
1238 | fep->ring_base, fep->ring_mem_addr); | ||
1239 | |||
1240 | free_netdev(dev); | ||
1241 | |||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | /**************************************************************************************/ | ||
1246 | /**************************************************************************************/ | ||
1247 | /**************************************************************************************/ | ||
1248 | |||
1249 | static int __init fec_8xx_init(void) | ||
1250 | { | ||
1251 | return fec_8xx_platform_init(); | ||
1252 | } | ||
1253 | |||
1254 | static void __exit fec_8xx_cleanup(void) | ||
1255 | { | ||
1256 | fec_8xx_platform_cleanup(); | ||
1257 | } | ||
1258 | |||
1259 | /**************************************************************************************/ | ||
1260 | /**************************************************************************************/ | ||
1261 | /**************************************************************************************/ | ||
1262 | |||
1263 | module_init(fec_8xx_init); | ||
1264 | module_exit(fec_8xx_cleanup); | ||
diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c deleted file mode 100644 index 3b6ca29d31f2..000000000000 --- a/drivers/net/fec_8xx/fec_mii.c +++ /dev/null | |||
@@ -1,418 +0,0 @@ | |||
1 | /* | ||
2 | * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. | ||
3 | * | ||
4 | * Copyright (c) 2003 Intracom S.A. | ||
5 | * by Pantelis Antoniou <panto@intracom.gr> | ||
6 | * | ||
7 | * Heavily based on original FEC driver by Dan Malek <dan@embeddededge.com> | ||
8 | * and modifications by Joakim Tjernlund <joakim.tjernlund@lumentis.se> | ||
9 | * | ||
10 | * Released under the GPL | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/ptrace.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/netdevice.h> | ||
25 | #include <linux/etherdevice.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/mii.h> | ||
29 | #include <linux/ethtool.h> | ||
30 | #include <linux/bitops.h> | ||
31 | |||
32 | #include <asm/8xx_immap.h> | ||
33 | #include <asm/pgtable.h> | ||
34 | #include <asm/mpc8xx.h> | ||
35 | #include <asm/irq.h> | ||
36 | #include <asm/uaccess.h> | ||
37 | #include <asm/cpm1.h> | ||
38 | |||
39 | /*************************************************/ | ||
40 | |||
41 | #include "fec_8xx.h" | ||
42 | |||
43 | /*************************************************/ | ||
44 | |||
45 | /* Make MII read/write commands for the FEC. | ||
46 | */ | ||
47 | #define mk_mii_read(REG) (0x60020000 | ((REG & 0x1f) << 18)) | ||
48 | #define mk_mii_write(REG, VAL) (0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff)) | ||
49 | #define mk_mii_end 0 | ||
50 | |||
51 | /*************************************************/ | ||
52 | |||
53 | /* XXX both FECs use the MII interface of FEC1 */ | ||
54 | static DEFINE_SPINLOCK(fec_mii_lock); | ||
55 | |||
56 | #define FEC_MII_LOOPS 10000 | ||
57 | |||
58 | int fec_mii_read(struct net_device *dev, int phy_id, int location) | ||
59 | { | ||
60 | struct fec_enet_private *fep = netdev_priv(dev); | ||
61 | fec_t *fecp; | ||
62 | int i, ret = -1; | ||
63 | unsigned long flags; | ||
64 | |||
65 | /* XXX MII interface is only connected to FEC1 */ | ||
66 | fecp = &((immap_t *) IMAP_ADDR)->im_cpm.cp_fec; | ||
67 | |||
68 | spin_lock_irqsave(&fec_mii_lock, flags); | ||
69 | |||
70 | if ((FR(fecp, r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) { | ||
71 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
72 | FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
73 | FW(fecp, ievent, FEC_ENET_MII); | ||
74 | } | ||
75 | |||
76 | /* Add PHY address to register command. */ | ||
77 | FW(fecp, mii_speed, fep->fec_phy_speed); | ||
78 | FW(fecp, mii_data, (phy_id << 23) | mk_mii_read(location)); | ||
79 | |||
80 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
81 | if ((FR(fecp, ievent) & FEC_ENET_MII) != 0) | ||
82 | break; | ||
83 | |||
84 | if (i < FEC_MII_LOOPS) { | ||
85 | FW(fecp, ievent, FEC_ENET_MII); | ||
86 | ret = FR(fecp, mii_data) & 0xffff; | ||
87 | } | ||
88 | |||
89 | spin_unlock_irqrestore(&fec_mii_lock, flags); | ||
90 | |||
91 | return ret; | ||
92 | } | ||
93 | |||
94 | void fec_mii_write(struct net_device *dev, int phy_id, int location, int value) | ||
95 | { | ||
96 | struct fec_enet_private *fep = netdev_priv(dev); | ||
97 | fec_t *fecp; | ||
98 | unsigned long flags; | ||
99 | int i; | ||
100 | |||
101 | /* XXX MII interface is only connected to FEC1 */ | ||
102 | fecp = &((immap_t *) IMAP_ADDR)->im_cpm.cp_fec; | ||
103 | |||
104 | spin_lock_irqsave(&fec_mii_lock, flags); | ||
105 | |||
106 | if ((FR(fecp, r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) { | ||
107 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
108 | FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
109 | FW(fecp, ievent, FEC_ENET_MII); | ||
110 | } | ||
111 | |||
112 | /* Add PHY address to register command. */ | ||
113 | FW(fecp, mii_speed, fep->fec_phy_speed); /* always adapt mii speed */ | ||
114 | FW(fecp, mii_data, (phy_id << 23) | mk_mii_write(location, value)); | ||
115 | |||
116 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
117 | if ((FR(fecp, ievent) & FEC_ENET_MII) != 0) | ||
118 | break; | ||
119 | |||
120 | if (i < FEC_MII_LOOPS) | ||
121 | FW(fecp, ievent, FEC_ENET_MII); | ||
122 | |||
123 | spin_unlock_irqrestore(&fec_mii_lock, flags); | ||
124 | } | ||
125 | |||
126 | /*************************************************/ | ||
127 | |||
128 | #ifdef CONFIG_FEC_8XX_GENERIC_PHY | ||
129 | |||
130 | /* | ||
131 | * Generic PHY support. | ||
132 | * Should work for all PHYs, but link change is detected by polling | ||
133 | */ | ||
134 | |||
135 | static void generic_timer_callback(unsigned long data) | ||
136 | { | ||
137 | struct net_device *dev = (struct net_device *)data; | ||
138 | struct fec_enet_private *fep = netdev_priv(dev); | ||
139 | |||
140 | fep->phy_timer_list.expires = jiffies + HZ / 2; | ||
141 | |||
142 | add_timer(&fep->phy_timer_list); | ||
143 | |||
144 | fec_mii_link_status_change_check(dev, 0); | ||
145 | } | ||
146 | |||
147 | static void generic_startup(struct net_device *dev) | ||
148 | { | ||
149 | struct fec_enet_private *fep = netdev_priv(dev); | ||
150 | |||
151 | fep->phy_timer_list.expires = jiffies + HZ / 2; /* every 500ms */ | ||
152 | fep->phy_timer_list.data = (unsigned long)dev; | ||
153 | fep->phy_timer_list.function = generic_timer_callback; | ||
154 | add_timer(&fep->phy_timer_list); | ||
155 | } | ||
156 | |||
157 | static void generic_shutdown(struct net_device *dev) | ||
158 | { | ||
159 | struct fec_enet_private *fep = netdev_priv(dev); | ||
160 | |||
161 | del_timer_sync(&fep->phy_timer_list); | ||
162 | } | ||
163 | |||
164 | #endif | ||
165 | |||
166 | #ifdef CONFIG_FEC_8XX_DM9161_PHY | ||
167 | |||
168 | /* ------------------------------------------------------------------------- */ | ||
169 | /* The Davicom DM9161 is used on the NETTA board */ | ||
170 | |||
171 | /* register definitions */ | ||
172 | |||
173 | #define MII_DM9161_ACR 16 /* Aux. Config Register */ | ||
174 | #define MII_DM9161_ACSR 17 /* Aux. Config/Status Register */ | ||
175 | #define MII_DM9161_10TCSR 18 /* 10BaseT Config/Status Reg. */ | ||
176 | #define MII_DM9161_INTR 21 /* Interrupt Register */ | ||
177 | #define MII_DM9161_RECR 22 /* Receive Error Counter Reg. */ | ||
178 | #define MII_DM9161_DISCR 23 /* Disconnect Counter Register */ | ||
179 | |||
180 | static void dm9161_startup(struct net_device *dev) | ||
181 | { | ||
182 | struct fec_enet_private *fep = netdev_priv(dev); | ||
183 | |||
184 | fec_mii_write(dev, fep->mii_if.phy_id, MII_DM9161_INTR, 0x0000); | ||
185 | } | ||
186 | |||
187 | static void dm9161_ack_int(struct net_device *dev) | ||
188 | { | ||
189 | struct fec_enet_private *fep = netdev_priv(dev); | ||
190 | |||
191 | fec_mii_read(dev, fep->mii_if.phy_id, MII_DM9161_INTR); | ||
192 | } | ||
193 | |||
194 | static void dm9161_shutdown(struct net_device *dev) | ||
195 | { | ||
196 | struct fec_enet_private *fep = netdev_priv(dev); | ||
197 | |||
198 | fec_mii_write(dev, fep->mii_if.phy_id, MII_DM9161_INTR, 0x0f00); | ||
199 | } | ||
200 | |||
201 | #endif | ||
202 | |||
203 | #ifdef CONFIG_FEC_8XX_LXT971_PHY | ||
204 | |||
205 | /* Support for LXT971/972 PHY */ | ||
206 | |||
207 | #define MII_LXT971_PCR 16 /* Port Control Register */ | ||
208 | #define MII_LXT971_SR2 17 /* Status Register 2 */ | ||
209 | #define MII_LXT971_IER 18 /* Interrupt Enable Register */ | ||
210 | #define MII_LXT971_ISR 19 /* Interrupt Status Register */ | ||
211 | #define MII_LXT971_LCR 20 /* LED Control Register */ | ||
212 | #define MII_LXT971_TCR 30 /* Transmit Control Register */ | ||
213 | |||
214 | static void lxt971_startup(struct net_device *dev) | ||
215 | { | ||
216 | struct fec_enet_private *fep = netdev_priv(dev); | ||
217 | |||
218 | fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x00F2); | ||
219 | } | ||
220 | |||
221 | static void lxt971_ack_int(struct net_device *dev) | ||
222 | { | ||
223 | struct fec_enet_private *fep = netdev_priv(dev); | ||
224 | |||
225 | fec_mii_read(dev, fep->mii_if.phy_id, MII_LXT971_ISR); | ||
226 | } | ||
227 | |||
228 | static void lxt971_shutdown(struct net_device *dev) | ||
229 | { | ||
230 | struct fec_enet_private *fep = netdev_priv(dev); | ||
231 | |||
232 | fec_mii_write(dev, fep->mii_if.phy_id, MII_LXT971_IER, 0x0000); | ||
233 | } | ||
234 | #endif | ||
235 | |||
236 | /**********************************************************************************/ | ||
237 | |||
238 | static const struct phy_info phy_info[] = { | ||
239 | #ifdef CONFIG_FEC_8XX_DM9161_PHY | ||
240 | { | ||
241 | .id = 0x00181b88, | ||
242 | .name = "DM9161", | ||
243 | .startup = dm9161_startup, | ||
244 | .ack_int = dm9161_ack_int, | ||
245 | .shutdown = dm9161_shutdown, | ||
246 | }, | ||
247 | #endif | ||
248 | #ifdef CONFIG_FEC_8XX_LXT971_PHY | ||
249 | { | ||
250 | .id = 0x0001378e, | ||
251 | .name = "LXT971/972", | ||
252 | .startup = lxt971_startup, | ||
253 | .ack_int = lxt971_ack_int, | ||
254 | .shutdown = lxt971_shutdown, | ||
255 | }, | ||
256 | #endif | ||
257 | #ifdef CONFIG_FEC_8XX_GENERIC_PHY | ||
258 | { | ||
259 | .id = 0, | ||
260 | .name = "GENERIC", | ||
261 | .startup = generic_startup, | ||
262 | .shutdown = generic_shutdown, | ||
263 | }, | ||
264 | #endif | ||
265 | }; | ||
266 | |||
267 | /**********************************************************************************/ | ||
268 | |||
269 | int fec_mii_phy_id_detect(struct net_device *dev) | ||
270 | { | ||
271 | struct fec_enet_private *fep = netdev_priv(dev); | ||
272 | const struct fec_platform_info *fpi = fep->fpi; | ||
273 | int i, r, start, end, phytype, physubtype; | ||
274 | const struct phy_info *phy; | ||
275 | int phy_hwid, phy_id; | ||
276 | |||
277 | /* if no MDIO */ | ||
278 | if (fpi->use_mdio == 0) | ||
279 | return -1; | ||
280 | |||
281 | phy_hwid = -1; | ||
282 | fep->phy = NULL; | ||
283 | |||
284 | /* auto-detect? */ | ||
285 | if (fpi->phy_addr == -1) { | ||
286 | start = 0; | ||
287 | end = 32; | ||
288 | } else { /* direct */ | ||
289 | start = fpi->phy_addr; | ||
290 | end = start + 1; | ||
291 | } | ||
292 | |||
293 | for (phy_id = start; phy_id < end; phy_id++) { | ||
294 | r = fec_mii_read(dev, phy_id, MII_PHYSID1); | ||
295 | if (r == -1 || (phytype = (r & 0xffff)) == 0xffff) | ||
296 | continue; | ||
297 | r = fec_mii_read(dev, phy_id, MII_PHYSID2); | ||
298 | if (r == -1 || (physubtype = (r & 0xffff)) == 0xffff) | ||
299 | continue; | ||
300 | phy_hwid = (phytype << 16) | physubtype; | ||
301 | if (phy_hwid != -1) | ||
302 | break; | ||
303 | } | ||
304 | |||
305 | if (phy_hwid == -1) { | ||
306 | printk(KERN_ERR DRV_MODULE_NAME | ||
307 | ": %s No PHY detected!\n", dev->name); | ||
308 | return -1; | ||
309 | } | ||
310 | |||
311 | for (i = 0, phy = phy_info; i < ARRAY_SIZE(phy_info); i++, phy++) | ||
312 | if (phy->id == (phy_hwid >> 4) || phy->id == 0) | ||
313 | break; | ||
314 | |||
315 | if (i >= ARRAY_SIZE(phy_info)) { | ||
316 | printk(KERN_ERR DRV_MODULE_NAME | ||
317 | ": %s PHY id 0x%08x is not supported!\n", | ||
318 | dev->name, phy_hwid); | ||
319 | return -1; | ||
320 | } | ||
321 | |||
322 | fep->phy = phy; | ||
323 | |||
324 | printk(KERN_INFO DRV_MODULE_NAME | ||
325 | ": %s Phy @ 0x%x, type %s (0x%08x)\n", | ||
326 | dev->name, phy_id, fep->phy->name, phy_hwid); | ||
327 | |||
328 | return phy_id; | ||
329 | } | ||
330 | |||
331 | void fec_mii_startup(struct net_device *dev) | ||
332 | { | ||
333 | struct fec_enet_private *fep = netdev_priv(dev); | ||
334 | const struct fec_platform_info *fpi = fep->fpi; | ||
335 | |||
336 | if (!fpi->use_mdio || fep->phy == NULL) | ||
337 | return; | ||
338 | |||
339 | if (fep->phy->startup == NULL) | ||
340 | return; | ||
341 | |||
342 | (*fep->phy->startup) (dev); | ||
343 | } | ||
344 | |||
345 | void fec_mii_shutdown(struct net_device *dev) | ||
346 | { | ||
347 | struct fec_enet_private *fep = netdev_priv(dev); | ||
348 | const struct fec_platform_info *fpi = fep->fpi; | ||
349 | |||
350 | if (!fpi->use_mdio || fep->phy == NULL) | ||
351 | return; | ||
352 | |||
353 | if (fep->phy->shutdown == NULL) | ||
354 | return; | ||
355 | |||
356 | (*fep->phy->shutdown) (dev); | ||
357 | } | ||
358 | |||
359 | void fec_mii_ack_int(struct net_device *dev) | ||
360 | { | ||
361 | struct fec_enet_private *fep = netdev_priv(dev); | ||
362 | const struct fec_platform_info *fpi = fep->fpi; | ||
363 | |||
364 | if (!fpi->use_mdio || fep->phy == NULL) | ||
365 | return; | ||
366 | |||
367 | if (fep->phy->ack_int == NULL) | ||
368 | return; | ||
369 | |||
370 | (*fep->phy->ack_int) (dev); | ||
371 | } | ||
372 | |||
373 | /* helper function */ | ||
374 | static int mii_negotiated(struct mii_if_info *mii) | ||
375 | { | ||
376 | int advert, lpa, val; | ||
377 | |||
378 | if (!mii_link_ok(mii)) | ||
379 | return 0; | ||
380 | |||
381 | val = (*mii->mdio_read) (mii->dev, mii->phy_id, MII_BMSR); | ||
382 | if ((val & BMSR_ANEGCOMPLETE) == 0) | ||
383 | return 0; | ||
384 | |||
385 | advert = (*mii->mdio_read) (mii->dev, mii->phy_id, MII_ADVERTISE); | ||
386 | lpa = (*mii->mdio_read) (mii->dev, mii->phy_id, MII_LPA); | ||
387 | |||
388 | return mii_nway_result(advert & lpa); | ||
389 | } | ||
390 | |||
391 | void fec_mii_link_status_change_check(struct net_device *dev, int init_media) | ||
392 | { | ||
393 | struct fec_enet_private *fep = netdev_priv(dev); | ||
394 | unsigned int media; | ||
395 | unsigned long flags; | ||
396 | |||
397 | if (mii_check_media(&fep->mii_if, netif_msg_link(fep), init_media) == 0) | ||
398 | return; | ||
399 | |||
400 | media = mii_negotiated(&fep->mii_if); | ||
401 | |||
402 | if (netif_carrier_ok(dev)) { | ||
403 | spin_lock_irqsave(&fep->lock, flags); | ||
404 | fec_restart(dev, !!(media & ADVERTISE_FULL), | ||
405 | (media & (ADVERTISE_100FULL | ADVERTISE_100HALF)) ? | ||
406 | 100 : 10); | ||
407 | spin_unlock_irqrestore(&fep->lock, flags); | ||
408 | |||
409 | netif_start_queue(dev); | ||
410 | } else { | ||
411 | netif_stop_queue(dev); | ||
412 | |||
413 | spin_lock_irqsave(&fep->lock, flags); | ||
414 | fec_stop(dev); | ||
415 | spin_unlock_irqrestore(&fep->lock, flags); | ||
416 | |||
417 | } | ||
418 | } | ||
diff --git a/drivers/of/device.c b/drivers/of/device.c index 29681c4b700b..8fbfeee53c1e 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -48,16 +48,32 @@ void of_dev_put(struct of_device *dev) | |||
48 | } | 48 | } |
49 | EXPORT_SYMBOL(of_dev_put); | 49 | EXPORT_SYMBOL(of_dev_put); |
50 | 50 | ||
51 | static ssize_t dev_show_devspec(struct device *dev, | 51 | static ssize_t devspec_show(struct device *dev, |
52 | struct device_attribute *attr, char *buf) | 52 | struct device_attribute *attr, char *buf) |
53 | { | 53 | { |
54 | struct of_device *ofdev; | 54 | struct of_device *ofdev; |
55 | 55 | ||
56 | ofdev = to_of_device(dev); | 56 | ofdev = to_of_device(dev); |
57 | return sprintf(buf, "%s", ofdev->node->full_name); | 57 | return sprintf(buf, "%s\n", ofdev->node->full_name); |
58 | } | 58 | } |
59 | 59 | ||
60 | static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL); | 60 | static ssize_t modalias_show(struct device *dev, |
61 | struct device_attribute *attr, char *buf) | ||
62 | { | ||
63 | struct of_device *ofdev = to_of_device(dev); | ||
64 | ssize_t len = 0; | ||
65 | |||
66 | len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2); | ||
67 | buf[len] = '\n'; | ||
68 | buf[len+1] = 0; | ||
69 | return len+1; | ||
70 | } | ||
71 | |||
72 | struct device_attribute of_platform_device_attrs[] = { | ||
73 | __ATTR_RO(devspec), | ||
74 | __ATTR_RO(modalias), | ||
75 | __ATTR_NULL | ||
76 | }; | ||
61 | 77 | ||
62 | /** | 78 | /** |
63 | * of_release_dev - free an of device structure when all users of it are finished. | 79 | * of_release_dev - free an of device structure when all users of it are finished. |
@@ -78,25 +94,13 @@ EXPORT_SYMBOL(of_release_dev); | |||
78 | 94 | ||
79 | int of_device_register(struct of_device *ofdev) | 95 | int of_device_register(struct of_device *ofdev) |
80 | { | 96 | { |
81 | int rc; | ||
82 | |||
83 | BUG_ON(ofdev->node == NULL); | 97 | BUG_ON(ofdev->node == NULL); |
84 | 98 | return device_register(&ofdev->dev); | |
85 | rc = device_register(&ofdev->dev); | ||
86 | if (rc) | ||
87 | return rc; | ||
88 | |||
89 | rc = device_create_file(&ofdev->dev, &dev_attr_devspec); | ||
90 | if (rc) | ||
91 | device_unregister(&ofdev->dev); | ||
92 | |||
93 | return rc; | ||
94 | } | 99 | } |
95 | EXPORT_SYMBOL(of_device_register); | 100 | EXPORT_SYMBOL(of_device_register); |
96 | 101 | ||
97 | void of_device_unregister(struct of_device *ofdev) | 102 | void of_device_unregister(struct of_device *ofdev) |
98 | { | 103 | { |
99 | device_remove_file(&ofdev->dev, &dev_attr_devspec); | ||
100 | device_unregister(&ofdev->dev); | 104 | device_unregister(&ofdev->dev); |
101 | } | 105 | } |
102 | EXPORT_SYMBOL(of_device_unregister); | 106 | EXPORT_SYMBOL(of_device_unregister); |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ca09a63a64db..298de0f95d70 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/of_device.h> | 17 | #include <linux/of_device.h> |
18 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
19 | 19 | ||
20 | extern struct device_attribute of_platform_device_attrs[]; | ||
21 | |||
20 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) | 22 | static int of_platform_bus_match(struct device *dev, struct device_driver *drv) |
21 | { | 23 | { |
22 | struct of_device *of_dev = to_of_device(dev); | 24 | struct of_device *of_dev = to_of_device(dev); |
@@ -103,6 +105,7 @@ int of_bus_type_init(struct bus_type *bus, const char *name) | |||
103 | bus->suspend = of_platform_device_suspend; | 105 | bus->suspend = of_platform_device_suspend; |
104 | bus->resume = of_platform_device_resume; | 106 | bus->resume = of_platform_device_resume; |
105 | bus->shutdown = of_platform_device_shutdown; | 107 | bus->shutdown = of_platform_device_shutdown; |
108 | bus->dev_attrs = of_platform_device_attrs; | ||
106 | return bus_register(bus); | 109 | return bus_register(bus); |
107 | } | 110 | } |
108 | 111 | ||
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h index 39c5c5f62bf5..d1dc16afb118 100644 --- a/include/asm-powerpc/mmu-hash64.h +++ b/include/asm-powerpc/mmu-hash64.h | |||
@@ -182,6 +182,7 @@ extern int mmu_io_psize; | |||
182 | extern int mmu_kernel_ssize; | 182 | extern int mmu_kernel_ssize; |
183 | extern int mmu_highuser_ssize; | 183 | extern int mmu_highuser_ssize; |
184 | extern u16 mmu_slb_size; | 184 | extern u16 mmu_slb_size; |
185 | extern unsigned long tce_alloc_start, tce_alloc_end; | ||
185 | 186 | ||
186 | /* | 187 | /* |
187 | * If the processor supports 64k normal pages but not 64k cache | 188 | * If the processor supports 64k normal pages but not 64k cache |
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h index 39023dde1cc4..38d87e5e569d 100644 --- a/include/asm-powerpc/ptrace.h +++ b/include/asm-powerpc/ptrace.h | |||
@@ -119,6 +119,7 @@ extern int ptrace_put_reg(struct task_struct *task, int regno, | |||
119 | #ifndef __powerpc64__ | 119 | #ifndef __powerpc64__ |
120 | #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0) | 120 | #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0) |
121 | #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0) | 121 | #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0) |
122 | #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0) | ||
122 | #endif /* ! __powerpc64__ */ | 123 | #endif /* ! __powerpc64__ */ |
123 | #define TRAP(regs) ((regs)->trap & ~0xF) | 124 | #define TRAP(regs) ((regs)->trap & ~0xF) |
124 | #ifdef __powerpc64__ | 125 | #ifdef __powerpc64__ |
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h index 505f35bacaa9..1cd43e3d94fb 100644 --- a/include/asm-powerpc/smp.h +++ b/include/asm-powerpc/smp.h | |||
@@ -37,6 +37,8 @@ extern void cpu_die(void); | |||
37 | extern void smp_send_debugger_break(int cpu); | 37 | extern void smp_send_debugger_break(int cpu); |
38 | extern void smp_message_recv(int); | 38 | extern void smp_message_recv(int); |
39 | 39 | ||
40 | DECLARE_PER_CPU(unsigned int, pvr); | ||
41 | |||
40 | #ifdef CONFIG_HOTPLUG_CPU | 42 | #ifdef CONFIG_HOTPLUG_CPU |
41 | extern void fixup_irqs(cpumask_t map); | 43 | extern void fixup_irqs(cpumask_t map); |
42 | int generic_cpu_disable(void); | 44 | int generic_cpu_disable(void); |
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 2b6559a6d113..df781adac6dd 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -190,6 +190,7 @@ extern struct task_struct *_switch(struct thread_struct *prev, | |||
190 | 190 | ||
191 | extern unsigned int rtas_data; | 191 | extern unsigned int rtas_data; |
192 | extern int mem_init_done; /* set on boot once kmalloc can be called */ | 192 | extern int mem_init_done; /* set on boot once kmalloc can be called */ |
193 | extern int init_bootmem_done; /* set on !NUMA once bootmem is available */ | ||
193 | extern unsigned long memory_limit; | 194 | extern unsigned long memory_limit; |
194 | extern unsigned long klimit; | 195 | extern unsigned long klimit; |
195 | 196 | ||
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index d030f5ce39ad..e079e81051fd 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h | |||
@@ -116,7 +116,6 @@ static inline struct thread_info *current_thread_info(void) | |||
116 | #define TIF_SECCOMP 10 /* secure computing */ | 116 | #define TIF_SECCOMP 10 /* secure computing */ |
117 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ | 117 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ |
118 | #define TIF_NOERROR 12 /* Force successful syscall return */ | 118 | #define TIF_NOERROR 12 /* Force successful syscall return */ |
119 | #define TIF_RESTORE_SIGMASK 13 /* Restore signal mask in do_signal */ | ||
120 | #define TIF_FREEZE 14 /* Freezing for suspend */ | 119 | #define TIF_FREEZE 14 /* Freezing for suspend */ |
121 | #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ | 120 | #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ |
122 | #define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ | 121 | #define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ |
@@ -134,21 +133,31 @@ static inline struct thread_info *current_thread_info(void) | |||
134 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 133 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
135 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) | 134 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) |
136 | #define _TIF_NOERROR (1<<TIF_NOERROR) | 135 | #define _TIF_NOERROR (1<<TIF_NOERROR) |
137 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
138 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 136 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
139 | #define _TIF_RUNLATCH (1<<TIF_RUNLATCH) | 137 | #define _TIF_RUNLATCH (1<<TIF_RUNLATCH) |
140 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 138 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
141 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | 139 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) |
142 | 140 | ||
143 | #define _TIF_USER_WORK_MASK ( _TIF_SIGPENDING | \ | 141 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED) |
144 | _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK) | ||
145 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) | 142 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) |
146 | 143 | ||
147 | /* Bits in local_flags */ | 144 | /* Bits in local_flags */ |
148 | /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */ | 145 | /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */ |
149 | #define TLF_NAPPING 0 /* idle thread enabled NAP mode */ | 146 | #define TLF_NAPPING 0 /* idle thread enabled NAP mode */ |
147 | #define TLF_RESTORE_SIGMASK 1 /* Restore signal mask in do_signal */ | ||
150 | 148 | ||
151 | #define _TLF_NAPPING (1 << TLF_NAPPING) | 149 | #define _TLF_NAPPING (1 << TLF_NAPPING) |
150 | #define _TLF_RESTORE_SIGMASK (1 << TLF_RESTORE_SIGMASK) | ||
151 | |||
152 | #ifndef __ASSEMBLY__ | ||
153 | #define HAVE_SET_RESTORE_SIGMASK 1 | ||
154 | static inline void set_restore_sigmask(void) | ||
155 | { | ||
156 | struct thread_info *ti = current_thread_info(); | ||
157 | ti->local_flags |= _TLF_RESTORE_SIGMASK; | ||
158 | set_bit(TIF_SIGPENDING, &ti->flags); | ||
159 | } | ||
160 | #endif /* !__ASSEMBLY__ */ | ||
152 | 161 | ||
153 | #endif /* __KERNEL__ */ | 162 | #endif /* __KERNEL__ */ |
154 | 163 | ||
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index ce5de6e0e690..febd581ec9b0 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h | |||
@@ -33,6 +33,7 @@ extern unsigned tb_to_us; | |||
33 | 33 | ||
34 | struct rtc_time; | 34 | struct rtc_time; |
35 | extern void to_tm(int tim, struct rtc_time * tm); | 35 | extern void to_tm(int tim, struct rtc_time * tm); |
36 | extern void GregorianDay(struct rtc_time *tm); | ||
36 | extern time_t last_rtc_update; | 37 | extern time_t last_rtc_update; |
37 | 38 | ||
38 | extern void generic_calibrate_decr(void); | 39 | extern void generic_calibrate_decr(void); |
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h index 88320a05f0a8..5eb8e599e5cc 100644 --- a/include/asm-powerpc/xmon.h +++ b/include/asm-powerpc/xmon.h | |||
@@ -12,13 +12,22 @@ | |||
12 | 12 | ||
13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
14 | 14 | ||
15 | #include <linux/irqreturn.h> | ||
16 | |||
15 | #ifdef CONFIG_XMON | 17 | #ifdef CONFIG_XMON |
16 | extern void xmon_setup(void); | 18 | extern void xmon_setup(void); |
17 | extern void xmon_register_spus(struct list_head *list); | 19 | extern void xmon_register_spus(struct list_head *list); |
20 | struct pt_regs; | ||
21 | extern int xmon(struct pt_regs *excp); | ||
22 | extern irqreturn_t xmon_irq(int, void *); | ||
18 | #else | 23 | #else |
19 | static inline void xmon_setup(void) { }; | 24 | static inline void xmon_setup(void) { }; |
20 | static inline void xmon_register_spus(struct list_head *list) { }; | 25 | static inline void xmon_register_spus(struct list_head *list) { }; |
21 | #endif | 26 | #endif |
22 | 27 | ||
28 | #if defined(CONFIG_XMON) && defined(CONFIG_SMP) | ||
29 | extern int cpus_are_in_xmon(void); | ||
30 | #endif | ||
31 | |||
23 | #endif /* __KERNEL __ */ | 32 | #endif /* __KERNEL __ */ |
24 | #endif /* __ASM_POWERPC_XMON_H */ | 33 | #endif /* __ASM_POWERPC_XMON_H */ |