linux.git
7 years agoMLK-11908 mfd: MAX17135: don't free i2c device client
Fugang Duan [Thu, 26 Nov 2015 08:31:14 +0000 (16:31 +0800)]
MLK-11908 mfd: MAX17135: don't free i2c device client

i2c device client shouldn't be freed by i2c device driver, there have
problems in below cases:
- one device match to different drivers, the second matched driver will
  cannot access i2c device client if it is freed by the first matched driver.
- one module driver insmod: the first insmod fail free client due to system
  low memory, after kswapd system free pages and has enough free pages, the
  second insmod will cause match failed.

Signed-off-by: Fugang Duan <B38611@freescale.com>
7 years agoMLK-10996 imx: qspi fix ddr delay setting
Peng Fan [Fri, 29 May 2015 01:12:22 +0000 (09:12 +0800)]
MLK-10996 imx: qspi fix ddr delay setting

For i.MX6UL and i.MX7D, ddr delay logic enable bit is changed from i.MX6SX.
If want to enable qspi ddr mode, ddr delay logic should be enabled.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
(cherry picked and merge from commit f28986825a7be1cbf2b5103ea110db28c96e74c7)
Signed-off-by: Han Xu <b45815@freescale.com>
Conflicts:
drivers/mtd/spi-nor/fsl-quadspi.c

7 years agoENGR00318063-14: ARM: imx6sx: set pll2_bus as the default parent of QSPI clock
Shawn Guo [Fri, 27 Jun 2014 08:32:46 +0000 (16:32 +0800)]
ENGR00318063-14: ARM: imx6sx: set pll2_bus as the default parent of QSPI clock

We already know that pll2_bus is the best parent of QSPI clock.  Let's
set it up in clock initialization as the default, so that we can save
those implicit parent switching and rate changing calls from clock
framework.

shawn.guo: cherry-pick commit ecef6a715f1a from imx_3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
(cherry picked and merge from commit dd32f1868a7c00c2d69424a14e48989d9c5bf103)
Signed-off-by: Han Xu <b45815@freescale.com>
Conflicts:
arch/arm/mach-imx/clk-imx6sx.c

7 years agoMLK-11940: add two more commands support for qspi
Han Xu [Mon, 23 Nov 2015 15:45:19 +0000 (09:45 -0600)]
MLK-11940: add two more commands support for qspi

add two more commands support for qspi on kernel 4.1, read EVCR and
write EVCR.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoENGR00279980 ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1
Huang Shijie [Wed, 18 Sep 2013 02:17:39 +0000 (10:17 +0800)]
ENGR00279980 ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1

If the master mtd does not have any slave mtd partitions,
and its numeraseregions is one(only has one erease block), and
we attach the master mtd with : ubiattach -m 0 -d 0

We will meet the error:
-------------------------------------------------------
root@freescale ~$ ubiattach /dev/ubi_ctrl -m 0 -d 0
UBI: attaching mtd0 to ubi0
UBI error: io_init: multiple regions, not implemented
ubiattach: error!: cannot attach mtd0
           error 22 (Invalid argument)
-------------------------------------------------------

In fact, if there is only one "erase block", we should not
prevent the attach.

This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit 361cdc47fc4c4db31c5485560cdabd94f409bd81)
(cherry picked from commit ebee7d74914fad3cf7223af84496811c9d2488a1)

7 years agoMLK-11573: ARM: dts: fix the iomux pin conflict for LPSR mode
Han Xu [Thu, 8 Oct 2015 23:16:02 +0000 (18:16 -0500)]
MLK-11573: ARM: dts: fix the iomux pin conflict for LPSR mode

add the pinctrl-1 for iomux in ecspi device tree to avoid conflict.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit edacd0568487815ca3a0821c25912133cb6c1731)

7 years agoMLK-11335: mtd: qspi: enalbe LPSR for qspi
Han Xu [Thu, 30 Jul 2015 21:35:52 +0000 (16:35 -0500)]
MLK-11335: mtd: qspi: enalbe LPSR for qspi

The LPSR turns off the power for IOMUX when suspending so restore the
IOMUX when resuming.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 906d0c1381e865dc7c96a4bde6fe694f1ce089a9)

7 years agoMLK-11334: ARM: dts: enable qspi IOMUX sleep state for imx7d-12x12-lpddr3-arm2
Han Xu [Thu, 30 Jul 2015 21:33:53 +0000 (16:33 -0500)]
MLK-11334: ARM: dts: enable qspi IOMUX sleep state for imx7d-12x12-lpddr3-arm2

Enable qspi IOMUX sleep state for imx7d-12x12-lpddr3-arm2.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 73773c936b0c33e6e01e14c646749dfa3daaedad)

7 years agoMLK-11095: mtd:qspi: clear the DDR_EN bit on 6UL and 7D
Han Xu [Thu, 11 Jun 2015 19:50:47 +0000 (14:50 -0500)]
MLK-11095: mtd:qspi: clear the DDR_EN bit on 6UL and 7D

the obsolete bit DDR_EN on 6UL and 7D should be clear in case other
program set the bit and cause qspi probe fail.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit d8b51cc358780f68e732522ee9bd6bd578dd6771)

7 years agoMLK-11087: mtd:qspi: support DDR Quad mode for Macronix mx25l51245g
Han Xu [Wed, 10 Jun 2015 22:14:01 +0000 (17:14 -0500)]
MLK-11087: mtd:qspi: support DDR Quad mode for Macronix mx25l51245g

Enable DDR quad mode for Macronix qspi chip mx25l51245g by setting Quad
bit in status register and enabling in dts file.

The LUT for SPINOR_OP_READ_1_4_4_D was initially designed for Spansion
qspi chip, so there is one cycle for "mode" after address and before
dummy. While Macronix qspi chip doesn't have this feature, so we just
take off one cycle in dts file to bypass this problem.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit e03fdad1c7713a7db70112e00c4ae96848accd34)

7 years agoMLK-11061: ARM:dts: enable ddr quad mode for QSPI on 6UL ARM2 and 7D ARM2
Han Xu [Fri, 5 Jun 2015 20:09:18 +0000 (15:09 -0500)]
MLK-11061: ARM:dts: enable ddr quad mode for QSPI on 6UL ARM2 and 7D ARM2

Enable DDR Quad mode for QSPI on 6UL ARM2 and 7D ARM2 board to improve
the performance.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit ba6c2f00b5b000996bf8acbbd62c30d8f8f61182)

7 years agoMLK-10868: ARM:dts: support 4 qspi chips on imx7d-12x12-lpddr3-arm2
Han Xu [Fri, 8 May 2015 16:00:18 +0000 (11:00 -0500)]
MLK-10868: ARM:dts: support 4 qspi chips on imx7d-12x12-lpddr3-arm2

enabled 4 qspi chips on imx7d-12x12-lpddr3-arm2 board in dts

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit a4e10bf5e94d883c06f41b2c61f80ce23946612b)

7 years agoMLK-10565-2: mtd: qspi: Support QSPI on i.MX7D SDB
Han Xu [Thu, 2 Apr 2015 20:01:41 +0000 (15:01 -0500)]
MLK-10565-2: mtd: qspi: Support QSPI on i.MX7D SDB

Add a new entry for MX25L51245G QSPI NOR chip.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 9f3f15ad1b0461d6b638c34599dd74d9c43fa01f)

