ARC: Possible issue with bitops

For ARCompact bit fiddling insn e.g. "BCLR a, b, c", the core already
masks the bitpos operand "c" to 5 bits (0-31). Thus we can avoid a mask
insn for bitpos operand.

However if that operand is constant and is large
- Ideally gcc/gas need to complaint (but as of 4.4 they don't)
- So code needs to ensure that it is clipped to 5 bits which can be
  cheaply done using __builtin_constant_p( ).

I was already doing this in test_and_{set,clear,change}_bit() routines
for making sure that test-orig-bit operation worked properly.

	if (__builtin_constant_p(nr)) nr &= 0x1f;
	 return (old & (1 << (nr))) != 0;

However missed out on the fact that the preceeding inline asm would also
suffer the same fate.

This patch ensures that inline asm doing the bitop get a clipped operand
iff "const"
- moves __builtin_constant_p() to top for test_and_{set,clear,change}_bit
- Introduces __builtin_constant_p() in {set,clear,change}_bit

This problem was reported by Anton Kolesov (akolesov@synopsys.com) as
spotting a "BCLR r7, r7, 99".
Interestingly enough however that insn is valid courtesy the alternate
valid encoding: BCLR a, b, s12

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
ARC: make clock source/events to be per platform.

Each platform should provide functions:
arc_platform_read_timer1
arc_platform_periodic_timer_setup
arc_platform_timer_init

Now each platform can apply its own methods to handle SMP.
Where in SMP we need some global clock source.

Signed-off-by: Noam Camus <noamc@ezchip.com>
NET: Add network driver

This patch adds an driver for the debug LAN device used in EZchip NPS boards.

Signed-off-by: Noam Camus <noamc@ezchip.com>
tty/8250_early: Turn serial_in/serial_out to weak symbols to allow platforms to override them.

Now one can replace default methods with similar fit to its needs.
e.g. choose other regshift, register offset, or any other manipulation.

This is useful for big endian platforms wishing to use the early serial driver.
Platform that needs to swab bytes before the register accesses.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: [plat-eznps] Add eznps platform

This platform include boards:
	Hardware Emulator (HE) version 0,1...
	Simulator based upon nSIM.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: [plat-eznps] Add eznps default board configurations

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: TLB flush for SMP

This is for cases we need to flush tlb's in several CPU's since a memory
structure may be held by several threads in the same time in different
CPU's.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: ASID with SMP

Each CPU got its own TLB and therefore it's own software cache.
Also each mmu context may reside at the same in several CPU's thanks to
threads sharing the context therefore may have different ASID.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: Add initrd from external file.

We now can easly get rootfs from external file.
It may be cpio, ext2, cramfs...

This makes vmlinux usable not only for internal cpio.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: Handle un-aligned user space access in BE.

Adding endian awarness to un-aligned access exception handling.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: uImage compression mode

It is possible to add configuration for gzip compression.

The default is none, no compression at all.

Signed-off-by: Noam Camus <noamc@ezchip.com>
Race between targets scripts_basic and asm-generic

This resolves race in make jobs (-j2 flag).
It happend when source tree is distcleaned (mrproper).

First job:
	running target asm-generic to generate all wrappers in architecure inlude/generated.
Second job:
	trying to compile empty.c since it is under taget always and it is dependency for __build.

The error is cause empty.o depends on some headers from arch/<arch>/include/generated/asm/.

This race hit once in a while and can be very annoying.

Signed-off-by: Noam Camus <noamc@ezchip.com>
Changed linux version to EXTRAVERSION = .EZchip_1.0
ARC: Reserve space address between STACK_TOP and TASK_SIZE

This reserved space is platform specific.
It can be used for any porpuse without overlapping user vaddr.

Signed-off-by: Noam Camus <noamc@ezchip.com>
ARC: add support for ioremap_prot API.
Implement ioremap_prot() to allow mapping IO memory with variable protection
via TLB.

Implementing this allows the /dev/mem driver to use its generic access()
VMA callback, which in turn allows ptrace to examine data in memory
mapped regions mapped via /dev/mem, such as Arc DCCM.

The end result is that it is possible to examine values of variables
placed into DCCM in user space programs via GDB.

ioremap_prot is forced to be uncached.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Acked-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>