platform/kernel/linux-stable.git
9 years agoARM: shmobile: koelsch-reference: Remove workarounds for core clock issues
Geert Uytterhoeven [Wed, 14 May 2014 14:47:45 +0000 (16:47 +0200)]
ARM: shmobile: koelsch-reference: Remove workarounds for core clock issues

Now the core clock issues have been fixed by commit
3c90c55dcde745bed81f6447f24ba96bda43d984 ("drivers: sh: compile
drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI"), revert the following
3 commits:
  - 4dcb4c80380dfa482874b931e308fd382597feab ("ARM: shmobile: Add Koelsch
    clock workarounds for SDHI"),
  - 8e4f394b20a0fe474dd88204d76978191566decf ("ARM: shmobile:
    koelsch-reference: Annotate clk_enables as __initconst"),
  - 3d75d9ea74fee6f5a4bdcbbdf2d577661d047eef ("ARM: shmobile:
    koelsch-reference: Work around core clock issues").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit d37e9b0b20dd7670946ad6034b4aa93b7e7048aa)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: rcar-gen2: correct return value of shmobile_smp_apmu_suspend_init
Simon Horman [Mon, 16 Jun 2014 11:21:13 +0000 (20:21 +0900)]
ARM: shmobile: rcar-gen2: correct return value of shmobile_smp_apmu_suspend_init

The dummy shmobile_smp_apmu_suspend_init() function provided when
CPU_IDLE is not set should not return a value as per the signature
of the function.

This problem appears to have been introduced by
867ba81f728f1daa ("ARM: shmobile: APMU: Add Core-Standby-state for Suspend
to RAM").

Cc: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit ecdaca48629bd99609fdc612685363330967dce2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: rcar-gen2: Remove useless copied section for LongTrail
Geert Uytterhoeven [Thu, 12 Jun 2014 08:42:24 +0000 (10:42 +0200)]
ARM: shmobile: rcar-gen2: Remove useless copied section for LongTrail

Open Firmware in the CHRP LongTrail does not support plugging in ARM CPUs
in its PPC 603e/604e-compatible CPU socket ;-)

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit ea2a0d581a3e742c2fb2bc520c8c8887fe1dafa6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: rcar-gen2: Use "1ULL" instead of "(u64)1"
Geert Uytterhoeven [Thu, 12 Jun 2014 08:42:23 +0000 (10:42 +0200)]
ARM: shmobile: rcar-gen2: Use "1ULL" instead of "(u64)1"

Casts are evil

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit b69f47c00f2eff19b532cf0142d81b993e587bf0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: rcar-gen2: Update for of_get_flat_dt_prop() update
Geert Uytterhoeven [Thu, 12 Jun 2014 08:42:22 +0000 (10:42 +0200)]
ARM: shmobile: rcar-gen2: Update for of_get_flat_dt_prop() update

Commit 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 ("of/fdt: update
of_get_flat_dt_prop in prep for libfdt") changed the function prototypes
of of_get_flat_dt_prop():
  - The return type was made const,
  - The last parameter was changed from "unsigned long *" to "int *".
and dt_mem_next_cell():
  - The second parameter was made const.

This causes the following compiler warnings:

arch/arm/mach-shmobile/setup-rcar-gen2.c: In function 'rcar_gen2_scan_mem':
arch/arm/mach-shmobile/setup-rcar-gen2.c:125:15: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
arch/arm/mach-shmobile/setup-rcar-gen2.c:142:2: warning: passing argument 3 of 'of_get_flat_dt_prop' from incompatible pointer type [enabled by default]
include/linux/of_fdt.h:53:20: note: expected 'int *' but argument is of type 'long unsigned int *'
arch/arm/mach-shmobile/setup-rcar-gen2.c:142:6: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
arch/arm/mach-shmobile/setup-rcar-gen2.c:144:3: warning: passing argument 3 of 'of_get_flat_dt_prop' from incompatible pointer type [enabled by default]
include/linux/of_fdt.h:53:20: note: expected 'int *' but argument is of type 'long unsigned int *'
arch/arm/mach-shmobile/setup-rcar-gen2.c:144:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
arch/arm/mach-shmobile/setup-rcar-gen2.c:152:3: warning: passing argument 2 of 'dt_mem_next_cell' from incompatible pointer type [enabled by default]
include/linux/of_fdt.h:69:12: note: expected 'const __be32 **' but argument is of type '__be32 **'
arch/arm/mach-shmobile/setup-rcar-gen2.c:153:3: warning: passing argument 2 of 'dt_mem_next_cell' from incompatible pointer type [enabled by default]
include/linux/of_fdt.h:69:12: note: expected 'const __be32 **' but argument is of type '__be32 **'

Update the variable types in rcar_gen2_scan_mem() to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
[horms+renesas@verge.net.au: rebased]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 83850b04ae7744f51681533fb7afb645e66ce8fe)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Add shared R-Car Gen2 CMA reservation code
Magnus Damm [Mon, 9 Jun 2014 12:38:45 +0000 (21:38 +0900)]
ARM: shmobile: Add shared R-Car Gen2 CMA reservation code

Add R-Car Gen2 CMA memory reservation code that can be
shared between multiple SoCs and boards. At this point
r8a7790 and r8a7791 are supported.

The top 256MiB of the legacy 32-bit physical memory space
is assigned to a separate CMA area that may be assigned
to various devices later on.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
[horms+renesas@verge.net.au: rebased]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit f8e819352d12f1b7d109d846e9bf1c07e006469a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Use shmobile_init_late() on r8a7791 DT-only
Magnus Damm [Fri, 6 Jun 2014 06:15:23 +0000 (15:15 +0900)]
ARM: shmobile: Use shmobile_init_late() on r8a7791 DT-only

Tie in shmobile_init_late for the DT-only r8a7791 SoC
Multiplatform support code. This will make sure that
Suspend-to-RAM, CPUIdle and CPUFreq get initialized.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 3d65226bc925f4749c2b2ab0ea3f4d274e194688)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Use shmobile_init_late() on r8a7790 DT-only
Magnus Damm [Fri, 6 Jun 2014 06:13:47 +0000 (15:13 +0900)]
ARM: shmobile: Use shmobile_init_late() on r8a7790 DT-only

Tie in shmobile_init_late for the DT-only r8a7790 SoC
Multiplatform support code. This will make sure that
Suspend-to-RAM, CPUIdle and CPUFreq get initialized.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 7d95b9ddfb933f94354fa2ff9b1bfccdd6c54653)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Mark all SoCs in shmobile as CPUFreq, capable
Benoit Cousson [Thu, 5 Jun 2014 03:49:44 +0000 (12:49 +0900)]
ARM: shmobile: Mark all SoCs in shmobile as CPUFreq, capable

Mark all SoCs in shmobile as CPUFreq capable
on multiplatform build only.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
[gaku.inami.xw@bp.renesas.com: Move the definition of cpufreq capable]
Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 6596e97e054647fecb016ecb7e1935aa2b7db954)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: r8a7791: Support Core-Standby for Suspend to RAM
keita kobayashi [Thu, 29 May 2014 07:24:52 +0000 (16:24 +0900)]
ARM: shmobile: r8a7791: Support Core-Standby for Suspend to RAM

Add r8a7791 Core-Standby state for Suspend to RAM support.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 7f6234013a835476f1503be2c9287f1fe3497457)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: r8a7790: Support Core-Standby for Suspend to RAM
keita kobayashi [Thu, 29 May 2014 07:24:39 +0000 (16:24 +0900)]
ARM: shmobile: r8a7790: Support Core-Standby for Suspend to RAM

