aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/kernel
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/cris/kernel
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/cris/kernel')
-rw-r--r--arch/cris/kernel/asm-offsets.c6
-rw-r--r--arch/cris/kernel/crisksyms.c1
-rw-r--r--arch/cris/kernel/irq.c1
-rw-r--r--arch/cris/kernel/module.c2
-rw-r--r--arch/cris/kernel/process.c36
-rw-r--r--arch/cris/kernel/ptrace.c3
-rw-r--r--arch/cris/kernel/setup.c1
-rw-r--r--arch/cris/kernel/time.c76
-rw-r--r--arch/cris/kernel/traps.c1
-rw-r--r--arch/cris/kernel/vmlinux.lds.S1
10 files changed, 112 insertions, 16 deletions
diff --git a/arch/cris/kernel/asm-offsets.c b/arch/cris/kernel/asm-offsets.c
index a5fd88d816a..dd7b8e98322 100644
--- a/arch/cris/kernel/asm-offsets.c
+++ b/arch/cris/kernel/asm-offsets.c
@@ -1,4 +1,3 @@
1#include <linux/kbuild.h>
2#include <linux/sched.h> 1#include <linux/sched.h>
3#include <asm/thread_info.h> 2#include <asm/thread_info.h>
4 3
@@ -8,6 +7,11 @@
8 * and format the required data. 7 * and format the required data.
9 */ 8 */
10 9
10#define DEFINE(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
12
13#define BLANK() asm volatile("\n->" : : )
14
11#if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32) 15#if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32)
12#error One of ARCH v10 and ARCH v32 must be true! 16#error One of ARCH v10 and ARCH v32 must be true!
13#endif 17#endif
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 5868cee20eb..7ac000f6a88 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -30,6 +30,7 @@ extern void __negdi2(void);
30extern void iounmap(volatile void * __iomem); 30extern void iounmap(volatile void * __iomem);
31 31
32/* Platform dependent support */ 32/* Platform dependent support */
33EXPORT_SYMBOL(kernel_thread);
33EXPORT_SYMBOL(get_cmos_time); 34EXPORT_SYMBOL(get_cmos_time);
34EXPORT_SYMBOL(loops_per_usec); 35EXPORT_SYMBOL(loops_per_usec);
35 36
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index d36836dbbc0..788eb224891 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -36,7 +36,6 @@
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37 37
38#include <asm/io.h> 38#include <asm/io.h>
39#include <arch/system.h>
40 39
41/* called by the assembler IRQ entry functions defined in irq.h 40/* called by the assembler IRQ entry functions defined in irq.h
42 * to dispatch the interrupts to registered handlers 41 * to dispatch the interrupts to registered handlers
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index 51123f985eb..37400f5869e 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -32,6 +32,8 @@
32#ifdef CONFIG_ETRAX_KMALLOCED_MODULES 32#ifdef CONFIG_ETRAX_KMALLOCED_MODULES
33void *module_alloc(unsigned long size) 33void *module_alloc(unsigned long size)
34{ 34{
35 if (size == 0)
36 return NULL;
35 return kmalloc(size, GFP_KERNEL); 37 return kmalloc(size, GFP_KERNEL);
36} 38}
37 39
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 7f65be6f7f1..aa585e4e979 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -16,6 +16,7 @@
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/system.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
21#include <linux/init_task.h> 22#include <linux/init_task.h>
@@ -25,11 +26,38 @@
25#include <linux/elfcore.h> 26#include <linux/elfcore.h>
26#include <linux/mqueue.h> 27#include <linux/mqueue.h>
27#include <linux/reboot.h> 28#include <linux/reboot.h>
28#include <linux/rcupdate.h>
29 29
30//#define DEBUG 30//#define DEBUG
31 31
32/* 32/*
33 * Initial task structure. Make this a per-architecture thing,
34 * because different architectures tend to have different
35 * alignment requirements and potentially different initial
36 * setup.
37 */
38
39static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
40static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
41/*
42 * Initial thread structure.
43 *
44 * We need to make sure that this is 8192-byte aligned due to the
45 * way process stacks are handled. This is done by having a special
46 * "init_task" linker map entry..
47 */
48union thread_union init_thread_union __init_task_data =
49 { INIT_THREAD_INFO(init_task) };
50
51/*
52 * Initial task structure.
53 *
54 * All other task structs will be allocated on slabs in fork.c
55 */
56struct task_struct init_task = INIT_TASK(init_task);
57
58EXPORT_SYMBOL(init_task);
59
60/*
33 * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if 61 * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
34 * there would ever be a halt sequence (for power save when idle) with 62 * there would ever be a halt sequence (for power save when idle) with
35 * some largish delay when halting or resuming *and* a driver that can't 63 * some largish delay when halting or resuming *and* a driver that can't
@@ -75,7 +103,6 @@ void cpu_idle (void)
75{ 103{
76 /* endless idle loop with no priority at all */ 104 /* endless idle loop with no priority at all */
77 while (1) { 105 while (1) {
78 rcu_idle_enter();
79 while (!need_resched()) { 106 while (!need_resched()) {
80 void (*idle)(void); 107 void (*idle)(void);
81 /* 108 /*
@@ -88,8 +115,9 @@ void cpu_idle (void)
88 idle = default_idle; 115 idle = default_idle;
89 idle(); 116 idle();
90 } 117 }
91 rcu_idle_exit(); 118 preempt_enable_no_resched();
92 schedule_preempt_disabled(); 119 schedule();
120 preempt_disable();
93 } 121 }
94} 122}
95 123
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 58d44ee1a71..48b0f391263 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -21,6 +21,7 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/system.h>
24#include <asm/processor.h> 25#include <asm/processor.h>
25 26
26 27
@@ -40,5 +41,7 @@ void do_notify_resume(int canrestart, struct pt_regs *regs,
40 if (thread_info_flags & _TIF_NOTIFY_RESUME) { 41 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
41 clear_thread_flag(TIF_NOTIFY_RESUME); 42 clear_thread_flag(TIF_NOTIFY_RESUME);
42 tracehook_notify_resume(regs); 43 tracehook_notify_resume(regs);
44 if (current->replacement_session_keyring)
45 key_replace_session_keyring();
43 } 46 }
44} 47}
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 32c3d248868..b712f4934c4 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -20,7 +20,6 @@
20#include <linux/pfn.h> 20#include <linux/pfn.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <asm/setup.h> 22#include <asm/setup.h>
23#include <arch/system.h>
24 23
25/* 24/*
26 * Setup options 25 * Setup options
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 277ffc459e4..4e73092e85c 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -21,6 +21,7 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/rtc.h>
24#include <linux/errno.h> 25#include <linux/errno.h>
25#include <linux/module.h> 26#include <linux/module.h>
26#include <linux/param.h> 27#include <linux/param.h>
@@ -31,8 +32,7 @@
31#include <linux/profile.h> 32#include <linux/profile.h>
32#include <linux/sched.h> /* just for sched_clock() - funny that */ 33#include <linux/sched.h> /* just for sched_clock() - funny that */
33 34
34 35int have_rtc; /* used to remember if we have an RTC or not */;
35#define D(x)
36 36
37#define TICK_SIZE tick 37#define TICK_SIZE tick
38 38
@@ -50,16 +50,78 @@ u32 arch_gettimeoffset(void)
50} 50}
51#endif 51#endif
52 52
53/*
54 * BUG: This routine does not handle hour overflow properly; it just
55 * sets the minutes. Usually you'll only notice that after reboot!
56 */
57
53int set_rtc_mmss(unsigned long nowtime) 58int set_rtc_mmss(unsigned long nowtime)
54{ 59{
55 D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime)); 60 int retval = 0;
56 return 0; 61 int real_seconds, real_minutes, cmos_minutes;
62
63 printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime);
64
65 if(!have_rtc)
66 return 0;
67
68 cmos_minutes = CMOS_READ(RTC_MINUTES);
69 cmos_minutes = bcd2bin(cmos_minutes);
70
71 /*
72 * since we're only adjusting minutes and seconds,
73 * don't interfere with hour overflow. This avoids
74 * messing with unknown time zones but requires your
75 * RTC not to be off by more than 15 minutes
76 */
77 real_seconds = nowtime % 60;
78 real_minutes = nowtime / 60;
79 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
80 real_minutes += 30; /* correct for half hour time zone */
81 real_minutes %= 60;
82
83 if (abs(real_minutes - cmos_minutes) < 30) {
84 real_seconds = bin2bcd(real_seconds);
85 real_minutes = bin2bcd(real_minutes);
86 CMOS_WRITE(real_seconds,RTC_SECONDS);
87 CMOS_WRITE(real_minutes,RTC_MINUTES);
88 } else {
89 printk_once(KERN_NOTICE
90 "set_rtc_mmss: can't update from %d to %d\n",
91 cmos_minutes, real_minutes);
92 retval = -1;
93 }
94
95 return retval;
57} 96}
58 97
59/* grab the time from the RTC chip */ 98/* grab the time from the RTC chip */
60unsigned long get_cmos_time(void) 99
100unsigned long
101get_cmos_time(void)
61{ 102{
62 return 0; 103 unsigned int year, mon, day, hour, min, sec;
104 if(!have_rtc)
105 return 0;
106
107 sec = CMOS_READ(RTC_SECONDS);
108 min = CMOS_READ(RTC_MINUTES);
109 hour = CMOS_READ(RTC_HOURS);
110 day = CMOS_READ(RTC_DAY_OF_MONTH);
111 mon = CMOS_READ(RTC_MONTH);
112 year = CMOS_READ(RTC_YEAR);
113
114 sec = bcd2bin(sec);
115 min = bcd2bin(min);
116 hour = bcd2bin(hour);
117 day = bcd2bin(day);
118 mon = bcd2bin(mon);
119 year = bcd2bin(year);
120
121 if ((year += 1900) < 1970)
122 year += 100;
123
124 return mktime(year, mon, day, hour, min, sec);
63} 125}
64 126
65 127
@@ -70,7 +132,7 @@ int update_persistent_clock(struct timespec now)
70 132
71void read_persistent_clock(struct timespec *ts) 133void read_persistent_clock(struct timespec *ts)
72{ 134{
73 ts->tv_sec = 0; 135 ts->tv_sec = get_cmos_time();
74 ts->tv_nsec = 0; 136 ts->tv_nsec = 0;
75} 137}
76 138
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index a11ad3229f8..8da53f34c7a 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -17,7 +17,6 @@
17 17
18#include <asm/pgtable.h> 18#include <asm/pgtable.h>
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <arch/system.h>
21 20
22extern void arch_enable_nmi(void); 21extern void arch_enable_nmi(void);
23extern void stop_watchdog(void); 22extern void stop_watchdog(void);
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index a68b983dcea..a6990cb0f09 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -52,7 +52,6 @@ SECTIONS
52 52
53 EXCEPTION_TABLE(4) 53 EXCEPTION_TABLE(4)
54 54
55 _sdata = .;
56 RODATA 55 RODATA
57 56
58 . = ALIGN (4); 57 . = ALIGN (4);