Commit Graph

132 Commits (d76628c67cdeebf84766a19c67c821c2e518baa4)

Author SHA1 Message Date
Jesper Nilsson 77a746cec5 cris: import memset.c from newlib: fixes compile error with newer (pre4.3) gcc
Adrian Bunk reported the following compile error with a SVN head GCC:

...
CC arch/cris/arch-v10/lib/memset.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c: In function 'memset':
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:164: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:165: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:166: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:167: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:185: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:189: error: lvalue required as increment operand
/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/cris/arch-v10/lib/memset.c:192: error: lvalue required as increment operand
... etc ...

This is due to the use of the construct:

	*((long*)dst)++ = lc;

Which is no longer legal since casts don't return an lvalue.

The solution is to import the implementation from newlib,
which is continually autotested together with GCC mainline,
and uses the construct:

	*(long *) dst = lc; dst += 4;

With this change, the generated code actually shrinks 76 bytes
since gcc notices that it can use autoincrement for the move
instruction in CRIS.

   text    data     bss     dec     hex filename
    304       0       0     304     130 memset.old.o
   text    data     bss     dec     hex filename
    228       0       0     228      e4 memset.o

Since this is an import of a file from newlib, I'm not touching
the formatting or correcting any checkpatch errors.

Note also that even if the two files for the CRIS v10 and CRIS v32
are identical at the moment, it might be possible to tweak the
CRIS v32 version. Thus, I'm not yet folding them into the same file,
at least not until we've done some research on it.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-14 20:58:04 -08:00
Jesper Nilsson 69b06c15e7 CRIS v32: Change drivers/i2c.c locking.
- Change spin_lock + local_irq_save into spin_lock_irqsave
- Change spin_unlock + local_irq_restore into spin_unlock_irqrestore
- Return ENOTTY if ioctl is not recognized as a cris ioctl.
- Make init functions static.
2008-02-08 17:00:25 +01:00
Jesper Nilsson a34d24425e CRIS v32: Rewrite ARTPEC-3 gpio driver to avoid volatiles and general cleanup.
Changes as suggested by Andrew Morton, plus general cleanup to
ease later consolidation of driver into machine common driver.

- Correct parameter type of gpio_write to const char __user *
- Remove volatile from the arrays of machine dependent registers, use
  readl and writel to access them instead.
- Remove useless casts of void.
- Use spin_lock_irqsave for locking.
- Break gpio_write into smaller sub-functions.
- Remove useless breaks after returns.
- Don't perform any change in IO_CFG_WRITE_MODE if values are invalid.
  (previously values were set and then set to zero)
- Change cast for copy_to_user to (void __user *)
- Make file_operations gpio_fops static and const.
- Make setget_output static. (However, it's still inline since the CRIS
  architecture is still not SMP, which makes the function small enough
  to inline)
2008-02-08 16:28:36 +01:00
Jesper Nilsson 7800029df3 CRIS: Add new timerfd syscall entries. 2008-02-08 11:54:30 +01:00
Jesper Nilsson eb090473a7 CRIS v32: Correct spelling of bandwidth in function name. 2008-02-08 11:16:46 +01:00
Jesper Nilsson 9f68ff9ee9 CRIS v32: Clean up nandflash.c for ARTPEC-3 and ETRAX FS.
Clean up issues noticed by Andrew Morton:

- Use a combined struct for allocating the mtd_info and nand_chip structs
  instead of using anonymous memory as the example in
  Documentation/DocBook/mtdnand.tmpl
- Use kzalloc instead of using kmalloc/memset(0)
- Make crisv32_device_ready static.
2008-02-08 11:16:45 +01:00
Jesper Nilsson 79e04fdbb3 CRIS: Move ETRAX_AXISFLASHMAP to common Kconfig file. 2008-02-08 11:08:06 +01:00
Jesper Nilsson ac17e82a87 CRIS v32: Fix minor formatting issue in mach-a3/io.c 2008-02-08 11:06:39 +01:00
Jesper Nilsson f8e47cb058 CRIS v32: Initialize GIO even if we're rambooting in kernel/head.S 2008-02-08 11:06:39 +01:00
Jesper Nilsson a87434b04f CRIS v32: Remove kernel/arbiter.c, it now exists in machine dependent directory. 2008-02-08 11:06:39 +01:00
Jesper Nilsson baa69b121a CRIS v32: Fix startup oops and replace hardcoded pagesize in vmlinux.lds.S
- Move alignment of init data to page size outside define CONFIG_BLK_DEV_INITRD
  This avoids oops due to memory on the same page as init data being freed.