Add r8a7790 Core-Standby state for Suspend to RAM support.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit ce508d1b13d1008db570ac58e775ce36bd9c5112)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: APMU: Add Core-Standby-state for Suspend to RAM
keita kobayashi [Thu, 29 May 2014 07:24:27 +0000 (16:24 +0900)]
ARM: shmobile: APMU: Add Core-Standby-state for Suspend to RAM

This patch add Core-Standby-state for Suspend to RAM.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
[horms+renesas@verge.net.au: rebase]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit d6d757c9a4e06e118fa5158fa74e03c514d862d2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: r8a7791 SYSC setup code
keita kobayashi [Fri, 30 May 2014 05:18:48 +0000 (14:18 +0900)]
ARM: shmobile: r8a7791 SYSC setup code

Add r8a7791 SYSC power management support.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
[horms+renesas@verge.net.au: rebased]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 5f6108bb9643949bf5ec0bc9f5cbde588c542c7f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: r8a7779: Reference clocks
Simon Horman [Thu, 15 May 2014 11:32:00 +0000 (20:32 +0900)]
ARM: shmobile: r8a7779: Reference clocks

Reference clocks using a "clocks" property in all nodes corresponding to
devices that require a clock.

Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoC.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 3325cbe8ab74731c88e70d172ffef74cbca13f18)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: marzen: Specify external clock frequency in DT
Simon Horman [Thu, 15 May 2014 11:31:59 +0000 (20:31 +0900)]
ARM: shmobile: marzen: Specify external clock frequency in DT

The external crystal frequency is 31.25 on the Marzen board.
Specify it in the device tree.

Based on work for the Lager board by Laurent Pinchart.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 954e42cf541b3cbb8dd07ba29f5974f91cb8c248)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Sync Marzen DTS with Marzen reference DTS
Simon Horman [Thu, 15 May 2014 11:31:58 +0000 (20:31 +0900)]
ARM: shmobile: Sync Marzen DTS with Marzen reference DTS

Copy the device nodes from Marzen reference into the Marzen device tree
file. This will allow us to use a single DTS file regardless of kernel
configuration. In case of legacy C board code the device nodes may or
may not be used, but in the multiplatform case all the DT device nodes
will be used.

Based on a similar change for the Lager board by Laurent Pinchart.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit bedd672409d68c98e717ac79f58b0ba155879275)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: r8a7779: Add clocks
Simon Horman [Thu, 15 May 2014 11:31:57 +0000 (20:31 +0900)]
ARM: shmobile: r8a7779: Add clocks

Declare all core and MSTP clocks currently used by r8a7779-based boards.

Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoCs.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 1e8515384bfa5efa5803a38c5ba7fecd6514c527)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Use shmobile_init_delay() on EMEV2
Magnus Damm [Thu, 5 Jun 2014 05:32:04 +0000 (14:32 +0900)]
ARM: shmobile: Use shmobile_init_delay() on EMEV2

Adjust EMEV2 to use shmobile_init_delay() together with
CPU Frequency settings from the DTS.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit ef9026e6879da358376b58fc63fe7a82f07404ad)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Update EMEV2 DTS to include CPU frequency
Magnus Damm [Thu, 5 Jun 2014 05:31:56 +0000 (14:31 +0900)]
ARM: shmobile: Update EMEV2 DTS to include CPU frequency

Add CPU Frequency information to the EMEV2 DTS file. This
will allow us to use the shared C code to on EMEV2 which
reads out the clock frequency from DT and calculates the
delay settings from there.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 11f1ca10b668995a031aade5c2728f0a251aaec7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move rcar-gen2.h, cleanup r8a7790 case
Magnus Damm [Tue, 17 Jun 2014 07:48:01 +0000 (16:48 +0900)]
ARM: shmobile: Move rcar-gen2.h, cleanup r8a7790 case

Change location of rcar-gen2.h so it can be used as #include "rcar-gen2.h"
instead of the old style #include <mach/rcar-gen2.h>. Also clean up
the r8a7790 case to follow the same style as r8a7791.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 62872989bdbf1245d7239b9f4c05a8ee7c775ed5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move pm-rcar.h, cleanup r8a7779 case
Magnus Damm [Tue, 17 Jun 2014 07:47:53 +0000 (16:47 +0900)]
ARM: shmobile: Move pm-rcar.h, cleanup r8a7779 case

