]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoASoC: core: Add signed register volume control logic
Markus Pargmann [Thu, 16 Jan 2014 15:02:10 +0000 (16:02 +0100)]
ASoC: core: Add signed register volume control logic

Some codecs use signed volume control representation with non standard
register sizes, e.g. 6 or 7 bit signed integers.

This patch adds generic signed register volume control logic to
soc-core. Instead of a fixed width signed register control, this
implementation uses a 'min' value and the signed bit location to translate
it to an absolute volume. Using the 'sign_bit' we can calculate a
correct mask for the register values and translate it back into signed
integers of standard size.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit f227b88f0fce5f9b82aa934f8829a741c2e06d82)

9 years agoARM: enable interactive as default cpufreq governor in imx_v7_defconfig
Anson Huang [Tue, 17 Jun 2014 07:27:46 +0000 (15:27 +0800)]
ARM: enable interactive as default cpufreq governor in imx_v7_defconfig

enable performance governor;
enable interactive as default cpufreq governor.

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agocpufreq: interactive: fix internal_create_group failure
Anson Huang [Tue, 17 Jun 2014 07:13:59 +0000 (15:13 +0800)]
cpufreq: interactive: fix internal_create_group failure

when interactive governor try to register sysfs interface,
need to make sure global kobject is initialized first,
otherwise, it will cause kernel Oops:

------------[ cut here ]------------
Kernel BUG at 80128178 [verbose debug info unavailable]
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.7+ #2883
task: ab078000 ti: ab05e000 task.ti: ab05e000
PC is at internal_create_group+0x1f4/0x230
LR is at cpufreq_governor_interactive+0x114/0x4f0
pc : [<80128178>]    lr : [<8043232c>]    psr: 60000113
sp : ab05fc48  ip : 00000063  fp : aaa3a128
r10: 8093c510  r9 : aaa3a0c0  r8 : 808d5834
r7 : 00000000  r6 : ab109200  r5 : aaa3a0c0  r4 : ab109200
r3 : 808d5aa4  r2 : 808d5834  r1 : 00000000  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 1000404a  DAC: 00000015
Process swapper/0 (pid: 1, stack limit = 0xab05e240)
Stack: (0xab05fc48 to 0xab060000)

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agocpufreq: add interactive governor support
Anson Huang [Tue, 17 Jun 2014 05:33:17 +0000 (13:33 +0800)]
cpufreq: add interactive governor support

This patch adds interactive governor support, the original files
are coming from google android experimental android-3.14 branch,
latest commit is:

c0eb5f75d cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agoARM: Call idle notifiers
Todd Poynor [Thu, 16 Jun 2011 00:44:50 +0000 (17:44 -0700)]
ARM: Call idle notifiers

Change-Id: Id833e61c13baa1783705ac9e9046d1f0cc90c95e
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
9 years agoMove x86_64 idle notifiers to generic
Todd Poynor [Thu, 16 Jun 2011 00:21:57 +0000 (17:21 -0700)]
Move x86_64 idle notifiers to generic

Move the x86_64 idle notifiers originally by Andi Kleen and Venkatesh
Pallipadi to generic.

Change-Id: Idf29cda15be151f494ff245933c12462643388d5
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
9 years agoENGR00381674 ARM: imx_v7_defconfig: enable the SPI NOR subsystem
Huang Shijie [Tue, 17 Jun 2014 06:15:50 +0000 (14:15 +0800)]
ENGR00381674 ARM: imx_v7_defconfig: enable the SPI NOR subsystem

Enable the SPI NOR subsystem which is used by the m25p80.c and our
qspi driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: allow to be built as module
Brian Norris [Thu, 10 Apr 2014 18:05:34 +0000 (11:05 -0700)]
mtd: spi-nor: allow to be built as module

There's no reason this can't be a module. Also, give SPI-NOR its own
submenu.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: shorten Kconfig naming
Brian Norris [Wed, 9 Apr 2014 03:30:25 +0000 (20:30 -0700)]
mtd: spi-nor: shorten Kconfig naming

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand_bbt: remove unused variable
Brian Norris [Fri, 3 Jan 2014 01:14:10 +0000 (17:14 -0800)]
mtd: nand_bbt: remove unused variable

Set, but unused, variable.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand_bbt: handle error case for nand_create_badblock_pattern()
Brian Norris [Wed, 21 May 2014 05:34:40 +0000 (22:34 -0700)]
mtd: nand_bbt: handle error case for nand_create_badblock_pattern()

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: add support for SanDisk SDTNRGAMA-008G
Huang Shijie [Fri, 3 Jan 2014 05:37:03 +0000 (13:37 +0800)]
mtd: nand: add support for SanDisk SDTNRGAMA-008G

The datasheet does not tell us how to parse out the ID data,
so handle it as a full ID nand.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: Warn the user if the selected ECC strength is too weak
Ezequiel Garcia [Wed, 14 May 2014 17:58:06 +0000 (14:58 -0300)]
mtd: nand: Warn the user if the selected ECC strength is too weak

This commit makes use of the chip->ecc_strength_ds and chip->ecc_step_ds which
contain the datasheet minimum requested ECC strength to produce a noisy warning
if the configured ECC strength is weaker.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoNAND_ECC_SOFT_BCH can support subpage reads too
Ron Lee [Fri, 25 Apr 2014 05:31:35 +0000 (15:01 +0930)]
NAND_ECC_SOFT_BCH can support subpage reads too

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix a typo in a comment line
Masahiro Yamada [Wed, 9 Apr 2014 07:26:26 +0000 (16:26 +0900)]
mtd: nand: fix a typo in a comment line

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: use the nand_read_subpage index everywhere
Ron [Sat, 15 Mar 2014 17:31:08 +0000 (04:01 +1030)]
mtd: nand: use the nand_read_subpage index everywhere

Now that the index variable is correctly set earlier in this function
we can use it in other places that compute the same thing too.

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoFix index regression in nand_read_subpage
Ron [Sat, 15 Mar 2014 17:31:07 +0000 (04:01 +1030)]
Fix index regression in nand_read_subpage

