linux.git
10 years agoENGR00300188-2 ASoC: imx-hdmi-dma: Clear offset in the trigger init
Nicolin Chen [Thu, 6 Mar 2014 11:14:29 +0000 (19:14 +0800)]
ENGR00300188-2 ASoC: imx-hdmi-dma: Clear offset in the trigger init

The offset reflects the current position of DMA access in the ALSA ring buffer.
So we should clear it before re-start DMA engine becasue the DMA access should
re-start its job from the 0 position. If we don't do this, the driver might get
a wrong idea about current position of DMA access. Thus fix it.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00300188-1 ASoC: imx-hdmi-dma: Double the buffer and period sizes
Nicolin Chen [Fri, 7 Mar 2014 11:59:04 +0000 (19:59 +0800)]
ENGR00300188-1 ASoC: imx-hdmi-dma: Double the buffer and period sizes

We found HDMI Audio has a performance issue when playback 8 channels 192KHz
files, CPU might lag its interrupt responsing while SDMA continues updating
HDMI internal AHB DMA's address and restarting AHB DMA, which resulted the
noise when AHB DMA access overlaps with the data copy procedures in this
driver.

Thus we here double the buffer size and period size of HDMI Audio to chop
the CPU interrupt to its half in the same span of time so that we can keep
the data copy procedures safe and provent it from overlapping access with
AHB DMA.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00302688-2 ARM:dts:imx6sx: Fixed code indent
Ranjani Vaidyanathan [Mon, 10 Mar 2014 23:05:49 +0000 (18:05 -0500)]
ENGR00302688-2 ARM:dts:imx6sx: Fixed code indent

Fixed code indent.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
10 years agoENGR00302688-1 ARM:dts:imx6sx: Fixed build break
Ranjani Vaidyanathan [Mon, 10 Mar 2014 23:04:59 +0000 (18:04 -0500)]
ENGR00302688-1 ARM:dts:imx6sx: Fixed build break

Fixed dtb build break.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
10 years agoENGR00301394 ARM:dts:imx6sx:Add support for imx6sx-19x19-arm2 board support
Ranjani Vaidyanathan [Thu, 27 Feb 2014 18:32:42 +0000 (12:32 -0600)]
ENGR00301394 ARM:dts:imx6sx:Add support for imx6sx-19x19-arm2 board support

Add dts files to support iMX6SX 19x19 ddr3 validation board.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
10 years agoASoC: fsl-sai: Add SND_SOC_DAIFMT_DSP_A/B support.
Xiubo Li [Thu, 27 Feb 2014 00:45:01 +0000 (08:45 +0800)]
ASoC: fsl-sai: Add SND_SOC_DAIFMT_DSP_A/B support.

o Add SND_SOC_DAIFMT_DSP_A support.
o Add SND_SOC_DAIFMT_DSP_B support.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit a3f7dcc9cc0392528bff75b17adfcd74fb8a0ecd)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl-sai: fix Freescale SAI DAI format setting.
Xiubo Li [Tue, 25 Feb 2014 09:54:51 +0000 (17:54 +0800)]
ASoC: fsl-sai: fix Freescale SAI DAI format setting.

o Fix some bugs of fsl_sai_set_dai_fmt_tr().
o Add SND_SOC_DAIFMT_LEFT_J support.
o Add SND_SOC_DAIFMT_CBS_CFM support.
o Add SND_SOC_DAIFMT_CBM_CFS support.
o And SND_SOC_DAIFMT_RIGHT_J need to be done in the future.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 13cde090030c7d00e991c85b87c12891cc8e4df4)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00302299 ARM: dts: imx6sx: add adc support on i.MX6SX-17x17-ARM2 platform
Luwei Zhou [Fri, 7 Mar 2014 08:23:53 +0000 (16:23 +0800)]
ENGR00302299 ARM: dts: imx6sx: add adc support on i.MX6SX-17x17-ARM2 platform

add adc support for i.MX6SX-17x17-ARM2 platform.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00302353 ARM: dts: Add SSI<->WM8962 audio support for imx6sx-sdb
Nicolin Chen [Fri, 7 Mar 2014 12:25:45 +0000 (20:25 +0800)]
ENGR00302353 ARM: dts: Add SSI<->WM8962 audio support for imx6sx-sdb

Append audio nodes to the devicetree to add audio support for imx6sx-sdb with
Wolfson WM8962 CODEC.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 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>
10 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>
10 years agomtd: nand: add "page" argument for read_subpage hook
Huang Shijie [Fri, 3 Jan 2014 03:01:40 +0000 (11:01 +0800)]
mtd: nand: add "page" argument for read_subpage hook

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

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
10 years agomtd: nand: remove unused function input parameter
Cai Zhiyong [Wed, 25 Dec 2013 12:11:15 +0000 (20:11 +0800)]
mtd: nand: remove unused function input parameter

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

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00302227-8 dts: imx6sx-sdb: add flexcan support
Dong Aisheng [Thu, 6 Mar 2014 11:12:16 +0000 (19:12 +0800)]
ENGR00302227-8 dts: imx6sx-sdb: add flexcan support

Add flexcan support

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-7 dts: imx6sx-17x17-arm2: do not use sw polling for card detect
Dong Aisheng [Thu, 6 Mar 2014 10:45:33 +0000 (18:45 +0800)]
ENGR00302227-7 dts: imx6sx-17x17-arm2: do not use sw polling for card detect

The SW polling for card detect will keep sending command repeatly
at backgroud which will consume CPU MIPS and aslo affects the normal
SD debug when enable CONFIG_MMC_DEBUG.

Just as the board design, we simply treat it as no card detect
support.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-6 mmc: sdhci-esdhc-imx: add imx6sx support
Dong Aisheng [Thu, 6 Mar 2014 08:04:19 +0000 (16:04 +0800)]
ENGR00302227-6 mmc: sdhci-esdhc-imx: add imx6sx support