Change location of pm-rcar.h so it can be used as #include "pm-rcar.h"
instead of the old style #include <mach/pm-rcar.h>. Also clean up
the r8a7779 case to move some unused header file cruft into a C
file.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 585c09df3738d4f72cee36eb0b975351fd9a339a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move pm-rmobile.h, cleanup sh73xx.h
Magnus Damm [Tue, 17 Jun 2014 07:47:45 +0000 (16:47 +0900)]
ARM: shmobile: Move pm-rmobile.h, cleanup sh73xx.h

Change location of pm-rmobile.h so it can be used as #include "pm-rmobile.h"
instead of the old style #include <mach/pm-rmobile.h>. Also clean up
the sh7372 and sh73a0 header files to get rid of unused include files.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 6b8b0cb477b3e77721982effae3415f3c5f58fee)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move common.h
Magnus Damm [Tue, 17 Jun 2014 07:47:37 +0000 (16:47 +0900)]
ARM: shmobile: Move common.h

Change location for common.h so it can be used as #include "common.h"
instead of the old style #include <mach/common.h>.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit fd44aa5e570d1d8c7d361dcbf94c2b8cd25cfe92)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move most of irqs.h, keep some for pinctl
Magnus Damm [Tue, 17 Jun 2014 07:47:29 +0000 (16:47 +0900)]
ARM: shmobile: Move most of irqs.h, keep some for pinctl

Move most of irqs.h so it can be used as #include "irqs.h"
instead of the old style #include <mach/irqs.h>.

Legacy code in drivers/pinctrl needs more work to get rid
of the "mach" portion of the include path, so some part
is left in the original location.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
[horms+renesas@verge.net.au: Do not add trailing blank line to irqs.h]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit b6bab1263c61e39cfc3427f54baff6f683f54298)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move clock.h
Magnus Damm [Tue, 17 Jun 2014 07:47:21 +0000 (16:47 +0900)]
ARM: shmobile: Move clock.h

Change location of clock.h so it can be used as #include "clock.h"
instead of the old style #include <mach/clock.h>.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit ad6ffa0b59dc2c81474d7642fa2188e25cce99d6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move dma-register.h
Magnus Damm [Tue, 17 Jun 2014 07:47:13 +0000 (16:47 +0900)]
ARM: shmobile: Move dma-register.h

Change location of dma-register.h so it can be used as #include
"dma-register.h" instead of the old style #include <mach/dma-register.h>.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 74ac0de8b7ee41246b8d6aae1df0618a64451435)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Move intc.h, cleanup sh_intc.h usage
Magnus Damm [Tue, 17 Jun 2014 07:47:05 +0000 (16:47 +0900)]
ARM: shmobile: Move intc.h, cleanup sh_intc.h usage

Change location of intc.h so it can be used as #include "intc.h"
instead of the old style #include <mach/intc.h>. Also clean up
some code to get rid of redundant #include <linux/sh_intc.h>.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 6200e2c1847b2282db13877b2398a5bee9e42254)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Fix device node reference leakage in shmobile_init_delay
Laurent Pinchart [Wed, 21 May 2014 13:31:05 +0000 (15:31 +0200)]
ARM: shmobile: Fix device node reference leakage in shmobile_init_delay

The of_find_compatible_node() function returns a new reference to the
found node. Instead of just adding of_node_put() calls, simplify the
code by moving the CPU identification logic inside the loop over cpu
nodes, in order to lower complexity from O(n) to O(1) by replacing
of_find_compatible_node() calls with of_device_is_compatible().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit edc8fb1d6ebdfc4efa009073586d3567c3368475)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: add cpufreq-cpu0 driver for common SH-Mobile
Gaku Inami [Tue, 3 Jun 2014 12:02:45 +0000 (21:02 +0900)]
ARM: shmobile: add cpufreq-cpu0 driver for common SH-Mobile

I add a new file(cpufreq.c) for the following reasons.
- Registration of platform_device must be unified in SH-Mobile.
- We can't create a node of cpufreq drivers into device tree.
  (Because cpufreq driver is virtual device.)

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 06e32c91dbce3c24ccbe84e3af2a35199662bca0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Enable CPUFREQ configuration
Gaku Inami [Tue, 3 Jun 2014 12:03:34 +0000 (21:03 +0900)]
ARM: shmobile: Enable CPUFREQ configuration

This changes of configuration is multiplatform build only for r8a7790/r8a7791.

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 468c570ed078f0326745bfe85868adb925659502)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: Enable PM_RUNTIME in defconfig
Simon Horman [Fri, 16 May 2014 00:04:42 +0000 (09:04 +0900)]
ARM: shmobile: Enable PM_RUNTIME in defconfig

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 6e2776388a85e6b41e8cc816ece318d944fc3388)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: marzen: Add to shmobile defconfig
Simon Horman [Fri, 16 May 2014 00:04:13 +0000 (09:04 +0900)]
ARM: shmobile: marzen: Add to shmobile defconfig

Add marzen to shmobile defconfig now that it supports multiplatform
Also enable SH_HSPI which is used by marzen.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit b2bfcdc2f28b045cf01f63d0949f7eb9bd597405)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: armadillo800eva defconfig: Enable REGULATOR_GPIO and LEDS_GPIO
Geert Uytterhoeven [Wed, 14 May 2014 14:51:22 +0000 (16:51 +0200)]
ARM: shmobile: armadillo800eva defconfig: Enable REGULATOR_GPIO and LEDS_GPIO

Enable missing options for devices in platform data and/or DT:
  - REGULATOR_GPIO
  - LEDS_GPIO (and its dependencies)

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 65b590adb672cbe91624f9bd7a80d5ef8919db48)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: marzen: Remove early_printk from command line
Simon Horman [Thu, 15 May 2014 11:39:31 +0000 (20:39 +0900)]
ARM: shmobile: marzen: Remove early_printk from command line

As early printk support is not enabled in the kernel in the
shmobile defconfig it does not make much sense to provide for
it in the default command line.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 7432695daeebffa39bae94d8f15ffe96ede3e581)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: armadillo800eva reference dts: Add matching LED labels
Geert Uytterhoeven [Wed, 14 May 2014 14:51:19 +0000 (16:51 +0200)]
ARM: shmobile: armadillo800eva reference dts: Add matching LED labels

