linux.git
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>
10 years agoENGR00300474-1 net: fec: Revert "ENGR00299593-4 net:fec: return -EPROBE_DEFER when...
Luwei Zhou [Mon, 24 Feb 2014 08:35:43 +0000 (16:35 +0800)]
ENGR00300474-1 net: fec: Revert "ENGR00299593-4 net:fec: return -EPROBE_DEFER when phy regulator isn't initialized"

There is some issue when using regulator to contorl phy supply. We will turn to
using GPIO pin control phy supply. This reverts fec driver modification in
commit a494258a9f24944d710dd375cc12f204deccaa47.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00299593-4 net:fec: return -EPROBE_DEFER when phy regulator isn't initialized
Luwei Zhou [Fri, 21 Feb 2014 08:08:44 +0000 (16:08 +0800)]
ENGR00299593-4 net:fec: return -EPROBE_DEFER when phy regulator isn't initialized

On i.mx6sx-17x17-arm2 board, fec needs to supply phy via max7322 extention gpio.
When fec probe, the phy regulator doesn't complete initilization. The fec_probe
needs to return  -EPROBE_DEFER and kernel will retry fec_probe after a delay.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00299593-3 ARM: imx_v7_defconfig: enable max7322 in default config
Luwei Zhou [Fri, 21 Feb 2014 06:04:55 +0000 (14:04 +0800)]
ENGR00299593-3 ARM: imx_v7_defconfig: enable max7322 in default config

Enable max7322 extention gpio driver in config

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00299593-2 ARM: dts: imx6sx-17X17-arm2: add max7322 gpio regulator dts support
Luwei Zhou [Mon, 24 Feb 2014 02:44:40 +0000 (10:44 +0800)]
ENGR00299593-2 ARM: dts: imx6sx-17X17-arm2: add max7322 gpio regulator dts support

FEC on imx6sx-17X17arm2 needs to make PHY work in 1.8v power supply.
The 1.8v power supply is controlled by max7322 output0 pin.Enable
max7322 dts support and phy regulator on imx6sx-17x17-arm2 platform
in this patch.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00299593-1 gpio: max7322: modify the max7322 driver to support device tree interface.
Luwei Zhou [Wed, 12 Feb 2014 02:13:35 +0000 (10:13 +0800)]
ENGR00299593-1 gpio: max7322: modify the max7322 driver to support device tree interface.

The max7322 driver can only support platform data interface. This patch
modify drvier to also support device tree interface.

Signed-off-by: Luwei Zhou <b45643@freescale.com>
10 years agoENGR00299180-2 ARM: imx: use dedicated ocram for lpm on i.mx6sx
Anson Huang [Fri, 14 Feb 2014 05:52:48 +0000 (13:52 +0800)]
ENGR00299180-2 ARM: imx: use dedicated ocram for lpm on i.mx6sx

On i.MX6SX, there is dedicated ocram for low power mode, dts has
different compatible string from mmio-sram, so update it.

Signed-off-by: Anson Huang <b20788@freescale.com>
10 years agoENGR00299180-1 ARM: dts: imx6sx: add compatible string for ocram_s
Anson Huang [Fri, 14 Feb 2014 05:51:01 +0000 (13:51 +0800)]
ENGR00299180-1 ARM: dts: imx6sx: add compatible string for ocram_s

Add compatible string for ocram_s to separate it from ocram, as
this ocram_s is dedicated for low power mode.

Signed-off-by: Anson Huang <b20788@freescale.com>
10 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>
10 years agomtd: nand: print out the right information for JEDEC compliant NAND
Huang Shijie [Fri, 21 Feb 2014 05:39:41 +0000 (13:39 +0800)]
mtd: nand: print out the right information for JEDEC compliant NAND

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
10 years agoENGR00299749 ARM: dts: imx: add pxp v4l2 output support on imx6sx 17x17 arm2 board
Robby Cai [Wed, 19 Feb 2014 11:16:11 +0000 (19:16 +0800)]
ENGR00299749 ARM: dts: imx: add pxp v4l2 output support on imx6sx 17x17 arm2 board