7 years agoMLK-10565-1: ARM:dts: new dts for QSPI on i.MX7D SDB
Han Xu [Thu, 2 Apr 2015 19:58:29 +0000 (14:58 -0500)]
MLK-10565-1: ARM:dts: new dts for QSPI on i.MX7D SDB

Add a new dts file for QSPI on i.MX7D SDB, also changed dtb file order
to alphabetical order.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit b24b9f69616f3d603f70740543e83ea71585c0ea)

7 years agoMLK-10521-1: ARM: dts: add new dts to support NAND on i.MX7D
Han Xu [Tue, 31 Mar 2015 19:47:19 +0000 (14:47 -0500)]
MLK-10521-1: ARM: dts: add new dts to support NAND on i.MX7D

Add new dts file for NAND on i.MX7D

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit 1464059618af514f211343d9f1cdd94999be705e)

7 years agoMLK-10497 ARM: dts: supported spi-nor on imx6qp sabreauto
Han Xu [Fri, 27 Mar 2015 16:23:08 +0000 (11:23 -0500)]
MLK-10497 ARM: dts: supported spi-nor on imx6qp sabreauto

add new dts to support spi-nor on imx6qp sabreauto

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit edb500d09c08effce28f8c45490372f38b037815)

7 years agoMLK-10205-1 ARM: dts: Create new dts for QSPI on i.MX7D
Han Xu [Wed, 28 Jan 2015 23:07:19 +0000 (07:07 +0800)]
MLK-10205-1 ARM: dts: Create new dts for QSPI on i.MX7D

create a new dts file for QSPI verification on i.MX7D

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit 2888c54189b6126519cf4c05094891980f321917)

7 years agoMLK-10483: ARM: dts: add gpmi weim support for imx6qp
Han Xu [Thu, 12 Mar 2015 23:11:52 +0000 (18:11 -0500)]
MLK-10483: ARM: dts: add gpmi weim support for imx6qp

dts for gpmi nand and weim nor support for imx6qp sabreauto

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked and merge from commit adb9c42a8be0bd148069540b089d2e762bec05e9)

7 years agoMLK-10189: ARM:dts: disable gpmi nand module in imx6qdl sabreauto dts
Allen Xu [Thu, 29 Jan 2015 17:57:44 +0000 (01:57 +0800)]
MLK-10189: ARM:dts: disable gpmi nand module in imx6qdl sabreauto dts

disable gpmi nand module in imx6qdl default dts since it conflicts with
uart3

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked from commit 54105e0ad2a4e30c5c048b5b9b233e49b4fba47d)

7 years agoMLK-9976: ARM: dts: NAND BBT inconsistency causes UBIFS randomly mount failed
Allen Xu [Tue, 9 Dec 2014 22:12:00 +0000 (06:12 +0800)]
MLK-9976: ARM: dts: NAND BBT inconsistency causes UBIFS randomly mount failed

NAND scans the bad blocks during kernel boots up, which invokes the
gpmi_ecc_read_oob function to check the badblock mark for each block. In
this function the oob data was raw read from NAND chip without ECC, so
it hardly to guarantee the consistency of the data considering the
possible bitflips. It found that in some MLC NAND the oob data changed
and consequently the BBT changed in different power cycles. This issue
may cause the UBIFS mount failed.

To fix this issue, add "nand_on_flash_bbt" option in dts to store the BBT
in NAND flash. On the first time kernel boot up, all bad blocks and
probably some fake bad block would be recognized and be recorded in
on-nand bad block table. From the second time boot, kernel will read BBT
from NAND Flash rather than calling gpmi_ecc_read_oob function to check
bad block.

No bad block would be missed when create BBT since the probability that
16bit bad block mark filps from 0x00 to 0xFF is extremely low.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit d957353768a1b6d39b340b9d10b22fc42b0aa8e2)
(cherry picked from commit 7b7d3d683a24b23f33d6c08874f31fe50ef2fc76)

7 years agoMLK-11939: ARM: dts: Add ddrsmp to device tree for i.mx6sx sabreauto and sdb board
Han Xu [Fri, 13 Nov 2015 16:48:22 +0000 (10:48 -0600)]
MLK-11939: ARM: dts: Add ddrsmp to device tree for i.mx6sx sabreauto and sdb board

Add ddrsmp parameter to device tree for i.MX6SX Sabreauto/Sabresd board.

DDRSMP value:
0 ---- i.MX6SX Sabresd board (RevB and RevA)
2 ---- i.MX6SX Sabreauto board

The Sabresd RevA board also needs to reduce clock to 29Mhz according to
the Spansion spec.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoMLK-9920 mtd: fsl-quadspi: Add ddrsmp parameter to device tree
Ye.Li [Mon, 1 Dec 2014 09:28:47 +0000 (17:28 +0800)]
MLK-9920 mtd: fsl-quadspi: Add ddrsmp parameter to device tree

Since QSPI internal DDR sample point is relevant with board layout,
we can't use same value for all boards. Add ddrsmp parameter to device
tree for different i.MX6SX board.

Signed-off-by: Ye.Li <B37916@freescale.com>
(cherry picked and merge from commit c9115cc22d836b5b980ca20932a005ea61b20082)
(cherry picked from commit b0d9d9ce804247ccb2842bf53d2b32f14eed0309)

7 years agoMLK-11938: ARM: dts: add gpmi nand and qspi support on i.mx6sx sabreauto
Han Xu [Fri, 13 Nov 2015 16:29:35 +0000 (10:29 -0600)]
MLK-11938: ARM: dts: add gpmi nand and qspi support on i.mx6sx sabreauto

supports gpmi nand and qspi on i.mx6sx sabreauto platform.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoENGR00333049 ARM: dts: add dts file for ecspi on imx6q sabreauto
Allen Xu [Wed, 24 Sep 2014 20:01:57 +0000 (15:01 -0500)]
ENGR00333049 ARM: dts: add dts file for ecspi on imx6q sabreauto

add new dts file to support ecspi on imx6q sabreauto board.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit ff87b56022d1d63003eff79a30bedf33271781fa)

7 years agoENGR00333048 ARM: dts: add new dts for gpmi and weim on imx6q sabreauto
Allen Xu [Wed, 24 Sep 2014 20:00:18 +0000 (15:00 -0500)]
ENGR00333048 ARM: dts: add new dts for gpmi and weim on imx6q sabreauto

new dts file to support gpmi/weim on imx6q sabreauto board.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit d51a5439d7b996a26e842c8d4034668e4c7959ab)

7 years agoENGR00333047 ARM: dts: add new dts for ecspi on imx6dl sabreauto
Allen Xu [Wed, 24 Sep 2014 19:57:27 +0000 (14:57 -0500)]
ENGR00333047 ARM: dts: add new dts for ecspi on imx6dl sabreauto

new dts file to support ecspi on imx6dl sabreauto board.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit 243e501dbec2b62148c6a470226abced76438eac)

7 years agoENGR00333046 ARM: dts: add new dts for gpmi and weim on imx6dl sabreauto
Allen Xu [Wed, 24 Sep 2014 19:54:11 +0000 (14:54 -0500)]
ENGR00333046 ARM: dts: add new dts for gpmi and weim on imx6dl sabreauto