And make the node name numbering match the label numbering.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: devicetree@vger.kernel.org
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 0ba06992e8919128d0547066247de9e54a8bb992)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: enable Mute control on DVC
Kuninori Morimoto [Fri, 1 Aug 2014 10:10:55 +0000 (03:10 -0700)]
ASoC: rsnd: enable Mute control on DVC

DVC can control Mute.
This patch supports it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cd2b65741e72da64508957cd1cde85116102d8dd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: tidyup DVC control method
Kuninori Morimoto [Fri, 1 Aug 2014 10:10:47 +0000 (03:10 -0700)]
ASoC: rsnd: tidyup DVC control method

DVC can use Volume and Mute control,
and these control methods doesn't have much difference.
This patch cleanup current method,
and it will be used for Mute control.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 486b09c750e58777976ad74a37de7b4252630332)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup SND_SOC_DAIFMT_xB_xF behavior
Kuninori Morimoto [Fri, 1 Aug 2014 01:08:18 +0000 (18:08 -0700)]
ASoC: rsnd: fixup SND_SOC_DAIFMT_xB_xF behavior

In current R-Car rsnd driver,
the SND_SOC_DAIFMT_xB_xF flags are used to HW default behavior,
but, it should be used to specific format.
The waveforms of LEFT_J/RIGHT_J format with
SND_SOC_DAIFMT_NB_NF flag will be
started from "falling edge" without this patch.
But, it should be started from "rising edge".

Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1a7889ca8aba333d7c74fad543d692c31bc7f280)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup pcm_new callback method
Kuninori Morimoto [Thu, 31 Jul 2014 06:53:03 +0000 (23:53 -0700)]
ASoC: rsnd: fixup pcm_new callback method

bff58ea4f43d9b4a9fd6fb05fabc8f50f68131f5
(ASoC: rsnd: add DVC support) added DVC support,
and it added pcm_new callback feature for it.
Then it called all DAI's pcm_new callback, and it was wrong.
This patch fixup it and call correct callback.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 7c63f3c02f5a998621758239abed43c5bd454b70)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: add missing dev_dbg() in rsnd_bset()
Kuninori Morimoto [Thu, 31 Jul 2014 06:52:50 +0000 (23:52 -0700)]
ASoC: rsnd: add missing dev_dbg() in rsnd_bset()

b8c637864a6904a9ba8e0df556d5bdf9f26b2c54
(ASoC: rsnd: use regmap_mmio instead of original regmap bus)
used regmap_mmio and modified dev_dbg() for rsnd_read/write().
But rsnd_bset() is missing it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4f8f86aa41232cc4595136f18013324482fdf749)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: care audio local bus data format consistency
Kuninori Morimoto [Thu, 31 Jul 2014 06:52:26 +0000 (23:52 -0700)]
ASoC: rsnd: care audio local bus data format consistency

R-Car sound uses Audio Local Bus which uses Lch/Rch format.
This bus is used if driver uses BUSIF.
But sound data is written as Rch/Lch format in register.
This means Rch <-> Lch will be inverted.
SSIU :: BUSIF_DALIGN is used to controlling data format.

Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1cc7195929501b96fccce42646f1ad0ffe2598a6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: care detail of SRC_BSDSR
Kuninori Morimoto [Thu, 31 Jul 2014 06:52:04 +0000 (23:52 -0700)]
ASoC: rsnd: care detail of SRC_BSDSR

Driver should care more detail of SRC_BSDSR settings.
The sound includes noise without this patch
if it used SRC.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 054cd7f4b986a941b56372b743602f7df6569c98)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: use regmap_mmio instead of original regmap bus
Kuninori Morimoto [Tue, 29 Jul 2014 07:37:31 +0000 (00:37 -0700)]
ASoC: rsnd: use regmap_mmio instead of original regmap bus

Current rsnd driver is using regmap and regmap_field.
It used original regmap bus which is
single regmap instance for multi register mapping.
This patch modifies it to use regmap_mmio bus,
and tidyuped probe method

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b8c637864a6904a9ba8e0df556d5bdf9f26b2c54)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup dai remove callback operation
Kuninori Morimoto [Thu, 24 Jul 2014 08:51:31 +0000 (01:51 -0700)]
ASoC: rsnd: fixup dai remove callback operation

rsnd driver is using SSI/SRC/DVC which are
using "mod" base operation.
These "mod" are supporting "probe" and "remove" callbacks.

Current rsnd_probe should call "remove" if "probe" was failed,
since "probe" might be having DMAEngine handle.
Some mod's "remove" callback might be called without calling
"probe", but it is no problem. because "remove" do nothing
in such case.

So, all mod's "remove" should be called when error case
of rsnd_probe() and rsnd_remove().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d62a3dcd4d75b1713d12697afdbffaf9a9da8f43)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: add missing src/dst_addr_width for DMAEngine
Kuninori Morimoto [Thu, 17 Jul 2014 06:18:44 +0000 (23:18 -0700)]
ASoC: rsnd: add missing src/dst_addr_width for DMAEngine

Renesas new DMAEngine driver requests src/dst_addr_width

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2bf865ba30405056e7922b960a1687bb4d5a4999)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: add DT support to DVC
Kuninori Morimoto [Mon, 23 Jun 2014 00:59:28 +0000 (17:59 -0700)]
ASoC: rsnd: add DT support to DVC

Now, DVC can use DT

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: DMA start address is properly used for each DMAC
Kuninori Morimoto [Mon, 23 Jun 2014 00:59:02 +0000 (17:59 -0700)]
ASoC: rsnd: DMA start address is properly used for each DMAC

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 340371005d399b595f4044fc5e336f4a66ead101)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
Kuninori Morimoto [Mon, 23 Jun 2014 00:58:26 +0000 (17:58 -0700)]
ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 37523034851d6a4b1dc951e24bf2f11bc28fe58d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: enable DVC when capture
Kuninori Morimoto [Mon, 23 Jun 2014 00:57:04 +0000 (17:57 -0700)]
ASoC: rsnd: enable DVC when capture

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 65f459923b7926f6a7f156970d83360bd80cb169)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
Kuninori Morimoto [Mon, 23 Jun 2014 00:56:41 +0000 (17:56 -0700)]
ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ccd01559ead29b59918458e9b412ff18b88fc6cf)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: SSI + DMA can select BUSIF
Kuninori Morimoto [Mon, 23 Jun 2014 00:56:23 +0000 (17:56 -0700)]
ASoC: rsnd: SSI + DMA can select BUSIF

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d9288d0ba12de1b5efb830b9128e4cc6877318fc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rcar: Fix dma direction type
Lars-Peter Clausen [Thu, 19 Jun 2014 07:40:30 +0000 (09:40 +0200)]
ASoC: rcar: Fix dma direction type

