regulators: max8660: fix build warnings

Fix a build warning for !CONFIG_OF and a cast from void* to
unsigned int which is invalid on 64bit machines.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Daniel Mack <zonque@gmail.com>
ARM: pxa: add OF_DEV_AUXDATA for ssp ports

This is needed until we switch over to the common clk framework.

Signed-off-by: Daniel Mack <zonque@gmail.com>
ARM: pxa: fix pwri2c of_dev_auxdata entry

Signed-off-by: Daniel Mack <zonque@gmail.com>
ARM: pxa: augment nand DMA resources with names

Signed-off-by: Daniel Mack <zonque@gmail.com>
mtd: nand: pxa3xx: Use devm_kzalloc

Replace regular kzalloc with managed devm_kzalloc
which simplifies the error path.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Use devm_ioremap_resource

Using the new devm_ioremap_resource() we can greatly
simplify resource handling.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Use devm_clk_get

Replacing clk_get by managed devm_clk_get, the error path
can be greatly simplified.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Use clk_prepare_enable and clk_disable_unprepare

This patch converts the module to use clk_prepare_enable and
clk_disable_unprepare variants as required by common clock framework.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Check for clk_prepare_enable() return value

clk_prepare_enable() can fail due to unknown reason.
Add a check for this and return the error code if it fails.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Move buffer release code to its own function

Create a function to release the buffer and the dma channel, thus undoing
what pxa3xx_nand_init_buff() did. This commit makes the code more readable
and will allow to handle non-DMA capable platforms easier.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Set info->use_dma properly

Currently, the variable info->use_dma is never set and always
zero-valued which means the driver never does DMA transfers.
We fix this by simply setting info->use_dma to the module parameter,
also named 'use_dma'. Note that the module parameter has the same name,
but different semantics.

This fixes a regression introduced by the below commit
which removed the info->use_dma variable set.

  commit 4eb2da8994042d68e84e31138788429a102da2ea
  Author: Lei Wen <leiwen@marvell.com>
  Date:   Mon Feb 28 10:32:13 2011 +0800

      mtd: pxa3xx_nand: unify prepare command

Before the above commit, the driver had use_dma=1 on all NAND commands
except on CMD_STATUS. This behavior is long lost and we are not
recovering in this patch, either.

This was spotted and verified only by human inspection. No testing of
any kind has been performed for lack of hardware.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Use of_machine_is_compatible()

This patch replaces cpu_is_pxa3xx() with of_machine_is_compatible()
which allows to build this driver for other platforms than ARCH_PXA.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Fix MODULE_DEVICE_TABLE declaration

This module's device table is incorrectly declared using
i2c_pxa_dt_ids, instead of pxa3xx_nand_dt_ids.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Add address support for READID command

This allows to support READID ONFI command which sends 0x20
as address together with the 0x90 READID command.

This is required to detect ONFI compliant devices.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Add support for Read parameter page command

This command is required to identify ONFI-compliant devices.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx_nand: remove unnecessary platform_set_drvdata()

The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
mtd: nand: pxa3xx: Handle ECC and DMA enable/disable properly

When ECC is not selected, the ECC enable bit must be cleared
in the NAND control register. Same applies to DMA.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
mtd: nand: pxa3xx: Allow to set/clear the 'spare enable' field

Some commands (such as the ONFI parameter page read) need to
clear the 'spare enable' bit. This commit allows to set/clear
depending on the prepared command, instead of having it always
set.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
mtd: nand: pxa3xx: Support command buffer #3

Some newer controllers support a fourth command buffer. This additional
command buffer allows to set an arbitrary length count, using the
NDCB3.NDLENCNT field, to perform non-standard length operations
such as the ONFI parameter page read.

In controllers without this register, the operation has no effect.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
mtd: nand: pxa3xx: Use 'length override' in ONFI paramater page read

The ONFI command 'parameter page read' needs a non-standard length.
Therefore, we enable the 'length override' field in NDCB0 and set
a non-zero 'length count' in NDCB3.

Additionally, the 'spare enable' bit must be disabled for any command
that sets a non-zero 'length count' in NDCB3.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>