ARM: 7670/1: fix the memset fix

Commit 455bd4c430b0 ("ARM: 7668/1: fix memset-related crashes caused by
recent GCC (4.7.2) optimizations") attempted to fix a compliance issue
with the memset return value.  However the memset itself became broken
by that patch for misaligned pointers.

This fixes the above by branching over the entry code from the
misaligned fixup code to avoid reloading the original pointer.

Also, because the function entry alignment is wrong in the Thumb mode
compilation, that fixup code is moved to the end.

While at it, the entry instructions are slightly reworked to help dual
issue pipelines.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arm: Move chained_irq_(enter|exit) to a generic file

These functions have been introduced by commit 10a8c383 (irq: introduce
entry and exit functions for chained handlers) in asm/mach/irq.h. This
patch moves them to linux/irqchip/chained_irq.h so that generic irqchip
drivers do not rely on architecture specific header files.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Rob Herring <rob.herring@calxeda.com>
lib: devres: Introduce devm_ioremap_resource()

The devm_request_and_ioremap() function is very useful and helps avoid a
whole lot of boilerplate. However, one issue that keeps popping up is
its lack of a specific error code to determine which of the steps that
it performs failed. Furthermore, while the function gives an example and
suggests what error code to return on failure, a wide variety of error
codes are used throughout the tree.

In an attempt to fix these problems, this patch adds a new function that
drivers can transition to. The devm_ioremap_resource() returns a pointer
to the remapped I/O memory on success or an ERR_PTR() encoded error code
on failure. Callers can check for failure using IS_ERR() and determine
its cause by extracting the error code using PTR_ERR().

devm_request_and_ioremap() is implemented as a wrapper around the new
API and return NULL on failure as before. This ensures that backwards
compatibility is maintained until all users have been converted to the
new API, at which point the old devm_request_and_ioremap() function
should be removed.

A semantic patch is included which can be used to convert from the old
devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
Some non-trivial cases may require manual intervention, though.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib: devres: Fix build breakage

The ERR_PTR() and IS_ERR() macros used by the devm_ioremap_resource()
function are defined in the linux/err.h header. On ARM this seems to be
pulled in by one of the other headers but the build fails at least on
OpenRISC.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
GPIO: xilinx: Simplify driver probe function

Simplification is done by using OF helper function
which increase readability of code and remove
(if (var) var = be32_to_cpup;) assignment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Synchronization with mainline version

Fix all issues which have been found in upstreaming
this driver.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Use __raw_readl/__raw_writel IO functions

This driver can be used on Xilinx ARM Zynq platform
where in_be32/out_be32 functions are not implemented.
Use __raw_readl/__raw_writel functions which are
implemented on Microblaze and PowerPC.
For ARM readl/writel functions are used instead.

The correct way how to implement this is to detect
endians directly on IP. But for the gpio case
without interrupt connected(it means without
interrupt logic) there are just 2 registers
data and tristate where auto detection can't be done.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Use BIT macro

Use BIT macro from linux/bitops.h.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Use standard coding style for macros

Trivial.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Fix kernel-doc mainline

Fix kernel-doc format in the whole driver not to report
any warning.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Add irq support to the driver

Only rising edge is supported.
Allocate irq chip per channel.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Do not allocate interrupts for IPs without IRQ support

Check if IP has IRQ connected. If not ignore IRQ allocation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
GPIO: xilinx: Do not use xgpiops but use only xgpio

It is typical c&p error because these functions
were taken from gpiops driver.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
gpio: xilinx: Fix type for irq_base

irq_alloc_descs() returns negative numbers
on error path. Use int type to capture it.

Bug was introduced by this commit:
"GPIO: xilinx: Add irq support to the driver"
(sha1: 796ae5e3e4ae5f550e0ba01ade34604c83b08cfd)

Reported-by: Kester Aernoudt <kestera@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
gpio: xilinx: Fix minor coding style issue.

Trivial.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
gpio: xilinx: Use platform_driver

Register driver as platform driver.
Based on this change, probe function uses devm_
which clear incorrect kfree(chip) usage.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
remoteproc: Do not use of_irq_count in xilinx drivers

Driver resources are already filled and driver can use them.
The reason is that of_irq_count() is not exported
for modules in the mainline.
The next patch which revert this patch which we have in our tree.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
remoteproc: mb: Remove not used zynq_cpun_start extern

Just clean up.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
remoteproc: Do not use moduleloader.h in the driver

It is causing compilation failure for multi_v7_defconfig.

Reported-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
remoteproc: mb: Update driver copyrights

Trivial.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>