dts file to support gpmi/weim on imx6dl sabreauto board.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit 5a7a430325e2c104609c4e3d34d4d88dc95cc50e)

7 years agoMLK-9909 ARM: dts: add imx6sx sdb revA QSPI legacy support
Allen Xu [Sat, 22 Nov 2014 19:15:19 +0000 (13:15 -0600)]
MLK-9909 ARM: dts: add imx6sx sdb revA QSPI legacy support

add sdb revA board QSPI legacy support for Spansion QSPI chip.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit 3fd143ae78007e58d1dc45bc829b462a12b93cd2)
(cherry picked from commit 8317ae5998a20b3303a2a9209c29ab5674e09dc3)

7 years agoMLK-9851 mtd: Change the mtd device driver build order for mfgtool
Allen Xu [Fri, 14 Nov 2014 16:36:07 +0000 (00:36 +0800)]
MLK-9851 mtd: Change the mtd device driver build order for mfgtool

i.MX6SX Sabreauto board enabled both NAND and QSPI1 drivrers, and by default,
NAND driver built first in kernel compiling, and it would be load first when
Kernel brought up.

Since we could not guarantee all boards mounted NAND chips, we wish the Kernel
could load QSPI driver first, when system mapped QSPI and NAND, the mtd device
index won't change dynamically, otherwise, the mfgtool may write images to the
inappropriate storage devices.

The code change moved the SPI driver at the prior position of NAND driver in
Makefile to solve this issue.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked from commit 3d2d5724f7a2968b40c2ea0a70c09a3214da1496)
(cherry picked from commit b03ee70fdd1dfaa3be61817eb49d01d49cb107d3)

7 years agoMLK-9943 ARM: dts: add new dts for nand support for 19x19 arm2
Allen Xu [Tue, 2 Dec 2014 19:23:39 +0000 (03:23 +0800)]
MLK-9943 ARM: dts: add new dts for nand support for 19x19 arm2

Add new dts file to support NAND for imx6sx 19x19 arm2 board.

Signed-off-by: Allen Xu <b45815@freescale.com>
(cherry picked and merge from commit bdc522d1773156f03b74d4711a60f81824184b40)

7 years agoENGR00318895-12 mtd: spi-nor: add DDR quad read flag for s25fl128s
Huang Shijie [Wed, 18 Jun 2014 02:01:50 +0000 (10:01 +0800)]
ENGR00318895-12 mtd: spi-nor: add DDR quad read flag for s25fl128s

This patch adds the DDR quad read flag for s25fl128s.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit 7346749f8f1083943431063bdd49ea9429a96941)
Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoENGR00318895-11 mtd: fsl-quadspi: add DDR quad read support for Micron
Huang Shijie [Fri, 25 Apr 2014 05:51:15 +0000 (13:51 +0800)]
ENGR00318895-11 mtd: fsl-quadspi: add DDR quad read support for Micron

Add DDR quad read opcode and LUT sequence for Micron N25Q256A.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit dc2a7430557dd3e102b56fdd6b6d0fe3b1e3e461)

7 years agoMLK-11937: mtd: spi-nor: add DDR quad read support for Micron
Han Xu [Fri, 25 Apr 2014 05:40:19 +0000 (13:40 +0800)]
MLK-11937: mtd: spi-nor: add DDR quad read support for Micron

This patch adds the DDR(or DTR) quad read support for the Micron
SPI NOR flash.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoENGR00318895-9: mtd: spi-nor: add more read transfer flags for n25q256a
Han Xu [Thu, 5 Nov 2015 17:04:33 +0000 (11:04 -0600)]
ENGR00318895-9: mtd: spi-nor: add more read transfer flags for n25q256a

The NOR flash can supports dual/quad/ddr-quad read.
Add more flags for these read transfers.

From the datasheet, the chip support the 64K sector erase operation.
So remove the SECT_4K for the chip which makes the flash_erase faster.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoMLK-11936: mtd: fsl-quadspi: add the DDR quad read support for Spansion NOR
Huang Shijie [Wed, 23 Apr 2014 02:20:35 +0000 (10:20 +0800)]
MLK-11936: mtd: fsl-quadspi: add the DDR quad read support for Spansion NOR

Add the DDR quad read support for the fsl-quadspi driver.

Check the "spi-nor,ddr-quad-read-dummy" DT property, if the DT node is exit,
it means we could enable the DDR quad read.

 (1) Test this patch with imx6sx-sdb board (Spansion s25fl128s)
     The clock rate is 66MHz.

 (2) The information of NOR flash:
     -----------------------------------------------
     root@imx6qdlsolo:~# mtdinfo /dev/mtd0
     mtd0
     Name:                           21e4000.qspi
     Type:                           nor
     Eraseblock size:                65536 bytes, 64.0 KiB
     Amount of eraseblocks:          256 (16777216 bytes, 16.0 MiB)
     Minimum input/output unit size: 1 byte
     Sub-page size:                  1 byte
     Character device major/minor:   90:0
     Bad blocks are allowed:         false
     Device is writable:             true
     -----------------------------------------------

 (3) Test this patch set with UBIFS & bonnie++:
     -----------------------------------------------
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
     -----------------------------------------------

 (4) Test this patch with mtd_speedtest.ko

     root@imx6qdlsolo:~# insmod mtd_speedtest.ko dev=0
     =================================================
     mtd_speedtest: MTD device: 0
     mtd_speedtest: not NAND flash, assume page size is 512 bytes.
     mtd_speedtest: MTD device size 16777216, eraseblock size 65536, page size 512,
                    count of eraseblocks 256, pages per eraseblock 128, OOB size 0
     mtd_speedtest: testing eraseblock write speed
     mtd_speedtest: eraseblock write speed is 665 KiB/s
     mtd_speedtest: testing eraseblock read speed
     mtd_speedtest: eraseblock read speed is 49799 KiB/s
     mtd_speedtest: testing page write speed
     mtd_speedtest: page write speed is 662 KiB/s
     mtd_speedtest: testing page read speed
     mtd_speedtest: page read speed is 24236 KiB/s
     mtd_speedtest: testing 2 page write speed
     mtd_speedtest: 2 page write speed is 657 KiB/s
     mtd_speedtest: testing 2 page read speed
     mtd_speedtest: 2 page read speed is 32637 KiB/s
     mtd_speedtest: Testing erase speed
     mtd_speedtest: erase speed is 518 KiB/s
     mtd_speedtest: Testing 2x multi-block erase speed
     mtd_speedtest: 2x multi-block erase speed is 506 KiB/s
     mtd_speedtest: Testing 4x multi-block erase speed
     mtd_speedtest: 4x multi-block erase speed is 503 KiB/s
     mtd_speedtest: Testing 8x multi-block erase speed
     mtd_speedtest: 8x multi-block erase speed is 501 KiB/s
     mtd_speedtest: Testing 16x multi-block erase speed
     mtd_speedtest: 16x multi-block erase speed is 498 KiB/s
     mtd_speedtest: Testing 32x multi-block erase speed
     mtd_speedtest: 32x multi-block erase speed is 496 KiB/s
     mtd_speedtest: Testing 64x multi-block erase speed
     mtd_speedtest: 64x multi-block erase speed is 495 KiB/s
     mtd_speedtest: finished
     =================================================

  (5) Conclusion:
     The DDR quad read could be 49799 KiB/s.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoENGR00318895-7 mtd: fsl-quadspi: use the information stored in spi-nor{}
