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