]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
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>
9 years agoARM: dts: imx6qdl: Allow disabling the PU regulator, add a enable ramp delay
Philipp Zabel [Thu, 6 Mar 2014 09:58:48 +0000 (10:58 +0100)]
ARM: dts: imx6qdl: Allow disabling the PU regulator, add a enable ramp delay

The PU regulator is enabled during boot, but not necessarily always-on.
It can be disabled by the generic pm domain framework when the PU power
domain is shut down. The ramp delay of 150 us might be a bit conservative,
the value is taken from the Freescale kernel.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[shawn.guo: http://thread.gmane.org/gmane.linux.drivers.devicetree/64973]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx6sl: Add power-domain information to gpc node
Philipp Zabel [Thu, 6 Mar 2014 09:58:47 +0000 (10:58 +0100)]
ARM: dts: imx6sl: Add power-domain information to gpc node

The PGC that is part of GPC controls isolation and power sequencing of the
power domains. The PU power domain will be handled by the generic pm domain
framework. It needs a phandle to the PU regulator to turn off power when
the domain is disabled and a list of clocks to be enabled during powerup
for reset propagation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[shawn.guo: http://thread.gmane.org/gmane.linux.drivers.devicetree/64973]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx6qdl: Add power-domain information to gpc node
Philipp Zabel [Thu, 6 Mar 2014 09:58:46 +0000 (10:58 +0100)]
ARM: dts: imx6qdl: Add power-domain information to gpc node

The PGC that is part of GPC controls isolation and power sequencing of the
power domains. The PU power domain will be handled by the generic pm domain
framework. It needs a phandle to the PU regulator to turn off power when
the domain is disabled, and a list of phandles to all clocks that must be
enabled during powerup for reset propagation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[shawn.guo: http://thread.gmane.org/gmane.linux.drivers.devicetree/64973]
[shawn.guo: use macro for clock IDs]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: imx6: gpc: Add PU power domain for GPU/VPU
Philipp Zabel [Thu, 6 Mar 2014 09:58:45 +0000 (10:58 +0100)]
ARM: imx6: gpc: Add PU power domain for GPU/VPU

When generic pm domain support is enabled, the PGC can be used
to completely gate power to the PU power domain containing GPU3D,
GPU2D, and VPU cores.
This code triggers the PGC powerdown sequence to disable the GPU/VPU
isolation cells and gate power and then disables the PU regulator.
To reenable, the reverse powerup sequence is triggered after the PU
regulator is enabled again.
The GPU and VPU devices in the PU power domain temporarily need
to be clocked during powerup, so that the reset machinery can work.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[shawn.guo: http://thread.gmane.org/gmane.linux.drivers.devicetree/64973]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoDocumentation: Add device tree bindings for Freescale i.MX GPC
Philipp Zabel [Thu, 6 Mar 2014 09:58:44 +0000 (10:58 +0100)]
Documentation: Add device tree bindings for Freescale i.MX GPC

The i.MX6 contains a power controller that controls power gating and
sequencing for the SoC's power domains.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[shawn.guo: http://thread.gmane.org/gmane.linux.drivers.devicetree/64973]
[shawn.guo: update property name to be 'power-domains']
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agodrivercore: Bind/unbind power domain on probe/remove
Tomasz Figa [Thu, 8 May 2014 12:49:14 +0000 (14:49 +0200)]
drivercore: Bind/unbind power domain on probe/remove

On a number of platforms, devices are part of controllable power
domains, which need to be enabled before such devices can be accessed
and may be powered down when the device is idle to save some power.
This means that on systems that support power domain control using
generic power domains subsystem, it is necessary to add device to its
power domain before binding a driver to it and remove it from its power
domain after its driver is unbound to make sure that an unused device
does not affect power domain state.

Since this is not limited to particular busses and specific
archs/platforms, it is more convenient to do the above directly in
driver core, just as done with pinctrl default configuration. This patch
adds necessary code to really_probe() and __device_release_driver() to
achieve this and maintain consistent stack-like ordering of operations
happening when binding and unbinding a driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
[on i.MX6 GK802]
Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
[shawn.guo: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/31029]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agobase: power: Add generic OF-based power domain look-up
Tomasz Figa [Thu, 8 May 2014 12:49:13 +0000 (14:49 +0200)]
base: power: Add generic OF-based power domain look-up

This patch introduces generic code to perform power domain look-up using
device tree and automatically bind devices to their power domains.
Generic device tree binding is introduced to specify power domains of
devices in their device tree nodes.

Backwards compatibility with legacy Samsung-specific power domain
bindings is provided, but for now the new code is not compiled when
CONFIG_ARCH_EXYNOS is selected to avoid collision with legacy code. This
will change as soon as Exynos power domain code gets converted to use
the generic framework in further patch.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Philipp Zabel <philipp.zabel@gmail.com>
[on i.MX6 GK802]
Tested-by: Philipp Zabel <philipp.zabel@gmail.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
[shawn.guo: http://thread.gmane.org/gmane.linux.kernel.samsung-soc/31029]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: regulator: anatop: force vddpu to use same voltage level as vddsoc
Shawn Guo [Mon, 16 Jun 2014 06:11:51 +0000 (14:11 +0800)]
ENGR00317981: regulator: anatop: force vddpu to use same voltage level as vddsoc

The anatop on i.MX6 requires that vddpu use the same voltage level as
vddsoc.  It's a quick hacking to force the check whenever vddpu is
about to be enabled.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoregulator: anatop: Remove checking control_reg in [set|get]_voltage_sel
Axel Lin [Sat, 22 Feb 2014 04:53:18 +0000 (12:53 +0800)]
regulator: anatop: Remove checking control_reg in [set|get]_voltage_sel

Remove checking control_reg in [set|get]_voltage_sel and then convert to use
regulator_[set|get]_voltage_sel_regmap for [set|get]_voltage_sel callbacks.

The anatop-reg-offset property is a required property rather than optional
property. So the question is what is the meaning of setting anatop-reg-offset
to 0? If 0 is a valid setting for anatop-reg-offset and it has special meaning,
we had better document it in the binding document. Otherwise, remove the testing
for control_reg in the driver.

No anatop voltage regulator node in the dts files set anatop-reg-offset to 0.
So I think it's safe to remove testing if control_reg is 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
[shawn.guo: cherry-pick commit 114c5748d540 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoregulator: anatop: Add bypass support to digital LDOs
Philipp Zabel [Tue, 11 Feb 2014 13:43:45 +0000 (14:43 +0100)]
regulator: anatop: Add bypass support to digital LDOs

The ARM, PU, and SOC LDOs in the i.MX6 PMU can operate
in bypass mode. This allows to use external switching
regulators for cpu voltage scaling.

Since bypass and power gating modes are not configured
with their own bits, but via the voltage target bitfield,
store bypass state to be restored when reenabling the
regulator.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
[shawn.guo: cherry-pick commit d38018f2019c from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoregulator: anatop: Add power gating support to digital LDOs
Philipp Zabel [Tue, 11 Feb 2014 13:43:44 +0000 (14:43 +0100)]
regulator: anatop: Add power gating support to digital LDOs

The ARM, PU, and SOC LDOs in the i.MX6 PMU can completely gate
their power output. Since power gating is configured by writing
zero to the voltage target bitfield,, store a copy of the
voltage selector to be restored when reenabling the regulator.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
[shawn.guo: cherry-pick commit 605ebd35f059 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: ARM: dts: imx6qdl: add LDB and LCD for imx6qdl-sabresd
Shawn Guo [Sun, 15 Jun 2014 03:55:24 +0000 (11:55 +0800)]
ENGR00317981: ARM: dts: imx6qdl: add LDB and LCD for imx6qdl-sabresd

It's a device tree source porting from imx_3.10.y regarding to LDB and
LCD support on imx6qdl-sabresd board.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00274172-1 ARM: imx6q: refactor some ldb related clocks
Liu Ying [Tue, 20 Aug 2013 06:37:47 +0000 (14:37 +0800)]
ENGR00274172-1 ARM: imx6q: refactor some ldb related clocks

The ldb_di[0|1]_ipu_div dividers may divide their parent clock
frequencies by either 3.5 or 7. The non-integral dividers cannot
be dealt with the common clock framework, so they cannot be
registered as common clock dividers. So this patch adds a fixed
factor clock of 1/7 and introduces ldb_di[0|1]_div_sel multiplexers
so that the fixed factor clocks of 1/3.5 and 1/7 can be set to be
the parents of ldb_di[0|1]_div_sel multiplexers. The ldb_di[0|1]_podf
dividers are no longer used then.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
[shawn.guo: cherry-pick commit aae58d71b525 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
Documentation/devicetree/bindings/clock/imx6q-clock.txt
arch/arm/mach-imx/clk-imx6q.c

9 years agoENGR00317981: ARM: imx6qdl: initialize IPU clocks
Shawn Guo [Sun, 15 Jun 2014 14:20:36 +0000 (22:20 +0800)]
ENGR00317981: ARM: imx6qdl: initialize IPU clocks

Initialize IPU related clock in the same way as imx_v3.10.y

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx6qdl: use DT macro for clock ID
Shawn Guo [Sun, 15 Jun 2014 12:36:50 +0000 (20:36 +0800)]
ARM: dts: imx6qdl: use DT macro for clock ID

Switch to use DT macro for clock ID, so that device tree source is more
readable.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick from community IMX tree]

Conflicts:
arch/arm/boot/dts/imx6dl.dtsi
arch/arm/boot/dts/imx6qdl.dtsi

9 years agoARM: imx6qdl: switch to use macro for clock ID
Shawn Guo [Sun, 15 Jun 2014 11:35:10 +0000 (19:35 +0800)]
ARM: imx6qdl: switch to use macro for clock ID

Instead of using enum for clock ID, let's switch imx6qdl clock driver to
use macro.  In this case, device tree can reuse these macros to improve
readability.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick from community IMX tree]

Conflicts:
arch/arm/mach-imx/clk-imx6q.c

9 years agoARM: dts: imx6: i2c4 cleanup
Iain Paton [Fri, 9 May 2014 15:01:56 +0000 (16:01 +0100)]
ARM: dts: imx6: i2c4 cleanup

add missing i2c4 clock and correct the compatible string to match other
imx6 i2c blocks

Signed-off-by: Iain Paton<ipaton0@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick from community IMX tree]

9 years agoARM: imx6: clk: i.MX6 DualLite/Solo i2c4 clock
Iain Paton [Wed, 16 Apr 2014 18:33:24 +0000 (19:33 +0100)]
ARM: imx6: clk: i.MX6 DualLite/Solo i2c4 clock

Compared to i.MX6 Quad/Dual the CCM_CCGR1 register in the i.MX6 Solo/DualLite
replaces the ecspi5 clock with the i2c4 clock.

Handle this difference using cpu_is_imx6dl().

Signed-off-by: Iain Paton <ipaton0@gmail.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick commit ee3387f97bea from upstream]

9 years agoARM: imx6q: clk: Parent DI clocks to video PLL via di_pre_sel
Sascha Hauer [Mon, 14 Apr 2014 14:20:39 +0000 (16:20 +0200)]
ARM: imx6q: clk: Parent DI clocks to video PLL via di_pre_sel

Route the video PLL to the display interface clocks via the di_pre_sel
and di_sel muxes by default.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
[shawn.guo: cherry-pick commit 17b9b3b9e88a from upstream]

9 years agoARM: imx6q: add the missing esai_ahb clock
Shawn Guo [Sat, 19 Apr 2014 03:15:06 +0000 (11:15 +0800)]
ARM: imx6q: add the missing esai_ahb clock

The esai_ahb clock is derived from ahb and used to provide ESAI the
capability of register accessing and FSYS clock source for I2S clocks
dividing.  The gate bits of this esai_ahb clock are shared with the
esai clock -- the baud clock, so we need to call imx_clk_gate2_shared()
for these two clocks.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
[shawn.guo: cherry-pick commit 886cda418b28 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: media: mxc_pxp_v4l2: change __s32 to __u32
Shawn Guo [Fri, 13 Jun 2014 09:19:47 +0000 (17:19 +0800)]
ENGR00317981: media: mxc_pxp_v4l2: change __s32 to __u32

Commit f90580ca0133 ([media] videodev2: Set vb2_rect's width and height
as unsigned) changes v4l2_rect's width and height from __s32 to __u32,
and thus we see the build error below.

  CC      drivers/media/platform/mxc/output/mxc_pxp_v4l2.o
drivers/media/platform/mxc/output/mxc_pxp_v4l2.c: In function ‘pxp_try_fmt_output_overlay’:
drivers/media/platform/mxc/output/mxc_pxp_v4l2.c:605:16: warning: comparison of distinct pointer types lacks a cast [enabled by default]
drivers/media/platform/mxc/output/mxc_pxp_v4l2.c:607:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Fix the error by changing __s32 to __u32.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: media: forward mxc video output drivers to 3.14 kernel
Shawn Guo [Fri, 13 Jun 2014 09:16:59 +0000 (17:16 +0800)]
ENGR00317981: media: forward mxc video output drivers to 3.14 kernel

Forward imx_3.10.y mxc video output drivers to 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00268508 backlight:Correct the setting for bd props.fb_blank
Liu Ying [Tue, 25 Jun 2013 09:13:33 +0000 (17:13 +0800)]
ENGR00268508 backlight:Correct the setting for bd props.fb_blank

The patch of "ENGR00264855 backlight: Support backlight shared by
multiple fbs" doesn't consider that bd->props.fb_blank could be
shared by several framebuffers which use the same backlight device.
This causes the pwm backlight wrongly check the fb blank status.
This patch corrects the setting for the fb blank status by
considering all the framebuffers in question to fix the issue.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit 68b97d114629f22f64b3d8c14d0a0b7d07d6ebb2)
[shawn.guo: cherry-pick commit 8a03a96fba08 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00264855 backlight: Support backlight shared by multiple fbs
Liu Ying [Thu, 30 May 2013 05:56:17 +0000 (13:56 +0800)]
ENGR00264855 backlight: Support backlight shared by multiple fbs

One backlight device may shared by multiple framebuffers.
We don't hope blanking one of the framebuffers may turn the
backlight off for all the other framebuffers, since they are
likely active to show display content. This patch adds logic
to record each framebuffer's backlight usage to determine the
backlight device use count and whether the backlight should be
turned on or off.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit 37cbf741e4dff1f757f3ade6bb861d9a2af70693)
[shawn.guo: cherry-pick commit d62e7e8a788b from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: iomuxc-gpr: forward imx6q-iomuxc-gpr.h to 3.14 kernel
Shawn Guo [Thu, 12 Jun 2014 06:52:33 +0000 (14:52 +0800)]
ENGR00317981: iomuxc-gpr: forward imx6q-iomuxc-gpr.h to 3.14 kernel

Forward imx_3.10.y imx6q-iomuxc-gpr.h to 3.14 kernel.

Keep IMX6Q_GPR1_GINT for need from arch/arm/mach-imx/pm-imx6.c

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: video: forward mxc video drivers to 3.14 kernel
Shawn Guo [Thu, 12 Jun 2014 07:12:20 +0000 (15:12 +0800)]
ENGR00317981: video: forward mxc video drivers to 3.14 kernel

Forward imx_3.10_y mxc video drivers to 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: mfd: forward mxc hdmi mfd driver to 3.14 kernel
Shawn Guo [Thu, 12 Jun 2014 08:23:33 +0000 (16:23 +0800)]
ENGR00317981: mfd: forward mxc hdmi mfd driver to 3.14 kernel

Forward imx_3.10.y mxc hdmi mfd driver to 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00275031-1 mx6sl fb: support lcdif framebuffer on 3.10
Robby Cai [Thu, 22 Aug 2013 06:35:09 +0000 (14:35 +0800)]
ENGR00275031-1 mx6sl fb: support lcdif framebuffer on 3.10

re-use the upstreaming mxsfb.c code.
- add the lcdif axi clock for register and dram access
- set the lcdif pix's parent as pll5_video to get most accurate pix clock
- add binding doc for lcdif dts

Signed-off-by: Robby Cai <R63905@freescale.com>
[shawn.guo: cherry-pick commit 423273b4437f from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Conflicts:
drivers/video/mxsfb.c

9 years agoENGR00317981: pxp: use DMA_COMPLETE for dma completion status
Shawn Guo [Thu, 12 Jun 2014 07:43:56 +0000 (15:43 +0800)]
ENGR00317981: pxp: use DMA_COMPLETE for dma completion status

DMA_SUCCESS is removed by commit 7db5f7274a0b (dmaengine: remove unused
DMA_SUCCESS).  Let's follow commit 409bff6a0f46 (dmaengine: imx-sdma: use
DMA_COMPLETE for dma completion status) to use DMA_COMPLETE instead.

This is to fix the following build error.

  CC      drivers/dma/pxp/pxp_dma_v2.o
drivers/dma/pxp/pxp_dma_v2.c: In function ‘pxp_tx_status’:
drivers/dma/pxp/pxp_dma_v2.c:1512:9: error: ‘DMA_SUCCESS’ undeclared (first use in this function)

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: pxp: forward pxp driver to 3.14 kernel
Shawn Guo [Thu, 12 Jun 2014 07:27:57 +0000 (15:27 +0800)]
ENGR00317981: pxp: forward pxp driver to 3.14 kernel

Forward imx_3.10.y pxp driver to 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: drm: vivante: drm_platform_exit is gone
Shawn Guo [Fri, 13 Jun 2014 03:37:29 +0000 (11:37 +0800)]
ENGR00317981: drm: vivante: drm_platform_exit is gone

The function drm_platform_exit() is removed by commit e2577d455adb (drm:
rip out drm_platform_exit).  To fix the build error below, we need to
call drm_put_dev directly.

  CC      drivers/gpu/drm/vivante/vivante_drv.o
drivers/gpu/drm/vivante/vivante_drv.c: In function ‘vivante_exit’:
drivers/gpu/drm/vivante/vivante_drv.c:100:3: error: implicit declaration of function ‘drm_platform_exit’ [-Werror=implicit-function-declaration]

Note, this only works with commit "ENGR00317981: drm: set drm_device
pointer into drvdata".

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: drm: set drm_device pointer into drvdata
Shawn Guo [Fri, 13 Jun 2014 08:02:58 +0000 (16:02 +0800)]
ENGR00317981: drm: set drm_device pointer into drvdata

If drvdata is not used by platform driver, let's set drm_device
pointer into it.  We take this as the default usage of drvdata,
and platform driver is free to overwrite it later as needed.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: drm: vivante: flag DRIVER_USE_MTRR is gone
Shawn Guo [Fri, 13 Jun 2014 02:45:39 +0000 (10:45 +0800)]
ENGR00317981: drm: vivante: flag DRIVER_USE_MTRR is gone

The flag DRIVER_USE_MTRR is removed by commit 281856477cda (drm: rip out
drm_core_has_MTRR checks).  Drop it from vivante driver to fix the build
error below.

  CC      drivers/gpu/drm/vivante/vivante_drv.o
drivers/gpu/drm/vivante/vivante_drv.c:72:21: error: ‘DRIVER_USE_MTRR’ undeclared here (not in a function)

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: drm: vivante: drm_fasync is gone
Shawn Guo [Fri, 13 Jun 2014 02:41:19 +0000 (10:41 +0800)]
ENGR00317981: drm: vivante: drm_fasync is gone

The drm_fasync() is gone since commit b0e898ac555e (drm: remove FASYNC
support).  Remove it from vivante driver to fix the build error below.

  CC      drivers/gpu/drm/vivante/vivante_drv.o
drivers/gpu/drm/vivante/vivante_drv.c:68:12: error: ‘drm_fasync’ undeclared here (not in a function)

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: drm: forward vivante driver to 3.14 kernel
Shawn Guo [Fri, 13 Jun 2014 02:36:33 +0000 (10:36 +0800)]
ENGR00317981: drm: forward vivante driver to 3.14 kernel

Forward imx_3.10.y vivante drm driver to 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: gpu-viv: use reinit_completion instead of INIT_COMPLETION
Shawn Guo [Thu, 12 Jun 2014 06:02:43 +0000 (14:02 +0800)]
ENGR00317981: gpu-viv: use reinit_completion instead of INIT_COMPLETION

INIT_COMPLETION was removed by commit 62026aedaace (sched: remove
INIT_COMPLETION), so we're seeing the following build error.

  CC      drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c: In function ‘gckOS_Signal’:
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:7506:9: error: implicit declaration of function ‘INIT_COMPLETION’ [-Werror=implicit-function-declaration]

Follow commit 16735d022f72 (tree-wide: use reinit_completion instead of
INIT_COMPLETION) to fix the error.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: mxc: forward mxc drivers to 3.14 kernel
Shawn Guo [Thu, 12 Jun 2014 02:13:32 +0000 (10:13 +0800)]
ENGR00317981: mxc: forward mxc drivers to 3.14 kernel

Forward imx_3.10.y mxc drivers to 3.14 kernel.  This includes all
the imx_3.10.y drivers in drivers/mxc folder except ASRC.  We will try
to use upstream ASRC driver on 3.14 kernel.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00275542-4 ARM: imx: Enable thermal driver for i.MX6SL
Anson Huang [Mon, 19 Aug 2013 20:19:34 +0000 (16:19 -0400)]
ENGR00275542-4 ARM: imx: Enable thermal driver for i.MX6SL

Add thermal dts to enable thermal driver for i.MX6SL.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit 72e3326a6020 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoARM: dts: imx6qdl: add necessary thermal clk
Anson Huang [Thu, 19 Dec 2013 18:17:23 +0000 (13:17 -0500)]
ARM: dts: imx6qdl: add necessary thermal clk

Thermal sensor needs pll3_usb_otg when measuring temperature,
so we need to pass clk info to thermal driver.

Signed-off-by: Anson Huang <b20788@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
[shawn.guo: cherry-pick commit f430d19c371f from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agothermal: imx: update formula for thermal sensor
Anson Huang [Wed, 12 Feb 2014 10:06:35 +0000 (18:06 +0800)]
thermal: imx: update formula for thermal sensor

Thermal sensor used to need two calibration points which are
in fuse map to get a slope for converting thermal sensor's raw
data to real temperature in degree C. Due to the chip calibration
limitation, hardware team provides an universal formula to get
real temperature from internal thermal sensor raw data:

Slope = 0.4297157 - (0.0015976 * 25C fuse);

Update the formula, as there will be no hot point calibration
data in fuse map from now on.

Signed-off-by: Anson Huang <b20788@freescale.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[shawn.guo: cherry-pick commit 749e8be71d61 from upstream]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00274056-1 thermal: add device cooling for thermal driver
Anson Huang [Thu, 8 Aug 2013 17:20:40 +0000 (13:20 -0400)]
ENGR00274056-1 thermal: add device cooling for thermal driver

cpu cooling is not enough when temperature is
too hot, as some devices may contribute a lot of heat
to SOC, such as GPU, so we need to add device cooling
as well, when system is too hot, devices can also take
their actions to lower SOC temperature.

when temperature cross the passive trip, device cooling
driver will send out notification, those devices who
register this devfreq_cooling notification will take
actions to lower SOC temperature.

Signed-off-by: Anson Huang <b20788@freescale.com>
[shawn.guo: cherry-pick commit 71493e909a65 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00317981: busfreq: fix the use of MT_MEMORY_NONCACHED
Shawn Guo [Thu, 12 Jun 2014 02:56:24 +0000 (10:56 +0800)]
ENGR00317981: busfreq: fix the use of MT_MEMORY_NONCACHED

Since commit 2e2c9de207be (ARM: add permission annotations to MT_MEMORY*
mapping types), MT_MEMORY_NONCACHED is not available any more.  Thus, we
see following build error.

  CC      arch/arm/mach-imx/busfreq_ddr3.o
arch/arm/mach-imx/busfreq_ddr3.c: In function ‘init_mmdc_settings’:
arch/arm/mach-imx/busfreq_ddr3.c:464:7: error: ‘MT_MEMORY_NONCACHED’ undeclared (first use in this function)

Fix it by using the new enum MT_MEMORY_RWX_NONCACHED.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00278432 [MX6x:Busfreq] Fix build warning.
Ranjani Vaidyanathan [Thu, 5 Sep 2013 22:06:10 +0000 (17:06 -0500)]
ENGR00278432 [MX6x:Busfreq] Fix build warning.

Fix build warning in arch/arm/mach-imx/busfreq_ddr3.c.

Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
[shawn.guo: cherry-pick commit 312864a0b7e7 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agoENGR00275974-1 [iMX6DQ/iMX6DL] Add busfreq support
Ranjani Vaidyanathan [Tue, 20 Aug 2013 19:30:16 +0000 (14:30 -0500)]
ENGR00275974-1 [iMX6DQ/iMX6DL] Add busfreq support

Add support to drop DDR and AHB frequency to 24MHz in
system IDLE state.

Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
[shawn.guo: cherry-pick commit 7091e3d1c771 from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
9 years agousb: phy: mxs: Add sync time after controller clear phcd
Peter Chen [Mon, 24 Feb 2014 02:21:04 +0000 (10:21 +0800)]
usb: phy: mxs: Add sync time after controller clear phcd

After clear portsc.phcd, PHY needs 200us stable time for switch
32K clock to AHB clock.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 47d1845ffac0 from upstream]

9 years agousb: phy: mxs: Add system suspend/resume API
Peter Chen [Mon, 24 Feb 2014 02:21:03 +0000 (10:21 +0800)]
usb: phy: mxs: Add system suspend/resume API

We need this to keep PHY's power on or off during the system
suspend mode. If we need to enable USB wakeup, then we
must keep PHY's power being on during the system suspend mode.
Otherwise, we need to keep PHY's power being off to save power.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit bf7834380086 from upstream]

9 years agousb: phy: mxs: Add implementation of set_wakeup
Peter Chen [Mon, 24 Feb 2014 02:21:02 +0000 (10:21 +0800)]
usb: phy: mxs: Add implementation of set_wakeup

When we need the PHY can be waken up by external signals,
we can call this API. Besides, we call mxs_phy_disconnect_line
at this API to close the connection between USB PHY and
controller, after that, the line state from controller is SE0.
Once the PHY is out of power, without calling mxs_phy_disconnect_line,
there are unknown wakeups due to dp/dm floating at device mode.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 3f1265056be0 from upstream]

9 years agousb: phy: Add set_wakeup API
Peter Chen [Mon, 24 Feb 2014 02:21:01 +0000 (10:21 +0800)]
usb: phy: Add set_wakeup API

This API is used to set wakeup enable at PHY registers, in that
case, the PHY can be waken up from suspend due to external events,
like vbus change, dp/dm change and id change.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 57bf9b09a6ad from upstream]

9 years agousb: phy: mxs: add controller id
Peter Chen [Mon, 24 Feb 2014 02:21:00 +0000 (10:21 +0800)]
usb: phy: mxs: add controller id

It is used to access un-regulator registers according to
different controllers.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 83be181b6422 from upstream]

9 years agousb: phy: mxs: Enable IC fixes for related SoCs
Peter Chen [Mon, 24 Feb 2014 02:20:59 +0000 (10:20 +0800)]
usb: phy: mxs: Enable IC fixes for related SoCs

Two PHY bugs are fixed by IC logic, but these bits are not
enabled by default, so we enable them at driver.
The two bugs are: MXS_PHY_ABNORMAL_IN_SUSPEND and MXS_PHY_SENDING_SOF_TOO_FAST
which are described at code.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 22db05ecf2ba from upstream]

9 years agousb: phy: mxs: change description of usb device speed
Peter Chen [Mon, 24 Feb 2014 02:20:58 +0000 (10:20 +0800)]
usb: phy: mxs: change description of usb device speed

Change "high speed" to "HS"
Change "non-high speed" to "FS/LS"

Implementation of notify_suspend and notify_resume will be different
according to mxs_phy_data->flags.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit f6a158243e56 from upstream]

9 years agousb: phy: mxs: Add anatop regmap
Peter Chen [Mon, 24 Feb 2014 02:20:57 +0000 (10:20 +0800)]
usb: phy: mxs: Add anatop regmap

It is needed by imx6 SoC series, but not for imx23 and imx28.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 0d896538d836 from upstream]

9 years agousb: doc: phy-mxs: update binding for adding anatop phandle
Peter Chen [Mon, 24 Feb 2014 02:20:56 +0000 (10:20 +0800)]
usb: doc: phy-mxs: update binding for adding anatop phandle

Add anatop phandle which is used to access anatop registers to
control PHY's power and other USB operations.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit d9c130328d2e from upstream]

9 years agousb: phy: mxs: Add auto clock and power setting
Peter Chen [Mon, 24 Feb 2014 02:20:55 +0000 (10:20 +0800)]
usb: phy: mxs: Add auto clock and power setting

The auto setting is used to open related power and clocks
automatically after receiving wakeup signal.

With this feature, the PHY's clock and power can be recovered
correctly from low power mode, it is guaranteed by IC logic.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 1364414411ac from upstream]

9 years agousb: phy: mxs: Add platform judgement code
Peter Chen [Mon, 24 Feb 2014 02:20:54 +0000 (10:20 +0800)]
usb: phy: mxs: Add platform judgement code

The mxs-phy has several bugs and features at different
versions, the driver code can get it through of_device_id.data.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[shawn.guo: cherry-pick commit 2400780ea18a from upstream]