platform/kernel/linux-stable.git
9 years agoclocksource: sh_tmu: Add index to struct sh_tmu_channel
Laurent Pinchart [Mon, 27 Jan 2014 21:04:17 +0000 (22:04 +0100)]
clocksource: sh_tmu: Add index to struct sh_tmu_channel

Use the index as the timer start/stop bit and when printing messages to
identify the channel.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit fe68eb802ef8bf034735f37cb561ab814fb3b0d6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Add memory base to sh_tmu_channel structure
Laurent Pinchart [Mon, 27 Jan 2014 21:04:17 +0000 (22:04 +0100)]
clocksource: sh_tmu: Add memory base to sh_tmu_channel structure

The channel memory base is channel-specific, add it to the channel
structure in preparation for support of multiple channels per device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit de693461bf9624ec12808f8c5524510364cc2a43)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Constify name argument to sh_tmu_register()
Laurent Pinchart [Mon, 17 Feb 2014 15:04:16 +0000 (16:04 +0100)]
clocksource: sh_tmu: Constify name argument to sh_tmu_register()

The name argument is assigned to const structure fields only, constify
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 84876d0505b15a2907696566a80a365993feab44)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Split channel setup to separate function
Laurent Pinchart [Mon, 27 Jan 2014 21:04:17 +0000 (22:04 +0100)]
clocksource: sh_tmu: Split channel setup to separate function

Move the channel setup code from sh_tmu_setup to a new
sh_tmu_setup_channel function and call it from sh_tmu_setup.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit a94ddaa6fcd46e168736027535b2d81b6a18883f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Rename struct sh_tmu_priv to sh_tmu_device
Laurent Pinchart [Mon, 27 Jan 2014 21:04:17 +0000 (22:04 +0100)]
clocksource: sh_tmu: Rename struct sh_tmu_priv to sh_tmu_device

Channel data is private as well, rename priv to device to make the
distrinction between the core device and the channels clearer.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 0a72aa39cc105fbf6971feb8928a63530a4a446b)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Split channel fields from sh_tmu_priv
Laurent Pinchart [Mon, 27 Jan 2014 14:29:19 +0000 (15:29 +0100)]
clocksource: sh_tmu: Split channel fields from sh_tmu_priv

Create a new sh_tmu_channel structure to hold the channel-specific
field in preparation for multiple channels per device support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit de2d12c7e856f0fa59ea83275410a364d2b182c0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Use request_irq() instead of setup_irq()
Laurent Pinchart [Mon, 17 Feb 2014 10:27:49 +0000 (11:27 +0100)]
clocksource: sh_tmu: Use request_irq() instead of setup_irq()

The driver claims it needs to register an interrupt handler too early
for request_irq(). This might have been true in the past, but the only
meaningful difference between request_irq() and setup_irq() today is an
additional kzalloc() call in request_irq(). As the driver calls
kmalloc() itself we know that the slab allocator is available, we can
thus switch to request_irq().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 1c56cf6b048e1e1bbe08faf38b5592b373905ac5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Add device tree support for r8a7{778,740,3a4} and sh73a0
Simon Horman [Fri, 11 Jul 2014 09:11:08 +0000 (11:11 +0200)]
serial: sh-sci: Add device tree support for r8a7{778,740,3a4} and sh73a0

Simply document new compat strings.
There appears to be no need for a driver updates.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 34c4eda809e1efb16c554c07bb5df4c8ace9424e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: Support setting mclk via a fixed factor
Andrew Lunn [Thu, 22 May 2014 15:31:49 +0000 (17:31 +0200)]
ASoC: simple-card: Support setting mclk via a fixed factor

Some platforms require that the codecs mclk is a fixed multiplication
factor of the audio stream rate. Add a optional property to the
binding to hold this factor and implement a hw_params() function to
make use of it.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2942a0e285c46587a1025f12597df63ec04d08c6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: is_top_level_node parameter to simple_card_dai_link_of()
Jyri Sarha [Thu, 24 Apr 2014 16:42:00 +0000 (19:42 +0300)]
ASoC: simple-card: is_top_level_node parameter to simple_card_dai_link_of()

Restore correct parsing of dai-link subnodes with more explicit
implementation for applying the "simple-audio-card,"-prefix to
dai-link property and subnode names.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 648722155dc081b019ab0ef548bbebde760a2b83)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: Improve coding style
Nicolin Chen [Thu, 24 Apr 2014 11:14:00 +0000 (19:14 +0800)]
ASoC: simple-card: Improve coding style

Improve indentation and space.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 781cbebed750af26341e551b785048a1ea347c5e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: Simplify error msg in simple_card_dai_link_of()
Nicolin Chen [Thu, 24 Apr 2014 11:13:59 +0000 (19:13 +0800)]
ASoC: simple-card: Simplify error msg in simple_card_dai_link_of()

It would look better to use prop instead.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 966b8063607fbf43c8fdeef579fd8de8a35ca45d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: Drop node->name checking
Nicolin Chen [Thu, 24 Apr 2014 11:13:58 +0000 (19:13 +0800)]
ASoC: simple-card: Drop node->name checking

The current simple-card driver limits the DT node name to "sound".
Any of other names is forbidden while actually we should allow DT
to pass other node names.

And if this function is being called, the node must already have
the compatible "simple-audio-card" in DTB. So there should be no
need to check the name here.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 50e6c718a1eb2ae6d05f22615d8268b026175a4a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: simple-card: Move dai-link level properties away from dai subnodes
Jyri Sarha [Mon, 24 Mar 2014 10:15:25 +0000 (12:15 +0200)]
ASoC: simple-card: Move dai-link level properties away from dai subnodes

The properties like format, bitclock-master, frame-master,
bitclock-inversion, and frame-inversion should be common to the dais
connected with a dai-link. For bitclock-master and frame-master
properties to be unambiguous they need to indicate the mastering dai
node with a phandle.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b3ca11ff59bc5842b01f13421a17e6d9a8936784)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: core: Update snd_soc_of_parse_daifmt() interface
Jyri Sarha [Mon, 24 Mar 2014 10:15:24 +0000 (12:15 +0200)]
ASoC: core: Update snd_soc_of_parse_daifmt() interface

