tty: xuartps: Fix RX hang, and TX corruption in termios call

The implementation of flushing the RX FIFO breaks in a number of cases,
it is impossible to ensure an complete flush of the RX FIFO due to the
hardware not allowing the use of the FIFOs when the receiver is disabled
(Reading from the FIFO register does not remove it from the FIFO when
the RX_EN=0 or RX_DIS=1). Additionally during an initial set_termios
call where RX_DIS=1 causes a hang waiting forever for the RX FIFO to
empty. On top of this the FIFO will be cleared by the use of the RXRST
bits on the Control Register, making the RX flush pointless (as it does
not preserve the data read anyway).

Due to the TXRST the TX FIFO and transmitter can be interrupted during
frame trasmission, causing corruption and additionally data lost in the
FIFO. Most other serial drivers do not flush or clear the FIFOs during
a termios configuration change and as such do not have issues with
corruption. For this UART controller is it required that the TXRST/RXRST
bit be flagged during the change, this means that the data in the FIFO
will be dropped when changing configuration. In order to prevent data
loss and corruption of the transmitted data, wait until the TX FIFO is
empty before changing the configuration. The performance of this may
cause the set_termios call to take a longer amount of time especially
on lower baud rates, however it is comparable to the same performance
hit that a console_write call costs.

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
Acked-by: Anirudha Sarangi <anirudh@xilinx.com>
Acked-by: Harini Katakam <harinik@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
spi: cadence: Init HW after reading devicetree attributes

This will make it possible to use the settings specified in the devicetree
to configure the hardware.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
spi: cadence: Fix 3-to-8 mux mode

In 3-to-8 mux mode for the CS pins we need to set the PERI_SEL bit in the
control register. Currently the driver never sets this bit even when
configured for 3-to-8 mux mode. This patch adds code which sets the bit
during device initialization when necessary.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Harini Katakam <harinik@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
i2c: cadence: Handle > 252 byte transfers

The I2C controller sends a NACK to the slave when transfer size register
reaches zero, irrespective of the hold bit. So, in order to handle transfers
greater than 252 bytes, the transfer size register has to be maintained at a
value >= 1. This patch implements the same.
The interrupt status is cleared at the beginning of the isr instead of
the end, to avoid missing any interrupts - this is in sync with the new
transfer handling.

Signed-off-by: Harini Katakam <harinik@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
i2c: cadence: cadence: Set the Hardware time-out register to MAX

This patch set Hardware time-out register value to MAX i.e 0xFF because
in master receiver mode, I2C master generates invalid read transactions
after time-out.

This is a cadence IP BUG.The issue happens even if the time-out interrupt
is disabled.

Writing value to time-out register will not avoid the issue completely but
reduce the chances of error.

Signed-off-by: Vishnu Motghare <vishnum@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
net: ethernet: xilinx: Get local MAC address from DTS

Get local MAC address from "local-mac-address" DTS property.
Used when u-boot does not set MAC address.

Signed-off-by: Davor Joja <davorjoja@logicbricks.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Radhey Shyam Pandey <radheys@xilinx.com>
ARM: zynq: DT: Add zc702 pushbuttons to DT as gpio-keys

Adds the two MIO connected pushbuttons on the zc702 board to the devicetree as a
single multi-key device for us with the gpio-keys driver.

This patch may require the leds patch (ARM: zynq: DT: Add LEDs to zc702 DT) in
order to apply correctly.

Signed-off-by: Ezra Savard <ezra.savard@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
zynq: usb: Fix modularization problems

Change Kconfig of USB_GADGET_XUSBPS from boolean to tristate so that the
Zynq USB peripheral driver can be built as a module.

Add a description to the Kconfig of USB_XUSBPS_DR_OF so that we can
choose to build it into the kernel when the rest of the Zynq USB drivers
are built as modules. The Zynq USB drivers don't work as modules unless
this piece is built into the kernel. Fixed USB Makefile for this as
well.

Export GPL symbol usb_port_suspend from usb/core/hub.c. The Zynq OTG
driver uses this function.

Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Merge branch 'master-next' of https://github.com/Xilinx/linux-xlnx into master-next