dmaengine_prep_slave_single() expects a enum dma_transfer_direction and not a
enum dma_data_direction. Since the integer representations of both DMA_TO_DEVICE
and DMA_MEM_TO_DEV aswell as DMA_FROM_DEVICE and DMA_DEV_TO_MEM have the same
value the code worked fine even though it was using the wrong type.

Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49:     int enum dma_data_direction  versus
sound/soc/sh/rcar/core.c:227:49:     int enum dma_transfer_direction

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cd7bcc6000165f6215d15e2e32b58a646e5de5ec)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup loop exit timing of dma name search
Kuninori Morimoto [Wed, 18 Jun 2014 08:55:09 +0000 (17:55 +0900)]
ASoC: rsnd: fixup loop exit timing of dma name search

Current dma name search loop didn't care about SSI index
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit c08c3b088053cec1465051258844e7934d3e3e37)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
Kuninori Morimoto [Wed, 18 Jun 2014 08:54:43 +0000 (17:54 +0900)]
ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1

ad32d0c7b0e993433df152ae747652647eb65a27
(ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
added rsnd_gen_dma_addr() to calculate DMA addr,
but, it is necessary only for Gen2.
This patch ignores Gen1 case.
Kernel will be panic without this patch.
Special thanks to Simon

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 64eae986fc1e3a281b00f04b7c9c00b145ec8a57)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: uds: Fix scaling of alpha layer
Laurent Pinchart [Sat, 31 May 2014 00:45:48 +0000 (21:45 -0300)]
v4l: vsp1: uds: Fix scaling of alpha layer

Pixel color components can be scaled using either bilinear interpolation
or a multitap filter. The multitap filter provides better results, but
can't be selected when the alpha layer need to be scaled down by more
than 1/2.

Disable alpha scaling when the input has a fixed alpha value, and
program the UDS to output a fixed alpha value in that case. This ensures
the multitap filter will be used whenever possible.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit bdc2df62ae38bbab044078f4d25a7a3d9e2379c9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Make the background color configurable
Laurent Pinchart [Wed, 28 May 2014 01:46:30 +0000 (22:46 -0300)]
v4l: vsp1: bru: Make the background color configurable

Expose the background color to userspace through the V4L2_CID_BG_COLOR
control.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit a16e2794592b733d47f372f0cadcd9ff0f349ca9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Support non-premultiplied colors at the BRU output
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: bru: Support non-premultiplied colors at the BRU output

The BRU outputs premultiplied colors, enable color data normalization
when the format configured at the output of the pipeline isn't
premultiplied.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9aca813e1401dcafe1c0a9d3b03795e254571504)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Support premultiplied alpha at the BRU inputs
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: bru: Support premultiplied alpha at the BRU inputs

Adjust the BRU blending formula to avoid the multiplication by alpha
when the corresponding input format is premultiplied. As this requires
access to the RPFs connected to the BRU inputs from the BRU module,
store pointers to the RPFs in the BRU structure when validating the
pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 6418b4d6e1f1d70199a93eeeed948be2229b9c1a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Add V4L2_CID_ALPHA_COMPONENT control support
Laurent Pinchart [Wed, 21 May 2014 22:00:05 +0000 (19:00 -0300)]
v4l: vsp1: Add V4L2_CID_ALPHA_COMPONENT control support

The control is used to configure the fixed alpha channel value, when
reading from memory in the RPF or writing to memory in the WPF.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7578c204620c8e25ec6e4849cd12098f831a14d0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Add alpha channel support to the memory ports
Laurent Pinchart [Mon, 26 May 2014 23:12:53 +0000 (20:12 -0300)]
v4l: vsp1: Add alpha channel support to the memory ports

Support ARGB formats on the RPF side by reading the alpha component from
memory and on the WPF side by writing it to memory.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7a52b6dea8e9559428149fbed0cddd587004006e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Switch to XRGB formats
Laurent Pinchart [Mon, 26 May 2014 22:57:21 +0000 (19:57 -0300)]
v4l: vsp1: Switch to XRGB formats

The driver ignores the alpha component on output video nodes and
hardcodes the alpha component to 0 on capture video nodes. Make this
explicit by exposing XRGB formats.

Compatibility with existing userspace applications is handled by
selecting the XRGB format corresponding to the requested old RGB format.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 56bfef3e72cf4a98d0e8f56129673146733c1366)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: wpf: Clear RPF to WPF association at stream off time
Laurent Pinchart [Wed, 28 May 2014 16:10:33 +0000 (13:10 -0300)]
v4l: vsp1: wpf: Clear RPF to WPF association at stream off time

The VSP1 stores the video pipelines' input (RPF) to output (WPF)
mappings in a WPF register. An RPF must never be associated with
multiple WPFs, even if all of those WPFs but one are unused, otherwise
the hardware won't function properly.

The driver doesn't ensure this correctly as it never clears the
mappings. An RPF used with one WPF and later with a different WPF will
lead to malfunction, as it will be associated with two WPFs. Clear the
mappings at stream off time to fix this.

Reported-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit d6c71e8ceb9fe79aaf9c2f73af5cb2ef93526b0d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: wpf: Simplify cast to pipeline structure
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: wpf: Simplify cast to pipeline structure

Use the subdev pointer directly to_vsp1_pipeline() macro instead of
casting from the subdev to the wpf object and back to the subdev.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 5aeb01adbea81e858318072097d98fc44578c7be)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: sru: Make the intensity controllable during streaming
Laurent Pinchart [Sat, 31 May 2014 23:30:11 +0000 (20:30 -0300)]
v4l: vsp1: sru: Make the intensity controllable during streaming