Commit 7351d3a5dbf42ba3299af71db3296be447bc1516 added an index variable
as part of fixing checkpatch warnings, presumably as a tool to make some
long lines shorter, however it only set that index in the case of there
being no gaps in eccpos for the fragment being read.  Which means the
later step of filling ecccode from oob_poi will use the wrong indexing
into eccpos in that case.

This patch restores the behaviour that existed prior to that change.

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH
Erico Nunes [Tue, 11 Mar 2014 04:31:26 +0000 (01:31 -0300)]
mtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH

Mention to CONFIG_MTD_ECC_BCH in the warning message can be confusing as this
doesn't match the exact name of the configuration option.
This warning showed up once to me when I was starting to set up BCH. After
checking my .config file, it took a moment before realizing it is
CONFIG_MTD_NAND_ECC_BCH instead of CONFIG_MTD_ECC_BCH.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: remove unused function input parameter
Cai Zhiyong [Wed, 25 Dec 2013 12:11:15 +0000 (20:11 +0800)]
mtd: nand: remove unused function input parameter

The nand_get_flash_type parameter "busw" input value is not used by any
branch, and it is updated before use it in the function, so remove it,
define the "busw" as an internal variable.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: print out the right information for JEDEC compliant NAND
Huang Shijie [Fri, 21 Feb 2014 05:39:41 +0000 (13:39 +0800)]
mtd: nand: print out the right information for JEDEC compliant NAND

Check the chip->jedec_version, and print out the right information
for JEDEC compliant NAND.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: Add support to use nand_base poi databuf as bounce buffer
Kamal Dasu [Fri, 2 May 2014 00:51:19 +0000 (20:51 -0400)]
mtd: nand: Add support to use nand_base poi databuf as bounce buffer

nand_base can be passed a kmap()'d buffers from highmem by
filesystems like jffs2. This results in failure to map the
physical address of the DMA buffer on various contoller
driver on different platforms. This change adds a chip option
to use preallocated databuf as bounce buffers used in
nand_do_read_ops() and nand_do_write_ops().
This allows for specific nand controller driver to set this
option as needed.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: refactor erase_cmd() to return chip status
Brian Norris [Tue, 6 May 2014 23:02:19 +0000 (16:02 -0700)]
mtd: nand: refactor erase_cmd() to return chip status

The nand_chip::erase_cmd callback previously served a dual purpose; for
one, it allowed a per-flash-chip override, so that AG-AND devices could
use a different erase command than other NAND. These AND devices were
dropped in commit 14c6578683367b1e7af0c3c09e872b45a45183a7 (mtd: nand:
remove AG-AND support). On the other hand, some drivers (denali and
doc-g4) need to use this sort of callback to implement
controller-specific erase operations.

To make the latter operation easier for some drivers (e.g., ST's new BCH
NAND driver), it helps if the command dispatch and wait functions can be
lumped together, rather than called separately.

This patch does two things:
 1. Pull the call to chip->waitfunc() into chip->erase_cmd(), and return
    the status from this callback
 2. Rename erase_cmd() to just erase(), since this callback does a
    little more than just send a command

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix GET/SET_FEATURES address on 16-bit devices
David Mosberger [Fri, 21 Mar 2014 22:05:10 +0000 (16:05 -0600)]
mtd: nand: fix GET/SET_FEATURES address on 16-bit devices

GET_FEATURES and SET_FEATURES also need byte-addressing on 16-bit devices.

Signed-off-by: David Mosberger <davidm@egauge.net>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: parse out the JEDEC compliant NAND
Huang Shijie [Fri, 21 Feb 2014 05:39:40 +0000 (13:39 +0800)]
mtd: nand: parse out the JEDEC compliant NAND

This patch adds the parsing code for the JEDEC compliant NAND.

Since we need the 0x40 as the column address, this patch also
makes the NAND_CMD_PARAM to use the 8-bit address only.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add a helper to get the supported features for JEDEC
Huang Shijie [Fri, 21 Feb 2014 05:39:39 +0000 (13:39 +0800)]
mtd: nand: add a helper to get the supported features for JEDEC

Add a helper to get the supported features for JEDEC compliant NAND.
Also add a macro JEDEC_FEATURE_16_BIT_BUS.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add fields for JEDEC in nand_chip
Huang Shijie [Fri, 21 Feb 2014 05:39:38 +0000 (13:39 +0800)]
mtd: nand: add fields for JEDEC in nand_chip

Add the jedec_version field, and add an anonymous union which
contains the nand_onfi_params and nand_jedec_params.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add the data structures for JEDEC parameter page
Huang Shijie [Fri, 21 Feb 2014 05:39:37 +0000 (13:39 +0800)]
mtd: nand: add the data structures for JEDEC parameter page

Create the nand_jedec_params{} and jedec_ecc_info{} according to
the JESD230A (Revision of JESD230, October 2012).

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: remove the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE
Huang Shijie [Fri, 20 Dec 2013 16:02:30 +0000 (00:02 +0800)]
mtd: nand: remove the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE

There is no reference to these two macros now.
Just remove them.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix erroneous read_buf call in nand_write_page_raw_syndrome
Boris BREZILLON [Sat, 1 Feb 2014 18:10:28 +0000 (19:10 +0100)]
mtd: nand: fix erroneous read_buf call in nand_write_page_raw_syndrome

read_buf is called in place of write_buf in the
nand_write_page_raw_syndrome function.

Signed-off-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: don't use read_buf for 8-bit ONFI transfers
Brian Norris [Sat, 30 Nov 2013 06:04:28 +0000 (22:04 -0800)]
mtd: nand: don't use read_buf for 8-bit ONFI transfers

Use a repeated read_byte() instead of read_buf(), since for x16 buswidth
devices, we need to avoid the upper I/O[16:9] bits. See the following
commit for reference:

commit 05f7835975dad6b3b517f9e23415985e648fb875
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Dec 5 22:22:04 2013 +0100

    mtd: nand: don't use {read,write}_buf for 8-bit transfers

Now, I think that all barriers to probing ONFI on x16 devices are
removed, so remove the check from nand_flash_detect_onfi().

Tested on 8-bit ONFI NAND (Micron MT29F32G08CBADAWP).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-By: Pekon Gupta <pekon@ti.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: force NAND_CMD_READID onto 8-bit bus
Brian Norris [Wed, 29 Jan 2014 22:08:12 +0000 (14:08 -0800)]
mtd: nand: force NAND_CMD_READID onto 8-bit bus