Adds struct device_node **bitclkmaster and struct device_node **framemaster
function parameters. With the new syntax bitclock-master and frame-master
properties can explicitly indicate the dai-link bit-clock and frame masters
with a phandle. This patch also makes the minimal changes to simple-card
for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears
to be the only user of snd_soc_of_parse_daifmt() for now.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 389cb8348cf5ac4a702c71bf13673c4c8bf01e34)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: pxa: hx4700: use PWM_LOOKUP to initialize struct pwm_lookup
Alexandre Belloni [Mon, 19 May 2014 20:42:40 +0000 (22:42 +0200)]
ARM: pxa: hx4700: use PWM_LOOKUP to initialize struct pwm_lookup

Use the new variant of the PWM_LOOKUP macro to initialize the PWM lookup
table.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 9becf5001130bcd24f57584e48467050e85eee03)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: armadillo: use PWM_LOOKUP to initialize struct pwm_lookup
Alexandre Belloni [Mon, 19 May 2014 20:42:39 +0000 (22:42 +0200)]
ARM: shmobile: armadillo: use PWM_LOOKUP to initialize struct pwm_lookup

Use the new variant of the PWM_LOOKUP macro to initialize the PWM lookup
table.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 48d6f146dced79d1df0cb91b30f1cdb749ecdf9f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: OMAP3: Beagle: use PWM_LOOKUP to initialize struct pwm_lookup
Alexandre Belloni [Mon, 19 May 2014 20:42:38 +0000 (22:42 +0200)]
ARM: OMAP3: Beagle: use PWM_LOOKUP to initialize struct pwm_lookup

Use the new variant of the PWM_LOOKUP macro to initialize the PWM lookup
table.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit dee401e1fd5eddc8e3d6ae0e8b5c4bd64aa2a369)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopwm: modify PWM_LOOKUP to initialize all struct pwm_lookup members
Alexandre Belloni [Mon, 19 May 2014 20:42:37 +0000 (22:42 +0200)]
pwm: modify PWM_LOOKUP to initialize all struct pwm_lookup members

Now that PWM_LOOKUP is not used anymore, modify it to initialize all the
members of struct pwm_lookup.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 4284402924cc55e182008ca7e9d4fb1e891ff5ae)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: pxa: hx4700: initialize all the struct pwm_lookup members
Alexandre Belloni [Mon, 19 May 2014 20:42:36 +0000 (22:42 +0200)]
ARM: pxa: hx4700: initialize all the struct pwm_lookup members

Instead of relying on the .pwm_period_ns member of the pwm-backlight
driver's platform data, the PWM period can be retrieved from the PWM
lookup table.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit fcb355063ffb12a834b3ca1383c9beec9285d568)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: OMAP3: Beagle: initialize all the struct pwm_lookup members
Alexandre Belloni [Mon, 19 May 2014 20:42:35 +0000 (22:42 +0200)]
ARM: OMAP3: Beagle: initialize all the struct pwm_lookup members

The PWM core can retrieve the period from the PWM lookup table, so the
struct led_pwm.pwm_period_ns member can be removed.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit e02a84a5ad2f46d4a262884df5ad9ab9e833a7b5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoARM: shmobile: armadillo: initialize all struct pwm_lookup members
Alexandre Belloni [Mon, 19 May 2014 20:42:33 +0000 (22:42 +0200)]
ARM: shmobile: armadillo: initialize all struct pwm_lookup members

Initializing all the struct pwm_lookup members allows to get rid of the
struct tpu_pwm_platform_data as the polarity initialization will be
taken care of by the PWM core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit b16001d745fbc900cc96c8ca2cd2cd08e738c421)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoDMA: shdma: add cyclic transfer support
Kuninori Morimoto [Thu, 3 Apr 2014 03:17:00 +0000 (20:17 -0700)]
DMA: shdma: add cyclic transfer support

This patch add cyclic transfer support and enables dmaengine_prep_dma_cyclic()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
[reflown changelog for readablity]
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit dfbb85cab5f0819d0424a3637b03e7892704fa42)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Add R-Car PCIe device tree bindings
Phil Edworthy [Mon, 12 May 2014 10:57:50 +0000 (11:57 +0100)]
PCI: rcar: Add R-Car PCIe device tree bindings

This patch adds the bindings for the R-Car PCIe driver.  The driver resides
under drivers/pci/host/pcie-rcar.c

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 7869fc6e295cbb1f80e30555bebbc795abb5b9a7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Add MSI support for PCIe
Phil Edworthy [Mon, 12 May 2014 10:57:49 +0000 (11:57 +0100)]
PCI: rcar: Add MSI support for PCIe

Add MSI support to the R-Car PCIe driver.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 290c1fb35860540223bef1be021944d02232889d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Add Renesas R-Car PCIe driver
Phil Edworthy [Mon, 12 May 2014 10:57:48 +0000 (11:57 +0100)]
PCI: rcar: Add Renesas R-Car PCIe driver

This PCIe Host driver currently does not support MSI, so cards fall back to
INTx interrupts.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit c25da4778803b41e11fd82dd5576c35c09b5f0e0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agonet: sh_eth: Fix timing of RACT setting in sh_eth_rx()
Yoshihiro Shimoda [Tue, 10 Jun 2014 00:40:24 +0000 (09:40 +0900)]
net: sh_eth: Fix timing of RACT setting in sh_eth_rx()

This patch fixes an issue that we cannot use nfs rootfs correctly
on r8a7790 when the command below runs on a host PC.

 $ sudo ping -f -l 8 $BOARD_IP_ADDR