Add V4L2 output via PxP support

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299748-2 ARM: dts: imx: add pxp support for imx6sx 17x17 arm2 board
Robby Cai [Wed, 19 Feb 2014 10:18:39 +0000 (18:18 +0800)]
ENGR00299748-2 ARM: dts: imx: add pxp support for imx6sx 17x17 arm2 board

- add pxp resources
- add a dummy clock for imx6sl/imx6dl

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299748-1 imx: pxp: add display_axi_clock handling for imx6sx
Robby Cai [Wed, 19 Feb 2014 10:05:48 +0000 (18:05 +0800)]
ENGR00299748-1 imx: pxp: add display_axi_clock handling for imx6sx

The display axi clock is a clock gating newly added on imx6sx.
It need to be enabled for lcdif/pxp/csi/pcie to work.
It should be set as a placeholder on other SoCs.

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299746-5 ARM: dts: imx: add lcdif support on imx6sx 17x17 arm2 board
Robby Cai [Wed, 19 Feb 2014 05:57:58 +0000 (13:57 +0800)]
ENGR00299746-5 ARM: dts: imx: add lcdif support on imx6sx 17x17 arm2 board

- add pinmux setting for lcdif
- add pwm3 setting for lcdif backlight
- add a dummy clock for imx23/imx28/imx60

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299746-4 imx: lcdif: change the outstanding requests on any clock cycle
Robby Cai [Wed, 19 Feb 2014 05:22:13 +0000 (13:22 +0800)]
ENGR00299746-4 imx: lcdif: change the outstanding requests on any clock cycle

Refer to the RM:
Generally, 4 outstanding requests of length 16 will provide enough performance
to drive any standard display resolution. These configuration bits are intended
to change the access pattern of the eLCDIF to optimize system bus throughput
when other system masters will contend for system memory resources.

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299746-3 imx: lcdif: add disp_axi clock handling for imx6sx
Robby Cai [Wed, 19 Feb 2014 03:37:33 +0000 (11:37 +0800)]
ENGR00299746-3 imx: lcdif: add disp_axi clock handling for imx6sx

The display axi clock is a clock gating newly added on imx6sx.
It need to be enabled for lcdif/pxp/csi/pcie to work.
It should be set as a placeholder on other SoCs.

This patch also simplifies the sanity check for axi and pixel clock.

Signed-off-by: Sandor Yu <R01008@freescale.com>
Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299746-2 ARM: imx6sx: correct lcdif clocks
Robby Cai [Wed, 19 Feb 2014 03:20:39 +0000 (11:20 +0800)]
ENGR00299746-2 ARM: imx6sx: correct lcdif clocks

- correct LCDIF pixel clock's parent selection
- correct LCDIF PODF clock's parent
- Set LCDIF1_PRE_SEL clock parent to PLL5_VIDEO, and set LCDIF1_SEL clock's
  parent to LCDIF1_PODF. They are set for pixel clock.

Signed-off-by: Sandor Yu <R01008@freescale.com>
Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoENGR00299746-1 ARM: dts: imx6sx: Add PWM support
Robby Cai [Wed, 19 Feb 2014 02:58:39 +0000 (10:58 +0800)]
ENGR00299746-1 ARM: dts: imx6sx: Add PWM support

add PWM[1-4] support in imx6sx.dtsi

Signed-off-by: Robby Cai <R63905@freescale.com>
10 years agoASoC: fsl-sai: convert to use regmap API for Freeacale SAI
Xiubo Li [Sat, 8 Feb 2014 06:38:28 +0000 (14:38 +0800)]
ASoC: fsl-sai: convert to use regmap API for Freeacale SAI

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 78957fc349bcf29d415a649601581a993ff25e4d)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl-sai: Clean up the code
Xiubo Li [Wed, 8 Jan 2014 08:13:05 +0000 (16:13 +0800)]
ASoC: fsl-sai: Clean up the code