- Change hardcoded page size to use macro from asm/page.h
- Add reserved memory via CONFIG_ETRAX_VMEM_SIZE.
- Use available defines for TEXT_TEXT and INITCALLS.
- Cleanup whitespace.
2008-02-08 11:06:36 +01:00
Jesper Nilsson 52d82ef12a CRIS v32: Avoid work when switching between tasks with shared memory descriptors in mm/tlb.c
There is no need to do all this work if they share memory descriptors.
Also, fix some minor whitespace and long lines.
2008-02-08 11:06:36 +01:00
Jesper Nilsson 3d44305abe CRIS v32: Add workaround for MMU hardware bug for ETRAX FS in mm/mmu.S 2008-02-08 11:06:36 +01:00
Jesper Nilsson 108ecfbc31 CRIS v32: Fix bug in internal memory allocator mm/intmem.c
- Fix bug where allocated memory didn't account for alignment.
- Add support for ARTPEC-3
- Add module_init for crisv32_intmem_init.
2008-02-08 11:06:36 +01:00
Jesper Nilsson 0836c6d26f CRIS v32: Change name of simulator config to CONFIG_ETRAX_VCS_SIM in mm/init.c
- Remove unneded code for ETRAX FS and ARTPEC-3
2008-02-08 11:06:36 +01:00
Jesper Nilsson ea0af95b1c CRIS v32: Change lib/spinlock.S to use byte operations instead of dwords. 2008-02-08 11:06:36 +01:00
Jesper Nilsson ea402db97f CRIS v32: Move hw_settings.S to machine specific directories for ETRAX FS and ARTPEC-3 2008-02-08 11:06:35 +01:00
Jesper Nilsson 41f9412b20 CRIS v32: Update lib/checksum.S and lib/checksumcopy.S
- Slight tweaks, use $acr + addoq to propagate carry across the loop boundary.
- Better use of latency cycles.
- Remove duplicate folding of carry, it is not needed.
2008-02-08 11:06:35 +01:00
Jesper Nilsson 7674464cb3 CRIS v32: Add lib/delay to build. 2008-02-08 11:06:35 +01:00
Jesper Nilsson 48c87a4483 CRIS v32: Add precise delay loops for ETRAX FS and ARTPEC-3.
Implements cris_delay10ns.
2008-02-08 11:06:35 +01:00
Jesper Nilsson a474de0a02 CRIS v32: Update vcs_hook.c for ETRAX FS.
- Clean up some formatting and whitespace.
2008-02-08 11:06:35 +01:00
Jesper Nilsson 09160d7cc3 CRIS v32: Move vcs_hook to machine specific directory.
These files are different for ETRAX FS and ARTPEC-3.
2008-02-08 11:06:35 +01:00
Jesper Nilsson 538380da1a CRIS v32: Update kernel/smp.c for CRIS v32.
- Change include paths to machine specific headers (asm/arch/hwregs -> hwregs)
- Add cpu_possible_map as cpumask_t and export it.
- Drop struct pt_regs parameter from crisv32_ipi_interrupt.
- timer -> timer0
2008-02-08 11:06:35 +01:00
Jesper Nilsson 574852a2a5 CRIS v32: Update signal handling in kernel/signal.c
- do_signal now returns void, and does not have the previous signal set
  as a parameter.
- Remove sys_rt_sigsuspend, we can use the common one instead.
- Change sys_sigsuspend to be more like x86, don't call do_signal here.
- handle_signal, setup_frame and setup_rt_frame now return -EFAULT
  if we've delivered a segfault, which is used by callers to perform
  necessary cleanup.