Since the driver sets the RACT to 1 in the first while loop of
sh_eth_rx(), the controller accepts a next frame into the next RX
descriptor during the while loop. But, in the first while loop
doesn't allocate a next skb. So, this patch removes the RACT setting
in the first while loop of sh_eth_rx().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1b72a0fc9c308d9f3255c177945cf383c3c82b0e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agonet: sh_eth: Fix receive packet "exceeded" condition in sh_eth_rx()
Yoshihiro Shimoda [Tue, 10 Jun 2014 00:40:14 +0000 (09:40 +0900)]
net: sh_eth: Fix receive packet "exceeded" condition in sh_eth_rx()

This patch fixes the packet "exceeded" condition in sh_eth_rx() when
RACT in an RX descriptor is not set and the "quota" is 0.
Otherwise, kernel panic happens because the "&n->poll_list" is deleted
twice in sh_eth_poll() which calls napi_complete() and net_rx_action().

Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4f809cea611f1f00a0b7a42751cb12d997a4c11c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh_eth: replace devm_kzalloc() with devm_kmalloc_array()
Sergei Shtylyov [Mon, 12 May 2014 22:30:14 +0000 (02:30 +0400)]
sh_eth: replace devm_kzalloc() with devm_kmalloc_array()

When I was converting the driver to the managed device API, only devm_kzalloc()
was available for memory allocation, so I had to use it, despite zeroing out the
PHY IRQ array right before initializing all  its entries to PHY_POLL was quite
stupid.   Now that devm_kmalloc_array() has become available, we can avoid the
needless zeroing out...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 86b5d251d5ac4dda51a022b34cb29b4ce65a8cd5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agousb: renesas: gadget: fixup: complete STATUS stage after receiving
Kuninori Morimoto [Mon, 2 Jun 2014 03:31:46 +0000 (20:31 -0700)]
usb: renesas: gadget: fixup: complete STATUS stage after receiving

Current usbhs gadget driver didn't complete STATUS stage after receiving.
It wasn't problem for us before, because some USB class doesn't use
DATA OUT stage in control transfer.
But, it is required on some device.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 3fe15505296cb563362e2cf6d3aed73e123e0df0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopwm: add period and polarity to struct pwm_lookup
Alexandre Belloni [Mon, 19 May 2014 20:42:32 +0000 (22:42 +0200)]
pwm: add period and polarity to struct pwm_lookup

Add period and polarity members to struct pwm_lookup so that platforms
using the lookup table can be treated the same way as those using the
device tree.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 3796ce1d4d4b330a75005c5eda105603ce9d4071)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: ak4642: Fix typo zoro -> zero
Sascha Hauer [Wed, 14 May 2014 07:37:33 +0000 (09:37 +0200)]
ASoC: ak4642: Fix typo zoro -> zero

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit da731845d5b47c517876cb70884789aafa00771b)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Extract rspi_common_transfer()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:19 +0000 (15:38 +0200)]
spi: rspi: Extract rspi_common_transfer()

Extract the common parts of rspi_transfer_one(), rspi_rz_transfer_one(),
and qspi_transfer_out_in() into the new function rspi_common_transfer().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 8b983e90ea1a3dd82070f96c062ad521a06b7cc0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Add DMA support for RSPI on RZ/A1H
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:18 +0000 (15:38 +0200)]
spi: rspi: Add DMA support for RSPI on RZ/A1H

Enable DMA support for RSPI on r7s72100 (RZ/A1H).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e7fb921d9f62df05240ad1a74b5a0f623e503c9c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Add DMA support for QSPI on R-Car Gen2
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:17 +0000 (15:38 +0200)]
spi: rspi: Add DMA support for QSPI on R-Car Gen2

Enable DMA support for QSPI on R-Car Gen2, for Single, Dual, and Quad SPI
Transfers.

Performance figures for reading from a QSPI FLASH driven at 24.375 MHz
on r8a7791/koelsch:
  - Single:  1.1 Mbps PIO, 23 Mbps DMA
  - Dual  : 12.7 Mbps PIO, 48 Mbps DMA
  - Quad  : 13   Mbps PIO, 70 Mbps DMA

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4f12b5e529e4ff274eb478ec1c2ef41358ed9577)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Absorb rspi_rz_transfer_out_in() into rspi_rz_transfer_one()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:16 +0000 (15:38 +0200)]
spi: rspi: Absorb rspi_rz_transfer_out_in() into rspi_rz_transfer_one()

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 03e627c55752fa434d5b3eba5ee3e489c51672b6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Merge rspi_*_dma() into rspi_dma_transfer()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:15 +0000 (15:38 +0200)]
spi: rspi: Merge rspi_*_dma() into rspi_dma_transfer()

rspi_send_dma() and rspi_send_receive_dma() are very similar. Consolidate
into a single function rspi_dma_transfer(), and add missing checks for
dmaengine_submit() failures.

Both sg_table pointer parameters can be NULL, as RSPI supports TX-only
mode, and unidirectional DMA transfers will also be needed later for
Dual/Quad DMA support.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit c52fb6d63425248bd4152451a2cc74b7df8fa989)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Pass sg_tables instead of spi_tranfer to rspi_*_dma()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:14 +0000 (15:38 +0200)]
spi: rspi: Pass sg_tables instead of spi_tranfer to rspi_*_dma()

The DMA routines only need access to the scatter-gather tables inside the
spi_transfer structures, hence just pass those.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e4b52dc4625ee739195189d40c6ddc7d55ddf312)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Move RSPI-specific setup out of DMA routines
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:13 +0000 (15:38 +0200)]
spi: rspi: Move RSPI-specific setup out of DMA routines

Refactor RSPI (on SH) DMA handling to make it reusable for other RSPI
implementations:
  - Call the DMA routines after configuring the TX Mode bit and after
    calling rspi_receive_init(), so these RSPI-specific operations can be
    removed from the DMA routines,
  - Absorb rspi_transfer_out_in() into rspi_transfer_one().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 8393fa787bf63c05cb6f9cf0a58ba1ea213c3f01)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Use SPI core DMA mapping framework
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:12 +0000 (15:38 +0200)]
spi: rspi: Use SPI core DMA mapping framework

