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
...

+857 -742
+4 -1
arch/cris/Kconfig
··· 24 24 def_bool y 25 25 26 26 config ARCH_USES_GETTIMEOFFSET 27 - def_bool y 27 + def_bool n 28 28 29 29 config GENERIC_IOMAP 30 30 bool ··· 128 128 129 129 config ETRAX100LX 130 130 bool "ETRAX-100LX-v1" 131 + select ARCH_USES_GETTIMEOFFSET 131 132 help 132 133 Support version 1 of the ETRAX 100LX. 133 134 134 135 config ETRAX100LX_V2 135 136 bool "ETRAX-100LX-v2" 137 + select ARCH_USES_GETTIMEOFFSET 136 138 help 137 139 Support version 2 of the ETRAX 100LX. 138 140 139 141 config SVINTO_SIM 140 142 bool "ETRAX-100LX-for-xsim-simulator" 143 + select ARCH_USES_GETTIMEOFFSET 141 144 help 142 145 Support the xsim ETRAX Simulator. 143 146
+6
arch/cris/Kconfig.debug
··· 32 32 If the system locks up without any debug information you can say Y 33 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 41 endmenu
+1 -1
arch/cris/arch-v10/drivers/Kconfig
··· 383 383 depends on ETRAX_SERIAL 384 384 help 385 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 388 config ETRAX_RS485_ON_PA 389 389 bool "RS-485 mode on PA"
-2
arch/cris/arch-v10/drivers/eeprom.c
··· 28 28 #include <linux/init.h> 29 29 #include <linux/delay.h> 30 30 #include <linux/interrupt.h> 31 - #include <linux/smp_lock.h> 32 31 #include <linux/wait.h> 33 32 #include <asm/uaccess.h> 34 33 #include "i2c.h" ··· 375 376 /* Opens the device. */ 376 377 static int eeprom_open(struct inode * inode, struct file * file) 377 378 { 378 - cycle_kernel_lock(); 379 379 if(iminor(inode) != EEPROM_MINOR_NR) 380 380 return -ENXIO; 381 381 if(imajor(inode) != EEPROM_MAJOR_NR)
+54 -28
arch/cris/arch-v10/drivers/gpio.c
··· 16 16 #include <linux/errno.h> 17 17 #include <linux/kernel.h> 18 18 #include <linux/fs.h> 19 - #include <linux/smp_lock.h> 20 19 #include <linux/string.h> 21 20 #include <linux/poll.h> 22 21 #include <linux/init.h> ··· 45 46 static wait_queue_head_t *gpio_wq; 46 47 #endif 47 48 48 - static int gpio_ioctl(struct inode *inode, struct file *file, 49 - unsigned int cmd, unsigned long arg); 49 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 50 50 static ssize_t gpio_write(struct file *file, const char __user *buf, 51 51 size_t count, loff_t *off); 52 52 static int gpio_open(struct inode *inode, struct file *filp); ··· 322 324 if (!priv) 323 325 return -ENOMEM; 324 326 325 - lock_kernel(); 326 327 priv->minor = p; 327 328 328 329 /* initialize the io/alarm struct */ ··· 356 359 alarmlist = priv; 357 360 spin_unlock_irqrestore(&gpio_lock, flags); 358 361 359 - unlock_kernel(); 360 362 return 0; 361 363 } 362 364 ··· 500 504 static int 501 505 gpio_leds_ioctl(unsigned int cmd, unsigned long arg); 502 506 503 - static int 504 - gpio_ioctl(struct inode *inode, struct file *file, 505 - unsigned int cmd, unsigned long arg) 507 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 506 508 { 507 509 unsigned long flags; 508 510 unsigned long val; ··· 510 516 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) 511 517 return -EINVAL; 512 518 513 - spin_lock_irqsave(&gpio_lock, flags); 514 - 515 519 switch (_IOC_NR(cmd)) { 516 520 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */ 517 521 // read the port 522 + spin_lock_irqsave(&gpio_lock, flags); 518 523 if (USE_PORTS(priv)) { 519 524 ret = *priv->port; 520 525 } else if (priv->minor == GPIO_MINOR_G) { 521 526 ret = (*R_PORT_G_DATA) & 0x7FFFFFFF; 522 527 } 528 + spin_unlock_irqrestore(&gpio_lock, flags); 529 + 523 530 break; 524 531 case IO_SETBITS: 525 532 // set changeable bits with a 1 in arg 533 + spin_lock_irqsave(&gpio_lock, flags); 534 + 526 535 if (USE_PORTS(priv)) { 527 - *priv->port = *priv->shadow |= 536 + *priv->port = *priv->shadow |= 528 537 ((unsigned char)arg & priv->changeable_bits); 529 538 } else if (priv->minor == GPIO_MINOR_G) { 530 539 *R_PORT_G_DATA = port_g_data_shadow |= (arg & dir_g_out_bits); 531 540 } 541 + spin_unlock_irqrestore(&gpio_lock, flags); 542 + 532 543 break; 533 544 case IO_CLRBITS: 534 545 // clear changeable bits with a 1 in arg 546 + spin_lock_irqsave(&gpio_lock, flags); 535 547 if (USE_PORTS(priv)) { 536 - *priv->port = *priv->shadow &= 548 + *priv->port = *priv->shadow &= 537 549 ~((unsigned char)arg & priv->changeable_bits); 538 550 } else if (priv->minor == GPIO_MINOR_G) { 539 551 *R_PORT_G_DATA = port_g_data_shadow &= ~((unsigned long)arg & dir_g_out_bits); 540 552 } 553 + spin_unlock_irqrestore(&gpio_lock, flags); 541 554 break; 542 555 case IO_HIGHALARM: 543 556 // set alarm when bits with 1 in arg go high 557 + spin_lock_irqsave(&gpio_lock, flags); 544 558 priv->highalarm |= arg; 545 559 gpio_some_alarms = 1; 560 + spin_unlock_irqrestore(&gpio_lock, flags); 546 561 break; 547 562 case IO_LOWALARM: 548 563 // set alarm when bits with 1 in arg go low 564 + spin_lock_irqsave(&gpio_lock, flags); 549 565 priv->lowalarm |= arg; 550 566 gpio_some_alarms = 1; 567 + spin_unlock_irqrestore(&gpio_lock, flags); 551 568 break; 552 569 case IO_CLRALARM: 553 - // clear alarm for bits with 1 in arg 570 + /* clear alarm for bits with 1 in arg */ 571 + spin_lock_irqsave(&gpio_lock, flags); 554 572 priv->highalarm &= ~arg; 555 573 priv->lowalarm &= ~arg; 556 574 { 557 575 /* Must update gpio_some_alarms */ 558 576 struct gpio_private *p = alarmlist; 559 577 int some_alarms; 560 - spin_lock_irq(&gpio_lock); 561 578 p = alarmlist; 562 579 some_alarms = 0; 563 580 while (p) { ··· 579 574 p = p->next; 580 575 } 581 576 gpio_some_alarms = some_alarms; 582 - spin_unlock_irq(&gpio_lock); 583 577 } 578 + spin_unlock_irqrestore(&gpio_lock, flags); 584 579 break; 585 580 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ 586 581 /* Read direction 0=input 1=output */ 582 + spin_lock_irqsave(&gpio_lock, flags); 587 583 if (USE_PORTS(priv)) { 588 584 ret = *priv->dir_shadow; 589 585 } else if (priv->minor == GPIO_MINOR_G) { ··· 593 587 */ 594 588 ret = (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF; 595 589 } 590 + spin_unlock_irqrestore(&gpio_lock, flags); 596 591 break; 597 592 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */ 598 - /* Set direction 0=unchanged 1=input, 599 - * return mask with 1=input 593 + /* Set direction 0=unchanged 1=input, 594 + * return mask with 1=input 600 595 */ 596 + spin_lock_irqsave(&gpio_lock, flags); 601 597 ret = setget_input(priv, arg) & 0x7FFFFFFF; 598 + spin_unlock_irqrestore(&gpio_lock, flags); 602 599 break; 603 600 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */ 604 - /* Set direction 0=unchanged 1=output, 605 - * return mask with 1=output 601 + /* Set direction 0=unchanged 1=output, 602 + * return mask with 1=output 606 603 */ 604 + spin_lock_irqsave(&gpio_lock, flags); 607 605 ret = setget_output(priv, arg) & 0x7FFFFFFF; 606 + spin_unlock_irqrestore(&gpio_lock, flags); 608 607 break; 609 608 case IO_SHUTDOWN: 609 + spin_lock_irqsave(&gpio_lock, flags); 610 610 SOFT_SHUTDOWN(); 611 + spin_unlock_irqrestore(&gpio_lock, flags); 611 612 break; 612 613 case IO_GET_PWR_BT: 614 + spin_lock_irqsave(&gpio_lock, flags); 613 615 #if defined (CONFIG_ETRAX_SOFT_SHUTDOWN) 614 616 ret = (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT)); 615 617 #else 616 618 ret = 0; 617 619 #endif 620 + spin_unlock_irqrestore(&gpio_lock, flags); 618 621 break; 619 622 case IO_CFG_WRITE_MODE: 623 + spin_lock_irqsave(&gpio_lock, flags); 620 624 priv->clk_mask = arg & 0xFF; 621 625 priv->data_mask = (arg >> 8) & 0xFF; 622 626 priv->write_msb = (arg >> 16) & 0x01; ··· 642 626 priv->data_mask = 0; 643 627 ret = -EPERM; 644 628 } 629 + spin_unlock_irqrestore(&gpio_lock, flags); 645 630 break; 646 - case IO_READ_INBITS: 631 + case IO_READ_INBITS: 647 632 /* *arg is result of reading the input pins */ 633 + spin_lock_irqsave(&gpio_lock, flags); 648 634 if (USE_PORTS(priv)) { 649 635 val = *priv->port; 650 636 } else if (priv->minor == GPIO_MINOR_G) { 651 637 val = *R_PORT_G_DATA; 652 638 } 639 + spin_unlock_irqrestore(&gpio_lock, flags); 653 640 if (copy_to_user((void __user *)arg, &val, sizeof(val))) 654 641 ret = -EFAULT; 655 642 break; 656 643 case IO_READ_OUTBITS: 657 644 /* *arg is result of reading the output shadow */ 645 + spin_lock_irqsave(&gpio_lock, flags); 658 646 if (USE_PORTS(priv)) { 659 647 val = *priv->shadow; 660 648 } else if (priv->minor == GPIO_MINOR_G) { 661 649 val = port_g_data_shadow; 662 650 } 651 + spin_unlock_irqrestore(&gpio_lock, flags); 663 652 if (copy_to_user((void __user *)arg, &val, sizeof(val))) 664 653 ret = -EFAULT; 665 654 break; 666 - case IO_SETGET_INPUT: 655 + case IO_SETGET_INPUT: 667 656 /* bits set in *arg is set to input, 668 657 * *arg updated with current input pins. 669 658 */ ··· 677 656 ret = -EFAULT; 678 657 break; 679 658 } 659 + spin_lock_irqsave(&gpio_lock, flags); 680 660 val = setget_input(priv, val); 661 + spin_unlock_irqrestore(&gpio_lock, flags); 681 662 if (copy_to_user((void __user *)arg, &val, sizeof(val))) 682 663 ret = -EFAULT; 683 664 break; ··· 691 668 ret = -EFAULT; 692 669 break; 693 670 } 671 + spin_lock_irqsave(&gpio_lock, flags); 694 672 val = setget_output(priv, val); 673 + spin_unlock_irqrestore(&gpio_lock, flags); 695 674 if (copy_to_user((void __user *)arg, &val, sizeof(val))) 696 675 ret = -EFAULT; 697 676 break; 698 677 default: 678 + spin_lock_irqsave(&gpio_lock, flags); 699 679 if (priv->minor == GPIO_MINOR_LEDS) 700 680 ret = gpio_leds_ioctl(cmd, arg); 701 681 else 702 682 ret = -EINVAL; 683 + spin_unlock_irqrestore(&gpio_lock, flags); 703 684 } /* switch */ 704 685 705 - spin_unlock_irqrestore(&gpio_lock, flags); 706 686 return ret; 707 687 } 708 688 ··· 739 713 } 740 714 741 715 static const struct file_operations gpio_fops = { 742 - .owner = THIS_MODULE, 743 - .poll = gpio_poll, 744 - .ioctl = gpio_ioctl, 745 - .write = gpio_write, 746 - .open = gpio_open, 747 - .release = gpio_release, 716 + .owner = THIS_MODULE, 717 + .poll = gpio_poll, 718 + .unlocked_ioctl = gpio_ioctl, 719 + .write = gpio_write, 720 + .open = gpio_open, 721 + .release = gpio_release, 748 722 }; 749 723 750 724 static void ioif_watcher(const unsigned int gpio_in_available,
+17 -22
arch/cris/arch-v10/drivers/i2c.c
··· 14 14 15 15 #include <linux/module.h> 16 16 #include <linux/sched.h> 17 - #include <linux/smp_lock.h> 18 17 #include <linux/errno.h> 19 18 #include <linux/kernel.h> 20 19 #include <linux/fs.h> ··· 59 60 60 61 #define SDABIT CONFIG_ETRAX_I2C_DATA_PORT 61 62 #define SCLBIT CONFIG_ETRAX_I2C_CLK_PORT 62 - #define i2c_enable() 63 - #define i2c_disable() 63 + #define i2c_enable() 64 + #define i2c_disable() 64 65 65 66 /* enable or disable output-enable, to select output or input on the i2c bus */ 66 67 ··· 90 91 91 92 #define i2c_dir_out() \ 92 93 *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ 93 - REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1); 94 + REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1); 94 95 #define i2c_dir_in() \ 95 96 *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \ 96 97 REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0); ··· 188 189 } else { 189 190 i2c_data(I2C_DATA_LOW); 190 191 } 191 - 192 + 192 193 i2c_delay(CLOCK_LOW_TIME/2); 193 194 i2c_clk(I2C_CLOCK_HIGH); 194 195 i2c_delay(CLOCK_HIGH_TIME); ··· 415 416 *# 416 417 *#--------------------------------------------------------------------------*/ 417 418 int 418 - i2c_writereg(unsigned char theSlave, unsigned char theReg, 419 + i2c_writereg(unsigned char theSlave, unsigned char theReg, 419 420 unsigned char theValue) 420 421 { 421 422 int error, cntr = 3; ··· 467 468 * enable interrupt again 468 469 */ 469 470 local_irq_restore(flags); 470 - 471 + 471 472 } while(error && cntr--); 472 473 473 474 i2c_delay(CLOCK_LOW_TIME); ··· 503 504 * generate start condition 504 505 */ 505 506 i2c_start(); 506 - 507 + 507 508 /* 508 509 * send slave address 509 510 */ ··· 554 555 * enable interrupt again 555 556 */ 556 557 local_irq_restore(flags); 557 - 558 + 558 559 } while(error && cntr--); 559 560 560 561 spin_unlock(&i2c_lock); ··· 565 566 static int 566 567 i2c_open(struct inode *inode, struct file *filp) 567 568 { 568 - cycle_kernel_lock(); 569 569 return 0; 570 570 } 571 571 ··· 577 579 /* Main device API. ioctl's to write or read to/from i2c registers. 578 580 */ 579 581 580 - static int 581 - i2c_ioctl(struct inode *inode, struct file *file, 582 - unsigned int cmd, unsigned long arg) 582 + static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 583 583 { 584 584 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { 585 585 return -EINVAL; ··· 586 590 switch (_IOC_NR(cmd)) { 587 591 case I2C_WRITEREG: 588 592 /* write to an i2c slave */ 589 - D(printk("i2cw %d %d %d\n", 593 + D(printk(KERN_DEBUG "i2cw %d %d %d\n", 590 594 I2C_ARGSLAVE(arg), 591 595 I2C_ARGREG(arg), 592 596 I2C_ARGVALUE(arg))); ··· 598 602 { 599 603 unsigned char val; 600 604 /* read from an i2c slave */ 601 - D(printk("i2cr %d %d ", 605 + D(printk(KERN_DEBUG "i2cr %d %d ", 602 606 I2C_ARGSLAVE(arg), 603 607 I2C_ARGREG(arg))); 604 608 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 605 - D(printk("= %d\n", val)); 609 + D(printk(KERN_DEBUG "= %d\n", val)); 606 610 return val; 607 - } 611 + } 608 612 default: 609 613 return -EINVAL; 610 614 611 615 } 612 - 613 616 return 0; 614 617 } 615 618 616 619 static const struct file_operations i2c_fops = { 617 - .owner = THIS_MODULE, 618 - .ioctl = i2c_ioctl, 619 - .open = i2c_open, 620 - .release = i2c_release, 620 + .owner = THIS_MODULE, 621 + .unlocked_ioctl = i2c_ioctl, 622 + .open = i2c_open, 623 + .release = i2c_release, 621 624 }; 622 625 623 626 int __init
+1 -2
arch/cris/arch-v10/drivers/i2c.h
··· 1 - /* $Id: i2c.h,v 1.3 2004/05/28 09:26:59 starvik Exp $ */ 2 - 1 + /* i2c.h */ 3 2 int i2c_init(void); 4 3 5 4 /* High level I2C actions */
+21 -9
arch/cris/arch-v10/drivers/sync_serial.c
··· 157 157 static int sync_serial_release(struct inode *inode, struct file *file); 158 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 161 unsigned int cmd, unsigned long arg); 162 162 static ssize_t sync_serial_write(struct file *file, const char *buf, 163 163 size_t count, loff_t *ppos); ··· 244 244 #define NUMBER_OF_PORTS 2 245 245 246 246 static const struct file_operations sync_serial_fops = { 247 - .owner = THIS_MODULE, 248 - .write = sync_serial_write, 249 - .read = sync_serial_read, 250 - .poll = sync_serial_poll, 251 - .ioctl = sync_serial_ioctl, 252 - .open = sync_serial_open, 253 - .release = sync_serial_release 247 + .owner = THIS_MODULE, 248 + .write = sync_serial_write, 249 + .read = sync_serial_read, 250 + .poll = sync_serial_poll, 251 + .unlocked_ioctl = sync_serial_ioctl, 252 + .open = sync_serial_open, 253 + .release = sync_serial_release 254 254 }; 255 255 256 256 static int __init etrax_sync_serial_init(void) ··· 678 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 682 unsigned int cmd, unsigned long arg) 683 683 { 684 684 int return_val = 0; ··· 954 954 } 955 955 local_irq_restore(flags); 956 956 return return_val; 957 + } 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; 957 969 } 958 970 959 971
+1 -5
arch/cris/arch-v10/kernel/fasttimer.c
··· 467 467 468 468 static void wake_up_func(unsigned long data) 469 469 { 470 - #ifdef DECLARE_WAITQUEUE 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 470 + wait_queue_head_t *sleep_wait_p = (wait_queue_head_t *)data; 475 471 wake_up(sleep_wait_p); 476 472 } 477 473
+1 -1
arch/cris/arch-v10/kernel/head.S
··· 280 280 ;; the "rom fs" we'll possibly use in 2.4 if not JFFS (which does 281 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 284 move.d [$r0], $r1 ; cramfs assumes same endian on host/target 285 285 cmp.d CRAMFS_MAGIC, $r1; magic value in cramfs superblock 286 286 bne 2f
+2 -52
arch/cris/arch-v10/kernel/time.c
··· 61 61 62 62 unsigned long do_slow_gettimeoffset(void) 63 63 { 64 - unsigned long count, t1; 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; 64 + unsigned long count; 75 65 76 66 /* The timer interrupt comes from Etrax timer 0. In order to get 77 67 * better precision, we check the current value. It might have 78 68 * underflowed already though. 79 69 */ 80 - 81 - #ifndef CONFIG_SVINTO_SIM 82 - /* Not available in the xsim simulator. */ 83 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 71 97 - jiffies_t = jiffies; 98 - 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 72 /* Convert timer value to usec */ 120 - usec_count += ( (TIMER0_DIV - count) * (1000000/HZ)/TIMER0_DIV ) + 121 - (( (presc_count) * (1000000000/PRESCALE_FREQ))/1000); 122 - 123 - return usec_count; 73 + return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV; 124 74 } 125 75 126 76 /* Excerpt from the Etrax100 HSDD about the built-in watchdog:
+20 -8
arch/cris/arch-v32/drivers/cryptocop.c
··· 11 11 #include <linux/string.h> 12 12 #include <linux/fs.h> 13 13 #include <linux/mm.h> 14 - #include <linux/smp_lock.h> 15 14 #include <linux/spinlock.h> 16 15 #include <linux/stddef.h> 17 16 ··· 216 217 217 218 static int cryptocop_release(struct inode *, struct file *); 218 219 219 - static int cryptocop_ioctl(struct inode *inode, struct file *file, 220 + static long cryptocop_ioctl(struct file *file, 220 221 unsigned int cmd, unsigned long arg); 221 222 222 223 static void cryptocop_start_job(void); ··· 278 279 279 280 280 281 const struct file_operations cryptocop_fops = { 281 - .owner = THIS_MODULE, 282 - .open = cryptocop_open, 283 - .release = cryptocop_release, 284 - .ioctl = cryptocop_ioctl 282 + .owner = THIS_MODULE, 283 + .open = cryptocop_open, 284 + .release = cryptocop_release, 285 + .unlocked_ioctl = cryptocop_ioctl 285 286 }; 286 287 287 288 ··· 2306 2307 { 2307 2308 int p = iminor(inode); 2308 2309 2309 - cycle_kernel_lock(); 2310 2310 if (p != CRYPTOCOP_MINOR) return -EINVAL; 2311 2311 2312 2312 filp->private_data = NULL; ··· 3100 3102 return 0; 3101 3103 } 3102 3104 3103 - static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) 3105 + static long cryptocop_ioctl_unlocked(struct inode *inode, 3106 + struct file *filp, unsigned int cmd, unsigned long arg) 3104 3107 { 3105 3108 int err = 0; 3106 3109 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) { ··· 3131 3132 return -ENOTTY; 3132 3133 } 3133 3134 return 0; 3135 + } 3136 + 3137 + static long 3138 + cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 3139 + { 3140 + struct inode *inode = file->f_path.dentry->d_inode; 3141 + long ret; 3142 + 3143 + lock_kernel(); 3144 + ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg); 3145 + unlock_kernel(); 3146 + 3147 + return ret; 3134 3148 } 3135 3149 3136 3150
+6 -6
arch/cris/arch-v32/drivers/i2c.c
··· 32 32 #include <linux/fs.h> 33 33 #include <linux/string.h> 34 34 #include <linux/init.h> 35 - #include <linux/smp_lock.h> 35 + #include <linux/mutex.h> 36 36 37 37 #include <asm/etraxi2c.h> 38 38 ··· 47 47 #define D(x) 48 48 49 49 #define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */ 50 + static DEFINE_MUTEX(i2c_mutex); 50 51 static const char i2c_name[] = "i2c"; 51 52 52 53 #define CLOCK_LOW_TIME 8 ··· 637 636 static int 638 637 i2c_open(struct inode *inode, struct file *filp) 639 638 { 640 - cycle_kernel_lock(); 641 639 return 0; 642 640 } 643 641 ··· 665 665 I2C_ARGREG(arg), 666 666 I2C_ARGVALUE(arg))); 667 667 668 - lock_kernel(); 668 + mutex_lock(&i2c_mutex); 669 669 ret = i2c_writereg(I2C_ARGSLAVE(arg), 670 670 I2C_ARGREG(arg), 671 671 I2C_ARGVALUE(arg)); 672 - unlock_kernel(); 672 + mutex_unlock(&i2c_mutex); 673 673 return ret; 674 674 675 675 case I2C_READREG: ··· 679 679 D(printk("i2cr %d %d ", 680 680 I2C_ARGSLAVE(arg), 681 681 I2C_ARGREG(arg))); 682 - lock_kernel(); 682 + mutex_lock(&i2c_mutex); 683 683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 684 - unlock_kernel(); 684 + mutex_unlock(&i2c_mutex); 685 685 D(printk("= %d\n", val)); 686 686 return val; 687 687 }
+19 -9
arch/cris/arch-v32/drivers/mach-a3/gpio.c
··· 72 72 static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 73 73 unsigned long arg); 74 74 #endif 75 - static int gpio_ioctl(struct inode *inode, struct file *file, 76 - unsigned int cmd, unsigned long arg); 75 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 77 76 static ssize_t gpio_write(struct file *file, const char __user *buf, 78 77 size_t count, loff_t *off); 79 78 static int gpio_open(struct inode *inode, struct file *filp); ··· 520 521 return dir_shadow; 521 522 } /* setget_output */ 522 523 523 - static int gpio_ioctl(struct inode *inode, struct file *file, 524 + static long gpio_ioctl_unlocked(struct file *file, 524 525 unsigned int cmd, unsigned long arg) 525 526 { 526 527 unsigned long flags; ··· 661 662 } /* switch */ 662 663 663 664 return 0; 665 + } 666 + 667 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 668 + { 669 + long ret; 670 + 671 + lock_kernel(); 672 + ret = gpio_ioctl_unlocked(file, cmd, arg); 673 + unlock_kernel(); 674 + 675 + return ret; 664 676 } 665 677 666 678 #ifdef CONFIG_ETRAX_VIRTUAL_GPIO ··· 887 877 } 888 878 889 879 static const struct file_operations gpio_fops = { 890 - .owner = THIS_MODULE, 891 - .poll = gpio_poll, 892 - .ioctl = gpio_ioctl, 893 - .write = gpio_write, 894 - .open = gpio_open, 895 - .release = gpio_release, 880 + .owner = THIS_MODULE, 881 + .poll = gpio_poll, 882 + .unlocked_ioctl = gpio_ioctl, 883 + .write = gpio_write, 884 + .open = gpio_open, 885 + .release = gpio_release, 896 886 }; 897 887 898 888 #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
+25 -17
arch/cris/arch-v32/drivers/mach-fs/gpio.c
··· 74 74 static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 75 75 unsigned long arg); 76 76 #endif 77 - static int gpio_ioctl(struct inode *inode, struct file *file, 78 - unsigned int cmd, unsigned long arg); 77 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 79 78 static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 80 79 loff_t *off); 81 80 static int gpio_open(struct inode *inode, struct file *filp); ··· 184 185 static unsigned int gpio_poll(struct file *file, struct poll_table_struct *wait) 185 186 { 186 187 unsigned int mask = 0; 187 - struct gpio_private *priv = (struct gpio_private *)file->private_data; 188 + struct gpio_private *priv = file->private_data; 188 189 unsigned long data; 189 190 poll_wait(file, &priv->alarm_wq, wait); 190 191 if (priv->minor == GPIO_MINOR_A) { ··· 352 353 static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 353 354 loff_t *off) 354 355 { 355 - struct gpio_private *priv = (struct gpio_private *)file->private_data; 356 + struct gpio_private *priv = file->private_data; 356 357 unsigned char data, clk_mask, data_mask, write_msb; 357 358 unsigned long flags; 358 359 unsigned long shadow; ··· 467 468 468 469 spin_lock_irq(&alarm_lock); 469 470 p = alarmlist; 470 - todel = (struct gpio_private *)filp->private_data; 471 + todel = filp->private_data; 471 472 472 473 if (p == todel) { 473 474 alarmlist = todel->next; ··· 556 557 return dir_shadow; 557 558 } /* setget_output */ 558 559 559 - static int 560 - gpio_leds_ioctl(unsigned int cmd, unsigned long arg); 560 + static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg); 561 561 562 562 static int 563 - gpio_ioctl(struct inode *inode, struct file *file, 564 - unsigned int cmd, unsigned long arg) 563 + gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg) 565 564 { 566 565 unsigned long flags; 567 566 unsigned long val; 568 567 unsigned long shadow; 569 - struct gpio_private *priv = (struct gpio_private *)file->private_data; 568 + struct gpio_private *priv = file->private_data; 570 569 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) 571 570 return -EINVAL; 572 571 ··· 704 707 return 0; 705 708 } 706 709 710 + static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 711 + { 712 + long ret; 713 + 714 + lock_kernel(); 715 + ret = gpio_ioctl_unlocked(file, cmd, arg); 716 + unlock_kernel(); 717 + 718 + return ret; 719 + } 720 + 707 721 #ifdef CONFIG_ETRAX_VIRTUAL_GPIO 708 722 static int 709 723 virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ··· 722 714 unsigned long flags; 723 715 unsigned short val; 724 716 unsigned short shadow; 725 - struct gpio_private *priv = (struct gpio_private *)file->private_data; 717 + struct gpio_private *priv = file->private_data; 726 718 727 719 switch (_IOC_NR(cmd)) { 728 720 case IO_SETBITS: ··· 864 856 } 865 857 866 858 static const struct file_operations gpio_fops = { 867 - .owner = THIS_MODULE, 868 - .poll = gpio_poll, 869 - .ioctl = gpio_ioctl, 870 - .write = gpio_write, 871 - .open = gpio_open, 872 - .release = gpio_release, 859 + .owner = THIS_MODULE, 860 + .poll = gpio_poll, 861 + .unlocked_ioctl = gpio_ioctl, 862 + .write = gpio_write, 863 + .open = gpio_open, 864 + .release = gpio_release, 873 865 }; 874 866 875 867 #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
+21 -9
arch/cris/arch-v32/drivers/sync_serial.c
··· 153 153 static int sync_serial_release(struct inode*, struct file*); 154 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 157 unsigned int cmd, unsigned long arg); 158 158 static ssize_t sync_serial_write(struct file * file, const char * buf, 159 159 size_t count, loff_t *ppos); ··· 241 241 #define NBR_PORTS ARRAY_SIZE(ports) 242 242 243 243 static const struct file_operations sync_serial_fops = { 244 - .owner = THIS_MODULE, 245 - .write = sync_serial_write, 246 - .read = sync_serial_read, 247 - .poll = sync_serial_poll, 248 - .ioctl = sync_serial_ioctl, 249 - .open = sync_serial_open, 250 - .release = sync_serial_release 244 + .owner = THIS_MODULE, 245 + .write = sync_serial_write, 246 + .read = sync_serial_read, 247 + .poll = sync_serial_poll, 248 + .unlocked_ioctl = sync_serial_ioctl, 249 + .open = sync_serial_open, 250 + .release = sync_serial_release 251 251 }; 252 252 253 253 static int __init etrax_sync_serial_init(void) ··· 650 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 654 unsigned int cmd, unsigned long arg) 655 655 { 656 656 int return_val = 0; ··· 959 959 960 960 spin_unlock_irq(&port->lock); 961 961 return return_val; 962 + } 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; 962 974 } 963 975 964 976 /* NOTE: sync_serial_write does not support concurrency */
+5
arch/cris/arch-v32/kernel/cacheflush.S
··· 1 1 .global cris_flush_cache_range 2 + .type cris_flush_cache_range, @function 2 3 cris_flush_cache_range: 3 4 move.d 1024, $r12 4 5 cmp.d $r11, $r12 ··· 81 80 addq 32, $r10 82 81 ba cris_flush_cache_range 83 82 sub.d $r12, $r11 83 + .size cris_flush_cache_range, . - cris_flush_cache_range 84 84 85 85 .global cris_flush_cache 86 + .type cris_flush_cache, @function 86 87 cris_flush_cache: 87 88 moveq 0, $r10 88 89 cris_flush_line: ··· 95 92 fidxd [$r10] 96 93 ret 97 94 nop 95 + .size cris_flush_cache, . - cris_flush_cache 96 +
+50 -30
arch/cris/arch-v32/kernel/entry.S
··· 76 76 77 77 ; Called at exit from fork. schedule_tail must be called to drop 78 78 ; spinlock if CONFIG_PREEMPT. 79 + .type ret_from_fork,@function 79 80 ret_from_fork: 80 81 jsr schedule_tail 81 82 nop 82 83 ba ret_from_sys_call 83 84 nop 85 + .size ret_from_fork, . - ret_from_fork 84 86 87 + .type ret_from_intr,@function 85 88 ret_from_intr: 86 89 ;; Check for resched if preemptive kernel, or if we're going back to 87 90 ;; user-mode. This test matches the user_regs(regs) macro. Don't simply ··· 94 91 move.d [$acr], $r0 95 92 btstq 16, $r0 ; User-mode flag. 96 93 bpl _resume_kernel 94 + .size ret_from_intr, . - ret_from_intr + 2 ; +2 includes the dslot. 97 95 98 96 ; Note that di below is in delay slot. 99 - 97 + .type _resume_userspace,@function 100 98 _resume_userspace: 101 99 di ; So need_resched and sigpending don't change. 102 100 ··· 111 107 nop 112 108 ba _Rexit 113 109 nop 110 + .size _resume_userspace, . - _resume_userspace 114 111 115 112 ;; The system_call is called by a BREAK instruction, which looks pretty 116 113 ;; much like any other exception. ··· 127 122 ;; non-used instructions. Only the non-common cases cause the outlined code 128 123 ;; to run.. 129 124 125 + .type system_call,@function 130 126 system_call: 131 127 ;; Stack-frame similar to the irq heads, which is reversed in 132 128 ;; ret_from_sys_call. 133 - subq 12, $sp ; Skip EXS, EDA. 134 - move $erp, [$sp] 135 - subq 4, $sp 136 - move $srp, [$sp] 137 - subq 4, $sp 138 - move $ccs, [$sp] 139 - subq 4, $sp 140 - ei ; Allow IRQs while handling system call 141 - move $spc, [$sp] 142 - subq 4, $sp 143 - move $mof, [$sp] 144 - subq 4, $sp 145 - move $srs, [$sp] 146 - subq 4, $sp 147 - move.d $acr, [$sp] 148 - subq 14*4, $sp ; Make room for R0-R13. 149 - movem $r13, [$sp] ; Push R0-R13 150 - subq 4, $sp 151 - move.d $r10, [$sp] ; Push orig_r10. 152 129 153 - ; Set S-bit when kernel debugging to keep hardware breakpoints active. 130 + sub.d 92, $sp ; Skip EXS and EDA. 131 + movem $r13, [$sp] 132 + move.d $sp, $r8 133 + addq 14*4, $r8 134 + move.d $acr, $r0 135 + move $srs, $r1 136 + move $mof, $r2 137 + move $spc, $r3 138 + move $ccs, $r4 139 + move $srp, $r5 140 + move $erp, $r6 141 + subq 4, $sp 142 + movem $r6, [$r8] 143 + ei ; Enable interrupts while processing syscalls. 144 + move.d $r10, [$sp] 145 + 146 + ; Set S-bit when kernel debugging to keep hardware breakpoints active. 154 147 #ifdef CONFIG_ETRAX_KGDB 155 148 move $ccs, $r0 156 149 or.d (1<<9), $r0 ··· 220 217 and.d _TIF_ALLWORK_MASK, $r1 221 218 bne _syscall_exit_work 222 219 nop 220 + .size system_call, . - system_call 223 221 222 + .type _Rexit,@function 224 223 _Rexit: 225 224 ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h 226 225 ;; and ptregs.h. ··· 239 234 addq 8, $sp ; Skip EXS, EDA. 240 235 jump $erp 241 236 rfe ; Restore condition code stack in delay-slot. 237 + .size _Rexit, . - _Rexit 242 238 243 239 ;; We get here after doing a syscall if extra work might need to be done 244 240 ;; perform syscall exit tracing if needed. 245 241 242 + .type _syscall_exit_work,@function 246 243 _syscall_exit_work: 247 244 ;; R0 contains current at this point and irq's are disabled. 248 245 ··· 260 253 move.d $r1, $r9 261 254 ba _resume_userspace 262 255 nop 256 + .size _syscall_exit_work, . - _syscall_exit_work 263 257 258 + .type _work_pending,@function 264 259 _work_pending: 265 260 addoq +TI_flags, $r0, $acr 266 261 move.d [$acr], $r10 267 262 btstq TIF_NEED_RESCHED, $r10 ; Need resched? 268 263 bpl _work_notifysig ; No, must be signal/notify. 269 264 nop 265 + .size _work_pending, . - _work_pending 270 266 267 + .type _work_resched,@function 271 268 _work_resched: 272 269 move.d $r9, $r1 ; Preserve R9. 273 270 jsr schedule ··· 287 276 btstq TIF_NEED_RESCHED, $r1 288 277 bmi _work_resched ; current->work.need_resched. 289 278 nop 279 + .size _work_resched, . - _work_resched 290 280 281 + .type _work_notifysig,@function 291 282 _work_notifysig: 292 283 ;; Deal with pending signals and notify-resume requests. 293 284 ··· 301 288 302 289 ba _Rexit 303 290 nop 291 + .size _work_notifysig, . - _work_notifysig 304 292 305 293 ;; We get here as a sidetrack when we've entered a syscall with the 306 294 ;; trace-bit set. We need to call do_syscall_trace and then continue ··· 343 329 ;; 344 330 ;; Returns old current in R10. 345 331 332 + .type resume,@function 346 333 resume: 347 - subq 4, $sp 348 - move $srp, [$sp] ; Keep old/new PC on the stack. 334 + subq 4, $sp ; Make space for srp. 335 + 349 336 add.d $r12, $r10 ; R10 = current tasks tss. 350 337 addoq +THREAD_ccs, $r10, $acr 338 + move $srp, [$sp] ; Keep old/new PC on the stack. 351 339 move $ccs, [$acr] ; Save IRQ enable state. 352 340 di 353 341 354 342 addoq +THREAD_usp, $r10, $acr 343 + subq 10*4, $sp ; Make room for R9. 355 344 move $usp, [$acr] ; Save user-mode stackpointer. 356 345 357 346 ;; See copy_thread for the reason why register R9 is saved. 358 - subq 10*4, $sp 359 347 movem $r9, [$sp] ; Save non-scratch registers and R9. 360 348 361 349 addoq +THREAD_ksp, $r10, $acr 350 + move.d $sp, $r10 ; Return last running task in R10. 362 351 move.d $sp, [$acr] ; Save kernel SP for old task. 363 352 364 - move.d $sp, $r10 ; Return last running task in R10. 365 353 and.d -8192, $r10 ; Get thread_info from stackpointer. 366 354 addoq +TI_task, $r10, $acr 367 - move.d [$acr], $r10 ; Get task. 368 355 add.d $r12, $r11 ; Find the new tasks tss. 356 + move.d [$acr], $r10 ; Get task. 369 357 addoq +THREAD_ksp, $r11, $acr 370 358 move.d [$acr], $sp ; Switch to new stackframe. 359 + addoq +THREAD_usp, $r11, $acr 371 360 movem [$sp+], $r9 ; Restore non-scratch registers and R9. 372 361 373 - addoq +THREAD_usp, $r11, $acr 374 362 move [$acr], $usp ; Restore user-mode stackpointer. 375 363 376 364 addoq +THREAD_ccs, $r11, $acr 365 + move.d [$sp+], $r11 366 + jump $r11 ; Restore PC. 377 367 move [$acr], $ccs ; Restore IRQ enable status. 378 - move.d [$sp+], $acr 379 - jump $acr ; Restore PC. 380 - nop 368 + .size resume, . - resume 381 369 382 370 nmi_interrupt: 383 371 ··· 442 426 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The 443 427 ;; hardware will call the unserved interrupts after the handler 444 428 ;; finishes. 429 + .type multiple_interrupt, @function 445 430 multiple_interrupt: 446 431 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h! 447 432 subq 12, $sp ; Skip EXS, EDA. ··· 475 458 move.d $sp, $r10 476 459 jump ret_from_intr 477 460 nop 461 + .size multiple_interrupt, . - multiple_interrupt 478 462 479 463 do_sigtrap: 480 464 ;; Sigtraps the process that executed the BREAK instruction. Creates a ··· 532 514 move.d [$sp+], $r0 ; Restore R0 in delay slot. 533 515 534 516 .global kernel_execve 517 + .type kernel_execve,@function 535 518 kernel_execve: 536 519 move.d __NR_execve, $r9 537 520 break 13 538 521 ret 539 522 nop 523 + .size kernel_execve, . - kernel_execve 540 524 541 525 .data 542 526
+41 -3
arch/cris/arch-v32/kernel/head.S
··· 69 69 ;; 70 70 ;; Note; 3 cycles is needed for a bank-select to take effect. Further; 71 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 79 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ 74 80 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ 75 81 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0 ··· 94 88 95 89 ;; Enable certain page protections and setup linear mapping 96 90 ;; for f,e,c,b,4,0. 97 - #ifndef CONFIG_ETRAX_VCS_SIM 91 + 92 + ;; ARTPEC-3: 93 + ;; c,d used for linear kernel mapping, up to 512 MB 94 + ;; e used for vmalloc 95 + ;; f unused, but page mapped to get page faults 96 + 97 + ;; ETRAX FS: 98 + ;; c used for linear kernel mapping, up to 256 MB 99 + ;; d used for vmalloc 100 + ;; e,f used for memory-mapped NOR flash 101 + 102 + #ifdef CONFIG_CRIS_MACH_ARTPEC3 103 + move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ 104 + | REG_STATE(mmu, rw_mm_cfg, acc, on) \ 105 + | REG_STATE(mmu, rw_mm_cfg, ex, on) \ 106 + | REG_STATE(mmu, rw_mm_cfg, inv, on) \ 107 + | REG_STATE(mmu, rw_mm_cfg, seg_f, page) \ 108 + | REG_STATE(mmu, rw_mm_cfg, seg_e, page) \ 109 + | REG_STATE(mmu, rw_mm_cfg, seg_d, linear) \ 110 + | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \ 111 + | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \ 112 + | REG_STATE(mmu, rw_mm_cfg, seg_a, page) \ 113 + | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \ 114 + | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \ 115 + | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \ 116 + | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \ 117 + | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \ 118 + | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \ 119 + | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \ 120 + | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \ 121 + | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \ 122 + | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2 123 + #elif !defined(CONFIG_ETRAX_VCS_SIM) 98 124 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ 99 125 | REG_STATE(mmu, rw_mm_cfg, acc, on) \ 100 126 | REG_STATE(mmu, rw_mm_cfg, ex, on) \ ··· 367 329 ;; For jffs2, a jhead is prepended which contains with magic and length. 368 330 ;; The jhead is not part of the jffs2 partition however. 369 331 #ifndef CONFIG_ETRAXFS_SIM 370 - move.d __vmlinux_end, $r0 332 + move.d __bss_start, $r0 371 333 #else 372 334 move.d __end, $r0 373 335 #endif
+22 -25
arch/cris/arch-v32/kernel/irq.c
··· 97 97 /* 98 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 103 BUILD_IRQ(0x31) 104 + #endif 101 105 BUILD_IRQ(0x32) 102 106 BUILD_IRQ(0x33) 103 107 BUILD_IRQ(0x34) ··· 127 123 BUILD_IRQ(0x48) 128 124 BUILD_IRQ(0x49) 129 125 BUILD_IRQ(0x4a) 126 + #ifdef CONFIG_ETRAXFS 127 + BUILD_TIMER_IRQ(0x4b, 0) 128 + #else 130 129 BUILD_IRQ(0x4b) 130 + #endif 131 131 BUILD_IRQ(0x4c) 132 132 BUILD_IRQ(0x4d) 133 133 BUILD_IRQ(0x4e) ··· 207 199 unsigned long flags; 208 200 209 201 spin_lock_irqsave(&irq_lock, flags); 210 - if (irq - FIRST_IRQ < 32) 202 + /* Remember, 1 let thru, 0 block. */ 203 + if (irq - FIRST_IRQ < 32) { 211 204 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 212 205 rw_mask, 0); 213 - else 214 - intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 215 - rw_mask, 1); 216 - 217 - /* Remember; 1 let thru, 0 block. */ 218 - if (irq - FIRST_IRQ < 32) 219 206 intr_mask &= ~(1 << (irq - FIRST_IRQ)); 220 - else 221 - intr_mask &= ~(1 << (irq - FIRST_IRQ - 32)); 222 - 223 - if (irq - FIRST_IRQ < 32) 224 207 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 225 208 0, intr_mask); 226 - else 209 + } else { 210 + intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 211 + rw_mask, 1); 212 + intr_mask &= ~(1 << (irq - FIRST_IRQ - 32)); 227 213 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 228 214 1, intr_mask); 215 + } 229 216 spin_unlock_irqrestore(&irq_lock, flags); 230 217 } 231 218 ··· 231 228 unsigned long flags; 232 229 233 230 spin_lock_irqsave(&irq_lock, flags); 234 - if (irq - FIRST_IRQ < 32) 231 + /* Remember, 1 let thru, 0 block. */ 232 + if (irq - FIRST_IRQ < 32) { 235 233 intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 236 234 rw_mask, 0); 237 - else 238 - intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 239 - rw_mask, 1); 240 - 241 - /* Remember; 1 let thru, 0 block. */ 242 - if (irq - FIRST_IRQ < 32) 243 235 intr_mask |= (1 << (irq - FIRST_IRQ)); 244 - else 245 - intr_mask |= (1 << (irq - FIRST_IRQ - 32)); 246 - 247 - if (irq - FIRST_IRQ < 32) 248 236 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 249 237 0, intr_mask); 250 - else 238 + } else { 239 + intr_mask = REG_RD_INT_VECT(intr_vect, irq_regs[cpu], 240 + rw_mask, 1); 241 + intr_mask |= (1 << (irq - FIRST_IRQ - 32)); 251 242 REG_WR_INT_VECT(intr_vect, irq_regs[cpu], rw_mask, 252 243 1, intr_mask); 253 - 244 + } 254 245 spin_unlock_irqrestore(&irq_lock, flags); 255 246 } 256 247
+8 -8
arch/cris/arch-v32/kernel/kgdb.c
··· 174 174 #include <asm/ptrace.h> 175 175 176 176 #include <asm/irq.h> 177 - #include <arch/hwregs/reg_map.h> 178 - #include <arch/hwregs/reg_rdwr.h> 179 - #include <arch/hwregs/intr_vect_defs.h> 180 - #include <arch/hwregs/ser_defs.h> 177 + #include <hwregs/reg_map.h> 178 + #include <hwregs/reg_rdwr.h> 179 + #include <hwregs/intr_vect_defs.h> 180 + #include <hwregs/ser_defs.h> 181 181 182 182 /* From entry.S. */ 183 183 extern void gdb_handle_exception(void); ··· 988 988 } 989 989 /* Only send PC, frame and stack pointer. */ 990 990 read_register(PC, &reg_cont); 991 - ptr = pack_hex_byte(PC); 991 + ptr = pack_hex_byte(ptr, PC); 992 992 *ptr++ = ':'; 993 993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]); 994 994 *ptr++ = ';'; 995 995 996 996 read_register(R8, &reg_cont); 997 - ptr = pack_hex_byte(R8); 997 + ptr = pack_hex_byte(ptr, R8); 998 998 *ptr++ = ':'; 999 999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]); 1000 1000 *ptr++ = ';'; 1001 1001 1002 1002 read_register(SP, &reg_cont); 1003 - ptr = pack_hex_byte(SP); 1003 + ptr = pack_hex_byte(ptr, SP); 1004 1004 *ptr++ = ':'; 1005 1005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]); 1006 1006 *ptr++ = ';'; 1007 1007 1008 1008 /* Send ERP as well; this will save us an entire register fetch in some cases. */ 1009 1009 read_register(ERP, &reg_cont); 1010 - ptr = pack_hex_byte(ERP); 1010 + ptr = pack_hex_byte(ptr, ERP); 1011 1011 *ptr++ = ':'; 1012 1012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]); 1013 1013 *ptr++ = ';';
+1 -1
arch/cris/arch-v32/kernel/kgdb_asm.S
··· 5 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 10 ;; Exported functions. 11 11 .globl kgdb_handle_exception
-229
arch/cris/arch-v32/kernel/pinmux.c
··· 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);
+66 -8
arch/cris/arch-v32/kernel/setup.c
··· 9 9 #include <linux/delay.h> 10 10 #include <linux/param.h> 11 11 12 + #include <linux/i2c.h> 13 + #include <linux/platform_device.h> 14 + 12 15 #ifdef CONFIG_PROC_FS 13 16 14 17 #define HAS_FPU 0x0001 ··· 46 43 47 44 {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB 48 45 | HAS_MMU}, 49 - 46 + #ifdef CONFIG_ETRAXFS 50 47 {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU}, 51 - 48 + #else 49 + {"ARTPEC-3", 32, 32, HAS_ETHERNET100 | HAS_MMU}, 50 + #endif 52 51 {"Unknown", 0, 0, 0} 53 52 }; 54 53 55 - int 56 - show_cpuinfo(struct seq_file *m, void *v) 54 + int show_cpuinfo(struct seq_file *m, void *v) 57 55 { 58 56 int i; 59 57 int cpu = (int)v - 1; ··· 111 107 112 108 #endif /* CONFIG_PROC_FS */ 113 109 114 - void 115 - show_etrax_copyright(void) 110 + void show_etrax_copyright(void) 116 111 { 117 - printk(KERN_INFO 118 - "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n"); 112 + #ifdef CONFIG_ETRAXFS 113 + printk(KERN_INFO "Linux/CRISv32 port on ETRAX FS " 114 + "(C) 2003, 2004 Axis Communications AB\n"); 115 + #else 116 + printk(KERN_INFO "Linux/CRISv32 port on ARTPEC-3 " 117 + "(C) 2003-2009 Axis Communications AB\n"); 118 + #endif 119 119 } 120 + 121 + static struct i2c_board_info __initdata i2c_info[] = { 122 + {I2C_BOARD_INFO("camblock", 0x43)}, 123 + {I2C_BOARD_INFO("tmp100", 0x48)}, 124 + {I2C_BOARD_INFO("tmp100", 0x4A)}, 125 + {I2C_BOARD_INFO("tmp100", 0x4C)}, 126 + {I2C_BOARD_INFO("tmp100", 0x4D)}, 127 + {I2C_BOARD_INFO("tmp100", 0x4E)}, 128 + #ifdef CONFIG_RTC_DRV_PCF8563 129 + {I2C_BOARD_INFO("pcf8563", 0x51)}, 130 + #endif 131 + #ifdef CONFIG_ETRAX_VIRTUAL_GPIO 132 + {I2C_BOARD_INFO("vgpio", 0x20)}, 133 + {I2C_BOARD_INFO("vgpio", 0x21)}, 134 + #endif 135 + {I2C_BOARD_INFO("pca9536", 0x41)}, 136 + {I2C_BOARD_INFO("fnp300", 0x40)}, 137 + {I2C_BOARD_INFO("fnp300", 0x42)}, 138 + {I2C_BOARD_INFO("adc101", 0x54)}, 139 + }; 140 + 141 + static struct i2c_board_info __initdata i2c_info2[] = { 142 + {I2C_BOARD_INFO("camblock", 0x43)}, 143 + {I2C_BOARD_INFO("tmp100", 0x48)}, 144 + {I2C_BOARD_INFO("tmp100", 0x4A)}, 145 + {I2C_BOARD_INFO("tmp100", 0x4C)}, 146 + {I2C_BOARD_INFO("tmp100", 0x4D)}, 147 + {I2C_BOARD_INFO("tmp100", 0x4E)}, 148 + #ifdef CONFIG_ETRAX_VIRTUAL_GPIO 149 + {I2C_BOARD_INFO("vgpio", 0x20)}, 150 + {I2C_BOARD_INFO("vgpio", 0x21)}, 151 + #endif 152 + {I2C_BOARD_INFO("pca9536", 0x41)}, 153 + {I2C_BOARD_INFO("fnp300", 0x40)}, 154 + {I2C_BOARD_INFO("fnp300", 0x42)}, 155 + {I2C_BOARD_INFO("adc101", 0x54)}, 156 + }; 157 + 158 + static struct i2c_board_info __initdata i2c_info3[] = { 159 + {I2C_BOARD_INFO("adc101", 0x54)}, 160 + }; 161 + 162 + static int __init etrax_init(void) 163 + { 164 + i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info)); 165 + i2c_register_board_info(1, i2c_info2, ARRAY_SIZE(i2c_info2)); 166 + i2c_register_board_info(2, i2c_info3, ARRAY_SIZE(i2c_info3)); 167 + return 0; 168 + } 169 + arch_initcall(etrax_init);
+1 -1
arch/cris/arch-v32/kernel/signal.c
··· 587 587 } 588 588 589 589 if (regs->r10 == -ERESTART_RESTARTBLOCK){ 590 - regs->r10 = __NR_restart_syscall; 590 + regs->r9 = __NR_restart_syscall; 591 591 regs->erp -= 2; 592 592 } 593 593 }
+34 -51
arch/cris/arch-v32/kernel/time.c
··· 1 1 /* 2 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 8 #include <linux/timex.h> 9 9 #include <linux/time.h> 10 - #include <linux/jiffies.h> 10 + #include <linux/clocksource.h> 11 11 #include <linux/interrupt.h> 12 12 #include <linux/swap.h> 13 13 #include <linux/sched.h> ··· 35 35 #define ETRAX_WD_HZ 763 /* watchdog counts at 763 Hz */ 36 36 /* Number of 763 counts before watchdog bites */ 37 37 #define ETRAX_WD_CNT ((2*ETRAX_WD_HZ)/HZ + 1) 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 + 38 62 39 63 unsigned long timer_regs[NR_CPUS] = 40 64 { ··· 91 67 return ns; 92 68 } 93 69 94 - unsigned long do_slow_gettimeoffset(void) 95 - { 96 - unsigned long count; 97 - unsigned long usec_count = 0; 98 - 99 - /* For the first call after boot */ 100 - static unsigned long count_p = TIMER0_DIV; 101 - static unsigned long jiffies_p = 0; 102 - 103 - /* Cache volatile jiffies temporarily; we have IRQs turned off. */ 104 - unsigned long jiffies_t; 105 - 106 - /* The timer interrupt comes from Etrax timer 0. In order to get 107 - * better precision, we check the current value. It might have 108 - * underflowed already though. */ 109 - count = REG_RD(timer, regi_timer0, r_tmr0_data); 110 - jiffies_t = jiffies; 111 - 112 - /* Avoiding timer inconsistencies (they are rare, but they happen) 113 - * There is one problem that must be avoided here: 114 - * 1. the timer counter underflows 115 - */ 116 - if( jiffies_t == jiffies_p ) { 117 - if( count > count_p ) { 118 - /* Timer wrapped, use new count and prescale. 119 - * Increase the time corresponding to one jiffy. 120 - */ 121 - usec_count = 1000000/HZ; 122 - } 123 - } else 124 - jiffies_p = jiffies_t; 125 - count_p = count; 126 - /* Convert timer value to usec */ 127 - /* 100 MHz timer, divide by 100 to get usec */ 128 - usec_count += (TIMER0_DIV - count) / 100; 129 - return usec_count; 130 - } 131 70 132 71 /* From timer MDS describing the hardware watchdog: 133 72 * 4.3.1 Watchdog Operation ··· 113 126 * is used though, so set this really low. */ 114 127 #define WATCHDOG_MIN_FREE_PAGES 8 115 128 116 - void 117 - reset_watchdog(void) 129 + void reset_watchdog(void) 118 130 { 119 131 #if defined(CONFIG_ETRAX_WATCHDOG) 120 132 reg_timer_rw_wd_ctrl wd_ctrl = { 0 }; ··· 133 147 134 148 /* stop the watchdog - we still need the correct key */ 135 149 136 - void 137 - stop_watchdog(void) 150 + void stop_watchdog(void) 138 151 { 139 152 #if defined(CONFIG_ETRAX_WATCHDOG) 140 153 reg_timer_rw_wd_ctrl wd_ctrl = { 0 }; ··· 147 162 148 163 extern void show_registers(struct pt_regs *regs); 149 164 150 - void 151 - handle_watchdog_bite(struct pt_regs* regs) 165 + void handle_watchdog_bite(struct pt_regs *regs) 152 166 { 153 167 #if defined(CONFIG_ETRAX_WATCHDOG) 154 168 extern int cause_of_death; ··· 187 203 */ 188 204 extern void cris_do_profile(struct pt_regs *regs); 189 205 190 - static inline irqreturn_t 191 - timer_interrupt(int irq, void *dev_id) 206 + static inline irqreturn_t timer_interrupt(int irq, void *dev_id) 192 207 { 193 208 struct pt_regs *regs = get_irq_regs(); 194 209 int cpu = smp_processor_id(); ··· 216 233 return IRQ_HANDLED; 217 234 218 235 /* Call the real timer interrupt handler */ 236 + write_seqlock(&xtime_lock); 219 237 do_timer(1); 238 + write_sequnlock(&xtime_lock); 220 239 return IRQ_HANDLED; 221 240 } 222 241 ··· 231 246 .name = "timer" 232 247 }; 233 248 234 - void __init 235 - cris_timer_init(void) 249 + void __init cris_timer_init(void) 236 250 { 237 251 int cpu = smp_processor_id(); 238 252 reg_timer_rw_tmr0_ctrl tmr0_ctrl = { 0 }; ··· 257 273 REG_WR(timer, timer_regs[cpu], rw_intr_mask, timer_intr_mask); 258 274 } 259 275 260 - void __init 261 - time_init(void) 276 + void __init time_init(void) 262 277 { 263 278 reg_intr_vect_rw_mask intr_mask; 264 279
+2 -4
arch/cris/arch-v32/kernel/traps.c
··· 9 9 #include <hwregs/intr_vect_defs.h> 10 10 #include <asm/irq.h> 11 11 12 - void 13 - show_registers(struct pt_regs *regs) 12 + void show_registers(struct pt_regs *regs) 14 13 { 15 14 /* 16 15 * It's possible to use either the USP register or current->thread.usp. ··· 100 101 } 101 102 } 102 103 103 - void 104 - arch_enable_nmi(void) 104 + void arch_enable_nmi(void) 105 105 { 106 106 unsigned long flags; 107 107
+3
arch/cris/arch-v32/lib/checksum.S
··· 6 6 */ 7 7 8 8 .globl csum_partial 9 + .type csum_partial,@function 9 10 csum_partial: 10 11 11 12 ;; r10 - src ··· 84 83 addu.b [$r10],$r12 85 84 ret 86 85 move.d $r12,$r10 86 + 87 + .size csum_partial, .-csum_partial
+3
arch/cris/arch-v32/lib/checksumcopy.S
··· 9 9 */ 10 10 11 11 .globl csum_partial_copy_nocheck 12 + .type csum_partial_copy_nocheck,@function 12 13 csum_partial_copy_nocheck: 13 14 14 15 ;; r10 - src ··· 90 89 move.b $r9,[$r11] 91 90 ret 92 91 move.d $r13,$r10 92 + 93 + .size csum_partial_copy_nocheck, . - csum_partial_copy_nocheck
+7
arch/cris/arch-v32/lib/spinlock.S
··· 6 6 7 7 8 8 .global cris_spin_lock 9 + .type cris_spin_lock,@function 9 10 .global cris_spin_trylock 11 + .type cris_spin_trylock,@function 10 12 11 13 .text 12 14 ··· 24 22 ret 25 23 nop 26 24 25 + .size cris_spin_lock, . - cris_spin_lock 26 + 27 27 cris_spin_trylock: 28 28 clearf p 29 29 1: move.b [$r10], $r11 ··· 35 31 clearf p 36 32 ret 37 33 movu.b $r11,$r10 34 + 35 + .size cris_spin_trylock, . - cris_spin_trylock 36 +
+4
arch/cris/arch-v32/mach-a3/Kconfig
··· 33 33 hex "DDR2 config" 34 34 default "0" 35 35 36 + config ETRAX_DDR2_LATENCY 37 + hex "DDR2 latency" 38 + default "0" 39 + 36 40 config ETRAX_PIO_CE0_CFG 37 41 hex "PIO CE0 configuration" 38 42 default "0"
+15 -1
arch/cris/arch-v32/mach-a3/dram_init.S
··· 24 24 25 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 32 ; Start clock 28 33 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_cfg), $r0 29 34 move.d REG_STATE(ddr2, rw_phy_cfg, en, yes), $r1 30 35 move.d $r1, [$r0] 36 + 37 + ; 2. Wait 200us 38 + move.d 10000, $r2 39 + 1: bne 1b 40 + subq 1, $r2 31 41 32 42 ; Reset phy and start calibration 33 43 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_phy_ctrl), $r0 ··· 62 52 lslq 16, $r1 63 53 or.d $r3, $r1 64 54 move.d $r1, [$r0] 55 + ; 2. Wait 200us 56 + move.d 10000, $r4 57 + 1: bne 1b 58 + subq 1, $r4 65 59 cmp.d sdram_commands_end, $r2 66 60 blo command_loop 67 61 nop ··· 77 63 78 64 ; Set latency 79 65 move.d REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency), $r0 80 - move.d 0x13, $r1 66 + move.d CONFIG_ETRAX_DDR2_LATENCY, $r1 81 67 move.d $r1, [$r0] 82 68 83 69 ; Set configuration
+2
arch/cris/arch-v32/mach-a3/hw_settings.S
··· 31 31 ; Register values 32 32 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_cfg) 33 33 .dword CONFIG_ETRAX_DDR2_CONFIG 34 + .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_latency) 35 + .dword CONFIG_ETRAX_DDR2_LATENCY 34 36 .dword REG_ADDR(ddr2, regi_ddr2_ctrl, rw_timing) 35 37 .dword CONFIG_ETRAX_DDR2_TIMING 36 38 .dword CONFIG_ETRAX_DDR2_MRS
+18 -5
arch/cris/arch-v32/mm/init.c
··· 27 27 * at kseg_4 thus the ksegs are set up again. Also clear the TLB and do various 28 28 * other paging stuff. 29 29 */ 30 - void __init 31 - cris_mmu_init(void) 30 + void __init cris_mmu_init(void) 32 31 { 33 32 unsigned long mmu_config; 34 33 unsigned long mmu_kbase_hi; ··· 54 55 /* Initialise the TLB. Function found in tlb.c. */ 55 56 tlb_init(); 56 57 57 - /* Enable exceptions and initialize the kernel segments. */ 58 + /* 59 + * Enable exceptions and initialize the kernel segments. 60 + * See head.S for differences between ARTPEC-3 and ETRAX FS. 61 + */ 58 62 mmu_config = ( REG_STATE(mmu, rw_mm_cfg, we, on) | 59 63 REG_STATE(mmu, rw_mm_cfg, acc, on) | 60 64 REG_STATE(mmu, rw_mm_cfg, ex, on) | 61 65 REG_STATE(mmu, rw_mm_cfg, inv, on) | 66 + #ifdef CONFIG_CRIS_MACH_ARTPEC3 67 + REG_STATE(mmu, rw_mm_cfg, seg_f, page) | 68 + REG_STATE(mmu, rw_mm_cfg, seg_e, page) | 69 + REG_STATE(mmu, rw_mm_cfg, seg_d, linear) | 70 + #else 62 71 REG_STATE(mmu, rw_mm_cfg, seg_f, linear) | 63 72 REG_STATE(mmu, rw_mm_cfg, seg_e, linear) | 64 73 REG_STATE(mmu, rw_mm_cfg, seg_d, page) | 74 + #endif 65 75 REG_STATE(mmu, rw_mm_cfg, seg_c, linear) | 66 76 REG_STATE(mmu, rw_mm_cfg, seg_b, linear) | 67 77 #ifndef CONFIG_ETRAX_VCS_SIM ··· 89 81 REG_STATE(mmu, rw_mm_cfg, seg_1, page) | 90 82 REG_STATE(mmu, rw_mm_cfg, seg_0, page)); 91 83 84 + /* See head.S for differences between ARTPEC-3 and ETRAX FS. */ 92 85 mmu_kbase_hi = ( REG_FIELD(mmu, rw_mm_kbase_hi, base_f, 0x0) | 86 + #ifdef CONFIG_CRIS_MACH_ARTPEC3 87 + REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x0) | 88 + REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x5) | 89 + #else 93 90 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x8) | 94 91 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x0) | 92 + #endif 95 93 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) | 96 94 REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) | 97 95 #ifndef CONFIG_ETRAX_VCS_SIM ··· 143 129 SUPP_REG_WR(RW_GC_CFG, 0xf); /* IMMU, DMMU, ICache, DCache on */ 144 130 } 145 131 146 - void __init 147 - paging_init(void) 132 + void __init paging_init(void) 148 133 { 149 134 int i; 150 135 unsigned long zones_size[MAX_NR_ZONES];
+4
arch/cris/arch-v32/mm/mmu.S
··· 38 38 ; to handle the fault. 39 39 .macro MMU_BUS_FAULT_HANDLER handler, mmu, we, ex 40 40 .globl \handler 41 + .type \handler,"function" 41 42 \handler: 42 43 SAVE_ALL 43 44 move \mmu, $srs ; Select MMU support register bank ··· 53 52 nop 54 53 ba ret_from_intr 55 54 nop 55 + .size \handler, . - \handler 56 56 .endm 57 57 58 58 ; Refill handler. Three cases may occur: ··· 86 84 2: .dword 0 ; last_refill_cause 87 85 .text 88 86 .globl \handler 87 + .type \handler, "function" 89 88 \handler: 90 89 subq 4, $sp 91 90 ; (The pipeline stalls for one cycle; $sp used as address in the next cycle.) ··· 199 196 ; Return 200 197 ba ret_from_intr 201 198 nop 199 + .size \handler, . - \handler 202 200 .endm 203 201 204 202 ; This is the MMU bus fault handlers.
+1 -1
arch/cris/boot/Makefile
··· 3 3 # 4 4 5 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 8 OBJCOPYFLAGS = -O binary $(objcopyflags-y) 9 9
+25 -40
arch/cris/boot/compressed/misc.c
··· 106 106 107 107 static void flush_window(void); 108 108 static void error(char *m); 109 - static void puts(const char *); 109 + static void aputs(const char *s); 110 110 111 111 extern char *input_data; /* lives in head.S */ 112 112 ··· 137 137 138 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 151 #endif 141 152 142 - static void puts(const char *s) 153 + static void aputs(const char *s) 143 154 { 144 155 #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 145 156 while (*s) { 146 157 #ifdef CONFIG_ETRAX_DEBUG_PORT0 147 - #ifdef CONFIG_ETRAX_ARCH_V32 148 - serout(s, regi_ser0); 149 - #else 150 - while (!(*R_SERIAL0_STATUS & (1 << 5))) 151 - ; 152 - *R_SERIAL0_TR_DATA = *s++; 153 - #endif 158 + SEROUT(s, 0); 154 159 #endif 155 160 #ifdef CONFIG_ETRAX_DEBUG_PORT1 156 - #ifdef CONFIG_ETRAX_ARCH_V32 157 - serout(s, regi_ser1); 158 - #else 159 - while (!(*R_SERIAL1_STATUS & (1 << 5))) 160 - ; 161 - *R_SERIAL1_TR_DATA = *s++; 162 - #endif 161 + SEROUT(s, 1); 163 162 #endif 164 163 #ifdef CONFIG_ETRAX_DEBUG_PORT2 165 - #ifdef CONFIG_ETRAX_ARCH_V32 166 - serout(s, regi_ser2); 167 - #else 168 - while (!(*R_SERIAL2_STATUS & (1 << 5))) 169 - ; 170 - *R_SERIAL2_TR_DATA = *s++; 171 - #endif 164 + SEROUT(s, 2); 172 165 #endif 173 166 #ifdef CONFIG_ETRAX_DEBUG_PORT3 174 - #ifdef CONFIG_ETRAX_ARCH_V32 175 - serout(s, regi_ser3); 176 - #else 177 - while (!(*R_SERIAL3_STATUS & (1 << 5))) 178 - ; 179 - *R_SERIAL3_TR_DATA = *s++; 167 + SEROUT(s, 3); 180 168 #endif 181 - #endif 182 - *s++; 183 169 } 184 - /* CONFIG_ETRAX_DEBUG_PORT_NULL */ 185 - #endif 170 + #endif /* CONFIG_ETRAX_DEBUG_PORT_NULL */ 186 171 } 187 172 188 173 void *memset(void *s, int c, size_t n) ··· 218 233 219 234 static void error(char *x) 220 235 { 221 - puts("\n\n"); 222 - puts(x); 223 - puts("\n\n -- System halted\n"); 236 + aputs("\n\n"); 237 + aputs(x); 238 + aputs("\n\n -- System halted\n"); 224 239 225 240 while(1); /* Halt */ 226 241 } ··· 363 378 __asm__ volatile ("move $vr,%0" : "=rm" (revision)); 364 379 if (revision < compile_rev) { 365 380 #ifdef CONFIG_ETRAX_ARCH_V32 366 - puts("You need an ETRAX FS to run Linux 2.6/crisv32\n"); 381 + aputs("You need at least ETRAX FS to run Linux 2.6/crisv32\n"); 367 382 #else 368 - puts("You need an ETRAX 100LX to run linux 2.6\n"); 383 + aputs("You need an ETRAX 100LX to run linux 2.6/crisv10\n"); 369 384 #endif 370 385 while(1); 371 386 } 372 387 373 - puts("Uncompressing Linux...\n"); 388 + aputs("Uncompressing Linux...\n"); 374 389 gunzip(); 375 - puts("Done. Now booting the kernel\n"); 390 + aputs("Done. Now booting the kernel\n"); 376 391 }
+2
arch/cris/include/arch-v32/arch/cache.h
··· 7 7 #define L1_CACHE_BYTES 32 8 8 #define L1_CACHE_SHIFT 5 9 9 10 + #define __read_mostly __attribute__((__section__(".data.read_mostly"))) 11 + 10 12 void flush_dma_list(dma_descr_data *descr); 11 13 void flush_dma_descr(dma_descr_data *descr, int flush_buf); 12 14
+1 -79
arch/cris/include/arch-v32/arch/dma.h
··· 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 - { 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 */ 1 + #include "mach/dma.h"
+12 -8
arch/cris/include/arch-v32/arch/io.h
··· 46 46 unsigned long flags; 47 47 spin_lock_irqsave(&iopin->port->lock, flags); 48 48 49 - if (val) 50 - *iopin->port->data |= iopin->bit; 51 - else 52 - *iopin->port->data &= ~iopin->bit; 49 + if (iopin->port->data) { 50 + if (val) 51 + *iopin->port->data |= iopin->bit; 52 + else 53 + *iopin->port->data &= ~iopin->bit; 54 + } 53 55 54 56 spin_unlock_irqrestore(&iopin->port->lock, flags); 55 57 } ··· 62 60 unsigned long flags; 63 61 spin_lock_irqsave(&iopin->port->lock, flags); 64 62 65 - if (dir == crisv32_io_dir_in) 66 - *iopin->port->oe &= ~iopin->bit; 67 - else 68 - *iopin->port->oe |= iopin->bit; 63 + if (iopin->port->oe) { 64 + if (dir == crisv32_io_dir_in) 65 + *iopin->port->oe &= ~iopin->bit; 66 + else 67 + *iopin->port->oe |= iopin->bit; 68 + } 69 69 70 70 spin_unlock_irqrestore(&iopin->port->lock, flags); 71 71 }
+1 -24
arch/cris/include/arch-v32/arch/memmap.h
··· 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 1 + #include <mach/memmap.h>
+8
arch/cris/include/arch-v32/arch/pgtable.h
··· 2 2 #define _ASM_CRIS_ARCH_PGTABLE_H 3 3 4 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 11 #define VMALLOC_START KSEG_D 6 12 #define VMALLOC_END KSEG_E 13 + #endif 14 + 7 15 #define VMALLOC_VMADDR(x) ((unsigned long)(x)) 8 16 9 17 #endif /* _ASM_CRIS_ARCH_PGTABLE_H */
+3 -4
arch/cris/include/arch-v32/arch/uaccess.h
··· 122 122 __asm__ __volatile__ ( 123 123 " move.d %3,%0\n" 124 124 "5: move.b [%2+],$acr\n" 125 - "1: beq 2f\n" 125 + "1: beq 6f\n" 126 126 " move.b $acr,[%1+]\n" 127 127 128 128 " subq 1,%0\n" 129 129 "2: bne 1b\n" 130 130 " move.b [%2+],$acr\n" 131 131 132 - " sub.d %3,%0\n" 132 + "6: sub.d %3,%0\n" 133 133 " neg.d %0,%0\n" 134 134 "3:\n" 135 135 " .section .fixup,\"ax\"\n" ··· 140 140 /* The address for a fault at the first move is trivial. 141 141 The address for a fault at the second move is that of 142 142 the preceding branch insn, since the move insn is in 143 - its delay-slot. That address is also a branch 144 - target. Just so you don't get confused... */ 143 + its delay-slot. Just so you don't get confused... */ 145 144 " .previous\n" 146 145 " .section __ex_table,\"a\"\n" 147 146 " .dword 5b,4b\n"
+27
arch/cris/include/arch-v32/mach-a3/mach/dma.h
··· 5 5 6 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 35 enum dma_owner { 9 36 dma_eth, 10 37 dma_ser0,
+26 -2
arch/cris/include/arch-v32/mach-a3/mach/startup.inc
··· 1 + #ifndef STARTUP_INC_INCLUDED 2 + #define STARTUP_INC_INCLUDED 3 + 1 4 #include <hwregs/asm/reg_map_asm.h> 2 5 #include <hwregs/asm/gio_defs_asm.h> 3 6 #include <hwregs/asm/pio_defs_asm.h> 4 7 #include <hwregs/asm/clkgen_defs_asm.h> 5 8 #include <hwregs/asm/pinmux_defs_asm.h> 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 6 16 7 17 .macro GIO_INIT 8 18 move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0 ··· 42 32 move.d 0xFFFFFFFF, $r0 43 33 move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pa), $r1 44 34 move.d $r0, [$r1] 45 - move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 46 - move.d $r0, [$r1] 47 35 move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pc), $r1 48 36 move.d $r0, [$r1] 37 + 38 + ;; If eth_mdio, eth, geth bits are set in hwprot, don't 39 + ;; set them to gpio, as this means they have been configured 40 + ;; earlier and shouldn't be changed. 41 + move.d 0xFC000000, $r2 ; pins 25..0 are eth_mdio, eth, geth 42 + move.d REG_ADDR(pinmux, regi_pinmux, rw_hwprot), $r1 43 + move.d [$r1], $r0 44 + btstq REG_BIT(pinmux, rw_hwprot, eth), $r0 45 + GIO_SET_P 0x00FFFF00, $r2 ;; pins 8..23 are eth 46 + btstq REG_BIT(pinmux, rw_hwprot, eth_mdio), $r0 47 + GIO_SET_P 0x03000000, $r2 ;; pins 24..25 are eth_mdio 48 + btstq REG_BIT(pinmux, rw_hwprot, geth), $r0 49 + GIO_SET_P 0x000000FF, $r2 ;; pins 0..7 are geth 50 + move.d REG_ADDR(pinmux, regi_pinmux, rw_gio_pb), $r1 51 + move.d $r2, [$r1] 49 52 .endm 50 53 51 54 .macro START_CLOCKS ··· 81 58 move.d CONFIG_ETRAX_PIO_CE2_CFG, $r1 82 59 move.d $r1, [$r0] 83 60 .endm 61 + #endif
+79
arch/cris/include/arch-v32/mach-fs/mach/dma.h
··· 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 */
+24
arch/cris/include/arch-v32/mach-fs/mach/memmap.h
··· 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
+5
arch/cris/include/arch-v32/mach-fs/mach/startup.inc
··· 1 + #ifndef STARTUP_INC_INCLUDED 2 + #define STARTUP_INC_INCLUDED 3 + 1 4 #include <hwregs/asm/reg_map_asm.h> 2 5 #include <hwregs/asm/bif_core_defs_asm.h> 3 6 #include <hwregs/asm/gio_defs_asm.h> ··· 78 75 move.d $r10, [$r11] 79 76 #endif 80 77 .endm 78 + 79 + #endif
+78 -18
arch/cris/include/asm/etraxgpio.h
··· 21 21 * /dev/leds minor 2, Access to leds depending on kernelconfig 22 22 * 23 23 * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3): 24 - * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction 25 - * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction 26 - * /dev/gpioc minor 3, 18 bit GPIO, each bit can change direction 27 - * /dev/gpiod minor 4, 18 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, 32 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, 32 bit GPIO, input only 28 28 * /dev/leds minor 2, Access to leds depending on kernelconfig 29 29 * /dev/pwm0 minor 16, PWM channel 0 on PA30 30 30 * /dev/pwm1 minor 17, PWM channel 1 on PA31 31 31 * /dev/pwm2 minor 18, PWM channel 2 on PB26 32 + * /dev/ppwm minor 19, PPWM channel 32 33 * 33 34 */ 34 35 #ifndef _ASM_ETRAXGPIO_H 35 36 #define _ASM_ETRAXGPIO_H 36 37 38 + #define GPIO_MINOR_FIRST 0 39 + 40 + #define ETRAXGPIO_IOCTYPE 43 41 + 37 42 /* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */ 38 43 #ifdef CONFIG_ETRAX_ARCH_V10 39 - #define ETRAXGPIO_IOCTYPE 43 40 44 #define GPIO_MINOR_A 0 41 45 #define GPIO_MINOR_B 1 42 46 #define GPIO_MINOR_LEDS 2 43 47 #define GPIO_MINOR_G 3 44 48 #define GPIO_MINOR_LAST 3 49 + #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST 45 50 #endif 46 51 47 52 #ifdef CONFIG_ETRAXFS 48 - #define ETRAXGPIO_IOCTYPE 43 49 53 #define GPIO_MINOR_A 0 50 54 #define GPIO_MINOR_B 1 51 55 #define GPIO_MINOR_LEDS 2 ··· 62 58 #else 63 59 #define GPIO_MINOR_LAST 5 64 60 #endif 61 + #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST 65 62 #endif 66 63 67 64 #ifdef CONFIG_CRIS_MACH_ARTPEC3 68 - #define ETRAXGPIO_IOCTYPE 43 69 65 #define GPIO_MINOR_A 0 70 66 #define GPIO_MINOR_B 1 71 67 #define GPIO_MINOR_LEDS 2 ··· 77 73 #else 78 74 #define GPIO_MINOR_LAST 4 79 75 #endif 80 - #define GPIO_MINOR_PWM0 16 81 - #define GPIO_MINOR_PWM1 17 82 - #define GPIO_MINOR_PWM2 18 83 - #define GPIO_MINOR_LAST_PWM GPIO_MINOR_PWM2 76 + #define GPIO_MINOR_FIRST_PWM 16 77 + #define GPIO_MINOR_PWM0 (GPIO_MINOR_FIRST_PWM+0) 78 + #define GPIO_MINOR_PWM1 (GPIO_MINOR_FIRST_PWM+1) 79 + #define GPIO_MINOR_PWM2 (GPIO_MINOR_FIRST_PWM+2) 80 + #define GPIO_MINOR_PPWM (GPIO_MINOR_FIRST_PWM+3) 81 + #define GPIO_MINOR_LAST_PWM GPIO_MINOR_PPWM 82 + #define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST_PWM 84 83 #endif 84 + 85 + 85 86 86 87 /* supported ioctl _IOC_NR's */ 87 88 ··· 134 125 */ 135 126 #define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */ 136 127 #define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */ 137 - #define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, 138 - * *arg updated with current input pins. 139 - */ 140 - #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, 141 - * *arg updated with current output pins. 142 - */ 128 + #define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, */ 129 + /* *arg updated with current input pins. */ 130 + #define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, */ 131 + /* *arg updated with current output pins. */ 143 132 144 133 /* The following ioctl's are applicable to the PWM channels only */ 145 134 ··· 147 140 PWM_OFF = 0, /* disabled, deallocated */ 148 141 PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */ 149 142 PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */ 150 - PWM_VARFREQ = 3 /* individually configurable high/low periods */ 143 + PWM_VARFREQ = 3, /* individually configurable high/low periods */ 144 + PWM_SOFT = 4 /* software generated */ 151 145 }; 152 146 153 147 struct io_pwm_set_mode { ··· 183 175 struct io_pwm_set_duty { 184 176 int duty; /* 0..255 */ 185 177 }; 178 + 179 + /* Returns information about the latest PWM pulse. 180 + * lo: Length of the latest low period, in units of 10ns. 181 + * hi: Length of the latest high period, in units of 10ns. 182 + * cnt: Time since last detected edge, in units of 10ns. 183 + * 184 + * The input source to PWM is decied by IO_PWM_SET_INPUT_SRC. 185 + * 186 + * NOTE: All PWM devices is connected to the same input source. 187 + */ 188 + #define IO_PWM_GET_PERIOD 0x23 189 + 190 + struct io_pwm_get_period { 191 + unsigned int lo; 192 + unsigned int hi; 193 + unsigned int cnt; 194 + }; 195 + 196 + /* Sets the input source for the PWM input. For the src value see the 197 + * register description for gio:rw_pwm_in_cfg. 198 + * 199 + * NOTE: All PWM devices is connected to the same input source. 200 + */ 201 + #define IO_PWM_SET_INPUT_SRC 0x24 202 + struct io_pwm_set_input_src { 203 + unsigned int src; /* 0..7 */ 204 + }; 205 + 206 + /* Sets the duty cycles in steps of 1/256, 0 = 0%, 255 = 100% duty cycle */ 207 + #define IO_PPWM_SET_DUTY 0x25 208 + 209 + struct io_ppwm_set_duty { 210 + int duty; /* 0..255 */ 211 + }; 212 + 213 + /* Configuraton struct for the IO_PWMCLK_SET_CONFIG ioctl to configure 214 + * PWM capable gpio pins: 215 + */ 216 + #define IO_PWMCLK_SETGET_CONFIG 0x26 217 + struct gpio_pwmclk_conf { 218 + unsigned int gpiopin; /* The pin number based on the opened device */ 219 + unsigned int baseclk; /* The base clock to use, or sw will select one close*/ 220 + unsigned int low; /* The number of low periods of the baseclk */ 221 + unsigned int high; /* The number of high periods of the baseclk */ 222 + }; 223 + 224 + /* Examples: 225 + * To get a symmetric 12 MHz clock without knowing anything about the hardware: 226 + * baseclk = 12000000, low = 0, high = 0 227 + * To just get info of current setting: 228 + * baseclk = 0, low = 0, high = 0, the values will be updated by driver. 229 + */ 186 230 187 231 #endif
+26 -1
arch/cris/include/asm/sync_serial.h
··· 19 19 #define SSP_OPOLARITY _IOR('S', 4, unsigned int) 20 20 #define SSP_SPI _IOR('S', 5, unsigned int) 21 21 #define SSP_INBUFCHUNK _IOR('S', 6, unsigned int) 22 + #define SSP_INPUT _IOR('S', 7, unsigned int) 22 23 23 24 /* Values for SSP_SPEED */ 24 25 #define SSP150 0 ··· 38 37 #define SSP921600 13 39 38 #define SSP3125000 14 40 39 #define CODEC 15 40 + #define CODEC_f32768 16 41 41 42 42 #define FREQ_4MHz 0 43 43 #define FREQ_2MHz 1 ··· 48 46 #define FREQ_128kHz 5 49 47 #define FREQ_64kHz 6 50 48 #define FREQ_32kHz 7 49 + /* FREQ_* with values where bit (value & 0x10) is set are */ 50 + /* used for CODEC_f32768 */ 51 + #define FREQ_4096kHz 16 /* CODEC_f32768 */ 51 52 52 53 /* Used by application to set CODEC divider, word rate and frame rate */ 53 - #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28)) 54 + #define CODEC_VAL(freq, clk_per_sync, sync_per_frame) \ 55 + ((CODEC + ((freq & 0x10) >> 4)) | (freq << 8) | \ 56 + (clk_per_sync << 16) | (sync_per_frame << 28)) 54 57 55 58 /* Used by driver to extract speed */ 56 59 #define GET_SPEED(x) (x & 0xff) ··· 75 68 #define NORMAL_SYNC 1 76 69 #define EARLY_SYNC 2 77 70 #define SECOND_WORD_SYNC 0x40000 71 + #define LATE_SYNC 0x80000 78 72 79 73 #define BIT_SYNC 4 80 74 #define WORD_SYNC 8 ··· 111 103 112 104 /* Values for SSP_INBUFCHUNK */ 113 105 /* plain integer with the size of DMA chunks */ 106 + 107 + /* To ensure that the timestamps are aligned with the data being read 108 + * the read length MUST be a multiple of the length of the DMA buffers. 109 + * 110 + * Use a multiple of SSP_INPUT_CHUNK_SIZE defined below. 111 + */ 112 + #define SSP_INPUT_CHUNK_SIZE 256 113 + 114 + /* Request struct to pass through the ioctl interface to read 115 + * data with timestamps. 116 + */ 117 + struct ssp_request { 118 + char __user *buf; /* Where to put the data. */ 119 + size_t len; /* Size of buf. MUST be a multiple of */ 120 + /* SSP_INPUT_CHUNK_SIZE! */ 121 + struct timespec ts; /* The time the data was sampled. */ 122 + }; 114 123 115 124 #endif
+7 -8
arch/cris/kernel/profile.c
··· 9 9 10 10 #define SAMPLE_BUFFER_SIZE 8192 11 11 12 - static char* sample_buffer; 13 - static char* sample_buffer_pos; 12 + static char *sample_buffer; 13 + static char *sample_buffer_pos; 14 14 static int prof_running = 0; 15 15 16 - void 17 - cris_profile_sample(struct pt_regs* regs) 16 + void cris_profile_sample(struct pt_regs *regs) 18 17 { 19 18 if (!prof_running) 20 19 return; ··· 23 24 else 24 25 *(unsigned int*)sample_buffer_pos = 0; 25 26 26 - *(unsigned int*)(sample_buffer_pos + 4) = instruction_pointer(regs); 27 + *(unsigned int *)(sample_buffer_pos + 4) = instruction_pointer(regs); 27 28 sample_buffer_pos += 8; 28 29 29 30 if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE) ··· 53 54 { 54 55 sample_buffer_pos = sample_buffer; 55 56 memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE); 57 + return count < SAMPLE_BUFFER_SIZE ? count : SAMPLE_BUFFER_SIZE; 56 58 } 57 59 58 60 static const struct file_operations cris_proc_profile_operations = { ··· 61 61 .write = write_cris_profile, 62 62 }; 63 63 64 - static int 65 - __init init_cris_profile(void) 64 + static int __init init_cris_profile(void) 66 65 { 67 66 struct proc_dir_entry *entry; 68 67 ··· 81 82 82 83 return 0; 83 84 } 84 - 85 85 __initcall(init_cris_profile); 86 +
+5 -2
arch/cris/kernel/time.c
··· 39 39 extern unsigned long loops_per_jiffy; /* init/main.c */ 40 40 unsigned long loops_per_usec; 41 41 42 + 43 + #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET 42 44 extern unsigned long do_slow_gettimeoffset(void); 43 45 static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; 44 46 45 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 54 * BUG: This routine does not handle hour overflow properly; it just ··· 154 151 155 152 unsigned long long sched_clock(void) 156 153 { 157 - return (unsigned long long)jiffies * (1000000000 / HZ) + 154 + return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + 158 155 get_ns_in_jiffie(); 159 156 } 160 157
+13 -1
arch/cris/kernel/vmlinux.lds.S
··· 58 58 ___data_start = . ; 59 59 __Sdata = . ; 60 60 .data : { /* Data */ 61 + CACHELINE_ALIGNED_DATA(32) 62 + READ_MOSTLY_DATA(32) 61 63 DATA_DATA 62 64 } 63 65 __edata = . ; /* End of data section. */ ··· 85 83 CON_INITCALL 86 84 } 87 85 SECURITY_INIT 86 + 87 + /* .exit.text is discarded at runtime, not link time, 88 + * to deal with references from __bug_table 89 + */ 90 + .exit.text : { 91 + EXIT_TEXT 92 + } 93 + .exit.data : { 94 + EXIT_DATA 95 + } 88 96 89 97 #ifdef CONFIG_ETRAX_ARCH_V10 90 98 #ifdef CONFIG_BLK_DEV_INITRD ··· 124 112 __init_end = .; 125 113 126 114 __data_end = . ; /* Move to _edata ? */ 127 - BSS_SECTION(0, 0, 0) 115 + BSS_SECTION(1, 1, 1) 128 116 129 117 . = ALIGN (0x20); 130 118 _end = .;
+29 -16
arch/cris/mm/fault.c
··· 1 1 /* 2 - * linux/arch/cris/mm/fault.c 2 + * arch/cris/mm/fault.c 3 3 * 4 - * Copyright (C) 2000-2006 Axis Communications AB 5 - * 6 - * Authors: Bjorn Wesen 7 - * 4 + * Copyright (C) 2000-2010 Axis Communications AB 8 5 */ 9 6 10 7 #include <linux/mm.h> 11 8 #include <linux/interrupt.h> 12 9 #include <linux/module.h> 10 + #include <linux/wait.h> 13 11 #include <asm/uaccess.h> 14 12 15 13 extern int find_fixup_code(struct pt_regs *); 16 14 extern void die_if_kernel(const char *, struct pt_regs *, long); 15 + extern void show_registers(struct pt_regs *regs); 17 16 18 17 /* debug of low-level TLB reload */ 19 18 #undef DEBUG ··· 107 108 info.si_code = SEGV_MAPERR; 108 109 109 110 /* 110 - * If we're in an interrupt or have no user 111 - * context, we must not take the fault.. 111 + * If we're in an interrupt or "atomic" operation or have no 112 + * user context, we must not take the fault. 112 113 */ 113 114 114 - if (in_interrupt() || !mm) 115 + if (in_atomic() || !mm) 115 116 goto no_context; 116 117 117 118 down_read(&mm->mmap_sem); ··· 192 193 /* User mode accesses just cause a SIGSEGV */ 193 194 194 195 if (user_mode(regs)) { 196 + printk(KERN_NOTICE "%s (pid %d) segfaults for page " 197 + "address %08lx at pc %08lx\n", 198 + tsk->comm, tsk->pid, 199 + address, instruction_pointer(regs)); 200 + 201 + /* With DPG on, we've already dumped registers above. */ 202 + DPG(if (0)) 203 + show_registers(regs); 204 + 205 + #ifdef CONFIG_NO_SEGFAULT_TERMINATION 206 + DECLARE_WAIT_QUEUE_HEAD(wq); 207 + wait_event_interruptible(wq, 0 == 1); 208 + #else 195 209 info.si_signo = SIGSEGV; 196 210 info.si_errno = 0; 197 211 /* info.si_code has been set above */ 198 212 info.si_addr = (void *)address; 199 213 force_sig_info(SIGSEGV, &info, tsk); 200 - printk(KERN_NOTICE "%s (pid %d) segfaults for page " 201 - "address %08lx at pc %08lx\n", 202 - tsk->comm, tsk->pid, address, instruction_pointer(regs)); 214 + #endif 203 215 return; 204 216 } 205 217 ··· 255 245 256 246 out_of_memory: 257 247 up_read(&mm->mmap_sem); 258 - printk("VM: killing process %s\n", tsk->comm); 259 - if (user_mode(regs)) 260 - do_exit(SIGKILL); 261 - goto no_context; 248 + if (!user_mode(regs)) 249 + goto no_context; 250 + pagefault_out_of_memory(); 251 + return; 262 252 263 253 do_sigbus: 264 254 up_read(&mm->mmap_sem); ··· 344 334 find_fixup_code(struct pt_regs *regs) 345 335 { 346 336 const struct exception_table_entry *fixup; 337 + /* in case of delay slot fault (v32) */ 338 + unsigned long ip = (instruction_pointer(regs) & ~0x1); 347 339 348 - if ((fixup = search_exception_tables(instruction_pointer(regs))) != 0) { 340 + fixup = search_exception_tables(ip); 341 + if (fixup != 0) { 349 342 /* Adjust the instruction pointer in the stackframe. */ 350 343 instruction_pointer(regs) = fixup->fixup; 351 344 arch_fixup(regs);