- Break long lines, correct whitespace and formatting errors.
2008-02-08 11:06:35 +01:00
Jesper Nilsson 14e61bebb4 CRIS v32: Update boot/rescue/rescue.ld
- Update to work for ETRAX FS and ARTPEC-3
2008-02-08 11:06:35 +01:00
Jesper Nilsson f2bbc96a40 CRIS v32: Change names of config variable and register field for data available.
- CONFIG_ETRAXFS_SIM -> CONFIG_ETRAX_VCS_SIM
- ser_intr_mask.data_avail -> ser_intr_mask.dav
2008-02-08 11:06:34 +01:00
Jesper Nilsson f64dd2191d CRIS v32: Change debug and formatting in kernel/fasttimer.c
- Don't use SANITYCHECK(x) as a macro, test FAST_TIMER_SANITY_CHECKS with
  ifdef. This makes it possible for automatic indent etc to work.
- Correct some whitespace errors.
- Don't initialize static variable.
2008-02-08 11:06:34 +01:00
Jesper Nilsson 43e6bd6aa8 CRIS v32: Update kernel/crisksyms.c
- Include pinmux.h from machine specific directory.
- Add some more symbols: crisv32_pinmux_alloc, crisv32_pinmux_dealloc_fixed,
  crisv32_io_get_name and crisv32_io_get
2008-02-08 11:06:34 +01:00
Jesper Nilsson cbca663488 CRIS v32: Remove config ifdef around init function for drivers/sync_serial.c
The init function should be defined always.
2008-02-08 11:06:34 +01:00
Jesper Nilsson 5adb5c873f CRIS v32: Remove drivers/gpio.c, now exists as machine specific file. 2008-02-08 11:06:34 +01:00
Jesper Nilsson 7edf744053 CRIS v32: Update driver for RTC chip pcf8563.
- Moved all calls to register_chrdev to a function called by module_init.
- Added mutex locking.
- Added better error handling at start up.
- Added BIN_TO_BCD of the month value before it is saved to the RTC.
- Corrected the month value returned by pcf8563_readreg.
- Cache the voltage low value at driver init so the battery status
  information does not get 'accidentally' cleared when setting the RTC time.
- Removed obsolete CONFIG_ETRAX_RTC_READONLY
- Voltage low ioctl():s RTC_VLOW_RD -> RTC_VL_READ, RTC_VLOW_SET -> RTC_VL_CLR
2008-02-08 11:06:34 +01:00
Jesper Nilsson d8ac17a0ee CRIS v32: Remove drivers/nandflash.h, now exists as machine specific file. 2008-02-08 11:06:34 +01:00
Jesper Nilsson 2c30da7175 CRIS v32: ETRAX FS Change name of LED macros in drivers/mach-fs/gpio.c to avoid collision. 2008-02-08 11:06:33 +01:00
Jesper Nilsson cacc0cc83f CRIS v32: Change name of LED macros in drivers/mach-a3/gpio.c to avoid collision. 2008-02-08 11:06:33 +01:00
Jesper Nilsson 935a847b98 CRIS v32: Change include path for hwregs in drivers/iop_fw_load.c
Also, remove useless CVS id tag.
2008-02-08 11:06:33 +01:00
Jesper Nilsson 635c45c195 CRIS v32: Rewrite of stream co-processor driver for ETRAX FS and ARTPEC-3
- Workaround for cachebug (Guinness TR 106).
- Add ARTPEC-3 support.
2008-02-08 11:06:33 +01:00
Jesper Nilsson a77dba6a4d CRIS v32: Replace build flags in boot/rescue/Makefile
- Change AFLAGS to asflags-y, LDFLAGS to ldflags-y and EXTRA_CFLAGS
  to ccflags-y. We only need the flags in this Makefile.
2008-02-08 11:06:33 +01:00
Jesper Nilsson 111e3b1aba CRIS v32: Replace build flags in boot/compressed/Makefile
- Change AFLAGS to asflags-y, LDFLAGS to ldflags-y and KBUILD_CFLAGS
  to ccflags-y. We only need the flags in this Makefile.