Huang Shijie [Tue, 22 Apr 2014 09:47:14 +0000 (17:47 +0800)]
ENGR00318895-7 mtd: fsl-quadspi: use the information stored in spi-nor{}

We can get the read/write/erase opcode from the spi nor framework now.
What's more is that we can get the correct dummy cycles.

This patch uses the information stored in the spi_nor{} to remove the
hardcode in the fsl_qspi_init_lut().

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit 3a9f46be2a6d358924d69757858ec816764222d4)

7 years agoENGR00318895-6 Documentation: fsl-quadspi: update the document
Huang Shijie [Wed, 23 Apr 2014 03:59:26 +0000 (11:59 +0800)]
ENGR00318895-6 Documentation: fsl-quadspi: update the document

The patch updates the document by adding more information to describe the
DT proporties used by the Freescale Quadspi driver and the childs nodes.

For the child node for SPI NOR flash, we add the required property
("spi-max-frequency"), and refer to spi-nor-flash.txt for the optional
properties.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit d7b296f51eb077b0c77580ad63ffd69ce722bf6c)

7 years agoENGR00318895-5 Documentation: mtd: add a new document for SPI NOR flash
Huang Shijie [Wed, 23 Apr 2014 05:54:40 +0000 (13:54 +0800)]
ENGR00318895-5 Documentation: mtd: add a new document for SPI NOR flash

We need a DT property to store the dummy cycles for DDR Quad read.
This is a common feature for the SPI NOR flash, such as Spansion and Micron
chips.

Add this file to describe this specific SPI NOR flash features which will
be referred by the SPI NOR flash drivers.

Signed-off-by: Huang Shijie <b32955@freescale.com>
(cherry picked from commit dfbe3eb5c7c2c3967c0f1bf32c0279136da7bfce)

7 years agoMLK-11941: mtd: spi-nor: add DDR quad read support
Han Xu [Tue, 3 Nov 2015 22:52:25 +0000 (16:52 -0600)]
MLK-11941: mtd: spi-nor: add DDR quad read support

This patch adds the DDR quad read support by the following:

[1] add SPI_NOR_DDR_QUAD read mode.

[2] add DDR Quad read opcodes:
    SPINOR_OP_READ_1_4_4_D / SPINOR_OP_READ4_1_4_4_D

[3] add set_ddr_quad_mode() to initialize for the DDR quad read.
    Currently it only works for Spansion NOR.

[3] about the dummy cycles.
    We set the dummy with 8 for DDR quad read by default.
    The m25p80.c can not support the DDR quad read, but the SPI NOR controller
    can set the dummy value in its child DT node, and the SPI NOR framework
    can parse it out.

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoMLK-11751: mtd: gpmi: add empty sentinel entry at the end of of_device_id table
Han Xu [Fri, 23 Oct 2015 03:22:58 +0000 (22:22 -0500)]
MLK-11751: mtd: gpmi: add empty sentinel entry at the end of of_device_id table

add an empty sentinel entry to avoid the struct of_device_id is not
terminated with a NULL entry issue.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 2b1ce5ec442dde8801b6b2d059d22f5dce7c9c76)

7 years agoMLK-11747: mtd: gpmi: save bch geometry setting only in initial stage
Han Xu [Wed, 21 Oct 2015 16:43:55 +0000 (11:43 -0500)]
MLK-11747: mtd: gpmi: save bch geometry setting only in initial stage

fix the bch setting issue when system suspend/resume, the bch geometry
only need to be saved to debugfs in driver initial stage

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 3b4f7178854e428fb5ef08d554b13abe4f27c533)

7 years agoMLK-11720: mtd: gpmi: change the erase threshold for mx6qp,mx6ul and mx7d
Han Xu [Fri, 9 Oct 2015 16:19:01 +0000 (11:19 -0500)]
MLK-11720: mtd: gpmi: change the erase threshold for mx6qp,mx6ul and mx7d

The erase threshold should be set to ecc_strength for these platforms.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit f46d113a02f5375c38fc9aba88c587fd672a30c4)

7 years agoMLK-11719-4: mtd: gpmi: change the BCH layout setting for large oob NAND
Han Xu [Thu, 30 Apr 2015 21:50:34 +0000 (16:50 -0500)]
MLK-11719-4: mtd: gpmi: change the BCH layout setting for large oob NAND

The cod change updated the NAND driver BCH ECC layout algorithm to
support large oob size NAND chips(oob > 1024 bytes) and proposed a new
way to set ECC layout.

Current implementation requires each chunk size larger than oob size so
the bad block marker (BBM) can be guaranteed located in data chunk. The
ECC layout always using the unbalanced layout(Ecc for both meta and
Data0 chunk), but for the NAND chips with oob larger than 1k, the driver
cannot support because BCH doesn’t support GF 15 for 2K chunk.

The change keeps the data chunk no larger than 1k and adjust the ECC
strength or ECC layout to locate the BBM in data chunk. General idea for
large oob NAND chips is

1.Try all ECC strength from the minimum value required by NAND spec to
the maximum one that works, any ECC makes the BBM locate in data chunk
can be chosen.

2.If none of them works, using separate ECC for meta, which will add one
extra ecc with the same ECC strength as other data chunks. This extra
ECC can guarantee BBM located in data chunk, of course, we need to check
if oob can afford it.

Previous code has two methods for ECC layout setting, the
legacy_set_geometry and set_geometry_by_ecc_info, the difference
between these two methods is, legacy_set_geometry set the chunk size
larger chan oob size and then set the maximum ECC strength that oob can
afford. While the set_geometry_by_ecc_info set chunk size and ECC
strength according to NAND spec. It has been proved that the first
method cannot provide safe ECC strength for some modern NAND chips, so
in current code,

1. Driver read NAND parameters first and then chose the proper ECC
layout setting method.

2. If the oob is large or NAND required data chunk larger than oob size,
chose set_geometry_for_large_oob, otherwise use set_geometry_by_ecc_info

3. legacy_set_geometry only used for some NAND chips does not contains
necessary information. So this is only a backup plan, it is NOT
recommended to use these NAND chips.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 78e8beff734adb72185405ae2cb55e0097eb96cb)

7 years agoMLK-11719-2: mtd: gpmi: save the bch layout setting in debugfs
Han Xu [Fri, 9 Oct 2015 15:18:20 +0000 (10:18 -0500)]
MLK-11719-2: mtd: gpmi: save the bch layout setting in debugfs

save the bch layout setting in debugfs for the upper layer applications,
such as kobs-ng.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 8a373e796c21f4e9b714039e5f0b7d9388ef5a32)

7 years agoMLK-11555: mtd: nand: i.MX6UL supports bitflip detection
Han Xu [Tue, 15 Sep 2015 20:50:18 +0000 (15:50 -0500)]
MLK-11555: mtd: nand: i.MX6UL supports bitflip detection

i.MX6UL also has the DEBUG1 register which can be used for bitflip
detection for erased page.

Signed-off-by: Han Xu <b45815@freescale.com>
(cherry picked from commit 8df8d10edc8909e19e60f0cc1dd65c1fe706ab67)

7 years agoMLK-11921-3 mxc IPUv3: regs: Fix the macro WROD definition
Liu Ying [Mon, 30 Nov 2015 09:11:10 +0000 (17:11 +0800)]
MLK-11921-3 mxc IPUv3: regs: Fix the macro WROD definition

