RT77744. lpc4350-eval: Merge partitions flash_uboot_image and flash_uboot_env

We do this to preserve the partition numbering used on all other Linux
Cortex-M targets. Particularly, we want to keep the JFFS2 partition on
`mtd2`.
RT #78451. Enable printascii() for LPC178X targets.
RT77920. lpc178x: Fix driver for I2C controller

 * Handle `Arbitration lost` status.
 * Clear the SI flag only after other flags and the data register is
ready, because this SI flag triggers the I2C controller to continue
operation.
 * Send correct ACK/NACK bits to tell the I2C slave where to stop data
transfer when reading from I2C slave.
leds: leds-pca9532 cleanups

- Remove unneeded input_free_device() after input_unregister_device().

- Add pca9532_destroy_devices() function for destroy devices.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/leds/leds-pca9532.c: add gpio capability

Allow unused leds on pca9532 to be used as gpio.  The board I am working
on now has no less than 6 pca9532 chips.  One chips is used for only leds,
one has 14 leds and 2 gpio and the rest of the chips are gpio only.

There is also one board in mainline which could use this capabilty;
arch/arm/mach-iop32x/n2100.c
 232         {       .type = PCA9532_TYPE_NONE }, /* power OFF gpio */
 233         {       .type = PCA9532_TYPE_NONE }, /* reset gpio */

This patch defines a new pin type, PCA9532_TYPE_GPIO, and registers a
gpiochip if any pin has this type set.  The gpio will registers all chip
pins but will filter on gpio_request.

[randy.dunlap@oracle.com: fix build when GPIOLIB is not enabled]
Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Jan Weitzel <j.weitzel@phytec.de>
Cc: Juergen Kilb <j.kilb@phytec.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Input: add input driver for polled GPIO buttons

The existing gpio-keys driver can be usable only for GPIO lines with
interrupt support. Several devices have buttons connected to a GPIO
line which is not capable to generate interrupts. This patch adds a
new input driver using the generic GPIO layer and the input-polldev
to support such buttons.

[Ben Gardiner <bengardiner@nanometrics.ca: fold code to use more
 of the original gpio_keys infrastructure; cleanups and other
 improvements.]

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Conflicts: (trivial)

	drivers/input/keyboard/Kconfig
	drivers/input/keyboard/Makefile
Input: gpio-keys - add support for disabling gpios through sysfs

Now gpio-keys input driver exports 4 new attributes to userland through
sysfs:
	/sys/devices/platform/gpio-keys/keys [ro]
	/sys/devices/platform/gpio-keys/switches [ro]
	/sys/devices/platform/gpio-keys/disabled_keys [rw]
	/sys/devices/platform/gpio-keys/disables_switches [rw]

With these attributes, userland program can read which keys and
switches can be disabled and then disable/enable them as needed.
Keys and switches are exported as stringified bitmap of codes
(keycodes or switch codes). For example keys 15, 89, 100, 101,
102 are exported as: '15,89,100-102'.

Description of the attributes:
	keys - bitmap of keys which can be disabled
	switches - bitmap of switches which can be disabled
	disabled_keys - bitmap of currently disabled keys
			(bit 1 means disabled, 0 enabled)
	disabled_switches - bitmap of currently disabled switches
			(bit 1 means disabled, 0 enabled)

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Input: gpio_keys - add hooks to enable/disable device

Allow platform code to specify callbcks that will be invoked when
input device is opened or closed, allowing, for example, to enable
the device.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
RT77920. lpc178x: Register MCU GPIOs with gpiolib

 * Move the GPIO controlling code from `include/mach/gpio.h` to `gpio.c`.
 * This change is required to enable GPIOLIB which is required for using
CONFIG_LEDS_PCA9532_GPIO.
RT77920. leds-pca9532: Support the `setup_gpio` callback

 * This callback runs after the gpio_chip is registered in the
`pca9532_probe()` function.
 * This callback does not run if there were no GPIOs declared in the
platform data for the driver (PCA9532_TYPE_GPIO).
 * This callback can be used to register some other devices that use the
GPIO lines provided by the `leds-pca9532` driver.
RT77920. ea-lpc1788: Register LEDs and polled keys connected to PCA9532

 * Register the 8 LEDs connected to the PCA9532 chip on the EA OEM Base
Board.
 * Register the GPIO lines of the PCA9532 connected to the 4 keys
SW2..SW5.
 * Register these keys as a keyboard using the driver
`gpio-keys-polled`.
RT78702. stm32_usart: Reset offsets in DMA buffers on reinitialization

After reinitialization performed in `stm_port_startup()`, the DMA
controller starts writing new data to the beginning of the first
buffer, therefore the buffer indices and offsets should be reset to 0
again. Otherwise we will be reading data from wrong positions in the
buffer.

`stm_port_startup()` is called on every `open()` system call, this is
why the bug described above manifests after the second `open()` call to
open one of the TTYs.
RT77744. lpc18xx: Fix software reset

The common Cortex-M reset method does not work on LPC4350 for some
reason. This is why we configure the watchdog timer to reset the MCU for
us.
RT78427. lpc18xx: Add support for Hitex LPC1850 Eval board

 * Update arch/arm/mach-lpc18xx/ to support the new board along with the
existing Hitex LPC4350 Eval board from a single kernel.
 * Add cases for PLATFORM_LPC18XX_HITEX_LPC1850_EVAL in the following
files (the algorithms for two boards have absolutely no differences):
  * clock.c
  * eth.c
  * nor-flash.c
 * The boards are distinguished at run-time based on the
`lpc18xx_platform=` kernel parameter passed by U-Boot to the kernel and
set to either `hitex-lpc4350` or `hitex-lpc1850`.
RT78329. stm32: Set baudrate when initializing UART port

 * USARTs other than used in U-Boot did not work.
 * Hardcode baud rate for additional USARTs to 115200.
 * Configure baud rate only if it was not set yet for the particular
USART (to avoid regression for people who set baudrate to values
other than 115200 in U-Boot).
RT78908 Changes to the SmartFusion Linux Ethernet driver to:

- make the size and location of the RX / TX rings build-time configurable
- enable kernel messages for those conditions in the Ethernet driver that are
viewed as critical mistakes
- clean-up in the driver messaging.