2008-02-08 11:06:33 +01:00
Jesper Nilsson a9d13fad8c CRIS v32: Remove useless CVS id tag from boot/compressed/README 2008-02-08 11:06:33 +01:00
Jesper Nilsson c3d6ddddb0 CRIS: Move common Kconfig variable ETRAX_RTC to arch independet Kconfig. 2008-02-08 11:06:30 +01:00
Jesper Nilsson fbdb5f865b CRIS v32: Update and improve kernel/time.c
- Shorten include paths to machine dependent header files.
- Register name for first timer is now regi_timer0.
- Remove raw_printk hack, use oops_in_progress instead.
- Add handling of CPU frequency scaling for CRIS.
- Remove regs parameter to timer_interrupt, get them from get_irq_regs instead.
- Whitespace and formatting changes.
2008-02-08 11:06:28 +01:00
Jesper Nilsson 9ce1ea751f CRIS v32: Update and improve kernel/traps.c
- Remove watchdog handling, handled elsewhere.
- Shorten include paths to machine dependent header files.
- Remove raw_printk hack, we now use oops_in_progress instead.
- Add handling of BUG for exception handlers (break 14).
- Formatting and whitespace changes.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 8cca29b713 CRIS v32: Minor updates to kernel/process.c
- Shorten include paths for machine dependent header files.
- Remove unused extern declaration of etrax_gpio_wake_up_check.
- Register name for first timer is now regi_timer0.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 693d9847b2 CRIS v32: Update and simplify kernel/irq.c.
- First timer register has changed name to timer0.
- Build IRQs with only IRQ number, mask bit will be calculated instead.
- Add more IRQs, up to 64 supported.
- Use arrays to hold which IRQs triggered instead of trying to do magic
  with two 32 bit values now that more than 32 IRQs are supported.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 96e476697d CRIS v32: Update kernel/head.S
- Shorten include paths for machine specific header files.
- Add magic for booting NAND flash.
- Change CONFIG_ETRAXFS_SIM to CONFIG_ETRAX_VCS_SIM.
- Use assembler macros for initializing hardware (clocks)
- Add stubs for SMP slave CPUs.
- Search for cramfs or jffs2 if no romfs found.
- Initialize l2cache.
2008-02-08 11:06:27 +01:00
Jesper Nilsson ec87ee20c2 CRIS v32: Update and improve fasttimer.c
- Change include path to machine dependent header files.
- Remove __INLINE__, it expands to inline anyway.
- Don't initialize static variables.
- Change timers to use fasttimer_t instead of timevals.
- Change name of timeval_cmp to fasttime_cmp to highlight this.
- Register name for first timer is regi_timer0, not regi_timer.
- Whitespace and formatting changes.
- Don't return if we're blocking interrupts, goto done and restore interrupts.
- Disable interrupts while walking the fasttimer list, only restore
  while doing the callback.
- Remove #ifdef DECLARE_WAITQUEUE, this code won't be used in another OS.
- Remove CVS log.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 8226410262 CRIS v32: Update debugport.
- Shorten include paths to machine dependent headers.
- Add support for fifth serial port.
- Remove CONFIG_ETRAXFS_SIM and CONFIG_ETRAX_DEBUG_PORT_NULL, no longer used.
- Remove raw_printk and stupid_debug hack, no longer needed.
- Remove dummy console stuff, no longer needed.
- Correct some register type names.
- Correct some whitespace errors and formatting.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 3f50c0673c CRIS v32: Update boot/rescue/head.S code.
- Add ifdef for ETRAX_AXISFLASHMAP to avoid compiling file unless it is set.
- Use assembler macros for setting up clocks.
- Don't copy image, just jump to it (only works for NOR flash)
2008-02-08 11:06:27 +01:00
Jesper Nilsson a5d204bf36 CRIS v32: Update boot/compressed/misc.c
- Shorten include paths to machine specific headers.
- Remove fill_inbuf, not defined here.
- Return __dest as value from memcpy.
- Enable serial port hardware transmitter and receiver in serial_setup.
- Correct baudrate divisor calculation, changed from 4800 to 115200.
- Add support for Artpec-3 specific serial port setup.
- Initialize pinmux for the correct serial port.
2008-02-08 11:06:27 +01:00
Jesper Nilsson 247c3c959f CRIS v32: Update compressed head.S
- Fixes for NAND and NOR flash booting.
- Use assembler macros for common tasks (clocks, general io etc)
- Use (EtraxFS or Artpec-3) machine specific include for dram and hardware init.
2008-02-08 11:06:26 +01:00