This patch adds missing parentheses around the argument of the macro
WROD to avoid any potential macro expansion issue.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11921-2 mxc IPUv3: param mem: Fix several potential macro expansion issues
Liu Ying [Mon, 30 Nov 2015 09:07:37 +0000 (17:07 +0800)]
MLK-11921-2 mxc IPUv3: param mem: Fix several potential macro expansion issues

This patch adds missing parentheses around the arguments of the macro
ipu_ch_param_addr/ipu_ch_param_set_field(_io)/ipu_ch_param_mod_field(_io)/
ipu_ch_param_read_field(_io) to avoid any potential macro expansion issue.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11921-1 mxc IPUv3: common: Fix the macro idma_is_valid/idma_mask definitions
Liu Ying [Mon, 30 Nov 2015 09:01:49 +0000 (17:01 +0800)]
MLK-11921-1 mxc IPUv3: common: Fix the macro idma_is_valid/idma_mask definitions

This patch adds missing parentheses around the argument of the macro
idma_is_valid and idma_mask to avoid any potential macro expansion issue.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11932 video: fbdev: mxc: ldb: Do not touch fbi->modelist in ldb_init()
Liu Ying [Tue, 1 Dec 2015 06:42:41 +0000 (14:42 +0800)]
MLK-11932 video: fbdev: mxc: ldb: Do not touch fbi->modelist in ldb_init()

We don't have to touch fbi->modelist in ldb_init(), because mxcfb_register()
may initialize the list and add a video mode to the list for us.

This patch fixes the following issue reported by Coverity:
INIT_LIST_HEAD(&fbi->modelist);
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value fb_vm. Field fb_vm.name is
uninitialized when calling fb_add_videomode.
fb_add_videomode(&fb_vm, &fbi->modelist);
fb_videomode_to_var(&fbi->var, &fb_vm);

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11918-4 video: mxc ipuv3 fb: Fix dangling pointer dereference in check_var
Liu Ying [Mon, 30 Nov 2015 03:46:00 +0000 (11:46 +0800)]
MLK-11918-4 video: mxc ipuv3 fb: Fix dangling pointer dereference in check_var

The function fbi_to_pixfmt() could access the pointer fbi->device provided
by it's input parameter fbi, so let's make sure the pointer isn't dangling.

This patch fixes the following issue reported by Coverity:
Uninitialized pointer read (UNINIT)
uninit_use_in_call: Using uninitialized value tmp_fbi.device when calling
fbi_to_pixfmt.
switch (fbi_to_pixfmt(&tmp_fbi, true)) {
case IPU_PIX_FMT_YUV420P2:
case IPU_PIX_FMT_YVU420P:

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11918-3 video: mxc ipuv3 fb: Fix bailout path for ioctrl FBIO_ALLOC
Liu Ying [Mon, 30 Nov 2015 03:01:07 +0000 (11:01 +0800)]
MLK-11918-3 video: mxc ipuv3 fb: Fix bailout path for ioctrl FBIO_ALLOC

Resources(kmem and DMA) should be freed correctly in the bailout path of
ioctrl FBIO_ALLOC.  We should also delete mem->list from fb_alloc_list
in the bailout path if necessary.

The kmem leakage issue is reported by Coverity:
if (get_user(size, argp))
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable mem going out of scope leaks the storage it points to.
return -EFAULT;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11918-2 video: mxc ipuv3 fb: Return err in ->fb_check_var if fbi_tmp is NULL
Liu Ying [Mon, 30 Nov 2015 02:55:12 +0000 (10:55 +0800)]
MLK-11918-2 video: mxc ipuv3 fb: Return err in ->fb_check_var if fbi_tmp is NULL

It has to be successful to find a relevant background framebuffer for a
foreground framebuffer.  So, we should return error code if it happens
to fail.

This patch fixes the following issue reported by Coverity:
Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer fbi_tmp.
if (fbi_tmp->var.vmode & FB_VMODE_INTERLACED)
var->vmode |= FB_VMODE_INTERLACED;
else
var->vmode &= ~FB_VMODE_INTERLACED;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11918-1 video: fbdev: mxc ipuv3 fb: Remove fbi NULL pointer check in ->remove()
Liu Ying [Mon, 30 Nov 2015 02:18:58 +0000 (10:18 +0800)]
MLK-11918-1 video: fbdev: mxc ipuv3 fb: Remove fbi NULL pointer check in ->remove()

The driver takes the pointer fbi as the driver data, so fbi cannot be a NULL
pointer in ->remove().  Let's remove the unnecessary NULL pointer check on
fbi.

This patch fixes the following issue reported by Coverity:
deref_ptr: Directly dereferencing pointer fbi.
struct mxcfb_info *mxc_fbi = fbi->par;

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking fbi suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
if (!fbi)
return 0;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11915-12 ASoC: fsl_asrc_m2m: fix null check issue for variable m2m and pair
Zidan Wang [Fri, 27 Nov 2015 05:50:12 +0000 (13:50 +0800)]
MLK-11915-12 ASoC: fsl_asrc_m2m: fix null check issue for variable m2m and pair

After allocating memory for m2m, we should null check for m2m instead of pair.

In fsl_asrc_close(), null-checking pair suggests that it may be null, but it
has already been dereferenced before the null check. pair will be alloceted
in fsl_asrc_open(), pair is null means that open dev file failed, and
close should not be called in user space. So remove null check for pair.

buf_len should not greater than ASRC_DMA_BUFFER_SIZE, otherwith dma buffer will
be overrun.

Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit b0dc15375b12b6c1bf46b9071b92267b827d8ce0)

7 years agoMLK-11915-11 ASoC: fsl_asrc_dma: check the return value for snd_pcm_hw_constraint_int...
Zidan Wang [Fri, 27 Nov 2015 05:45:09 +0000 (13:45 +0800)]
MLK-11915-11 ASoC: fsl_asrc_dma: check the return value for snd_pcm_hw_constraint_integer()

check the return value for snd_pcm_hw_constraint_integer().
Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 26f8fea617fcebd8835f660534a988c58b9f0517)

7 years agoMLK-11915-10 ASoC: imx_mqs: fix mqs_priv->name overrun issue
Zidan Wang [Fri, 27 Nov 2015 05:42:41 +0000 (13:42 +0800)]
MLK-11915-10 ASoC: imx_mqs: fix mqs_priv->name overrun issue

fix mqs_priv->name overrun issue. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit ef1c59f93981b15412a0207d5517a26901bb2ecd)

7 years agoMLK-11915-09 ASoC: cs42xx8: remove the no effect comparison
Zidan Wang [Fri, 27 Nov 2015 03:22:32 +0000 (11:22 +0800)]
MLK-11915-09 ASoC: cs42xx8: remove the no effect comparison

rate_tx and rate_rx are always greater than or equal to 0, so remove the
no effect comparison. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit d5957250784a27cf6f6f421d8a6e0ba45b4bbc18)

7 years agoMLK-11915-08 ASoC: imx-si476x: init fm_np to avoid wild pointer
Zidan Wang [Fri, 27 Nov 2015 06:44:51 +0000 (14:44 +0800)]
MLK-11915-08 ASoC: imx-si476x: init fm_np to avoid wild pointer