The NAND command helpers tend to automatically shift the column address
for x16 bus devices, since most commands expect a word address, not a
byte address. The Read ID command, however, expects an 8-bit address
(i.e., 0x00, 0x20, or 0x40 should not be translated to 0x00, 0x10, or
0x20).

This fixes the column address for a few drivers which imitate the
nand_base defaults. Note that I don't touch sh_flctl.c, since it already
handles this problem slightly differently (note its comment "READID is
always performed using an 8-bit bus").

I have not tested this patch, as I only have x8 parts up for testing at
this point. Hopefully that can change soon...

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-By: Pekon Gupta <pekon@ti.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{}
Huang Shijie [Mon, 13 Jan 2014 06:27:12 +0000 (14:27 +0800)]
mtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{}

The patch converts the arrays to buffer pointers for nand_buffers{}.

The cafe_nand.c is the only NAND_OWN_BUFFERS user which allocates
nand_buffers{} itself.

This patch disables the DMA for nand_scan_ident, and restores the DMA
status after we finish the nand_scan_ident. This way, we can get page
size and OOB size and use them to allocate cafe->dmabuf.

Since the cafe_nand.c uses the NAND_ECC_HW_SYNDROME ECC mode, we do not
allocate the buffers for @ecccalc and @ecccode.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agoENGR00317981: ARM: remove DEBUG_LL from imx_v7_defconfig
Shawn Guo [Tue, 17 Jun 2014 06:02:40 +0000 (14:02 +0800)]
ENGR00317981: ARM: remove DEBUG_LL from imx_v7_defconfig

The CONFIG_DEBUG_LL should only be enabled for debugging early boot
issue on particular board.  Let's drop it from defconfig.

Note, CONFIG_MTD_M25P80 is dropped by running savedefconfig.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: ARM: enable SOC_IMX6SX in imx_v7_defconfig
Shawn Guo [Tue, 17 Jun 2014 05:34:09 +0000 (13:34 +0800)]
ENGR00317981: ARM: enable SOC_IMX6SX in imx_v7_defconfig

Enable i.MX6 SoloX support in imx_v7_defconfig.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: ARM: dts: imx6sx: tempmon is not compatiable with imx6q
Shawn Guo [Tue, 17 Jun 2014 05:27:16 +0000 (13:27 +0800)]
ENGR00317981: ARM: dts: imx6sx: tempmon is not compatiable with imx6q

The TEMPMON on imx6q has only one alarm value to program, while the one
on imx6sx support 3, Panic, High and Low.  So let's drop
fsl,imx6q-tempmon from its compatible.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx: add initial imx6sx-sdb board support
Shawn Guo [Tue, 13 May 2014 13:43:36 +0000 (21:43 +0800)]
ARM: dts: imx: add initial imx6sx-sdb board support

Add initial imx6sx-sdb board support with limited devices enabled.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit eeaa11f9ee61 from community IMX tree]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
arch/arm/boot/dts/Makefile

9 years agoARM: dts: imx: add initial imx6sx device tree source
Shawn Guo [Tue, 13 May 2014 12:21:35 +0000 (20:21 +0800)]
ARM: dts: imx: add initial imx6sx device tree source

Add initial device tree source for i.MX6 SoloX SoC.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit ab6c4d16a3b9 from community IMX tree]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx: add pin function header for imx6sx
Shawn Guo [Sun, 11 May 2014 13:59:26 +0000 (21:59 +0800)]
ARM: dts: imx: add pin function header for imx6sx

Add pin function header for i.MX6 SoloX SoC.

[shawn.guo: cherry-pick commit 51518f11f174 from community IMX tree]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx: add basic imx6sx SoC support
Shawn Guo [Tue, 13 May 2014 13:46:16 +0000 (21:46 +0800)]
ARM: imx: add basic imx6sx SoC support

Add basic suppport for i.MX6 SoloX SoC.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit d9654dceb315 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx: add clock driver for imx6sx
Anson Huang [Sun, 11 May 2014 14:47:09 +0000 (22:47 +0800)]
ARM: imx: add clock driver for imx6sx

Add clock driver for i.MX6 SoloX SoC.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit d55135689019 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx: add low-level debug support for imx6sx
Shawn Guo [Sun, 11 May 2014 13:53:48 +0000 (21:53 +0800)]
ARM: imx: add low-level debug support for imx6sx

Enable low-level debug support for i.MX6 SoloX by adding the debug
port definitions for the SoC.