Use the SPI core DMA mapping framework instead of our own.
If available, DMA is used for transfers larger than the FIFO size
(8 or 32 bytes).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2f777ec91aa0623e058c43dd4aaf0b3325d3c3e8)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: SPI DMA core needs both RX and TX DMA to function
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:11 +0000 (15:38 +0200)]
spi: rspi: SPI DMA core needs both RX and TX DMA to function

The SPI DMA core framework needs both RX and TX DMA to function.  As a
preparation for converting the driver to use this framework, fall back to
PIO if no DMA channel or only one DMA channel is available.

This affects only RSPI, which could do DMA transfers for TX-only before.
RSPI-RZ and QSPI (at least for Single SPI Transfers) will need both RX and
TX DMA anyway.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 5f338d0ce0b4c9e6c554b92cfb288789a41bfbc1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Remove unneeded resource test in DMA setup
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:10 +0000 (15:38 +0200)]
spi: rspi: Remove unneeded resource test in DMA setup

The resource is know to exist, as rspi_probe() already mapped it.
Remove the test, and just pass the resource.
Pass the device pointer instead of the platform device pointer, as the
latter is no longer needed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit fcdc49ae53dc8cfc1a7758607bca68935f568ca2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Extract rspi_request_dma_chan()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:09 +0000 (15:38 +0200)]
spi: rspi: Extract rspi_request_dma_chan()

Setup of the receive and transmit DMA channels is very similar, so let's
consolidate.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 65bf220571f131a7c3a564a88793bd0f16fd7c96)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Don't consider DMA configuration failures fatal
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:08 +0000 (15:38 +0200)]
spi: rspi: Don't consider DMA configuration failures fatal

Fall back to PIO if DMA configuration failed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 27e105a6006b8ce1b55709c5e24f63959981475d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Extract rspi_pio_transfer()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:07 +0000 (15:38 +0200)]
spi: rspi: Extract rspi_pio_transfer()

The various PIO loops are very similar. Consolidate into a single
function rspi_pio_transfer().

Both buffer pointers can be NULL, as RSPI supports TX-only mode, and
Dual/Quad SPI Transfers are unidirectional.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 6837b8e91d2a080293c30d5fe42d9692390091fa)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Use core SPI_MASTER_MUST_[RT]X handling
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:06 +0000 (15:38 +0200)]
spi: rspi: Use core SPI_MASTER_MUST_[RT]X handling

RSPI needs dummy transfers to generate the SPI clock on receive.
RSPI-RZ and QSPI always do both transmit and receive.

Use the SPI core SPI_MASTER_MUST_RX/SPI_MASTER_MUST_TX infrastructure
instead of checking for the presence of buffers and providing dummy data
ourselves (for PIO), or providing a dummy buffer (for DMA).

rspi_receive_dma() now provides full duplex DMA transfers on RSPI, and is
renamed to rspi_send_receive_dma().

As the SPI core will always provide a TX buffer, the logic to choose
between DMA send and DMA send/receive in rspi_transfer_one() now has to
check for the presence of an RX buffer. Likewise for the DMA availability
tests in rspi_is_dma().

The buffer tests in qspi_transfer_one() are now always true, so they're
removed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b42e03596db3d45980c976c8124fdc323f031dc4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Remove unused 16-bit DMA support
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:05 +0000 (15:38 +0200)]
spi: rspi: Remove unused 16-bit DMA support

The 16-bit DMA support doesn't fit well within the SPI core DMA framework,
as it needs to manage its own double-sized temporary buffers, for handling
the interleaved data.
Remove it, as there is no in-tree board code that sets
rspi_plat_data.dma_width_16bit.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 9c5de2c1754c2bb3c69c4d7bf0d0edc0a61d8232)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Do not call rspi_receive_init() for TX-only
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:04 +0000 (15:38 +0200)]
spi: rspi: Do not call rspi_receive_init() for TX-only

Since commit 8449fd76deb9ac67a15a6fb8ead7bb4595d019d2 ("spi: rspi: Merge
rspi_send_pio() and rspi_receive_pio()"), rspi_receive_init() is called
for transmit-only transfers too, while this is not needed.
Only call rspi_receive_init() when receiving, to preserve behavior on
RSPI on SH.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 32c64261c6f50a4e71ec7546f7e2f48eba91c985)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Extract rspi_wait_for_{tx_empty,rx_full}()
Geert Uytterhoeven [Mon, 2 Jun 2014 13:38:03 +0000 (15:38 +0200)]
spi: rspi: Extract rspi_wait_for_{tx_empty,rx_full}()

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 5f684c34fc82be84ece158aa5c5c7c5072daa9a0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Round up division to avoid slave overclocking
Geert Uytterhoeven [Thu, 22 May 2014 18:07:35 +0000 (20:07 +0200)]
spi: rspi: Round up division to avoid slave overclocking

The calculation of the bit rate divider used a standard C division, which
rounds down the quotient. This may lead to a higher bitrate than requested.
Round up to avoid this.

E.g. on Koelsch, the SPI flash (configured for 30 MHz) was driven at 48.75
MHz. After this patch it's driven at a safe 24.375 MHz.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3beb61dbfcf188399cbc36ce1eeb8b2ba724de38)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrivers: sh: Enable PM runtime for new R-Car Gen2 SoCs
Geert Uytterhoeven [Tue, 27 May 2014 13:45:09 +0000 (15:45 +0200)]
drivers: sh: Enable PM runtime for new R-Car Gen2 SoCs

The PM runtime code should also be enabled for:
  - r8a7792 (R-Car V2H)
  - r8a7793 (R-Car M2-N)
  - r8a7794 (R-Car E2)

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 2f35fb3c8a6018a0a5fe4a7fb0948b853c157256)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrivers: sh: pm_runtime implementation needs to suspend and resume devices
Ben Dooks [Thu, 22 May 2014 18:00:05 +0000 (20:00 +0200)]
drivers: sh: pm_runtime implementation needs to suspend and resume devices