init fm_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit dea49f320f33e1f723301a0bfa18573c0f7b5fb1)

7 years agoMLK-11915-07 ASoC: imx-audmux: fix missing break in switch
Zidan Wang [Fri, 27 Nov 2015 03:20:49 +0000 (11:20 +0800)]
MLK-11915-07 ASoC: imx-audmux: fix missing break in switch

fix missing break in switch. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 302516a1dfca5758a34cbed939c9976679febb0c)

7 years agoMLK-11915-06 ASoC: fsl_esai: fix missing break in switch
Zidan Wang [Fri, 27 Nov 2015 03:15:38 +0000 (11:15 +0800)]
MLK-11915-06 ASoC: fsl_esai: fix missing break in switch

fix missing break in switch. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit ec9d74d9258e3320ec68a1f977932cb20ace4ca2)

7 years agoMLK-11915-05 ASoC: imx-wm8958: init codec_np to avoid wild pointer
Zidan Wang [Fri, 27 Nov 2015 03:14:36 +0000 (11:14 +0800)]
MLK-11915-05 ASoC: imx-wm8958: init codec_np to avoid wild pointer

init codec_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 76665930654867cf38a86ba747a9f8a5bf2665e2)

7 years agoMLK-11915-04 ASoC: imx-cs42888: init asrc_np to avoid wild pointer and check return...
Zidan Wang [Fri, 27 Nov 2015 03:12:30 +0000 (11:12 +0800)]
MLK-11915-04 ASoC: imx-cs42888: init asrc_np to avoid wild pointer and check return value of set_fmt()

init asrc_np to avoid wild pointer and check return value of
set_fmt(). Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 4ccc87a93e180e09b6494fd6c6d81b07dc054e9b)

7 years agoMLK-11915-03 ASoC: imx-sii902x: init sii902x_np to avoid wild pointer
Zidan Wang [Fri, 27 Nov 2015 03:10:53 +0000 (11:10 +0800)]
MLK-11915-03 ASoC: imx-sii902x: init sii902x_np to avoid wild pointer

init sii902x_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 780e27683c38f785ea7f7e07e83b00ffd3c22d78)

7 years agoMLK-11915-02 ASoC: imx-wm8962: init codec_np to avoid wild pointer
Zidan Wang [Fri, 27 Nov 2015 03:08:20 +0000 (11:08 +0800)]
MLK-11915-02 ASoC: imx-wm8962: init codec_np to avoid wild pointer

init codec_np to avoid wild pointer. Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 8e27b90c9adf5033038a40e0b61a7ffe4c971290)

7 years agoMLK-11915-01 ASoC: imx-wm8960: check return value and init codec_np to avoid wild...
Zidan Wang [Fri, 27 Nov 2015 02:53:09 +0000 (10:53 +0800)]
MLK-11915-01 ASoC: imx-wm8960: check return value and init codec_np to avoid wild pointer

check return value for set_fmt and set_sysclk function, and init
codec_np to avoid wild pointer. Reported by coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 68021ab9ada4a7f3037993a3887453e12271d4ed)

7 years agoMLK-11911-1 mxc IPUv3: capture: Define div_ratio as type of int32_t
Liu Ying [Thu, 26 Nov 2015 07:28:36 +0000 (15:28 +0800)]
MLK-11911-1 mxc IPUv3: capture: Define div_ratio as type of int32_t

The local variable div_ratio could be less than zero, so let's define
it as type of int32_t instead of uint32_t.

This issue is reported by Coverity:
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value
is never true. div_ratio < 0U.
if (div_ratio > 0xFF || div_ratio < 0) {
dev_dbg(ipu->dev, "value of pixel_clk extends normal range\n");
return -EINVAL;
}

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-7 mxc IPUv3: common: Convert macro tri_cur_buf_mask/shift to function
Liu Ying [Fri, 27 Nov 2015 06:29:53 +0000 (14:29 +0800)]
MLK-11911-7 mxc IPUv3: common: Convert macro tri_cur_buf_mask/shift to function

This patch converts macro tri_cur_buf_mask/shift to function to address the
following issue reported by Coverity:
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: dma_chan * 2 != 63 is always true regardless of
the values of its operands. This occurs as the logical first operand of '?:'.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-6 mxc IPUv3: Minor improvement for _ipu_is_smfc_chan()
Liu Ying [Thu, 26 Nov 2015 08:33:58 +0000 (16:33 +0800)]
MLK-11911-6 mxc IPUv3: Minor improvement for _ipu_is_smfc_chan()

A minor improvement for _ipu_is_smfc_chan() to address the following
issue reported by Coverity:
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of an
unsigned value is always true. dma_chan >= 0U.
return ((dma_chan >= 0) && (dma_chan <= 3));

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-5 mxc IPUv3: pixel clk: Free gate clk memory if clk_regiser fails
Liu Ying [Thu, 26 Nov 2015 08:30:25 +0000 (16:30 +0800)]
MLK-11911-5 mxc IPUv3: pixel clk: Free gate clk memory if clk_regiser fails

This patch fixes the following issue reported by Coverity:
if (IS_ERR(clk))
freed_arg: kfree frees clk. [Note: The source code implementation of the
function has been overridden by a builtin model.]
kfree(clk);

Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer clk.
return clk;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-4 mxc IPUv3: pixel clk: Free di_div clk memory if clk_regiser fails
Liu Ying [Thu, 26 Nov 2015 08:30:08 +0000 (16:30 +0800)]
MLK-11911-4 mxc IPUv3: pixel clk: Free di_div clk memory if clk_regiser fails

This patch fixes the following issue reported by Coverity:
if (IS_ERR(clk))
freed_arg: kfree frees clk. [Note: The source code implementation of the
function has been overridden by a builtin model.]
kfree(clk);

Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer clk.
return clk;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-3 mxc IPUv3: disp: Correct display ID check in ipu_uninit_sync_panel()
Liu Ying [Thu, 26 Nov 2015 08:11:17 +0000 (16:11 +0800)]
MLK-11911-3 mxc IPUv3: disp: Correct display ID check in ipu_uninit_sync_panel()

This patch fixes the following issue reported by Coverity:
Constant expression result (CONSTANT_EXPRESSION_RESULT)
always_true_or: The "or" condition disp != 0 || disp != 1 will always be true
because disp cannot be equal to two different values at the same time, so it
must be not equal to at least one of them.
if ((disp != 0) || (disp != 1))
return;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11911-2 mxc IPUv3: device: Correct bailout path for the ioctrl IPU_ALLOC
Liu Ying [Thu, 26 Nov 2015 07:51:44 +0000 (15:51 +0800)]
MLK-11911-2 mxc IPUv3: device: Correct bailout path for the ioctrl IPU_ALLOC

We should do the bailout dance correctly for the ioctrl IPU_ALLOC:
- Free the mem pointer.
- Free the DMA.
- Delete the mem->list from the ipu_alloc_list.

The potential memory leakage issue on the mem pointer is reported by Coverity:
if (get_user(size, argp))
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable mem going out of scope leaks the storage it points to.
return -EFAULT;

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11917-2 media: output: pxp_v4l2: correct comparing unsigned to 0
Fancy Fang [Mon, 30 Nov 2015 02:32:37 +0000 (10:32 +0800)]
MLK-11917-2 media: output: pxp_v4l2: correct comparing unsigned to 0