[shawn.guo: cherry-pick commit 74368e81b119 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agopinctrl: add pinctrl driver for imx6sx
Anson Huang [Mon, 12 May 2014 15:10:35 +0000 (23:10 +0800)]
pinctrl: add pinctrl driver for imx6sx

Add a pinctrl driver for i.MX6 SoloX based on pinctrl-imx core
driver.

Signed-off-by: Anson Huang <b20788@freescale.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[shawn.guo: cherry-pick commit 2cc140fe3607 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx: factor device tree timer initialization
Gilles Chanteperdrix [Sat, 5 Apr 2014 15:57:45 +0000 (17:57 +0200)]
ARM: imx: factor device tree timer initialization

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
[shawn.guo: cherry-pick commit 876292d66791 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
arch/arm/mach-imx/clk-imx6sl.c

9 years agoENGR00300890-1 mtd: fix the build error
Huang Shijie [Wed, 26 Feb 2014 04:05:56 +0000 (12:05 +0800)]
ENGR00300890-1 mtd: fix the build error

We may meet the built error:
------------------------------------------------------
drivers/built-in.o: In function `m25p_probe:
clk-composite.c:(.text+0xed7b4): undefined reference to `spi_nor_scan
drivers/built-in.o: In function `.LANCHOR1:
clk-composite.c:(.data+0xe4a0): undefined reference to `spi_nor_ids
make: *** [vmlinux] Error 1
------------------------------------------------------
This error is caused by the missing dependency of SPI NOR framework.

Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoserial: imx: disable the receiver ready interrupt for imx_stop_rx
Huang Shijie [Fri, 23 May 2014 04:32:54 +0000 (12:32 +0800)]
serial: imx: disable the receiver ready interrupt for imx_stop_rx

This patch disables the receiver ready interrupt for imx_stop_rx.
It reduces the interrupt numbers when the uart is going to close
or suspend.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoserial: imx: remove the redundant code
Huang Shijie [Wed, 21 May 2014 01:09:47 +0000 (09:09 +0800)]
serial: imx: remove the redundant code

In the imx_startup(), we will reset the uart port which will reset all
the FIFOs, including the URXD.

So the code to clear the RX FIFO is redundant. Just remove it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoserial: imx: reset the uart port all the time
Huang Shijie [Wed, 21 May 2014 00:56:28 +0000 (08:56 +0800)]
serial: imx: reset the uart port all the time

Current code resets the uart port only when it supports the irda mode.
In actually, we also need to reset the uart port in the non-irda mode.
A hang was caught in the following case:

    UART A transmits data to the other end. But the transmission maybe
    terminated. In some corner case, the TX FIFO maybe not empty.

The kernel will hang at the imx_set_termios():
............................................................
while (!(readl(sport->port.membase + USR2) & USR2_TXDC))
barrier();
............................................................

This patch resets the uart port all the time in the imx_startup().
And fix the hang.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoserial: imx: Disable new features of autobaud detection
Fabio Estevam [Wed, 14 May 2014 18:55:03 +0000 (15:55 -0300)]
serial: imx: Disable new features of autobaud detection

Bit 7 of UCR3 is described in the i.MX reference manuals (with the exception
of i.MX1) as follows:

ADNIMP: Autobaud Detection Not Improved-. Disables new features of
autobaud detection (See Baud Rate Automatic Detection
Protocol, for more details).

0 Autobaud detection new features selected
1 Keep old autobaud detection mechanism

The "new features" mechanism occasionally cause the receiver to get out of sync
and continuously produce received characters of '\xff'.

In order to reproduce the problem:

$ stty -F /dev/ttymxc0 19200

- Change the terminal baudrate to 19200

- Type in the console and it should look good

- Change the terminal baudrate back to 115200

- Type 'b' in the console, then a stream of garbage characters is seen.

Also rename the bit definition as per the reference manual.

Tested on mx6q, mx6dl, mx6solo and mx53.

Based on a patch from Eric Nelson for U-boot.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Eric Nelson <eric.nelson@boundarydevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoserial: imx: Remove init() and exit() platform callbacks
Alexander Shiyan [Sat, 22 Feb 2014 12:01:35 +0000 (16:01 +0400)]
serial: imx: Remove init() and exit() platform callbacks

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoserial: imx: Use dev_name() for request_irq() to distinguish UARTs
Alexander Shiyan [Sat, 22 Feb 2014 12:01:34 +0000 (16:01 +0400)]
serial: imx: Use dev_name() for request_irq() to distinguish UARTs

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoserial: imx: Use devm_ioremap_resource()
Alexander Shiyan [Sat, 22 Feb 2014 12:01:33 +0000 (16:01 +0400)]
serial: imx: Use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler and
it gives proper codes on errors.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoserial: imx: always wake up the processes in the TX callback
Huang Shijie [Wed, 22 Jan 2014 08:23:37 +0000 (16:23 +0800)]
serial: imx: always wake up the processes in the TX callback

The current code only wakes up the processes when the circle
buffer has less data then the WAKEUP_CHARS.

But sometimes, the circle buffer may has data more then the WAKEUP_CHARS,
in such case, the processes will hang.

This patch makes it always wakes up the processes in the TX callback.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoARM: clk: imx: remove the CLK_SET_RATE_NO_REPARENT for imx_clk_mux_flags
Huang Shijie [Mon, 26 May 2014 07:31:14 +0000 (15:31 +0800)]
ARM: clk: imx: remove the CLK_SET_RATE_NO_REPARENT for imx_clk_mux_flags

The clocks for Quadspi controller may be different when different
NOR flashes are connected to the board.

But the CLK_SET_RATE_NO_REPARENT flag in the current imx_clk_mux_flags
makes the clock do not have the re-parent capability.

This patch removes the CLK_SET_RATE_NO_REPARENT for imx_clk_mux_flags.
It makes the Quadspi happy.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agomtd: nand: add "page" argument for read_subpage hook
Huang Shijie [Fri, 3 Jan 2014 03:01:40 +0000 (11:01 +0800)]
mtd: nand: add "page" argument for read_subpage hook

Add the "page" argument for the read_subpage hook. With this argument,
the implementation of this hook could prints out more accurate information
for debugging.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: gpmi: add gpmi support for imx6sx
Huang Shijie [Thu, 27 Mar 2014 02:43:22 +0000 (10:43 +0800)]
mtd: gpmi: add gpmi support for imx6sx

The gpmi's IP for imx6sx is nearly the same as the gpmi's IP for imx6q,
except the following two new features:

     (1) the new BCH contoller has 62-BIT correcting ECC strength
            (The BCH for imx6q only has 40-BIT ECC strength).

     (2) add the hardware Randomizer support.

This patch does the follow changes:

     (1) add a new macro GPMI_IS_MX6SX to represent the imx6sx's gpmi.

     (2) add a new macro GPMI_IS_MX6.
           We use this macro to initialize the same registers for both
         imx6sx and imx6q, and so on.

     (3) add a new gpmi_devdata instance, the gpmi_devdata_imx6sx, for
         imx6sx.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: gpmi: add gpmi_devdata{} to simplify the code
Huang Shijie [Fri, 21 Mar 2014 10:19:39 +0000 (18:19 +0800)]
mtd: gpmi: add gpmi_devdata{} to simplify the code

More and more chips use the GPMI controller, but these chips may use different
version of the IPs for GPMI and BCH. Different IPs have
 different features, such as the BCH's maximum ECC strength:

     imx23/imx28 -- the BCH's maximum ECC strength is 20
     imx6q       -- the BCH's maximum ECC strength is 40
     imx6sx      -- the BCH's maximum ECC strength is 62

This patch does the following things:

  [1] add a new data structure, gpmi_devdata{}, to store the information for
      each IP. Besides the IP version, we store the following information:
         <1> BCH's maximum ECC strength.
         <2> the maximum chain delay in ns used by the EDO mode.

      but we may add more information in future.

  [2] add the gpmi_devdata_imx{23|28|6q} to replace the gpmi_ids.

  [3] simplify the code by using the ECC strength from gpmi_devdata, such as
      gpmi_check_ecc() and legacy_set_geometry();

  [4] use the maximum chain delay to initialize the EDO mode,
      see gpmi_compute_edo_timing().

  [5] rewrite the macros, such GPMI_IS_MX{23|28|6Q}.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: gpmi: add subpage read support
Huang Shijie [Fri, 3 Jan 2014 03:01:42 +0000 (11:01 +0800)]
mtd: gpmi: add subpage read support

1) Why add the subpage read support?
  The page size of the nand chip becomes larger and larger, the imx6 has to
  supports the 16K page or even bigger page. But sometimes, the upper layer only
  needs a small part of the page, such as 512 bytes or less.

  For example, ubiattach may only read 64 bytes per page.

2) We only enable the subpage read support when it meets the conditions:
   <1> the chip is imx6 (or later chips) which can supports large nand page.
   <2> the size of ECC parity is byte aligned.
       If the size of ECC parity is not byte aligned, the calling of NAND_CMD_RNDOUT
       will fail.

3) What does this patch do?
   This patch will fake a virtual small page for the subpage read, and call the
   gpmi_ecc_read_page() to do the real work.

   In order to fake a virtual small page, the patch changes the BCH registers and
   the bch_geometry{}. After the subpage read finished, we will restore them back.

