ARM: at91: fix pinctrl and old gpio simultaneous support

No more compiling the old gpio driver when pinctrl is used leads to too many
compilation issues with current defconfigs. So still compile it but decide at
runtime if which driver to use.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
ARM: at91: enhance linux-at91 at91sam9x5 support

This patch enhances the linux-at91 at91sam9x5 support mainly by updating
device tree files to use latest drivers and to enable dma.
at91_dt_defconfig has also been updated to support features available on
at91sam9x5 family.

Known issue:
- dma-rx for dbgu is not working
- no support for audio
- no support for ISI
- no support for dataflash memory on Cogent cpu modules

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
dt: define of_find_device_by_node when dt is not enabled

Temporary workaround since some at91 drivers use this function even if dt is
not enabled causing compilation issue.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
ARM: at91/trivial: fix model name for SAM9G15-EK

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
ARM: at91/trivial: fix alsa driver module description with correct sama5d3 name
ARM: at91/trivial: fix typo in NFC driver comments
mtd: atmel_nand: avoid to report an error when lookup table offset is 0.

Before this patch, we assume the whole ROM code are mapping to memory. So
it is wrong if the lookup table offset is 0.

After this patch, we can map only the lookup table of ROM code to memory
intead of the whole ROM code (about 1M). In this case, one lookup table
offset can be 0.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
mtd: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional.

If those two are not specified in dts file, driver will find ecc requirement
in NAND ONFI parameters.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
mtd: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement.

This patch will check NAND flash's ecc minimum requirement in ONFI parameter.

1. if pmecc-cap, pmecc-sector-size is set in dts. then use it. Driver will
   print out a WARNING if the values are different from ONFI parameters.
2. if pmecc-cap, pmecc-sector-size is not set in dts, then use the value
   from ONFI parameters.
    * If ONFI ECC parameters are in ONFI extended parameter page, since we are
      not support it, so assume the minimum ecc requirement is 2 bits in 512
      bytes.
    * For non-ONFI support nand flash, also assume the minimum ecc requirement is
      2 bits in 512 bytes.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
sama5d3: reduce the lookup table size for PMECC.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
ARM: at91: sama5d3: reduce TWI internal clock frequency

There are still I2C unexpected behaviors which are solved by reducing TWI
internal frequency.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Input: atmel_tsadcc: fix compilation as a module

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Change internal SRAM memory type to "MT_MEMORY_SO"

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Change the internal SRAM memory type MT_MEMORY_NONCACHED

Because MT_DEVICE is not executable in armv7, we change
the the internal SRAM memory type to MT_MEMORY_SO as commit
5fe012d4aee98ef82df66e6763882c735902ed0f,
but MT_MEMORY_SO is strongly ordered, this feature is not required
for the internal SRAM memory.

So we change the internal SRAM memory type to MT_MEMORY_NONCACHED.
As it seems that caching this internal SRAM memory is not necessary,
we chose the this memory type.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
pm/ddr: make ddr-sdram enter self refresh mode when excuting pm and cpuidle

Change the implementation of function to be used on other boards with ddr-sdram.

inline void at91sam9g45_standby(void)
==>
inline void at91sam_ddr_standby(unsigned int bank)

Add support to at91sam9x5ek, at91sam9n12ek

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
pm/sama5d3: add pm support for sama5d3xek

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
pm: disable UPLL when excuting PM

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
mmc: atmel-mci: pio hang on block errors

The driver is doing, by default, multi-block reads. When a block error
occurs, card/block.c instigates a single block read: "mmcblk0: retrying
using single block read".  It leaves the sg chain intact and just changes
the length attribute for the first sg entry and the overall sg_len
parameter.  When atmci_read_data_pio is called to read the single block
of data it ignores the sg_len and expects to read more than 512 bytes as
it sees there are multiple items in the sg list. No more data comes as
the controller has only been commanded to get one block.

Signed-off-by: Terry Barnaby <terry@beam.ltd.uk>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Cc: stable <stable@vger.kernel.org> # 3.2+
Signed-off-by: Chris Ball <cjb@laptop.org>
dmaengine: at_hdmac: fix race condition in atc_advance_work()

The BUG_ON() directive is triggered probably due to a latency
modification following inclusion of commit c10d73671ad3 ("softirq:
reduce latencies").  This condition has not been met before 3.9-rc1 and
doesn't trigger without this patch.

We now make sure that DMA channel is idle before calling
atc_complete_all() which makes the BUG_ON() "protection" useless.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ARM: at91: add LUT entry to at91sam9g45 resources

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>