Re: [v4,2/2] dt-bindings: watchdog: renesas-wdt: Add support for R7S9210

2018-09-15 Thread Guenter Roeck
On Mon, Sep 10, 2018 at 02:52:33PM -0500, Chris Brandt wrote:
> Document support for RZ/A2
> 
> Signed-off-by: Chris Brandt 

Reviewed-by: Guenter Roeck 

> ---
>  Documentation/devicetree/bindings/watchdog/renesas-wdt.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt 
> b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
> index 5d47a262474c..45a709dd0345 100644
> --- a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
> @@ -19,6 +19,7 @@ Required properties:
>- "renesas,r8a77990-wdt" (R-Car E3)
>- "renesas,r8a77995-wdt" (R-Car D3)
>- "renesas,r7s72100-wdt" (RZ/A1)
> +  - "renesas,r7s9210-wdt"  (RZ/A2)
>   The generic compatible string must be:
>- "renesas,rza-wdt" for RZ/A
>- "renesas,rcar-gen2-wdt" for R-Car Gen2 and RZ/G


Re: [v4,1/2] watchdog: rza_wdt: Support longer timeouts

2018-09-15 Thread Guenter Roeck
On Mon, Sep 10, 2018 at 02:52:32PM -0500, Chris Brandt wrote:
> The RZ/A2 watchdog timer extends the clock source options in order to
> allow for longer timeouts.
> 
> Signed-off-by: Chris Brandt 

Reviewed-by: Guenter Roeck 

> ---
> v4:
>  * Documented CKS_3BIT/CKS_4BIT better
>  * Changed 16384 and 4194304 into #define
>  * Removed rza_wdt.timeout
>  * Removed extra ( ) from DIV_ROUND_UP
>  * Removed check for counter value > 256
>  * Added set_timeout function
>  * Removed checking for new timeout value in ping function
>  * Removed unneeded 'else' case when checking .data in probe
> v3:
>  * Removed + 1 from DIV_ROUND_UP line
>  * resetting to 0 if time to big did not make as much sense are resetting
>to 256
> v2:
> * use DIV_ROUND_UP
> * use %u for pr_debug
> * use of_match data to determine the size of CKS register
> ---
>  drivers/watchdog/rza_wdt.c | 88 
> --
>  1 file changed, 70 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/watchdog/rza_wdt.c b/drivers/watchdog/rza_wdt.c
> index e618218d2374..aeca6b13c797 100644
> --- a/drivers/watchdog/rza_wdt.c
> +++ b/drivers/watchdog/rza_wdt.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -34,12 +35,45 @@
>  #define WRCSR_RSTE   BIT(6)
>  #define WRCSR_CLEAR_WOVF 0xA500  /* special value */
>  
> +/* The maximum CKS register setting value to get the longest timeout */
> +#define CKS_3BIT 0x7
> +#define CKS_4BIT 0xF
> +
> +#define DIVIDER_3BIT 16384   /* Clock divider when CKS = 0x7 */
> +#define DIVIDER_4BIT 4194304 /* Clock divider when CKS = 0xF */
> +
>  struct rza_wdt {
>   struct watchdog_device wdev;
>   void __iomem *base;
>   struct clk *clk;
> + u8 count;
> + u8 cks;
>  };
>  
> +static void rza_wdt_calc_timeout(struct rza_wdt *priv, int timeout)
> +{
> + unsigned long rate = clk_get_rate(priv->clk);
> + unsigned int ticks;
> +
> + if (priv->cks == CKS_4BIT) {
> + ticks = DIV_ROUND_UP(timeout * rate, DIVIDER_4BIT);
> +
> + /*
> +  * Since max_timeout was set in probe, we know that the timeout
> +  * value passed will never calculate to a tick value greater
> +  * than 256.
> +  */
> + priv->count = 256 - ticks;
> +
> + } else {
> + /* Start timer with longest timeout */
> + priv->count = 0;
> + }
> +
> + pr_debug("%s: timeout set to %u (WTCNT=%d)\n", __func__,
> +  timeout, priv->count);
> +}
> +
>  static int rza_wdt_start(struct watchdog_device *wdev)
>  {
>   struct rza_wdt *priv = watchdog_get_drvdata(wdev);
> @@ -51,13 +85,12 @@ static int rza_wdt_start(struct watchdog_device *wdev)
>   readb(priv->base + WRCSR);
>   writew(WRCSR_CLEAR_WOVF, priv->base + WRCSR);
>  
> - /*
> -  * Start timer with slowest clock source and reset option enabled.
> -  */
> + rza_wdt_calc_timeout(priv, wdev->timeout);
> +
>   writew(WRCSR_MAGIC | WRCSR_RSTE, priv->base + WRCSR);
> - writew(WTCNT_MAGIC | 0, priv->base + WTCNT);
> - writew(WTCSR_MAGIC | WTSCR_WT | WTSCR_TME | WTSCR_CKS(7),
> -priv->base + WTCSR);
> + writew(WTCNT_MAGIC | priv->count, priv->base + WTCNT);
> + writew(WTCSR_MAGIC | WTSCR_WT | WTSCR_TME |
> +WTSCR_CKS(priv->cks), priv->base + WTCSR);
>  
>   return 0;
>  }
> @@ -75,8 +108,17 @@ static int rza_wdt_ping(struct watchdog_device *wdev)
>  {
>   struct rza_wdt *priv = watchdog_get_drvdata(wdev);
>  
> - writew(WTCNT_MAGIC | 0, priv->base + WTCNT);
> + writew(WTCNT_MAGIC | priv->count, priv->base + WTCNT);
>  
> + pr_debug("%s: timeout = %u\n", __func__, wdev->timeout);
> +
> + return 0;
> +}
> +
> +static int rza_set_timeout(struct watchdog_device *wdev, unsigned int 
> timeout)
> +{
> + wdev->timeout = timeout;
> + rza_wdt_start(wdev);
>   return 0;
>  }
>  
> @@ -121,6 +163,7 @@ static const struct watchdog_ops rza_wdt_ops = {
>   .start = rza_wdt_start,
>   .stop = rza_wdt_stop,
>   .ping = rza_wdt_ping,
> + .set_timeout = rza_set_timeout,
>   .restart = rza_wdt_restart,
>  };
>  
> @@ -150,20 +193,28 @@ static int rza_wdt_probe(struct platform_device *pdev)
>   return -ENOENT;
>   }
>  
> - /* Assume slowest clock rate possible (CKS=7) */
> - rate /= 16384;
> -
>   priv->wdev.info = &rza_wdt_ident,
>   priv->wdev.ops = &rza_wdt_ops,
>   priv->wdev.parent = &pdev->dev;
>  
> - /*
> -  * Since the max possible timeout of our 8-bit count register is less
> -  * than a second, we must use max_hw_heartbeat_ms.
> -  */
> - priv->wdev.max_hw_heartbeat_ms = (1000 * U8_MAX) / rate;
> - dev_dbg(&pdev->dev, "max hw timeout of %dms\n",
> -  priv->wdev.max_hw_heartbeat_ms);
> + priv->cks = (unsigned int)of_device_get_match_