4) Performace:
    4.1) Tested with Toshiba TC58NVG2S0F(4096 + 224) with the following command:
         #ubiattach /dev/ubi_ctrl -m 4

       The detail information of /dev/mtd4 shows below:
       --------------------------------------------------------------
       #mtdinfo /dev/mtd4
        mtd4
        Name:                           test
        Type:                           nand
        Eraseblock size:                262144 bytes, 256.0 KiB
        Amount of eraseblocks:          1856 (486539264 bytes, 464.0 MiB)
        Minimum input/output unit size: 4096 bytes
        Sub-page size:                  4096 bytes
        OOB size:                       224 bytes
        Character device major/minor:   90:8
        Bad blocks are allowed:         true
        Device is writable:             true
       --------------------------------------------------------------

    4.2) Before this patch:
       --------------------------------------------------------------
       [   94.530495] UBI: attaching mtd4 to ubi0
       [   98.928850] UBI: scanning is finished
       [   98.953594] UBI: attached mtd4 (name "test", size 464 MiB) to ubi0
       [   98.958562] UBI: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
       [   98.964076] UBI: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
       [   98.969518] UBI: VID header offset: 4096 (aligned 4096), data offset: 8192
       [   98.975128] UBI: good PEBs: 1856, bad PEBs: 0, corrupted PEBs: 0
       [   98.979843] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
       [   98.985878] UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 2024916145
       [   98.993635] UBI: available PEBs: 0, total reserved PEBs: 1856, PEBs reserved for bad PEB handling: 40
       [   99.001807] UBI: background thread "ubi_bgt0d" started, PID 831
       --------------------------------------------------------------
       The attach time is about 98.9 - 94.5 = 4.4s

    4.3) After this patch:
       --------------------------------------------------------------
       [  286.464906] UBI: attaching mtd4 to ubi0
       [  289.186129] UBI: scanning is finished
       [  289.211416] UBI: attached mtd4 (name "test", size 464 MiB) to ubi0
       [  289.216360] UBI: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
       [  289.221858] UBI: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
       [  289.227293] UBI: VID header offset: 4096 (aligned 4096), data offset: 8192
       [  289.232878] UBI: good PEBs: 1856, bad PEBs: 0, corrupted PEBs: 0
       [  289.237628] UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
       [  289.243553] UBI: max/mean erase counter: 1/1, WL threshold: 4096, image sequence number: 2024916145
       [  289.251348] UBI: available PEBs: 1812, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
       [  289.259417] UBI: background thread "ubi_bgt0d" started, PID 847
       --------------------------------------------------------------
       The attach time is about 289.18 - 286.46 = 2.7s

     4.4) The conclusion:
       We achieve (4.4 - 2.7) / 4.4 = 38.6% faster in the ubiattach.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: gpmi: do not use the mtd->writesize
Huang Shijie [Fri, 3 Jan 2014 03:01:41 +0000 (11:01 +0800)]
mtd: gpmi: do not use the mtd->writesize

The nfc_geo->payload_size is equal to the mtd->writesize now,
use the nfc_geo->payload_size to replace the mtd->writesize.

This patch makes preparation for the gpmi's subpage read support.
In the subpage support, the nfc_geo->payload_size maybe smaller then
the mtd->writesize.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agoARM: imx/mxs defconfigs: add MTD_SPI_NOR (new dependency for M25P80)
Brian Norris [Thu, 1 May 2014 06:26:36 +0000 (23:26 -0700)]
ARM: imx/mxs defconfigs: add MTD_SPI_NOR (new dependency for M25P80)

These defconfigs contain the CONFIG_M25P80 symbol, which is now
dependent on the MTD_SPI_NOR symbol. Add CONFIG_MTD_SPI_NOR to satisfy
the new dependency.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoDocumentation: spi-nor: rewrite some portions
Brian Norris [Wed, 9 Apr 2014 03:17:04 +0000 (20:17 -0700)]
Documentation: spi-nor: rewrite some portions

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: Enable Dual and Quad SPI read transfers for s25sl032p
Geert Uytterhoeven [Tue, 22 Apr 2014 12:45:32 +0000 (14:45 +0200)]
mtd: spi-nor: Enable Dual and Quad SPI read transfers for s25sl032p

Spansion s25sl032p supports Dual and Quad SPI transfers, hence set the
SPI_NOR_DUAL_READ and SPI_NOR_QUAD_READ flags.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: unify read opcode variants with ST SPI FSM
Brian Norris [Wed, 9 Apr 2014 02:16:49 +0000 (19:16 -0700)]
mtd: spi-nor: unify read opcode variants with ST SPI FSM

serial_flash_cmds.h defines our opcodes a little differently. Let's
borrow its naming, since it's borrowed from the SFDP standard, and it's
more extensible.