The control value is currently stored in the SRU structure by the
control set handler and written to the hardware at stream on time,
making control set during streaming ineffective. Fix it by writing to
the registers from within the control set handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 58f896d859ce555dd3684f439f8a65bfda437533)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: sru: Fix the intensity control default value
Laurent Pinchart [Wed, 21 May 2014 22:00:05 +0000 (19:00 -0300)]
v4l: vsp1: sru: Fix the intensity control default value

The default value isn't set and defaults to 0, which isn't in the 1-6
min-max range. Fix it by setting the default value to 1.

This shoud have been caught when checking the control handler error
field at initialization time, but the check was missing. Add it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit a1606102dafe6942905e97a88ceea9a60e1a2c7d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Setup control handler automatically at stream on time
Laurent Pinchart [Sat, 31 May 2014 13:40:51 +0000 (10:40 -0300)]
v4l: vsp1: Setup control handler automatically at stream on time

When setting a control directly on a subdev node the VSP1 driver doesn't
guarantee that the device is powered on. This leads to crashes when the
control handlers writes to hardware registers. One easy way to fix this
is to ensure that the device gets powered on when a subdev node is
opened. However, this consumes power unnecessarily, as there's no need
to power the device on when setting formats on the pipeline.
Furthermore, control handler setup at entity init time suffers from the
same problem as the device isn't powered on easier.

Fix this by extend the entity base object to setup the control handler
automatically when starting the stream. Entities must then skip writing
to registers in the set control handler when not streaming, which can be
tested with the new vsp1_entity_is_streaming() helper function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 960de2cff49a4e5f45e6a60175f4298cc34dc526)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Propagate vsp1_device_get errors to the callers
Laurent Pinchart [Sat, 31 May 2014 11:50:32 +0000 (08:50 -0300)]
v4l: vsp1: Propagate vsp1_device_get errors to the callers

Modify the vsp1_device_get() function to return an error code instead of
a pointer to the VSP1 device, and use the return value in the callers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 4c16d6a079a4c9a64d664cc9c30ebae5f0bd0c64)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Cleanup video nodes at removal time
Laurent Pinchart [Wed, 28 May 2014 15:49:13 +0000 (12:49 -0300)]
v4l: vsp1: Cleanup video nodes at removal time

Video nodes created and initialized in the RPF and WPF init code paths
are never unregistered, and the related resources (videobuf alloc
context and media entity) never released.

Fix this by storing a pointer to the vsp1_video object in vsp1_entity
and calling vsp1_video_cleanup() from vsp1_entity_destroy(). This also
allows simplifying the init error code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 1499be67a545fb6f41acb5614b8e4732147cec50)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix typos
Laurent Pinchart [Tue, 27 May 2014 15:59:39 +0000 (12:59 -0300)]
v4l: vsp1: Fix typos

Several macros were mistakenly prefixed with VPS1 instead of VSP1. Fix
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7005a81705d032887b9f4f808e6dce8e57b8980a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix pipeline stop timeout
Laurent Pinchart [Mon, 23 Jun 2014 20:15:02 +0000 (17:15 -0300)]
v4l: vsp1: Fix pipeline stop timeout

If the pipeline was already stopped when stopping the stream, no
frame end interrupt will be generated and the driver will time out
waiting for the pipeline to stop.

Fix this by setting the pipeline state to STOPPED when the pipeline is
idle waiting for frames to process, and to STOPPING at stream stop time
only when the pipeline is currently RUNNING.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9b3e6e2abd7568f9458e927fc4e5eca1b3cde521)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Release buffers at stream stop
Laurent Pinchart [Mon, 23 Jun 2014 19:57:22 +0000 (16:57 -0300)]
v4l: vsp1: Release buffers at stream stop

videobuf2 expects no buffer to be owned by the driver when the
stop_stream queue operation returns. As the vsp1 driver fails to do so,
a warning is generated at stream top time.

Fix this by releasing all buffers queued on the IRQ queue in the
stop_stream operation handler and marking them as erroneous.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9df04e9d9ac6982d16a8a042c8274410ed29fb0e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix routing cleanup when stopping the stream
Laurent Pinchart [Mon, 23 Jun 2014 21:40:49 +0000 (18:40 -0300)]
v4l: vsp1: Fix routing cleanup when stopping the stream

Commit d9b45ed3d8b75e8cf38c8cd1563c29217eecba27 ("v4l: vsp1: Support
multi-input entities") reworked pipeline routing configuration and
introduced a bug by writing to the entities routing registers without
first checking whether the entity had a routing register. This results
in overwriting the value at offset 0 of the device register space when
stopping the stream.

Fix this by skipping routing register write for entities without a
routing register.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit aaa48cbb098e13cf9c22066b8c65958a7243fb95)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agorcar_vin: add devicetree support
Ben Dooks [Sat, 5 Jul 2014 22:26:22 +0000 (19:26 -0300)]
rcar_vin: add devicetree support

Add support for devicetree probe for the rcar-vin
driver.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[g.liakhovetski@gmx.de fix a typo, sort headers alphabetically]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 47c71bd61b772cd72159dff4aae43734257a485a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agorcar_vin: copy flags from pdata
Ben Dooks [Mon, 14 Apr 2014 10:36:40 +0000 (07:36 -0300)]
rcar_vin: copy flags from pdata

The platform data is a single word, so simply copy
it into the device's private data structure than
keeping a copy of the pointer.

This will make changing to device-tree binding
easier as it is one allocation instead of two.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 25dfa02ce21981ef08d375be987862f96676d8ab)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoof: move graph helpers from drivers/media/v4l2-core to drivers/of
Philipp Zabel [Mon, 10 Feb 2014 21:01:48 +0000 (22:01 +0100)]
of: move graph helpers from drivers/media/v4l2-core to drivers/of

