diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-08 13:08:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-08 13:08:26 -0400 |
commit | 53bcef60633086ad73683d01a4ef9ca678484d2d (patch) | |
tree | 8b14cc031124d0aa0da6cd3b60115bc7eaa80061 /arch | |
parent | 4fd6c6bf83cb16321e9902b00e2af79054f4e0d6 (diff) | |
parent | 85d9865721c62a551547984e6cc8bd3ba732e294 (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')
54 files changed, 857 insertions, 742 deletions
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 887ef855be2a..aefe3b18a074 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -24,7 +24,7 @@ config GENERIC_CMOS_UPDATE | |||
24 | def_bool y | 24 | def_bool y |
25 | 25 | ||
26 | config ARCH_USES_GETTIMEOFFSET | 26 | config ARCH_USES_GETTIMEOFFSET |
27 | def_bool y | 27 | def_bool n |
28 | 28 | ||
29 | config GENERIC_IOMAP | 29 | config GENERIC_IOMAP |
30 | bool | 30 | bool |
@@ -128,16 +128,19 @@ choice | |||
128 | 128 | ||
129 | config ETRAX100LX | 129 | config ETRAX100LX |
130 | bool "ETRAX-100LX-v1" | 130 | bool "ETRAX-100LX-v1" |
131 | select ARCH_USES_GETTIMEOFFSET | ||
131 | help | 132 | help |
132 | Support version 1 of the ETRAX 100LX. | 133 | Support version 1 of the ETRAX 100LX. |
133 | 134 | ||
134 | config ETRAX100LX_V2 | 135 | config ETRAX100LX_V2 |
135 | bool "ETRAX-100LX-v2" | 136 | bool "ETRAX-100LX-v2" |
137 | select ARCH_USES_GETTIMEOFFSET | ||
136 | help | 138 | help |
137 | Support version 2 of the ETRAX 100LX. | 139 | Support version 2 of the ETRAX 100LX. |
138 | 140 | ||
139 | config SVINTO_SIM | 141 | config SVINTO_SIM |
140 | bool "ETRAX-100LX-for-xsim-simulator" | 142 | bool "ETRAX-100LX-for-xsim-simulator" |
143 | select ARCH_USES_GETTIMEOFFSET | ||
141 | help | 144 | help |
142 | Support the xsim ETRAX Simulator. | 145 | Support the xsim ETRAX Simulator. |
143 | 146 | ||
diff --git a/arch/cris/Kconfig.debug b/arch/cris/Kconfig.debug index 0a1d62a23614..0b9a630dc812 100644 --- a/arch/cris/Kconfig.debug +++ b/arch/cris/Kconfig.debug | |||
@@ -32,4 +32,10 @@ config DEBUG_NMI_OOPS | |||
32 | If the system locks up without any debug information you can say Y | 32 | If the system locks up without any debug information you can say Y |
33 | here to make it possible to dump an OOPS with an external NMI. | 33 | here to make it possible to dump an OOPS with an external NMI. |
34 | 34 | ||
35 | config NO_SEGFAULT_TERMINATION | ||
36 | bool "Keep segfaulting processes" | ||
37 | help | ||
38 | Place segfaulting user mode processes on a wait queue instead of | ||
39 | delivering a terminating SIGSEGV to allow debugging with gdb. | ||
40 | |||
35 | endmenu | 41 | endmenu |
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig index 58f5864a6680..0d7221779923 100644 --- a/arch/cris/arch-v10/drivers/Kconfig +++ b/arch/cris/arch-v10/drivers/Kconfig | |||
@@ -383,7 +383,7 @@ config ETRAX_RS485 | |||
383 | depends on ETRAX_SERIAL | 383 | depends on ETRAX_SERIAL |
384 | help | 384 | help |
385 | Enables support for RS-485 serial communication. For a primer on | 385 | Enables support for RS-485 serial communication. For a primer on |
386 | RS-485, see <http://www.hw.cz/english/docs/rs485/rs485.html>. | 386 | RS-485, see <http://en.wikipedia.org/wiki/Rs485> |
387 | 387 | ||
388 | config ETRAX_RS485_ON_PA | 388 | config ETRAX_RS485_ON_PA |
389 | bool "RS-485 mode on PA" | 389 | bool "RS-485 mode on PA" |
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c index c3405507a3d1..5047a33043bd 100644 --- a/arch/cris/arch-v10/drivers/eeprom.c +++ b/arch/cris/arch-v10/drivers/eeprom.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
33 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
34 | #include "i2c.h" | 33 | #include "i2c.h" |
@@ -376,7 +375,6 @@ int __init eeprom_init(void) | |||
376 | /* Opens the device. */ | 375 | /* Opens the device. */ |
377 | static int eeprom_open(struct inode * inode, struct file * file) | 376 | static int eeprom_open(struct inode * inode, struct file * file) |
378 | { | 377 | { |
379 | cycle_kernel_lock(); | ||
380 | if(iminor(inode) != EEPROM_MINOR_NR) | 378 | if(iminor(inode) != EEPROM_MINOR_NR) |
381 | return -ENXIO; | 379 | return -ENXIO; |
382 | if(imajor(inode) != EEPROM_MAJOR_NR) | 380 | if(imajor(inode) != EEPROM_MAJOR_NR) |
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c index 4b0f65fac8e8..a07b6d25b0c7 100644 --- a/arch/cris/arch-v10/drivers/gpio.c +++ b/arch/cris/arch-v10/drivers/gpio.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/string.h> | 19 | #include <linux/string.h> |
21 | #include <linux/poll.h> | 20 | #include <linux/poll.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
@@ -46,8 +45,7 @@ static char gpio_name[] = "etrax gpio"; | |||
46 | static wait_queue_head_t *gpio_wq; | 45 | static wait_queue_head_t *gpio_wq; |
47 | #endif | 46 | #endif |
48 | 47 | ||
49 | static int gpio_ioctl(struct inode *inode, struct file *file, | 48 | static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
50 | unsigned int cmd, unsigned long arg); | ||
51 | static ssize_t gpio_write(struct file *file, const char __user *buf, | 49 | static ssize_t gpio_write(struct file *file, const char __user *buf, |
52 | size_t count, loff_t *off); | 50 | size_t count, loff_t *off); |
53 | static int gpio_open(struct inode *inode, struct file *filp); | 51 | static int gpio_open(struct inode *inode, struct file *filp); |
@@ -324,7 +322,6 @@ gpio_open(struct inode *inode, struct file *filp) | |||
324 | if (!priv) | 322 | if (!priv) |
325 | return -ENOMEM; | 323 | return -ENOMEM; |
326 | 324 | ||
327 | lock_kernel(); | ||
328 | priv->minor = p; | 325 | priv->minor = p; |
329 | 326 | ||
330 | /* initialize the io/alarm struct */ | 327 | /* initialize the io/alarm struct */ |
@@ -359,7 +356,6 @@ gpio_open(struct inode *inode, struct file *filp) | |||
359 | alarmlist = priv; | 356 | alarmlist = priv; |
360 | spin_unlock_irqrestore(&gpio_lock, flags); | 357 | spin_unlock_irqrestore(&gpio_lock, flags); |
361 | 358 | ||
362 | unlock_kernel(); | ||
363 | return 0; | 359 | return 0; |
364 | } | 360 | } |
365 | 361 | ||
@@ -504,9 +500,7 @@ unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg) | |||
504 | static int | 500 | static int |
505 | gpio_leds_ioctl(unsigned int cmd, unsigned long arg); | 501 | gpio_leds_ioctl(unsigned int cmd, unsigned long arg); |
506 | 502 | ||
507 | static int | 503 | static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
508 | gpio_ioctl(struct inode *inode, struct file *file, | ||
509 | unsigned int cmd, unsigned long arg) | ||
510 | { | 504 | { |
511 | unsigned long flags; | 505 | unsigned long flags; |
512 | unsigned long val; | 506 | unsigned long val; |
@@ -516,54 +510,65 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
516 | if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) | 510 | if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) |
517 | return -EINVAL; | 511 | return -EINVAL; |
518 | 512 | ||
519 | spin_lock_irqsave(&gpio_lock, flags); | ||
520 | |||
521 | switch (_IOC_NR(cmd)) { | 513 | switch (_IOC_NR(cmd)) { |
522 | case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */ | 514 | case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */ |
523 | // read the port | 515 | // read the port |
516 | spin_lock_irqsave(&gpio_lock, flags); | ||
524 | if (USE_PORTS(priv)) { | 517 | if (USE_PORTS(priv)) { |
525 | ret = *priv->port; | 518 | ret = *priv->port; |
526 | } else if (priv->minor == GPIO_MINOR_G) { | 519 | } else if (priv->minor == GPIO_MINOR_G) { |
527 | ret = (*R_PORT_G_DATA) & 0x7FFFFFFF; | 520 | ret = (*R_PORT_G_DATA) & 0x7FFFFFFF; |
528 | } | 521 | } |
522 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
523 | |||
529 | break; | 524 | break; |
530 | case IO_SETBITS: | 525 | case IO_SETBITS: |
531 | // set changeable bits with a 1 in arg | 526 | // set changeable bits with a 1 in arg |
527 | spin_lock_irqsave(&gpio_lock, flags); | ||
528 | |||
532 | if (USE_PORTS(priv)) { | 529 | if (USE_PORTS(priv)) { |
533 | *priv->port = *priv->shadow |= | 530 | *priv->port = *priv->shadow |= |
534 | ((unsigned char)arg & priv->changeable_bits); | 531 | ((unsigned char)arg & priv->changeable_bits); |
535 | } else if (priv->minor == GPIO_MINOR_G) { | 532 | } else if (priv->minor == GPIO_MINOR_G) { |
536 | *R_PORT_G_DATA = port_g_data_shadow |= (arg & dir_g_out_bits); | 533 | *R_PORT_G_DATA = port_g_data_shadow |= (arg & dir_g_out_bits); |
537 | } | 534 | } |
535 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
536 | |||
538 | break; | 537 | break; |
539 | case IO_CLRBITS: | 538 | case IO_CLRBITS: |
540 | // clear changeable bits with a 1 in arg | 539 | // clear changeable bits with a 1 in arg |
540 | spin_lock_irqsave(&gpio_lock, flags); | ||
541 | if (USE_PORTS(priv)) { | 541 | if (USE_PORTS(priv)) { |
542 | *priv->port = *priv->shadow &= | 542 | *priv->port = *priv->shadow &= |
543 | ~((unsigned char)arg & priv->changeable_bits); | 543 | ~((unsigned char)arg & priv->changeable_bits); |
544 | } else if (priv->minor == GPIO_MINOR_G) { | 544 | } else if (priv->minor == GPIO_MINOR_G) { |
545 | *R_PORT_G_DATA = port_g_data_shadow &= ~((unsigned long)arg & dir_g_out_bits); | 545 | *R_PORT_G_DATA = port_g_data_shadow &= ~((unsigned long)arg & dir_g_out_bits); |
546 | } | 546 | } |
547 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
547 | break; | 548 | break; |
548 | case IO_HIGHALARM: | 549 | case IO_HIGHALARM: |
549 | // set alarm when bits with 1 in arg go high | 550 | // set alarm when bits with 1 in arg go high |
551 | spin_lock_irqsave(&gpio_lock, flags); | ||
550 | priv->highalarm |= arg; | 552 | priv->highalarm |= arg; |
551 | gpio_some_alarms = 1; | 553 | gpio_some_alarms = 1; |
554 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
552 | break; | 555 | break; |
553 | case IO_LOWALARM: | 556 | case IO_LOWALARM: |
554 | // set alarm when bits with 1 in arg go low | 557 | // set alarm when bits with 1 in arg go low |
558 | spin_lock_irqsave(&gpio_lock, flags); | ||
555 | priv->lowalarm |= arg; | 559 | priv->lowalarm |= arg; |
556 | gpio_some_alarms = 1; | 560 | gpio_some_alarms = 1; |
561 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
557 | break; | 562 | break; |
558 | case IO_CLRALARM: | 563 | case IO_CLRALARM: |
559 | // clear alarm for bits with 1 in arg | 564 | /* clear alarm for bits with 1 in arg */ |
565 | spin_lock_irqsave(&gpio_lock, flags); | ||
560 | priv->highalarm &= ~arg; | 566 | priv->highalarm &= ~arg; |
561 | priv->lowalarm &= ~arg; | 567 | priv->lowalarm &= ~arg; |
562 | { | 568 | { |
563 | /* Must update gpio_some_alarms */ | 569 | /* Must update gpio_some_alarms */ |
564 | struct gpio_private *p = alarmlist; | 570 | struct gpio_private *p = alarmlist; |
565 | int some_alarms; | 571 | int some_alarms; |
566 | spin_lock_irq(&gpio_lock); | ||
567 | p = alarmlist; | 572 | p = alarmlist; |
568 | some_alarms = 0; | 573 | some_alarms = 0; |
569 | while (p) { | 574 | while (p) { |
@@ -574,11 +579,12 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
574 | p = p->next; | 579 | p = p->next; |
575 | } | 580 | } |
576 | gpio_some_alarms = some_alarms; | 581 | gpio_some_alarms = some_alarms; |
577 | spin_unlock_irq(&gpio_lock); | ||
578 | } | 582 | } |
583 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
579 | break; | 584 | break; |
580 | case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ | 585 | case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ |
581 | /* Read direction 0=input 1=output */ | 586 | /* Read direction 0=input 1=output */ |
587 | spin_lock_irqsave(&gpio_lock, flags); | ||
582 | if (USE_PORTS(priv)) { | 588 | if (USE_PORTS(priv)) { |
583 | ret = *priv->dir_shadow; | 589 | ret = *priv->dir_shadow; |
584 | } else if (priv->minor == GPIO_MINOR_G) { | 590 | } else if (priv->minor == GPIO_MINOR_G) { |
@@ -587,30 +593,40 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
587 | */ | 593 | */ |
588 | ret = (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF; | 594 | ret = (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF; |
589 | } | 595 | } |
596 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
590 | break; | 597 | break; |
591 | case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */ | 598 | case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */ |
592 | /* Set direction 0=unchanged 1=input, | 599 | /* Set direction 0=unchanged 1=input, |
593 | * return mask with 1=input | 600 | * return mask with 1=input |
594 | */ | 601 | */ |
602 | spin_lock_irqsave(&gpio_lock, flags); | ||
595 | ret = setget_input(priv, arg) & 0x7FFFFFFF; | 603 | ret = setget_input(priv, arg) & 0x7FFFFFFF; |
604 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
596 | break; | 605 | break; |
597 | case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */ | 606 | case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */ |
598 | /* Set direction 0=unchanged 1=output, | 607 | /* Set direction 0=unchanged 1=output, |
599 | * return mask with 1=output | 608 | * return mask with 1=output |
600 | */ | 609 | */ |
610 | spin_lock_irqsave(&gpio_lock, flags); | ||
601 | ret = setget_output(priv, arg) & 0x7FFFFFFF; | 611 | ret = setget_output(priv, arg) & 0x7FFFFFFF; |
612 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
602 | break; | 613 | break; |
603 | case IO_SHUTDOWN: | 614 | case IO_SHUTDOWN: |
615 | spin_lock_irqsave(&gpio_lock, flags); | ||
604 | SOFT_SHUTDOWN(); | 616 | SOFT_SHUTDOWN(); |
617 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
605 | break; | 618 | break; |
606 | case IO_GET_PWR_BT: | 619 | case IO_GET_PWR_BT: |
620 | spin_lock_irqsave(&gpio_lock, flags); | ||
607 | #if defined (CONFIG_ETRAX_SOFT_SHUTDOWN) | 621 | #if defined (CONFIG_ETRAX_SOFT_SHUTDOWN) |
608 | ret = (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT)); | 622 | ret = (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT)); |
609 | #else | 623 | #else |
610 | ret = 0; | 624 | ret = 0; |
611 | #endif | 625 | #endif |
626 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
612 | break; | 627 | break; |
613 | case IO_CFG_WRITE_MODE: | 628 | case IO_CFG_WRITE_MODE: |
629 | spin_lock_irqsave(&gpio_lock, flags); | ||
614 | priv->clk_mask = arg & 0xFF; | 630 | priv->clk_mask = arg & 0xFF; |
615 | priv->data_mask = (arg >> 8) & 0xFF; | 631 | priv->data_mask = (arg >> 8) & 0xFF; |
616 | priv->write_msb = (arg >> 16) & 0x01; | 632 | priv->write_msb = (arg >> 16) & 0x01; |
@@ -626,28 +642,33 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
626 | priv->data_mask = 0; | 642 | priv->data_mask = 0; |
627 | ret = -EPERM; | 643 | ret = -EPERM; |
628 | } | 644 | } |
645 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
629 | break; | 646 | break; |
630 | case IO_READ_INBITS: | 647 | case IO_READ_INBITS: |
631 | /* *arg is result of reading the input pins */ | 648 | /* *arg is result of reading the input pins */ |
649 | spin_lock_irqsave(&gpio_lock, flags); | ||
632 | if (USE_PORTS(priv)) { | 650 | if (USE_PORTS(priv)) { |
633 | val = *priv->port; | 651 | val = *priv->port; |
634 | } else if (priv->minor == GPIO_MINOR_G) { | 652 | } else if (priv->minor == GPIO_MINOR_G) { |
635 | val = *R_PORT_G_DATA; | 653 | val = *R_PORT_G_DATA; |
636 | } | 654 | } |
655 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
637 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) | 656 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) |
638 | ret = -EFAULT; | 657 | ret = -EFAULT; |
639 | break; | 658 | break; |
640 | case IO_READ_OUTBITS: | 659 | case IO_READ_OUTBITS: |
641 | /* *arg is result of reading the output shadow */ | 660 | /* *arg is result of reading the output shadow */ |
661 | spin_lock_irqsave(&gpio_lock, flags); | ||
642 | if (USE_PORTS(priv)) { | 662 | if (USE_PORTS(priv)) { |
643 | val = *priv->shadow; | 663 | val = *priv->shadow; |
644 | } else if (priv->minor == GPIO_MINOR_G) { | 664 | } else if (priv->minor == GPIO_MINOR_G) { |
645 | val = port_g_data_shadow; | 665 | val = port_g_data_shadow; |
646 | } | 666 | } |
667 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
647 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) | 668 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) |
648 | ret = -EFAULT; | 669 | ret = -EFAULT; |
649 | break; | 670 | break; |
650 | case IO_SETGET_INPUT: | 671 | case IO_SETGET_INPUT: |
651 | /* bits set in *arg is set to input, | 672 | /* bits set in *arg is set to input, |
652 | * *arg updated with current input pins. | 673 | * *arg updated with current input pins. |
653 | */ | 674 | */ |
@@ -656,7 +677,9 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
656 | ret = -EFAULT; | 677 | ret = -EFAULT; |
657 | break; | 678 | break; |
658 | } | 679 | } |
680 | spin_lock_irqsave(&gpio_lock, flags); | ||
659 | val = setget_input(priv, val); | 681 | val = setget_input(priv, val); |
682 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
660 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) | 683 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) |
661 | ret = -EFAULT; | 684 | ret = -EFAULT; |
662 | break; | 685 | break; |
@@ -668,18 +691,21 @@ gpio_ioctl(struct inode *inode, struct file *file, | |||
668 | ret = -EFAULT; | 691 | ret = -EFAULT; |
669 | break; | 692 | break; |
670 | } | 693 | } |
694 | spin_lock_irqsave(&gpio_lock, flags); | ||
671 | val = setget_output(priv, val); | 695 | val = setget_output(priv, val); |
696 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
672 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) | 697 | if (copy_to_user((void __user *)arg, &val, sizeof(val))) |
673 | ret = -EFAULT; | 698 | ret = -EFAULT; |
674 | break; | 699 | break; |
675 | default: | 700 | default: |
701 | spin_lock_irqsave(&gpio_lock, flags); | ||
676 | if (priv->minor == GPIO_MINOR_LEDS) | 702 | if (priv->minor == GPIO_MINOR_LEDS) |
677 | ret = gpio_leds_ioctl(cmd, arg); | 703 | ret = gpio_leds_ioctl(cmd, arg); |
678 | else | 704 | else |
679 | ret = -EINVAL; | 705 | ret = -EINVAL; |
706 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
680 | } /* switch */ | 707 | } /* switch */ |
681 | 708 | ||
682 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
683 | return ret; | 709 | return ret; |
684 | } | 710 | } |
685 | 711 | ||
@@ -713,12 +739,12 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg) | |||
713 | } | 739 | } |
714 | 740 | ||
715 | static const struct file_operations gpio_fops = { | 741 | static const struct file_operations gpio_fops = { |
716 | .owner = THIS_MODULE, | 742 | .owner = THIS_MODULE, |
717 | .poll = gpio_poll, | 743 | .poll = gpio_poll, |
718 | .ioctl = gpio_ioctl, | 744 | .unlocked_ioctl = gpio_ioctl, |
719 | .write = gpio_write, | 745 | .write = gpio_write, |
720 | .open = gpio_open, | 746 | .open = gpio_open, |
721 | .release = gpio_release, | 747 | .release = gpio_release, |
722 | }; | 748 | }; |
723 | 749 | ||
724 | static void ioif_watcher(const unsigned int gpio_in_available, | 750 | static void ioif_watcher(const unsigned int gpio_in_available, |
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c index a8737a8eb229..77a941813819 100644 --- a/arch/cris/arch-v10/drivers/i2c.c +++ b/arch/cris/arch-v10/drivers/i2c.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/smp_lock.h> | ||
18 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
@@ -60,8 +59,8 @@ static const char i2c_name[] = "i2c"; | |||
60 | 59 | ||
61 | #define SDABIT CONFIG_ETRAX_I2C_DATA_PORT | 60 | #define SDABIT CONFIG_ETRAX_I2C_DATA_PORT |
62 | #define SCLBIT CONFIG_ETRAX_I2C_CLK_PORT | 61 | #define SCLBIT CONFIG_ETRAX_I2C_CLK_PORT |
63 | #define i2c_enable() | 62 | #define i2c_enable() |
64 | #define i2c_disable() | 63 | #define i2c_disable() |
65 | 64 | ||
66 | /* enable or disable output-enable, to select output or input on the i2c bus */ | 65 | /* enable or disable output-enable, to select output or input on the i2c bus */ |
67 | 66 | ||
@@ -91,7 +90,7 @@ static const char i2c_name[] = "i2c"; | |||
91 | 90 | ||
92 | #define i2c_dir_out() \ | 91 | #define i2c_dir_out() \ |
93 | *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ | 92 | *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ |
94 | REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1); | 93 | REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1); |
95 | #define i2c_dir_in() \ | 94 | #define i2c_dir_in() \ |
96 | *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ | 95 | *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ |
97 | REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0); | 96 | REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0); |
@@ -189,7 +188,7 @@ i2c_outbyte(unsigned char x) | |||
189 | } else { | 188 | } else { |
190 | i2c_data(I2C_DATA_LOW); | 189 | i2c_data(I2C_DATA_LOW); |
191 | } | 190 | } |
192 | 191 | ||
193 | i2c_delay(CLOCK_LOW_TIME/2); | 192 | i2c_delay(CLOCK_LOW_TIME/2); |
194 | i2c_clk(I2C_CLOCK_HIGH); | 193 | i2c_clk(I2C_CLOCK_HIGH); |
195 | i2c_delay(CLOCK_HIGH_TIME); | 194 | i2c_delay(CLOCK_HIGH_TIME); |
@@ -416,7 +415,7 @@ i2c_sendnack(void) | |||
416 | *# | 415 | *# |
417 | *#--------------------------------------------------------------------------*/ | 416 | *#--------------------------------------------------------------------------*/ |
418 | int | 417 | int |
419 | i2c_writereg(unsigned char theSlave, unsigned char theReg, | 418 | i2c_writereg(unsigned char theSlave, unsigned char theReg, |
420 | unsigned char theValue) | 419 | unsigned char theValue) |
421 | { | 420 | { |
422 | int error, cntr = 3; | 421 | int error, cntr = 3; |
@@ -468,7 +467,7 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg, | |||
468 | * enable interrupt again | 467 | * enable interrupt again |
469 | */ | 468 | */ |
470 | local_irq_restore(flags); | 469 | local_irq_restore(flags); |
471 | 470 | ||
472 | } while(error && cntr--); | 471 | } while(error && cntr--); |
473 | 472 | ||
474 | i2c_delay(CLOCK_LOW_TIME); | 473 | i2c_delay(CLOCK_LOW_TIME); |
@@ -504,7 +503,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg) | |||
504 | * generate start condition | 503 | * generate start condition |
505 | */ | 504 | */ |
506 | i2c_start(); | 505 | i2c_start(); |
507 | 506 | ||
508 | /* | 507 | /* |
509 | * send slave address | 508 | * send slave address |
510 | */ | 509 | */ |
@@ -555,7 +554,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg) | |||
555 | * enable interrupt again | 554 | * enable interrupt again |
556 | */ | 555 | */ |
557 | local_irq_restore(flags); | 556 | local_irq_restore(flags); |
558 | 557 | ||
559 | } while(error && cntr--); | 558 | } while(error && cntr--); |
560 | 559 | ||
561 | spin_unlock(&i2c_lock); | 560 | spin_unlock(&i2c_lock); |
@@ -566,7 +565,6 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg) | |||
566 | static int | 565 | static int |
567 | i2c_open(struct inode *inode, struct file *filp) | 566 | i2c_open(struct inode *inode, struct file *filp) |
568 | { | 567 | { |
569 | cycle_kernel_lock(); | ||
570 | return 0; | 568 | return 0; |
571 | } | 569 | } |
572 | 570 | ||
@@ -579,9 +577,7 @@ i2c_release(struct inode *inode, struct file *filp) | |||
579 | /* Main device API. ioctl's to write or read to/from i2c registers. | 577 | /* Main device API. ioctl's to write or read to/from i2c registers. |
580 | */ | 578 | */ |
581 | 579 | ||
582 | static int | 580 | static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
583 | i2c_ioctl(struct inode *inode, struct file *file, | ||
584 | unsigned int cmd, unsigned long arg) | ||
585 | { | 581 | { |
586 | if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { | 582 | if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { |
587 | return -EINVAL; | 583 | return -EINVAL; |
@@ -590,7 +586,7 @@ i2c_ioctl(struct inode *inode, struct file *file, | |||
590 | switch (_IOC_NR(cmd)) { | 586 | switch (_IOC_NR(cmd)) { |
591 | case I2C_WRITEREG: | 587 | case I2C_WRITEREG: |
592 | /* write to an i2c slave */ | 588 | /* write to an i2c slave */ |
593 | D(printk("i2cw %d %d %d\n", | 589 | D(printk(KERN_DEBUG "i2cw %d %d %d\n", |
594 | I2C_ARGSLAVE(arg), | 590 | I2C_ARGSLAVE(arg), |
595 | I2C_ARGREG(arg), | 591 | I2C_ARGREG(arg), |
596 | I2C_ARGVALUE(arg))); | 592 | I2C_ARGVALUE(arg))); |
@@ -602,26 +598,25 @@ i2c_ioctl(struct inode *inode, struct file *file, | |||
602 | { | 598 | { |
603 | unsigned char val; | 599 | unsigned char val; |
604 | /* read from an i2c slave */ | 600 | /* read from an i2c slave */ |
605 | D(printk("i2cr %d %d ", | 601 | D(printk(KERN_DEBUG "i2cr %d %d ", |
606 | I2C_ARGSLAVE(arg), | 602 | I2C_ARGSLAVE(arg), |
607 | I2C_ARGREG(arg))); | 603 | I2C_ARGREG(arg))); |
608 | val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); | 604 | val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); |
609 | D(printk("= %d\n", val)); | 605 | D(printk(KERN_DEBUG "= %d\n", val)); |
610 | return val; | 606 | return val; |
611 | } | 607 | } |
612 | default: | 608 | default: |
613 | return -EINVAL; | 609 | return -EINVAL; |
614 | 610 | ||
615 | } | 611 | } |
616 | |||
617 | return 0; | 612 | return 0; |
618 | } | 613 | } |
619 | 614 | ||
620 | static const struct file_operations i2c_fops = { | 615 | static const struct file_operations i2c_fops = { |
621 | .owner = THIS_MODULE, | 616 | .owner = THIS_MODULE, |
622 | .ioctl = i2c_ioctl, | 617 | .unlocked_ioctl = i2c_ioctl, |
623 | .open = i2c_open, | 618 | .open = i2c_open, |
624 | .release = i2c_release, | 619 | .release = i2c_release, |
625 | }; | 620 | }; |
626 | 621 | ||
627 | int __init | 622 | int __init |
diff --git a/arch/cris/arch-v10/drivers/i2c.h b/arch/cris/arch-v10/drivers/i2c.h index 4ee91426bd40..e36c96276478 100644 --- a/arch/cris/arch-v10/drivers/i2c.h +++ b/arch/cris/arch-v10/drivers/i2c.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* $Id: i2c.h,v 1.3 2004/05/28 09:26:59 starvik Exp $ */ | 1 | /* i2c.h */ |
2 | |||
3 | int i2c_init(void); | 2 | int i2c_init(void); |
4 | 3 | ||
5 | /* High level I2C actions */ | 4 | /* High level I2C actions */ |
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c index 109dcd826d17..ee2dd4323daf 100644 --- a/arch/cris/arch-v10/drivers/sync_serial.c +++ b/arch/cris/arch-v10/drivers/sync_serial.c | |||
@@ -157,7 +157,7 @@ static int sync_serial_open(struct inode *inode, struct file *file); | |||
157 | static int sync_serial_release(struct inode *inode, struct file *file); | 157 | static int sync_serial_release(struct inode *inode, struct file *file); |
158 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); | 158 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); |
159 | 159 | ||
160 | static int sync_serial_ioctl(struct inode *inode, struct file *file, | 160 | static int sync_serial_ioctl(struct file *file, |
161 | unsigned int cmd, unsigned long arg); | 161 | unsigned int cmd, unsigned long arg); |
162 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 162 | static ssize_t sync_serial_write(struct file *file, const char *buf, |
163 | size_t count, loff_t *ppos); | 163 | size_t count, loff_t *ppos); |
@@ -244,13 +244,13 @@ static unsigned sync_serial_prescale_shadow; | |||
244 | #define NUMBER_OF_PORTS 2 | 244 | #define NUMBER_OF_PORTS 2 |
245 | 245 | ||
246 | static const struct file_operations sync_serial_fops = { | 246 | static const struct file_operations sync_serial_fops = { |
247 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
248 | .write = sync_serial_write, | 248 | .write = sync_serial_write, |
249 | .read = sync_serial_read, | 249 | .read = sync_serial_read, |
250 | .poll = sync_serial_poll, | 250 | .poll = sync_serial_poll, |
251 | .ioctl = sync_serial_ioctl, | 251 | .unlocked_ioctl = sync_serial_ioctl, |
252 | .open = sync_serial_open, | 252 | .open = sync_serial_open, |
253 | .release = sync_serial_release | 253 | .release = sync_serial_release |
254 | }; | 254 | }; |
255 | 255 | ||
256 | static int __init etrax_sync_serial_init(void) | 256 | static int __init etrax_sync_serial_init(void) |
@@ -678,7 +678,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait) | |||
678 | return mask; | 678 | return mask; |
679 | } | 679 | } |
680 | 680 | ||
681 | static int sync_serial_ioctl(struct inode *inode, struct file *file, | 681 | static int sync_serial_ioctl_unlocked(struct file *file, |
682 | unsigned int cmd, unsigned long arg) | 682 | unsigned int cmd, unsigned long arg) |
683 | { | 683 | { |
684 | int return_val = 0; | 684 | int return_val = 0; |
@@ -956,6 +956,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file, | |||
956 | return return_val; | 956 | return return_val; |
957 | } | 957 | } |
958 | 958 | ||
959 | static long sync_serial_ioctl(struct file *file, | ||
960 | unsigned int cmd, unsigned long arg) | ||
961 | { | ||
962 | long ret; | ||
963 | |||
964 | lock_kernel(); | ||
965 | ret = sync_serial_ioctl_unlocked(file, cmd, arg); | ||
966 | unlock_kernel(); | ||
967 | |||
968 | return ret; | ||
969 | } | ||
970 | |||
959 | 971 | ||
960 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 972 | static ssize_t sync_serial_write(struct file *file, const char *buf, |
961 | size_t count, loff_t *ppos) | 973 | size_t count, loff_t *ppos) |
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index 5ff08a8695e9..8a8196ee8ce8 100644 --- a/arch/cris/arch-v10/kernel/fasttimer.c +++ b/arch/cris/arch-v10/kernel/fasttimer.c | |||
@@ -467,11 +467,7 @@ timer1_handler(int irq, void *dev_id) | |||
467 | 467 | ||
468 | static void wake_up_func(unsigned long data) | 468 | static void wake_up_func(unsigned long data) |
469 | { | 469 | { |
470 | #ifdef DECLARE_WAITQUEUE | 470 | wait_queue_head_t *sleep_wait_p = (wait_queue_head_t *)data; |
471 | wait_queue_head_t *sleep_wait_p = (wait_queue_head_t*)data; | ||
472 | #else | ||
473 | struct wait_queue **sleep_wait_p = (struct wait_queue **)data; | ||
474 | #endif | ||
475 | wake_up(sleep_wait_p); | 471 | wake_up(sleep_wait_p); |
476 | } | 472 | } |
477 | 473 | ||
diff --git a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S index fc4577102933..a1f2014b4e3b 100644 --- a/arch/cris/arch-v10/kernel/head.S +++ b/arch/cris/arch-v10/kernel/head.S | |||
@@ -280,7 +280,7 @@ _no_romfs_in_flash: | |||
280 | ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does | 280 | ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does |
281 | ;; not need this mechanism anyway) | 281 | ;; not need this mechanism anyway) |
282 | 282 | ||
283 | move.d __vmlinux_end, $r0; the image will be after the vmlinux end address | 283 | move.d __init_end, $r0; the image will be after the end of init |
284 | move.d [$r0], $r1 ; cramfs assumes same endian on host/target | 284 | move.d [$r0], $r1 ; cramfs assumes same endian on host/target |
285 | cmp.d CRAMFS_MAGIC, $r1; magic value in cramfs superblock | 285 | cmp.d CRAMFS_MAGIC, $r1; magic value in cramfs superblock |
286 | bne 2f | 286 | bne 2f |
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c index 30adae594aef..00eb36f8debf 100644 --- a/arch/cris/arch-v10/kernel/time.c +++ b/arch/cris/arch-v10/kernel/time.c | |||
@@ -61,66 +61,16 @@ unsigned long get_ns_in_jiffie(void) | |||
61 | 61 | ||
62 | unsigned long do_slow_gettimeoffset(void) | 62 | unsigned long do_slow_gettimeoffset(void) |
63 | { | 63 | { |
64 | unsigned long count, t1; | 64 | unsigned long count; |
65 | unsigned long usec_count = 0; | ||
66 | unsigned short presc_count; | ||
67 | |||
68 | static unsigned long count_p = TIMER0_DIV;/* for the first call after boot */ | ||
69 | static unsigned long jiffies_p = 0; | ||
70 | |||
71 | /* | ||
72 | * cache volatile jiffies temporarily; we have IRQs turned off. | ||
73 | */ | ||
74 | unsigned long jiffies_t; | ||
75 | 65 | ||
76 | /* The timer interrupt comes from Etrax timer 0. In order to get | 66 | /* The timer interrupt comes from Etrax timer 0. In order to get |
77 | * better precision, we check the current value. It might have | 67 | * better precision, we check the current value. It might have |
78 | * underflowed already though. | 68 | * underflowed already though. |
79 | */ | 69 | */ |
80 | |||
81 | #ifndef CONFIG_SVINTO_SIM | ||
82 | /* Not available in the xsim simulator. */ | ||
83 | count = *R_TIMER0_DATA; | 70 | count = *R_TIMER0_DATA; |
84 | presc_count = *R_TIM_PRESC_STATUS; | ||
85 | /* presc_count might be wrapped */ | ||
86 | t1 = *R_TIMER0_DATA; | ||
87 | if (count != t1){ | ||
88 | /* it wrapped, read prescaler again... */ | ||
89 | presc_count = *R_TIM_PRESC_STATUS; | ||
90 | count = t1; | ||
91 | } | ||
92 | #else | ||
93 | count = 0; | ||
94 | presc_count = 0; | ||
95 | #endif | ||
96 | |||
97 | jiffies_t = jiffies; | ||
98 | 71 | ||
99 | /* | ||
100 | * avoiding timer inconsistencies (they are rare, but they happen)... | ||
101 | * there are one problem that must be avoided here: | ||
102 | * 1. the timer counter underflows | ||
103 | */ | ||
104 | if( jiffies_t == jiffies_p ) { | ||
105 | if( count > count_p ) { | ||
106 | /* Timer wrapped, use new count and prescale | ||
107 | * increase the time corresponding to one jiffie | ||
108 | */ | ||
109 | usec_count = 1000000/HZ; | ||
110 | } | ||
111 | } else | ||
112 | jiffies_p = jiffies_t; | ||
113 | count_p = count; | ||
114 | if (presc_count >= PRESCALE_VALUE/2 ){ | ||
115 | presc_count = PRESCALE_VALUE - presc_count + PRESCALE_VALUE/2; | ||
116 | } else { | ||
117 | presc_count = PRESCALE_VALUE - presc_count - PRESCALE_VALUE/2; | ||
118 | } | ||
119 | /* Convert timer value to usec */ | 72 | /* Convert timer value to usec */ |
120 | usec_count += ( (TIMER0_DIV - count) * (1000000/HZ)/TIMER0_DIV ) + | 73 | return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV; |
121 | (( (presc_count) * (1000000000/PRESCALE_FREQ))/1000); | ||
122 | |||
123 | return usec_count; | ||
124 | } | 74 | } |
125 | 75 | ||
126 | /* Excerpt from the Etrax100 HSDD about the built-in watchdog: | 76 | /* Excerpt from the Etrax100 HSDD about the built-in watchdog: |
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 | ||
218 | static int cryptocop_release(struct inode *, struct file *); | 217 | static int cryptocop_release(struct inode *, struct file *); |
219 | 218 | ||
220 | static int cryptocop_ioctl(struct inode *inode, struct file *file, | 219 | static long cryptocop_ioctl(struct file *file, |
221 | unsigned int cmd, unsigned long arg); | 220 | unsigned int cmd, unsigned long arg); |
222 | 221 | ||
223 | static void cryptocop_start_job(void); | 222 | static 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 | ||
281 | const struct file_operations cryptocop_fops = { | 280 | const 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 | ||
3105 | static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) | 3103 | static 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 | ||
3136 | static long | ||
3137 | cryptocop_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 |
3139 | static void print_dma_descriptors(struct cryptocop_int_operation *iop) | 3151 | static 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 */ |
50 | static DEFINE_MUTEX(i2c_mutex); | ||
50 | static const char i2c_name[] = "i2c"; | 51 | static 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) | |||
636 | static int | 637 | static int |
637 | i2c_open(struct inode *inode, struct file *filp) | 638 | i2c_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"; | |||
72 | static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, | 72 | static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, |
73 | unsigned long arg); | 73 | unsigned long arg); |
74 | #endif | 74 | #endif |
75 | static int gpio_ioctl(struct inode *inode, struct file *file, | 75 | static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
76 | unsigned int cmd, unsigned long arg); | ||
77 | static ssize_t gpio_write(struct file *file, const char __user *buf, | 76 | static 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); |
79 | static int gpio_open(struct inode *inode, struct file *filp); | 78 | static 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 | ||
524 | static int gpio_ioctl(struct inode *inode, struct file *file, | 523 | static 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 | ||
666 | static 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 |
668 | static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, | 678 | static 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 | ||
879 | static const struct file_operations gpio_fops = { | 889 | static 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; | |||
74 | static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, | 74 | static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, |
75 | unsigned long arg); | 75 | unsigned long arg); |
76 | #endif | 76 | #endif |
77 | static int gpio_ioctl(struct inode *inode, struct file *file, | 77 | static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
78 | unsigned int cmd, unsigned long arg); | ||
79 | static ssize_t gpio_write(struct file *file, const char *buf, size_t count, | 78 | static ssize_t gpio_write(struct file *file, const char *buf, size_t count, |
80 | loff_t *off); | 79 | loff_t *off); |
81 | static int gpio_open(struct inode *inode, struct file *filp); | 80 | static int gpio_open(struct inode *inode, struct file *filp); |
@@ -185,7 +184,7 @@ static volatile unsigned long *dir_oe[NUM_PORTS] = { | |||
185 | static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait) | 184 | static 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) | |||
353 | static ssize_t gpio_write(struct file *file, const char *buf, size_t count, | 352 | static 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 | ||
560 | static int | 559 | static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg); |
561 | gpio_leds_ioctl(unsigned int cmd, unsigned long arg); | ||
562 | 560 | ||
563 | static int | 561 | static int |
564 | gpio_ioctl(struct inode *inode, struct file *file, | 562 | gpio_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 | ||
707 | static 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 |
711 | static int | 719 | static int |
712 | virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 720 | virtual_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 | ||
858 | static const struct file_operations gpio_fops = { | 866 | static 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*); | |||
153 | static int sync_serial_release(struct inode*, struct file*); | 153 | static int sync_serial_release(struct inode*, struct file*); |
154 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); | 154 | static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); |
155 | 155 | ||
156 | static int sync_serial_ioctl(struct inode*, struct file*, | 156 | static int sync_serial_ioctl(struct file *, |
157 | unsigned int cmd, unsigned long arg); | 157 | unsigned int cmd, unsigned long arg); |
158 | static ssize_t sync_serial_write(struct file * file, const char * buf, | 158 | static 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 | ||
243 | static const struct file_operations sync_serial_fops = { | 243 | static 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 | ||
253 | static int __init etrax_sync_serial_init(void) | 253 | static 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 | ||
653 | static int sync_serial_ioctl(struct inode *inode, struct file *file, | 653 | static 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 | ||
964 | static 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 */ |
965 | static ssize_t sync_serial_write(struct file *file, const char *buf, | 977 | static 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 | ||
2 | cris_flush_cache_range: | 3 | cris_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 | ||
85 | cris_flush_cache: | 88 | cris_flush_cache: |
86 | moveq 0, $r10 | 89 | moveq 0, $r10 |
87 | cris_flush_line: | 90 | cris_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 | ||
79 | ret_from_fork: | 80 | ret_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 | ||
85 | ret_from_intr: | 88 | ret_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 | ||
125 | system_call: | 131 | system_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 | ||
332 | resume: | 347 | resume: |
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 | ||
368 | nmi_interrupt: | 384 | nmi_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 | ||
429 | multiple_interrupt: | 446 | multiple_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 | ||
462 | do_sigtrap: | 480 | do_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 | ||
517 | kernel_execve: | 536 | kernel_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 | ||
101 | BUILD_TIMER_IRQ(0x31, 0) | ||
102 | #else | ||
100 | BUILD_IRQ(0x31) | 103 | BUILD_IRQ(0x31) |
104 | #endif | ||
101 | BUILD_IRQ(0x32) | 105 | BUILD_IRQ(0x32) |
102 | BUILD_IRQ(0x33) | 106 | BUILD_IRQ(0x33) |
103 | BUILD_IRQ(0x34) | 107 | BUILD_IRQ(0x34) |
@@ -123,7 +127,11 @@ BUILD_IRQ(0x47) | |||
123 | BUILD_IRQ(0x48) | 127 | BUILD_IRQ(0x48) |
124 | BUILD_IRQ(0x49) | 128 | BUILD_IRQ(0x49) |
125 | BUILD_IRQ(0x4a) | 129 | BUILD_IRQ(0x4a) |
130 | #ifdef CONFIG_ETRAXFS | ||
131 | BUILD_TIMER_IRQ(0x4b, 0) | ||
132 | #else | ||
126 | BUILD_IRQ(0x4b) | 133 | BUILD_IRQ(0x4b) |
134 | #endif | ||
127 | BUILD_IRQ(0x4c) | 135 | BUILD_IRQ(0x4c) |
128 | BUILD_IRQ(0x4d) | 136 | BUILD_IRQ(0x4d) |
129 | BUILD_IRQ(0x4e) | 137 | BUILD_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. */ |
183 | extern void gdb_handle_exception(void); | 183 | extern 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, ®_cont); | 990 | read_register(PC, ®_cont); |
991 | ptr = pack_hex_byte(PC); | 991 | ptr = pack_hex_byte(ptr, PC); |
992 | *ptr++ = ':'; | 992 | *ptr++ = ':'; |
993 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[PC]); | 993 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[PC]); |
994 | *ptr++ = ';'; | 994 | *ptr++ = ';'; |
995 | 995 | ||
996 | read_register(R8, ®_cont); | 996 | read_register(R8, ®_cont); |
997 | ptr = pack_hex_byte(R8); | 997 | ptr = pack_hex_byte(ptr, R8); |
998 | *ptr++ = ':'; | 998 | *ptr++ = ':'; |
999 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[R8]); | 999 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[R8]); |
1000 | *ptr++ = ';'; | 1000 | *ptr++ = ';'; |
1001 | 1001 | ||
1002 | read_register(SP, ®_cont); | 1002 | read_register(SP, ®_cont); |
1003 | ptr = pack_hex_byte(SP); | 1003 | ptr = pack_hex_byte(ptr, SP); |
1004 | *ptr++ = ':'; | 1004 | *ptr++ = ':'; |
1005 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[SP]); | 1005 | ptr = mem2hex(ptr, (unsigned char *)®_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, ®_cont); | 1009 | read_register(ERP, ®_cont); |
1010 | ptr = pack_hex_byte(ERP); | 1010 | ptr = pack_hex_byte(ptr, ERP); |
1011 | *ptr++ = ':'; | 1011 | *ptr++ = ':'; |
1012 | ptr = mem2hex(ptr, (unsigned char *)®_cont, register_size[ERP]); | 1012 | ptr = mem2hex(ptr, (unsigned char *)®_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 | |||
24 | static char pins[PORTS][PORT_PINS]; | ||
25 | static DEFINE_SPINLOCK(pinmux_lock); | ||
26 | |||
27 | static void crisv32_pinmux_set(int port); | ||
28 | |||
29 | int | ||
30 | crisv32_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 | |||
49 | int | ||
50 | crisv32_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 | |||
85 | int | ||
86 | crisv32_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 | |||
169 | void | ||
170 | crisv32_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 | |||
192 | int | ||
193 | crisv32_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 | |||
214 | void | ||
215 | crisv32_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 | ||
52 | int | 57 | int show_cpuinfo(struct seq_file *m, void *v) |
53 | show_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 | ||
110 | void | 114 | void show_etrax_copyright(void) |
111 | show_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 | |||
125 | static 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 | |||
145 | static 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 | |||
162 | static struct i2c_board_info __initdata i2c_info3[] = { | ||
163 | {I2C_BOARD_INFO("adc101", 0x54)}, | ||
164 | }; | ||
165 | |||
166 | static 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 | } |
173 | arch_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. */ | ||
40 | static cycle_t read_cont_rotime(struct clocksource *cs) | ||
41 | { | ||
42 | return (u32)REG_RD(timer, regi_timer0, r_time); | ||
43 | } | ||
44 | |||
45 | static 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 | |||
54 | static 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 | } | ||
60 | arch_initcall(etrax_init_cont_rotime); | ||
61 | |||
62 | |||
39 | unsigned long timer_regs[NR_CPUS] = | 63 | unsigned 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 | ||
70 | unsigned 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 | ||
129 | void | 116 | void reset_watchdog(void) |
130 | reset_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 | ||
150 | void | 136 | void stop_watchdog(void) |
151 | stop_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 | ||
163 | extern void show_registers(struct pt_regs *regs); | 148 | extern void show_registers(struct pt_regs *regs); |
164 | 149 | ||
165 | void | 150 | void handle_watchdog_bite(struct pt_regs *regs) |
166 | handle_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 | */ |
204 | extern void cris_do_profile(struct pt_regs *regs); | 188 | extern void cris_do_profile(struct pt_regs *regs); |
205 | 189 | ||
206 | static inline irqreturn_t | 190 | static inline irqreturn_t timer_interrupt(int irq, void *dev_id) |
207 | timer_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 | ||
249 | void __init | 234 | void __init cris_timer_init(void) |
250 | cris_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 | ||
276 | void __init | 260 | void __init time_init(void) |
277 | time_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 | ||
12 | void | 12 | void show_registers(struct pt_regs *regs) |
13 | show_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 | ||
104 | void | 103 | void arch_enable_nmi(void) |
105 | arch_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 | ||
9 | csum_partial: | 10 | csum_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 | ||
12 | csum_partial_copy_nocheck: | 13 | csum_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 | |||
25 | cris_spin_trylock: | 29 | cris_spin_trylock: |
26 | clearf p | 30 | clearf p |
27 | 1: move.b [$r10], $r11 | 31 | 1: 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 | ||
36 | config ETRAX_DDR2_LATENCY | ||
37 | hex "DDR2 latency" | ||
38 | default "0" | ||
39 | |||
36 | config ETRAX_PIO_CE0_CFG | 40 | config 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 | ||
29 | 1: 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 | ||
39 | 1: 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 | ||
67 | 1: 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 | */ |
30 | void __init | 30 | void __init cris_mmu_init(void) |
31 | cris_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 | ||
132 | void __init | 146 | void __init paging_init(void) |
133 | paging_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 @@ | |||
84 | 2: .dword 0 ; last_refill_cause | 86 | 2: .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. |
diff --git a/arch/cris/boot/Makefile b/arch/cris/boot/Makefile index 144f3afa0119..6e3b509fd7fc 100644 --- a/arch/cris/boot/Makefile +++ b/arch/cris/boot/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment | 5 | objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment |
6 | objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss | 6 | objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss --remove-section=.note.gnu.build-id |
7 | 7 | ||
8 | OBJCOPYFLAGS = -O binary $(objcopyflags-y) | 8 | OBJCOPYFLAGS = -O binary $(objcopyflags-y) |
9 | 9 | ||
diff --git a/arch/cris/boot/compressed/misc.c b/arch/cris/boot/compressed/misc.c index 47bc190ba6d4..548d886b03d3 100644 --- a/arch/cris/boot/compressed/misc.c +++ b/arch/cris/boot/compressed/misc.c | |||
@@ -106,7 +106,7 @@ static unsigned outcnt = 0; /* bytes in output buffer */ | |||
106 | 106 | ||
107 | static void flush_window(void); | 107 | static void flush_window(void); |
108 | static void error(char *m); | 108 | static void error(char *m); |
109 | static void puts(const char *); | 109 | static void aputs(const char *s); |
110 | 110 | ||
111 | extern char *input_data; /* lives in head.S */ | 111 | extern char *input_data; /* lives in head.S */ |
112 | 112 | ||
@@ -137,52 +137,37 @@ static inline void serout(const char *s, reg_scope_instances regi_ser) | |||
137 | 137 | ||
138 | REG_WR(ser, regi_ser, rw_dout, dout); | 138 | REG_WR(ser, regi_ser, rw_dout, dout); |
139 | } | 139 | } |
140 | #define SEROUT(S, N) \ | ||
141 | do { \ | ||
142 | serout(S, regi_ser ## N); \ | ||
143 | s++; \ | ||
144 | } while (0) | ||
145 | #else | ||
146 | #define SEROUT(S, N) do { \ | ||
147 | while (!(*R_SERIAL ## N ## _STATUS & (1 << 5))) \ | ||
148 | ; \ | ||
149 | *R_SERIAL ## N ## _TR_DATA = *s++; \ | ||
150 | } while (0) | ||
140 | #endif | 151 | #endif |
141 | 152 | ||
142 | static void puts(const char *s) | 153 | static void aputs(const char *s) |
143 | { | 154 | { |
144 | #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL | 155 | #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL |
145 | while (*s) { | 156 | while (*s) { |
146 | #ifdef CONFIG_ETRAX_DEBUG_PORT0 | 157 | #ifdef CONFIG_ETRAX_DEBUG_PORT0 |
147 | #ifdef CONFIG_ETRAX_ARCH_V32 | 158 | SEROUT(s, 0); |
148 | serout(s, regi_ser0); | ||
149 | #else | ||
150 | while (!(*R_SERIAL0_STATUS & (1 << 5))) | ||
151 | ; | ||
152 | *R_SERIAL0_TR_DATA = *s++; | ||
153 | #endif | ||
154 | #endif | 159 | #endif |
155 | #ifdef CONFIG_ETRAX_DEBUG_PORT1 | 160 | #ifdef CONFIG_ETRAX_DEBUG_PORT1 |
156 | #ifdef CONFIG_ETRAX_ARCH_V32 | 161 | SEROUT(s, 1); |
157 | serout(s, regi_ser1); | ||
158 | #else | ||
159 | while (!(*R_SERIAL1_STATUS & (1 << 5))) | ||
160 | ; | ||
161 | *R_SERIAL1_TR_DATA = *s++; | ||
162 | #endif | ||
163 | #endif | 162 | #endif |
164 | #ifdef CONFIG_ETRAX_DEBUG_PORT2 | 163 | #ifdef CONFIG_ETRAX_DEBUG_PORT2 |
165 | #ifdef CONFIG_ETRAX_ARCH_V32 | 164 | SEROUT(s, 2); |
166 | serout(s, regi_ser2); | ||
167 | #else | ||
168 | while (!(*R_SERIAL2_STATUS & (1 << 5))) | ||
169 | ; | ||
170 | *R_SERIAL2_TR_DATA = *s++; | ||
171 | #endif | ||
172 | #endif | 165 | #endif |
173 | #ifdef CONFIG_ETRAX_DEBUG_PORT3 | 166 | #ifdef CONFIG_ETRAX_DEBUG_PORT3 |
174 | #ifdef CONFIG_ETRAX_ARCH_V32 | 167 | SEROUT(s, 3); |
175 | serout(s, regi_ser3); | ||
176 | #else | ||
177 | while (!(*R_SERIAL3_STATUS & (1 << 5))) | ||
178 | ; | ||
179 | *R_SERIAL3_TR_DATA = *s++; | ||
180 | #endif | 168 | #endif |
181 | #endif | ||
182 | *s++; | ||
183 | } | 169 | } |
184 | /* CONFIG_ETRAX_DEBUG_PORT_NULL */ | 170 | #endif /* CONFIG_ETRAX_DEBUG_PORT_NULL */ |
185 | #endif | ||
186 | } | 171 | } |
187 | 172 | ||
188 | void *memset(void *s, int c, size_t n) | 173 | void *memset(void *s, int c, size_t n) |
@@ -233,9 +218,9 @@ static void flush_window(void) | |||
233 | 218 | ||
234 | static void error(char *x) | 219 | static void error(char *x) |
235 | { | 220 | { |
236 | puts("\n\n"); | 221 | aputs("\n\n"); |
237 | puts(x); | 222 | aputs(x); |
238 | puts("\n\n -- System halted\n"); | 223 | aputs("\n\n -- System halted\n"); |
239 | 224 | ||
240 | while(1); /* Halt */ | 225 | while(1); /* Halt */ |
241 | } | 226 | } |
@@ -378,14 +363,14 @@ void decompress_kernel(void) | |||
378 | __asm__ volatile ("move $vr,%0" : "=rm" (revision)); | 363 | __asm__ volatile ("move $vr,%0" : "=rm" (revision)); |
379 | if (revision < compile_rev) { | 364 | if (revision < compile_rev) { |
380 | #ifdef CONFIG_ETRAX_ARCH_V32 | 365 | #ifdef CONFIG_ETRAX_ARCH_V32 |
381 | puts("You need an ETRAX FS to run Linux 2.6/crisv32\n"); | 366 | aputs("You need at least ETRAX FS to run Linux 2.6/crisv32\n"); |
382 | #else | 367 | #else |
383 | puts("You need an ETRAX 100LX to run linux 2.6\n"); | 368 | aputs("You need an ETRAX 100LX to run linux 2.6/crisv10\n"); |
384 | #endif | 369 | #endif |
385 | while(1); | 370 | while(1); |
386 | } | 371 | } |
387 | 372 | ||
388 | puts("Uncompressing Linux...\n"); | 373 | aputs("Uncompressing Linux...\n"); |
389 | gunzip(); | 374 | gunzip(); |
390 | puts("Done. Now booting the kernel\n"); | 375 | aputs("Done. Now booting the kernel\n"); |
391 | } | 376 | } |
diff --git a/arch/cris/include/arch-v32/arch/cache.h b/arch/cris/include/arch-v32/arch/cache.h index dfc73050e6b4..1de779f4f240 100644 --- a/arch/cris/include/arch-v32/arch/cache.h +++ b/arch/cris/include/arch-v32/arch/cache.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #define L1_CACHE_BYTES 32 | 7 | #define L1_CACHE_BYTES 32 |
8 | #define L1_CACHE_SHIFT 5 | 8 | #define L1_CACHE_SHIFT 5 |
9 | 9 | ||
10 | #define __read_mostly __attribute__((__section__(".data.read_mostly"))) | ||
11 | |||
10 | void flush_dma_list(dma_descr_data *descr); | 12 | void flush_dma_list(dma_descr_data *descr); |
11 | void flush_dma_descr(dma_descr_data *descr, int flush_buf); | 13 | void flush_dma_descr(dma_descr_data *descr, int flush_buf); |
12 | 14 | ||
diff --git a/arch/cris/include/arch-v32/arch/dma.h b/arch/cris/include/arch-v32/arch/dma.h index 3674081389fd..61906153a9af 100644 --- a/arch/cris/include/arch-v32/arch/dma.h +++ b/arch/cris/include/arch-v32/arch/dma.h | |||
@@ -1,79 +1 @@ | |||
1 | #ifndef _ASM_ARCH_CRIS_DMA_H | #include "mach/dma.h" | |
2 | #define _ASM_ARCH_CRIS_DMA_H | ||
3 | |||
4 | /* Defines for using and allocating dma channels. */ | ||
5 | |||
6 | #define MAX_DMA_CHANNELS 10 | ||
7 | |||
8 | #define NETWORK_ETH0_TX_DMA_NBR 0 /* Ethernet 0 out. */ | ||
9 | #define NETWORK_ETH0 RX_DMA_NBR 1 /* Ethernet 0 in. */ | ||
10 | |||
11 | #define IO_PROC_DMA0_TX_DMA_NBR 2 /* IO processor DMA0 out. */ | ||
12 | #define IO_PROC_DMA0_RX_DMA_NBR 3 /* IO processor DMA0 in. */ | ||
13 | |||
14 | #define ATA_TX_DMA_NBR 2 /* ATA interface out. */ | ||
15 | #define ATA_RX_DMA_NBR 3 /* ATA interface in. */ | ||
16 | |||
17 | #define ASYNC_SER2_TX_DMA_NBR 2 /* Asynchronous serial port 2 out. */ | ||
18 | #define ASYNC_SER2_RX_DMA_NBR 3 /* Asynchronous serial port 2 in. */ | ||
19 | |||
20 | #define IO_PROC_DMA1_TX_DMA_NBR 4 /* IO processor DMA1 out. */ | ||
21 | #define IO_PROC_DMA1_RX_DMA_NBR 5 /* IO processor DMA1 in. */ | ||
22 | |||
23 | #define ASYNC_SER1_TX_DMA_NBR 4 /* Asynchronous serial port 1 out. */ | ||
24 | #define ASYNC_SER1_RX_DMA_NBR 5 /* Asynchronous serial port 1 in. */ | ||
25 | |||
26 | #define SYNC_SER0_TX_DMA_NBR 4 /* Synchronous serial port 0 out. */ | ||
27 | #define SYNC_SER0_RX_DMA_NBR 5 /* Synchronous serial port 0 in. */ | ||
28 | |||
29 | #define EXTDMA0_TX_DMA_NBR 6 /* External DMA 0 out. */ | ||
30 | #define EXTDMA1_RX_DMA_NBR 7 /* External DMA 1 in. */ | ||
31 | |||
32 | #define ASYNC_SER0_TX_DMA_NBR 6 /* Asynchronous serial port 0 out. */ | ||
33 | #define ASYNC_SER0_RX_DMA_NBR 7 /* Asynchronous serial port 0 in. */ | ||
34 | |||
35 | #define SYNC_SER1_TX_DMA_NBR 6 /* Synchronous serial port 1 out. */ | ||
36 | #define SYNC_SER1_RX_DMA_NBR 7 /* Synchronous serial port 1 in. */ | ||
37 | |||
38 | #define NETWORK_ETH1_TX_DMA_NBR 6 /* Ethernet 1 out. */ | ||
39 | #define NETWORK_ETH1_RX_DMA_NBR 7 /* Ethernet 1 in. */ | ||
40 | |||
41 | #define EXTDMA2_TX_DMA_NBR 8 /* External DMA 2 out. */ | ||
42 | #define EXTDMA3_RX_DMA_NBR 9 /* External DMA 3 in. */ | ||
43 | |||
44 | #define STRCOP_TX_DMA_NBR 8 /* Stream co-processor out. */ | ||
45 | #define STRCOP_RX_DMA_NBR 9 /* Stream co-processor in. */ | ||
46 | |||
47 | #define ASYNC_SER3_TX_DMA_NBR 8 /* Asynchronous serial port 3 out. */ | ||
48 | #define ASYNC_SER3_RX_DMA_NBR 9 /* Asynchronous serial port 3 in. */ | ||
49 | |||
50 | enum dma_owner | ||
51 | { | ||
52 | dma_eth0, | ||
53 | dma_eth1, | ||
54 | dma_iop0, | ||
55 | dma_iop1, | ||
56 | dma_ser0, | ||
57 | dma_ser1, | ||
58 | dma_ser2, | ||
59 | dma_ser3, | ||
60 | dma_sser0, | ||
61 | dma_sser1, | ||
62 | dma_ata, | ||
63 | dma_strp, | ||
64 | dma_ext0, | ||
65 | dma_ext1, | ||
66 | dma_ext2, | ||
67 | dma_ext3 | ||
68 | }; | ||
69 | |||
70 | int crisv32_request_dma(unsigned int dmanr, const char * device_id, | ||
71 | unsigned options, unsigned bandwidth, enum dma_owner owner); | ||
72 | void crisv32_free_dma(unsigned int dmanr); | ||
73 | |||
74 | /* Masks used by crisv32_request_dma options: */ | ||
75 | #define DMA_VERBOSE_ON_ERROR 1 | ||
76 | #define DMA_PANIC_ON_ERROR (2|DMA_VERBOSE_ON_ERROR) | ||
77 | #define DMA_INT_MEM 4 | ||
78 | |||
79 | #endif /* _ASM_ARCH_CRIS_DMA_H */ | ||
diff --git a/arch/cris/include/arch-v32/arch/io.h b/arch/cris/include/arch-v32/arch/io.h index 72024452cea9..adc5484351bf 100644 --- a/arch/cris/include/arch-v32/arch/io.h +++ b/arch/cris/include/arch-v32/arch/io.h | |||
@@ -46,10 +46,12 @@ static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val) | |||
46 | unsigned long flags; | 46 | unsigned long flags; |
47 | spin_lock_irqsave(&iopin->port->lock, flags); | 47 | spin_lock_irqsave(&iopin->port->lock, flags); |
48 | 48 | ||
49 | if (val) | 49 | if (iopin->port->data) { |
50 | *iopin->port->data |= iopin->bit; | 50 | if (val) |
51 | else | 51 | *iopin->port->data |= iopin->bit; |
52 | *iopin->port->data &= ~iopin->bit; | 52 | else |
53 | *iopin->port->data &= ~iopin->bit; | ||
54 | } | ||
53 | 55 | ||
54 | spin_unlock_irqrestore(&iopin->port->lock, flags); | 56 | spin_unlock_irqrestore(&iopin->port->lock, flags); |
55 | } | 57 | } |
@@ -60,10 +62,12 @@ static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, | |||
60 | unsigned long flags; | 62 | unsigned long flags; |
61 | spin_lock_irqsave(&iopin->port->lock, flags); | 63 | spin_lock_irqsave(&iopin->port->lock, flags); |
62 | 64 | ||
63 | if (dir == crisv32_io_dir_in) | 65 | if (iopin->port->oe) { |
64 | *iopin->port->oe &= ~iopin->bit; | 66 | if (dir == crisv32_io_dir_in) |
65 | else | 67 | *iopin->port->oe &= ~iopin->bit; |
66 | *iopin->port->oe |= iopin->bit; | 68 | else |
69 | *iopin->port->oe |= iopin->bit; | ||
70 | } | ||
67 | 71 | ||
68 | spin_unlock_irqrestore(&iopin->port->lock, flags); | 72 | spin_unlock_irqrestore(&iopin->port->lock, flags); |
69 | } | 73 | } |
diff --git a/arch/cris/include/arch-v32/arch/memmap.h b/arch/cris/include/arch-v32/arch/memmap.h index d29df5644d3e..81985c0a6789 100644 --- a/arch/cris/include/arch-v32/arch/memmap.h +++ b/arch/cris/include/arch-v32/arch/memmap.h | |||
@@ -1,24 +1 @@ | |||
1 | #ifndef _ASM_ARCH_MEMMAP_H | #include <mach/memmap.h> | |
2 | #define _ASM_ARCH_MEMMAP_H | ||
3 | |||
4 | #define MEM_CSE0_START (0x00000000) | ||
5 | #define MEM_CSE0_SIZE (0x04000000) | ||
6 | #define MEM_CSE1_START (0x04000000) | ||
7 | #define MEM_CSE1_SIZE (0x04000000) | ||
8 | #define MEM_CSR0_START (0x08000000) | ||
9 | #define MEM_CSR1_START (0x0c000000) | ||
10 | #define MEM_CSP0_START (0x10000000) | ||
11 | #define MEM_CSP1_START (0x14000000) | ||
12 | #define MEM_CSP2_START (0x18000000) | ||
13 | #define MEM_CSP3_START (0x1c000000) | ||
14 | #define MEM_CSP4_START (0x20000000) | ||
15 | #define MEM_CSP5_START (0x24000000) | ||
16 | #define MEM_CSP6_START (0x28000000) | ||
17 | #define MEM_CSP7_START (0x2c000000) | ||
18 | #define MEM_INTMEM_START (0x38000000) | ||
19 | #define MEM_INTMEM_SIZE (0x00020000) | ||
20 | #define MEM_DRAM_START (0x40000000) | ||
21 | |||
22 | #define MEM_NON_CACHEABLE (0x80000000) | ||
23 | |||
24 | #endif | ||
diff --git a/arch/cris/include/arch-v32/arch/pgtable.h b/arch/cris/include/arch-v32/arch/pgtable.h index 08cb7ff7e4e7..c1051a8da33d 100644 --- a/arch/cris/include/arch-v32/arch/pgtable.h +++ b/arch/cris/include/arch-v32/arch/pgtable.h | |||
@@ -2,8 +2,16 @@ | |||
2 | #define _ASM_CRIS_ARCH_PGTABLE_H | 2 | #define _ASM_CRIS_ARCH_PGTABLE_H |
3 | 3 | ||
4 | /* Define the kernels virtual memory area. */ | 4 | /* Define the kernels virtual memory area. */ |
5 | |||
6 | /* See head.S for differences between ARTPEC-3 and ETRAX FS. */ | ||
7 | #ifdef CONFIG_CRIS_MACH_ARTPEC3 | ||
8 | #define VMALLOC_START KSEG_E | ||
9 | #define VMALLOC_END KSEG_F | ||
10 | #else | ||
5 | #define VMALLOC_START KSEG_D | 11 | #define VMALLOC_START KSEG_D |
6 | #define VMALLOC_END KSEG_E | 12 | #define VMALLOC_END KSEG_E |
13 | #endif | ||
14 | |||
7 | #define VMALLOC_VMADDR(x) ((unsigned long)(x)) | 15 | #define VMALLOC_VMADDR(x) ((unsigned long)(x)) |
8 | 16 | ||
9 | #endif /* _ASM_CRIS_ARCH_PGTABLE_H */ | 17 | #endif /* _ASM_CRIS_ARCH_PGTABLE_H */ |
diff --git a/arch/cris/include/arch-v32/arch/uaccess.h b/arch/cris/include/arch-v32/arch/uaccess.h index 6b207f1b6622..3196019706cb 100644 --- a/arch/cris/include/arch-v32/arch/uaccess.h +++ b/arch/cris/include/arch-v32/arch/uaccess.h | |||
@@ -122,14 +122,14 @@ __do_strncpy_from_user(char *dst, const char *src, long count) | |||
122 | __asm__ __volatile__ ( | 122 | __asm__ __volatile__ ( |
123 | " move.d %3,%0\n" | 123 | " move.d %3,%0\n" |
124 | "5: move.b [%2+],$acr\n" | 124 | "5: move.b [%2+],$acr\n" |
125 | "1: beq 2f\n" | 125 | "1: beq 6f\n" |
126 | " move.b $acr,[%1+]\n" | 126 | " move.b $acr,[%1+]\n" |
127 | 127 | ||
128 | " subq 1,%0\n" | 128 | " subq 1,%0\n" |
129 | "2: bne 1b\n" | 129 | "2: bne 1b\n" |
130 | " move.b [%2+],$acr\n" | 130 | " move.b [%2+],$acr\n" |
131 | 131 | ||
132 | " sub.d %3,%0\n" | 132 | "6: sub.d %3,%0\n" |
133 | " neg.d %0,%0\n" | 133 | " neg.d %0,%0\n" |
134 | "3:\n" | 134 | "3:\n" |
135 | " .section .fixup,\"ax\"\n" | 135 | " .section .fixup,\"ax\"\n" |
@@ -140,8 +140,7 @@ __do_strncpy_from_user(char *dst, const char *src, long count) | |||
140 | /* The address for a fault at the first move is trivial. | 140 | /* The address for a fault at the first move is trivial. |
141 | The address for a fault at the second move is that of | 141 | The address for a fault at the second move is that of |
142 | the preceding branch insn, since the move insn is in | 142 | the preceding branch insn, since the move insn is in |
143 | its delay-slot. That address is also a branch | 143 | its delay-slot. Just so you don't get confused... */ |
144 | target. Just so you don't get confused... */ | ||
145 | " .previous\n" | 144 | " .previous\n" |
146 | " .section __ex_table,\"a\"\n" | 145 | " .section __ex_table,\"a\"\n" |
147 | " .dword 5b,4b\n" | 146 | " .dword 5b,4b\n" |
diff --git a/arch/cris/include/arch-v32/mach-a3/mach/dma.h b/arch/cris/include/arch-v32/mach-a3/mach/dma.h index 9e8eb13b601d..f01dca1ad108 100644 --- a/arch/cris/include/arch-v32/mach-a3/mach/dma.h +++ b/arch/cris/include/arch-v32/mach-a3/mach/dma.h | |||
@@ -5,6 +5,33 @@ | |||
5 | 5 | ||
6 | #define MAX_DMA_CHANNELS 12 /* 8 and 10 not used. */ | 6 | #define MAX_DMA_CHANNELS 12 /* 8 and 10 not used. */ |
7 | 7 | ||
8 | #define NETWORK_ETH_TX_DMA_NBR 0 /* Ethernet 0 out. */ | ||
9 | #define NETWORK_ETH_RX_DMA_NBR 1 /* Ethernet 0 in. */ | ||
10 | |||
11 | #define IO_PROC_DMA_TX_DMA_NBR 4 /* IO processor DMA0 out. */ | ||
12 | #define IO_PROC_DMA_RX_DMA_NBR 5 /* IO processor DMA0 in. */ | ||
13 | |||
14 | #define ASYNC_SER3_TX_DMA_NBR 2 /* Asynchronous serial port 3 out. */ | ||
15 | #define ASYNC_SER3_RX_DMA_NBR 3 /* Asynchronous serial port 3 in. */ | ||
16 | |||
17 | #define ASYNC_SER2_TX_DMA_NBR 6 /* Asynchronous serial port 2 out. */ | ||
18 | #define ASYNC_SER2_RX_DMA_NBR 7 /* Asynchronous serial port 2 in. */ | ||
19 | |||
20 | #define ASYNC_SER1_TX_DMA_NBR 4 /* Asynchronous serial port 1 out. */ | ||
21 | #define ASYNC_SER1_RX_DMA_NBR 5 /* Asynchronous serial port 1 in. */ | ||
22 | |||
23 | #define SYNC_SER_TX_DMA_NBR 6 /* Synchronous serial port 0 out. */ | ||
24 | #define SYNC_SER_RX_DMA_NBR 7 /* Synchronous serial port 0 in. */ | ||
25 | |||
26 | #define ASYNC_SER0_TX_DMA_NBR 0 /* Asynchronous serial port 0 out. */ | ||
27 | #define ASYNC_SER0_RX_DMA_NBR 1 /* Asynchronous serial port 0 in. */ | ||
28 | |||
29 | #define STRCOP_TX_DMA_NBR 2 /* Stream co-processor out. */ | ||
30 | #define STRCOP_RX_DMA_NBR 3 /* Stream co-processor in. */ | ||
31 | |||
32 | #define dma_eth0 dma_eth | ||
33 | #define dma_eth1 dma_eth | ||
34 | |||
8 | enum dma_owner { | 35 | enum dma_owner { |
9 | dma_eth, | 36 | dma_eth, |
10 | dma_ser0, | 37 | dma_ser0, |
diff --git a/arch/cris/include/arch-v32/mach-a3/mach/startup.inc b/arch/cris/include/arch-v32/mach-a3/mach/startup.inc index 2f23e5e16f4a..2d52bcc96ed5 100644 --- a/arch/cris/include/arch-v32/mach-a3/mach/startup.inc +++ b/arch/cris/include/arch-v32/mach-a3/mach/startup.inc | |||
@@ -1,9 +1,19 @@ | |||
1 | #ifndef STARTUP_INC_INCLUDED | ||
2 | #define STARTUP_INC_INCLUDED | ||
3 | |||
1 | #include <hwregs/asm/reg_map_asm.h> | 4 | #include <hwregs/asm/reg_map_asm.h> |
2 | #include <hwregs/asm/gio_defs_asm.h> | 5 | #include <hwregs/asm/gio_defs_asm.h> |
3 | #include <hwregs/asm/pio_defs_asm.h> | 6 | #include <hwregs/asm/pio_defs_asm.h> |
4 | #include <hwregs/asm/clkgen_defs_asm.h> | 7 | #include <hwregs/asm/clkgen_defs_asm.h> |
5 | #include <hwregs/asm/pinmux_defs_asm.h> | 8 | #include <hwregs/asm/pinmux_defs_asm.h> |
6 | 9 | ||
10 | .macro GIO_SET_P BITS, OUTREG | ||
11 | bmi 1f ; btstq: bit -> N flag | ||
12 | nop | ||
13 | or.d \BITS, \OUTREG | ||
14 | 1: | ||
15 | .endm | ||
16 | |||
7 | .macro GIO_INIT | 17 | .macro GIO_INIT |
8 | move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0 | 18 | move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0 |
9 | move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r1 | 19 | move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r1 |
@@ -32,10 +42,23 @@ | |||
32 | move.d 0xFFFFFFFF, $r0 | 42 | move.d 0xFFFFFFFF, $r0 |
33 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pa), $r1 | 43 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pa), $r1 |
34 | move.d $r0, [$r1] | 44 | move.d $r0, [$r1] |
35 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 | ||
36 | move.d $r0, [$r1] | ||
37 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pc), $r1 | 45 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pc), $r1 |
38 | move.d $r0, [$r1] | 46 | move.d $r0, [$r1] |
47 | |||
48 | ;; If eth_mdio, eth, geth bits are set in hwprot, don't | ||
49 | ;; set them to gpio, as this means they have been configured | ||
50 | ;; earlier and shouldn't be changed. | ||
51 | move.d 0xFC000000, $r2 ; pins 25..0 are eth_mdio, eth, geth | ||
52 | move.d REG_ADDR(pinmux, regi_pinmux, rw_hwprot), $r1 | ||
53 | move.d [$r1], $r0 | ||
54 | btstq REG_BIT(pinmux, rw_hwprot, eth), $r0 | ||
55 | GIO_SET_P 0x00FFFF00, $r2 ;; pins 8..23 are eth | ||
56 | btstq REG_BIT(pinmux, rw_hwprot, eth_mdio), $r0 | ||
57 | GIO_SET_P 0x03000000, $r2 ;; pins 24..25 are eth_mdio | ||
58 | btstq REG_BIT(pinmux, rw_hwprot, geth), $r0 | ||
59 | GIO_SET_P 0x000000FF, $r2 ;; pins 0..7 are geth | ||
60 | move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 | ||
61 | move.d $r2, [$r1] | ||
39 | .endm | 62 | .endm |
40 | 63 | ||
41 | .macro START_CLOCKS | 64 | .macro START_CLOCKS |
@@ -58,3 +81,4 @@ | |||
58 | move.d CONFIG_ETRAX_PIO_CE2_CFG, $r1 | 81 | move.d CONFIG_ETRAX_PIO_CE2_CFG, $r1 |
59 | move.d $r1, [$r0] | 82 | move.d $r1, [$r0] |
60 | .endm | 83 | .endm |
84 | #endif | ||
diff --git a/arch/cris/include/arch-v32/mach-fs/mach/dma.h b/arch/cris/include/arch-v32/mach-fs/mach/dma.h new file mode 100644 index 000000000000..a8c59292586a --- /dev/null +++ b/arch/cris/include/arch-v32/mach-fs/mach/dma.h | |||
@@ -0,0 +1,79 @@ | |||
1 | #ifndef _ASM_ARCH_CRIS_DMA_H | ||
2 | #define _ASM_ARCH_CRIS_DMA_H | ||
3 | |||
4 | /* Defines for using and allocating dma channels. */ | ||
5 | |||
6 | #define MAX_DMA_CHANNELS 10 | ||
7 | |||
8 | #define NETWORK_ETH0_TX_DMA_NBR 0 /* Ethernet 0 out. */ | ||
9 | #define NETWORK_ETH0 RX_DMA_NBR 1 /* Ethernet 0 in. */ | ||
10 | |||
11 | #define IO_PROC_DMA0_TX_DMA_NBR 2 /* IO processor DMA0 out. */ | ||
12 | #define IO_PROC_DMA0_RX_DMA_NBR 3 /* IO processor DMA0 in. */ | ||
13 | |||
14 | #define ATA_TX_DMA_NBR 2 /* ATA interface out. */ | ||
15 | #define ATA_RX_DMA_NBR 3 /* ATA interface in. */ | ||
16 | |||
17 | #define ASYNC_SER2_TX_DMA_NBR 2 /* Asynchronous serial port 2 out. */ | ||
18 | #define ASYNC_SER2_RX_DMA_NBR 3 /* Asynchronous serial port 2 in. */ | ||
19 | |||
20 | #define IO_PROC_DMA1_TX_DMA_NBR 4 /* IO processor DMA1 out. */ | ||
21 | #define IO_PROC_DMA1_RX_DMA_NBR 5 /* IO processor DMA1 in. */ | ||
22 | |||
23 | #define ASYNC_SER1_TX_DMA_NBR 4 /* Asynchronous serial port 1 out. */ | ||
24 | #define ASYNC_SER1_RX_DMA_NBR 5 /* Asynchronous serial port 1 in. */ | ||
25 | |||
26 | #define SYNC_SER0_TX_DMA_NBR 4 /* Synchronous serial port 0 out. */ | ||
27 | #define SYNC_SER0_RX_DMA_NBR 5 /* Synchronous serial port 0 in. */ | ||
28 | |||
29 | #define EXTDMA0_TX_DMA_NBR 6 /* External DMA 0 out. */ | ||
30 | #define EXTDMA1_RX_DMA_NBR 7 /* External DMA 1 in. */ | ||
31 | |||
32 | #define ASYNC_SER0_TX_DMA_NBR 6 /* Asynchronous serial port 0 out. */ | ||
33 | #define ASYNC_SER0_RX_DMA_NBR 7 /* Asynchronous serial port 0 in. */ | ||
34 | |||
35 | #define SYNC_SER1_TX_DMA_NBR 6 /* Synchronous serial port 1 out. */ | ||
36 | #define SYNC_SER1_RX_DMA_NBR 7 /* Synchronous serial port 1 in. */ | ||
37 | |||
38 | #define NETWORK_ETH1_TX_DMA_NBR 6 /* Ethernet 1 out. */ | ||
39 | #define NETWORK_ETH1_RX_DMA_NBR 7 /* Ethernet 1 in. */ | ||
40 | |||
41 | #define EXTDMA2_TX_DMA_NBR 8 /* External DMA 2 out. */ | ||
42 | #define EXTDMA3_RX_DMA_NBR 9 /* External DMA 3 in. */ | ||
43 | |||
44 | #define STRCOP_TX_DMA_NBR 8 /* Stream co-processor out. */ | ||
45 | #define STRCOP_RX_DMA_NBR 9 /* Stream co-processor in. */ | ||
46 | |||
47 | #define ASYNC_SER3_TX_DMA_NBR 8 /* Asynchronous serial port 3 out. */ | ||
48 | #define ASYNC_SER3_RX_DMA_NBR 9 /* Asynchronous serial port 3 in. */ | ||
49 | |||
50 | enum dma_owner { | ||
51 | dma_eth0, | ||
52 | dma_eth1, | ||
53 | dma_iop0, | ||
54 | dma_iop1, | ||
55 | dma_ser0, | ||
56 | dma_ser1, | ||
57 | dma_ser2, | ||
58 | dma_ser3, | ||
59 | dma_sser0, | ||
60 | dma_sser1, | ||
61 | dma_ata, | ||
62 | dma_strp, | ||
63 | dma_ext0, | ||
64 | dma_ext1, | ||
65 | dma_ext2, | ||
66 | dma_ext3 | ||
67 | }; | ||
68 | |||
69 | int crisv32_request_dma(unsigned int dmanr, const char *device_id, | ||
70 | unsigned options, unsigned bandwidth, | ||
71 | enum dma_owner owner); | ||
72 | void crisv32_free_dma(unsigned int dmanr); | ||
73 | |||
74 | /* Masks used by crisv32_request_dma options: */ | ||
75 | #define DMA_VERBOSE_ON_ERROR 1 | ||
76 | #define DMA_PANIC_ON_ERROR (2|DMA_VERBOSE_ON_ERROR) | ||
77 | #define DMA_INT_MEM 4 | ||
78 | |||
79 | #endif /* _ASM_ARCH_CRIS_DMA_H */ | ||
diff --git a/arch/cris/include/arch-v32/mach-fs/mach/memmap.h b/arch/cris/include/arch-v32/mach-fs/mach/memmap.h new file mode 100644 index 000000000000..d29df5644d3e --- /dev/null +++ b/arch/cris/include/arch-v32/mach-fs/mach/memmap.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _ASM_ARCH_MEMMAP_H | ||
2 | #define _ASM_ARCH_MEMMAP_H | ||
3 | |||
4 | #define MEM_CSE0_START (0x00000000) | ||
5 | #define MEM_CSE0_SIZE (0x04000000) | ||
6 | #define MEM_CSE1_START (0x04000000) | ||
7 | #define MEM_CSE1_SIZE (0x04000000) | ||
8 | #define MEM_CSR0_START (0x08000000) | ||
9 | #define MEM_CSR1_START (0x0c000000) | ||
10 | #define MEM_CSP0_START (0x10000000) | ||
11 | #define MEM_CSP1_START (0x14000000) | ||
12 | #define MEM_CSP2_START (0x18000000) | ||
13 | #define MEM_CSP3_START (0x1c000000) | ||
14 | #define MEM_CSP4_START (0x20000000) | ||
15 | #define MEM_CSP5_START (0x24000000) | ||
16 | #define MEM_CSP6_START (0x28000000) | ||
17 | #define MEM_CSP7_START (0x2c000000) | ||
18 | #define MEM_INTMEM_START (0x38000000) | ||
19 | #define MEM_INTMEM_SIZE (0x00020000) | ||
20 | #define MEM_DRAM_START (0x40000000) | ||
21 | |||
22 | #define MEM_NON_CACHEABLE (0x80000000) | ||
23 | |||
24 | #endif | ||
diff --git a/arch/cris/include/arch-v32/mach-fs/mach/startup.inc b/arch/cris/include/arch-v32/mach-fs/mach/startup.inc index 4a10ccbd6cc1..dd1abbdcbc7a 100644 --- a/arch/cris/include/arch-v32/mach-fs/mach/startup.inc +++ b/arch/cris/include/arch-v32/mach-fs/mach/startup.inc | |||
@@ -1,3 +1,6 @@ | |||
1 | #ifndef STARTUP_INC_INCLUDED | ||
2 | #define STARTUP_INC_INCLUDED | ||
3 | |||
1 | #include <hwregs/asm/reg_map_asm.h> | 4 | #include <hwregs/asm/reg_map_asm.h> |
2 | #include <hwregs/asm/bif_core_defs_asm.h> | 5 | #include <hwregs/asm/bif_core_defs_asm.h> |
3 | #include <hwregs/asm/gio_defs_asm.h> | 6 | #include <hwregs/asm/gio_defs_asm.h> |
@@ -75,3 +78,5 @@ | |||
75 | move.d $r10, [$r11] | 78 | move.d $r10, [$r11] |
76 | #endif | 79 | #endif |
77 | .endm | 80 | .endm |
81 | |||
82 | #endif | ||
diff --git a/arch/cris/include/asm/etraxgpio.h b/arch/cris/include/asm/etraxgpio.h index 38f1c8e1770c..d474818a537e 100644 --- a/arch/cris/include/asm/etraxgpio.h +++ b/arch/cris/include/asm/etraxgpio.h | |||
@@ -21,31 +21,35 @@ | |||
21 | * /dev/leds minor 2, Access to leds depending on kernelconfig | 21 | * /dev/leds minor 2, Access to leds depending on kernelconfig |
22 | * | 22 | * |
23 | * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3): | 23 | * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3): |
24 | * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction | 24 | * /dev/gpioa minor 0, 32 bit GPIO, each bit can change direction |
25 | * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction | 25 | * /dev/gpiob minor 1, 32 bit GPIO, each bit can change direction |
26 | * /dev/gpioc minor 3, 18 bit GPIO, each bit can change direction | 26 | * /dev/gpioc minor 3, 16 bit GPIO, each bit can change direction |
27 | * /dev/gpiod minor 4, 18 bit GPIO, each bit can change direction | 27 | * /dev/gpiod minor 4, 32 bit GPIO, input only |
28 | * /dev/leds minor 2, Access to leds depending on kernelconfig | 28 | * /dev/leds minor 2, Access to leds depending on kernelconfig |
29 | * /dev/pwm0 minor 16, PWM channel 0 on PA30 | 29 | * /dev/pwm0 minor 16, PWM channel 0 on PA30 |
30 | * /dev/pwm1 minor 17, PWM channel 1 on PA31 | 30 | * /dev/pwm1 minor 17, PWM channel 1 on PA31 |
31 | * /dev/pwm2 minor 18, PWM channel 2 on PB26 | 31 | * /dev/pwm2 minor 18, PWM channel 2 on PB26 |
32 | * /dev/ppwm minor 19, PPWM channel | ||
32 | * | 33 | * |
33 | */ | 34 | */ |
34 | #ifndef _ASM_ETRAXGPIO_H | 35 | #ifndef _ASM_ETRAXGPIO_H |
35 | #define _ASM_ETRAXGPIO_H | 36 | #define _ASM_ETRAXGPIO_H |
36 | 37 | ||
38 | #define GPIO_MINOR_FIRST 0 | ||
39 | |||
40 | #define ETRAXGPIO_IOCTYPE 43 | ||
41 | |||
37 | /* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */ | 42 | /* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */ |
38 | #ifdef CONFIG_ETRAX_ARCH_V10 | 43 | #ifdef CONFIG_ETRAX_ARCH_V10 |
39 | #define ETRAXGPIO_IOCTYPE 43 | ||
40 | #define GPIO_MINOR_A 0 | 44 | #define GPIO_MINOR_A 0 |
41 | #define GPIO_MINOR_B 1 | 45 | #define GPIO_MINOR_B 1 |
42 | #define GPIO_MINOR_LEDS 2 | 46 | #define GPIO_MINOR_LEDS 2 |
43 | #define GPIO_MINOR_G 3 | 47 | #define GPIO_MINOR_G 3 |
44 | #define GPIO_MINOR_LAST 3 | 48 | #define GPIO_MINOR_LAST 3 |
49 | #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST | ||
45 | #endif | 50 | #endif |
46 | 51 | ||
47 | #ifdef CONFIG_ETRAXFS | 52 | #ifdef CONFIG_ETRAXFS |
48 | #define ETRAXGPIO_IOCTYPE 43 | ||
49 | #define GPIO_MINOR_A 0 | 53 | #define GPIO_MINOR_A 0 |
50 | #define GPIO_MINOR_B 1 | 54 | #define GPIO_MINOR_B 1 |
51 | #define GPIO_MINOR_LEDS 2 | 55 | #define GPIO_MINOR_LEDS 2 |
@@ -58,10 +62,10 @@ | |||
58 | #else | 62 | #else |
59 | #define GPIO_MINOR_LAST 5 | 63 | #define GPIO_MINOR_LAST 5 |
60 | #endif | 64 | #endif |
65 | #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST | ||
61 | #endif | 66 | #endif |
62 | 67 | ||
63 | #ifdef CONFIG_CRIS_MACH_ARTPEC3 | 68 | #ifdef CONFIG_CRIS_MACH_ARTPEC3 |
64 | #define ETRAXGPIO_IOCTYPE 43 | ||
65 | #define GPIO_MINOR_A 0 | 69 | #define GPIO_MINOR_A 0 |
66 | #define GPIO_MINOR_B 1 | 70 | #define GPIO_MINOR_B 1 |
67 | #define GPIO_MINOR_LEDS 2 | 71 | #define GPIO_MINOR_LEDS 2 |
@@ -73,12 +77,17 @@ | |||
73 | #else | 77 | #else |
74 | #define GPIO_MINOR_LAST 4 | 78 | #define GPIO_MINOR_LAST 4 |
75 | #endif | 79 | #endif |
76 | #define GPIO_MINOR_PWM0 16 | 80 | #define GPIO_MINOR_FIRST_PWM 16 |
77 | #define GPIO_MINOR_PWM1 17 | 81 | #define GPIO_MINOR_PWM0 (GPIO_MINOR_FIRST_PWM+0) |
78 | #define GPIO_MINOR_PWM2 18 | 82 | #define GPIO_MINOR_PWM1 (GPIO_MINOR_FIRST_PWM+1) |
79 | #define GPIO_MINOR_LAST_PWM GPIO_MINOR_PWM2 | 83 | #define GPIO_MINOR_PWM2 (GPIO_MINOR_FIRST_PWM+2) |
84 | #define GPIO_MINOR_PPWM (GPIO_MINOR_FIRST_PWM+3) | ||
85 | #define GPIO_MINOR_LAST_PWM GPIO_MINOR_PPWM | ||
86 | #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST_PWM | ||
80 | #endif | 87 | #endif |
81 | 88 | ||
89 | |||
90 | |||
82 | /* supported ioctl _IOC_NR's */ | 91 | /* supported ioctl _IOC_NR's */ |
83 | 92 | ||
84 | #define IO_READBITS 0x1 /* read and return current port bits (obsolete) */ | 93 | #define IO_READBITS 0x1 /* read and return current port bits (obsolete) */ |
@@ -125,12 +134,10 @@ | |||
125 | */ | 134 | */ |
126 | #define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */ | 135 | #define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */ |
127 | #define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */ | 136 | #define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */ |
128 | #define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, | 137 | #define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, */ |
129 | * *arg updated with current input pins. | 138 | /* *arg updated with current input pins. */ |
130 | */ | 139 | #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, */ |
131 | #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, | 140 | /* *arg updated with current output pins. */ |
132 | * *arg updated with current output pins. | ||
133 | */ | ||
134 | 141 | ||
135 | /* The following ioctl's are applicable to the PWM channels only */ | 142 | /* The following ioctl's are applicable to the PWM channels only */ |
136 | 143 | ||
@@ -140,7 +147,8 @@ enum io_pwm_mode { | |||
140 | PWM_OFF = 0, /* disabled, deallocated */ | 147 | PWM_OFF = 0, /* disabled, deallocated */ |
141 | PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */ | 148 | PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */ |
142 | PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */ | 149 | PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */ |
143 | PWM_VARFREQ = 3 /* individually configurable high/low periods */ | 150 | PWM_VARFREQ = 3, /* individually configurable high/low periods */ |
151 | PWM_SOFT = 4 /* software generated */ | ||
144 | }; | 152 | }; |
145 | 153 | ||
146 | struct io_pwm_set_mode { | 154 | struct io_pwm_set_mode { |
@@ -176,4 +184,56 @@ struct io_pwm_set_duty { | |||
176 | int duty; /* 0..255 */ | 184 | int duty; /* 0..255 */ |
177 | }; | 185 | }; |
178 | 186 | ||
187 | /* Returns information about the latest PWM pulse. | ||
188 | * lo: Length of the latest low period, in units of 10ns. | ||
189 | * hi: Length of the latest high period, in units of 10ns. | ||
190 | * cnt: Time since last detected edge, in units of 10ns. | ||
191 | * | ||
192 | * The input source to PWM is decied by IO_PWM_SET_INPUT_SRC. | ||
193 | * | ||
194 | * NOTE: All PWM devices is connected to the same input source. | ||
195 | */ | ||
196 | #define IO_PWM_GET_PERIOD 0x23 | ||
197 | |||
198 | struct io_pwm_get_period { | ||
199 | unsigned int lo; | ||
200 | unsigned int hi; | ||
201 | unsigned int cnt; | ||
202 | }; | ||
203 | |||
204 | /* Sets the input source for the PWM input. For the src value see the | ||
205 | * register description for gio:rw_pwm_in_cfg. | ||
206 | * | ||
207 | * NOTE: All PWM devices is connected to the same input source. | ||
208 | */ | ||
209 | #define IO_PWM_SET_INPUT_SRC 0x24 | ||
210 | struct io_pwm_set_input_src { | ||
211 | unsigned int src; /* 0..7 */ | ||
212 | }; | ||
213 | |||
214 | /* Sets the duty cycles in steps of 1/256, 0 = 0%, 255 = 100% duty cycle */ | ||
215 | #define IO_PPWM_SET_DUTY 0x25 | ||
216 | |||
217 | struct io_ppwm_set_duty { | ||
218 | int duty; /* 0..255 */ | ||
219 | }; | ||
220 | |||
221 | /* Configuraton struct for the IO_PWMCLK_SET_CONFIG ioctl to configure | ||
222 | * PWM capable gpio pins: | ||
223 | */ | ||
224 | #define IO_PWMCLK_SETGET_CONFIG 0x26 | ||
225 | struct gpio_pwmclk_conf { | ||
226 | unsigned int gpiopin; /* The pin number based on the opened device */ | ||
227 | unsigned int baseclk; /* The base clock to use, or sw will select one close*/ | ||
228 | unsigned int low; /* The number of low periods of the baseclk */ | ||
229 | unsigned int high; /* The number of high periods of the baseclk */ | ||
230 | }; | ||
231 | |||
232 | /* Examples: | ||
233 | * To get a symmetric 12 MHz clock without knowing anything about the hardware: | ||
234 | * baseclk = 12000000, low = 0, high = 0 | ||
235 | * To just get info of current setting: | ||
236 | * baseclk = 0, low = 0, high = 0, the values will be updated by driver. | ||
237 | */ | ||
238 | |||
179 | #endif | 239 | #endif |
diff --git a/arch/cris/include/asm/sync_serial.h b/arch/cris/include/asm/sync_serial.h index d87c24df2b38..7f827fea30e7 100644 --- a/arch/cris/include/asm/sync_serial.h +++ b/arch/cris/include/asm/sync_serial.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define SSP_OPOLARITY _IOR('S', 4, unsigned int) | 19 | #define SSP_OPOLARITY _IOR('S', 4, unsigned int) |
20 | #define SSP_SPI _IOR('S', 5, unsigned int) | 20 | #define SSP_SPI _IOR('S', 5, unsigned int) |
21 | #define SSP_INBUFCHUNK _IOR('S', 6, unsigned int) | 21 | #define SSP_INBUFCHUNK _IOR('S', 6, unsigned int) |
22 | #define SSP_INPUT _IOR('S', 7, unsigned int) | ||
22 | 23 | ||
23 | /* Values for SSP_SPEED */ | 24 | /* Values for SSP_SPEED */ |
24 | #define SSP150 0 | 25 | #define SSP150 0 |
@@ -37,6 +38,7 @@ | |||
37 | #define SSP921600 13 | 38 | #define SSP921600 13 |
38 | #define SSP3125000 14 | 39 | #define SSP3125000 14 |
39 | #define CODEC 15 | 40 | #define CODEC 15 |
41 | #define CODEC_f32768 16 | ||
40 | 42 | ||
41 | #define FREQ_4MHz 0 | 43 | #define FREQ_4MHz 0 |
42 | #define FREQ_2MHz 1 | 44 | #define FREQ_2MHz 1 |
@@ -46,9 +48,14 @@ | |||
46 | #define FREQ_128kHz 5 | 48 | #define FREQ_128kHz 5 |
47 | #define FREQ_64kHz 6 | 49 | #define FREQ_64kHz 6 |
48 | #define FREQ_32kHz 7 | 50 | #define FREQ_32kHz 7 |
51 | /* FREQ_* with values where bit (value & 0x10) is set are */ | ||
52 | /* used for CODEC_f32768 */ | ||
53 | #define FREQ_4096kHz 16 /* CODEC_f32768 */ | ||
49 | 54 | ||
50 | /* Used by application to set CODEC divider, word rate and frame rate */ | 55 | /* Used by application to set CODEC divider, word rate and frame rate */ |
51 | #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28)) | 56 | #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) \ |
57 | ((CODEC + ((freq & 0x10) >> 4)) | (freq << 8) | \ | ||
58 | (clk_per_sync << 16) | (sync_per_frame << 28)) | ||
52 | 59 | ||
53 | /* Used by driver to extract speed */ | 60 | /* Used by driver to extract speed */ |
54 | #define GET_SPEED(x) (x & 0xff) | 61 | #define GET_SPEED(x) (x & 0xff) |
@@ -68,6 +75,7 @@ | |||
68 | #define NORMAL_SYNC 1 | 75 | #define NORMAL_SYNC 1 |
69 | #define EARLY_SYNC 2 | 76 | #define EARLY_SYNC 2 |
70 | #define SECOND_WORD_SYNC 0x40000 | 77 | #define SECOND_WORD_SYNC 0x40000 |
78 | #define LATE_SYNC 0x80000 | ||
71 | 79 | ||
72 | #define BIT_SYNC 4 | 80 | #define BIT_SYNC 4 |
73 | #define WORD_SYNC 8 | 81 | #define WORD_SYNC 8 |
@@ -104,4 +112,21 @@ | |||
104 | /* Values for SSP_INBUFCHUNK */ | 112 | /* Values for SSP_INBUFCHUNK */ |
105 | /* plain integer with the size of DMA chunks */ | 113 | /* plain integer with the size of DMA chunks */ |
106 | 114 | ||
115 | /* To ensure that the timestamps are aligned with the data being read | ||
116 | * the read length MUST be a multiple of the length of the DMA buffers. | ||
117 | * | ||
118 | * Use a multiple of SSP_INPUT_CHUNK_SIZE defined below. | ||
119 | */ | ||
120 | #define SSP_INPUT_CHUNK_SIZE 256 | ||
121 | |||
122 | /* Request struct to pass through the ioctl interface to read | ||
123 | * data with timestamps. | ||
124 | */ | ||
125 | struct ssp_request { | ||
126 | char __user *buf; /* Where to put the data. */ | ||
127 | size_t len; /* Size of buf. MUST be a multiple of */ | ||
128 | /* SSP_INPUT_CHUNK_SIZE! */ | ||
129 | struct timespec ts; /* The time the data was sampled. */ | ||
130 | }; | ||
131 | |||
107 | #endif | 132 | #endif |
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c index b917549a7d94..195ec5fa0dd2 100644 --- a/arch/cris/kernel/profile.c +++ b/arch/cris/kernel/profile.c | |||
@@ -9,12 +9,11 @@ | |||
9 | 9 | ||
10 | #define SAMPLE_BUFFER_SIZE 8192 | 10 | #define SAMPLE_BUFFER_SIZE 8192 |
11 | 11 | ||
12 | static char* sample_buffer; | 12 | static char *sample_buffer; |
13 | static char* sample_buffer_pos; | 13 | static char *sample_buffer_pos; |
14 | static int prof_running = 0; | 14 | static int prof_running = 0; |
15 | 15 | ||
16 | void | 16 | void cris_profile_sample(struct pt_regs *regs) |
17 | cris_profile_sample(struct pt_regs* regs) | ||
18 | { | 17 | { |
19 | if (!prof_running) | 18 | if (!prof_running) |
20 | return; | 19 | return; |
@@ -24,7 +23,7 @@ cris_profile_sample(struct pt_regs* regs) | |||
24 | else | 23 | else |
25 | *(unsigned int*)sample_buffer_pos = 0; | 24 | *(unsigned int*)sample_buffer_pos = 0; |
26 | 25 | ||
27 | *(unsigned int*)(sample_buffer_pos + 4) = instruction_pointer(regs); | 26 | *(unsigned int *)(sample_buffer_pos + 4) = instruction_pointer(regs); |
28 | sample_buffer_pos += 8; | 27 | sample_buffer_pos += 8; |
29 | 28 | ||
30 | if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE) | 29 | if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE) |
@@ -54,6 +53,7 @@ write_cris_profile(struct file *file, const char __user *buf, | |||
54 | { | 53 | { |
55 | sample_buffer_pos = sample_buffer; | 54 | sample_buffer_pos = sample_buffer; |
56 | memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE); | 55 | memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE); |
56 | return count < SAMPLE_BUFFER_SIZE ? count : SAMPLE_BUFFER_SIZE; | ||
57 | } | 57 | } |
58 | 58 | ||
59 | static const struct file_operations cris_proc_profile_operations = { | 59 | static const struct file_operations cris_proc_profile_operations = { |
@@ -61,8 +61,7 @@ static const struct file_operations cris_proc_profile_operations = { | |||
61 | .write = write_cris_profile, | 61 | .write = write_cris_profile, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static int | 64 | static int __init init_cris_profile(void) |
65 | __init init_cris_profile(void) | ||
66 | { | 65 | { |
67 | struct proc_dir_entry *entry; | 66 | struct proc_dir_entry *entry; |
68 | 67 | ||
@@ -82,5 +81,5 @@ __init init_cris_profile(void) | |||
82 | 81 | ||
83 | return 0; | 82 | return 0; |
84 | } | 83 | } |
85 | |||
86 | __initcall(init_cris_profile); | 84 | __initcall(init_cris_profile); |
85 | |||
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c index c72730d20ef6..b5096430ce1c 100644 --- a/arch/cris/kernel/time.c +++ b/arch/cris/kernel/time.c | |||
@@ -39,13 +39,16 @@ int have_rtc; /* used to remember if we have an RTC or not */; | |||
39 | extern unsigned long loops_per_jiffy; /* init/main.c */ | 39 | extern unsigned long loops_per_jiffy; /* init/main.c */ |
40 | unsigned long loops_per_usec; | 40 | unsigned long loops_per_usec; |
41 | 41 | ||
42 | |||
43 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET | ||
42 | extern unsigned long do_slow_gettimeoffset(void); | 44 | extern unsigned long do_slow_gettimeoffset(void); |
43 | static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; | 45 | static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; |
44 | 46 | ||
45 | u32 arch_gettimeoffset(void) | 47 | u32 arch_gettimeoffset(void) |
46 | { | 48 | { |
47 | return do_gettimeoffset() * 1000; | 49 | return do_gettimeoffset() * 1000; |
48 | } | 50 | } |
51 | #endif | ||
49 | 52 | ||
50 | /* | 53 | /* |
51 | * BUG: This routine does not handle hour overflow properly; it just | 54 | * BUG: This routine does not handle hour overflow properly; it just |
@@ -151,7 +154,7 @@ cris_do_profile(struct pt_regs* regs) | |||
151 | 154 | ||
152 | unsigned long long sched_clock(void) | 155 | unsigned long long sched_clock(void) |
153 | { | 156 | { |
154 | return (unsigned long long)jiffies * (1000000000 / HZ) + | 157 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + |
155 | get_ns_in_jiffie(); | 158 | get_ns_in_jiffie(); |
156 | } | 159 | } |
157 | 160 | ||
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S index d49d17d2a14f..442218980db0 100644 --- a/arch/cris/kernel/vmlinux.lds.S +++ b/arch/cris/kernel/vmlinux.lds.S | |||
@@ -58,6 +58,8 @@ SECTIONS | |||
58 | ___data_start = . ; | 58 | ___data_start = . ; |
59 | __Sdata = . ; | 59 | __Sdata = . ; |
60 | .data : { /* Data */ | 60 | .data : { /* Data */ |
61 | CACHELINE_ALIGNED_DATA(32) | ||
62 | READ_MOSTLY_DATA(32) | ||
61 | DATA_DATA | 63 | DATA_DATA |
62 | } | 64 | } |
63 | __edata = . ; /* End of data section. */ | 65 | __edata = . ; /* End of data section. */ |
@@ -84,6 +86,16 @@ SECTIONS | |||
84 | } | 86 | } |
85 | SECURITY_INIT | 87 | SECURITY_INIT |
86 | 88 | ||
89 | /* .exit.text is discarded at runtime, not link time, | ||
90 | * to deal with references from __bug_table | ||
91 | */ | ||
92 | .exit.text : { | ||
93 | EXIT_TEXT | ||
94 | } | ||
95 | .exit.data : { | ||
96 | EXIT_DATA | ||
97 | } | ||
98 | |||
87 | #ifdef CONFIG_ETRAX_ARCH_V10 | 99 | #ifdef CONFIG_ETRAX_ARCH_V10 |
88 | #ifdef CONFIG_BLK_DEV_INITRD | 100 | #ifdef CONFIG_BLK_DEV_INITRD |
89 | .init.ramfs : { | 101 | .init.ramfs : { |
@@ -112,7 +124,7 @@ SECTIONS | |||
112 | __init_end = .; | 124 | __init_end = .; |
113 | 125 | ||
114 | __data_end = . ; /* Move to _edata ? */ | 126 | __data_end = . ; /* Move to _edata ? */ |
115 | BSS_SECTION(0, 0, 0) | 127 | BSS_SECTION(1, 1, 1) |
116 | 128 | ||
117 | . = ALIGN (0x20); | 129 | . = ALIGN (0x20); |
118 | _end = .; | 130 | _end = .; |
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c index 380df1a73a6e..9dcac8ec8fa0 100644 --- a/arch/cris/mm/fault.c +++ b/arch/cris/mm/fault.c | |||
@@ -1,19 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/cris/mm/fault.c | 2 | * arch/cris/mm/fault.c |
3 | * | ||
4 | * Copyright (C) 2000-2006 Axis Communications AB | ||
5 | * | ||
6 | * Authors: Bjorn Wesen | ||
7 | * | 3 | * |
4 | * Copyright (C) 2000-2010 Axis Communications AB | ||
8 | */ | 5 | */ |
9 | 6 | ||
10 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
11 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
12 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/wait.h> | ||
13 | #include <asm/uaccess.h> | 11 | #include <asm/uaccess.h> |
14 | 12 | ||
15 | extern int find_fixup_code(struct pt_regs *); | 13 | extern int find_fixup_code(struct pt_regs *); |
16 | extern void die_if_kernel(const char *, struct pt_regs *, long); | 14 | extern void die_if_kernel(const char *, struct pt_regs *, long); |
15 | extern void show_registers(struct pt_regs *regs); | ||
17 | 16 | ||
18 | /* debug of low-level TLB reload */ | 17 | /* debug of low-level TLB reload */ |
19 | #undef DEBUG | 18 | #undef DEBUG |
@@ -108,11 +107,11 @@ do_page_fault(unsigned long address, struct pt_regs *regs, | |||
108 | info.si_code = SEGV_MAPERR; | 107 | info.si_code = SEGV_MAPERR; |
109 | 108 | ||
110 | /* | 109 | /* |
111 | * If we're in an interrupt or have no user | 110 | * If we're in an interrupt or "atomic" operation or have no |
112 | * context, we must not take the fault.. | 111 | * user context, we must not take the fault. |
113 | */ | 112 | */ |
114 | 113 | ||
115 | if (in_interrupt() || !mm) | 114 | if (in_atomic() || !mm) |
116 | goto no_context; | 115 | goto no_context; |
117 | 116 | ||
118 | down_read(&mm->mmap_sem); | 117 | down_read(&mm->mmap_sem); |
@@ -193,14 +192,25 @@ do_page_fault(unsigned long address, struct pt_regs *regs, | |||
193 | /* User mode accesses just cause a SIGSEGV */ | 192 | /* User mode accesses just cause a SIGSEGV */ |
194 | 193 | ||
195 | if (user_mode(regs)) { | 194 | if (user_mode(regs)) { |
195 | printk(KERN_NOTICE "%s (pid %d) segfaults for page " | ||
196 | "address %08lx at pc %08lx\n", | ||
197 | tsk->comm, tsk->pid, | ||
198 | address, instruction_pointer(regs)); | ||
199 | |||
200 | /* With DPG on, we've already dumped registers above. */ | ||
201 | DPG(if (0)) | ||
202 | show_registers(regs); | ||
203 | |||
204 | #ifdef CONFIG_NO_SEGFAULT_TERMINATION | ||
205 | DECLARE_WAIT_QUEUE_HEAD(wq); | ||
206 | wait_event_interruptible(wq, 0 == 1); | ||
207 | #else | ||
196 | info.si_signo = SIGSEGV; | 208 | info.si_signo = SIGSEGV; |
197 | info.si_errno = 0; | 209 | info.si_errno = 0; |
198 | /* info.si_code has been set above */ | 210 | /* info.si_code has been set above */ |
199 | info.si_addr = (void *)address; | 211 | info.si_addr = (void *)address; |
200 | force_sig_info(SIGSEGV, &info, tsk); | 212 | force_sig_info(SIGSEGV, &info, tsk); |
201 | printk(KERN_NOTICE "%s (pid %d) segfaults for page " | 213 | #endif |
202 | "address %08lx at pc %08lx\n", | ||
203 | tsk->comm, tsk->pid, address, instruction_pointer(regs)); | ||
204 | return; | 214 | return; |
205 | } | 215 | } |
206 | 216 | ||
@@ -245,10 +255,10 @@ do_page_fault(unsigned long address, struct pt_regs *regs, | |||
245 | 255 | ||
246 | out_of_memory: | 256 | out_of_memory: |
247 | up_read(&mm->mmap_sem); | 257 | up_read(&mm->mmap_sem); |
248 | printk("VM: killing process %s\n", tsk->comm); | 258 | if (!user_mode(regs)) |
249 | if (user_mode(regs)) | 259 | goto no_context; |
250 | do_exit(SIGKILL); | 260 | pagefault_out_of_memory(); |
251 | goto no_context; | 261 | return; |
252 | 262 | ||
253 | do_sigbus: | 263 | do_sigbus: |
254 | up_read(&mm->mmap_sem); | 264 | up_read(&mm->mmap_sem); |
@@ -334,8 +344,11 @@ int | |||
334 | find_fixup_code(struct pt_regs *regs) | 344 | find_fixup_code(struct pt_regs *regs) |
335 | { | 345 | { |
336 | const struct exception_table_entry *fixup; | 346 | const struct exception_table_entry *fixup; |
347 | /* in case of delay slot fault (v32) */ | ||
348 | unsigned long ip = (instruction_pointer(regs) & ~0x1); | ||
337 | 349 | ||
338 | if ((fixup = search_exception_tables(instruction_pointer(regs))) != 0) { | 350 | fixup = search_exception_tables(ip); |
351 | if (fixup != 0) { | ||
339 | /* Adjust the instruction pointer in the stackframe. */ | 352 | /* Adjust the instruction pointer in the stackframe. */ |
340 | instruction_pointer(regs) = fixup->fixup; | 353 | instruction_pointer(regs) = fixup->fixup; |
341 | arch_fixup(regs); | 354 | arch_fixup(regs); |