This prepares us for merging serial_flash_cmds.h and spi-nor.h opcode
listing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*
Brian Norris [Wed, 9 Apr 2014 01:15:31 +0000 (18:15 -0700)]
mtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*

Qualify these with a better namespace, and prepare them for use in more
drivers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: add the copyright information
Huang Shijie [Thu, 10 Apr 2014 08:27:28 +0000 (16:27 +0800)]
mtd: spi-nor: add the copyright information

Add the copyright information for spi-nor.c and spi-nor.h.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: spi-nor: EXPORT symbols which could be used by module drivers
Brian Norris [Wed, 9 Apr 2014 01:22:57 +0000 (18:22 -0700)]
mtd: spi-nor: EXPORT symbols which could be used by module drivers

Fix errors like this:

    ERROR: "spi_nor_ids" [drivers/mtd/devices/m25p80.ko] undefined!
    ERROR: "spi_nor_scan" [drivers/mtd/devices/m25p80.ko] undefined!
    make[1]: *** [__modpost] Error 1
    make: *** [modules] Error 2

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: fsl-quadspi: fix __iomem annotations
Brian Norris [Thu, 10 Apr 2014 22:49:38 +0000 (15:49 -0700)]
mtd: fsl-quadspi: fix __iomem annotations

This corrects some sparse warnings:

   drivers/mtd/spi-nor/fsl-quadspi.c:281:31: warning: incorrect type in initializer (different address spaces) [sparse]
   drivers/mtd/spi-nor/fsl-quadspi.c:281:31:    expected void *[noderef] <asn:2>base [sparse]
   drivers/mtd/spi-nor/fsl-quadspi.c:281:31:    got void [noderef] <asn:2>*iobase [sparse]
   (etc.)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: unify read opcode variants with ST SPI FSM
Brian Norris [Wed, 9 Apr 2014 02:16:49 +0000 (19:16 -0700)]
mtd: spi-nor: unify read opcode variants with ST SPI FSM

serial_flash_cmds.h defines our opcodes a little differently. Let's
borrow its naming, since it's borrowed from the SFDP standard, and it's
more extensible.

This prepares us for merging serial_flash_cmds.h and spi-nor.h opcode
listing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*
Brian Norris [Wed, 9 Apr 2014 01:15:31 +0000 (18:15 -0700)]
mtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*

Qualify these with a better namespace, and prepare them for use in more
drivers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: unify read opcode variants with ST SPI FSM
Brian Norris [Wed, 9 Apr 2014 02:16:49 +0000 (19:16 -0700)]
mtd: spi-nor: unify read opcode variants with ST SPI FSM

serial_flash_cmds.h defines our opcodes a little differently. Let's
borrow its naming, since it's borrowed from the SFDP standard, and it's
more extensible.

This prepares us for merging serial_flash_cmds.h and spi-nor.h opcode
listing.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*
Brian Norris [Wed, 9 Apr 2014 01:15:31 +0000 (18:15 -0700)]
mtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*

Qualify these with a better namespace, and prepare them for use in more
drivers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: drop \t after #define
Brian Norris [Wed, 9 Apr 2014 01:10:23 +0000 (18:10 -0700)]
mtd: spi-nor: drop \t after #define

Spacing is a little non-standard here. Fix up tabs vs. spaces.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: Add Freescale QuadSPI driver
Huang Shijie [Mon, 24 Feb 2014 10:37:42 +0000 (18:37 +0800)]
mtd: spi-nor: Add Freescale QuadSPI driver

(0) What is the QuadSPI controller?

    The QuadSPI(Quad Serial Peripheral Interface) acts as an interface to
    one single or two external serial flash devices, each with up to 4
    bidirectional data lines.

(1) The QuadSPI controller is driven by the LUT(Look-up Table) registers.
    The LUT registers are a look-up-table for sequences of instructions.
    A valid sequence consists of four LUT registers.

(2) The definition of the LUT register shows below:

    ---------------------------------------------------
    | INSTR1 | PAD1 | OPRND1 | INSTR0 | PAD0 | OPRND0 |
    ---------------------------------------------------

    There are several types of INSTRx, such as:
CMD : the SPI NOR command.
ADDR : the address for the SPI NOR command.
DUMMY : the dummy cycles needed by the SPI NOR command.
....

    There are several types of PADx, such as:
PAD1 : use a singe I/O line.
PAD2 : use two I/O lines.
PAD4 : use quad I/O lines.
....

(3) Test this driver with the JFFS2 and UBIFS:

    For jffs2:
    -------------
#flash_eraseall /dev/mtd0
#mount -t jffs2 /dev/mtdblock0 tmp
#bonnie++ -d tmp -u 0 -s 10 -r 5

    For ubifs:
    -------------
#flash_eraseall /dev/mtd0
#ubiattach /dev/ubi_ctrl -m 0
#ubimkvol /dev/ubi0 -N test -m
#mount -t ubifs ubi0:test tmp
#bonnie++ -d tmp -u 0 -s 10 -r 5

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agoDocumentation: add the binding file for Freescale QuadSPI driver
Huang Shijie [Mon, 24 Feb 2014 10:37:41 +0000 (18:37 +0800)]
Documentation: add the binding file for Freescale QuadSPI driver

This patch adds the binding file for Freescale QuadSPI driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: spi-nor: add a helper to find the spi_device_id
Huang Shijie [Mon, 24 Feb 2014 10:37:40 +0000 (18:37 +0800)]
mtd: spi-nor: add a helper to find the spi_device_id

Add the spi_nor_match_id() to find the proper spi_device_id with the
NOR flash's name in the spi_nor_ids table.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agoDocumentation: add the document for the SPI NOR framework
Huang Shijie [Fri, 28 Feb 2014 07:58:00 +0000 (15:58 +0800)]
Documentation: add the document for the SPI NOR framework

This patch adds the document for the SPI NOR framework.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: spi-nor: add the framework for SPI NOR
Huang Shijie [Mon, 24 Feb 2014 10:37:37 +0000 (18:37 +0800)]
mtd: spi-nor: add the framework for SPI NOR

This patch cloned most of the m25p80.c. In theory, it adds a new spi-nor layer.