This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
(cherry picked from commit fd9fdb78a9bf85b94fb2190c82ff280c8f8375cc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoi2c: i2c-rcar: Drop class based scanning to improve bootup time
Wolfram Sang [Thu, 10 Jul 2014 11:46:31 +0000 (13:46 +0200)]
i2c: i2c-rcar: Drop class based scanning to improve bootup time

This driver has been flagged to drop class based instantiation. The removal
improves boot-up time and is unneeded for embedded controllers. Users have been
warned to switch for some time now, so we can actually do the removal. Keep the
DEPRECATED flag, so the core can inform users that the behaviour finally
changed now. After another transition period, this flag can go, too.
While we are here, remove the indentation for the array setup because
such things always break after some time.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit 929e3aba5114235388793443cbc05882904577b9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Fix GPL v2 license string typo
Bjorn Helgaas [Tue, 15 Jul 2014 21:06:12 +0000 (15:06 -0600)]
PCI: rcar: Fix GPL v2 license string typo

Per license_is_gpl_compatible(), the MODULE_LICENSE() string for GPL v2 is
"GPL v2", not "GPLv2".  Use "GPL v2" so this module doesn't taint the
kernel.

Based-on-work-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit 68947eb17503ce2009c603d0d0bb9feb139fb8b8)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm/rcar-du: Fix maximum frame buffer pitch computation
Laurent Pinchart [Mon, 28 Jul 2014 18:18:36 +0000 (20:18 +0200)]
drm/rcar-du: Fix maximum frame buffer pitch computation

The maximum pitch constraint for the hardware is expressed in pixels.
Convert it to bytes to validate frame buffer creation, as frame buffer
pitches are expressed in bytes.

Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8bed5cc765ffdd61b59f8405d38b377f5a7f0920)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: fix warnings
Russell King [Sun, 13 Jul 2014 11:18:58 +0000 (12:18 +0100)]
drm: rcar-du: fix warnings

drivers/gpu/drm/rcar-du/rcar_du_drv.c:190:5: warning: "CONFIG_PM_SLEEP" is not defined [-Wundef]

Always use #ifdef with CONFIG symbols, never just bare #if

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 396d7a24a9b3ddbce3335c57a234227eb7762d14)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agothermal: rcar: Document SoC-specific bindings
Geert Uytterhoeven [Wed, 9 Jul 2014 12:23:35 +0000 (14:23 +0200)]
thermal: rcar: Document SoC-specific bindings

The documentation only mentioned the generic fallback compatible property.
Add the missing SoC-specific compatible properties, some of which are
already in use.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: linux-pm@vger.kernel.org
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit fa313103c953fd832b7c4e431c74be55c20b1ce1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Fix leaking of unused DMA descriptors
Geert Uytterhoeven [Wed, 6 Aug 2014 12:58:58 +0000 (14:58 +0200)]
spi: rspi: Fix leaking of unused DMA descriptors

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3819bc8752367eae0d72fa1c473dc88ea45631a7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
Geert Uytterhoeven [Wed, 9 Jul 2014 10:26:22 +0000 (12:26 +0200)]
spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully

As typically a shmobile SoC has less DMA channels than devices that can use
DMA, we may want to prioritize access to the DMA channels in the future.
This means that dmaengine_prep_slave_sg() may start failing arbitrarily.

Handle dmaengine_prep_slave_sg() failures gracefully by falling back to
PIO.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 85912a88c1ebcad04a5cfec971771195ce8d6691)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh: intc: Confine SH_INTC to platforms that need it
Geert Uytterhoeven [Wed, 20 Aug 2014 13:39:22 +0000 (15:39 +0200)]
sh: intc: Confine SH_INTC to platforms that need it

Currently the sh-intc driver is compiled on all SuperH and
non-multiplatform SH-Mobile platforms, while it's only used on a limited
number of platforms:
  - SuperH: SH2(A), SH3(A), SH4(A)(L) (all but SH5)
  - ARM: sh7372, sh73a0

Drop the "default y" on SH_INTC, make all CPU platforms that use it
select it, and protect all sub-options by "if SH_INTC" to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 049d28048be595e0a10a58fe1c104b153c386633)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
arch/arm/mach-shmobile/Kconfig
arch/sh/Kconfig

9 years agonet: sh_eth: Add r8a7794 support
Hisashi Nakamura [Fri, 1 Aug 2014 15:03:00 +0000 (17:03 +0200)]
net: sh_eth: Add r8a7794 support

Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
[uli: added bindings documentation]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0f76b9d83b2b010b63a094024b3cfd82e20af28d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: sh_mmcif: Configure DMA slave bus width
Laurent Pinchart [Tue, 15 Jul 2014 22:45:13 +0000 (00:45 +0200)]
mmc: sh_mmcif: Configure DMA slave bus width

The data register is 4 bytes wide, hardcode the DMA transfer size to
4 bytes in both directions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit e36152aa84cf68bd7f09acffd480cd2b6aa5480d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: sh_mmcif: Fix DMA slave address configuration
Laurent Pinchart [Tue, 15 Jul 2014 22:45:12 +0000 (00:45 +0200)]
mmc: sh_mmcif: Fix DMA slave address configuration