The imx6sx usdhc is derived from imx6sl, the difference is minor.
imx6sx have the errata ESDHC_FLAG_ERR004536 fixed.
So introduce a new compatible string for imx6sx to distinguish them.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-5 dts: imx6sx-sdb: add SD2 support
Dong Aisheng [Wed, 5 Mar 2014 10:01:05 +0000 (18:01 +0800)]
ENGR00302227-5 dts: imx6sx-sdb: add SD2 support

SD2 has no CD/WP pin and not power cycle and signal voltage switch capability.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-4 dts: imx6sx-sdb: SD4 update
Dong Aisheng [Wed, 5 Mar 2014 08:57:27 +0000 (16:57 +0800)]
ENGR00302227-4 dts: imx6sx-sdb: SD4 update

Add CD/WP support and fix pinctrl setting that SD4 slot on SDB board
is 4 bit, not 8 bit.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-3 dts:imx6sx-sdb: add SD3 support
Dong Aisheng [Wed, 5 Mar 2014 08:30:25 +0000 (16:30 +0800)]
ENGR00302227-3 dts:imx6sx-sdb: add SD3 support

Add SD3 support

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-2 dts: imx6sx-17x17-arm2: fix the pad setting of can gpios
Dong Aisheng [Wed, 5 Mar 2014 08:19:49 +0000 (16:19 +0800)]
ENGR00302227-2 dts: imx6sx-17x17-arm2: fix the pad setting of can gpios

We use the default GPIO pad ctrl setting for CAN before.
However, we found the reset value of CAN gpio pad ctrl setting is
000030c1 which indicates the Drive Strength Field is HIZ.
Thus there will be no output and GPIO output function will not work.
Altough the board level pull up will make the CAN tranceiver work
properly by default, however, we will not be able to shutdown
the tranceiver by GPIO.
Setting the correct driver strength for GPIO pad ctrl to make the pad
out work properly.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00302227-1 dts:imx6sx-17x17-arm2: use external regulator for SDB
Dong Aisheng [Wed, 5 Mar 2014 07:20:14 +0000 (15:20 +0800)]
ENGR00302227-1 dts:imx6sx-17x17-arm2: use external regulator for SDB

With using external regulator, we will be able to shutdown the power
for the card during suspend.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00301869-3 ARM: dts: imx6sx: add adc support on i.MX6SX-SDB platform
Luwei Zhou [Wed, 5 Mar 2014 09:12:08 +0000 (17:12 +0800)]
ENGR00301869-3 ARM: dts: imx6sx: add adc support on i.MX6SX-SDB platform

add adc devicetree support for i.MX6SX-SDB platform.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00301869-2 ARM: imx_v7_defconfig: enable ADC in default config
Luwei Zhou [Wed, 5 Mar 2014 09:02:31 +0000 (17:02 +0800)]
ENGR00301869-2 ARM: imx_v7_defconfig: enable ADC in default config

Enable ADC driver in default config.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00301869-1 iio: adc: Enable i.MX6SX adc driver.
Luwei Zhou [Thu, 6 Mar 2014 07:47:47 +0000 (15:47 +0800)]
ENGR00301869-1 iio: adc: Enable i.MX6SX adc driver.

Enable i.MX6SX adc driver. ADC driver will try getting ADC controller
channel number via device tree, because i.MX chip enable 4 channels
on each controller.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agosched: replace INIT_COMPLETION with reinit_completion
Wolfram Sang [Thu, 14 Nov 2013 22:32:01 +0000 (14:32 -0800)]
sched: replace INIT_COMPLETION with reinit_completion

For the casual device driver writer, it is hard to remember when to use
init_completion (to init a completion structure) or INIT_COMPLETION (to
*reinit* a completion structure).  Furthermore, while all other
completion functions exepct a pointer as a parameter, INIT_COMPLETION
does not.  To make it easier to remember which function to use and to
make code more readable, introduce a new inline function with the proper
name and consistent argument type.  Update the kernel-doc for
init_completion while we are here.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoiio: core: implement devm_iio_device_alloc/devm_iio_device_free
Grygorii Strashko [Thu, 18 Jul 2013 10:19:00 +0000 (11:19 +0100)]
iio: core: implement devm_iio_device_alloc/devm_iio_device_free

Add a resource managed devm_iio_device_alloc()/devm_iio_device_free()
to automatically clean up any allocations made by IIO drivers,
thus leading to simplified IIO drivers code.

In addition, this will allow IIO drivers to use other devm_*() API
(like devm_request_irq) and don't care about the race between
iio_device_free() and the release of resources by Device core
during driver removing.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Tested-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoASoC: sgtl5000: Fix VAG_POWER enabling/disabling order
Marek Vasut [Tue, 28 May 2013 18:55:56 +0000 (20:55 +0200)]
ASoC: sgtl5000: Fix VAG_POWER enabling/disabling order

The VAG_POWER must be enabled after all other bits in CHIP_ANA_POWER
and disabled before any other bit in CHIP_ANA_POWER. See the SGTL5000
datasheet (Table 31, BIT 7, page 42-43). Failing to follow this order
will result in ugly loud "POP" noise at the end of playback.

To achieve such order, use the _PRE and _POST DAPM widgets to trigger
the power_vag_event, where the event type check has to be fixed
accordingly as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit dd4d2d6dfb49e8916064f2cb07f0ad7b32a82fb7)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00301993 imx6sx: fix kernel can't boot at imx6sx for mfg config
Frank Li [Wed, 5 Mar 2014 20:13:56 +0000 (04:13 +0800)]
ENGR00301993 imx6sx: fix kernel can't boot at imx6sx for mfg config

