aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
commit53bcef60633086ad73683d01a4ef9ca678484d2d (patch)
tree8b14cc031124d0aa0da6cd3b60115bc7eaa80061 /arch/cris/arch-v32
parent4fd6c6bf83cb16321e9902b00e2af79054f4e0d6 (diff)
parent85d9865721c62a551547984e6cc8bd3ba732e294 (diff)
Merge branch 'for-linus' of git://www.jni.nu/cris
* 'for-linus' of git://www.jni.nu/cris: (51 commits) CRIS: Fix alignment problem for older ld CRIS: Always dump registers for segfaulting process. CRIS: Add config for pausing a seg-faulting process CRIS: Don't take faults while in_atomic CRIS: Fixup lookup for delay slot faults CRIS: Discard exit.text and .data at runtime CRIS: Add cache aligned and read mostly data sections CRIS: Return something from profile write CRIS: Add ARTPEC-3 and timestamps for sync-serial CRIS: Better ARTPEC-3 support for gpio CRIS: Add include guard CRIS: Better handling of pinmux settings CRIS: New DMA defines for ARTPEC-3 CRIS: __do_strncpy_from_user: Don't read the byte beyond the nil CRIS: Pagetable for ARTPEC-3 CRIS: Machine dependent memmap.h CRIS: Check if pointer is set before using it CRIS: Machine dependent dma.h CRIS: Define __read_mostly for CRISv32 CRIS: Discard .note.gnu.build-id section ...
Diffstat (limited to 'arch/cris/arch-v32')
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c28
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c12
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c28
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c42
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c30
-rw-r--r--arch/cris/arch-v32/kernel/cacheflush.S5
-rw-r--r--arch/cris/arch-v32/kernel/entry.S80
-rw-r--r--arch/cris/arch-v32/kernel/head.S44
-rw-r--r--arch/cris/arch-v32/kernel/irq.c47
-rw-r--r--arch/cris/arch-v32/kernel/kgdb.c16
-rw-r--r--arch/cris/arch-v32/kernel/kgdb_asm.S2
-rw-r--r--arch/cris/arch-v32/kernel/pinmux.c229
-rw-r--r--arch/cris/arch-v32/kernel/setup.c74
-rw-r--r--arch/cris/arch-v32/kernel/signal.c2
-rw-r--r--arch/cris/arch-v32/kernel/time.c85
-rw-r--r--arch/cris/arch-v32/kernel/traps.c6
-rw-r--r--arch/cris/arch-v32/lib/checksum.S3
-rw-r--r--arch/cris/arch-v32/lib/checksumcopy.S3
-rw-r--r--arch/cris/arch-v32/lib/spinlock.S7
-rw-r--r--arch/cris/arch-v32/mach-a3/Kconfig4
-rw-r--r--arch/cris/arch-v32/mach-a3/dram_init.S16
-rw-r--r--arch/cris/arch-v32/mach-a3/hw_settings.S2
-rw-r--r--arch/cris/arch-v32/mm/init.c23
-rw-r--r--arch/cris/arch-v32/mm/mmu.S4
24 files changed, 377 insertions, 415 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index b70fb34939d9..b07646a30509 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -11,7 +11,6 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/smp_lock.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
16#include <linux/stddef.h> 15#include <linux/stddef.h>
17 16
@@ -217,7 +216,7 @@ static int cryptocop_open(struct inode *, struct file *);
217 216
218static int cryptocop_release(struct inode *, struct file *); 217static int cryptocop_release(struct inode *, struct file *);
219 218
220static int cryptocop_ioctl(struct inode *inode, struct file *file, 219static long cryptocop_ioctl(struct file *file,
221 unsigned int cmd, unsigned long arg); 220 unsigned int cmd, unsigned long arg);
222 221
223static void cryptocop_start_job(void); 222static void cryptocop_start_job(void);
@@ -279,10 +278,10 @@ static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op);
279 278
280 279
281const struct file_operations cryptocop_fops = { 280const struct file_operations cryptocop_fops = {
282 .owner = THIS_MODULE, 281 .owner = THIS_MODULE,
283 .open = cryptocop_open, 282 .open = cryptocop_open,
284 .release = cryptocop_release, 283 .release = cryptocop_release,
285 .ioctl = cryptocop_ioctl 284 .unlocked_ioctl = cryptocop_ioctl
286}; 285};
287 286
288 287
@@ -2307,7 +2306,6 @@ static int cryptocop_open(struct inode *inode, struct file *filp)
2307{ 2306{
2308 int p = iminor(inode); 2307 int p = iminor(inode);
2309 2308
2310 cycle_kernel_lock();
2311 if (p != CRYPTOCOP_MINOR) return -EINVAL; 2309 if (p != CRYPTOCOP_MINOR) return -EINVAL;
2312 2310
2313 filp->private_data = NULL; 2311 filp->private_data = NULL;
@@ -3102,7 +3100,8 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
3102 return 0; 3100 return 0;
3103} 3101}
3104 3102
3105static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) 3103static long cryptocop_ioctl_unlocked(struct inode *inode,
3104 struct file *filp, unsigned int cmd, unsigned long arg)
3106{ 3105{
3107 int err = 0; 3106 int err = 0;
3108 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) { 3107 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
@@ -3134,6 +3133,19 @@ static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int
3134 return 0; 3133 return 0;
3135} 3134}
3136 3135
3136static long
3137cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3138{
3139 struct inode *inode = file->f_path.dentry->d_inode;
3140 long ret;
3141
3142 lock_kernel();
3143 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
3144 unlock_kernel();
3145
3146 return ret;
3147}
3148
3137 3149
3138#ifdef LDEBUG 3150#ifdef LDEBUG
3139static void print_dma_descriptors(struct cryptocop_int_operation *iop) 3151static void print_dma_descriptors(struct cryptocop_int_operation *iop)
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index 2fd6a740d895..5a3e900c9a78 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -32,7 +32,7 @@
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/smp_lock.h> 35#include <linux/mutex.h>
36 36
37#include <asm/etraxi2c.h> 37#include <asm/etraxi2c.h>
38 38
@@ -47,6 +47,7 @@
47#define D(x) 47#define D(x)
48 48
49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */ 49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */
50static DEFINE_MUTEX(i2c_mutex);
50static const char i2c_name[] = "i2c"; 51static const char i2c_name[] = "i2c";
51 52
52#define CLOCK_LOW_TIME 8 53#define CLOCK_LOW_TIME 8
@@ -636,7 +637,6 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
636static int 637static int
637i2c_open(struct inode *inode, struct file *filp) 638i2c_open(struct inode *inode, struct file *filp)
638{ 639{
639 cycle_kernel_lock();
640 return 0; 640 return 0;
641} 641}
642 642
@@ -665,11 +665,11 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
665 I2C_ARGREG(arg), 665 I2C_ARGREG(arg),
666 I2C_ARGVALUE(arg))); 666 I2C_ARGVALUE(arg)));
667 667
668 lock_kernel(); 668 mutex_lock(&i2c_mutex);
669 ret = i2c_writereg(I2C_ARGSLAVE(arg), 669 ret = i2c_writereg(I2C_ARGSLAVE(arg),
670 I2C_ARGREG(arg), 670 I2C_ARGREG(arg),
671 I2C_ARGVALUE(arg)); 671 I2C_ARGVALUE(arg));
672 unlock_kernel(); 672 mutex_unlock(&i2c_mutex);
673 return ret; 673 return ret;
674 674
675 case I2C_READREG: 675 case I2C_READREG:
@@ -679,9 +679,9 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
679 D(printk("i2cr %d %d ", 679 D(printk("i2cr %d %d ",
680 I2C_ARGSLAVE(arg), 680 I2C_ARGSLAVE(arg),
681 I2C_ARGREG(arg))); 681 I2C_ARGREG(arg)));
682 lock_kernel(); 682 mutex_lock(&i2c_mutex);
683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
684 unlock_kernel(); 684 mutex_unlock(&i2c_mutex);
685 D(printk("= %d\n", val)); 685 D(printk("= %d\n", val));
686 return val; 686 return val;
687 } 687 }
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 97357cfd17bb..2dcd27adbad4 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -72,8 +72,7 @@ static char gpio_name[] = "etrax gpio";
72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
73 unsigned long arg); 73 unsigned long arg);
74#endif 74#endif
75static int gpio_ioctl(struct inode *inode, struct file *file, 75static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
76 unsigned int cmd, unsigned long arg);
77static ssize_t gpio_write(struct file *file, const char __user *buf, 76static ssize_t gpio_write(struct file *file, const char __user *buf,
78 size_t count, loff_t *off); 77 size_t count, loff_t *off);
79static int gpio_open(struct inode *inode, struct file *filp); 78static int gpio_open(struct inode *inode, struct file *filp);
@@ -521,7 +520,7 @@ static inline unsigned long setget_output(struct gpio_private *priv,
521 return dir_shadow; 520 return dir_shadow;
522} /* setget_output */ 521} /* setget_output */
523 522
524static int gpio_ioctl(struct inode *inode, struct file *file, 523static long gpio_ioctl_unlocked(struct file *file,
525 unsigned int cmd, unsigned long arg) 524 unsigned int cmd, unsigned long arg)
526{ 525{
527 unsigned long flags; 526 unsigned long flags;
@@ -664,6 +663,17 @@ static int gpio_ioctl(struct inode *inode, struct file *file,
664 return 0; 663 return 0;
665} 664}
666 665
666static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
667{
668 long ret;
669
670 lock_kernel();
671 ret = gpio_ioctl_unlocked(file, cmd, arg);
672 unlock_kernel();
673
674 return ret;
675}
676
667#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 677#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
668static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 678static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
669 unsigned long arg) 679 unsigned long arg)
@@ -877,12 +887,12 @@ static int gpio_pwm_ioctl(struct gpio_private *priv, unsigned int cmd,
877} 887}
878 888
879static const struct file_operations gpio_fops = { 889static const struct file_operations gpio_fops = {
880 .owner = THIS_MODULE, 890 .owner = THIS_MODULE,
881 .poll = gpio_poll, 891 .poll = gpio_poll,
882 .ioctl = gpio_ioctl, 892 .unlocked_ioctl = gpio_ioctl,
883 .write = gpio_write, 893 .write = gpio_write,
884 .open = gpio_open, 894 .open = gpio_open,
885 .release = gpio_release, 895 .release = gpio_release,
886}; 896};
887 897
888#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 898#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index d89ab80498ed..5ec8a7d4e7d7 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -74,8 +74,7 @@ static wait_queue_head_t *gpio_wq;
74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
75 unsigned long arg); 75 unsigned long arg);
76#endif 76#endif
77static int gpio_ioctl(struct inode *inode, struct file *file, 77static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
78 unsigned int cmd, unsigned long arg);
79static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 78static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
80 loff_t *off); 79 loff_t *off);
81static int gpio_open(struct inode *inode, struct file *filp); 80static int gpio_open(struct inode *inode, struct file *filp);
@@ -185,7 +184,7 @@ static volatile unsigned long *dir_oe[NUM_PORTS] = {
185static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait) 184static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait)
186{ 185{
187 unsigned int mask = 0; 186 unsigned int mask = 0;
188 struct gpio_private *priv = (struct gpio_private *)file->private_data; 187 struct gpio_private *priv = file->private_data;
189 unsigned long data; 188 unsigned long data;
190 poll_wait(file, &priv->alarm_wq, wait); 189 poll_wait(file, &priv->alarm_wq, wait);
191 if (priv->minor == GPIO_MINOR_A) { 190 if (priv->minor == GPIO_MINOR_A) {
@@ -353,7 +352,7 @@ gpio_pa_interrupt(int irq, void *dev_id)
353static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 352static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
354 loff_t *off) 353 loff_t *off)
355{ 354{
356 struct gpio_private *priv = (struct gpio_private *)file->private_data; 355 struct gpio_private *priv = file->private_data;
357 unsigned char data, clk_mask, data_mask, write_msb; 356 unsigned char data, clk_mask, data_mask, write_msb;
358 unsigned long flags; 357 unsigned long flags;
359 unsigned long shadow; 358 unsigned long shadow;
@@ -468,7 +467,7 @@ gpio_release(struct inode *inode, struct file *filp)
468 467
469 spin_lock_irq(&alarm_lock); 468 spin_lock_irq(&alarm_lock);
470 p = alarmlist; 469 p = alarmlist;
471 todel = (struct gpio_private *)filp->private_data; 470 todel = filp->private_data;
472 471
473 if (p == todel) { 472 if (p == todel) {
474 alarmlist = todel->next; 473 alarmlist = todel->next;
@@ -557,17 +556,15 @@ inline unsigned long setget_output(struct gpio_private *priv, unsigned long arg)
557 return dir_shadow; 556 return dir_shadow;
558} /* setget_output */ 557} /* setget_output */
559 558
560static int 559static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
561gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
562 560
563static int 561static int
564gpio_ioctl(struct inode *inode, struct file *file, 562gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
565 unsigned int cmd, unsigned long arg)
566{ 563{
567 unsigned long flags; 564 unsigned long flags;
568 unsigned long val; 565 unsigned long val;
569 unsigned long shadow; 566 unsigned long shadow;
570 struct gpio_private *priv = (struct gpio_private *)file->private_data; 567 struct gpio_private *priv = file->private_data;
571 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) 568 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE)
572 return -EINVAL; 569 return -EINVAL;
573 570
@@ -707,6 +704,17 @@ gpio_ioctl(struct inode *inode, struct file *file,
707 return 0; 704 return 0;
708} 705}
709 706
707static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
708{
709 long ret;
710
711 lock_kernel();
712 ret = gpio_ioctl_unlocked(file, cmd, arg);
713 unlock_kernel();
714
715 return ret;
716}
717
710#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 718#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
711static int 719static int
712virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 720virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -714,7 +722,7 @@ virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
714 unsigned long flags; 722 unsigned long flags;
715 unsigned short val; 723 unsigned short val;
716 unsigned short shadow; 724 unsigned short shadow;
717 struct gpio_private *priv = (struct gpio_private *)file->private_data; 725 struct gpio_private *priv = file->private_data;
718 726
719 switch (_IOC_NR(cmd)) { 727 switch (_IOC_NR(cmd)) {
720 case IO_SETBITS: 728 case IO_SETBITS:
@@ -856,12 +864,12 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
856} 864}
857 865
858static const struct file_operations gpio_fops = { 866static const struct file_operations gpio_fops = {
859 .owner = THIS_MODULE, 867 .owner = THIS_MODULE,
860 .poll = gpio_poll, 868 .poll = gpio_poll,
861 .ioctl = gpio_ioctl, 869 .unlocked_ioctl = gpio_ioctl,
862 .write = gpio_write, 870 .write = gpio_write,
863 .open = gpio_open, 871 .open = gpio_open,
864 .release = gpio_release, 872 .release = gpio_release,
865}; 873};
866 874
867#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 875#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 4889f196ecd6..ca248f3adb80 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -153,7 +153,7 @@ static int sync_serial_open(struct inode *, struct file*);
153static int sync_serial_release(struct inode*, struct file*); 153static int sync_serial_release(struct inode*, struct file*);
154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); 154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
155 155
156static int sync_serial_ioctl(struct inode*, struct file*, 156static int sync_serial_ioctl(struct file *,
157 unsigned int cmd, unsigned long arg); 157 unsigned int cmd, unsigned long arg);
158static ssize_t sync_serial_write(struct file * file, const char * buf, 158static ssize_t sync_serial_write(struct file * file, const char * buf,
159 size_t count, loff_t *ppos); 159 size_t count, loff_t *ppos);
@@ -241,13 +241,13 @@ static struct sync_port ports[]=
241#define NBR_PORTS ARRAY_SIZE(ports) 241#define NBR_PORTS ARRAY_SIZE(ports)
242 242
243static const struct file_operations sync_serial_fops = { 243static const struct file_operations sync_serial_fops = {
244 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
245 .write = sync_serial_write, 245 .write = sync_serial_write,
246 .read = sync_serial_read, 246 .read = sync_serial_read,
247 .poll = sync_serial_poll, 247 .poll = sync_serial_poll,
248 .ioctl = sync_serial_ioctl, 248 .unlocked_ioctl = sync_serial_ioctl,
249 .open = sync_serial_open, 249 .open = sync_serial_open,
250 .release = sync_serial_release 250 .release = sync_serial_release
251}; 251};
252 252
253static int __init etrax_sync_serial_init(void) 253static int __init etrax_sync_serial_init(void)
@@ -650,7 +650,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
650 return mask; 650 return mask;
651} 651}
652 652
653static int sync_serial_ioctl(struct inode *inode, struct file *file, 653static int sync_serial_ioctl(struct file *file,
654 unsigned int cmd, unsigned long arg) 654 unsigned int cmd, unsigned long arg)
655{ 655{
656 int return_val = 0; 656 int return_val = 0;
@@ -961,6 +961,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
961 return return_val; 961 return return_val;
962} 962}
963 963
964static long sync_serial_ioctl(struct file *file,
965 unsigned int cmd, unsigned long arg)
966{
967 long ret;
968
969 lock_kernel();
970 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
971 unlock_kernel();
972
973 return ret;
974}
975
964/* NOTE: sync_serial_write does not support concurrency */ 976/* NOTE: sync_serial_write does not support concurrency */
965static ssize_t sync_serial_write(struct file *file, const char *buf, 977static ssize_t sync_serial_write(struct file *file, const char *buf,
966 size_t count, loff_t *ppos) 978 size_t count, loff_t *ppos)
diff --git a/arch/cris/arch-v32/kernel/cacheflush.S b/arch/cris/arch-v32/kernel/cacheflush.S
index 956e8fb82f01..6fc3d95d7029 100644
--- a/arch/cris/arch-v32/kernel/cacheflush.S
+++ b/arch/cris/arch-v32/kernel/cacheflush.S
@@ -1,4 +1,5 @@
1 .global cris_flush_cache_range 1 .global cris_flush_cache_range
2 .type cris_flush_cache_range, @function
2cris_flush_cache_range: 3cris_flush_cache_range:
3 move.d 1024, $r12 4 move.d 1024, $r12
4 cmp.d $r11, $r12 5 cmp.d $r11, $r12
@@ -80,8 +81,10 @@ cris_flush_1KB:
80 addq 32, $r10 81 addq 32, $r10
81 ba cris_flush_cache_range 82 ba cris_flush_cache_range
82 sub.d $r12, $r11 83 sub.d $r12, $r11
84 .size cris_flush_cache_range, . - cris_flush_cache_range
83 85
84 .global cris_flush_cache 86 .global cris_flush_cache
87 .type cris_flush_cache, @function
85cris_flush_cache: 88cris_flush_cache:
86 moveq 0, $r10 89 moveq 0, $r10
87cris_flush_line: 90cris_flush_line:
@@ -92,3 +95,5 @@ cris_flush_line:
92 fidxd [$r10] 95 fidxd [$r10]
93 ret 96 ret
94 nop 97 nop
98 .size cris_flush_cache, . - cris_flush_cache
99
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 1f39861eac8c..0ecb50b8f0d9 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -76,12 +76,15 @@ _need_resched:
76 76
77 ; Called at exit from fork. schedule_tail must be called to drop 77 ; Called at exit from fork. schedule_tail must be called to drop
78 ; spinlock if CONFIG_PREEMPT. 78 ; spinlock if CONFIG_PREEMPT.
79 .type ret_from_fork,@function
79ret_from_fork: 80ret_from_fork:
80 jsr schedule_tail 81 jsr schedule_tail
81 nop 82 nop
82 ba ret_from_sys_call 83 ba ret_from_sys_call
83 nop 84 nop
85 .size ret_from_fork, . - ret_from_fork
84 86
87 .type ret_from_intr,@function
85ret_from_intr: 88ret_from_intr:
86 ;; Check for resched if preemptive kernel, or if we're going back to 89 ;; Check for resched if preemptive kernel, or if we're going back to
87 ;; user-mode. This test matches the user_regs(regs) macro. Don't simply 90 ;; user-mode. This test matches the user_regs(regs) macro. Don't simply
@@ -91,9 +94,10 @@ ret_from_intr:
91 move.d [$acr], $r0 94 move.d [$acr], $r0
92 btstq 16, $r0 ; User-mode flag. 95 btstq 16, $r0 ; User-mode flag.
93 bpl _resume_kernel 96 bpl _resume_kernel
97 .size ret_from_intr, . - ret_from_intr + 2 ; +2 includes the dslot.
94 98
95 ; Note that di below is in delay slot. 99 ; Note that di below is in delay slot.
96 100 .type _resume_userspace,@function
97_resume_userspace: 101_resume_userspace:
98 di ; So need_resched and sigpending don't change. 102 di ; So need_resched and sigpending don't change.
99 103
@@ -107,6 +111,7 @@ _resume_userspace:
107 nop 111 nop
108 ba _Rexit 112 ba _Rexit
109 nop 113 nop
114 .size _resume_userspace, . - _resume_userspace
110 115
111 ;; The system_call is called by a BREAK instruction, which looks pretty 116 ;; The system_call is called by a BREAK instruction, which looks pretty
112 ;; much like any other exception. 117 ;; much like any other exception.
@@ -122,30 +127,28 @@ _resume_userspace:
122 ;; non-used instructions. Only the non-common cases cause the outlined code 127 ;; non-used instructions. Only the non-common cases cause the outlined code
123 ;; to run.. 128 ;; to run..
124 129
130 .type system_call,@function
125system_call: 131system_call:
126 ;; Stack-frame similar to the irq heads, which is reversed in 132 ;; Stack-frame similar to the irq heads, which is reversed in
127 ;; ret_from_sys_call. 133 ;; ret_from_sys_call.
128 subq 12, $sp ; Skip EXS, EDA.
129 move $erp, [$sp]
130 subq 4, $sp
131 move $srp, [$sp]
132 subq 4, $sp
133 move $ccs, [$sp]
134 subq 4, $sp
135 ei ; Allow IRQs while handling system call
136 move $spc, [$sp]
137 subq 4, $sp
138 move $mof, [$sp]
139 subq 4, $sp
140 move $srs, [$sp]
141 subq 4, $sp
142 move.d $acr, [$sp]
143 subq 14*4, $sp ; Make room for R0-R13.
144 movem $r13, [$sp] ; Push R0-R13
145 subq 4, $sp
146 move.d $r10, [$sp] ; Push orig_r10.
147 134
148; Set S-bit when kernel debugging to keep hardware breakpoints active. 135 sub.d 92, $sp ; Skip EXS and EDA.
136 movem $r13, [$sp]
137 move.d $sp, $r8
138 addq 14*4, $r8
139 move.d $acr, $r0
140 move $srs, $r1
141 move $mof, $r2
142 move $spc, $r3
143 move $ccs, $r4
144 move $srp, $r5
145 move $erp, $r6
146 subq 4, $sp
147 movem $r6, [$r8]
148 ei ; Enable interrupts while processing syscalls.
149 move.d $r10, [$sp]
150
151 ; Set S-bit when kernel debugging to keep hardware breakpoints active.
149#ifdef CONFIG_ETRAX_KGDB 152#ifdef CONFIG_ETRAX_KGDB
150 move $ccs, $r0 153 move $ccs, $r0
151 or.d (1<<9), $r0 154 or.d (1<<9), $r0
@@ -217,7 +220,9 @@ ret_from_sys_call:
217 and.d _TIF_ALLWORK_MASK, $r1 220 and.d _TIF_ALLWORK_MASK, $r1
218 bne _syscall_exit_work 221 bne _syscall_exit_work
219 nop 222 nop
223 .size system_call, . - system_call
220 224
225 .type _Rexit,@function
221_Rexit: 226_Rexit:
222 ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h 227 ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h
223 ;; and ptregs.h. 228 ;; and ptregs.h.
@@ -234,10 +239,12 @@ _Rexit:
234 addq 8, $sp ; Skip EXS, EDA. 239 addq 8, $sp ; Skip EXS, EDA.
235 jump $erp 240 jump $erp
236 rfe ; Restore condition code stack in delay-slot. 241 rfe ; Restore condition code stack in delay-slot.
242 .size _Rexit, . - _Rexit
237 243
238 ;; We get here after doing a syscall if extra work might need to be done 244 ;; We get here after doing a syscall if extra work might need to be done
239 ;; perform syscall exit tracing if needed. 245 ;; perform syscall exit tracing if needed.
240 246
247 .type _syscall_exit_work,@function
241_syscall_exit_work: 248_syscall_exit_work:
242 ;; R0 contains current at this point and irq's are disabled. 249 ;; R0 contains current at this point and irq's are disabled.
243 250
@@ -253,14 +260,18 @@ _syscall_exit_work:
253 move.d $r1, $r9 260 move.d $r1, $r9
254 ba _resume_userspace 261 ba _resume_userspace
255 nop 262 nop
263 .size _syscall_exit_work, . - _syscall_exit_work
256 264
265 .type _work_pending,@function
257_work_pending: 266_work_pending:
258 addoq +TI_flags, $r0, $acr 267 addoq +TI_flags, $r0, $acr
259 move.d [$acr], $r10 268 move.d [$acr], $r10
260 btstq TIF_NEED_RESCHED, $r10 ; Need resched? 269 btstq TIF_NEED_RESCHED, $r10 ; Need resched?
261 bpl _work_notifysig ; No, must be signal/notify. 270 bpl _work_notifysig ; No, must be signal/notify.
262 nop 271 nop
272 .size _work_pending, . - _work_pending
263 273
274 .type _work_resched,@function
264_work_resched: 275_work_resched:
265 move.d $r9, $r1 ; Preserve R9. 276 move.d $r9, $r1 ; Preserve R9.
266 jsr schedule 277 jsr schedule
@@ -276,7 +287,9 @@ _work_resched:
276 btstq TIF_NEED_RESCHED, $r1 287 btstq TIF_NEED_RESCHED, $r1
277 bmi _work_resched ; current->work.need_resched. 288 bmi _work_resched ; current->work.need_resched.
278 nop 289 nop
290 .size _work_resched, . - _work_resched
279 291
292 .type _work_notifysig,@function
280_work_notifysig: 293_work_notifysig:
281 ;; Deal with pending signals and notify-resume requests. 294 ;; Deal with pending signals and notify-resume requests.
282 295
@@ -288,6 +301,7 @@ _work_notifysig:
288 301
289 ba _Rexit 302 ba _Rexit
290 nop 303 nop
304 .size _work_notifysig, . - _work_notifysig
291 305
292 ;; We get here as a sidetrack when we've entered a syscall with the 306 ;; We get here as a sidetrack when we've entered a syscall with the
293 ;; trace-bit set. We need to call do_syscall_trace and then continue 307 ;; trace-bit set. We need to call do_syscall_trace and then continue
@@ -329,41 +343,43 @@ _syscall_trace_entry:
329 ;; 343 ;;
330 ;; Returns old current in R10. 344 ;; Returns old current in R10.
331 345
346 .type resume,@function
332resume: 347resume:
333 subq 4, $sp 348 subq 4, $sp ; Make space for srp.
334 move $srp, [$sp] ; Keep old/new PC on the stack. 349
335 add.d $r12, $r10 ; R10 = current tasks tss. 350 add.d $r12, $r10 ; R10 = current tasks tss.
336 addoq +THREAD_ccs, $r10, $acr 351 addoq +THREAD_ccs, $r10, $acr
352 move $srp, [$sp] ; Keep old/new PC on the stack.
337 move $ccs, [$acr] ; Save IRQ enable state. 353 move $ccs, [$acr] ; Save IRQ enable state.
338 di 354 di
339 355
340 addoq +THREAD_usp, $r10, $acr 356 addoq +THREAD_usp, $r10, $acr
357 subq 10*4, $sp ; Make room for R9.
341 move $usp, [$acr] ; Save user-mode stackpointer. 358 move $usp, [$acr] ; Save user-mode stackpointer.
342 359
343 ;; See copy_thread for the reason why register R9 is saved. 360 ;; See copy_thread for the reason why register R9 is saved.
344 subq 10*4, $sp
345 movem $r9, [$sp] ; Save non-scratch registers and R9. 361 movem $r9, [$sp] ; Save non-scratch registers and R9.
346 362
347 addoq +THREAD_ksp, $r10, $acr 363 addoq +THREAD_ksp, $r10, $acr
364 move.d $sp, $r10 ; Return last running task in R10.
348 move.d $sp, [$acr] ; Save kernel SP for old task. 365 move.d $sp, [$acr] ; Save kernel SP for old task.
349 366
350 move.d $sp, $r10 ; Return last running task in R10.
351 and.d -8192, $r10 ; Get thread_info from stackpointer. 367 and.d -8192, $r10 ; Get thread_info from stackpointer.
352 addoq +TI_task, $r10, $acr 368 addoq +TI_task, $r10, $acr
353 move.d [$acr], $r10 ; Get task.
354 add.d $r12, $r11 ; Find the new tasks tss. 369 add.d $r12, $r11 ; Find the new tasks tss.
370 move.d [$acr], $r10 ; Get task.
355 addoq +THREAD_ksp, $r11, $acr 371 addoq +THREAD_ksp, $r11, $acr
356 move.d [$acr], $sp ; Switch to new stackframe. 372 move.d [$acr], $sp ; Switch to new stackframe.
373 addoq +THREAD_usp, $r11, $acr
357 movem [$sp+], $r9 ; Restore non-scratch registers and R9. 374 movem [$sp+], $r9 ; Restore non-scratch registers and R9.
358 375
359 addoq +THREAD_usp, $r11, $acr
360 move [$acr], $usp ; Restore user-mode stackpointer. 376 move [$acr], $usp ; Restore user-mode stackpointer.
361 377
362 addoq +THREAD_ccs, $r11, $acr 378 addoq +THREAD_ccs, $r11, $acr
379 move.d [$sp+], $r11
380 jump $r11 ; Restore PC.
363 move [$acr], $ccs ; Restore IRQ enable status. 381 move [$acr], $ccs ; Restore IRQ enable status.
364 move.d [$sp+], $acr 382 .size resume, . - resume
365 jump $acr ; Restore PC.
366 nop
367 383
368nmi_interrupt: 384nmi_interrupt:
369 385
@@ -426,6 +442,7 @@ spurious_interrupt:
426 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The 442 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The
427 ;; hardware will call the unserved interrupts after the handler 443 ;; hardware will call the unserved interrupts after the handler
428 ;; finishes. 444 ;; finishes.
445 .type multiple_interrupt, @function
429multiple_interrupt: 446multiple_interrupt:
430 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h! 447 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
431 subq 12, $sp ; Skip EXS, EDA. 448 subq 12, $sp ; Skip EXS, EDA.
@@ -458,6 +475,7 @@ multiple_interrupt:
458 move.d $sp, $r10 475 move.d $sp, $r10
459 jump ret_from_intr 476 jump ret_from_intr
460 nop 477 nop
478 .size multiple_interrupt, . - multiple_interrupt
461 479
462do_sigtrap: 480do_sigtrap:
463 ;; Sigtraps the process that executed the BREAK instruction. Creates a 481 ;; Sigtraps the process that executed the BREAK instruction. Creates a
@@ -514,11 +532,13 @@ _ugdb_handle_exception:
514 move.d [$sp+], $r0 ; Restore R0 in delay slot. 532 move.d [$sp+], $r0 ; Restore R0 in delay slot.
515 533
516 .global kernel_execve 534 .global kernel_execve
535 .type kernel_execve,@function
517kernel_execve: 536kernel_execve:
518 move.d __NR_execve, $r9 537 move.d __NR_execve, $r9
519 break 13 538 break 13
520 ret 539 ret
521 nop 540 nop
541 .size kernel_execve, . - kernel_execve
522 542
523 .data 543 .data
524 544
diff --git a/arch/cris/arch-v32/kernel/head.S b/arch/cris/arch-v32/kernel/head.S
index 76266f80a5f1..5d502b9ab56d 100644
--- a/arch/cris/arch-v32/kernel/head.S
+++ b/arch/cris/arch-v32/kernel/head.S
@@ -69,7 +69,13 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */
69 ;; 69 ;;
70 ;; Note; 3 cycles is needed for a bank-select to take effect. Further; 70 ;; Note; 3 cycles is needed for a bank-select to take effect. Further;
71 ;; bank 1 is the instruction MMU, bank 2 is the data MMU. 71 ;; bank 1 is the instruction MMU, bank 2 is the data MMU.
72#ifndef CONFIG_ETRAX_VCS_SIM 72
73#ifdef CONFIG_CRIS_MACH_ARTPEC3
74 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
75 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \
76 | REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 5) \
77 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0
78#elif !defined(CONFIG_ETRAX_VCS_SIM)
73 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ 79 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
74 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ 80 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \
75 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0 81 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0
@@ -88,7 +94,39 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */
88 94
89 ;; Enable certain page protections and setup linear mapping 95 ;; Enable certain page protections and setup linear mapping
90 ;; for f,e,c,b,4,0. 96 ;; for f,e,c,b,4,0.
91#ifndef CONFIG_ETRAX_VCS_SIM 97
98 ;; ARTPEC-3:
99 ;; c,d used for linear kernel mapping, up to 512 MB
100 ;; e used for vmalloc
101 ;; f unused, but page mapped to get page faults
102
103 ;; ETRAX FS:
104 ;; c used for linear kernel mapping, up to 256 MB
105 ;; d used for vmalloc
106 ;; e,f used for memory-mapped NOR flash
107
108#ifdef CONFIG_CRIS_MACH_ARTPEC3
109 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
110 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
111 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
112 | REG_STATE(mmu, rw_mm_cfg, inv, on) \
113 | REG_STATE(mmu, rw_mm_cfg, seg_f, page) \
114 | REG_STATE(mmu, rw_mm_cfg, seg_e, page) \
115 | REG_STATE(mmu, rw_mm_cfg, seg_d, linear) \
116 | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \
117 | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \
118 | REG_STATE(mmu, rw_mm_cfg, seg_a, page) \
119 | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \
120 | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \
121 | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \
122 | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \
123 | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \
124 | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \
125 | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \
126 | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \
127 | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \
128 | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2
129#elif !defined(CONFIG_ETRAX_VCS_SIM)
92 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ 130 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
93 | REG_STATE(mmu, rw_mm_cfg, acc, on) \ 131 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
94 | REG_STATE(mmu, rw_mm_cfg, ex, on) \ 132 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
@@ -329,7 +367,7 @@ _no_romfs_in_flash:
329 ;; For jffs2, a jhead is prepended which contains with magic and length. 367 ;; For jffs2, a jhead is prepended which contains with magic and length.
330 ;; The jhead is not part of the jffs2 partition however. 368 ;; The jhead is not part of the jffs2 partition however.
331#ifndef CONFIG_ETRAXFS_SIM 369#ifndef CONFIG_ETRAXFS_SIM
332 move.d __vmlinux_end, $r0 370 move.d __bss_start, $r0
333#else 371#else
334 move.d __end, $r0 372 move.d __end, $r0
335#endif 373#endif
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 0b1febe44aa3..2ed48ae3d313 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -97,7 +97,11 @@ extern void breakh_BUG(void);
97/* 97/*
98 * Build the IRQ handler stubs using macros from irq.h. 98 * Build the IRQ handler stubs using macros from irq.h.
99 */ 99 */
100#ifdef CONFIG_CRIS_MACH_ARTPEC3
101BUILD_TIMER_IRQ(0x31, 0)
102#else
100BUILD_IRQ(0x31) 103BUILD_IRQ(0x31)
104#endif
101BUILD_IRQ(0x32) 105BUILD_IRQ(0x32)
102BUILD_IRQ(0x33) 106BUILD_IRQ(0x33)
103BUILD_IRQ(0x34) 107BUILD_IRQ(0x34)
@@ -123,7 +127,11 @@ BUILD_IRQ(0x47)
123BUILD_IRQ(0x48) 127BUILD_IRQ(0x48)
124BUILD_IRQ(0x49) 128BUILD_IRQ(0x49)
125BUILD_IRQ(0x4a) 129BUILD_IRQ(0x4a)
130#ifdef CONFIG_ETRAXFS
131BUILD_TIMER_IRQ(0x4b, 0)
132#else
126BUILD_IRQ(0x4b) 133BUILD_IRQ(0x4b)
134#endif
127BUILD_IRQ(0x4c) 135BUILD_IRQ(0x4c)
128BUILD_IRQ(0x4d) 136BUILD_IRQ(0x4d)
129BUILD_IRQ(0x4e) 137BUILD_IRQ(0x4e)
@@ -199,25 +207,20 @@ block_irq(int irq, int cpu)
199 unsigned long flags; 207 unsigned long flags;
200 208
201 spin_lock_irqsave(&irq_lock, flags); 209 spin_lock_irqsave(&irq_lock, flags);
202 if (irq - FIRST_IRQ < 32) 210 /* Remember, 1 let thru, 0 block. */
211 if (irq - FIRST_IRQ < 32) {
203 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 212 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
204 rw_mask, 0); 213 rw_mask, 0);
205 else
206 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
207 rw_mask, 1);
208
209 /* Remember; 1 let thru, 0 block. */
210 if (irq - FIRST_IRQ < 32)
211 intr_mask &= ~(1 << (irq - FIRST_IRQ)); 214 intr_mask &= ~(1 << (irq - FIRST_IRQ));
212 else
213 intr_mask &= ~(1 << (irq - FIRST_IRQ - 32));
214
215 if (irq - FIRST_IRQ < 32)
216 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 215 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask,
217 0, intr_mask); 216 0, intr_mask);
218 else 217 } else {
218 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
219 rw_mask, 1);
220 intr_mask &= ~(1 << (irq - FIRST_IRQ - 32));
219 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 221 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask,
220 1, intr_mask); 222 1, intr_mask);
223 }
221 spin_unlock_irqrestore(&irq_lock, flags); 224 spin_unlock_irqrestore(&irq_lock, flags);
222} 225}
223 226
@@ -228,26 +231,20 @@ unblock_irq(int irq, int cpu)
228 unsigned long flags; 231 unsigned long flags;
229 232
230 spin_lock_irqsave(&irq_lock, flags); 233 spin_lock_irqsave(&irq_lock, flags);
231 if (irq - FIRST_IRQ < 32) 234 /* Remember, 1 let thru, 0 block. */
235 if (irq - FIRST_IRQ < 32) {
232 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 236 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
233 rw_mask, 0); 237 rw_mask, 0);
234 else
235 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
236 rw_mask, 1);
237
238 /* Remember; 1 let thru, 0 block. */
239 if (irq - FIRST_IRQ < 32)
240 intr_mask |= (1 << (irq - FIRST_IRQ)); 238 intr_mask |= (1 << (irq - FIRST_IRQ));
241 else
242 intr_mask |= (1 << (irq - FIRST_IRQ - 32));
243
244 if (irq - FIRST_IRQ < 32)
245 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 239 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask,
246 0, intr_mask); 240 0, intr_mask);
247 else 241 } else {
242 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu],
243 rw_mask, 1);
244 intr_mask |= (1 << (irq - FIRST_IRQ - 32));
248 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 245 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask,
249 1, intr_mask); 246 1, intr_mask);
250 247 }
251 spin_unlock_irqrestore(&irq_lock, flags); 248 spin_unlock_irqrestore(&irq_lock, flags);
252} 249}
253 250
diff --git a/arch/cris/arch-v32/kernel/kgdb.c b/arch/cris/arch-v32/kernel/kgdb.c
index c981fd663323..6b653323d796 100644
--- a/arch/cris/arch-v32/kernel/kgdb.c
+++ b/arch/cris/arch-v32/kernel/kgdb.c
@@ -174,10 +174,10 @@
174#include <asm/ptrace.h> 174#include <asm/ptrace.h>
175 175
176#include <asm/irq.h> 176#include <asm/irq.h>
177#include <arch/hwregs/reg_map.h> 177#include <hwregs/reg_map.h>
178#include <arch/hwregs/reg_rdwr.h> 178#include <hwregs/reg_rdwr.h>
179#include <arch/hwregs/intr_vect_defs.h> 179#include <hwregs/intr_vect_defs.h>
180#include <arch/hwregs/ser_defs.h> 180#include <hwregs/ser_defs.h>
181 181
182/* From entry.S. */ 182/* From entry.S. */
183extern void gdb_handle_exception(void); 183extern void gdb_handle_exception(void);
@@ -988,26 +988,26 @@ stub_is_stopped(int sigval)
988 } 988 }
989 /* Only send PC, frame and stack pointer. */ 989 /* Only send PC, frame and stack pointer. */
990 read_register(PC, &reg_cont); 990 read_register(PC, &reg_cont);
991 ptr = pack_hex_byte(PC); 991 ptr = pack_hex_byte(ptr, PC);
992 *ptr++ = ':'; 992 *ptr++ = ':';
993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]); 993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
994 *ptr++ = ';'; 994 *ptr++ = ';';
995 995
996 read_register(R8, &reg_cont); 996 read_register(R8, &reg_cont);
997 ptr = pack_hex_byte(R8); 997 ptr = pack_hex_byte(ptr, R8);
998 *ptr++ = ':'; 998 *ptr++ = ':';
999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]); 999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
1000 *ptr++ = ';'; 1000 *ptr++ = ';';
1001 1001
1002 read_register(SP, &reg_cont); 1002 read_register(SP, &reg_cont);
1003 ptr = pack_hex_byte(SP); 1003 ptr = pack_hex_byte(ptr, SP);
1004 *ptr++ = ':'; 1004 *ptr++ = ':';
1005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]); 1005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
1006 *ptr++ = ';'; 1006 *ptr++ = ';';
1007 1007
1008 /* Send ERP as well; this will save us an entire register fetch in some cases. */ 1008 /* Send ERP as well; this will save us an entire register fetch in some cases. */
1009 read_register(ERP, &reg_cont); 1009 read_register(ERP, &reg_cont);
1010 ptr = pack_hex_byte(ERP); 1010 ptr = pack_hex_byte(ptr, ERP);
1011 *ptr++ = ':'; 1011 *ptr++ = ':';
1012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]); 1012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
1013 *ptr++ = ';'; 1013 *ptr++ = ';';
diff --git a/arch/cris/arch-v32/kernel/kgdb_asm.S b/arch/cris/arch-v32/kernel/kgdb_asm.S
index eba93e7e4aad..f3a47605902a 100644
--- a/arch/cris/arch-v32/kernel/kgdb_asm.S
+++ b/arch/cris/arch-v32/kernel/kgdb_asm.S
@@ -5,7 +5,7 @@
5 * port exceptions for kernel debugging purposes. 5 * port exceptions for kernel debugging purposes.
6 */ 6 */
7 7
8#include <arch/hwregs/intr_vect.h> 8#include <hwregs/intr_vect.h>
9 9
10 ;; Exported functions. 10 ;; Exported functions.
11 .globl kgdb_handle_exception 11 .globl kgdb_handle_exception
diff --git a/arch/cris/arch-v32/kernel/pinmux.c b/arch/cris/arch-v32/kernel/pinmux.c
deleted file mode 100644
index f6f3637a4194..000000000000
--- a/arch/cris/arch-v32/kernel/pinmux.c
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Allocator for I/O pins. All pins are allocated to GPIO at bootup.
3 * Unassigned pins and GPIO pins can be allocated to a fixed interface
4 * or the I/O processor instead.
5 *
6 * Copyright (c) 2004 Axis Communications AB.
7 */
8
9#include <linux/init.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <linux/spinlock.h>
14#include <arch/hwregs/reg_map.h>
15#include <arch/hwregs/reg_rdwr.h>
16#include <arch/pinmux.h>
17#include <arch/hwregs/pinmux_defs.h>
18
19#undef DEBUG
20
21#define PORT_PINS 18
22#define PORTS 4
23
24static char pins[PORTS][PORT_PINS];
25static DEFINE_SPINLOCK(pinmux_lock);
26
27static void crisv32_pinmux_set(int port);
28
29int
30crisv32_pinmux_init(void)
31{
32 static int initialized = 0;
33
34 if (!initialized) {
35 reg_pinmux_rw_pa pa = REG_RD(pinmux, regi_pinmux, rw_pa);
36 initialized = 1;
37 pa.pa0 = pa.pa1 = pa.pa2 = pa.pa3 =
38 pa.pa4 = pa.pa5 = pa.pa6 = pa.pa7 = regk_pinmux_yes;
39 REG_WR(pinmux, regi_pinmux, rw_pa, pa);
40 crisv32_pinmux_alloc(PORT_B, 0, PORT_PINS - 1, pinmux_gpio);
41 crisv32_pinmux_alloc(PORT_C, 0, PORT_PINS - 1, pinmux_gpio);
42 crisv32_pinmux_alloc(PORT_D, 0, PORT_PINS - 1, pinmux_gpio);
43 crisv32_pinmux_alloc(PORT_E, 0, PORT_PINS - 1, pinmux_gpio);
44 }
45
46 return 0;
47}
48
49int
50crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
51{
52 int i;
53 unsigned long flags;
54
55 crisv32_pinmux_init();
56
57 if (port > PORTS || port < 0)
58 return -EINVAL;
59
60 spin_lock_irqsave(&pinmux_lock, flags);
61
62 for (i = first_pin; i <= last_pin; i++)
63 {
64 if ((pins[port][i] != pinmux_none) && (pins[port][i] != pinmux_gpio) &&
65 (pins[port][i] != mode))
66 {
67 spin_unlock_irqrestore(&pinmux_lock, flags);
68#ifdef DEBUG
69 panic("Pinmux alloc failed!\n");
70#endif
71 return -EPERM;
72 }
73 }
74
75 for (i = first_pin; i <= last_pin; i++)
76 pins[port][i] = mode;
77
78 crisv32_pinmux_set(port);
79
80 spin_unlock_irqrestore(&pinmux_lock, flags);
81
82 return 0;
83}
84
85int
86crisv32_pinmux_alloc_fixed(enum fixed_function function)
87{
88 int ret = -EINVAL;
89 char saved[sizeof pins];
90 unsigned long flags;
91
92 spin_lock_irqsave(&pinmux_lock, flags);
93
94 /* Save internal data for recovery */
95 memcpy(saved, pins, sizeof pins);
96
97 reg_pinmux_rw_hwprot hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
98
99 switch(function)
100 {
101 case pinmux_ser1:
102 ret = crisv32_pinmux_alloc(PORT_C, 4, 7, pinmux_fixed);
103 hwprot.ser1 = regk_pinmux_yes;
104 break;
105 case pinmux_ser2:
106 ret = crisv32_pinmux_alloc(PORT_C, 8, 11, pinmux_fixed);
107 hwprot.ser2 = regk_pinmux_yes;
108 break;
109 case pinmux_ser3:
110 ret = crisv32_pinmux_alloc(PORT_C, 12, 15, pinmux_fixed);
111 hwprot.ser3 = regk_pinmux_yes;
112 break;
113 case pinmux_sser0:
114 ret = crisv32_pinmux_alloc(PORT_C, 0, 3, pinmux_fixed);
115 ret |= crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
116 hwprot.sser0 = regk_pinmux_yes;
117 break;
118 case pinmux_sser1:
119 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
120 hwprot.sser1 = regk_pinmux_yes;
121 break;
122 case pinmux_ata0:
123 ret = crisv32_pinmux_alloc(PORT_D, 5, 7, pinmux_fixed);
124 ret |= crisv32_pinmux_alloc(PORT_D, 15, 17, pinmux_fixed);
125 hwprot.ata0 = regk_pinmux_yes;
126 break;
127 case pinmux_ata1:
128 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
129 ret |= crisv32_pinmux_alloc(PORT_E, 17, 17, pinmux_fixed);
130 hwprot.ata1 = regk_pinmux_yes;
131 break;
132 case pinmux_ata2:
133 ret = crisv32_pinmux_alloc(PORT_C, 11, 15, pinmux_fixed);
134 ret |= crisv32_pinmux_alloc(PORT_E, 3, 3, pinmux_fixed);
135 hwprot.ata2 = regk_pinmux_yes;
136 break;
137 case pinmux_ata3:
138 ret = crisv32_pinmux_alloc(PORT_C, 8, 10, pinmux_fixed);
139 ret |= crisv32_pinmux_alloc(PORT_C, 0, 2, pinmux_fixed);
140 hwprot.ata2 = regk_pinmux_yes;
141 break;
142 case pinmux_ata:
143 ret = crisv32_pinmux_alloc(PORT_B, 0, 15, pinmux_fixed);
144 ret |= crisv32_pinmux_alloc(PORT_D, 8, 15, pinmux_fixed);
145 hwprot.ata = regk_pinmux_yes;
146 break;
147 case pinmux_eth1:
148 ret = crisv32_pinmux_alloc(PORT_E, 0, 17, pinmux_fixed);
149 hwprot.eth1 = regk_pinmux_yes;
150 hwprot.eth1_mgm = regk_pinmux_yes;
151 break;
152 case pinmux_timer:
153 ret = crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
154 hwprot.timer = regk_pinmux_yes;
155 spin_unlock_irqrestore(&pinmux_lock, flags);
156 return ret;
157 }
158
159 if (!ret)
160 REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
161 else
162 memcpy(pins, saved, sizeof pins);
163
164 spin_unlock_irqrestore(&pinmux_lock, flags);
165
166 return ret;
167}
168
169void
170crisv32_pinmux_set(int port)
171{
172 int i;
173 int gpio_val = 0;
174 int iop_val = 0;
175
176 for (i = 0; i < PORT_PINS; i++)
177 {
178 if (pins[port][i] == pinmux_gpio)
179 gpio_val |= (1 << i);
180 else if (pins[port][i] == pinmux_iop)
181 iop_val |= (1 << i);
182 }
183
184 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_gio + 8*port, gpio_val);
185 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_iop + 8*port, iop_val);
186
187#ifdef DEBUG
188 crisv32_pinmux_dump();
189#endif
190}
191
192int
193crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
194{
195 int i;
196 unsigned long flags;
197
198 crisv32_pinmux_init();
199
200 if (port > PORTS || port < 0)
201 return -EINVAL;
202
203 spin_lock_irqsave(&pinmux_lock, flags);
204
205 for (i = first_pin; i <= last_pin; i++)
206 pins[port][i] = pinmux_none;
207
208 crisv32_pinmux_set(port);
209 spin_unlock_irqrestore(&pinmux_lock, flags);
210
211 return 0;
212}
213
214void
215crisv32_pinmux_dump(void)
216{
217 int i, j;
218
219 crisv32_pinmux_init();
220
221 for (i = 0; i < PORTS; i++)
222 {
223 printk("Port %c\n", 'B'+i);
224 for (j = 0; j < PORT_PINS; j++)
225 printk(" Pin %d = %d\n", j, pins[i][j]);
226 }
227}
228
229__initcall(crisv32_pinmux_init);
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 72e9e8331f63..61e10ae65296 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -9,6 +9,9 @@
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/param.h> 10#include <linux/param.h>
11 11
12#include <linux/i2c.h>
13#include <linux/platform_device.h>
14
12#ifdef CONFIG_PROC_FS 15#ifdef CONFIG_PROC_FS
13 16
14#define HAS_FPU 0x0001 17#define HAS_FPU 0x0001
@@ -43,14 +46,15 @@ static struct cpu_info cpinfo[] = {
43 46
44 {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB 47 {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
45 | HAS_MMU}, 48 | HAS_MMU},
46 49#ifdef CONFIG_ETRAXFS
47 {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU}, 50 {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU},
48 51#else
52 {"ARTPEC-3", 32, 32, HAS_ETHERNET100 | HAS_MMU},
53#endif
49 {"Unknown", 0, 0, 0} 54 {"Unknown", 0, 0, 0}
50}; 55};
51 56
52int 57int show_cpuinfo(struct seq_file *m, void *v)
53show_cpuinfo(struct seq_file *m, void *v)
54{ 58{
55 int i; 59 int i;
56 int cpu = (int)v - 1; 60 int cpu = (int)v - 1;
@@ -107,9 +111,63 @@ show_cpuinfo(struct seq_file *m, void *v)
107 111
108#endif /* CONFIG_PROC_FS */ 112#endif /* CONFIG_PROC_FS */
109 113
110void 114void show_etrax_copyright(void)
111show_etrax_copyright(void) 115{
116#ifdef CONFIG_ETRAXFS
117 printk(KERN_INFO "Linux/CRISv32 port on ETRAX FS "
118 "(C) 2003, 2004 Axis Communications AB\n");
119#else
120 printk(KERN_INFO "Linux/CRISv32 port on ARTPEC-3 "
121 "(C) 2003-2009 Axis Communications AB\n");
122#endif
123}
124
125static struct i2c_board_info __initdata i2c_info[] = {
126 {I2C_BOARD_INFO("camblock", 0x43)},
127 {I2C_BOARD_INFO("tmp100", 0x48)},
128 {I2C_BOARD_INFO("tmp100", 0x4A)},
129 {I2C_BOARD_INFO("tmp100", 0x4C)},
130 {I2C_BOARD_INFO("tmp100", 0x4D)},
131 {I2C_BOARD_INFO("tmp100", 0x4E)},
132#ifdef CONFIG_RTC_DRV_PCF8563
133 {I2C_BOARD_INFO("pcf8563", 0x51)},
134#endif
135#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
136 {I2C_BOARD_INFO("vgpio", 0x20)},
137 {I2C_BOARD_INFO("vgpio", 0x21)},
138#endif
139 {I2C_BOARD_INFO("pca9536", 0x41)},
140 {I2C_BOARD_INFO("fnp300", 0x40)},
141 {I2C_BOARD_INFO("fnp300", 0x42)},
142 {I2C_BOARD_INFO("adc101", 0x54)},
143};
144
145static struct i2c_board_info __initdata i2c_info2[] = {
146 {I2C_BOARD_INFO("camblock", 0x43)},
147 {I2C_BOARD_INFO("tmp100", 0x48)},
148 {I2C_BOARD_INFO("tmp100", 0x4A)},
149 {I2C_BOARD_INFO("tmp100", 0x4C)},
150 {I2C_BOARD_INFO("tmp100", 0x4D)},
151 {I2C_BOARD_INFO("tmp100", 0x4E)},
152#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
153 {I2C_BOARD_INFO("vgpio", 0x20)},
154 {I2C_BOARD_INFO("vgpio", 0x21)},
155#endif
156 {I2C_BOARD_INFO("pca9536", 0x41)},
157 {I2C_BOARD_INFO("fnp300", 0x40)},
158 {I2C_BOARD_INFO("fnp300", 0x42)},
159 {I2C_BOARD_INFO("adc101", 0x54)},
160};
161
162static struct i2c_board_info __initdata i2c_info3[] = {
163 {I2C_BOARD_INFO("adc101", 0x54)},
164};
165
166static int __init etrax_init(void)
112{ 167{
113 printk(KERN_INFO 168 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
114 "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n"); 169 i2c_register_board_info(1, i2c_info2, ARRAY_SIZE(i2c_info2));
170 i2c_register_board_info(2, i2c_info3, ARRAY_SIZE(i2c_info3));
171 return 0;
115} 172}
173arch_initcall(etrax_init);
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index 0b7e3f143281..b3a05ae56214 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -587,7 +587,7 @@ do_signal(int canrestart, struct pt_regs *regs)
587 } 587 }
588 588
589 if (regs->r10 == -ERESTART_RESTARTBLOCK){ 589 if (regs->r10 == -ERESTART_RESTARTBLOCK){
590 regs->r10 = __NR_restart_syscall; 590 regs->r9 = __NR_restart_syscall;
591 regs->erp -= 2; 591 regs->erp -= 2;
592 } 592 }
593 } 593 }
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index 1ee0e1010228..a545211e999d 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * linux/arch/cris/arch-v32/kernel/time.c 2 * linux/arch/cris/arch-v32/kernel/time.c
3 * 3 *
4 * Copyright (C) 2003-2007 Axis Communications AB 4 * Copyright (C) 2003-2010 Axis Communications AB
5 * 5 *
6 */ 6 */
7 7
8#include <linux/timex.h> 8#include <linux/timex.h>
9#include <linux/time.h> 9#include <linux/time.h>
10#include <linux/jiffies.h> 10#include <linux/clocksource.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/swap.h> 12#include <linux/swap.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
@@ -36,6 +36,30 @@
36/* Number of 763 counts before watchdog bites */ 36/* Number of 763 counts before watchdog bites */
37#define ETRAX_WD_CNT ((2*ETRAX_WD_HZ)/HZ + 1) 37#define ETRAX_WD_CNT ((2*ETRAX_WD_HZ)/HZ + 1)
38 38
39/* Register the continuos readonly timer available in FS and ARTPEC-3. */
40static cycle_t read_cont_rotime(struct clocksource *cs)
41{
42 return (u32)REG_RD(timer, regi_timer0, r_time);
43}
44
45static struct clocksource cont_rotime = {
46 .name = "crisv32_rotime",
47 .rating = 300,
48 .read = read_cont_rotime,
49 .mask = CLOCKSOURCE_MASK(32),
50 .shift = 10,
51 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
52};
53
54static int __init etrax_init_cont_rotime(void)
55{
56 cont_rotime.mult = clocksource_khz2mult(100000, cont_rotime.shift);
57 clocksource_register(&cont_rotime);
58 return 0;
59}
60arch_initcall(etrax_init_cont_rotime);
61
62
39unsigned long timer_regs[NR_CPUS] = 63unsigned long timer_regs[NR_CPUS] =
40{ 64{
41 regi_timer0, 65 regi_timer0,
@@ -67,43 +91,6 @@ unsigned long get_ns_in_jiffie(void)
67 return ns; 91 return ns;
68} 92}
69 93
70unsigned long do_slow_gettimeoffset(void)
71{
72 unsigned long count;
73 unsigned long usec_count = 0;
74
75 /* For the first call after boot */
76 static unsigned long count_p = TIMER0_DIV;
77 static unsigned long jiffies_p = 0;
78
79 /* Cache volatile jiffies temporarily; we have IRQs turned off. */
80 unsigned long jiffies_t;
81
82 /* The timer interrupt comes from Etrax timer 0. In order to get
83 * better precision, we check the current value. It might have
84 * underflowed already though. */
85 count = REG_RD(timer, regi_timer0, r_tmr0_data);
86 jiffies_t = jiffies;
87
88 /* Avoiding timer inconsistencies (they are rare, but they happen)
89 * There is one problem that must be avoided here:
90 * 1. the timer counter underflows
91 */
92 if( jiffies_t == jiffies_p ) {
93 if( count > count_p ) {
94 /* Timer wrapped, use new count and prescale.
95 * Increase the time corresponding to one jiffy.
96 */
97 usec_count = 1000000/HZ;
98 }
99 } else
100 jiffies_p = jiffies_t;
101 count_p = count;
102 /* Convert timer value to usec */
103 /* 100 MHz timer, divide by 100 to get usec */
104 usec_count += (TIMER0_DIV - count) / 100;
105 return usec_count;
106}
107 94
108/* From timer MDS describing the hardware watchdog: 95/* From timer MDS describing the hardware watchdog:
109 * 4.3.1 Watchdog Operation 96 * 4.3.1 Watchdog Operation
@@ -126,8 +113,7 @@ static short int watchdog_key = 42; /* arbitrary 7 bit number */
126 * is used though, so set this really low. */ 113 * is used though, so set this really low. */
127#define WATCHDOG_MIN_FREE_PAGES 8 114#define WATCHDOG_MIN_FREE_PAGES 8
128 115
129void 116void reset_watchdog(void)
130reset_watchdog(void)
131{ 117{
132#if defined(CONFIG_ETRAX_WATCHDOG) 118#if defined(CONFIG_ETRAX_WATCHDOG)
133 reg_timer_rw_wd_ctrl wd_ctrl = { 0 }; 119 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
@@ -147,8 +133,7 @@ reset_watchdog(void)
147 133
148/* stop the watchdog - we still need the correct key */ 134/* stop the watchdog - we still need the correct key */
149 135
150void 136void stop_watchdog(void)
151stop_watchdog(void)
152{ 137{
153#if defined(CONFIG_ETRAX_WATCHDOG) 138#if defined(CONFIG_ETRAX_WATCHDOG)
154 reg_timer_rw_wd_ctrl wd_ctrl = { 0 }; 139 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
@@ -162,8 +147,7 @@ stop_watchdog(void)
162 147
163extern void show_registers(struct pt_regs *regs); 148extern void show_registers(struct pt_regs *regs);
164 149
165void 150void handle_watchdog_bite(struct pt_regs *regs)
166handle_watchdog_bite(struct pt_regs* regs)
167{ 151{
168#if defined(CONFIG_ETRAX_WATCHDOG) 152#if defined(CONFIG_ETRAX_WATCHDOG)
169 extern int cause_of_death; 153 extern int cause_of_death;
@@ -203,8 +187,7 @@ handle_watchdog_bite(struct pt_regs* regs)
203 */ 187 */
204extern void cris_do_profile(struct pt_regs *regs); 188extern void cris_do_profile(struct pt_regs *regs);
205 189
206static inline irqreturn_t 190static inline irqreturn_t timer_interrupt(int irq, void *dev_id)
207timer_interrupt(int irq, void *dev_id)
208{ 191{
209 struct pt_regs *regs = get_irq_regs(); 192 struct pt_regs *regs = get_irq_regs();
210 int cpu = smp_processor_id(); 193 int cpu = smp_processor_id();
@@ -233,7 +216,9 @@ timer_interrupt(int irq, void *dev_id)
233 return IRQ_HANDLED; 216 return IRQ_HANDLED;
234 217
235 /* Call the real timer interrupt handler */ 218 /* Call the real timer interrupt handler */
219 write_seqlock(&xtime_lock);
236 do_timer(1); 220 do_timer(1);
221 write_sequnlock(&xtime_lock);
237 return IRQ_HANDLED; 222 return IRQ_HANDLED;
238} 223}
239 224
@@ -246,8 +231,7 @@ static struct irqaction irq_timer = {
246 .name = "timer" 231 .name = "timer"
247}; 232};
248 233
249void __init 234void __init cris_timer_init(void)
250cris_timer_init(void)
251{ 235{
252 int cpu = smp_processor_id(); 236 int cpu = smp_processor_id();
253 reg_timer_rw_tmr0_ctrl tmr0_ctrl = { 0 }; 237 reg_timer_rw_tmr0_ctrl tmr0_ctrl = { 0 };
@@ -273,8 +257,7 @@ cris_timer_init(void)
273 REG_WR(timer, timer_regs[cpu], rw_intr_mask, timer_intr_mask); 257 REG_WR(timer, timer_regs[cpu], rw_intr_mask, timer_intr_mask);
274} 258}
275 259
276void __init 260void __init time_init(void)
277time_init(void)
278{ 261{
279 reg_intr_vect_rw_mask intr_mask; 262 reg_intr_vect_rw_mask intr_mask;
280 263
diff --git a/arch/cris/arch-v32/kernel/traps.c b/arch/cris/arch-v32/kernel/traps.c
index 9003e382cada..8bbe09c93132 100644
--- a/arch/cris/arch-v32/kernel/traps.c
+++ b/arch/cris/arch-v32/kernel/traps.c
@@ -9,8 +9,7 @@
9#include <hwregs/intr_vect_defs.h> 9#include <hwregs/intr_vect_defs.h>
10#include <asm/irq.h> 10#include <asm/irq.h>
11 11
12void 12void show_registers(struct pt_regs *regs)
13show_registers(struct pt_regs *regs)
14{ 13{
15 /* 14 /*
16 * It's possible to use either the USP register or current->thread.usp. 15 * It's possible to use either the USP register or current->thread.usp.
@@ -101,8 +100,7 @@ bad_value:
101 } 100 }
102} 101}
103 102
104void 103void arch_enable_nmi(void)
105arch_enable_nmi(void)
106{ 104{
107 unsigned long flags; 105 unsigned long flags;
108 106
diff --git a/arch/cris/arch-v32/lib/checksum.S b/arch/cris/arch-v32/lib/checksum.S
index 87f3fd71ab10..4a72a94a49ad 100644
--- a/arch/cris/arch-v32/lib/checksum.S
+++ b/arch/cris/arch-v32/lib/checksum.S
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8 .globl csum_partial 8 .globl csum_partial
9 .type csum_partial,@function
9csum_partial: 10csum_partial:
10 11
11 ;; r10 - src 12 ;; r10 - src
@@ -83,3 +84,5 @@ _do_byte:
83 addu.b [$r10],$r12 84 addu.b [$r10],$r12
84 ret 85 ret
85 move.d $r12,$r10 86 move.d $r12,$r10
87
88 .size csum_partial, .-csum_partial
diff --git a/arch/cris/arch-v32/lib/checksumcopy.S b/arch/cris/arch-v32/lib/checksumcopy.S
index 21aabe91489b..54e209f18b06 100644
--- a/arch/cris/arch-v32/lib/checksumcopy.S
+++ b/arch/cris/arch-v32/lib/checksumcopy.S
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11 .globl csum_partial_copy_nocheck 11 .globl csum_partial_copy_nocheck
12 .type csum_partial_copy_nocheck,@function
12csum_partial_copy_nocheck: 13csum_partial_copy_nocheck:
13 14
14 ;; r10 - src 15 ;; r10 - src
@@ -89,3 +90,5 @@ _do_byte:
89 move.b $r9,[$r11] 90 move.b $r9,[$r11]
90 ret 91 ret
91 move.d $r13,$r10 92 move.d $r13,$r10
93
94 .size csum_partial_copy_nocheck, . - csum_partial_copy_nocheck
diff --git a/arch/cris/arch-v32/lib/spinlock.S b/arch/cris/arch-v32/lib/spinlock.S
index 79087ef59a1c..fe610b9d775f 100644
--- a/arch/cris/arch-v32/lib/spinlock.S
+++ b/arch/cris/arch-v32/lib/spinlock.S
@@ -6,7 +6,9 @@
6 6
7 7
8 .global cris_spin_lock 8 .global cris_spin_lock
9 .type cris_spin_lock,@function
9 .global cris_spin_trylock 10 .global cris_spin_trylock
11 .type cris_spin_trylock,@function
10 12
11 .text 13 .text
12 14
@@ -22,6 +24,8 @@ cris_spin_lock:
22 ret 24 ret
23 nop 25 nop
24 26
27 .size cris_spin_lock, . - cris_spin_lock
28
25cris_spin_trylock: 29cris_spin_trylock:
26 clearf p 30 clearf p
271: move.b [$r10], $r11 311: move.b [$r10], $r11
@@ -31,3 +35,6 @@ cris_spin_trylock:
31 clearf p 35 clearf p
32 ret 36 ret
33 movu.b $r11,$r10 37 movu.b $r11,$r10
38
39 .size cris_spin_trylock, . - cris_spin_trylock
40
diff --git a/arch/cris/arch-v32/mach-a3/Kconfig b/arch/cris/arch-v32/mach-a3/Kconfig
index a4df06d5997a..7796aafc711e 100644
--- a/arch/cris/arch-v32/mach-a3/Kconfig
+++ b/arch/cris/arch-v32/mach-a3/Kconfig
@@ -33,6 +33,10 @@ config ETRAX_DDR2_CONFIG
33 hex "DDR2 config" 33 hex "DDR2 config"
34 default "0" 34 default "0"
35 35
36config ETRAX_DDR2_LATENCY
37 hex "DDR2 latency"
38 default "0"
39
36config ETRAX_PIO_CE0_CFG 40config ETRAX_PIO_CE0_CFG
37 hex "PIO CE0 configuration" 41 hex "PIO CE0 configuration"
38 default "0" 42 default "0"
diff --git a/arch/cris/arch-v32/mach-a3/dram_init.S b/arch/cris/arch-v32/mach-a3/dram_init.S
index 94d6b41cb299..ec8648be32d3 100644
--- a/arch/cris/arch-v32/mach-a3/dram_init.S
+++ b/arch/cris/arch-v32/mach-a3/dram_init.S
@@ -24,11 +24,21 @@
24 24
25 ;; Refer to ddr2 MDS for initialization sequence 25 ;; Refer to ddr2 MDS for initialization sequence
26 26
27 ; 2. Wait 200us
28 move.d 10000, $r2
291: bne 1b
30 subq 1, $r2
31
27 ; Start clock 32 ; Start clock
28 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_cfg), $r0 33 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_cfg), $r0
29 move.d REG_STATE(ddr2, rw_phy_cfg, en, yes), $r1 34 move.d REG_STATE(ddr2, rw_phy_cfg, en, yes), $r1
30 move.d $r1, [$r0] 35 move.d $r1, [$r0]
31 36
37 ; 2. Wait 200us
38 move.d 10000, $r2
391: bne 1b
40 subq 1, $r2
41
32 ; Reset phy and start calibration 42 ; Reset phy and start calibration
33 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_ctrl), $r0 43 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_ctrl), $r0
34 move.d REG_STATE(ddr2, rw_phy_ctrl, rst, yes) | \ 44 move.d REG_STATE(ddr2, rw_phy_ctrl, rst, yes) | \
@@ -52,6 +62,10 @@ do_cmd:
52 lslq 16, $r1 62 lslq 16, $r1
53 or.d $r3, $r1 63 or.d $r3, $r1
54 move.d $r1, [$r0] 64 move.d $r1, [$r0]
65 ; 2. Wait 200us
66 move.d 10000, $r4
671: bne 1b
68 subq 1, $r4
55 cmp.d sdram_commands_end, $r2 69 cmp.d sdram_commands_end, $r2
56 blo command_loop 70 blo command_loop
57 nop 71 nop
@@ -63,7 +77,7 @@ do_cmd:
63 77
64 ; Set latency 78 ; Set latency
65 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency), $r0 79 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency), $r0
66 move.d 0x13, $r1 80 move.d CONFIG_ETRAX_DDR2_LATENCY, $r1
67 move.d $r1, [$r0] 81 move.d $r1, [$r0]
68 82
69 ; Set configuration 83 ; Set configuration
diff --git a/arch/cris/arch-v32/mach-a3/hw_settings.S b/arch/cris/arch-v32/mach-a3/hw_settings.S
index 258a6329cd4a..0145725a1ce5 100644
--- a/arch/cris/arch-v32/mach-a3/hw_settings.S
+++ b/arch/cris/arch-v32/mach-a3/hw_settings.S
@@ -31,6 +31,8 @@
31 ; Register values 31 ; Register values
32 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_cfg) 32 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_cfg)
33 .dword CONFIG_ETRAX_DDR2_CONFIG 33 .dword CONFIG_ETRAX_DDR2_CONFIG
34 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency)
35 .dword CONFIG_ETRAX_DDR2_LATENCY
34 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_timing) 36 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_timing)
35 .dword CONFIG_ETRAX_DDR2_TIMING 37 .dword CONFIG_ETRAX_DDR2_TIMING
36 .dword CONFIG_ETRAX_DDR2_MRS 38 .dword CONFIG_ETRAX_DDR2_MRS
diff --git a/arch/cris/arch-v32/mm/init.c b/arch/cris/arch-v32/mm/init.c
index caeb921a92ea..0768bc409ca8 100644
--- a/arch/cris/arch-v32/mm/init.c
+++ b/arch/cris/arch-v32/mm/init.c
@@ -27,8 +27,7 @@ extern void tlb_init(void);
27 * at kseg_4 thus the ksegs are set up again. Also clear the TLB and do various 27 * at kseg_4 thus the ksegs are set up again. Also clear the TLB and do various
28 * other paging stuff. 28 * other paging stuff.
29 */ 29 */
30void __init 30void __init cris_mmu_init(void)
31cris_mmu_init(void)
32{ 31{
33 unsigned long mmu_config; 32 unsigned long mmu_config;
34 unsigned long mmu_kbase_hi; 33 unsigned long mmu_kbase_hi;
@@ -55,14 +54,23 @@ cris_mmu_init(void)
55 /* Initialise the TLB. Function found in tlb.c. */ 54 /* Initialise the TLB. Function found in tlb.c. */
56 tlb_init(); 55 tlb_init();
57 56
58 /* Enable exceptions and initialize the kernel segments. */ 57 /*
58 * Enable exceptions and initialize the kernel segments.
59 * See head.S for differences between ARTPEC-3 and ETRAX FS.
60 */
59 mmu_config = ( REG_STATE(mmu, rw_mm_cfg, we, on) | 61 mmu_config = ( REG_STATE(mmu, rw_mm_cfg, we, on) |
60 REG_STATE(mmu, rw_mm_cfg, acc, on) | 62 REG_STATE(mmu, rw_mm_cfg, acc, on) |
61 REG_STATE(mmu, rw_mm_cfg, ex, on) | 63 REG_STATE(mmu, rw_mm_cfg, ex, on) |
62 REG_STATE(mmu, rw_mm_cfg, inv, on) | 64 REG_STATE(mmu, rw_mm_cfg, inv, on) |
65#ifdef CONFIG_CRIS_MACH_ARTPEC3
66 REG_STATE(mmu, rw_mm_cfg, seg_f, page) |
67 REG_STATE(mmu, rw_mm_cfg, seg_e, page) |
68 REG_STATE(mmu, rw_mm_cfg, seg_d, linear) |
69#else
63 REG_STATE(mmu, rw_mm_cfg, seg_f, linear) | 70 REG_STATE(mmu, rw_mm_cfg, seg_f, linear) |
64 REG_STATE(mmu, rw_mm_cfg, seg_e, linear) | 71 REG_STATE(mmu, rw_mm_cfg, seg_e, linear) |
65 REG_STATE(mmu, rw_mm_cfg, seg_d, page) | 72 REG_STATE(mmu, rw_mm_cfg, seg_d, page) |
73#endif
66 REG_STATE(mmu, rw_mm_cfg, seg_c, linear) | 74 REG_STATE(mmu, rw_mm_cfg, seg_c, linear) |
67 REG_STATE(mmu, rw_mm_cfg, seg_b, linear) | 75 REG_STATE(mmu, rw_mm_cfg, seg_b, linear) |
68#ifndef CONFIG_ETRAX_VCS_SIM 76#ifndef CONFIG_ETRAX_VCS_SIM
@@ -81,9 +89,15 @@ cris_mmu_init(void)
81 REG_STATE(mmu, rw_mm_cfg, seg_1, page) | 89 REG_STATE(mmu, rw_mm_cfg, seg_1, page) |
82 REG_STATE(mmu, rw_mm_cfg, seg_0, page)); 90 REG_STATE(mmu, rw_mm_cfg, seg_0, page));
83 91
92 /* See head.S for differences between ARTPEC-3 and ETRAX FS. */
84 mmu_kbase_hi = ( REG_FIELD(mmu, rw_mm_kbase_hi, base_f, 0x0) | 93 mmu_kbase_hi = ( REG_FIELD(mmu, rw_mm_kbase_hi, base_f, 0x0) |
94#ifdef CONFIG_CRIS_MACH_ARTPEC3
95 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x0) |
96 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x5) |
97#else
85 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x8) | 98 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x8) |
86 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x0) | 99 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x0) |
100#endif
87 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) | 101 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) |
88 REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) | 102 REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) |
89#ifndef CONFIG_ETRAX_VCS_SIM 103#ifndef CONFIG_ETRAX_VCS_SIM
@@ -129,8 +143,7 @@ cris_mmu_init(void)
129 SUPP_REG_WR(RW_GC_CFG, 0xf); /* IMMU, DMMU, ICache, DCache on */ 143 SUPP_REG_WR(RW_GC_CFG, 0xf); /* IMMU, DMMU, ICache, DCache on */
130} 144}
131 145
132void __init 146void __init paging_init(void)
133paging_init(void)
134{ 147{
135 int i; 148 int i;
136 unsigned long zones_size[MAX_NR_ZONES]; 149 unsigned long zones_size[MAX_NR_ZONES];
diff --git a/arch/cris/arch-v32/mm/mmu.S b/arch/cris/arch-v32/mm/mmu.S
index f125d912e140..72727c1d8e60 100644
--- a/arch/cris/arch-v32/mm/mmu.S
+++ b/arch/cris/arch-v32/mm/mmu.S
@@ -38,6 +38,7 @@
38; to handle the fault. 38; to handle the fault.
39.macro MMU_BUS_FAULT_HANDLER handler, mmu, we, ex 39.macro MMU_BUS_FAULT_HANDLER handler, mmu, we, ex
40 .globl \handler 40 .globl \handler
41 .type \handler,"function"
41\handler: 42\handler:
42 SAVE_ALL 43 SAVE_ALL
43 move \mmu, $srs ; Select MMU support register bank 44 move \mmu, $srs ; Select MMU support register bank
@@ -52,6 +53,7 @@
52 nop 53 nop
53 ba ret_from_intr 54 ba ret_from_intr
54 nop 55 nop
56 .size \handler, . - \handler
55.endm 57.endm
56 58
57; Refill handler. Three cases may occur: 59; Refill handler. Three cases may occur:
@@ -84,6 +86,7 @@
842: .dword 0 ; last_refill_cause 862: .dword 0 ; last_refill_cause
85 .text 87 .text
86 .globl \handler 88 .globl \handler
89 .type \handler, "function"
87\handler: 90\handler:
88 subq 4, $sp 91 subq 4, $sp
89; (The pipeline stalls for one cycle; $sp used as address in the next cycle.) 92; (The pipeline stalls for one cycle; $sp used as address in the next cycle.)
@@ -196,6 +199,7 @@
196 ; Return 199 ; Return
197 ba ret_from_intr 200 ba ret_from_intr
198 nop 201 nop
202 .size \handler, . - \handler
199.endm 203.endm
200 204
201 ; This is the MMU bus fault handlers. 205 ; This is the MMU bus fault handlers.