Commit e5a233cb647d749de2f188477c9a54b94d90477f ("mmc: sh_mmcif:
Factorize DMA channel request and configuration code") incorrectly
set the destination address for both slave channels instead of setting
the source address for the receive channel. Fix that.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit d25006e7e5045e76575e9f58903efc1a860a3ff1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: tmio: Configure DMA slave bus width
Laurent Pinchart [Tue, 15 Jul 2014 22:45:14 +0000 (00:45 +0200)]
mmc: tmio: Configure DMA slave bus width

Even though some implementations support 4-bytes data register access,
the tmio driver never configures the hardware in such a way and always
performs 2-bytes accesses. Hardcode the DMA transfer size to 2 bytes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 39ab196243e8732ad68928be97129305b29afbbd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Fix transmit-only DMA transfers
Geert Uytterhoeven [Thu, 7 Aug 2014 12:07:43 +0000 (14:07 +0200)]
spi: sh-msiof: Fix transmit-only DMA transfers

Fix tx/rx mixup, which broke transmit-only transfers.

Introduced by commit 4240305f7cbdc7782aa8bc40cc702775d9ac0839
("spi: sh-msiof: Fix leaking of unused DMA descriptors").

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cdcd565fa0925edf9b80c875fcc84a231c75bd1d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Fix leaking of unused DMA descriptors
Geert Uytterhoeven [Wed, 6 Aug 2014 12:59:03 +0000 (14:59 +0200)]
spi: sh-msiof: Fix leaking of unused DMA descriptors

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3e81b59208fa4697c6c3b6eefb92892b47f8b1e7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Use correct device for DMA mapping with IOMMU
Geert Uytterhoeven [Fri, 11 Jul 2014 15:56:22 +0000 (17:56 +0200)]
spi: sh-msiof: Use correct device for DMA mapping with IOMMU

To function correctly in the presence of an IOMMU, the DMA buffers must be
mapped using the DMA channel's device instead of the MSIOF platform
device's device.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 5dabcf2f27ded864cf79204c4a3cca1516b66026)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully
Geert Uytterhoeven [Wed, 9 Jul 2014 10:26:23 +0000 (12:26 +0200)]
spi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully

As typically a shmobile SoC has less DMA channels than devices that can use
DMA, we may want to prioritize access to the DMA channels in the future.
This means that dmaengine_prep_slave_single() may start failing
arbitrarily.

Handle dmaengine_prep_slave_single() failures gracefully by falling back to
PIO. This requires moving DMA-specific configuration of the MSIOF device
after the call(s) to dmaengine_prep_slave_single().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 279d2378c9c4f05bbe41b55625b4003871026266)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Add DMA support
Geert Uytterhoeven [Mon, 30 Jun 2014 10:10:24 +0000 (12:10 +0200)]
spi: sh-msiof: Add DMA support

Add DMA support to the MSIOF driver using platform data.

As MSIOF DMA is limited to 32-bit words (requiring byte/wordswapping for
smaller wordsizes), and the group length is limited to 256 words, DMA is
performed on two fixed pages, allocated and mapped at driver initialization
time.

Performance figures (in Mbps) on r8a7791/koelsch at different SPI clock
frequencies for 1024-byte and 4096-byte transfers:

                   1024 bytes           4096 bytes
  -  3.25 MHz: PIO  2.1, DMA  2.6 | PIO  2.8, DMA  3.1
  -  6.5  MHz: PIO  3.2, DMA  4.4 | PIO  5.0, DMA  5.9
  - 13    MHz: PIO  4.2, DMA  6.6 | PIO  8.2, DMA 10.7
  - 26    MHz: PIO  5.9, DMA 10.4 | PIO 12.4, DMA 18.4

Note that DMA is only faster than PIO for transfers that exceed the FIFO
size (typically 64 words / 256 bytes).

Also note that large transfers (larger than the group length for DMA, or
larger than the FIFO size for PIO), should use cs-gpio (with the
appropriate pinmux setup), as the hardware chipselect will be deasserted in
between chunks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b0d0ce8b6b91a0f6f99045b6019fc4c824634fb4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Refactor sh_msiof_transfer_one()
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:19 +0000 (12:16 +0200)]
spi: sh-msiof: Refactor sh_msiof_transfer_one()

  - Move buffer pointer and length setup to the top,
  - Make unsigned values unsigned,
  - Loop over words and increment pointers instead of recalculating them,
    which allows to kill bytes_done.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 0312d59130693adad85c2acfbc0b92a669930a41)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Improve transfer error handling
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:18 +0000 (12:16 +0200)]
spi: sh-msiof: Improve transfer error handling

  - Add a timeout when waiting for the transfer complete interrupt,
  - If sh_msiof_spi_stop() fails, there's no need to clear IER, as the
    interrupt handler has already done that,
  - Propagate transfer failures in sh_msiof_transfer_one().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 75b82e23a4ea20a9e1a48695ff5e01761889dbb3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Extract sh_msiof_spi_{start,stop}() helpers
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:17 +0000 (12:16 +0200)]
spi: sh-msiof: Extract sh_msiof_spi_{start,stop}() helpers

Based on an old patch by Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 76c02e71612533206cb062b875c9609bce83d23a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Add more register documentation
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:16 +0000 (12:16 +0200)]
spi: sh-msiof: Add more register documentation

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2e2b36872d7b45b1f88a590283b14c67931b777f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: r8a7791: fix CAN pin groups
Sergei Shtylyov [Mon, 28 Jul 2014 22:12:55 +0000 (02:12 +0400)]
sh-pfc: r8a7791: fix CAN pin groups

I had made last-minute changes before submitting the patch "sh-pfc: r8a7791:
add CAN pin groups"; now I'm seeing that they weren't complete: I had missed
update to the pin group names in pin[01]_groups[]. Drop the "_a" suffixes there.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 302fb1781783ded370f515e8e649b8285ee29cdc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Add calculation recive margin for HSCIF
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:10:00 +0000 (16:10 +0900)]
serial: sh-sci: Add calculation recive margin for HSCIF

When the error of the same bit rate is detected, we will need to select
the recive margin is large. Current code holds the minimum error, it does
not have to check the recive margin. This adds this calculation.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 730c4e782c039caf40b467c35f595c005e94220c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Fix range check of bit-rate for HSCIF
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:09:59 +0000 (16:09 +0900)]
serial: sh-sci: Fix range check of bit-rate for HSCIF

If bit-rate calculation result of HSCIF is expect 255 from 0,
driver does not calculate error bit. However, we need to round
the value to calculate error bit in the case of negative value.
This rounds the value of bit-rate using clamp(), and bit-rate is the
case of negative value, it enables the calculation of the error bit.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bcb9973a6097652a12660958449301aada41de9c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Updated calculation of bit error rate and bit rate
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:09:58 +0000 (16:09 +0900)]
serial: sh-sci: Updated calculation of bit error rate and bit rate

Currently, the decimal point is discarded calculation of BRR.
Therefore, it can not calculate a value close to the correct value.
This patch fixes this problem by using DIV_ROUND_CLOSEST.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b7d66397f4d282ddf2a2fe516fc9329c5a063459)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>