[GIT PULL FOR renesas-drivers] D3 and E3 HDMI output support

2018-09-15 Thread Laurent Pinchart
Hi Geert,

The following changes since commit 6e1637c91742570ff873433ed27227933b792af4:

  drm: rcar-du: Remove packed VYUY support (2018-09-15 17:28:34 +0300)

are available in the Git repository at:

  git://linuxtv.org/pinchartl/media.git for/renesas-drivers

for you to fetch changes up to d7e0cb47e1d06d3033812281fe98528d1713ec16:

  Merge tag 'drm-du-dt-lvds-pll-v1-20180915' into for/renesas-drivers 
(2018-09-15 17:38:05 +0300)

Please note that the for/renesas-drivers branch is a merge of a code and a DT 
branch (available under the drm-du-lvds-pll-v1-20180915 and drm-du-dt-lvds-
pll-v1-20180915 tags respectively). Those two branches have different bases 
(drm-next from Dave's tree and devel from Simon's tree respectively), I've 
thus edited the diffstat below manually.


Kieran Bingham (1):
  arm64: dts: renesas: r8a77995: Add LVDS support

Laurent Pinchart (14):
  arm64: dts: renesas: r8a77990: Add display output support
  arm64: dts: renesas: r8a77990: ebisu: Enable VGA and HDMI outputs
  pinctrl: sh-pfc: r8a77990: Add DU pins, groups and function
  dt-bindings: display: renesas: du: Document r8a77990 bindings
  dt-bindings: display: renesas: lvds: Document r8a77990 bindings
  dt-bindings: display: renesas: lvds: Add EXTAL and DU_DOTCLKIN clocks
  drm: bridge: thc63: Restrict modes based on hardware operating frequency
  drm: rcar-du: lvds: D3/E3 support
  drm: rcar-du: Perform the initial CRTC setup from rcar_du_crtc_get()
  drm: rcar-du: Use LVDS PLL clock as dot clock when possible
  drm: rcar-du: Enable configurable DPAD0 routing on Gen3
  drm: rcar-du: Cache DSYSR value to ensure known initial value
  drm: rcar-du: Don't use TV sync mode when not supported by the hardware
  Merge tag 'drm-du-dt-lvds-pll-v1-20180915' into for/renesas-drivers

Ulrich Hecht (2):
  arm64: dts: renesas: r8a77995: draak: Enable HDMI display output
  drm: rcar-du: Add r8a77990 and r8a77995 device support

 Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt |   13 
 Documentation/devicetree/bindings/display/renesas,du.txt  |2 
 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts|  166 
 arch/arm64/boot/dts/renesas/r8a77990.dtsi |  167 
 arch/arm64/boot/dts/renesas/r8a77995-draak.dts|   98 ++
 arch/arm64/boot/dts/renesas/r8a77995.dtsi |   56 +
 drivers/gpu/drm/bridge/thc63lvd1024.c |   18 
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c|  136 ++-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h|5 
 drivers/gpu/drm/rcar-du/rcar_du_drv.c |   63 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.h |3 
 drivers/gpu/drm/rcar-du/rcar_du_group.c   |   88 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |   12 
 drivers/gpu/drm/rcar-du/rcar_lvds.c   |  355 +++-
 drivers/gpu/drm/rcar-du/rcar_lvds_regs.h  |   43 +
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c |  110 +++
 16 files changed, 1187 insertions(+), 148 deletions(-)

-- 
Regards,

Laurent Pinchart