Makes the code slightly shorter.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 633ff8f8a4393b4a13b94eddd2613198c32035e6)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl_sai: fix the endianess for SAI fifo data.
Xiubo Li [Tue, 31 Dec 2013 07:33:22 +0000 (15:33 +0800)]
ASoC: fsl_sai: fix the endianess for SAI fifo data.

Revert the SAI's endianess for fifo data to/from DMA engine.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 72aa62bed3ea30635156fad95f123a0b665072bf)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl_sai: Fix one bug for hardware limitation.
Xiubo Li [Tue, 31 Dec 2013 07:33:21 +0000 (15:33 +0800)]
ASoC: fsl_sai: Fix one bug for hardware limitation.

This is maybe one bug or a limitation of the hardware that the {T,R}CR2's
Synchronous Mode bits must be set as late as possible, or the SAI device
maybe hanged up, and there has not any explaination about this limitation
in the SAI Data Sheet.

And the {T,R}CR2's Synchronous Mode bits must be set at the same time whether
for Tx or Rx stream.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 496a39d9ec238569fac6daceac8f5420c5edc2f1)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl_sai: Add disable operation for the corresponding data channel.
Xiubo Li [Wed, 25 Dec 2013 04:40:04 +0000 (12:40 +0800)]
ASoC: fsl_sai: Add disable operation for the corresponding data channel.

Enables/Disables the corresponding data channel for tx/rx operation.
A channel must be enabled before its FIFO is accessed, and then disable
it when tx/rx is stopped or idle.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e5d0fa9c3ec59a40e0285d96b65b7f62875acd42)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl_sai: Move the global registers setting to _dai_probe()
Xiubo Li [Wed, 25 Dec 2013 03:20:14 +0000 (11:20 +0800)]
ASoC: fsl_sai: Move the global registers setting to _dai_probe()

Because we cannot make sure which one of _dai_fmt() and _dai_sysclk()
will be firstly called. So move the RCSR/TCSR and TCR1/RCR1's
initialization to _dai_probe(), and this can make sure that before any
of {T,R}CR{1~5} register to be set the RCSR/TCSR's RE/TE bit has been
cleared for the hareware limitation.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e6dc12d7198eddba2e3e7a13feab5c7edde7ba1d)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl_sai: Sort local variable in general way
Nicolin Chen [Fri, 20 Dec 2013 08:41:05 +0000 (16:41 +0800)]
ASoC: fsl_sai: Sort local variable in general way

Generally we would write code for local variable like:
static new_func()
{
struct xxx *yyy;
...
int ret;
}

But this driver only follows this pattern for some functions, not all.
Thus this patch sorts the local variable in the general way.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4e3a99f5b004b30bc604d82e5498700649148e0d)

10 years agoASoC: fsl_sai: Make dev_err information neater
Nicolin Chen [Fri, 20 Dec 2013 08:41:04 +0000 (16:41 +0800)]
ASoC: fsl_sai: Make dev_err information neater

Since using dev_err() there's no need to mention SAI any more, it will
print the full name of the driver -- fsl_sai.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 190af12dad975f2ea7d69d1c5c9d36fec64da767)

10 years agoASoC: fsl_sai: Drop useless ret in startup()
Nicolin Chen [Fri, 20 Dec 2013 08:41:03 +0000 (16:41 +0800)]
ASoC: fsl_sai: Drop useless ret in startup()

We can save this ret to make the code neater.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 15b29dae6604d2d2daf586429ff12f26272a868a)

10 years agoASoC: fsl_sai: Drop useless channels check in hw_params()
Nicolin Chen [Fri, 20 Dec 2013 08:41:02 +0000 (16:41 +0800)]
ASoC: fsl_sai: Drop useless channels check in hw_params()

SAi only supports two data channels on hardware level and the driver also does
register the min->1 and max->2, so no need to check channels.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d22e28cce80a93578787d273bf1fa26a2be2636b)

10 years agoASoC: fsl_sai: Use snd_pcm_format_width()
Nicolin Chen [Fri, 20 Dec 2013 08:41:01 +0000 (16:41 +0800)]
ASoC: fsl_sai: Use snd_pcm_format_width()