Before this patch, the layer is like:

                   MTD
         ------------------------
                  m25p80
         ------------------------
       spi bus driver
         ------------------------
        SPI NOR chip

After this patch, the layer is like:
                   MTD
         ------------------------
                  spi-nor
         ------------------------
                  m25p80
         ------------------------
       spi bus driver
         ------------------------
       SPI NOR chip

With the spi-nor controller driver(Freescale Quadspi), it looks like:
                   MTD
         ------------------------
                  spi-nor
         ------------------------
                fsl-quadspi
         ------------------------
       SPI NOR chip

New APIs:
   spi_nor_scan: used to scan a spi-nor flash.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
[Brian: rebased to include additional m25p_ids[] entry]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: add the basic data structures
Huang Shijie [Mon, 24 Feb 2014 10:37:36 +0000 (18:37 +0800)]
mtd: spi-nor: add the basic data structures

The spi_nor{} is cloned from the m25p{}.
The spi_nor{} can be used by both the m25p80 and spi-nor controller.

We also add the spi_nor_xfer_cfg{} which can be used by the two
fundamental primitives: read_xfer/write_xfer.

 1) the hooks for spi_nor{}:
    @prepare/unpreare: used to do some work before or after the
             read/write/erase/lock/unlock.
    @read_xfer/write_xfer: We can use these two hooks to code all
             the following hooks if the driver tries to implement them
             by itself.
    @read_reg: used to read the registers, such as read status register,
             read configure register.
    @write_reg: used to write the registers, such as write enable,
             erase sector.
    @read_id: read out the ID info.
    @wait_till_ready: wait till the NOR becomes ready.
    @read: read out the data from the NOR.
    @write: write data to the NOR.
    @erase: erase a sector of the NOR.

 2) Add a new field sst_write_second for the SST NOR write.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: spi-nor: copy the SPI NOR commands to a new header file
Huang Shijie [Mon, 24 Feb 2014 10:37:35 +0000 (18:37 +0800)]
mtd: spi-nor: copy the SPI NOR commands to a new header file

This patch adds a new header :spi-nor.h,
and copies all the SPI NOR commands and relative macros into this new header.

This hearder can be used by the m25p80.c and other spi-nor controller,
such as Freescale's Quadspi.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: m25p80: Revive dual read support
Geert Uytterhoeven [Tue, 22 Apr 2014 12:45:31 +0000 (14:45 +0200)]
mtd: m25p80: Revive dual read support