If we override the platform bus calls for pm_runtime then we end up
with the calls to the devices' suspend and resume methods ignored
in favour of the bus ones.

Change to calling the pm_runtime calls to suspend and resume the
devices specifically in the drivers/sh/pm_runtime.c implementation
to allow any device that may want to run power management to do so.

Note, all the current sh driver implementations do not use their
own power management code so this is not a major implementation
issues.

This also brings the implementation into line with the versions
used by the Davinci and Keystone PM domain code, so once fully
tested these implementations could be merged together.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
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 8255fe169232364e5a01bd062e8037b8c1a9adec)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrivers: sh: Restrict INTC_USERIMASK to SH4A
Geert Uytterhoeven [Thu, 22 May 2014 18:00:06 +0000 (20:00 +0200)]
drivers: sh: Restrict INTC_USERIMASK to SH4A

register_intc_userimask() is called from sh4a code only.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [r8a7779 legacy]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 39c5abbc54179998bf04368a11c561e19220d7d4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrivers: sh: pm_runtime does not need idle callback
Ben Dooks [Thu, 22 May 2014 18:00:04 +0000 (20:00 +0200)]
drivers: sh: pm_runtime does not need idle callback

In the runtime_pm idle callback the code assumes that a NULL .runtime_idle
entry is the same as a .runtime_idle entry that returns 0 as a result. This
means the entry in drivers/sh/pm_runtime can be removed in favour of just
leaving the entry NULL.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [r8a7779 legacy]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit fe95c932a31e7f12bcb6a4e07434462da2ac6e1d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh: intc: Remove pointless irq_reserve_irqs() invocation
Thomas Gleixner [Wed, 7 May 2014 15:44:18 +0000 (15:44 +0000)]
sh: intc: Remove pointless irq_reserve_irqs() invocation

The preceding call to irq_create_identity_mapping() marks the
interrupt as allocated already. Remove the leftover.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Simon Horman <horms@verge.net.au>
Cc: linux-sh@vger.kernel.org
Link: http://lkml.kernel.org/r/20140507154339.189047829@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 3670802223e164f1089287d1c223d34d3c5dc3da)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh: clk: Use cpufreq_for_each_valid_entry macro for iteration
Stratos Karafotis [Fri, 25 Apr 2014 20:16:58 +0000 (23:16 +0300)]
sh: clk: Use cpufreq_for_each_valid_entry macro for iteration

The cpufreq core now supports the cpufreq_for_each_valid_entry macro
helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4229e1c61a4a7ac21d5d0790f6add1c9b98d33e7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agocpufreq: Fix build error on some platforms that use cpufreq_for_each_*
Stratos Karafotis [Wed, 7 May 2014 16:33:33 +0000 (19:33 +0300)]
cpufreq: Fix build error on some platforms that use cpufreq_for_each_*

On platforms that use cpufreq_for_each_* macros, build fails if
CONFIG_CPU_FREQ=n, e.g. ARM/shmobile/koelsch/non-multiplatform:

drivers/built-in.o: In function `clk_round_parent':
clkdev.c:(.text+0xcf168): undefined reference to `cpufreq_next_valid'
drivers/built-in.o: In function `clk_rate_table_find':
clkdev.c:(.text+0xcf820): undefined reference to `cpufreq_next_valid'
make[3]: *** [vmlinux] Error 1

Fix this making cpufreq_next_valid function inline and move it to
cpufreq.h.

Fixes: 27e289dce297 (cpufreq: Introduce macros for cpufreq_frequency_table iteration)
Reported-and-tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 5eeaf1f1897372590105f155c6a7110b3fa36aef)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
include/linux/cpufreq.h

9 years agocpufreq: Introduce macros for cpufreq_frequency_table iteration
Stratos Karafotis [Fri, 25 Apr 2014 20:15:23 +0000 (23:15 +0300)]
cpufreq: Introduce macros for cpufreq_frequency_table iteration

Many cpufreq drivers need to iterate over the cpufreq_frequency_table
for various tasks.

This patch introduces two macros which can be used for iteration over
cpufreq_frequency_table keeping a common coding style across drivers:

- cpufreq_for_each_entry: iterate over each entry of the table
- cpufreq_for_each_valid_entry: iterate over each entry that contains
a valid frequency.

It should have no functional changes.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 27e289dce29764e488c1e13e9aa6950cad1f4aab)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: sh_mmcif: clarify DDR timing mode between SD-UHS and eMMC
Seungwon Jeon [Fri, 14 Mar 2014 12:12:33 +0000 (21:12 +0900)]
mmc: sh_mmcif: clarify DDR timing mode between SD-UHS and eMMC

Replaced UHS_DDR50 with MMC_DDR52.

CC: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 4039ff4741c6e8d27b5ca42dc92d87dc2d625b80)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: clarify DDR timing mode between SD-UHS and eMMC
Seungwon Jeon [Fri, 14 Mar 2014 12:11:56 +0000 (21:11 +0900)]
mmc: clarify DDR timing mode between SD-UHS and eMMC

This change distinguishes DDR timing mode of current
mixed usage to clarify device type.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 79f7ae7c45a6ccf04e2908337461dee615f6afb0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Add device tree support for r8a7779
Simon Horman [Thu, 15 May 2014 11:00:58 +0000 (20:00 +0900)]
serial: sh-sci: Add device tree support for r8a7779

Simply document a new compat string.
There appears to be no need for a driver updates.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 81bd1eb7af751666ace2f1dadb0b0101401807cd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoRevert "serial: sh-sci: Add device tree support for r8a7779"
Greg Kroah-Hartman [Fri, 25 Apr 2014 02:26:16 +0000 (19:26 -0700)]
Revert "serial: sh-sci: Add device tree support for r8a7779"

This reverts commit fcbee4d49f30eb0eaa83a62e6a3cab5a892ed93f.

It wasn't quite ready to go in yet, sorry about that.