Miss imx6sx support.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
10 years agoENGR00301115 net: fec_ptp: fix convergence issue to support IXXAT and LinuxPTP stack
Fugang Duan [Thu, 27 Feb 2014 07:29:09 +0000 (15:29 +0800)]
ENGR00301115 net: fec_ptp: fix convergence issue to support IXXAT and LinuxPTP stack

IEEE 1588 module has one hw issue in capturing the ATVR register. According
to the user manual it is:
ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
while(ENET0->ATCR & ENET_ATCR_CAPTURE_MASK);
ts_counter_ns = ENET0->ATVR;

Incorrect behavior for ENET_ATCR[Capture and Restart Bits]. These bits will always
read a value zero. According to SPEC, when these bits are set to 1'b1, these should
hold value 1'b1 until the counter value is capture in the register clock domain.

Unfortunately there is a bug with the way the bit "ENET_ATCR_CAPTURE" clears.
So need something like:
ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
wait();
ts_counter_ns = ENET0->ATVR;

The wait-time to be at least 6 clock cycle of the slower clock between the register
clock and the 1588 clock. The 1588 ts_clk is 25Mhz, register clock is 66Mhz, so the
wait-time must be greater than 240ns (40ns * 6). The workaround is that adding 1us
delay before read ATVR.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agoENGR00300156 net: fec: Workaround for imx6sx enet tx hang when enable three queues
Fugang Duan [Fri, 21 Feb 2014 00:49:21 +0000 (08:49 +0800)]
ENGR00300156 net: fec: Workaround for imx6sx enet tx hang when enable three queues

When enable three queues on imx6sx enet, and then do tx performance
test with iperf tool, after some time running, tx hang.

Found that:
If uDMA is running, software set TDAR may cause tx hang.
If uDMA is in idle, software set TDAR don't cause tx hang.

There is a TDAR race condition for mutliQ when the software sets TDAR
and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles).
This will cause the udma_tx and udma_tx_arbiter state machines to hang.
The issue exist at i.MX6SX enet IP.

So, the Workaround is checking TDAR status four time, if TDAR cleared by
hardware and then write TDAR, otherwise don't set TDAR.

The patch is only one Workaround for the issue TKT210582.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agomtd: nand: Add a devicetree binding for ECC strength and ECC step size
Ezequiel Garcia [Mon, 24 Feb 2014 22:24:49 +0000 (19:24 -0300)]
mtd: nand: Add a devicetree binding for ECC strength and ECC step size

Some flashes can only be properly accessed when the ECC mode is
specified, so a way to describe such mode is required.

Together, the ECC strength and step size define the correction capability,
so that we say we will correct "{strength} bit errors per {size} bytes".

The interpretation of these parameters is implementation-defined, but they
often have ramifications on the formation, interpretation, and placement of
correction metadata on the flash. Not all implementations must support all
possible combinations. Implementations are encouraged to further define the
value(s) they support.

Acked-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoof_mtd: Add helpers to get ECC strength and ECC step size
Ezequiel Garcia [Mon, 24 Feb 2014 22:24:48 +0000 (19:24 -0300)]
of_mtd: Add helpers to get ECC strength and ECC step size

This commit adds simple helpers to obtain the devicetree properties
that specify the ECC strength and ECC step size to use on a given
NAND controller.

Acked-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agomtd: Add a retlen parameter to _get_{fact,user}_prot_info
Christian Riesch [Tue, 28 Jan 2014 08:29:44 +0000 (09:29 +0100)]
mtd: Add a retlen parameter to _get_{fact,user}_prot_info

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Cc: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoof_mtd: fix header file include guard
Philipp Rosenberger [Thu, 28 Nov 2013 11:36:52 +0000 (12:36 +0100)]
of_mtd: fix header file include guard

It seems the include guard was copied from of_net.h.

Signed-off-by: Philipp Rosenberger <philipp.rosenberger@xse.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoof_mtd: Add no-op stubs to support CONFIG_OF=n
Ezequiel Garcia [Tue, 3 Sep 2013 02:37:53 +0000 (23:37 -0300)]
of_mtd: Add no-op stubs to support CONFIG_OF=n

Just like the rest of the subsystems, let's add the required no-op
functions to implement stubs when CONFIG_OF=n.