Comparing unsigned integer with 0 is meaningless. So
remove this kind of integer comparing.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11917-1 media: output: pxp_v4l2: remove some duplicate dead code
Fancy Fang [Mon, 30 Nov 2015 02:19:35 +0000 (10:19 +0800)]
MLK-11917-1 media: output: pxp_v4l2: remove some duplicate dead code

The code slice in the 'v4l2_fmt_to_pxp_fmt()' function:
"
        else if (v4l2_pix_fmt == V4L2_PIX_FMT_RGB555)
                pxp_fmt = PXP_PIX_FMT_RGB555;
"
appears twice continuously. And the second code slice
will become dead code which is never executed. So
remove the second one.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11912 cpufreq: imx: fix dereference null return value issue
Bai Ping [Thu, 26 Nov 2015 10:22:20 +0000 (18:22 +0800)]
MLK-11912 cpufreq: imx: fix dereference null return value issue

After coverity code check, it reports dereference NULL return value
complain, so fix it.

Signed-off-by: Bai Ping <b51503@freescale.com>
7 years agoMLK-11896-3 usb: chipidea: imx: add NULL check for usbmisc_data
Li Jun [Thu, 26 Nov 2015 09:35:13 +0000 (17:35 +0800)]
MLK-11896-3 usb: chipidea: imx: add NULL check for usbmisc_data

Check if data->usbmisc_data is NULL before dereference it in probe.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoMLK-11914-2 video: mipi_dsi: add the missing error code check
Fancy Fang [Fri, 27 Nov 2015 07:09:30 +0000 (15:09 +0800)]
MLK-11914-2 video: mipi_dsi: add the missing error code check

Add the missing error code check just as the others which
have the check.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11914-1 video: mipi_dsi: correct wrong buf index usage
Fancy Fang [Fri, 27 Nov 2015 07:04:06 +0000 (15:04 +0800)]
MLK-11914-1 video: mipi_dsi: correct wrong buf index usage

The 'buf' index loop is obviously wrong. So correct
it.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11913 dma: pxp-v3: remove some duplicate dead code
Fancy Fang [Fri, 27 Nov 2015 02:21:27 +0000 (10:21 +0800)]
MLK-11913 dma: pxp-v3: remove some duplicate dead code

The code slice in the pxp_probe() function:
"
       if (!res || irq < 0) {
               err = -ENODEV;
               goto exit;
       }
"
appears twice closely. And the second code slice will become
dead code which is never executed. So remove the second one.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11907 dma: pxp-dev: allocate the 'sg' buffer dynamically.
Fancy Fang [Thu, 26 Nov 2015 08:47:07 +0000 (16:47 +0800)]
MLK-11907 dma: pxp-dev: allocate the 'sg' buffer dynamically.

The 'sg' buffer should be allocated dynamically, since its
size is dependent on the 'sg_len' which is calculated
according to the functions required.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 57f08c108fc4f4721449b4b94be9820c7443978a)

7 years agoMLK-11896-2 usb: chipidea: imx: derefence pointer after NULL check
Li Jun [Thu, 26 Nov 2015 09:34:18 +0000 (17:34 +0800)]
MLK-11896-2 usb: chipidea: imx: derefence pointer after NULL check

Dereference data pointer after its NULL check.

Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoMLK-11896-1 usb: chipidea: imx: add break for switch case
Li Jun [Thu, 26 Nov 2015 02:48:05 +0000 (10:48 +0800)]
MLK-11896-1 usb: chipidea: imx: add break for switch case

Fix the coverity check complains although there is no function issue
with current code.

Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode
Zidan Wang [Mon, 9 Nov 2015 11:03:13 +0000 (19:03 +0800)]
ASoC: fsl-sai: set xCR4/xCR5/xMR for SAI master mode

For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will
generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4),
RCR5(TCR5) and RMR(TMR) for playback(capture), or there will be sync
error sometimes.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 51659ca069ce5bdf20675a7967a39ef8419e87f2)

7 years agoMGS-1276 ENGR00306443-2 dts:Add QoS description in imx6sx dts
Shawn Xiao [Mon, 2 Feb 2015 07:39:51 +0000 (15:39 +0800)]
MGS-1276 ENGR00306443-2 dts:Add QoS description in imx6sx dts

(cherry-pick from f9759787e60ad3422d2119f9f25ac320ca58f5df)

confilict: arch/arm/boot/dts/imx6sx.dtsi
The dts file arch has changed in 3.14. Add QoS description in
imx6sx dts manually and solve the conflict.

Date Feb 2, 2015

Signed-off-by: Shawn Xiao <b49994@freescale.com>
7 years agoMLK-11881 video: fbdev: mxc ipuv3 fb: Correct ->prefetch in ioctrl SET_PREFETCH
Liu Ying [Fri, 20 Nov 2015 05:50:20 +0000 (13:50 +0800)]
MLK-11881 video: fbdev: mxc ipuv3 fb: Correct ->prefetch in ioctrl SET_PREFETCH

When a framebuffer is blanked, the user may call the MXCFB_SET_PREFETCH ioctrl
to enable or disable the prefetch engine.  After sanity check, the cached
->prefetch should reflect the user's intention for next unblank operation
any way instead of checking ->cur_prefetch first.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11870 usb: chipidea: otg: disable term select override for B device
Li Jun [Wed, 18 Nov 2015 08:31:00 +0000 (16:31 +0800)]
MLK-11870 usb: chipidea: otg: disable term select override for B device

In MLK-11272, we introduce a workaround to resolve data pulse detection
IC issue in i.MX7D, but did not disable the term select override after
the A device becomes B device in some cases: a_idle --> enable term
select override --> b_idle, which cause the B device cannot be enumerated
in b_peripheral mode. This patch is to fix it by disable the term select
and data pulse when A device becomes B device.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 2df52fcaded838a572c2ee8f93d6cc827a2ebc60)

7 years agoMLK-11857 mxc IPUv3: PRE: Use spinlock to protect pre_list instead of mutex
Liu Ying [Fri, 13 Nov 2015 06:55:55 +0000 (14:55 +0800)]
MLK-11857 mxc IPUv3: PRE: Use spinlock to protect pre_list instead of mutex

The pre_list can be accessed in an irq context.  To avoid potential hang up
issue, use spinlock to protect pre_list instead of mutex.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11874 media: platform: mxc v4l2 capture: Correct suspend/resume for capture
Liu Ying [Thu, 19 Nov 2015 05:43:58 +0000 (13:43 +0800)]
MLK-11874 media: platform: mxc v4l2 capture: Correct suspend/resume for capture

The capture channel should be correctly disabled in ->suspend() and
enabled in ->resume() with ->enc_disable()/->enc_disable_csi() and
->enc_enable()/->enc_enable_csi() respectively.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
7 years agoMLK-11876 dma: imx-sdma: fix 'section mismatch'
Robin Gong [Thu, 19 Nov 2015 03:07:50 +0000 (11:07 +0800)]
MLK-11876 dma: imx-sdma: fix 'section mismatch'

The commit '39c6663 MLK-11848-2 dma: imx-sdma: add __init for probe()' is
not correct, fix it totally.