Cc: Simon Horman <horms@verge.net.au>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2aafb3864b9fa5ce83250537d940f973ef37b8dc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Add device tree support for r8a7779
Simon Horman [Thu, 24 Apr 2014 06:54:44 +0000 (15:54 +0900)]
serial: sh-sci: Add device tree support for r8a7779

According to the platform data for the legacy-C initialisation of sh-sci
for the r8a7779 SoC and my own testing the SCIx_SH4_SCIF_REGTYPE bit of
scscr needs to be set.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fcbee4d49f30eb0eaa83a62e6a3cab5a892ed93f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: r8a73a4: Allow Multiplatform Build
Magnus Damm [Tue, 13 May 2014 11:37:49 +0000 (13:37 +0200)]
pinctrl: sh-pfc: r8a73a4: Allow Multiplatform Build

Add #ifdefs to allow r8a73a4 Multiplatform build. Needed
to enable r8a73a4 Multiplatform support.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit f39d8a72feb073c4ef6296f1d12cedf2ed572bfb)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: sh73a0: Allow Multiplatform Build
Magnus Damm [Tue, 13 May 2014 11:37:48 +0000 (13:37 +0200)]
pinctrl: sh-pfc: sh73a0: Allow Multiplatform Build

Add #ifdefs to allow sh73a0 Multiplatform build. Needed
to enable sh73a0 Multiplatform support.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 672d32377494b84d6af483ce46eda07baba4e3ea)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: r8a7740: Allow Multiplatform Build
Magnus Damm [Tue, 13 May 2014 11:37:47 +0000 (13:37 +0200)]
pinctrl: sh-pfc: r8a7740: Allow Multiplatform Build

Add #ifdefs to allow r8a7740 Multiplatform build. Needed
to enable r8a7740 Multiplatform support.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit b6c996a295620b67e4033f2eb07e5a5cf9e7a48f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: Don't set the pinmux_irq irq field for multiplatform
Laurent Pinchart [Tue, 13 May 2014 11:37:46 +0000 (13:37 +0200)]
pinctrl: sh-pfc: Don't set the pinmux_irq irq field for multiplatform

In the multiplatform kernel case the IRQs associated with the PFC GPIOs
are specified through DT. The pinmux_irq irq field is thus ignored by
the code, and doesn't need to be set.

This will allow removing the mach/irq.h include from pfc-*.c files that
was required for the irq_pin() macro used to initialize the irq field.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 0e26e8dfb9dddb0559fb7cd7b53a8b497a8d4121)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: pfc: r8a7790: add mux data for IIC(B) cores
Wolfram Sang [Tue, 25 Mar 2014 18:56:26 +0000 (19:56 +0100)]
pinctrl: pfc: r8a7790: add mux data for IIC(B) cores

Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit a16b81dcbfc5889c37dac5f8e836136e4740fc18)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: pfc: r8a7790: add i2c0 muxing
Wolfram Sang [Tue, 25 Mar 2014 18:56:25 +0000 (19:56 +0100)]
pinctrl: pfc: r8a7790: add i2c0 muxing

Add the muxing for the last missing i2c rcar core. Fix the sorting for
SH_PFC_PIN_NAMED while we are here.

Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 35a493de0daf4955b6d15d488b3f8754d4637a04)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: r8a7791: Add Audio pin support
Kuninori Morimoto [Mon, 14 Apr 2014 00:24:04 +0000 (17:24 -0700)]
sh-pfc: r8a7791: Add Audio pin support

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit c57a05b0eb0ee0205b34f2694b035afc75fa71e4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: r8a7791: Add SSI pin support
Kuninori Morimoto [Mon, 14 Apr 2014 00:23:35 +0000 (17:23 -0700)]
sh-pfc: r8a7791: Add SSI pin support

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit b664cd1f020211d8e4480c2937b82fe513a9c757)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: r8a7791: Split the DU sync and cde/disp groups
Laurent Pinchart [Tue, 1 Apr 2014 10:59:09 +0000 (12:59 +0200)]
pinctrl: sh-pfc: r8a7791: Split the DU sync and cde/disp groups

The DU parallel interface ODDF signal is optional, move it out of the
HSYNC/VSYNC group into a group of its down. The CDE and DISP signals are
independent, split them to two different groups.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit d10046e25c73e6150677b1b5360f20bb631181a7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Remove unnecessary OOM messages
Jingoo Han [Thu, 22 May 2014 12:05:07 +0000 (14:05 +0200)]
clocksource: sh_mtu2: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

[dlezcano] : refreshed against latest modifications: kmalloc -> kzalloc

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
(cherry picked from commit c77a565b2966567b97d589e90a6b9ce725bb15b1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Sort headers alphabetically
Laurent Pinchart [Tue, 4 Mar 2014 13:11:47 +0000 (14:11 +0100)]
clocksource: sh_mtu2: Sort headers alphabetically

This helps locating duplicates and inserting new headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 346f5e76b3822a2530a03f33b00ee89dfc463326)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Remove FSF mail address from GPL notice
Laurent Pinchart [Tue, 4 Mar 2014 13:12:32 +0000 (14:12 +0100)]
clocksource: sh_mtu2: Remove FSF mail address from GPL notice

Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 24c8f71707087eb177b45f4a24faedaa0d8f0287)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Rename clock to "fck" in the non-legacy case
Laurent Pinchart [Tue, 4 Mar 2014 17:09:15 +0000 (18:09 +0100)]
clocksource: sh_mtu2: Rename clock to "fck" in the non-legacy case

The sh_mtu2 driver gets the MTU2 functional clock using a connection ID
of "mtu2_fck". While all SH SoCs create clock lookup entries with a NULL
device ID and a "mtu2_fck" connection ID, the ARM SoCs use the device ID
only with a NULL connection ID. This works on legacy platforms but will
break on ARM with DT boot.