This prevents MTD drivers from having ugly ifdefs in their code,
and instead hide the ifdef monster in the header closet (far away
from people's sight).

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00301290-5 usb: chipidea: imx: disable dpdm change wakeup at device mode
Peter Chen [Fri, 28 Feb 2014 08:46:55 +0000 (16:46 +0800)]
ENGR00301290-5 usb: chipidea: imx: disable dpdm change wakeup at device mode

At imx6sx, there is a new feature that we can disable dpdm change
wakeup at device mode when the vbus is not there, it can avoid
unexpected wakeup when the phy is no power and imx6 is disconnected
from host.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
10 years agoENGR00301290-4 usb: phy-mxs: enable imx6sx
Peter Chen [Tue, 28 Jan 2014 11:52:05 +0000 (19:52 +0800)]
ENGR00301290-4 usb: phy-mxs: enable imx6sx

Add compatible string, etc.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
10 years agoENGR00301290-3 usb: chipidea: enable usb for imx6sx
Peter Chen [Tue, 28 Jan 2014 11:50:27 +0000 (19:50 +0800)]
ENGR00301290-3 usb: chipidea: enable usb for imx6sx

Add imx6sx compatible string, and enable bvalid as vbus wakeup
source. When vbus as system wakeup source, only bvalid can be
vbus wakeup source, the weak2p5 is needed to enable for vbus wakeup.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
10 years agoENGR00301290-2 ARM: imx6sx: enable usbphy dummy clock
Peter Chen [Fri, 28 Feb 2014 01:04:01 +0000 (09:04 +0800)]
ENGR00301290-2 ARM: imx6sx: enable usbphy dummy clock

If usbphy is enabled, we need to enable usbphy dump clock, it is
the requirement from IC engineer, it is used to guarantee some
RTL operation correctness without software operation.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
10 years agoENGR00301290-1 ARM: imx6sx: add usb support
Peter Chen [Fri, 28 Feb 2014 01:02:37 +0000 (09:02 +0800)]
ENGR00301290-1 ARM: imx6sx: add usb support

- Add usbotg1 and usbotg2 support
- Enable usbotg1 at arm2 board

Signed-off-by: Peter Chen <peter.chen@freescale.com>
10 years agoENGR00301635 ARM: dts: imx6sx: add thermal monitor support
Anson Huang [Tue, 4 Mar 2014 04:37:48 +0000 (12:37 +0800)]
ENGR00301635 ARM: dts: imx6sx: add thermal monitor support

add thermal monitor support for i.MX6SX.

Signed-off-by: Anson Huang <b20788@freescale.com>
10 years agoENGR00301650 ARM: dts: imx6sx: add anatop regulator support
Robin Gong [Tue, 4 Mar 2014 04:55:50 +0000 (12:55 +0800)]
ENGR00301650 ARM: dts: imx6sx: add anatop regulator support

Enable Anatop regulator on imx6sx.

Signed-off-by: Robin Gong <b38343@freescale.com>
10 years agoENGR00301552-3 ARM: imx6sx: Add sgtl5000 support with SSI for 17x17 ARM2 board
Nicolin Chen [Mon, 3 Mar 2014 11:02:58 +0000 (19:02 +0800)]
ENGR00301552-3 ARM: imx6sx: Add sgtl5000 support with SSI for 17x17 ARM2 board

This patch adds SSI and sgtl5000 devicetree nodes for imx6sx 17x17 ARM2 board.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00301552-2 ARM: dtsi: Add SSI, ASRC and AUDMUX support for imx6sx
Nicolin Chen [Mon, 3 Mar 2014 10:55:02 +0000 (18:55 +0800)]
ENGR00301552-2 ARM: dtsi: Add SSI, ASRC and AUDMUX support for imx6sx

This patch adds default nodes for ASRC and AUDMUX/SSI for i.MX6 SoloX.

It also appends two pin groups for AUDMUX.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00301552-1 ARM: imx6sx: Correct audio_clk in the clock tree
Nicolin Chen [Mon, 3 Mar 2014 10:51:41 +0000 (18:51 +0800)]
ENGR00301552-1 ARM: imx6sx: Correct audio_clk in the clock tree

We currently has asrc_* clocks in the imx6sx clock tree while actually,
according to the Reference Manual, all of them should be named after the
audio_clk that controls the external MCLK output from MCLK pad of AUDMUX.

Thus fix it along with its gate clock missing in the current clock tree.

Meanwhile, this patch also configures a default clock rate for it -- 24MHz.

Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00301106 PXP: enable PXP in imx6sx-sdb
Fancy Fang [Thu, 27 Feb 2014 07:55:36 +0000 (15:55 +0800)]
ENGR00301106 PXP: enable PXP in imx6sx-sdb

Enable PXP module in imx6sx-sdb by default. This
make sure PXP can be used in imx6sx-sdb.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
10 years agoXillybus driver added to Kconfig and Makefile in drivers/char/
Eli Billauer [Wed, 12 Feb 2014 10:48:01 +0000 (12:48 +0200)]
Xillybus driver added to Kconfig and Makefile in drivers/char/

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
10 years agoAdd Xillybus driver to driver/char/ in a separate directory
Eli Billauer [Wed, 12 Feb 2014 10:48:53 +0000 (12:48 +0200)]
Add Xillybus driver to driver/char/ in a separate directory

For more information about Xillybus, see http://xillybus.com

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
10 years agoENGR00301095 gpu:gpu hang when dma memory is used up
Loren Huang [Thu, 27 Feb 2014 07:44:49 +0000 (15:44 +0800)]
ENGR00301095 gpu:gpu hang when dma memory is used up

When dma zone memory used up, gckOS_AllocateNonPagedMemory() will try to
free non paged memory cache and allocate again. Such operation will cause
 twice memory mutex request and cause gpu driver hang.

The solution is free the memory mutex at first before trying to free non
paged memory cache.

Date: Feb 27, 2014
Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
10 years agomtd: nand: fix off-by-one read retry mode counting
Brian Norris [Thu, 13 Feb 2014 00:08:28 +0000 (16:08 -0800)]
mtd: nand: fix off-by-one read retry mode counting

A flash may support N read retry voltage threshold modes, numbered 0
through N-1 (where mode 0 represents the initial state). However,
nand_do_read_ops() tries to use mode 0 through N.

This off-by-one error shows up, for instance, when using nanddump, and
we have cycled through available modes:

    nand: setting READ RETRY mode 0
    nand: setting READ RETRY mode 1
    nand: setting READ RETRY mode 2
    nand: setting READ RETRY mode 3
    nand: setting READ RETRY mode 4
    nand: setting READ RETRY mode 5
    nand: setting READ RETRY mode 6
    nand: setting READ RETRY mode 7
    nand: setting READ RETRY mode 8
    libmtd: error!: cannot read 8192 bytes from mtd0 (eraseblock 20, offset 0)
            error 22 (Invalid argument)
    nanddump: error!: mtd_read

Tested on Micron MT29F64G08CBCBBH1, with 8 retry modes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300939 ARM: dts: imx: Add power supply for imx6sx sdb lcdif
Sandor Yu [Wed, 26 Feb 2014 09:38:32 +0000 (17:38 +0800)]
ENGR00300939 ARM: dts: imx: Add power supply for imx6sx sdb lcdif

-Change lcd1_reset pin to GPIO mode
-Add regulator reg_lcd_3v3 for lcdif

Signed-off-by: Sandor Yu <R01008@freescale.com>
10 years agoENGR00300890-2 ARM: imx_v7{_mfg}_defconfig: enable the SPI-NOR framework
Huang Shijie [Wed, 26 Feb 2014 04:32:47 +0000 (12:32 +0800)]
ENGR00300890-2 ARM: imx_v7{_mfg}_defconfig: enable the SPI-NOR framework

enable the SPI NOR framework and the Quadspi driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300890-1 mtd: fix the build error
Huang Shijie [Wed, 26 Feb 2014 04:05:56 +0000 (12:05 +0800)]
ENGR00300890-1 mtd: fix the build error

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

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-13 mtd: spi-nor: do not enable the quad mode for Micron NOR
Huang Shijie [Wed, 12 Feb 2014 06:26:52 +0000 (14:26 +0800)]
ENGR00300430-13 mtd: spi-nor: do not enable the quad mode for Micron NOR

We use the Extended SPI protocol, and do not need to enable
the Quad mode.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-12 ARM: clk: add a new helper which can re-parent the clock
Huang Shijie [Tue, 25 Feb 2014 05:14:26 +0000 (13:14 +0800)]
ENGR00300430-12 ARM: clk: add a new helper which can re-parent the clock

The clock for qspi may be different when different NOR flashes are connected
to the board.

So the IMX6SX_CLK_QSPI1_SEL/IMX6SX_CLK_QSPI2_SEL should have the re-parent
capability.

This patch adds a new helper to register the clock which needs the
re-parent capability.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-11 mtd: spi-nor: enable the quad read feature for n25q256a
Huang Shijie [Fri, 21 Feb 2014 10:37:12 +0000 (18:37 +0800)]
ENGR00300430-11 mtd: spi-nor: enable the quad read feature for n25q256a

enable the quad read feature for n25q256a

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-10 ARM: dts: imx6sx-17x17-arm2: enable the qspi2
Huang Shijie [Mon, 24 Feb 2014 06:40:35 +0000 (14:40 +0800)]
ENGR00300430-10 ARM: dts: imx6sx-17x17-arm2: enable the qspi2

enable the qspi2.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-9 ARM: dts: imx6sx: add the properties for QuadSpi
Huang Shijie [Fri, 21 Feb 2014 10:29:21 +0000 (18:29 +0800)]
ENGR00300430-9 ARM: dts: imx6sx: add the properties for QuadSpi

add the qspi2 property and its pinctrl.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-8 mtd: fsl-quadspi: enable the DDR QUAD read
Huang Shijie [Fri, 21 Feb 2014 10:24:15 +0000 (18:24 +0800)]
ENGR00300430-8 mtd: fsl-quadspi: enable the DDR QUAD read

enable the DDR quad read, this is the temporary code.

Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300430-7 mtd: spi-nor: Add Freescale QuadSPI driver
Huang Shijie [Mon, 9 Dec 2013 05:58:39 +0000 (13:58 +0800)]
ENGR00300430-7 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>
10 years agoENGR00300430-6 Documentation: add the binding file for Freescale QuadSPI driver
Huang Shijie [Mon, 26 Aug 2013 04:26:49 +0000 (12:26 +0800)]
ENGR00300430-6 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>
10 years agoENGR00300430-5 mtd: spi-nor: add a helper to find the spi_device_id
Huang Shijie [Mon, 16 Dec 2013 07:57:33 +0000 (15:57 +0800)]
ENGR00300430-5 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>
10 years agoENGR00300430-4 mtd: m25p80: use the SPI nor framework
Huang Shijie [Mon, 24 Feb 2014 02:25:42 +0000 (10:25 +0800)]
ENGR00300430-4 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>
10 years agoENGR00300430-3 mtd: spi-nor: add the framework for SPI NOR
Huang Shijie [Mon, 28 Oct 2013 05:29:13 +0000 (13:29 +0800)]
ENGR00300430-3 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>
10 years agoENGR00300430-2 mtd: spi-nor: add the basic data structures
Huang Shijie [Fri, 22 Nov 2013 07:24:52 +0000 (15:24 +0800)]
ENGR00300430-2 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>
10 years agoENGR00300430-1 mtd: spi-nor: copy the SPI NOR commands to a new header file
Huang Shijie [Fri, 22 Nov 2013 07:15:32 +0000 (15:15 +0800)]
ENGR00300430-1 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>
10 years agoENGR00300745 ARM: dts: imx: Add lcdif support for imx6sx sdb board
Sandor Yu [Tue, 25 Feb 2014 10:20:16 +0000 (18:20 +0800)]
ENGR00300745 ARM: dts: imx: Add lcdif support for imx6sx sdb board

-Add pin mux setting for pwm3 in imx6sx.dtsi
-Add pwm3 setting for lcdif backlight
-Add lcdif1 in imx6sx-sdb.dtsi

Signed-off-by: Sandor Yu <R01008@freescale.com>
10 years agoENGR00300439-6 dts: imx6sx: add flexcan stop mode support
Dong Aisheng [Mon, 24 Feb 2014 06:35:52 +0000 (14:35 +0800)]
ENGR00300439-6 dts: imx6sx: add flexcan stop mode support

Add flexcan stop mode support.
The driver does not use alias id now, so remove it too.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300439-5 can: flexcan: parse stop mode control bits from device tree
Dong Aisheng [Mon, 24 Feb 2014 06:25:12 +0000 (14:25 +0800)]
ENGR00300439-5 can: flexcan: parse stop mode control bits from device tree

Starting from IMX6, the flexcan stop mode control bits is SoC specific,
move it out of IP driver and parse it from devicetree.
It's good from maintain perspective and can avoid adding too many SoC
specifi bits in driver but with no IP changes when the IMX SoC series
keep growing.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300439-4 dts: imx6sx-arm2: add flexcan support
Dong Aisheng [Thu, 20 Feb 2014 08:49:40 +0000 (16:49 +0800)]
ENGR00300439-4 dts: imx6sx-arm2: add flexcan support

Add flexcan support

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300439-3 imx6sx: use auxdata for can transceiver setting
Dong Aisheng [Thu, 20 Feb 2014 08:48:05 +0000 (16:48 +0800)]
ENGR00300439-3 imx6sx: use auxdata for can transceiver setting

We still do not have a framework for can tranceiver settings.
Use audxdata as workaround as before.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300439-2 imx6sx: fix can_sel parent clock
Dong Aisheng [Thu, 20 Feb 2014 08:46:19 +0000 (16:46 +0800)]
ENGR00300439-2 imx6sx: fix can_sel parent clock

The default parent of can_sel clock is invalid, need manually set it.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300439-1 dts: imx6sx-17x17-arm2: add usdhc2 and usdhc4 support
Dong Aisheng [Thu, 20 Feb 2014 07:24:43 +0000 (15:24 +0800)]
ENGR00300439-1 dts: imx6sx-17x17-arm2: add usdhc2 and usdhc4 support

add usdhc2 and usdhc4 support

Signed-off-by: Dong Aisheng <b29396@freescale.com>
10 years agoENGR00300665 ARM: dts: imx6sx-sdb: enable VGEN1 always on
Robin Gong [Tue, 25 Feb 2014 07:08:39 +0000 (15:08 +0800)]
ENGR00300665 ARM: dts: imx6sx-sdb: enable VGEN1 always on

On imx6sx-sdb board, there is one level shift between soc and
enet phy chip, so need keep VGEN1 always on, else system can't
mount NFS.

Signed-off-by: Robin Gong <b38343@freescale.com>
10 years agoUSB: EHCI: add delay during suspend to prevent erroneous wakeups
Alan Stern [Thu, 13 Feb 2014 20:49:17 +0000 (15:49 -0500)]
USB: EHCI: add delay during suspend to prevent erroneous wakeups

High-speed USB connections revert back to full-speed signalling when
the device goes into suspend.  This takes several milliseconds, and
during that time it's not possible to tell reliably whether the device
has been disconnected.

On some platforms, the Wake-On-Disconnect circuitry gets confused
during this intermediate state.  It generates a false wakeup signal,
which can prevent the controller from going to sleep.

To avoid this problem, this patch adds a 5-ms delay to the
ehci_bus_suspend() routine if any ports have to switch over to
full-speed signalling.  (Actually, the delay was already present for
devices using a particular kind of PHY power management; the patch
merely causes the delay to be used more widely.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Peter Chen <Peter.Chen@freescale.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:

drivers/usb/host/ehci-hub.c

10 years agoENGR00300479-2 ARM: dts: imx6sx-sdb: Add pfuze support
Robin Gong [Tue, 25 Feb 2014 05:34:54 +0000 (13:34 +0800)]
ENGR00300479-2 ARM: dts: imx6sx-sdb: Add pfuze support

Add pfuze pmic driver support for imx6sx-sdb board

Signed-off-by: Robin Gong <b38343@freescale.com>
10 years agoENGR00300479-1 ARM: dts: imx6sx-17x17-arm2: Add pfuze support
Robin Gong [Tue, 25 Feb 2014 05:33:49 +0000 (13:33 +0800)]
ENGR00300479-1 ARM: dts: imx6sx-17x17-arm2: Add pfuze support

Add pfuze support on imx6sx-17x17-arm2 board

Signed-off-by: Robin Gong <b38343@freescale.com>
10 years agoclk: export fixed-factor, gate & mux registration
Mike Turquette [Fri, 16 Aug 2013 02:06:29 +0000 (19:06 -0700)]
clk: export fixed-factor, gate & mux registration

These registration calls may be used by loadable modules. Export them.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: mux: Add support for read-only muxes.
Tomasz Figa [Mon, 22 Jul 2013 23:49:18 +0000 (01:49 +0200)]
clk: mux: Add support for read-only muxes.

Some platforms have read-only clock muxes that are preconfigured at
reset and cannot be changed at runtime. This patch extends mux clock
driver to allow handling such read-only muxes by adding new
CLK_MUX_READ_ONLY mux flag.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: mux: add CLK_MUX_HIWORD_MASK
Haojian Zhuang [Sat, 8 Jun 2013 14:47:17 +0000 (22:47 +0800)]
clk: mux: add CLK_MUX_HIWORD_MASK

In both Hisilicon & Rockchip Cortex-A9 based chips, they don't use the
paradigm of reading-changing-writing the register contents.
Instead they use a hiword mask to indicate the changed bits.

When b01 should be set as switching mux, it also needs to indicate
the change by setting hiword mask (b11 << 16).

The patch adds mux flag for this usage.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: clk-divider: Export clk_register_divider()
Fabio Estevam [Fri, 2 Aug 2013 16:14:07 +0000 (13:14 -0300)]
clk: clk-divider: Export clk_register_divider()

clk_register_divider() needs to be exported so that it could be used
in a module driver, otherwise we get the following error:

ERROR: "clk_register_divider" [sound/soc/mxs/snd-soc-mxs.ko] undefined!

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
[mturquette@linaro.org: also export clk_register_divider_table]
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: divider: add CLK_DIVIDER_HIWORD_MASK flag
Haojian Zhuang [Sat, 8 Jun 2013 14:47:18 +0000 (22:47 +0800)]
clk: divider: add CLK_DIVIDER_HIWORD_MASK flag

In both Hisilicon & Rockchip Cortex-A9 based chips, they don't use the
paradigm of reading-changing-writing the register contents.
Instead they use a hiword mask to indicate the changed bits.

When b01 should be set as setting divider, it also needs to indicate
the change by setting hiword mask (b11 << 16).

The patch adds divider flag for this usage.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: fix new_parent dereference before null check
James Hogan [Thu, 29 Aug 2013 11:10:51 +0000 (12:10 +0100)]
clk: fix new_parent dereference before null check

Commit 71472c0 (clk: add support for clock reparent on set_rate) added a
dereference of the new_parent pointer in clk_reparent(), but as detected
by smatch clk_reparent() later checks whether new_parent is NULL.

The dereference was in order to clear the new parent's new_child pointer
to avoid duplicate POST_RATE_CHANGE notifications, so clearly isn't
necessary if the new parent is NULL, so move it inside the "if
(new_parent)" block.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: get matching entry under lock in of_clk_init()
Alex Elder [Thu, 22 Aug 2013 16:31:31 +0000 (11:31 -0500)]
clk: get matching entry under lock in of_clk_init()

Currently of_clk_init() finds a matching device node while holding
the device tree spinlock.  When a matching device node is found, the
lock is dropped and then re-acquired in order to get a reference
to the matching device id structure.

Acquiring the spinlock twice is unnecessary (and it opens a
vulnerable window that could conceivably lead to errors).

There already exists an interface for both finding and taking a
reference to a device id under lock, so use it.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Christian Daudt <csd@broadcom.com>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: handle NULL struct clk gracefully
Mike Turquette [Thu, 22 Aug 2013 06:58:09 +0000 (23:58 -0700)]
clk: handle NULL struct clk gracefully

At some point changes to clk_set_rate and clk_set_parent introduced a
bug whereby NULL struct clk pointers were treated as an error. This is
in violation of the API in include/linux/clk.h. Reintroduce graceful
handling of NULL clk's by bailing from clk_set_rate and clk_set_parent
with return codes of zero.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: clk-mux: implement remuxing on set_rate
James Hogan [Mon, 29 Jul 2013 11:25:02 +0000 (12:25 +0100)]
clk: clk-mux: implement remuxing on set_rate

Implement clk-mux remuxing if the CLK_SET_RATE_NO_REPARENT flag isn't
set. This implements determine_rate for clk-mux to propagate to each
parent and to choose the best one (like clk-divider this chooses the
parent which provides the fastest rate <= the requested rate).

The determine_rate op is implemented as a core helper function so that
it can be easily used by more complex clocks which incorporate muxes.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: add CLK_SET_RATE_NO_REPARENT flag
James Hogan [Mon, 29 Jul 2013 11:25:01 +0000 (12:25 +0100)]
clk: add CLK_SET_RATE_NO_REPARENT flag

Add a CLK_SET_RATE_NO_REPARENT clock flag, which will prevent muxes
being reparented during clk_set_rate.

To avoid breaking existing platforms, all callers of clk_register_mux()
are adjusted to pass the new flag. Platform maintainers are encouraged
to remove the flag if they wish to allow mux reparenting on set_rate.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Chao Xie <xiechao.mail@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Emilio López" <emilio@elopez.com.ar>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Chew <achew@nvidia.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Thomas Abraham <thomas.abraham@linaro.org>
Cc: Tomasz Figa <t.figa@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: spear-devel@list.st.com
Cc: linux-tegra@vger.kernel.org
Tested-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Stephen Warren <swarren@nvidia.com> [tegra]
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> [sunxi]
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com> [Zynq]
Signed-off-by: Mike Turquette <mturquette@linaro.org>
10 years agoclk: add support for clock reparent on set_rate
James Hogan [Mon, 29 Jul 2013 11:25:00 +0000 (12:25 +0100)]
clk: add support for clock reparent on set_rate

Add core support to allow clock implementations to select the best
parent clock when rounding a rate, e.g. the one which can provide the
closest clock rate to that requested. This is by way of adding a new
clock op, determine_rate(), which is like round_rate() but has an extra
parameter to allow the clock implementation to optionally select a
different parent clock. The core then takes care of reparenting the
clock when setting the rate.

The parent change takes place with the help of some new private data
members. struct clk::new_parent specifies a clock's new parent (NULL
indicates no change), and struct clk::new_child specifies a clock's new
child (whose new_parent member points back to it). The purpose of these
are to allow correct walking of the future tree for notifications prior
to actually reparenting any clocks, specifically to skip child clocks
who are being reparented to another clock (they will be notified via the
new parent), and to include any new child clock. These pointers are set
by clk_calc_subtree(), and the new_child pointer gets cleared when a
child is actually reparented to avoid duplicate POST_RATE_CHANGE
notifications.

Each place where round_rate() is called, determine_rate() is checked
first and called in preference. This restructures a few of the call
sites to simplify the logic into if/else blocks.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: move some parent related functions upwards
James Hogan [Mon, 29 Jul 2013 11:24:59 +0000 (12:24 +0100)]
clk: move some parent related functions upwards

Move some parent related functions up in clk.c so they can be used by
the modifications in the following patch which enables clock reparenting
during set_rate. No other changes are made so this patch makes no
functional difference in isolation. This is separate from the following
patch primarily to ease readability of that patch.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: Disable unused clocks after deferred probing is done
Saravana Kannan [Thu, 9 May 2013 18:35:01 +0000 (11:35 -0700)]
clk: Disable unused clocks after deferred probing is done

With deferred probing, late_initcall() is too soon to declare a clock as
unused. Wait for deferred probing to finish before declaring a clock as
unused. Since deferred probing is done in late_initcall(), do the unused
check to late_initcall_sync.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: Fix race condition between clk_set_parent and clk_enable()
Saravana Kannan [Thu, 16 May 2013 04:07:24 +0000 (21:07 -0700)]
clk: Fix race condition between clk_set_parent and clk_enable()

Without this patch, the following race condition is possible.
* clk-A has two parents - clk-X and clk-Y.
* All three are disabled and clk-X is current parent.
* Thread A: clk_set_parent(clk-A, clk-Y).
* Thread A: <snip execution flow>
* Thread A: Grabs enable lock.
* Thread A: Sees enable count of clk-A is 0, so doesn't enable clk-Y.
* Thread A: Updates clk-A SW parent to clk-Y
* Thread A: Releases enable lock.
* Thread B: clk_enable(clk-A).
* Thread B: clk_enable() enables clk-Y, then enabled clk-A and returns.

clk-A is now enabled in software, but not clocking in hardware since the
hardware parent is still clk-X.

The only way to avoid race conditions between clk_set_parent() and
clk_enable/disable() is to ensure that clk_enable/disable() calls don't
require changes to hardware enable state between changes to software clock
topology and hardware clock topology.

The options to achieve the above are:
1. Grab the enable lock before changing software/hardware topology and
   release it afterwards.
2. Keep the clock enabled for the duration of software/hardware topology
   change so that any additional enable/disable calls don't try to change
   the hardware state. Once the topology change is complete, the clock can
   be put back in its original enable state.

Option (1) is not an acceptable solution since the set_parent() ops might
need to sleep.

Therefore, this patch implements option (2).

This patch doesn't violate any API semantics. clk_disable() doesn't
guarantee that the clock is actually disabled. So, no clients of a clock
can assume that a clock is disabled after their last call to clk_disable().
So, enabling the clock during a parent change is not a violation of any API
semantics.

This also has the nice side effect of simplifying the error handling code.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
[mturquette@linaro.org: fixed up whitespace issue]
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: abstract parent cache
James Hogan [Mon, 29 Jul 2013 11:24:58 +0000 (12:24 +0100)]
clk: abstract parent cache

Abstract access to the clock parent cache by defining
clk_get_parent_by_index(clk, index). This allows access to parent
clocks from clock drivers.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: fix typos
Peter Meerwald [Sat, 29 Jun 2013 13:14:19 +0000 (15:14 +0200)]
clk: fix typos

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: Always notify whole subtree when reparenting
Soren Brinkmann [Tue, 16 Apr 2013 17:06:50 +0000 (10:06 -0700)]
clk: Always notify whole subtree when reparenting

A clock's notifier count only reflects notifiers which are registered
directly for that clock. A reparent operation though affects the whole
subtree because of a potential rate change.
When issuing the pre rate change notifications only the notifier count
for the clock to be changed is considered and notifiers for subclocks
may never be called. Resulting in clocks in the subtree which have
registered notifiers, may receive a POST_- or ABORT_RATE_CHANGE
notification, without a PRE_RATE_CHANGE_NOTIFICATION.
Therefore always traverse the whole subtree when issueing pre rate
change notifications during a reparent operation.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: honor CLK_GET_RATE_NOCACHE in clk_set_rate
Peter De Schrijver [Wed, 5 Jun 2013 15:06:36 +0000 (18:06 +0300)]
clk: honor CLK_GET_RATE_NOCACHE in clk_set_rate

clk_set_rate() uses clk->rate directly. This causes problems if the clock
is marked as CLK_GET_RATE_NOCACHE. Hence call clk_get_rate() to get the
current rate.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoclk: use clk_get_rate() for debugfs
Peter De Schrijver [Wed, 5 Jun 2013 15:06:35 +0000 (18:06 +0300)]
clk: use clk_get_rate() for debugfs

debugfs uses the rate field directly. However this ignores the
CLK_GET_RATE_NOCACHE flag. Call clk_get_rate() instead.

Tested-by: Mark Zhang <markz@nvidia.com>
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
10 years agoENGR00300628 net: fec: align rx data buffer size for dma map/unmap
Fugang Duan [Tue, 25 Feb 2014 01:35:13 +0000 (09:35 +0800)]
ENGR00300628 net: fec: align rx data buffer size for dma map/unmap

Align allocated rx data buffer size for dma map/unmap, otherwise
kernel print warning when enable DMA_API_DEBUG.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agoENGR00300625-2 ARM:dts:imx6sx: add enet_out clk to avoid Last bit is not set
Fugang Duan [Tue, 25 Feb 2014 01:28:09 +0000 (09:28 +0800)]
ENGR00300625-2 ARM:dts:imx6sx: add enet_out clk to avoid Last bit is not set

enet_out clock is the same as ptp clock, driver use the clock
to check whether SOC supply clock to phy or not. So add enet_out
clk to imx6sx dts file to avoid receive frame "L" bit is not set.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agoENGR00300625-1 net: fec: avoid imx6sx enet-avb Last bit is not set
Fugang Duan [Tue, 25 Feb 2014 01:04:32 +0000 (09:04 +0800)]
ENGR00300625-1 net: fec: avoid imx6sx enet-avb Last bit is not set

When imx6sx-arm2/sdb platform do suspend/resume with nfs rootfs,
there have warning like "rcv is not +last", which means the frame
BD last bit is not set.

The root cause: enet suspend will disable phy clock, phy link down,
after resume back, enet MAC redo initial and ready to tx/rx packet,
but phy still is not ready which is doing auto-negotiation.

So, when enet output clock to phy, or there have regulator control
phy power, after phy is ready and then re-init enet MAC.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agoENGR00300474-2 ARM:dts: Replace phy regulator with gpio control in dts
Luwei Zhou [Mon, 24 Feb 2014 08:53:31 +0000 (16:53 +0800)]
ENGR00300474-2 ARM:dts: Replace phy regulator with gpio control in dts

Ther is some issue when using regulator contorl phy supply.The patch
replace the regulator with gpio direct control.

Signed-off-by: Luwei Zhou <b45643@freescale.com>