Use common helper function snd_pcm_format_width() to make code neater.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1d7003092771bd2feec30e2f3e5a06aa33479e08)

10 years agoASoC: fsl_sai: Keep symmetry for clk_enable() and clk_disable()
Nicolin Chen [Fri, 20 Dec 2013 08:41:00 +0000 (16:41 +0800)]
ASoC: fsl_sai: Keep symmetry for clk_enable() and clk_disable()

There are two functions haven't clk_disable_unprepare() if having error.
Thus fix them.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Reviewed-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1fb2d9d7465bcbb519c582fa4a3bd04ff4fce2d2)

10 years agoASoC: fsl-sai: Use snd_soc_dai_init_dma_data()
Xiubo Li [Fri, 20 Dec 2013 04:35:33 +0000 (12:35 +0800)]
ASoC: fsl-sai: Use snd_soc_dai_init_dma_data()

Makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit dd9f40602e96353c210805a99abd9af6abd28473)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl-sai: Use devm_snd_dmaengine_pcm_register()
Xiubo Li [Fri, 20 Dec 2013 04:30:26 +0000 (12:30 +0800)]
ASoC: fsl-sai: Use devm_snd_dmaengine_pcm_register()

Makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e5180df3960b6130f17f3c5ab50d23674cdb2b5a)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: fsl-sai: Remove fsl_sai_remove()
Xiubo Li [Fri, 20 Dec 2013 04:17:38 +0000 (12:17 +0800)]
ASoC: fsl-sai: Remove fsl_sai_remove()

There is no need of this function and makes the code slightly shorter

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit a6af47ae5399baf4f5a2426b2121c1bcb9da4019)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: Add SAI SoC Digital Audio Interface driver.
Xiubo Li [Tue, 17 Dec 2013 03:24:38 +0000 (11:24 +0800)]
ASoC: Add SAI SoC Digital Audio Interface driver.

This adds Freescale SAI ASoC Audio support.
This implementation is only compatible with device tree definition.
Features:
o Supports playback/capture
o Supports 16/20/24 bit PCM
o Supports 8k - 96k sample rates
o Supports master and slave mode.

Signed-off-by: Alison Wang <b18965@freescale.com>
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4355082149429d1f87b6fbfc3ebc6305a5372ce2)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Conflicts:
sound/soc/fsl/Makefile

10 years agoASoC: dai: Provide interface for setting DMA data at probe time
Mark Brown [Thu, 17 Oct 2013 20:13:19 +0000 (21:13 +0100)]
ASoC: dai: Provide interface for setting DMA data at probe time

Allow DMA data to be set at probe time for devices that can do that,
avoiding the need to do it every time we start a stream and supporting
non-DT dmaengine users using the helpers.

Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ecfc0c04f236f1e2a95094792ec10cf27be39f7c)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: core: fix devres parameter in devm_snd_soc_register_card()
Shawn Guo [Mon, 2 Dec 2013 05:26:50 +0000 (13:26 +0800)]
ASoC: core: fix devres parameter in devm_snd_soc_register_card()

Since devm_card_release() expects parameter 'res' to be a pointer to
struct snd_soc_card, devm_snd_soc_register_card() should really pass
such a pointer rather than the one to struct device.

This bug causes the kernel Oops below with imx-sgtl500 driver when we
remove the module.  It happens because with 'card' pointing to the wrong
structure, card->num_rtd becomes 0 in function soc_remove_dai_links().
Consequently, soc_remove_link_components() and in turn
soc_cleanup_codec[platform]_debugfs() will not be called on card
removal.  It results in that debugfs_card_root is being removed while
its child entries debugfs_codec_root and debugfs_platform_root are still
there, and thus the kernel Oops.

Fix the bug by correcting the parameter 'res' to be the pointer to
struct snd_soc_card.