Signed-off-by: Robin Gong <b38343@freescale.com>
7 years agoMLK-11832: MIPI CSI: Adjust mipi csi sensor power up process
Sandor Yu [Wed, 18 Nov 2015 03:43:59 +0000 (11:43 +0800)]
MLK-11832: MIPI CSI: Adjust mipi csi sensor power up process

Add s_stream interface for MIPI CSI and ov5647/ov5640 drivers.
Enable MIPI CSI sensor after MIPI CSI DPHY CLK enable
in case MIPI DPHY miss MIPI CSI sensor signal.

Signed-off-by: Sandor Yu <R01008@freescale.com>
(cherry picked from commit 26d81b416be6e3af203d1254a3116dbcf39a5605)

7 years agoMLK-11859: dts: Fix imx7D mipi csi reset bit error
Sandor Yu [Tue, 17 Nov 2015 09:20:51 +0000 (17:20 +0800)]
MLK-11859: dts: Fix imx7D mipi csi reset bit error

There is a error in i.MX7D RM RevB.
Actually the register of SRC_MIPIPHY_RCR(src offset 0x28)
bit 1 for MIPI PHY Master Reset
bit 2 for MIPI PHY Slave Reset.

Signed-off-by: Sandor Yu <R01008@freescale.com>
(cherry picked from commit 4f3128a79c023319c9e21690be866dc46a9d6816)

7 years agoMLK-11813 change the clock type of 'pre_periph_sel' on imx6sl
Bai Ping [Tue, 3 Nov 2015 16:51:34 +0000 (00:51 +0800)]
MLK-11813 change the clock type of 'pre_periph_sel' on imx6sl

The 'pre_periph2_sel' and 'pre_periph_clk' and other two clks
should have the ability to change its parent clk without disabling
itself first, so change the clk type of these clocks to make the
parent can be swithed without disabling the clock.

Signed-off-by: Bai Ping <b51503@freescale.com>
7 years agoMLK-11803 pci: imx: imx6qp pcie ep self-test failed
Richard Zhu [Mon, 2 Nov 2015 03:41:02 +0000 (11:41 +0800)]
MLK-11803 pci: imx: imx6qp pcie ep self-test failed

imx pcie used the wrab mode to do the cached access
methods on axi bus. There is 64bytes address mis-aligned
problem.
Disable the cached operations.

Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
(cherry picked from commit 85db70336ab66136481926bcd7f5abe599e2aa4f)

7 years agoMLK-11765 video: mxsfb: change the fb buffer managment
Fancy Fang [Wed, 28 Oct 2015 09:16:01 +0000 (17:16 +0800)]
MLK-11765 video: mxsfb: change the fb buffer managment

The previous fb buffer management has two problems:

1. After reallocate a bigger buffer and free the old buffer,
   user space app doesn't know this and may continue accessing
   the old buffer.
2. The freed buffer contents will be lost.

So, this patch allocates a big enough fb buffer(32MB) from the
beginning and never reallocates it.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit c76a37e342369675aa9ef2efde6373d288c2f013)

Conflicts:
drivers/video/mxsfb.c

7 years agoMLK-11849: ARM: dts: fix the iomux issue in sai dts
Han Xu [Tue, 10 Nov 2015 20:19:53 +0000 (14:19 -0600)]
MLK-11849: ARM: dts: fix the iomux issue in sai dts

some issue was involved when merging the commit to kernel 4.1

Signed-off-by: Han Xu <b45815@freescale.com>
7 years agoMLK-11848-2 dma: imx-sdma: add __init for probe()
Robin Gong [Tue, 10 Nov 2015 10:29:01 +0000 (18:29 +0800)]
MLK-11848-2 dma: imx-sdma: add __init for probe()

Fix buiding error with GCC 4.6.2:

WARNING: drivers/dma/built-in.o(.text+0xefac): Section mismatch in reference from the function sdma_probe() to the function .init.text:sdma_event_remap.isra.21()
The function sdma_probe() references
the function __init sdma_event_remap.isra.21().
This is often because sdma_probe lacks a __init
annotation or the annotation of sdma_event_remap.isra.21 is wrong.

Signed-off-by: Robin Gong <b38343@freescale.com>
7 years agoMLK-11848-1 spi: spi: Revert "spi: check tx_buf and rx_buf in spi_unmap_msg"
Robin Gong [Tue, 10 Nov 2015 10:06:53 +0000 (18:06 +0800)]
MLK-11848-1 spi: spi: Revert "spi: check tx_buf and rx_buf in spi_unmap_msg"

This commit 06634f8a25f4c5e4ff0c0ef5368a48eb394db63b cherry-picked wrong,
and that cause SPI DMA mode never works. Actually, no need this patch since
this patch has already been upsteaminged as below:

commit f8bb820da4ae863c676156627973a950129559fb
Author: Robin Gong <b38343@freescale.com>
Date:   Thu Apr 16 10:54:18 2015 +0800

    spi: check tx_buf and rx_buf in spi_unmap_msg

Signed-off-by: Robin Gong <b38343@freescale.com>
7 years agoMLK-11844-2 ARM: dts: imx7d: reserve DDR space for M4 use case
Anson Huang [Tue, 10 Nov 2015 11:12:55 +0000 (19:12 +0800)]
MLK-11844-2 ARM: dts: imx7d: reserve DDR space for M4 use case

FreeRTOS/M4 has DDR use case, M4 can only execute on DDR
space lower than 0xa0000000, Linux kernel will reserve 1M
(0x9ff00000 - 0x9fffffff) for it, below are the DDR usage:

0x80000000 - 0x9fefffff: Linux kernel;
0x9ff00000 - 0x9fffffff: FreeRTOS;
0xa0000000 - 0xbfefffff: Linux kernel;
0xbff00000 - 0xbfffffff: RPMSG shared memory;
0xc0000000 - 0xffffffff: Linux kernel if boards has 2GB DDR.

Also, remove 'reg' property which is unused.

Signed-off-by: Anson Huang <Anson.Huang@freescale.com>
7 years agoMLK-11844-1 ARM: dts: imx6sx: reserve DDR space for M4 use case
Anson Huang [Tue, 10 Nov 2015 11:05:02 +0000 (19:05 +0800)]
MLK-11844-1 ARM: dts: imx6sx: reserve DDR space for M4 use case

FreeRTOS/M4 has DDR use case, M4 can only execute on DDR
space lower than 0xa0000000, Linux kernel will reserve 1M
(0x9ff00000 - 0x9fffffff) for it, below are the DDR usage:

0x80000000 - 0x9fefffff: Linux kernel;
0x9ff00000 - 0x9fffffff: FreeRTOS;
0xa0000000 - 0xbfefffff: Linux kernel;
0xbff00000 - 0xbfffffff: RPMSG shared memory;
0xc0000000 - 0xffffffff: Linux kernel if boards has 2GB DDR.

Also, remove 'reg' property which is unused.

Signed-off-by: Anson Huang <Anson.Huang@freescale.com>
7 years agoMLK-11828-2 ARM: dts: reserve OCRAM space for M4
Anson Huang [Fri, 6 Nov 2015 10:46:35 +0000 (18:46 +0800)]
MLK-11828-2 ARM: dts: reserve OCRAM space for M4

FreeRTOS has use case of running on OCRAM, reserve the
bottom half of OCRAM spase(0x910000 - 0x91efff) for M4,
the last 4K is for shared memory power management.

Signed-off-by: Anson Huang <Anson.Huang@freescale.com>