Commit 03e296f613affcc2671c1e86d8c25ecad867204e ("mtd: m25p80: use the SPI
nor framework") accidentally removed support for Dual SPI read transfers.
Add it back.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*
Brian Norris [Wed, 9 Apr 2014 01:15:31 +0000 (18:15 -0700)]
mtd: spi-nor: re-name OPCODE_* to SPINOR_OP_*

Qualify these with a better namespace, and prepare them for use in more
drivers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: use the SPI nor framework
Brian Norris [Thu, 20 Mar 2014 12:00:12 +0000 (05:00 -0700)]
mtd: m25p80: use the SPI nor framework

Use the new SPI nor framework, and rewrite the m25p80:
 (0) remove all the NOR comands.
 (1) change the m25p->command to an array.
 (2) implement the necessary hooks, such as m25p80_read/m25p80_write.

Tested with the m25p32.
Signed-off-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
[Brian: rebased]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: add Macronix mx66l1g55g 1Gbit SPI flash
Brian Norris [Wed, 29 Jan 2014 21:39:43 +0000 (13:39 -0800)]
mtd: m25p80: add Macronix mx66l1g55g 1Gbit SPI flash

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: add support for the Spansion s25fl008k chip
Kuninori Morimoto [Tue, 11 Feb 2014 08:51:18 +0000 (09:51 +0100)]
mtd: m25p80: add support for the Spansion s25fl008k chip

Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: Use positive logic to check JEDEC ID
Axel Lin [Tue, 21 Jan 2014 07:56:34 +0000 (15:56 +0800)]
mtd: m25p80: Use positive logic to check JEDEC ID

For slightly better readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: delete non-required instances of include <linux/init.h>
Paul Gortmaker [Tue, 21 Jan 2014 21:22:52 +0000 (16:22 -0500)]
mtd: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
[Brian: dropped one incorrect hunk]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: Enable Dual SPI read transfers for s25fl256s1 and s25fl512s
Geert Uytterhoeven [Tue, 21 Jan 2014 12:59:19 +0000 (13:59 +0100)]
mtd: m25p80: Enable Dual SPI read transfers for s25fl256s1 and s25fl512s

Spansion s25fl256s1 and s25fl512s support Dual SPI transfers, hence set the
M25P80_DUAL_READ flag.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: m25p80: Add dual read support
Geert Uytterhoeven [Tue, 21 Jan 2014 12:59:18 +0000 (13:59 +0100)]
mtd: m25p80: Add dual read support

Add support for Dual SPI read transfers, which is supported by some
Spansion SPI FLASHes.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoENGR00269945: ARM: dts: add max7310 support for imx6qdl-sabreauto
Shawn Guo [Sun, 14 Jul 2013 14:17:16 +0000 (22:17 +0800)]
ENGR00269945: ARM: dts: add max7310 support for imx6qdl-sabreauto

On imx6qdl-sabreauto board, there are three IO expanders implemented by
max7310, which are all controlled by I2C3.  And GPIO5_4 is steering the
I2C3_SDA availability, while GPIO1_15 is used to reset max7310.

[shawn.guo: cherry-pick commit b938a6cb0d4c from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi

9 years agoENGR00269945: pinctrl: support pinctrl setting assertion via gpios
Shawn Guo [Mon, 15 Jul 2013 08:31:53 +0000 (16:31 +0800)]
ENGR00269945: pinctrl: support pinctrl setting assertion via gpios

It's pretty common that on some reference design or validation boards,
one pin could be used by two devices on board, and the pin route is
controlled by a GPIO.  So to assert the pin for given device, not only
the pinmux controller in SoC needs to be set up properly but also the
GPIO needs to be pulled up/down.

The patch adds support of a device tree property "pinctrl-assert-gpios"
under client device node.  It plays pretty much like a board level pin
multiplexer, and steers the pin route by controlling the GPIOs.  When
client device has the property represent in its node, pinctrl device
tree mapping function will firstly pull up/down the GPIOs to assert the
pins for the device at board level.

[shawn.guo: cherry-pick commit e5a718edab82 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: gpio: pca953x: add device_reset() call
Shawn Guo [Sun, 14 Jul 2013 13:52:38 +0000 (21:52 +0800)]
ENGR00269945: gpio: pca953x: add device_reset() call

The pca953x type of devices, e.g. max7310, may have a reset which needs
to be handled to get the device start working.  Add a device_reset()
call for that, and defer the probe if the reset controller for that is
not ready yet.

[shawn.guo: cherry-pick commit e95dae89011e from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
drivers/gpio/gpio-pca953x.c

9 years agoENGR00269945: select ARCH_HAS_RESET_CONTROLLER for IMX
Shawn Guo [Sun, 14 Jul 2013 13:39:35 +0000 (21:39 +0800)]
ENGR00269945: select ARCH_HAS_RESET_CONTROLLER for IMX

Move ARCH_HAS_RESET_CONTROLLER from HAVE_IMX_SRC to ARCH_MXC to have it
selected for the whole IMX family instead of SRC (System Reset
Controller), since GPIO could be another reset controller in many cases.

[shawn.guo: cherry-pick commit 6d43306b9c80 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
arch/arm/mach-imx/Kconfig

9 years agoENGR00269945: reset: add dummy device_reset() for !CONFIG_RESET_CONTROLLER build
Shawn Guo [Sun, 14 Jul 2013 13:35:49 +0000 (21:35 +0800)]
ENGR00269945: reset: add dummy device_reset() for !CONFIG_RESET_CONTROLLER build

Add dummy device_reset() function for !CONFIG_RESET_CONTROLLER build,
so that we do not have to add #ifdef CONFIG_RESET_CONTROLLER in every
single client device drivers that call the function.

[shawn.guo: cherry-pick commit a9c086f35277 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: reset: build in CONFIG_RESET_GPIO by default
Shawn Guo [Sun, 14 Jul 2013 13:10:37 +0000 (21:10 +0800)]
ENGR00269945: reset: build in CONFIG_RESET_GPIO by default

GPIO is widely used as the reset control for various devices.  Let's
build the support in by default.

[shawn.guo: cherry-pick commit 795fcb3bc5bb from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00269945: reset: register gpio-reset driver in arch_initcall
Shawn Guo [Sun, 14 Jul 2013 12:41:00 +0000 (20:41 +0800)]
ENGR00269945: reset: register gpio-reset driver in arch_initcall

It's a little bit late to register gpio-reset driver at module_init
time, because gpio-reset provides reset control via gpio for other
devices which are mostly probed at module_init time too.  And it
becomes even worse, when the gpio comes from IO expander on I2C bus,
e.g. pca953x.  In that case, gpio-reset needs to be ready before I2C
bus driver which is generally ready at subsys_initcall time.  Let's
register gpio-reset driver in arch_initcall() to have it ready early
enough.

The defer probe mechanism is not used here, because a reset controller
driver should be reasonably registered early than other devices.  More
importantly, defer probe doe not help in some nasty cases, e.g. the
gpio-pca953x device itself needs a reset from gpio-reset driver start
working.

[shawn.guo: cherry-pick commit 7153f05108ef from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoreset: Add driver for gpio-controlled reset pins
Philipp Zabel [Thu, 30 May 2013 09:09:00 +0000 (11:09 +0200)]
reset: Add driver for gpio-controlled reset pins

This driver implements a reset controller device that toggle a gpio
connected to a reset pin of a peripheral IC. The delay between assertion
and de-assertion of the reset signal can be configured via device tree.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
[shawn.guo: cherry-pick commit 27e3604c82cb from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
drivers/reset/Makefile

9 years agoENGR00317981: ARM: add imx_v7_defconfig
Shawn Guo [Mon, 16 Jun 2014 07:19:36 +0000 (15:19 +0800)]
ENGR00317981: ARM: add imx_v7_defconfig

Add a imx defconfig for ARMv7 only build.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00240988: ARM: dts: add gpu nodes for imx6q and imx6dl
Shawn Guo [Fri, 26 Jul 2013 08:50:49 +0000 (16:50 +0800)]
ENGR00240988: ARM: dts: add gpu nodes for imx6q and imx6dl

It adds gpu nodes for imx6q and imx6dl.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick commit dfbafe2b0b33 from imx_3.10.y, use macro
 for clock IDs and IRQ trigger type, and add power-domains]

9 years agoENGR00240988: ARM: imx6q: add dma_zone_size for GPU limit
Shawn Guo [Wed, 31 Jul 2013 02:24:07 +0000 (10:24 +0800)]
ENGR00240988: ARM: imx6q: add dma_zone_size for GPU limit

GPU has a limit on physical address that it accesses, which must be
below 2GiB.  Since i.MX6Q/DL maps system memory at 0x10000000 (offset
256MiB), we set dma_zone_size as (SZ_2G - SZ_256M) to ensure that.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick commit f12c42130ab4 from imx_3.10.y]

Conflicts:
arch/arm/mach-imx/Kconfig

9 years agoENGR00240988: ARM: imx6q: add gpu clock initialzatin code
Loren HUANG [Fri, 9 Nov 2012 04:47:10 +0000 (12:47 +0800)]
ENGR00240988: ARM: imx6q: add gpu clock initialzatin code

This is a cherry-pick of commit 80f38bb (ENGR00240988-3 Add gpu clock
initialzatin code) from 3.5.7 kernel.

Signed-off-by: Loren HUANG <b02279@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick commit c905623ba3f9 from imx_3.10.y, and use
 macro for clock IDs]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: gpu-viv: use runtime pm for VDDPU management
Shawn Guo [Mon, 16 Jun 2014 06:48:01 +0000 (14:48 +0800)]
ENGR00317981: gpu-viv: use runtime pm for VDDPU management

On kernel 3.14, we use generic power domain for VDDPU management.  In
that case, GPU driver does not need to call regulator API to manage
VDDPU anymore.  Instead, it only needs to call runtime pm, which is
already being used by the driver.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>