$ lsmod
Module                  Size  Used by
snd_soc_imx_sgtl5000     3506  0
snd_soc_sgtl5000       13677  2
snd_soc_imx_audmux      5324  1 snd_soc_imx_sgtl5000
snd_soc_fsl_ssi         8139  2
imx_pcm_dma             1380  1 snd_soc_fsl_ssi
$ rmmod snd_soc_imx_sgtl5000
Unable to handle kernel paging request at virtual address e594025c
pgd = be134000
[e594025c] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in: snd_soc_imx_sgtl5000(-) snd_soc_sgtl5000 snd_soc_imx_audmux snd_soc_fsl_ssi imx_pcm_dma
CPU: 0 PID: 1793 Comm: rmmod Not tainted 3.13.0-rc1 #1570
task: bee28900 ti: bfbec000 task.ti: bfbec000
PC is at debugfs_remove_recursive+0x28/0x154
LR is at snd_soc_unregister_card+0xa0/0xcc
pc : [<80252b38>]    lr : [<80496ac4>]    psr: a0000013
sp : bfbede00  ip : bfbede28  fp : bfbede24
r10: 803281d4  r9 : bfbec000  r8 : 803271ac
r7 : bef54440  r6 : 00000004  r5 : bf9a4010  r4 : bf9a4010
r3 : e5940224  r2 : 00000000  r1 : bef54450  r0 : 803271ac
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 4e13404a  DAC: 00000015
Process rmmod (pid: 1793, stack limit = 0xbfbec240)
Stack: (0xbfbede00 to 0xbfbee000)
de00: 00000000 bf9a4010 bf9a4010 00000004 bef54440 bec89000 bfbede44 bfbede28
de20: 80496ac4 80252b1c 804a4b60 bfbede60 bf9a4010 00000004 bfbede54 bfbede48
de40: 804a4b74 80496a30 bfbede94 bfbede58 80328728 804a4b6c bfbede94 a0000013
de60: bf1b5800 bef54440 00000002 bf9a4010 7f0169f8 bf9a4044 00000081 8000e9c4
de80: bfbec000 00000000 bfbedeac bfbede98 80328cb0 80328618 7f016000 bf9a4010
dea0: bfbedec4 bfbedeb0 8032561c 80328c84 bf9a4010 7f0169f8 bfbedee4 bfbedec8
dec0: 80325e84 803255a8 bee28900 7f0169f8 00000000 78208d30 bfbedefc bfbedee8
dee0: 80325410 80325dd4 beca8100 7f0169f8 bfbedf14 bfbedf00 803264f8 803253c8
df00: 7f01635c 7f016a3c bfbedf24 bfbedf18 80327098 803264d4 bfbedf34 bfbedf28
df20: 7f016370 80327090 bfbedfa4 bfbedf38 80085ef0 7f016368 bfbedf54 5f646e73
df40: 5f636f73 5f786d69 6c746773 30303035 00000000 78208008 bfbedf84 bfbedf68
df60: 800613b0 80061194 fffffffe 78208d00 7efc2f07 00000081 7f016a3c 00000800
df80: bfbedf84 00000000 00000000 fffffffe 78208d00 7efc2f07 00000000 bfbedfa8
dfa0: 8000e800 80085dcc fffffffe 78208d00 78208d30 00000800 a8c82400 a8c82400
dfc0: fffffffe 78208d00 7efc2f07 00000081 00000002 00000000 78208008 00000800
dfe0: 7efc2e1c 7efc2ba8 76f5ca47 76edec7c 80000010 78208d30 00000000 00000000
Backtrace:
[<80252b10>] (debugfs_remove_recursive+0x0/0x154) from [<80496ac4>] (snd_soc_unregister_card+0xa0/0xcc)
 r8:bec89000 r7:bef54440 r6:00000004 r5:bf9a4010 r4:bf9a4010
r3:00000000
[<80496a24>] (snd_soc_unregister_card+0x0/0xcc) from [<804a4b74>] (devm_card_release+0x14/0x18)
 r6:00000004 r5:bf9a4010 r4:bfbede60 r3:804a4b60
[<804a4b60>] (devm_card_release+0x0/0x18) from [<80328728>] (release_nodes+0x11c/0x1dc)
[<8032860c>] (release_nodes+0x0/0x1dc) from [<80328cb0>] (devres_release_all+0x38/0x54)
[<80328c78>] (devres_release_all+0x0/0x54) from [<8032561c>] (__device_release_driver+0x80/0xd4)
 r4:bf9a4010 r3:7f016000