Fix the situation by using a connection ID of "fck" in the non-legacy
platform data case. Clock lookup entries will be renamed to use the
device ID as well as the connection ID as platforms get moved to new
platform data. The legacy code will eventually be dropped, leaving us
with device ID based clock lookup, compatible with DT boot.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 6dc9693bb3997cb324a2ffb39deaa72081a9bd0d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Add support for multiple channels per device
Laurent Pinchart [Tue, 4 Mar 2014 17:05:45 +0000 (18:05 +0100)]
clocksource: sh_mtu2: Add support for multiple channels per device

MTU2 hardware devices can support multiple channels, with global
registers and per-channel registers. The sh_mtu2 driver currently models
the hardware with one Linux device per channel. This model makes it
difficult to handle global registers in a clean way.

Add support for a new model that uses one Linux device per timer with
multiple channels per device. This requires changes to platform data,
add new channel configuration fields.

Support for the legacy model is kept and will be removed after all
platforms switch to the new model.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit faf3f4f8c805f5f8a786ba544c94bf3e01838388)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Hardcode MTU2 clock event rating to 200
Laurent Pinchart [Tue, 4 Mar 2014 14:19:41 +0000 (15:19 +0100)]
clocksource: sh_mtu2: Hardcode MTU2 clock event rating to 200

All boards use clock event ratings of 200 for the MTU2, hardcode it in
the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 207e21a9732a27f58843ccae1c9644f3a1636b66)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Set cpumask to cpu_possible_mask
Laurent Pinchart [Tue, 4 Mar 2014 14:22:19 +0000 (15:22 +0100)]
clocksource: sh_mtu2: Set cpumask to cpu_possible_mask

The MTU2 is not tied to CPU0, make it usable on any CPU.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 3cc950479891040366629247357512f1cc928da3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Replace hardcoded register values with macros
Laurent Pinchart [Tue, 4 Mar 2014 14:16:25 +0000 (15:16 +0100)]
clocksource: sh_mtu2: Replace hardcoded register values with macros

Define symbolic macros for all used registers bits.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit f992c2410bd31b7c80ba8cc8b989d91b9cac3c30)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Allocate channels dynamically
Laurent Pinchart [Tue, 4 Mar 2014 13:23:00 +0000 (14:23 +0100)]
clocksource: sh_mtu2: Allocate channels dynamically

This prepares the driver for multi-channel support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit c54ccb431ce6ce813bb850e8659991fc4c5bc6bc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Replace kmalloc + memset with kzalloc
Laurent Pinchart [Tue, 4 Mar 2014 13:10:55 +0000 (14:10 +0100)]
clocksource: sh_mtu2: Replace kmalloc + memset with kzalloc

One kzalloc a day keeps the bugs away.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 810c651369b343618d949826e0acd0df1b8b06eb)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Add index to struct sh_mtu2_channel
Laurent Pinchart [Tue, 4 Mar 2014 13:17:26 +0000 (14:17 +0100)]
clocksource: sh_mtu2: Add index to struct sh_mtu2_channel

Use the index as the timer start/stop bit and when printing messages to
identify the channel.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit d2b93177065fd8e1e18f4f42880326e0881ff457)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Add memory base to sh_mtu2_channel structure
Laurent Pinchart [Tue, 4 Mar 2014 13:04:24 +0000 (14:04 +0100)]
clocksource: sh_mtu2: Add memory base to sh_mtu2_channel structure

The channel memory base is channel-specific, add it to the channel
structure in preparation for support of multiple channels per device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit da90a1c67751a412499a9f5698c3bf0bf80f65a6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Constify name argument to sh_mtu2_register()
Laurent Pinchart [Tue, 4 Mar 2014 12:57:14 +0000 (13:57 +0100)]
clocksource: sh_mtu2: Constify name argument to sh_mtu2_register()

The name argument is assigned to const structure fields only, constify
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit aa83804af705731d2802b80fb4b94a79045d31a3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Split channel setup to separate function
Laurent Pinchart [Tue, 4 Mar 2014 12:11:23 +0000 (13:11 +0100)]
clocksource: sh_mtu2: Split channel setup to separate function

Move the channel setup code from sh_mtu2_setup to a new
sh_mtu2_setup_channel function and call it from sh_mtu2_setup.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 2e1a53265d550002fdd1658778854d56ae4cadc1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Rename struct sh_mtu2_priv to sh_mtu2_device
Laurent Pinchart [Tue, 4 Mar 2014 12:04:48 +0000 (13:04 +0100)]
clocksource: sh_mtu2: Rename struct sh_mtu2_priv to sh_mtu2_device

Channel data is private as well, rename priv to device to make the
distrinction between the core device and the channels clearer.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 7dad72de1b475d02935e5c79c218637b6c63108b)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Split channel fields from sh_mtu2_priv
Laurent Pinchart [Tue, 4 Mar 2014 11:58:30 +0000 (12:58 +0100)]
clocksource: sh_mtu2: Split channel fields from sh_mtu2_priv

Create a new sh_mtu2_channel structure to hold the channel-specific
fields in preparation for multiple channels per device support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 42752cc619c0ee619b56f86932ce42b00adb5052)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Turn sh_mtu2_priv fields into local variables
Laurent Pinchart [Tue, 4 Mar 2014 11:59:54 +0000 (12:59 +0100)]
clocksource: sh_mtu2: Turn sh_mtu2_priv fields into local variables

The rate and periodic fields are used in a single function only, as
local variables. Remove them from the structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit f92d62f53973466cccb25900c2597ff6df950d74)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Use request_irq() instead of setup_irq()
Laurent Pinchart [Mon, 17 Feb 2014 10:27:49 +0000 (11:27 +0100)]
clocksource: sh_mtu2: Use request_irq() instead of setup_irq()

The driver claims it needs to register an interrupt handler too early
for request_irq(). This might have been true in the past, but the only
meaningful difference between request_irq() and setup_irq() today is an
additional kzalloc() call in request_irq(). As the driver calls
kmalloc() itself we know that the slab allocator is available, we can
thus switch to request_irq().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 276bee05d8b72e98d530b55161e0a2131da99f58)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Remove unnecessary OOM messages
Jingoo Han [Thu, 22 May 2014 12:05:06 +0000 (14:05 +0200)]
clocksource: sh_cmt: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