[<8032559c>] (__device_release_driver+0x0/0xd4) from [<80325e84>] (driver_detach+0xbc/0xc0)
 r5:7f0169f8 r4:bf9a4010
[<80325dc8>] (driver_detach+0x0/0xc0) from [<80325410>] (bus_remove_driver+0x54/0x98)
 r6:78208d30 r5:00000000 r4:7f0169f8 r3:bee28900
[<803253bc>] (bus_remove_driver+0x0/0x98) from [<803264f8>] (driver_unregister+0x30/0x50)
 r4:7f0169f8 r3:beca8100
[<803264c8>] (driver_unregister+0x0/0x50) from [<80327098>] (platform_driver_unregister+0x14/0x18)
 r4:7f016a3c r3:7f01635c
[<80327084>] (platform_driver_unregister+0x0/0x18) from [<7f016370>] (imx_sgtl5000_driver_exit+0x14/0x1c [snd_soc_imx_sgtl5000])
[<7f01635c>] (imx_sgtl5000_driver_exit+0x0/0x1c [snd_soc_imx_sgtl5000]) from [<80085ef0>] (SyS_delete_module+0x130/0x18c)
[<80085dc0>] (SyS_delete_module+0x0/0x18c) from [<8000e800>] (ret_fast_syscall+0x0/0x48)
 r6:7efc2f07 r5:78208d00 r4:fffffffe
Code: 889da9f8 e5983020 e3530000 089da9f8 (e5933038)
---[ end trace 825e7e125251a225 ]---

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ebff65473f56e6c30de928fd6a4f1ce5ae36e8c5)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: Add resource managed snd_dmaengine_pcm_register()
Lars-Peter Clausen [Thu, 28 Nov 2013 07:50:32 +0000 (08:50 +0100)]
ASoC: Add resource managed snd_dmaengine_pcm_register()

For many drivers using the generic dmaengine PCM driver one of the few (or the
only) things left to do in the drivers remove function is to unregister the PCM
device. This patch adds a resource managed version of snd_dmaengine_pcm_register()
which makes it possible to simplify the remove function as well as the error
path in the probe function for those drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 21585ee848078b12d0d1a513e93936bf96b444a0)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: core: Add devm_snd_soc_register_card()
Mark Brown [Mon, 16 Sep 2013 17:02:05 +0000 (18:02 +0100)]
ASoC: core: Add devm_snd_soc_register_card()

Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register() card.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
(cherry picked from commit 0e4ff5c806263bf40ee5409ac283b776f0c11e41)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoASoC: core: Implement devm_snd_soc_register_component()
Mark Brown [Wed, 4 Sep 2013 19:37:34 +0000 (20:37 +0100)]
ASoC: core: Implement devm_snd_soc_register_component()

Since with the wider use of devres many drivers are now only calling
snd_soc_unregister_component() in their remove functions providing a
managed version will save a reasonable amount of code.

Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit a0b03a616b08cf9d709812ff5cf7e9c0958d6807)
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
10 years agoENGR00300245 ARM: dts: imx6sx: add egalax support for sdb board
Fugang Duan [Fri, 21 Feb 2014 08:56:02 +0000 (16:56 +0800)]
ENGR00300245 ARM: dts: imx6sx: add egalax support for sdb board

- Add egalax touch screen support for sdb board.
- Correct i2c3 pinctrl.

Signed-off-by: Fugang Duan <B38611@freescale.com>
10 years agoDocumentation: add the binding file for Freescale vf610 ADC driver
Fugang Duan [Sun, 26 Jan 2014 05:39:00 +0000 (05:39 +0000)]
Documentation: add the binding file for Freescale vf610 ADC driver

The patch adds the binding file for Freescale vf610 ADC driver.

CC: Shawn Guo <shawn.guo@linaro.org>
CC: Jonathan Cameron <jic23@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: Peter Meerwald <pmeerw@pmeerw.net>
CC: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>