[dlezcano] : refreshed against latest modifications: kmalloc -> kzalloc

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
(cherry picked from commit 0178f41d3d35b63ed25a066d90e7dda380018c06)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Request IRQ for clock event device only
Laurent Pinchart [Fri, 21 Feb 2014 00:24:47 +0000 (01:24 +0100)]
clocksource: sh_cmt: Request IRQ for clock event device only

Clock sources don't need an IRQ, request the IRQ only for channels used
as clock event devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit bfa76bb12f23ecf0c6d07c302f4571a6fe9bc3e3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Sort headers alphabetically
Laurent Pinchart [Wed, 12 Feb 2014 15:56:44 +0000 (16:56 +0100)]
clocksource: sh_cmt: Sort headers alphabetically

This helps locating duplicates and inserting new headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit e7a9bcc2372b0e62443569c63a369cfd528db4f4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Remove FSF mail address from GPL notice
Laurent Pinchart [Fri, 14 Feb 2014 00:25:50 +0000 (01:25 +0100)]
clocksource: sh_cmt: Remove FSF mail address from GPL notice

Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 1cd89c568c057a13ca11acf0eb3a78121513e2b6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Rename clock to "fck" in the non-legacy case
Laurent Pinchart [Thu, 13 Feb 2014 23:35:18 +0000 (00:35 +0100)]
clocksource: sh_cmt: Rename clock to "fck" in the non-legacy case

The sh_cmt driver gets the CMT functional clock using a connection ID of
"cmt_fck". While all SH SoCs create clock lookup entries with a NULL
device ID and a "cmt_fck" connection ID, the ARM SoCs use the device ID
only with a NULL connection ID. This works on legacy platforms but will
break on ARM with DT boot.

Fix the situation by using a connection ID of "fck" in the non-legacy
platform data case. Clock lookup entries will be renamed to use the
device ID as well as the connection ID as platforms get moved to new
platform data. The legacy code will eventually be dropped, leaving us
with device ID based clock lookup, compatible with DT boot.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 24b4e07df54b7bf7739fb3dd193f639a8f274ad6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Add support for multiple channels per device
Laurent Pinchart [Tue, 28 Jan 2014 11:36:48 +0000 (12:36 +0100)]
clocksource: sh_cmt: Add support for multiple channels per device

CMT hardware devices can support multiple channels, with global
registers and per-channel registers. The sh_cmt driver currently models
the hardware with one Linux device per channel. This model makes it
difficult to handle global registers in a clean way.

Add support for a new model that uses one Linux device per timer with
multiple channels per device. This requires changes to platform data,
add new channel configuration fields.

Support for the legacy model is kept and will be removed after all
platforms switch to the new model.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 81b3b2711072b6047d5f332cd8751a1c5c9a3fb2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Hardcode CMT clock source rating to 125
Laurent Pinchart [Wed, 19 Feb 2014 16:00:31 +0000 (17:00 +0100)]
clocksource: sh_cmt: Hardcode CMT clock source rating to 125

All boards use or should use a clock source rating of 125 for the CMT,
hardcode it in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit fb28a659813084365eced5c2876c6383da52e634)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Hardcode CMT clock event rating to 125
Laurent Pinchart [Wed, 19 Feb 2014 16:00:31 +0000 (17:00 +0100)]
clocksource: sh_cmt: Hardcode CMT clock event rating to 125

All boards use or should use a clock event rating of 125 for the CMT,
hardcode it in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit b7fcbb0f830e6cccc9d358c24f8463e5d8018649)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Set cpumask to cpu_possible_mask
Laurent Pinchart [Wed, 19 Feb 2014 15:19:44 +0000 (16:19 +0100)]
clocksource: sh_cmt: Set cpumask to cpu_possible_mask

The CMT is a global timer not restricted to a single CPU. It has a lower
rating than the TMU or ARM architected timer, but is still useful on
systems where the other timers are stopped during CPU sleep.

When multiple timers are available the timers core selects which timer
to use based on timer ratings.

On SMP systems where timer broadcasting is required, one dummy timer is
instantiated per CPU with a rating of 100. On those systems the CMT
timer has a rating of 80, which makes the dummy timer selected by
default on all CPUs. The CMT is then available, and will be used as a
broadcast timer.

On UP systems no dummy timer is instantiated. The CMT timer has a rating
of 125 on those systems and is used directly as a clock event device for
CPU0 without broadcasting.

The CMT rating shouldn't depend on whether we boot a UP or SMP system.
We can't raise the CMT rating to 125 on SMP systems. This would select
CMT as the clock event device for CPU0 as its rating is higher than the
dummy timer rating, and would leave the system without a broadcast
timer. We could instead lower the rating to 80 on all systems, but that
wouldn't reflect reality as ratings between 1 and 99 are documented as
"unfit for real use".

We should raise the rating above 99 and still have the CMT selected as a
broadcast timer. This can be done by changing the cpumask from
cpumask_of(0) to cpu_possible_mask. In that case the timer selection
logic will prefer the previously probed and already selected dummy timer
for all CPUs based on the fact that already selected per-cpu timers are
preferred over new global timers, regardless of their respective
ratings. This also better reflects reality, as the CMT is not tied to
the boot CPU.

Ideally the timer selection logic should realize that the CMT needs to
be used as a broadcast timer on SMP systems as no other broadcast timer
is available, regardless of the cpumask and rating.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit f1ebe1e47e1979393a8492bfe751176908a830ae)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Replace hardcoded register values with macros
Laurent Pinchart [Tue, 28 Jan 2014 23:33:08 +0000 (00:33 +0100)]
clocksource: sh_cmt: Replace hardcoded register values with macros

Define symbolic macros for all used registers bits.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit d14be99b7e3fe52bc9921caa30953d49f499f121)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>