Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-12-01 Thread Chanwoo Choi
Hi Felipe,

On 2016년 11월 30일 19:36, Felipe Balbi wrote:
> 
> Hi,
> 
> Chanwoo Choi  writes:
>> This patch uses the resource-managed extcon API for 
>> extcon_register_notifier()
>> and replaces the deprecated extcon API as following:
>> - extcon_get_cable_state_() -> extcon_get_state()
>>
>> Signed-off-by: Chanwoo Choi 
> 
> Acked-by: Felipe Balbi 
> 

Thanks for your review.

Each patch has no any dependency among patches.
So, If possible, could you pick the patch6/8/9/10/11/12 on your tree?

-- 
Best Regards,
Chanwoo Choi


Re: [PATCH 05/12] usb: chipdata: Replace the extcon API

2016-12-01 Thread Peter Chen
On Wed, Nov 30, 2016 at 02:57:33PM +0900, Chanwoo Choi wrote:
> This patch uses the resource-managed extcon API for extcon_register_notifier()
> and replaces the deprecated extcon API as following:
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/usb/chipidea/core.c | 30 ++
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 69426e644d17..a5b44963eaea 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev,
>   cable->edev = ext_vbus;
>  
>   if (!IS_ERR(ext_vbus)) {
> - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB);
> + ret = extcon_get_state(cable->edev, EXTCON_USB);
>   if (ret)
>   cable->state = true;
>   else
> @@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev,
>   cable->edev = ext_id;
>  
>   if (!IS_ERR(ext_id)) {
> - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST);
> + ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
>   if (ret)
>   cable->state = false;
>   else
> @@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   id = &ci->platdata->id_extcon;
>   id->ci = ci;
>   if (!IS_ERR(id->edev)) {
> - ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST,
> -&id->nb);
> + ret = devm_extcon_register_notifier(ci->dev, id->edev,
> + EXTCON_USB_HOST, &id->nb);
>   if (ret < 0) {
>   dev_err(ci->dev, "register ID failed\n");
>   return ret;
> @@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   vbus = &ci->platdata->vbus_extcon;
>   vbus->ci = ci;
>   if (!IS_ERR(vbus->edev)) {
> - ret = extcon_register_notifier(vbus->edev, EXTCON_USB,
> -&vbus->nb);
> + ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
> + EXTCON_USB, &vbus->nb);
>   if (ret < 0) {
> - extcon_unregister_notifier(id->edev, EXTCON_USB_HOST,
> -&id->nb);
>   dev_err(ci->dev, "register VBUS failed\n");
>   return ret;
>   }
> @@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   return 0;
>  }
>  
> -static void ci_extcon_unregister(struct ci_hdrc *ci)
> -{
> - struct ci_hdrc_cable *cable;
> -
> - cable = &ci->platdata->id_extcon;
> - if (!IS_ERR(cable->edev))
> - extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST,
> -&cable->nb);
> -
> - cable = &ci->platdata->vbus_extcon;
> - if (!IS_ERR(cable->edev))
> - extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb);
> -}
> -
>  static DEFINE_IDA(ci_ida);
>  
>  struct platform_device *ci_hdrc_add_device(struct device *dev,
> @@ -1053,7 +1037,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>   if (!ret)
>   return 0;
>  
> - ci_extcon_unregister(ci);
>  stop:
>   ci_role_destroy(ci);
>  deinit_phy:
> @@ -1073,7 +1056,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
>   }
>  
>   dbg_remove_files(ci);
> - ci_extcon_unregister(ci);
>   ci_role_destroy(ci);
>   ci_hdrc_enter_lpm(ci, true);
>   ci_usb_phy_exit(ci);
> -- 

Acked-by: Peter Chen 

-- 

Best Regards,
Peter Chen


Re: [RFC] mmc: tmio: use SDIO master interrupt bit only when allowed

2016-12-01 Thread Yasushi SHOJI
On Fri, 02 Dec 2016 00:08:13 +0900,
Wolfram Sang wrote:
> 
> The master bit to enable SDIO interrupts can only be accessed if
> SCLKDIVEN bit allows that. However, the core uses the SDIO enable
> callback at times when SCLKDIVEN forbids the change. This leads to
> "timeout waiting for SD bus idle" messages.
> 
> We now activate the master bit in probe once if SDIO is supported. IRQ
> en-/disabling will be done now by the individual IRQ enablement bits
> only.
> 
> Signed-off-by: Wolfram Sang 
> ---
> 
> Compile tested only, due to no testcase.

We've reviewed and tested your patch.  It looks good and works fine
under the condition we had.

Reviewed-by: Yasushi SHOJI 

Cc: sta...@vger.kernel.org if other boards with the same controller
can confirm.

Thanks you Wolfram for your quick response and the rfc.
-- 
   yashi


[PATCH v2] pinctrl: sh-pfc: r8a7791: Add ADI pinconf support

2016-12-01 Thread Jacopo Mondi
Add pin configuration support for Gyro-ADC, named ADI on r8a7791 SoC.

The Gyro-ADC supports three different configurations:
a single ADC (adi and adi_b groups), 2 ADCs selectable through a single
channel select signal (adi_chsel1 and adi_chsel1_b groups), up to 4 ADCs
through 2 channel select signals (adi_chsel2 and adi_chsel2_b groups)
and up to 8 ADCs through 3 channel select signals (adi_chsel3 and
adi_chsel3_b groups)

Signed-off-by: Jacopo Mondi 
---
Compiled only, not tested with an actual ADC.

For reference only, these are the changes introduced by Geert's private
review of first sketch of this patch:
* separate ADI chsel in 3 overlapping groups:
  the user can now select how many pins to assign to channel selection
  function.

v1 -> v2:
* let the user freely select the single CHS line to use.
  This requires the configuration to match the ADI mode in use, but
  allows users to select CHS1 or CHS2 lines alone, and dedicate other
  pins to other functions.

---
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 86 
 1 file changed, 86 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 7ca37c3..75c9882 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -1691,6 +1691,72 @@ static const struct sh_pfc_pin pinmux_pins[] = {
PINMUX_GPIO_GP_ALL(),
 };
 
+/* - ADI  
*/
+static const unsigned int adi_common_pins[] = {
+   /* ADIDATA, ADICS/SAMP, ADICLK */
+   RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25), RCAR_GP_PIN(6, 26),
+};
+static const unsigned int adi_common_mux[] = {
+   /* ADIDATA, ADICS/SAMP, ADICLK */
+   ADIDATA_MARK, ADICS_SAMP_MARK, ADICLK_MARK,
+};
+static const unsigned int adi_chsel0_pins[] = {
+   /* ADICHS 0 */
+   RCAR_GP_PIN(6, 27),
+};
+static const unsigned int adi_chsel0_mux[] = {
+   /* ADICHS 0 */
+   ADICHS0_MARK,
+};
+static const unsigned int adi_chsel1_pins[] = {
+   /* ADICHS 1 */
+   RCAR_GP_PIN(6, 28),
+};
+static const unsigned int adi_chsel1_mux[] = {
+   /* ADICHS 1 */
+   ADICHS1_MARK,
+};
+static const unsigned int adi_chsel2_pins[] = {
+   /* ADICHS 2 */
+   RCAR_GP_PIN(6, 29),
+};
+static const unsigned int adi_chsel2_mux[] = {
+   /* ADICHS 2 */
+   ADICHS2_MARK,
+};
+static const unsigned int adi_common_b_pins[] = {
+   /* ADIDATA B, ADICS/SAMP B, ADICLK B */
+   RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 26), RCAR_GP_PIN(5, 27),
+};
+static const unsigned int adi_common_b_mux[] = {
+   /* ADIDATA B, ADICS/SAMP B, ADICLK B */
+   ADIDATA_B_MARK, ADICS_SAMP_B_MARK, ADICLK_B_MARK,
+};
+static const unsigned int adi_chsel0_b_pins[] = {
+   /* ADICHS 0 B */
+   RCAR_GP_PIN(5, 28),
+};
+static const unsigned int adi_chsel0_b_mux[] = {
+   /* ADICHS 0 B */
+   ADICHS0_B_MARK,
+};
+static const unsigned int adi_chsel1_b_pins[] = {
+   /* ADICHS 1 B */
+   RCAR_GP_PIN(5, 29),
+};
+static const unsigned int adi_chsel1_b_mux[] = {
+   /* ADICHS 1 B */
+   ADICHS1_B_MARK,
+};
+static const unsigned int adi_chsel2_b_pins[] = {
+   /* ADICHS 2 B */
+   RCAR_GP_PIN(5, 30),
+};
+static const unsigned int adi_chsel2_b_mux[] = {
+   /* ADICHS 2 B */
+   ADICHS2_B_MARK,
+};
+
 /* - Audio Clock  
*/
 static const unsigned int audio_clk_a_pins[] = {
/* CLK */
@@ -4343,6 +4409,14 @@ static const unsigned int vin2_clk_mux[] = {
 };
 
 static const struct sh_pfc_pin_group pinmux_groups[] = {
+   SH_PFC_PIN_GROUP(adi_common),
+   SH_PFC_PIN_GROUP(adi_chsel0),
+   SH_PFC_PIN_GROUP(adi_chsel1),
+   SH_PFC_PIN_GROUP(adi_chsel2),
+   SH_PFC_PIN_GROUP(adi_common_b),
+   SH_PFC_PIN_GROUP(adi_chsel0_b),
+   SH_PFC_PIN_GROUP(adi_chsel1_b),
+   SH_PFC_PIN_GROUP(adi_chsel2_b),
SH_PFC_PIN_GROUP(audio_clk_a),
SH_PFC_PIN_GROUP(audio_clk_b),
SH_PFC_PIN_GROUP(audio_clk_b_b),
@@ -4687,6 +4761,17 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(vin2_clk),
 };
 
+static const char * const adi_groups[] = {
+   "adi_common",
+   "adi_chsel0",
+   "adi_chsel1",
+   "adi_chsel2",
+   "adi_common_b",
+   "adi_chsel0_b",
+   "adi_chsel1_b",
+   "adi_chsel2_b",
+};
+
 static const char * const audio_clk_groups[] = {
"audio_clk_a",
"audio_clk_b",
@@ -5192,6 +5277,7 @@ static const char * const vin2_groups[] = {
 };
 
 static const struct sh_pfc_function pinmux_functions[] = {
+   SH_PFC_FUNCTION(adi),
SH_PFC_FUNCTION(audio_clk),
SH_PFC_FUNCTION(avb),
SH_PFC_FUNCTION(can0),
-- 
2.7.4



[PATCH 11/22] drm: bridge: dw-hdmi: Refactor hdmi_phy_configure resolution parameter

2016-12-01 Thread Laurent Pinchart
From: Kieran Bingham 

The current code hard codes the call of hdmi_phy_configure() to be 8bpp
and provides extraneous error checking to verify that this hardcoded
value is correct.

Simplify the passing of the data by setting the parameter to be of the
enum type it represents rather than converting and then verifying the
value. This will allow the compiler to check the value is acceptable
based on the type, and remove the dead code that we currently have.

Signed-off-by: Kieran Bingham 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 20 ++--
 include/drm/bridge/dw_hdmi.h |  2 +-
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 107fea49c4c6..074ceb1e4897 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -931,30 +931,14 @@ static void dw_hdmi_phy_sel_interface_control(struct 
dw_hdmi *hdmi, u8 enable)
 }
 
 static int hdmi_phy_configure(struct dw_hdmi *hdmi,
- unsigned char res, int cscon)
+ enum dw_hdmi_resolution res_idx, int cscon)
 {
-   unsigned res_idx;
u8 val, msec;
const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg;
const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr;
const struct dw_hdmi_phy_config *phy_config = pdata->phy_config;
 
-   switch (res) {
-   case 0: /* color resolution 0 is 8 bit colour depth */
-   case 8:
-   res_idx = DW_HDMI_RES_8;
-   break;
-   case 10:
-   res_idx = DW_HDMI_RES_10;
-   break;
-   case 12:
-   res_idx = DW_HDMI_RES_12;
-   break;
-   default:
-   return -EINVAL;
-   }
-
/* PLL/MPLL Cfg - always match on final entry */
for (; mpll_config->mpixelclock != ~0UL; mpll_config++)
if (hdmi->hdmi_data.video_mode.mpixelclock <=
@@ -1068,7 +1052,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi)
dw_hdmi_phy_enable_powerdown(hdmi, true);
 
/* Enable CSC */
-   ret = hdmi_phy_configure(hdmi, 8, cscon);
+   ret = hdmi_phy_configure(hdmi, DW_HDMI_RES_8, cscon);
if (ret)
return ret;
}
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 3bb22a849830..e551b457c100 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -14,7 +14,7 @@
 
 struct dw_hdmi;
 
-enum {
+enum dw_hdmi_resolution {
DW_HDMI_RES_8,
DW_HDMI_RES_10,
DW_HDMI_RES_12,
-- 
Regards,

Laurent Pinchart



[PATCH 17/22] drm: rcar-du: Skip disabled outputs

2016-12-01 Thread Laurent Pinchart
When a DT node connected to a DU output is disabled no bridge will ever
be instantiated for it. Skip the output in that case.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index aa84689043ae..7a6bd8bdba05 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -384,6 +384,13 @@ static int rcar_du_encoders_init_one(struct rcar_du_device 
*rcdu,
return -ENODEV;
}
 
+   if (!of_device_is_available(entity)) {
+   dev_dbg(rcdu->dev,
+   "connected entity %s is disabled, skipping\n",
+   entity->full_name);
+   return -ENODEV;
+   }
+
entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
 
for_each_endpoint_of_node(entity, ep_node) {
-- 
Regards,

Laurent Pinchart



[PATCH 14/22] dt-bindings: display: dw-hdmi: Clean up DT bindings documentation

2016-12-01 Thread Laurent Pinchart
Make it clear that the core bridge/dw_hdmi.txt document isn't a device
tree binding by itself but is meant to be referenced by platform device
tree bindings, and update the Rockchip and Freescale DWC HDMI TX
bindings to reference it.

Signed-off-by: Laurent Pinchart 
---
 .../devicetree/bindings/display/bridge/dw_hdmi.txt | 85 +-
 .../devicetree/bindings/display/imx/hdmi.txt   | 51 +++--
 .../bindings/display/rockchip/dw_hdmi-rockchip.txt | 43 +++
 3 files changed, 91 insertions(+), 88 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
index 5e9a84d6e5f1..33bf981fbe33 100644
--- a/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
+++ b/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
@@ -1,52 +1,33 @@
-DesignWare HDMI bridge bindings
-
-Required properties:
-- compatible: platform specific such as:
-   * "snps,dw-hdmi-tx"
-   * "fsl,imx6q-hdmi"
-   * "fsl,imx6dl-hdmi"
-   * "rockchip,rk3288-dw-hdmi"
-- reg: Physical base address and length of the controller's registers.
-- interrupts: The HDMI interrupt number
-- clocks, clock-names : must have the phandles to the HDMI iahb and isfr 
clocks,
-  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
-  the clocks are soc specific, the clock-names should be "iahb", "isfr"
--port@[X]: SoC specific port nodes with endpoint definitions as defined
-   in Documentation/devicetree/bindings/media/video-interfaces.txt,
-   please refer to the SoC specific binding document:
-* Documentation/devicetree/bindings/display/imx/hdmi.txt
-* Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt
-
-Optional properties
-- reg-io-width: the width of the reg:1,4, default set to 1 if not present
-- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing,
-  if the property is omitted, a functionally reduced I2C bus
-  controller on DW HDMI is probed
-- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
-
-Example:
-   hdmi: hdmi@012 {
-   compatible = "fsl,imx6q-hdmi";
-   reg = <0x0012 0x9000>;
-   interrupts = <0 115 0x04>;
-   gpr = <&gpr>;
-   clocks = <&clks 123>, <&clks 124>;
-   clock-names = "iahb", "isfr";
-   ddc-i2c-bus = <&i2c2>;
-
-   port@0 {
-   reg = <0>;
-
-   hdmi_mux_0: endpoint {
-   remote-endpoint = <&ipu1_di0_hdmi>;
-   };
-   };
-
-   port@1 {
-   reg = <1>;
-
-   hdmi_mux_1: endpoint {
-   remote-endpoint = <&ipu1_di1_hdmi>;
-   };
-   };
-   };
+Synopsys DesignWare HDMI TX Encoder
+===
+
+This document defines device tree properties for the Synopsys DesignWare HDMI
+TX Encoder (DWC HDMI TX). It doesn't constitue a device tree binding
+specification by itself but is meant to be referenced by platform-specific
+device tree bindings.
+
+When referenced from platform device tree bindings the properties defined in
+this document are defined as follows. The platform device tree bindings are
+responsible for defining whether each property is required or optional.
+
+- reg: Memory mapped base address and length of the DWC HDMI TX registers.
+
+- reg-io-width: Width of the registers specified by the reg property. The
+  value is expressed in bytes and must be equal to 1 or 4 if specified. The
+  register width defaults to 1 if the property is not present.
+
+- interrupts: Reference to the DWC HDMI TX interrupt.
+
+- clocks: References to all the clocks specified in the clock-names property
+  as specified in Documentation/devicetree/bindings/clock/clock-bindings.txt.
+
+- clock-names: The DWC HDMI TX uses the following clocks.
+
+  - "iahb" is the bus clock for either AHB and APB (mandatory).
+  - "isfr" is the internal register configuration clock (mandatory).
+  - "cec" is the HDMI CEC controller main clock (optional).
+
+- ports: The connectivity of the DWC HDMI TX with the rest of the system is
+  expressed in using ports as specified in the device graph bindings defined
+  in Documentation/devicetree/bindings/graph.txt. The numbering of the ports
+  is platform-specific.
diff --git a/Documentation/devicetree/bindings/display/imx/hdmi.txt 
b/Documentation/devicetree/bindings/display/imx/hdmi.txt
index 1b756cf9afb0..66a8f86e5d12 100644
--- a/Documentation/devicetree/bindings/display/imx/hdmi.txt
+++ b/Documentation/devicetree/bindings/display/imx/hdmi.txt
@@ -1,29 +1,36 @@
-Device-Tree bindings for HDMI Transmitter
+Freescale i.MX6 DWC HDMI TX Encoder
+===
 
-HDMI Transmitter
-
+The HDMI transmitter is a Synopsys DesignWare

[PATCH 01/22] drm: bridge: dw-hdmi: Merge __hdmi_phy_i2c_write and hdmi_phy_i2c_write

2016-12-01 Thread Laurent Pinchart
The latter is just an int wrapper around the former void function that
unconditionally returns 0. As the return value is never checked, merge
the two functions into one.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index f5009ae39b89..a6685502571e 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -868,7 +868,7 @@ static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, 
int msec)
return true;
 }
 
-static void __hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
+static void hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
 unsigned char addr)
 {
hdmi_writeb(hdmi, 0xFF, HDMI_IH_I2CMPHY_STAT0);
@@ -882,13 +882,6 @@ static void __hdmi_phy_i2c_write(struct dw_hdmi *hdmi, 
unsigned short data,
hdmi_phy_wait_i2c_done(hdmi, 1000);
 }
 
-static int hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
- unsigned char addr)
-{
-   __hdmi_phy_i2c_write(hdmi, data, addr);
-   return 0;
-}
-
 static void dw_hdmi_phy_enable_powerdown(struct dw_hdmi *hdmi, bool enable)
 {
hdmi_mask_writeb(hdmi, !enable, HDMI_PHY_CONF0,
-- 
Regards,

Laurent Pinchart



[PATCH 18/22] drm: rcar-du: Add DPLL support

2016-12-01 Thread Laurent Pinchart
From: Koji Matsuoka 

The implementation hardcodes a workaround for the H3 ES1.x SoC
regardless of the SoC revision, as the workaround can be safely applied
on all devices in the Gen3 family without any side effect.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Ulrich Hecht 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 81 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.h  |  1 +
 drivers/gpu/drm/rcar-du/rcar_du_regs.h | 23 ++
 4 files changed, 105 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index a2ec6d8796a0..cec20abd61aa 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -106,9 +106,62 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
  * Hardware Setup
  */
 
+struct dpll_info {
+   unsigned int output;
+   unsigned int fdpll;
+   unsigned int n;
+   unsigned int m;
+};
+
+static void rcar_du_dpll_divider(struct rcar_du_crtc *rcrtc,
+struct dpll_info *dpll,
+unsigned long input,
+unsigned long target)
+{
+   unsigned long best_diff = (unsigned long)-1;
+   unsigned long diff;
+   unsigned int fdpll;
+   unsigned int m;
+   unsigned int n;
+
+   for (n = 39; n < 120; n++) {
+   for (m = 0; m < 4; m++) {
+   for (fdpll = 1; fdpll < 32; fdpll++) {
+   unsigned long output;
+
+   /* 1/2 (FRQSEL=1) for duty rate 50% */
+   output = input * (n + 1) / (m + 1)
+  / (fdpll + 1) / 2;
+
+   if (output >= 4)
+   continue;
+
+   diff = abs((long)output - (long)target);
+   if (best_diff > diff) {
+   best_diff = diff;
+   dpll->n = n;
+   dpll->m = m;
+   dpll->fdpll = fdpll;
+   dpll->output = output;
+   }
+
+   if (diff == 0)
+   goto done;
+   }
+   }
+   }
+
+done:
+   dev_dbg(rcrtc->group->dev->dev,
+   "output:%u, fdpll:%u, n:%u, m:%u, diff:%lu\n",
+dpll->output, dpll->fdpll, dpll->n, dpll->m,
+best_diff);
+}
+
 static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 {
const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
+   struct rcar_du_device *rcdu = rcrtc->group->dev;
unsigned long mode_clock = mode->clock * 1000;
unsigned long clk;
u32 value;
@@ -124,12 +177,18 @@ static void rcar_du_crtc_set_display_timing(struct 
rcar_du_crtc *rcrtc)
escr = div | ESCR_DCLKSEL_CLKS;
 
if (rcrtc->extclock) {
+   struct dpll_info dpll = { 0 };
unsigned long extclk;
unsigned long extrate;
unsigned long rate;
u32 extdiv;
 
extclk = clk_get_rate(rcrtc->extclock);
+   if (rcdu->info->dpll_ch & (1 << rcrtc->index)) {
+   rcar_du_dpll_divider(rcrtc, &dpll, extclk, mode_clock);
+   extclk = dpll.output;
+   }
+
extdiv = DIV_ROUND_CLOSEST(extclk, mode_clock);
extdiv = clamp(extdiv, 1U, 64U) - 1;
 
@@ -140,7 +199,27 @@ static void rcar_du_crtc_set_display_timing(struct 
rcar_du_crtc *rcrtc)
abs((long)rate - (long)mode_clock)) {
dev_dbg(rcrtc->group->dev->dev,
"crtc%u: using external clock\n", rcrtc->index);
-   escr = extdiv | ESCR_DCLKSEL_DCLKIN;
+
+   if (rcdu->info->dpll_ch & (1 << rcrtc->index)) {
+   u32 dpllcr = DPLLCR_CODE | DPLLCR_CLKE
+  | DPLLCR_FDPLL(dpll.fdpll)
+  | DPLLCR_N(dpll.n) | DPLLCR_M(dpll.m)
+  | DPLLCR_STBY;
+
+   if (rcrtc->index == 1)
+   dpllcr |= DPLLCR_PLCS1
+  |  DPLLCR_INCS_DOTCLKIN1;
+   else
+   dpllcr |= DPLLCR_PLCS0
+  |  DPLLCR_INCS_DOTCLKIN0;
+
+   rcar_du_group_write(rcrtc->group, DPLLCR,
+  

[PATCH 12/22] drm: bridge: dw-hdmi: Abstract the platform PHY configuration

2016-12-01 Thread Laurent Pinchart
From: Kieran Bingham 

Platforms implement the dw-hdmi with a separate PHY entity. It is
configured over it's own I2C bus. To allow for different PHY's to be
configured from the dw-hdmi driver, abstract the actual programming of
the PHY to its own functions, as configured by the platform.

Signed-off-by: Kieran Bingham 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c| 79 ++---
 drivers/gpu/drm/imx/dw_hdmi-imx.c   |  2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  1 +
 include/drm/bridge/dw_hdmi.h| 12 +
 4 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 074ceb1e4897..06a44a2cdf3b 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -867,8 +867,8 @@ static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, 
int msec)
return true;
 }
 
-static void hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
-unsigned char addr)
+void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
+  unsigned char addr)
 {
hdmi_writeb(hdmi, 0xFF, HDMI_IH_I2CMPHY_STAT0);
hdmi_writeb(hdmi, addr, HDMI_PHY_I2CM_ADDRESS_ADDR);
@@ -880,6 +880,7 @@ static void hdmi_phy_i2c_write(struct dw_hdmi *hdmi, 
unsigned short data,
HDMI_PHY_I2CM_OPERATION_ADDR);
hdmi_phy_wait_i2c_done(hdmi, 1000);
 }
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
 
 static void dw_hdmi_phy_enable_powerdown(struct dw_hdmi *hdmi, bool enable)
 {
@@ -930,38 +931,61 @@ static void dw_hdmi_phy_sel_interface_control(struct 
dw_hdmi *hdmi, u8 enable)
 HDMI_PHY_CONF0_SELDIPIF_MASK);
 }
 
-static int hdmi_phy_configure(struct dw_hdmi *hdmi,
- enum dw_hdmi_resolution res_idx, int cscon)
+int dw_hdmi_phy_configure_synopsys(struct dw_hdmi *hdmi,
+  const struct dw_hdmi_plat_data *pdata,
+  unsigned long mpixelclock,
+  enum dw_hdmi_resolution resolution)
+
 {
-   u8 val, msec;
-   const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
const struct dw_hdmi_mpll_config *mpll_config = pdata->mpll_cfg;
const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr;
const struct dw_hdmi_phy_config *phy_config = pdata->phy_config;
 
/* PLL/MPLL Cfg - always match on final entry */
for (; mpll_config->mpixelclock != ~0UL; mpll_config++)
-   if (hdmi->hdmi_data.video_mode.mpixelclock <=
-   mpll_config->mpixelclock)
+   if (mpixelclock <= mpll_config->mpixelclock)
break;
 
for (; curr_ctrl->mpixelclock != ~0UL; curr_ctrl++)
-   if (hdmi->hdmi_data.video_mode.mpixelclock <=
-   curr_ctrl->mpixelclock)
+   if (mpixelclock <= curr_ctrl->mpixelclock)
break;
 
for (; phy_config->mpixelclock != ~0UL; phy_config++)
-   if (hdmi->hdmi_data.video_mode.mpixelclock <=
-   phy_config->mpixelclock)
+   if (mpixelclock <= phy_config->mpixelclock)
break;
 
if (mpll_config->mpixelclock == ~0UL ||
curr_ctrl->mpixelclock == ~0UL ||
-   phy_config->mpixelclock == ~0UL) {
-   dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
-   hdmi->hdmi_data.video_mode.mpixelclock);
+   phy_config->mpixelclock == ~0UL)
return -EINVAL;
-   }
+
+   dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[resolution].cpce, 0x06);
+   dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[resolution].gmp, 0x15);
+
+   /* CURRCTRL */
+   dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[resolution], 0x10);
+
+   dw_hdmi_phy_i2c_write(hdmi, 0x, 0x13); /* PLLPHBYCTRL */
+   dw_hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
+
+   dw_hdmi_phy_i2c_write(hdmi, phy_config->term, 0x19); /* TXTERM */
+   dw_hdmi_phy_i2c_write(hdmi, phy_config->sym_ctr, 0x09); /* CKSYMTXCTRL 
*/
+   dw_hdmi_phy_i2c_write(hdmi, phy_config->vlev_ctr, 0x0E); /* VLEVCTRL */
+
+   /* REMOVE CLK TERM */
+   dw_hdmi_phy_i2c_write(hdmi, 0x8000, 0x05); /* CKCALCTRL */
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_configure_synopsys);
+
+static int hdmi_phy_configure(struct dw_hdmi *hdmi,
+ enum dw_hdmi_resolution resolution, int cscon)
+{
+   const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
+   unsigned long mpixelclock = hdmi->hdmi_data.video_mode.mpixelclock;
+   u8 val, msec;
+   int ret;
 
/* Enable csc path */
if (cscon)
@@ -988,21 +1012,14 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi,
HDMI_PHY_I2CM_SLAVE_ADDR

[PATCH 00/22] R-Car Gen3 HDMI output support

2016-12-01 Thread Laurent Pinchart
Hello,

This patch series implements support for the HDMI output on Renesas R-Car Gen3
SoCs, and more specifically on the R-Car H3.

R-Car Gen3 SoCs include one or multiple Synopsys DWC HDMI TX controllers. The
series thus starts with 13 cleanup or feature patches for the dw-hdmi driver.
Patches 01/22 to 05/22 are small miscellaneous cleanups. Patch 06/22 fixes a
crash when the HPD interrupt is generated before the bridge gets attached to a
DRM device.

Patch 07/22 then starts refactoring the API towards platform glue by moving
common I/O and clock resource allocation to common code. Patches 08/22 and
09/22 continue by moving connector creation to the bridge attach operation to
comply with the DRM bridge API. Patch 10/22 implements a new API for platform
glue to register the bridge with the DRM core, for platform that doesn't use
the component framework. Patches 11/22 to 13/22 finally abstract PHY setup to
allow platforms to implement configuration for custom PHYs.

The next three patches add glue code for the DWC HDMI on Renesas R-Car Gen3
platforms. Patch 14/22 rework the DWC HDMI DT bindings to make them more
modular, and patch 15/22 makes use of them to document the R-Car Gen DWC HDMI
TX DT bindings. Patch 16/22 then implements the platform glue code.

The next three patches implement support for the R8A7795 HDMI outputs in the
R-Car DU driver. Patch 17/22 fixes a bug that makes the driver defer probe
forever if an encoder is disabled. Patch 18/22 implement DPLL support to
generate more precise clocks required by the HDMI controller, and patch 19/22
then enables the two HDMI output on the R-Car H3 SoC.

The last three patches enable the HDMI outputs on the H3 Salvator-X board by
adding the HDMI encoders to the R-Car H3 DT (20/22), adding HDMI connectors
and enabling the encoders (21/22) and adding the external dot clocks (22/22).

The code has been tested on a Renesas Salvator-X H3 board, and modifications
to the dw-hdmi Freescale and Rockchip platform glues have been compile-tested.

More improvements to the dw-hdmi driver would be beneficial. The PHY
modularization is based on the limited understanding of the HDMI PHYs used on
the three supported platforms and will possibly be enhanced later when adding
support for more platforms. The DT bindings would also benefit from a
standardized definition of the ports, and the reg-io-width property could
possibly be deprecated in favour of encoding the information in platform glue
code. The patch series is however big enough as is to be submitted for review
and merge before the dw-hdmi driver achieves perfection.

Kieran Bingham (4):
  drm: bridge: dw-hdmi: Remove unused function parameter
  drm: bridge: dw-hdmi: Refactor hdmi_phy_configure resolution parameter
  drm: bridge: dw-hdmi: Abstract the platform PHY configuration
  drm: bridge: dw-hdmi: Replace device type with platform quirks

Koji Matsuoka (4):
  drm: rcar-du: Add Gen3 HDMI encoder support
  drm: rcar-du: Add DPLL support
  drm: rcar-du: Add HDMI outputs to R8A7795 device description
  arm64: dts: r8a7795: salvator-x: Enable HDMI outputs

Laurent Pinchart (13):
  drm: bridge: dw-hdmi: Merge __hdmi_phy_i2c_write and
hdmi_phy_i2c_write
  drm: bridge: dw-hdmi: Remove unneeded arguments to bind/unbind
functions
  drm: bridge: dw-hdmi: Embed drm_bridge in struct dw_hdmi
  drm: bridge: dw-hdmi: Remove encoder field from struct dw_hdmi
  drm: bridge: dw-hdmi: Don't forward HPD events to DRM core before
attach
  drm: bridge: dw-hdmi: Move IRQ and IO resource allocation to common
code
  drm: bridge: dw-hdmi: Reorder functions to prepare for next commit
  drm: bridge: dw-hdmi: Create connector in the bridge attach operation
  drm: bridge: dw-hdmi: Implement DRM bridge registration
  dt-bindings: display: dw-hdmi: Clean up DT bindings documentation
  dt-bindings: display: renesas: Add R-Car Gen3 HDMI TX DT bindings
  drm: rcar-du: Skip disabled outputs
  arm64: dts: r8a7795: salvator-x: Add DU1 and DU2 external dot clocks

Ulrich Hecht (1):
  arm64: dts: r8a7795: Add HDMI encoder support

 .../devicetree/bindings/display/bridge/dw_hdmi.txt |  85 ++---
 .../bindings/display/bridge/renesas,dw-hdmi.txt|  75 +
 .../devicetree/bindings/display/imx/hdmi.txt   |  51 +--
 .../bindings/display/rockchip/dw_hdmi-rockchip.txt |  43 ++-
 MAINTAINERS|   1 +
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  73 +
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   |  50 +++
 drivers/gpu/drm/bridge/dw-hdmi.c   | 364 -
 drivers/gpu/drm/bridge/dw-hdmi.h   |   4 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c  |  19 +-
 drivers/gpu/drm/rcar-du/Kconfig|   8 +
 drivers/gpu/drm/rcar-du/Makefile   |   1 +
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c |  81 -
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |   4 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv

[PATCH 20/22] arm64: dts: r8a7795: Add HDMI encoder support

2016-12-01 Thread Laurent Pinchart
From: Ulrich Hecht 

Add DT nodes for the two HDMI encoders in disabled state.

Based on work by Koji Matsuoka.

Signed-off-by: Ulrich Hecht 
Signed-off-by: Laurent Pinchart 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 50 
 1 file changed, 50 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 9b717dee1f7b..eceb62ee88df 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1590,11 +1590,13 @@
port@1 {
reg = <1>;
du_out_hdmi0: endpoint {
+   remote-endpoint = 
<&dw_hdmi0_in>;
};
};
port@2 {
reg = <2>;
du_out_hdmi1: endpoint {
+   remote-endpoint = 
<&dw_hdmi1_in>;
};
};
port@3 {
@@ -1604,5 +1606,53 @@
};
};
};
+
+   hdmi0: hdmi0@fead {
+   compatible = "renesas,r8a7795-hdmi", 
"renesas,rcar-gen3-hdmi";
+   reg = <0 0xfead 0 0x1>;
+   interrupts = <0 389 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = <&cpg CPG_CORE R8A7795_CLK_S0D4>, <&cpg 
CPG_MOD 729>;
+   clock-names = "iahb", "isfr";
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   dw_hdmi0_in: endpoint {
+   remote-endpoint = 
<&du_out_hdmi0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   };
+   };
+   };
+
+   hdmi1: hdmi1@feae {
+   compatible = "renesas,r8a7795-hdmi", 
"renesas,rcar-gen3-hdmi";
+   reg = <0 0xfeae 0 0x1>;
+   interrupts = <0 436 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = <&cpg CPG_CORE R8A7795_CLK_S0D4>, <&cpg 
CPG_MOD 728>;
+   clock-names = "iahb", "isfr";
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   dw_hdmi1_in: endpoint {
+   remote-endpoint = 
<&du_out_hdmi1>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   };
+   };
+   };
};
 };
-- 
Regards,

Laurent Pinchart



[PATCH 15/22] dt-bindings: display: renesas: Add R-Car Gen3 HDMI TX DT bindings

2016-12-01 Thread Laurent Pinchart
The Renesas R-Car Gen3 SoCs use a Synopsys DWC HDMI TX encoder IP. Add
corresponding device tree bindings based on the DWC HDMI TX bindings
model.

Signed-off-by: Laurent Pinchart 
---
 .../bindings/display/bridge/renesas,dw-hdmi.txt| 75 ++
 MAINTAINERS|  1 +
 2 files changed, 76 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt

diff --git 
a/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt 
b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
new file mode 100644
index ..f6b3f36d422b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
@@ -0,0 +1,75 @@
+Renesas Gen3 DWC HDMI TX Encoder
+
+
+The HDMI transmitter is a Synopsys DesignWare HDMI 1.4 TX controller IP
+with a companion PHY IP.
+
+These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
+Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt with the
+following device-specific properties.
+
+
+Required properties:
+
+- compatible : Shall contain one or more of
+  - "renesas,r8a7795-hdmi" for R8A7795 (R-Car H3) compatible HDMI TX
+  - "renesas,rcar-gen3-hdmi" for the generic R-Car Gen3 compatible HDMI TX
+
+When compatible with generic versions, nodes must list the SoC-specific
+version corresponding to the platform first, followed by the
+family-specific version.
+
+- reg: See dw_hdmi.txt.
+- interrupts: HDMI interrupt number
+- clocks: See dw_hdmi.txt.
+- clock-names: Shall contain "iahb" and "isfr" as defined in dw_hdmi.txt.
+- ports: See dw_hdmi.txt. The DWC HDMI shall have one port numbered 0
+  corresponding to the video input of the controller and one port numbered 1
+  corresponding to its HDMI output. Each port shall have a single endpoint.
+
+Optional properties:
+
+- power-domains: Shall reference the power domain that contains the DWC HDMI,
+  if any.
+
+
+Example:
+
+   hdmi0: hdmi0@fead {
+   compatible = "renesas,r8a7795-dw-hdmi";
+   reg = <0 0xfead 0 0x1>;
+   interrupts = <0 389 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = <&cpg CPG_CORE R8A7795_CLK_S0D4>, <&cpg CPG_MOD 729>;
+   clock-names = "iahb", "isfr";
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   port@0 {
+   reg = <0>;
+   dw_hdmi0_in: endpoint {
+   remote-endpoint = <&du_out_hdmi0>;
+   };
+   };
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi0_out: endpoint {
+   remote-endpoint = <&hdmi0_con>;
+   };
+   };
+   };
+   };
+
+   hdmi0-out {
+   compatible = "hdmi-connector";
+   label = "HDMI0 OUT";
+   type = "a";
+
+   port {
+   hdmi0_con: endpoint {
+   remote-endpoint = <&rcar_dw_hdmi0_out>;
+   };
+   };
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index 30c873192458..a513fda157d0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4231,6 +4231,7 @@ S:Supported
 F: drivers/gpu/drm/rcar-du/
 F: drivers/gpu/drm/shmobile/
 F: include/linux/platform_data/shmob_drm.h
+F: Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
 F: Documentation/devicetree/bindings/display/renesas,du.txt
 
 DRM DRIVER FOR QXL VIRTUAL GPU
-- 
Regards,

Laurent Pinchart



[PATCH 16/22] drm: rcar-du: Add Gen3 HDMI encoder support

2016-12-01 Thread Laurent Pinchart
From: Koji Matsuoka 

The R-Car Gen3 SoCs include on-chip DesignWare HDMI encoders. Support
them with a platform driver to provide platform glue data to the dw-hdmi
driver.

The driver is a complete rewrite of code coming from the Renesas BSP,
save for the values in the PHY parameters table.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Ulrich Hecht 
Signed-off-by: Laurent Pinchart 
Signed-off-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/Kconfig|   8 +++
 drivers/gpu/drm/rcar-du/Makefile   |   1 +
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 105 +
 3 files changed, 114 insertions(+)
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 06121eeba9e5..a356d2f2f6d6 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -11,6 +11,14 @@ config DRM_RCAR_DU
  Choose this option if you have an R-Car chipset.
  If M is selected the module will be called rcar-du-drm.
 
+config DRM_RCAR_DW_HDMI
+   bool "R-Car DU Gen3 HDMI Encoder Support"
+   depends on DRM_RCAR_DU
+   depends on OF
+   select DRM_DW_HDMI
+   help
+ Enable support for R-Car Gen3 internal HDMI encoder.
+
 config DRM_RCAR_LVDS
bool "R-Car DU LVDS Encoder Support"
depends on DRM_RCAR_DU
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index a492e6858691..2131e722de3b 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -11,3 +11,4 @@ rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)   += rcar_du_lvdsenc.o
 rcar-du-drm-$(CONFIG_DRM_RCAR_VSP) += rcar_du_vsp.o
 
 obj-$(CONFIG_DRM_RCAR_DU)  += rcar-du-drm.o
+obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c 
b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
new file mode 100644
index ..1921d7aa6aed
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
@@ -0,0 +1,105 @@
+/*
+ * R-Car Gen3 HDMI PHY
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ *
+ * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+
+#include 
+
+#define RCAR_HDMI_PHY_OPMODE_PLLCFG0x06/* Mode of operation and PLL 
dividers */
+#define RCAR_HDMI_PHY_PLLCURRGMPCTRL   0x10/* PLL current and Gmp 
(conductance) */
+#define RCAR_HDMI_PHY_PLLDIVCTRL   0x11/* PLL dividers */
+
+struct rcar_hdmi_phy_params {
+   unsigned long mpixelclock;
+   u16 opmode_div; /* Mode of operation and PLL dividers */
+   u16 curr_gmp;   /* PLL current and Gmp (conductance) */
+   u16 div;/* PLL dividers */
+};
+
+static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = {
+   { 3550,  0x0003, 0x0344, 0x0328 },
+   { 4490,  0x0003, 0x0285, 0x0128 },
+   { 7100,  0x0002, 0x1184, 0x0314 },
+   { 9000,  0x0002, 0x1144, 0x0114 },
+   { 14025, 0x0001, 0x20c4, 0x030a },
+   { 18275, 0x0001, 0x2084, 0x010a },
+   { 28125, 0x, 0x0084, 0x0305 },
+   { 29700, 0x, 0x0084, 0x0105 },
+   { ~0UL,  0x, 0x, 0x },
+};
+
+static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi,
+  const struct dw_hdmi_plat_data *pdata,
+  unsigned long mpixelclock,
+  enum dw_hdmi_resolution resolution)
+{
+   const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params;
+
+   if (resolution != DW_HDMI_RES_8)
+   return -EINVAL;
+
+   for (; params && params->mpixelclock != ~0UL; ++params) {
+   if (mpixelclock <= params->mpixelclock)
+   break;
+   }
+
+   if (params->mpixelclock == ~0UL)
+   return -EINVAL;
+
+   dw_hdmi_phy_i2c_write(hdmi, params->opmode_div,
+ RCAR_HDMI_PHY_OPMODE_PLLCFG);
+   dw_hdmi_phy_i2c_write(hdmi, params->curr_gmp,
+ RCAR_HDMI_PHY_PLLCURRGMPCTRL);
+   dw_hdmi_phy_i2c_write(hdmi, params->div, RCAR_HDMI_PHY_PLLDIVCTRL);
+
+   return 0;
+}
+
+static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = {
+   .configure_phy  = rcar_hdmi_phy_configure,
+   .quirks = DW_HDMI_QUIRK_PHY_SVSRET,
+};
+
+static int rcar_dw_hdmi_probe(struct platform_device *pdev)
+{
+   return dw_hdmi_probe(pdev, &rcar_dw_hdmi_plat_data);
+}
+
+static int rcar_dw_hdmi_remove(struct platform_device *pdev)
+{
+   dw_hdmi_remove(pdev);
+
+   return 0;
+}
+
+static const struct of_device_id rcar_dw_hdmi_of_table[] = {
+   {

[PATCH 02/22] drm: bridge: dw-hdmi: Remove unneeded arguments to bind/unbind functions

2016-12-01 Thread Laurent Pinchart
The master argument isn't used. The data argument, a void pointer, is
used by the bind function only where it's cast to a drm_device pointer,
which can easily be obtained from the encoder argument instead. Remove
them.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c| 8 +++-
 drivers/gpu/drm/imx/dw_hdmi-imx.c   | 4 ++--
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 4 ++--
 include/drm/bridge/dw_hdmi.h| 5 ++---
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index a6685502571e..f86894622070 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1854,12 +1854,10 @@ static int dw_hdmi_register(struct drm_device *drm, 
struct dw_hdmi *hdmi)
return 0;
 }
 
-int dw_hdmi_bind(struct device *dev, struct device *master,
-void *data, struct drm_encoder *encoder,
+int dw_hdmi_bind(struct device *dev, struct drm_encoder *encoder,
 struct resource *iores, int irq,
 const struct dw_hdmi_plat_data *plat_data)
 {
-   struct drm_device *drm = data;
struct device_node *np = dev->of_node;
struct platform_device_info pdevinfo;
struct device_node *ddc_node;
@@ -1992,7 +1990,7 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
if (ret)
goto err_iahb;
 
-   ret = dw_hdmi_register(drm, hdmi);
+   ret = dw_hdmi_register(encoder->dev, hdmi);
if (ret)
goto err_iahb;
 
@@ -2059,7 +2057,7 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
 }
 EXPORT_SYMBOL_GPL(dw_hdmi_bind);
 
-void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
+void dw_hdmi_unbind(struct device *dev)
 {
struct dw_hdmi *hdmi = dev_get_drvdata(dev);
 
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 359cd2765552..f79665801543 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -249,7 +249,7 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
drm_encoder_init(drm, encoder, &dw_hdmi_imx_encoder_funcs,
 DRM_MODE_ENCODER_TMDS, NULL);
 
-   ret = dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
+   ret = dw_hdmi_bind(dev, encoder, iores, irq, plat_data);
 
/*
 * If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(),
@@ -264,7 +264,7 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
 static void dw_hdmi_imx_unbind(struct device *dev, struct device *master,
   void *data)
 {
-   return dw_hdmi_unbind(dev, master, data);
+   return dw_hdmi_unbind(dev);
 }
 
 static const struct component_ops dw_hdmi_imx_ops = {
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 0665fb915579..e8fb5c56b224 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -301,7 +301,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct 
device *master,
drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
 DRM_MODE_ENCODER_TMDS, NULL);
 
-   ret = dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
+   ret = dw_hdmi_bind(dev, encoder, iores, irq, plat_data);
 
/*
 * If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(),
@@ -316,7 +316,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct 
device *master,
 static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
void *data)
 {
-   return dw_hdmi_unbind(dev, master, data);
+   return dw_hdmi_unbind(dev);
 }
 
 static const struct component_ops dw_hdmi_rockchip_ops = {
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index bae79f3c4d28..11edda631a9d 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -56,9 +56,8 @@ struct dw_hdmi_plat_data {
   struct drm_display_mode *mode);
 };
 
-void dw_hdmi_unbind(struct device *dev, struct device *master, void *data);
-int dw_hdmi_bind(struct device *dev, struct device *master,
-void *data, struct drm_encoder *encoder,
+void dw_hdmi_unbind(struct device *dev);
+int dw_hdmi_bind(struct device *dev, struct drm_encoder *encoder,
 struct resource *iores, int irq,
 const struct dw_hdmi_plat_data *plat_data);
 
-- 
Regards,

Laurent Pinchart



[PATCH 09/22] drm: bridge: dw-hdmi: Create connector in the bridge attach operation

2016-12-01 Thread Laurent Pinchart
The DRM device is not guaranteed by the bridge API to be available
before the attach callback. The driver performs properly at the moment
as it doesn't use the drm_bridge_add() registration method. As this will
be changed later, move connector creation to attach time to ensure
compatibility with the API.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 92ce9e532603..88cd40adb977 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1667,6 +1667,25 @@ static const struct drm_connector_helper_funcs 
dw_hdmi_connector_helper_funcs =
.best_encoder = drm_atomic_helper_best_encoder,
 };
 
+static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
+{
+   struct dw_hdmi *hdmi = bridge->driver_private;
+   struct drm_encoder *encoder = bridge->encoder;
+   struct drm_connector *connector = &hdmi->connector;
+
+   connector->interlace_allowed = 1;
+   connector->polled = DRM_CONNECTOR_POLL_HPD;
+
+   drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs);
+
+   drm_connector_init(bridge->dev, connector, &dw_hdmi_connector_funcs,
+  DRM_MODE_CONNECTOR_HDMIA);
+
+   drm_mode_connector_attach_encoder(connector, encoder);
+
+   return 0;
+}
+
 static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
struct drm_display_mode *orig_mode,
struct drm_display_mode *mode)
@@ -1704,6 +1723,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge 
*bridge)
 }
 
 static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
+   .attach = dw_hdmi_bridge_attach,
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.mode_set = dw_hdmi_bridge_mode_set,
@@ -1829,17 +1849,6 @@ static int dw_hdmi_register(struct drm_encoder *encoder, 
struct dw_hdmi *hdmi)
return -EINVAL;
}
 
-   hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
-
-   drm_connector_helper_add(&hdmi->connector,
-&dw_hdmi_connector_helper_funcs);
-
-   drm_connector_init(encoder->dev, &hdmi->connector,
-  &dw_hdmi_connector_funcs,
-  DRM_MODE_CONNECTOR_HDMIA);
-
-   drm_mode_connector_attach_encoder(&hdmi->connector, encoder);
-
return 0;
 }
 
@@ -1862,8 +1871,6 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
if (!hdmi)
return -ENOMEM;
 
-   hdmi->connector.interlace_allowed = 1;
-
hdmi->plat_data = plat_data;
hdmi->dev = dev;
hdmi->dev_type = plat_data->dev_type;
-- 
Regards,

Laurent Pinchart



[PATCH 06/22] drm: bridge: dw-hdmi: Don't forward HPD events to DRM core before attach

2016-12-01 Thread Laurent Pinchart
Hotplug events should only be forwarded to the DRM core by the interrupt
handler when the bridge has been attached, otherwise the DRM device
pointer will be NULL, resulting in a crash.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index ef10bb866b2f..488dc1a9204f 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1805,7 +1805,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
dev_dbg(hdmi->dev, "EVENT=%s\n",
phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout");
-   drm_helper_hpd_irq_event(hdmi->bridge.dev);
+   if (hdmi->bridge.dev)
+   drm_helper_hpd_irq_event(hdmi->bridge.dev);
}
 
hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0);
-- 
Regards,

Laurent Pinchart



[PATCH 13/22] drm: bridge: dw-hdmi: Replace device type with platform quirks

2016-12-01 Thread Laurent Pinchart
From: Kieran Bingham 

The dw-hdmi driver declares a dev_type to distinguish platform specific
changes. Replace this with a quirk field, so that the platform can
specify the required quirks for the driver, rather than the driver
becoming conditional on multiple platforms.

As part of this, we rename the dw-hdmi 'spare' which is defined as the
SVSRET bit in later documentation.

Signed-off-by: Kieran Bingham 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c| 14 ++
 drivers/gpu/drm/bridge/dw-hdmi.h|  4 ++--
 drivers/gpu/drm/imx/dw_hdmi-imx.c   |  3 +--
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  2 +-
 include/drm/bridge/dw_hdmi.h| 12 +---
 5 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 06a44a2cdf3b..26607185722f 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -118,7 +118,6 @@ struct dw_hdmi {
struct drm_bridge bridge;
 
struct platform_device *audio;
-   enum dw_hdmi_devtype dev_type;
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
@@ -896,11 +895,11 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, 
u8 enable)
 HDMI_PHY_CONF0_ENTMDS_MASK);
 }
 
-static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable)
+static void dw_hdmi_phy_enable_svsret(struct dw_hdmi *hdmi, u8 enable)
 {
hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
-HDMI_PHY_CONF0_SPARECTRL_OFFSET,
-HDMI_PHY_CONF0_SPARECTRL_MASK);
+HDMI_PHY_CONF0_SVSRET_OFFSET,
+HDMI_PHY_CONF0_SVSRET_MASK);
 }
 
 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable)
@@ -1031,8 +1030,8 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi,
dw_hdmi_phy_gen2_txpwron(hdmi, 1);
dw_hdmi_phy_gen2_pddq(hdmi, 0);
 
-   if (hdmi->dev_type == RK3288_HDMI)
-   dw_hdmi_phy_enable_spare(hdmi, 1);
+   if (pdata->quirks & DW_HDMI_QUIRK_PHY_SVSRET)
+   dw_hdmi_phy_enable_svsret(hdmi, 1);
 
/*Wait for PHY PLL lock */
msec = 5;
@@ -1348,7 +1347,7 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi)
hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, HDMI_MC_SWRSTZ);
 
val = hdmi_readb(hdmi, HDMI_FC_INVIDCONF);
-   if (hdmi->dev_type == IMX6DL_HDMI) {
+   if (hdmi->plat_data->quirks & DW_HDMI_QUIRK_FC_INVIDCONF) {
hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF);
return;
}
@@ -1859,7 +1858,6 @@ __dw_hdmi_probe(struct platform_device *pdev,
 
hdmi->plat_data = plat_data;
hdmi->dev = dev;
-   hdmi->dev_type = plat_data->dev_type;
hdmi->sample_rate = 48000;
hdmi->disabled = true;
hdmi->rxsense = true;
diff --git a/drivers/gpu/drm/bridge/dw-hdmi.h b/drivers/gpu/drm/bridge/dw-hdmi.h
index 55135bbd0c16..08235aef2fa3 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.h
+++ b/drivers/gpu/drm/bridge/dw-hdmi.h
@@ -847,8 +847,8 @@ enum {
HDMI_PHY_CONF0_PDZ_OFFSET = 7,
HDMI_PHY_CONF0_ENTMDS_MASK = 0x40,
HDMI_PHY_CONF0_ENTMDS_OFFSET = 6,
-   HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20,
-   HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5,
+   HDMI_PHY_CONF0_SVSRET_MASK = 0x20,
+   HDMI_PHY_CONF0_SVSRET_OFFSET = 5,
HDMI_PHY_CONF0_GEN2_PDDQ_MASK = 0x10,
HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET = 4,
HDMI_PHY_CONF0_GEN2_TXPWRON_MASK = 0x8,
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index f1cb25c429cf..404def112f5d 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -175,7 +175,6 @@ static struct dw_hdmi_plat_data imx6q_hdmi_drv_data = {
.mpll_cfg   = imx_mpll_cfg,
.cur_ctr= imx_cur_ctr,
.phy_config = imx_phy_config,
-   .dev_type   = IMX6Q_HDMI,
.mode_valid = imx6q_hdmi_mode_valid,
.configure_phy = dw_hdmi_phy_configure_synopsys,
 };
@@ -184,7 +183,7 @@ static struct dw_hdmi_plat_data imx6dl_hdmi_drv_data = {
.mpll_cfg = imx_mpll_cfg,
.cur_ctr  = imx_cur_ctr,
.phy_config = imx_phy_config,
-   .dev_type = IMX6DL_HDMI,
+   .quirks   = DW_HDMI_QUIRK_FC_INVIDCONF,
.mode_valid = imx6dl_hdmi_mode_valid,
.configure_phy = dw_hdmi_phy_configure_synopsys,
 };
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 55b1f2f27d6e..4f6ff30fa091 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -238,7 +238,7 @@ static const struct dw_hdmi_plat_data 
rockchip_hdmi_drv_data = {
.cur_ctr= rockchip_cur_ctr,
.phy_config = rockchip_phy_config,
.configure_phy = dw_hdmi_phy_co

[PATCH 03/22] drm: bridge: dw-hdmi: Remove unused function parameter

2016-12-01 Thread Laurent Pinchart
From: Kieran Bingham 

The 'prep' parameter passed to hdmi_phy_configure() is useless. It is
hardcoded as 0, and if set, simply prevents the configure function from
executing.

Remove it.

Signed-off-by: Kieran Bingham 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index f86894622070..5f8044a7d602 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -931,7 +931,7 @@ static void dw_hdmi_phy_sel_interface_control(struct 
dw_hdmi *hdmi, u8 enable)
 HDMI_PHY_CONF0_SELDIPIF_MASK);
 }
 
-static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
+static int hdmi_phy_configure(struct dw_hdmi *hdmi,
  unsigned char res, int cscon)
 {
unsigned res_idx;
@@ -941,9 +941,6 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
const struct dw_hdmi_curr_ctrl *curr_ctrl = pdata->cur_ctr;
const struct dw_hdmi_phy_config *phy_config = pdata->phy_config;
 
-   if (prep)
-   return -EINVAL;
-
switch (res) {
case 0: /* color resolution 0 is 8 bit colour depth */
case 8:
@@ -1072,7 +1069,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi)
dw_hdmi_phy_enable_powerdown(hdmi, true);
 
/* Enable CSC */
-   ret = hdmi_phy_configure(hdmi, 0, 8, cscon);
+   ret = hdmi_phy_configure(hdmi, 8, cscon);
if (ret)
return ret;
}
-- 
Regards,

Laurent Pinchart



[PATCH 07/22] drm: bridge: dw-hdmi: Move IRQ and IO resource allocation to common code

2016-12-01 Thread Laurent Pinchart
There's no need to duplicate identical code in multiple drivers (two at
the moment, one more to come soon). Move it to the dw-hdmi core where it
can be shared. If resource allocation ever becomes device-specific later
we'll always have the option of splitting it out again.

While it at pass the platform device to the bind function to avoid
having to cast struct device to struct platform_device.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c| 13 ++---
 drivers/gpu/drm/imx/dw_hdmi-imx.c   | 12 +---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 12 +---
 include/drm/bridge/dw_hdmi.h|  3 +--
 4 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 488dc1a9204f..563cbec47da6 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1843,14 +1843,16 @@ static int dw_hdmi_register(struct drm_encoder 
*encoder, struct dw_hdmi *hdmi)
return 0;
 }
 
-int dw_hdmi_bind(struct device *dev, struct drm_encoder *encoder,
-struct resource *iores, int irq,
+int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder,
 const struct dw_hdmi_plat_data *plat_data)
 {
+   struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct platform_device_info pdevinfo;
struct device_node *ddc_node;
struct dw_hdmi *hdmi;
+   struct resource *iores;
+   int irq;
int ret;
u32 val = 1;
u8 config0;
@@ -1903,6 +1905,7 @@ int dw_hdmi_bind(struct device *dev, struct drm_encoder 
*encoder,
dev_dbg(hdmi->dev, "no ddc property found\n");
}
 
+   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdmi->regs = devm_ioremap_resource(dev, iores);
if (IS_ERR(hdmi->regs)) {
ret = PTR_ERR(hdmi->regs);
@@ -1945,6 +1948,10 @@ int dw_hdmi_bind(struct device *dev, struct drm_encoder 
*encoder,
 
initialize_hdmi_ih_mutes(hdmi);
 
+   irq = platform_get_irq(pdev, 0);
+   if (irq < 0)
+   goto err_iahb;
+
ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
dw_hdmi_irq, IRQF_SHARED,
dev_name(dev), hdmi);
@@ -2025,7 +2032,7 @@ int dw_hdmi_bind(struct device *dev, struct drm_encoder 
*encoder,
if (hdmi->i2c)
dw_hdmi_i2c_init(hdmi);
 
-   dev_set_drvdata(dev, hdmi);
+   platform_set_drvdata(pdev, hdmi);
 
return 0;
 
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index f79665801543..f645275e6e63 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -207,8 +207,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
struct drm_device *drm = data;
struct drm_encoder *encoder;
struct imx_hdmi *hdmi;
-   struct resource *iores;
-   int irq;
int ret;
 
if (!pdev->dev.of_node)
@@ -223,14 +221,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
hdmi->dev = &pdev->dev;
encoder = &hdmi->encoder;
 
-   irq = platform_get_irq(pdev, 0);
-   if (irq < 0)
-   return irq;
-
-   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!iores)
-   return -ENXIO;
-
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
/*
 * If we failed to find the CRTC(s) which this encoder is
@@ -249,7 +239,7 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
drm_encoder_init(drm, encoder, &dw_hdmi_imx_encoder_funcs,
 DRM_MODE_ENCODER_TMDS, NULL);
 
-   ret = dw_hdmi_bind(dev, encoder, iores, irq, plat_data);
+   ret = dw_hdmi_bind(pdev, encoder, plat_data);
 
/*
 * If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(),
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index e8fb5c56b224..a6d4a0236e8f 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -257,8 +257,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct 
device *master,
struct drm_device *drm = data;
struct drm_encoder *encoder;
struct rockchip_hdmi *hdmi;
-   struct resource *iores;
-   int irq;
int ret;
 
if (!pdev->dev.of_node)
@@ -273,14 +271,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
hdmi->dev = &pdev->dev;
encoder = &hdmi->encoder;
 
-   irq = platform_get_irq(pdev, 0);
-   if (irq < 0)
-   return irq;
-
-   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if 

[PATCH 08/22] drm: bridge: dw-hdmi: Reorder functions to prepare for next commit

2016-12-01 Thread Laurent Pinchart
The next commit will reference structures and functions in a way that
currently requires forward declarations. Reorder the functions to avoid
that. No functional change to the code is performed.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 72 
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 563cbec47da6..92ce9e532603 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1575,42 +1575,6 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi)
hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0);
 }
 
-static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
-   struct drm_display_mode *orig_mode,
-   struct drm_display_mode *mode)
-{
-   struct dw_hdmi *hdmi = bridge->driver_private;
-
-   mutex_lock(&hdmi->mutex);
-
-   /* Store the display mode for plugin/DKMS poweron events */
-   memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode));
-
-   mutex_unlock(&hdmi->mutex);
-}
-
-static void dw_hdmi_bridge_disable(struct drm_bridge *bridge)
-{
-   struct dw_hdmi *hdmi = bridge->driver_private;
-
-   mutex_lock(&hdmi->mutex);
-   hdmi->disabled = true;
-   dw_hdmi_update_power(hdmi);
-   dw_hdmi_update_phy_mask(hdmi);
-   mutex_unlock(&hdmi->mutex);
-}
-
-static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
-{
-   struct dw_hdmi *hdmi = bridge->driver_private;
-
-   mutex_lock(&hdmi->mutex);
-   hdmi->disabled = false;
-   dw_hdmi_update_power(hdmi);
-   dw_hdmi_update_phy_mask(hdmi);
-   mutex_unlock(&hdmi->mutex);
-}
-
 static enum drm_connector_status
 dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -1703,6 +1667,42 @@ static const struct drm_connector_helper_funcs 
dw_hdmi_connector_helper_funcs =
.best_encoder = drm_atomic_helper_best_encoder,
 };
 
+static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
+   struct drm_display_mode *orig_mode,
+   struct drm_display_mode *mode)
+{
+   struct dw_hdmi *hdmi = bridge->driver_private;
+
+   mutex_lock(&hdmi->mutex);
+
+   /* Store the display mode for plugin/DKMS poweron events */
+   memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode));
+
+   mutex_unlock(&hdmi->mutex);
+}
+
+static void dw_hdmi_bridge_disable(struct drm_bridge *bridge)
+{
+   struct dw_hdmi *hdmi = bridge->driver_private;
+
+   mutex_lock(&hdmi->mutex);
+   hdmi->disabled = true;
+   dw_hdmi_update_power(hdmi);
+   dw_hdmi_update_phy_mask(hdmi);
+   mutex_unlock(&hdmi->mutex);
+}
+
+static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
+{
+   struct dw_hdmi *hdmi = bridge->driver_private;
+
+   mutex_lock(&hdmi->mutex);
+   hdmi->disabled = false;
+   dw_hdmi_update_power(hdmi);
+   dw_hdmi_update_phy_mask(hdmi);
+   mutex_unlock(&hdmi->mutex);
+}
+
 static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
-- 
Regards,

Laurent Pinchart



[PATCH 19/22] drm: rcar-du: Add HDMI outputs to R8A7795 device description

2016-12-01 Thread Laurent Pinchart
From: Koji Matsuoka 

Update the device description with the two available HDMI outputs.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  4 +++-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 12 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 6f08b7e7db06..459e5390d6e0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -1,7 +1,7 @@
 /*
  * rcar_du_crtc.h  --  R-Car Display Unit CRTCs
  *
- * Copyright (C) 2013-2014 Renesas Electronics Corporation
+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
  *
@@ -61,6 +61,8 @@ enum rcar_du_output {
RCAR_DU_OUTPUT_DPAD1,
RCAR_DU_OUTPUT_LVDS0,
RCAR_DU_OUTPUT_LVDS1,
+   RCAR_DU_OUTPUT_HDMI0,
+   RCAR_DU_OUTPUT_HDMI1,
RCAR_DU_OUTPUT_TCON,
RCAR_DU_OUTPUT_MAX,
 };
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 74352140f55f..3107719c4653 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -150,13 +150,21 @@ static const struct rcar_du_device_info 
rcar_du_r8a7795_info = {
  | RCAR_DU_FEATURE_VSP1_SOURCE,
.num_crtcs = 4,
.routes = {
-   /* R8A7795 has one RGB output, one LVDS output and two
-* (currently unsupported) HDMI outputs.
+   /* R8A7795 has one RGB output, two HDMI outputs and one
+* LVDS output.
 */
[RCAR_DU_OUTPUT_DPAD0] = {
.possible_crtcs = BIT(3),
.port = 0,
},
+   [RCAR_DU_OUTPUT_HDMI0] = {
+   .possible_crtcs = BIT(1),
+   .port = 1,
+   },
+   [RCAR_DU_OUTPUT_HDMI1] = {
+   .possible_crtcs = BIT(2),
+   .port = 2,
+   },
[RCAR_DU_OUTPUT_LVDS0] = {
.possible_crtcs = BIT(0),
.port = 3,
-- 
Regards,

Laurent Pinchart



[PATCH 21/22] arm64: dts: r8a7795: salvator-x: Enable HDMI outputs

2016-12-01 Thread Laurent Pinchart
From: Koji Matsuoka 

Instantiate the HDMI connectors and enable the encoders.

Signed-off-by: Koji Matsuoka 
Signed-off-by: Ulrich Hecht 
Signed-off-by: Laurent Pinchart 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 73a22b93f7b1..08554b4d7e86 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -147,6 +147,30 @@
};
};
 
+   hdmi0-out {
+   compatible = "hdmi-connector";
+   label = "HDMI0 OUT";
+   type = "a";
+
+   port {
+   hdmi0_con: endpoint {
+   remote-endpoint = <&rcar_dw_hdmi0_out>;
+   };
+   };
+   };
+
+   hdmi1-out {
+   compatible = "hdmi-connector";
+   label = "HDMI1 OUT";
+   type = "a";
+
+   port {
+   hdmi1_con: endpoint {
+   remote-endpoint = <&rcar_dw_hdmi1_out>;
+   };
+   };
+   };
+
vga-encoder {
compatible = "adi,adv7123";
 
@@ -190,6 +214,32 @@
};
 };
 
+&hdmi0 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi0_out: endpoint {
+   remote-endpoint = <&hdmi0_con>;
+   };
+   };
+   };
+};
+
+&hdmi1 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi1_out: endpoint {
+   remote-endpoint = <&hdmi1_con>;
+   };
+   };
+   };
+};
+
 &du {
pinctrl-0 = <&du_pins>;
pinctrl-names = "default";
-- 
Regards,

Laurent Pinchart



[PATCH 22/22] arm64: dts: r8a7795: salvator-x: Add DU1 and DU2 external dot clocks

2016-12-01 Thread Laurent Pinchart
The DU1 and DU2 external dot clocks are fixed frequency clock generators
running at 33MHz.

Signed-off-by: Laurent Pinchart 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 23 ++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 08554b4d7e86..b6dc6f5188d6 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -147,6 +147,19 @@
};
};
 
+   /* External DU dot clocks */
+   x21_clk: x21-clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <3300>;
+   };
+
+   x22_clk: x22-clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <3300>;
+   };
+
hdmi0-out {
compatible = "hdmi-connector";
label = "HDMI0 OUT";
@@ -245,6 +258,16 @@
pinctrl-names = "default";
status = "okay";
 
+   clocks = <&cpg CPG_MOD 724>,
+<&cpg CPG_MOD 723>,
+<&cpg CPG_MOD 722>,
+<&cpg CPG_MOD 721>,
+<&cpg CPG_MOD 727>,
+<&x21_clk>,
+<&x22_clk>;
+   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+ "dclkin.1", "dclkin.2";
+
ports {
port@0 {
endpoint {
-- 
Regards,

Laurent Pinchart



[PATCH 04/22] drm: bridge: dw-hdmi: Embed drm_bridge in struct dw_hdmi

2016-12-01 Thread Laurent Pinchart
The drm_bridge instance is always needed, there's no point in allocating
it separately.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 5f8044a7d602..2c85b6c07a80 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -116,7 +116,7 @@ struct dw_hdmi_i2c {
 struct dw_hdmi {
struct drm_connector connector;
struct drm_encoder *encoder;
-   struct drm_bridge *bridge;
+   struct drm_bridge bridge;
 
struct platform_device *audio;
enum dw_hdmi_devtype dev_type;
@@ -1806,7 +1806,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
dev_dbg(hdmi->dev, "EVENT=%s\n",
phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout");
-   drm_helper_hpd_irq_event(hdmi->bridge->dev);
+   drm_helper_hpd_irq_event(hdmi->bridge.dev);
}
 
hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0);
@@ -1819,16 +1819,9 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
 static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
 {
struct drm_encoder *encoder = hdmi->encoder;
-   struct drm_bridge *bridge;
+   struct drm_bridge *bridge = &hdmi->bridge;
int ret;
 
-   bridge = devm_kzalloc(drm->dev, sizeof(*bridge), GFP_KERNEL);
-   if (!bridge) {
-   DRM_ERROR("Failed to allocate drm bridge\n");
-   return -ENOMEM;
-   }
-
-   hdmi->bridge = bridge;
bridge->driver_private = hdmi;
bridge->funcs = &dw_hdmi_bridge_funcs;
ret = drm_bridge_attach(encoder, bridge, NULL);
-- 
Regards,

Laurent Pinchart



[PATCH 10/22] drm: bridge: dw-hdmi: Implement DRM bridge registration

2016-12-01 Thread Laurent Pinchart
As an option for drivers not based on the component framework, register
the bridge with the DRM core with the DRM bridge API. Existing drivers
based on dw_hdmi_bind() and dw_hdmi_unbind() are not affected as those
functions are preserved with their current behaviour.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 112 ---
 include/drm/bridge/dw_hdmi.h |   3 ++
 2 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 88cd40adb977..107fea49c4c6 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1836,24 +1836,9 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
return IRQ_HANDLED;
 }
 
-static int dw_hdmi_register(struct drm_encoder *encoder, struct dw_hdmi *hdmi)
-{
-   struct drm_bridge *bridge = &hdmi->bridge;
-   int ret;
-
-   bridge->driver_private = hdmi;
-   bridge->funcs = &dw_hdmi_bridge_funcs;
-   ret = drm_bridge_attach(encoder, bridge, NULL);
-   if (ret) {
-   DRM_ERROR("Failed to initialize bridge with drm\n");
-   return -EINVAL;
-   }
-
-   return 0;
-}
-
-int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder,
-const struct dw_hdmi_plat_data *plat_data)
+static struct dw_hdmi *
+__dw_hdmi_probe(struct platform_device *pdev,
+   const struct dw_hdmi_plat_data *plat_data)
 {
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
@@ -1869,7 +1854,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
 
hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
-   return -ENOMEM;
+   return ERR_PTR(-ENOMEM);
 
hdmi->plat_data = plat_data;
hdmi->dev = dev;
@@ -1896,7 +1881,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
break;
default:
dev_err(dev, "reg-io-width must be 1 or 4\n");
-   return -EINVAL;
+   return ERR_PTR(-EINVAL);
}
 
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
@@ -1905,7 +1890,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
of_node_put(ddc_node);
if (!hdmi->ddc) {
dev_dbg(hdmi->dev, "failed to read ddc node\n");
-   return -EPROBE_DEFER;
+   return ERR_PTR(-EPROBE_DEFER);
}
 
} else {
@@ -1956,8 +1941,10 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
initialize_hdmi_ih_mutes(hdmi);
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0)
+   if (irq < 0) {
+   ret = irq;
goto err_iahb;
+   }
 
ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
dw_hdmi_irq, IRQF_SHARED,
@@ -1988,11 +1975,11 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE,
HDMI_IH_PHY_STAT0);
 
-   ret = dw_hdmi_fb_registered(hdmi);
-   if (ret)
-   goto err_iahb;
+   hdmi->bridge.driver_private = hdmi;
+   hdmi->bridge.funcs = &dw_hdmi_bridge_funcs;
+   hdmi->bridge.of_node = pdev->dev.of_node;
 
-   ret = dw_hdmi_register(encoder, hdmi);
+   ret = dw_hdmi_fb_registered(hdmi);
if (ret)
goto err_iahb;
 
@@ -2041,7 +2028,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
 
platform_set_drvdata(pdev, hdmi);
 
-   return 0;
+   return hdmi;
 
 err_iahb:
if (hdmi->i2c) {
@@ -2055,14 +2042,11 @@ int dw_hdmi_bind(struct platform_device *pdev, struct 
drm_encoder *encoder,
 err_res:
i2c_put_adapter(hdmi->ddc);
 
-   return ret;
+   return ERR_PTR(ret);
 }
-EXPORT_SYMBOL_GPL(dw_hdmi_bind);
 
-void dw_hdmi_unbind(struct device *dev)
+static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
 {
-   struct dw_hdmi *hdmi = dev_get_drvdata(dev);
-
if (hdmi->audio && !IS_ERR(hdmi->audio))
platform_device_unregister(hdmi->audio);
 
@@ -2077,6 +2061,70 @@ void dw_hdmi_unbind(struct device *dev)
else
i2c_put_adapter(hdmi->ddc);
 }
+
+/* 
-
+ * Probe/remove API, used from platforms based on the DRM bridge API.
+ */
+int dw_hdmi_probe(struct platform_device *pdev,
+ const struct dw_hdmi_plat_data *plat_data)
+{
+   struct dw_hdmi *hdmi;
+   int ret;
+
+   hdmi = __dw_hdmi_probe(pdev, plat_data);
+   if (IS_ERR(hdmi))
+   return PTR_ERR(hdmi);
+
+   ret = drm_bridge_add(&hdmi->bridge)

[PATCH 05/22] drm: bridge: dw-hdmi: Remove encoder field from struct dw_hdmi

2016-12-01 Thread Laurent Pinchart
The field isn't needed, remove it.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/dw-hdmi.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 2c85b6c07a80..ef10bb866b2f 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -115,7 +115,6 @@ struct dw_hdmi_i2c {
 
 struct dw_hdmi {
struct drm_connector connector;
-   struct drm_encoder *encoder;
struct drm_bridge bridge;
 
struct platform_device *audio;
@@ -1816,9 +1815,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
return IRQ_HANDLED;
 }
 
-static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
+static int dw_hdmi_register(struct drm_encoder *encoder, struct dw_hdmi *hdmi)
 {
-   struct drm_encoder *encoder = hdmi->encoder;
struct drm_bridge *bridge = &hdmi->bridge;
int ret;
 
@@ -1835,7 +1833,7 @@ static int dw_hdmi_register(struct drm_device *drm, 
struct dw_hdmi *hdmi)
drm_connector_helper_add(&hdmi->connector,
 &dw_hdmi_connector_helper_funcs);
 
-   drm_connector_init(drm, &hdmi->connector,
+   drm_connector_init(encoder->dev, &hdmi->connector,
   &dw_hdmi_connector_funcs,
   DRM_MODE_CONNECTOR_HDMIA);
 
@@ -1867,7 +1865,6 @@ int dw_hdmi_bind(struct device *dev, struct drm_encoder 
*encoder,
hdmi->dev = dev;
hdmi->dev_type = plat_data->dev_type;
hdmi->sample_rate = 48000;
-   hdmi->encoder = encoder;
hdmi->disabled = true;
hdmi->rxsense = true;
hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE);
@@ -1980,7 +1977,7 @@ int dw_hdmi_bind(struct device *dev, struct drm_encoder 
*encoder,
if (ret)
goto err_iahb;
 
-   ret = dw_hdmi_register(encoder->dev, hdmi);
+   ret = dw_hdmi_register(encoder, hdmi);
if (ret)
goto err_iahb;
 
-- 
Regards,

Laurent Pinchart



[PATCH v3] pinctrl: sh-pfc: r8a7791: Add ADI pinconf support

2016-12-01 Thread Jacopo Mondi
Add pin configuration support for Gyro-ADC, named ADI on r8a7791 SoC.

Signed-off-by: Jacopo Mondi 
---
Compiled only, not tested with an actual ADC.

For reference only, these are the changes introduced by Geert's private
review of first sketch of this patch:
* separate ADI chsel in 3 overlapping groups:
  the user can now select how many pins to assign to channel selection
  function.

v1 -> v2:
* let the user freely select the single CHS line to use.
  This requires the configuration to match the ADI mode in use, but
  allows users to select CHS1 or CHS2 lines alone, and dedicate other
  pins to other functions.

v2 -> v3:
* Update commit message which I forgot to do in v2 :/

---
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 86 
 1 file changed, 86 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 7ca37c3..75c9882 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -1691,6 +1691,72 @@ static const struct sh_pfc_pin pinmux_pins[] = {
PINMUX_GPIO_GP_ALL(),
 };
 
+/* - ADI  
*/
+static const unsigned int adi_common_pins[] = {
+   /* ADIDATA, ADICS/SAMP, ADICLK */
+   RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25), RCAR_GP_PIN(6, 26),
+};
+static const unsigned int adi_common_mux[] = {
+   /* ADIDATA, ADICS/SAMP, ADICLK */
+   ADIDATA_MARK, ADICS_SAMP_MARK, ADICLK_MARK,
+};
+static const unsigned int adi_chsel0_pins[] = {
+   /* ADICHS 0 */
+   RCAR_GP_PIN(6, 27),
+};
+static const unsigned int adi_chsel0_mux[] = {
+   /* ADICHS 0 */
+   ADICHS0_MARK,
+};
+static const unsigned int adi_chsel1_pins[] = {
+   /* ADICHS 1 */
+   RCAR_GP_PIN(6, 28),
+};
+static const unsigned int adi_chsel1_mux[] = {
+   /* ADICHS 1 */
+   ADICHS1_MARK,
+};
+static const unsigned int adi_chsel2_pins[] = {
+   /* ADICHS 2 */
+   RCAR_GP_PIN(6, 29),
+};
+static const unsigned int adi_chsel2_mux[] = {
+   /* ADICHS 2 */
+   ADICHS2_MARK,
+};
+static const unsigned int adi_common_b_pins[] = {
+   /* ADIDATA B, ADICS/SAMP B, ADICLK B */
+   RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 26), RCAR_GP_PIN(5, 27),
+};
+static const unsigned int adi_common_b_mux[] = {
+   /* ADIDATA B, ADICS/SAMP B, ADICLK B */
+   ADIDATA_B_MARK, ADICS_SAMP_B_MARK, ADICLK_B_MARK,
+};
+static const unsigned int adi_chsel0_b_pins[] = {
+   /* ADICHS B 0 */
+   RCAR_GP_PIN(5, 28),
+};
+static const unsigned int adi_chsel0_b_mux[] = {
+   /* ADICHS B 0 */
+   ADICHS0_B_MARK,
+};
+static const unsigned int adi_chsel1_b_pins[] = {
+   /* ADICHS B 1 */
+   RCAR_GP_PIN(5, 29),
+};
+static const unsigned int adi_chsel1_b_mux[] = {
+   /* ADICHS B 1 */
+   ADICHS1_B_MARK,
+};
+static const unsigned int adi_chsel2_b_pins[] = {
+   /* ADICHS B 2 */
+   RCAR_GP_PIN(5, 30),
+};
+static const unsigned int adi_chsel2_b_mux[] = {
+   /* ADICHS B 2 */
+   ADICHS2_B_MARK,
+};
+
 /* - Audio Clock  
*/
 static const unsigned int audio_clk_a_pins[] = {
/* CLK */
@@ -4343,6 +4409,14 @@ static const unsigned int vin2_clk_mux[] = {
 };
 
 static const struct sh_pfc_pin_group pinmux_groups[] = {
+   SH_PFC_PIN_GROUP(adi_common),
+   SH_PFC_PIN_GROUP(adi_chsel0),
+   SH_PFC_PIN_GROUP(adi_chsel1),
+   SH_PFC_PIN_GROUP(adi_chsel2),
+   SH_PFC_PIN_GROUP(adi_common_b),
+   SH_PFC_PIN_GROUP(adi_chsel0_b),
+   SH_PFC_PIN_GROUP(adi_chsel1_b),
+   SH_PFC_PIN_GROUP(adi_chsel2_b),
SH_PFC_PIN_GROUP(audio_clk_a),
SH_PFC_PIN_GROUP(audio_clk_b),
SH_PFC_PIN_GROUP(audio_clk_b_b),
@@ -4687,6 +4761,17 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(vin2_clk),
 };
 
+static const char * const adi_groups[] = {
+   "adi_common",
+   "adi_chsel0",
+   "adi_chsel1",
+   "adi_chsel2",
+   "adi_common_b",
+   "adi_chsel0_b",
+   "adi_chsel1_b",
+   "adi_chsel2_b",
+};
+
 static const char * const audio_clk_groups[] = {
"audio_clk_a",
"audio_clk_b",
@@ -5192,6 +5277,7 @@ static const char * const vin2_groups[] = {
 };
 
 static const struct sh_pfc_function pinmux_functions[] = {
+   SH_PFC_FUNCTION(adi),
SH_PFC_FUNCTION(audio_clk),
SH_PFC_FUNCTION(avb),
SH_PFC_FUNCTION(can0),
-- 
2.7.4



[PATCH v4 0/4] thermal: add driver for R-Car Gen3

2016-12-01 Thread Wolfram Sang
Here is the next series for adding thermal support to Renesas R-Car Gen3 SoCs.
All changes from last revision went into patch 2/4, so please check the
changelog there. This series has again been tested on Salvator-X boards with
H3 and M3-W SoCs. The updated branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
renesas/thermal-on-4.10-next

I know we are ultra close, but I still dare to hope the new-driver-rule might
apply for this driver?

Please review, comment, apply. Thanks,

   Wolfram


Wolfram Sang (4):
  thermal: rcar_gen3_thermal: Document the R-Car Gen3
  thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver
  arm64: dts: r8a7795: Add R-Car Gen3 thermal support
  arm64: dts: r8a7796: Add R-Car Gen3 thermal support

 .../bindings/thermal/rcar-gen3-thermal.txt |  56 
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   |  58 
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   |  58 
 drivers/thermal/Kconfig|   9 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/rcar_gen3_thermal.c| 324 +
 6 files changed, 506 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt
 create mode 100644 drivers/thermal/rcar_gen3_thermal.c

-- 
2.10.2



[PATCH v4 4/4] arm64: dts: r8a7796: Add R-Car Gen3 thermal support

2016-12-01 Thread Wolfram Sang
Signed-off-by: Hien Dang 
Signed-off-by: Thao Nguyen 
Signed-off-by: Khiem Nguyen 
Signed-off-by: Wolfram Sang 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 9217da98352565..5261f0f77ce2e9 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -251,5 +251,63 @@
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
+
+   tsc: thermal@e6198000 {
+   compatible = "renesas,r8a7796-thermal";
+   reg = <0 0xe6198000 0 0x68>,
+ <0 0xe61a 0 0x5c>,
+ <0 0xe61a8000 0 0x5c>;
+   interrupts = ,
+,
+;
+   clocks = <&cpg CPG_MOD 522>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   #thermal-sensor-cells = <1>;
+   status = "okay";
+   };
+
+   thermal-zones {
+   sensor_thermal1: sensor-thermal1 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 0>;
+
+   trips {
+   sensor1_crit: sensor1-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+
+   sensor_thermal2: sensor-thermal2 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 1>;
+
+   trips {
+   sensor2_crit: sensor2-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+
+   sensor_thermal3: sensor-thermal3 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 2>;
+
+   trips {
+   sensor3_crit: sensor3-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+   };
};
 };
-- 
2.10.2



[PATCH v4 2/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver

2016-12-01 Thread Wolfram Sang
Add support for R-Car Gen3 thermal sensors. Polling only for now,
interrupts will be added incrementally. Same goes for reading fuses.
This is documented already, but no hardware available for now.

Signed-off-by: Hien Dang 
Signed-off-by: Thao Nguyen 
Signed-off-by: Khiem Nguyen 
Signed-off-by: Wolfram Sang 
---

Changes since v3:

* call 'init' callback a tad earlier, avoids need for locking
* converted spinlock to mutex and simplified locking (only done against
  concurrent access in rcar_gen3_thermal_get_temp() now)
* use usleep_range instead of udelay
* use s64 instead of long (int didn't work)
* fixed an error path
* simplified rcar_gen3_thermal_update_temp() and its use

Thanks a lot to Eduardo and Geert for the prompt reviews!

 drivers/thermal/Kconfig |   9 +
 drivers/thermal/Makefile|   1 +
 drivers/thermal/rcar_gen3_thermal.c | 324 
 3 files changed, 334 insertions(+)
 create mode 100644 drivers/thermal/rcar_gen3_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index c2c056cc7ea52e..3912d24a07b10f 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -245,6 +245,15 @@ config RCAR_THERMAL
  Enable this to plug the R-Car thermal sensor driver into the Linux
  thermal framework.
 
+config RCAR_GEN3_THERMAL
+   tristate "Renesas R-Car Gen3 thermal driver"
+   depends on ARCH_RENESAS || COMPILE_TEST
+   depends on HAS_IOMEM
+   depends on OF
+   help
+ Enable this to plug the R-Car Gen3 thermal sensor driver into the 
Linux
+ thermal framework.
+
 config KIRKWOOD_THERMAL
tristate "Temperature sensor on Marvell Kirkwood SoCs"
depends on MACH_KIRKWOOD || COMPILE_TEST
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c92eb22a41ff89..1216fb31ed4036 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM)+= 
qcom-spmi-temp-alarm.o
 obj-$(CONFIG_SPEAR_THERMAL)+= spear_thermal.o
 obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
+obj-$(CONFIG_RCAR_GEN3_THERMAL)+= rcar_gen3_thermal.o
 obj-$(CONFIG_KIRKWOOD_THERMAL)  += kirkwood_thermal.o
 obj-y  += samsung/
 obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o
diff --git a/drivers/thermal/rcar_gen3_thermal.c 
b/drivers/thermal/rcar_gen3_thermal.c
new file mode 100644
index 00..ef30d84b0f56a2
--- /dev/null
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -0,0 +1,324 @@
+/*
+ *  R-Car Gen3 THS thermal sensor driver
+ *  Based on rcar_thermal.c and work from Hien Dang and Khiem Nguyen.
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation.
+ * Copyright (C) 2016 Sang Engineering
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register offsets */
+#define REG_GEN3_IRQSTR0x04
+#define REG_GEN3_IRQMSK0x08
+#define REG_GEN3_IRQCTL0x0C
+#define REG_GEN3_IRQEN 0x10
+#define REG_GEN3_IRQTEMP1  0x14
+#define REG_GEN3_IRQTEMP2  0x18
+#define REG_GEN3_IRQTEMP3  0x1C
+#define REG_GEN3_CTSR  0x20
+#define REG_GEN3_THCTR 0x20
+#define REG_GEN3_TEMP  0x28
+#define REG_GEN3_THCODE1   0x50
+#define REG_GEN3_THCODE2   0x54
+#define REG_GEN3_THCODE3   0x58
+
+/* CTSR bits */
+#define CTSR_PONM  BIT(8)
+#define CTSR_AOUT  BIT(7)
+#define CTSR_THBGR BIT(5)
+#define CTSR_VMEN  BIT(4)
+#define CTSR_VMST  BIT(1)
+#define CTSR_THSST BIT(0)
+
+/* THCTR bits */
+#define THCTR_PONM BIT(6)
+#define THCTR_THSSTBIT(0)
+
+#define CTEMP_MASK 0xFFF
+
+#define MCELSIUS(temp) ((temp) * 1000)
+#define GEN3_FUSE_MASK 0xFFF
+
+#define TSC_MAX_NUM3
+
+/* Structure for thermal temperature calculation */
+struct equation_coefs {
+   s64 a1;
+   s64 b1;
+   s64 a2;
+   s64 b2;
+};
+
+struct rcar_gen3_thermal_tsc {
+   void __iomem *base;
+   struct thermal_zone_device *zone;
+   struct equation_coefs coef;
+   struct mutex lock;
+   u32 ctemp;
+};
+
+struct rcar_gen3_thermal_priv {
+   struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM];
+};
+
+struct rcar_gen3_thermal_data {
+   void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc);
+};
+
+/* Temperature calculation  */
+#define RCAR3_THERMAL_GRAN 500
+#define CODETSD(x) ((x) * 100

[PATCH v4 3/4] arm64: dts: r8a7795: Add R-Car Gen3 thermal support

2016-12-01 Thread Wolfram Sang
Signed-off-by: Hien Dang 
Signed-off-by: Thao Nguyen 
Signed-off-by: Khiem Nguyen 
Signed-off-by: Wolfram Sang 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 8c15040f2540d6..0699e04fbdf264 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1541,5 +1541,63 @@
};
};
};
+
+   tsc: thermal@e6198000 {
+   compatible = "renesas,r8a7795-thermal";
+   reg = <0 0xe6198000 0 0x68>,
+ <0 0xe61a 0 0x5c>,
+ <0 0xe61a8000 0 0x5c>;
+   interrupts = ,
+,
+;
+   clocks = <&cpg CPG_MOD 522>;
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   #thermal-sensor-cells = <1>;
+   status = "okay";
+   };
+
+   thermal-zones {
+   sensor_thermal1: sensor-thermal1 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 0>;
+
+   trips {
+   sensor1_crit: sensor1-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+
+   sensor_thermal2: sensor-thermal2 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 1>;
+
+   trips {
+   sensor2_crit: sensor2-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+
+   sensor_thermal3: sensor-thermal3 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 2>;
+
+   trips {
+   sensor3_crit: sensor3-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+   };
};
 };
-- 
2.10.2



[PATCH v4 1/4] thermal: rcar_gen3_thermal: Document the R-Car Gen3

2016-12-01 Thread Wolfram Sang
Signed-off-by: Hien Dang 
Signed-off-by: Khiem Nguyen 
Signed-off-by: Wolfram Sang 
---
 .../bindings/thermal/rcar-gen3-thermal.txt | 56 ++
 1 file changed, 56 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt

diff --git a/Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt 
b/Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt
new file mode 100644
index 00..07a9713ae6a757
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt
@@ -0,0 +1,56 @@
+* DT bindings for Renesas R-Car Gen3 Thermal Sensor driver
+
+On R-Car Gen3 SoCs, the thermal sensor controllers (TSC) control the thermal
+sensors (THS) which are the analog circuits for measuring temperature (Tj)
+inside the LSI.
+
+Required properties:
+- compatible   : "renesas,-thermal",
+ Examples with soctypes are:
+   - "renesas,r8a7795-thermal" (R-Car H3)
+   - "renesas,r8a7796-thermal" (R-Car M3-W)
+- reg  : Address ranges of the thermal registers. Each sensor
+ needs one address range. Sorting must be done in
+ increasing order according to datasheet, i.e.
+ TSC1, TSC2, ...
+- clocks   : Must contain a reference to the functional clock.
+- #thermal-sensor-cells : must be <1>.
+
+Optional properties:
+
+- interrupts   : interrupts routed to the TSC (3 for H3 and M3-W)
+- power-domain : Must contain a reference to the power domain. This
+ property is mandatory if the thermal sensor instance
+ is part of a controllable power domain.
+
+Example:
+
+   tsc: thermal@e6198000 {
+   compatible = "renesas,r8a7795-thermal";
+   reg = <0 0xe6198000 0 0x68>,
+ <0 0xe61a 0 0x5c>,
+ <0 0xe61a8000 0 0x5c>;
+   interrupts = ,
+,
+;
+   clocks = <&cpg CPG_MOD 522>;
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   #thermal-sensor-cells = <1>;
+   status = "okay";
+   };
+
+   thermal-zones {
+   sensor_thermal1: sensor-thermal1 {
+   polling-delay-passive = <250>;
+   polling-delay = <1000>;
+   thermal-sensors = <&tsc 0>;
+
+   trips {
+   sensor1_crit: sensor1-crit {
+   temperature = <9>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+   };
-- 
2.10.2



[PATCHv2 4/5] tests: Test suspend/resume on idle pipelines

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Provide a test to verify the hardware is functional both before and
after entering a suspend / resume cycle. Make use of the
/sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform
the testing

Signed-off-by: Kieran Bingham 

---
v2:

- extended pipeline test to run twice to verify stop->start process
- added return value checking to track test progress
- modified test reporting to be once per 'suspend mode'
- removed trailing ';' uses
- verify the pm_test mode is available, or skip

 tests/vsp-unit-test-0019.sh | 101 
 1 file changed, 101 insertions(+)
 create mode 100755 tests/vsp-unit-test-0019.sh

diff --git a/tests/vsp-unit-test-0019.sh b/tests/vsp-unit-test-0019.sh
new file mode 100755
index ..728dcdda29e6
--- /dev/null
+++ b/tests/vsp-unit-test-0019.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are idle
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still operable after resume.
+#
+# Format iteration loops are maintained, even with only one format so that this
+# test can be easily extended to try further formats if needed in the future.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+
+# Two formats are specified so that the test is run twice.
+# This ensures that stop -> start works both before and after suspend
+formats="RGB24 RGB24"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+test_wpf_packing() {
+   pipe_configure rpf-wpf 0 0
+   format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+   vsp_runner rpf.0 &
+   vsp_runner wpf.0
+
+   local result=$(compare_frames)
+   [ x$result == xpass ] && return 0 || return 1
+}
+
+test_hw_pipe() {
+   local format
+   local result
+
+   for format in $formats ; do
+   test_wpf_packing $format
+   result=$?
+
+   # return early on failure
+   [ $result != 0 ] && return 1
+   done
+
+   return 0
+}
+
+test_suspend_resume() {
+   local result=0
+
+   test_start "non-active pipeline suspend/resume in suspend:$mode"
+
+   # Verify the test is available
+   grep -q $mode /sys/power/pm_test
+   if [ $? != 0 ]; then
+   test_complete skip
+   return
+   fi
+
+   # Test the hardware each side of suspend resume
+   test_hw_pipe
+   result=$((result+$?))
+
+   # Set the test mode
+   echo $mode > /sys/power/pm_test
+
+   # Comence suspend
+   # The pm_test framework will automatically resume after 5 seconds
+   echo mem > /sys/power/state
+
+   # Verify the hardware is still operational
+   test_hw_pipe
+   result=$((result+$?))
+
+   if [ $result != 0 ]; then
+   test_complete "failed"
+   else
+   test_complete "passed"
+   fi
+}
+
+test_main() {
+   local mode
+
+   # Check for pm-suspend test option
+   if [ ! -e /sys/power/pm_test ] ; then
+   echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+   test_complete skip
+   return
+   fi
+
+   for mode in $suspend_modes ; do
+   test_suspend_resume $mode
+   done
+}
+
+test_init $0 "$features"
+test_run
-- 
2.7.4



[PATCHv2 3/5] logger: Log to the FTrace buffer if tracing is enabled

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Extend the logger such that it will detect the tracing system, and also
append print statement to this ring buffer.

This provides the relevant logging output interspersed in the ftrace
logs for an effective solution to identifying the actions that caused
the traces to occur

Signed-off-by: Kieran Bingham 
---
 scripts/logger.sh | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/logger.sh b/scripts/logger.sh
index 8123f0c9f6e3..8412b0ba9a08 100755
--- a/scripts/logger.sh
+++ b/scripts/logger.sh
@@ -6,6 +6,17 @@ now() {
 
 label=${1:+ [$1]}
 
+TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
+if [ -e $TRACE_MARKER ]; then
+   extra_log_files=$TRACE_MARKER
+fi
+
 while read line ; do
-   echo "$(now)$label $line"
+   newline="$(now)$label $line"
+
+   echo "$newline"
+
+   for f in $extra_log_files; do
+   echo "$newline" >> $f;
+   done;
 done
-- 
2.7.4



[PATCHv2 0/5] VSP-Tests: Add suspend resume tests and helpers

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Following on from previous useful feedback, I have reworked the supporting
scripts and tests.

Provide two tests for suspend/resume cycles. One will verify the VSP1 is
functional with a test before and after a suspend cycle. The other will
maintain an active pipeline which must succeed despite a suspend resume cycle
occuring in the middle of the test.

Along side these tests are a couple of helpers that I have locally and thought
they might be useful to others, so I'm posting for review. A test suite runner
simplifies executing all vsp-unit tests, and provides the ability to easily
repeat the test suite (for example to run an overnight longevity test).

'bin2png.sh' is a wrapper around the existing tools that helps convert the test
files generated by VSP-Tests into png files for easy viewing.

Finally, I have extended 'logger.sh' to also log to the FTrace buffer. As I have
been making greater use of ftrace for register write capture, and driver flow -
this addition helps separate multiple tests from the ftrace kernelshark view.

Kieran Bingham (5):
  scripts: Test suite runner
  scripts: Provide bin2png.sh helper
  logger: Log to the FTrace buffer if tracing is enabled
  tests: Test suspend/resume on idle pipelines
  tests: Test suspend/resume on active pipelines

 scripts/Makefile|   2 +-
 scripts/bin2png.sh  |  36 
 scripts/logger.sh   |  13 +-
 scripts/vsp-tests.sh|  49 +
 tests/vsp-unit-test-0019.sh | 101 
 tests/vsp-unit-test-0020.sh |  97 ++
 6 files changed, 296 insertions(+), 2 deletions(-)
 create mode 100755 scripts/bin2png.sh
 create mode 100755 scripts/vsp-tests.sh
 create mode 100755 tests/vsp-unit-test-0019.sh
 create mode 100755 tests/vsp-unit-test-0020.sh

-- 
2.7.4



[PATCHv2 1/5] scripts: Test suite runner

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Provide a utility script to execute all vsp unit tests, as well
as the option to execute multiple iterations of the suite.

Signed-off-by: Kieran Bingham 

---
v2
- remove spurious uses of ';'
- fix output logging

 scripts/vsp-tests.sh | 49 +
 1 file changed, 49 insertions(+)
 create mode 100755 scripts/vsp-tests.sh

diff --git a/scripts/vsp-tests.sh b/scripts/vsp-tests.sh
new file mode 100755
index ..8b21176ccc09
--- /dev/null
+++ b/scripts/vsp-tests.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+##
+## VSP Tests runner
+##
+## Automatically execute all vsp-unit tests
+## Move test failure results to a specific folder for
+## the running kernel version
+##
+## An argument can be provided to specify the number of
+## iterations to perform
+##
+## usage:
+##  ./vsp-tests.sh 
+##
+##   n: Number of iterations to execute test suite
+##
+
+KERNEL_VERSION=`uname -r`
+
+run_test() {
+   echo $1
+   ./$1
+
+   if [ $(ls *.bin 2>/dev/null | wc -l) != 0 ]
+   then
+   RESULTS_DIR=$KERNEL_VERSION/test-$1/$2/
+
+   echo "Moving *.bin to $RESULTS_DIR"
+   mkdir -p $RESULTS_DIR
+   mv *.bin $RESULTS_DIR
+   for f in $RESULTS_DIR/*.bin
+   do
+   ./bin2png.sh "$f"
+   done
+   fi
+}
+
+run_suite() {
+   echo "Test loop $1"
+
+   for test in vsp-unit-test*.sh; do
+   run_test $test $1;
+   done;
+}
+
+for loop in `seq 1 1 $1`; do
+   run_suite $loop
+done;
-- 
2.7.4



[PATCHv2 2/5] scripts: Provide bin2png.sh helper

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Identify the size and format from the test output filename, and pass
to raw2rgbpnm for conversion to a PNM file.

>From there we can convert easily to a PNG output file.

Signed-off-by: Kieran Bingham 

---
v2:

- use 'convert' to proces png files to png
- strip '.bin' from target filenames

 scripts/Makefile   |  2 +-
 scripts/bin2png.sh | 36 
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100755 scripts/bin2png.sh

diff --git a/scripts/Makefile b/scripts/Makefile
index 8c452f4c54ce..6586b2989aed 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -1,4 +1,4 @@
-SCRIPTS=logger.sh vsp-lib.sh
+SCRIPTS=$(wildcard *.sh)
 
 all:
 
diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh
new file mode 100755
index ..bde1ddfa3eab
--- /dev/null
+++ b/scripts/bin2png.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+FILE="$1"
+
+PNM=$(echo $FILE | sed -e 's|\.bin$|.pnm|')
+PNG=$(echo $FILE | sed -e 's|\.bin$|.png|')
+
+fmt=$(echo $FILE | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\1|')
+size=$(echo $FILE | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\2|')
+
+case $fmt in
+   yuv410m|yvu410m|yuv411m|yuv420m|yvu420m|yuv422m|yvu422m|yuv444m|yvu444m)
+   fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+   fmt=`echo $fmt | tr 'M' 'P'`
+   ;;
+   nv12m|nv21m|nv16m|nv61m)
+   fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+   fmt=`echo $fmt | tr -d 'M'`
+   ;;
+   argb555|xrgb555)
+   fmt=RGB555X
+   ;;
+   argb32|xrgb32)
+   fmt=RGB32
+   ;;
+   abgr32|xbgr32)
+   fmt=BGR32
+   ;;
+   *)
+   fmt=`echo $fmt | tr '[:lower:]' '[:upper:]'`
+   ;;
+esac
+
+raw2rgbpnm -s $size -f $fmt $FILE $PNM && \
+   convert $PNM $PNG
+rm $PNM
-- 
2.7.4



[PATCHv2 5/5] tests: Test suspend/resume on active pipelines

2016-12-01 Thread Kieran Bingham
From: Kieran Bingham 

Provide a test to verify the hardware completes a functional test whilst
performing a suspend resume cycle in parallel. Make use of the
/sys/power/pm_test functionality provided by CONFIG_PM_DEBUG to perform
the testing

Signed-off-by: Kieran Bingham 

---
v2:

- removed format iteration loop
- modified test reporting to be once per 'suspend mode'
- verify the pm_test mode is available, or skip

 tests/vsp-unit-test-0020.sh | 97 +
 1 file changed, 97 insertions(+)
 create mode 100755 tests/vsp-unit-test-0020.sh

diff --git a/tests/vsp-unit-test-0020.sh b/tests/vsp-unit-test-0020.sh
new file mode 100755
index ..c9e6b79e5d06
--- /dev/null
+++ b/tests/vsp-unit-test-0020.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+#
+# Test power-management suspend/resume whilst pipelines are active
+#
+# Utilise the basic RPF->WPF packing test case as a measure that the hardware
+# is operable while we perform test suspend and resume, and verify that it is
+# still successful even with a suspend resume cycle in the middle of the test.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 wpf.0"
+
+# These can be extracted from /sys/power/pm_test
+suspend_modes="freezer devices platform processors core"
+
+# This extended function performs the same
+# as it's non-extended name-sake - but runs the pipeline
+# for 300 frames. The suspend action occurs between frame #150~#200
+
+test_extended_wpf_packing() {
+   pipe_configure rpf-wpf 0 0
+   format_configure rpf-wpf 0 0 ARGB32 1024x768 $format
+
+   vsp_runner rpf.0 --count=300 &
+   vsp_runner wpf.0 --count=300 --skip=297
+
+   local result=$(compare_frames)
+
+   test_complete $result
+}
+
+test_hw_pipe() {
+   local format
+
+   for format in $formats ; do
+   test_extended_wpf_packing RGB24
+   done
+}
+
+test_suspend_resume() {
+   local result
+   local test_pid
+
+   test_start "Testing active pipeline suspend/resume in suspend:$mode"
+
+   # Verify the test is available
+   grep -q $mode /sys/power/pm_test
+   if [ $? != 0 ]; then
+   test_complete skip
+   return
+   fi
+
+   # Set the hardware running in parallel while we suspend
+   test_hw_pipe &
+   test_pid=$!
+
+   # Make sure the pipeline has time to start
+   sleep 1
+
+   # Set the test mode
+   echo $mode > /sys/power/pm_test
+
+   # Comence suspend
+   # The pm_test framework will automatically resume after 5 seconds
+   echo mem > /sys/power/state
+
+   # Wait for the pipeline to complete
+   wait $test_pid
+   result=$?
+
+   if [ $result == 0 ]; then
+   test_complete pass
+   else
+   test_complete fail
+   fi
+}
+
+test_main() {
+   local mode;
+   local suspend_test_failures
+
+   # Check for pm-suspend test option
+   if [ ! -e /sys/power/pm_test ] ; then
+   echo "$0: Suspend Resume testing requires CONFIG_PM_DEBUG"
+   test_complete skip
+   return
+   fi;
+
+   for mode in $suspend_modes ; do
+   test_suspend_resume $mode
+   done;
+}
+
+test_init $0 "$features"
+test_run
-- 
2.7.4



Re: [patch] net: renesas: ravb: unintialized return value

2016-12-01 Thread Sergei Shtylyov

Hello!

On 12/01/2016 11:57 PM, Dan Carpenter wrote:


We want to set the other "err" variable here so that we can return it
later.  My version of GCC misses this issue but I caught it with a
static checker.

Fixes: 9f70eb339f52 ("net: ethernet: renesas: ravb: fix fixed-link phydev 
leaks")


   Hm, I somehow missed this one, probably due to the horrific CC list. :-(


Signed-off-by: Dan Carpenter 


Acked-by: Sergei Shtylyov 

MBR, Sergei



[patch] net: renesas: ravb: unintialized return value

2016-12-01 Thread Dan Carpenter
We want to set the other "err" variable here so that we can return it
later.  My version of GCC misses this issue but I caught it with a
static checker.

Fixes: 9f70eb339f52 ("net: ethernet: renesas: ravb: fix fixed-link phydev 
leaks")
Signed-off-by: Dan Carpenter 
---
Applies to the net tree for 4.10.

diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
index 2c0357c..92d7692 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1016,8 +1016,6 @@ static int ravb_phy_init(struct net_device *ndev)
 * at this time.
 */
if (priv->chip_id == RCAR_GEN3) {
-   int err;
-
err = phy_set_max_speed(phydev, SPEED_100);
if (err) {
netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");


RE: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Chris Brandt
Hi Geert,

On 12/1/2016, Sergei Shtylyov wrote:
> 
> On 12/01/2016 05:42 PM, Geert Uytterhoeven wrote:
> 
> >> --- a/drivers/net/ethernet/renesas/sh_eth.c
> >> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> >> @@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = {
> >>
> >> .ecsr_value = ECSR_ICD,
> >> .ecsipr_value   = ECSIPR_ICDIP,
> >> -   .eesipr_value   = 0xff7f009f,
> >> +   .eesipr_value   = 0xe77f009f,
> >
> > Comment not directly related to the merits of this patch: the EESIPR
> > bit definitions seem to be identical to those for EESR, so we can get
> > rid of the hardcoded values here?
> 
> Do you mean using the @define's? We have EESIPR bits also declared,
> see enum DMAC_IM_BIT,


Is your idea to get rid of .eesipr_value for devices that have values
that are the same as .eesr_err_check?


For example in sh_eth_dev_init():

sh_eth_modify(ndev, EESR, 0, 0);
mdp->irq_enabled = true;
-   sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+   if (mdp->cd->eesipr_value)
+   sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+   else
+   sh_eth_write(ndev, mdp->cd->eesr_err_check, EESIPR);


Chris



[PATCH v3] sh_eth: remove unchecked interrupts for RZ/A1

2016-12-01 Thread Chris Brandt
When streaming a lot of data and the RZ/A1 can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.

irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 
Acked-by: Sergei Shtylyov 
---
v3:
* add RZ/A1 to subject line
v2:
* switched from modifying eesr_err_check to modifying eesipr_value
---
 drivers/net/ethernet/renesas/sh_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c 
b/drivers/net/ethernet/renesas/sh_eth.c
index 05b0dc5..1a92de7 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = {
 
.ecsr_value = ECSR_ICD,
.ecsipr_value   = ECSIPR_ICDIP,
-   .eesipr_value   = 0xff7f009f,
+   .eesipr_value   = 0xe77f009f,
 
.tx_check   = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
-- 
2.10.1




Re: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Sergei Shtylyov

On 12/01/2016 09:24 PM, Chris Brandt wrote:


One thing you've missed so far is mentioning R7S72100 (RZ/A1) in the
subject. This driver supports many SoCs, you're only fixing one of them...


For the last sh_eth.c patch I submitted, I had:

"net: ethernet: renesas: sh_eth: add POST registers for rz"


Should I resend the patch as:

"[PATCH v3] sh_eth: remove unchecked interrupts for RZ/A1"


??


   Yes, that will do.


Chris


MBR, Sergei



RE: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Chris Brandt
On 12/1/2016, Sergei Shtylyov wrote:
> One thing you've missed so far is mentioning R7S72100 (RZ/A1) in the
> subject. This driver supports many SoCs, you're only fixing one of them...

For the last sh_eth.c patch I submitted, I had:

"net: ethernet: renesas: sh_eth: add POST registers for rz"


Should I resend the patch as:

"[PATCH v3] sh_eth: remove unchecked interrupts for RZ/A1"


??

Chris



Re: [PATCH] pinctrl: sh-pfc: r8a7791: Add ADI pinconf support

2016-12-01 Thread jac...@jmondi.org

Hi Laurent, Geert,
   thanks for review

On 29/11/2016 22:39, Geert Uytterhoeven wrote:

Hi Laurent,

On Tue, Nov 29, 2016 at 8:30 PM, Laurent Pinchart
 wrote:

On Tuesday 29 Nov 2016 10:11:56 Jacopo Mondi wrote:

Add pin configuration support for Gyro-ADC, named ADI on r8a7791 SoC.

The Gyro-ADC supports three different configurations:
a single ADC (adi and adi_b groups), 2 ADCs selectable through a single
channel select signal (adi_chsel1 and adi_chsel1_b groups),


I've only briefly looked up at the datasheet, but is that a supported mode ?
It seems that mode 1 uses 4 channels and mode 2 and 3 use 8 channels.


I think you can always connect less ADCs than there are channels.
If you connect e.g. only one, you don't need any CHS signals.
If you connect e.g. two, you can use only one CHS signal.

AFAICS, you still have to use an external demux to create individual chip
selects from the single CS signal and (up to 3) CHS signals.


Actually Laurent's right and I have mis-interpreted the CHS signal purpose.

The CHS signal are not intended to select an external ADC where to 
sample from among the several connected ones, but instead to select 
which line to drive to a single ADC.


Quoting the processor manual, ADI supports three different ADC models 
through 3 different "modes"

- mode1: MB88101A
- mode2: ADCS7476/ADC121 and AD7476
- mode3: MAX1162
and cycles through channels moving the CHS[0:1] lines in mode1, and 
CHS[0:2] lines in mode2 and mode3.


Actually, being the MB88101A a 4-channel ADC, the CHS[0:1] lines could 
be connected to the ADC itself and used to cycle between its 4 input pins.
In mode2 and mode3 an external DEMUX is probably required, as the 
supported ADCs for these modes are single-channel ones.


For pin configuration purposes anyway, it's enough to know that we 
cannot split CHS signals in three separate groups, but in 2 only (one 
for mode1 and one for mode2 and 3).


Will send v2 shortly.
Thanks
   j




Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds





Re: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Sergei Shtylyov

On 12/01/2016 08:36 PM, Sergei Shtylyov wrote:


When streaming a lot of data and the RZ can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.

irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 


Acked-by: Sergei Shtylyov 


   One thing you've missed so far is mentioning R7S72100 (RZ/A1) in the 
subject. This driver supports many SoCs, you're only fixing one of them...


MBR, Sergei



Re: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Sergei Shtylyov

On 12/01/2016 05:42 PM, Geert Uytterhoeven wrote:


--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = {

.ecsr_value = ECSR_ICD,
.ecsipr_value   = ECSIPR_ICDIP,
-   .eesipr_value   = 0xff7f009f,
+   .eesipr_value   = 0xe77f009f,


Comment not directly related to the merits of this patch: the EESIPR bit
definitions seem to be identical to those for EESR, so we can get rid of the
hardcoded values here?


   Do you mean using the @define's? We have EESIPR bits also declared, see 
enum DMAC_IM_BIT,


[...]

MBR, Sergei



Re: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Sergei Shtylyov

On 12/01/2016 05:06 PM, Chris Brandt wrote:


When streaming a lot of data and the RZ can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.

irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 


Acked-by: Sergei Shtylyov 

MBR, Sergei



Re: [PATCH/RFC v2 i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Simon Horman
On Thu, Dec 01, 2016 at 04:55:13PM +0100, Geert Uytterhoeven wrote:
> Hi Simon,
> 
> On Thu, Dec 1, 2016 at 4:41 PM, Simon Horman  
> wrote:
> > In the case of Renesas R-Car hardware we know that there are generations of
> > SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
> > relationship between IP blocks might be. For example, I believe that
> > r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
> > descendant of the former or vice versa.
> >
> > We can, however, by examining the documentation and behaviour of the
> > hardware at run-time observe that the current driver implementation appears
> > to be compatible with the IP blocks on SoCs within a given generation.
> >
> > For the above reasons and convenience when enabling new SoCs a
> > per-generation fallback compatibility string scheme being adopted for
> > drivers for Renesas SoCs.
> >
> > Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
> > compatible with R-Car Gen 1. It also appears unused in mainline.
> >
> > Signed-off-by: Simon Horman 
> > ---
> > Include accidently omitted i2c-rcar.c portion of patch
> > ---
> >  Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 32 
> > ++
> >  drivers/i2c/busses/i2c-rcar.c  |  5 +++-
> >  2 files changed, 24 insertions(+), 13 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
> > b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > index 239632a0d709..8c679b17c4c6 100644
> > --- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > +++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> > @@ -1,17 +1,25 @@
> >  I2C for R-Car platforms
> >
> >  Required properties:
> > -- compatible: Must be one of
> > -   "renesas,i2c-rcar"
> > -   "renesas,i2c-r8a7778"
> > -   "renesas,i2c-r8a7779"
> > -   "renesas,i2c-r8a7790"
> > -   "renesas,i2c-r8a7791"
> > -   "renesas,i2c-r8a7792"
> > -   "renesas,i2c-r8a7793"
> > -   "renesas,i2c-r8a7794"
> > -   "renesas,i2c-r8a7795"
> > -   "renesas,i2c-r8a7796"
> > +- compatible:
> > +   "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC.
> > +   "renesas,i2c-r8a7779" if the device is a part of a R8A7797 SoC.
> > +   "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
> > +   "renesas,i2c-r8a7791" if the device is a part of a R8A7791 SoC.
> > +   "renesas,i2c-r8a7792" if the device is a part of a R8A7792 SoC.
> > +   "renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
> > +   "renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
> > +   "renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
> > +   "renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
> > +   "renesas,i2c-rcar-gen1" for a generic R-Car Gen1 compatible device.
> > +   "renesas,i2c-rcar-gen2" for a generic R-Car Gen2 compatible device.
> > +   "renesas,i2c-rcar-gen3" for a generic R-Car Gen3 compatible device.
> 
> "renesas,rcar-gen1-i2c" etc.
> 
> > +   "renesas,i2c-rcar" (deprecated)
> > +
> > +   When compatible with the generic version, nodes must list the
> > +   SoC-specific version corresponding to the platform first followed
> > +   by the generic version.
> > +
> >  - reg: physical base address of the controller and length of memory mapped
> >region.
> >  - interrupts: interrupt specifier.
> > @@ -33,7 +41,7 @@ Examples :
> >  i2c0: i2c@e6508000 {
> > #address-cells = <1>;
> > #size-cells = <0>;
> > -   compatible = "renesas,i2c-r8a7791";
> > +   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
> 
> "renesas,rcar-gen2-i2c"
> 
> > reg = <0 0xe6508000 0 0x40>;
> > interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
> > clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > index 726615e54f2a..622def6b43e2 100644
> > --- a/drivers/i2c/busses/i2c-rcar.c
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -793,7 +793,6 @@ static const struct i2c_algorithm rcar_i2c_algo = {
> >  };
> >
> >  static const struct of_device_id rcar_i2c_dt_ids[] = {
> > -   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
> > { .compatible = "renesas,i2c-r8a7778", .data = (void 
> > *)I2C_RCAR_GEN1 },
> > { .compatible = "renesas,i2c-r8a7779", .data = (void 
> > *)I2C_RCAR_GEN1 },
> > { .compatible = "renesas,i2c-r8a7790", .data = (void 
> > *)I2C_RCAR_GEN2 },
> > @@ -803,6 +802,10 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
> > { .compatible = "renesas,i2c-r8a7794", .data = (void 
> > *)I2C_RCAR_GEN2 },
> > { .compatible = "renesas,i2c-r8a7795", .data = (void 
> > *)I2C_RCAR_GEN3 },
> > { .compatible = "renesas,i2c-r8a7796", .data = (void 
> > *)I2C_RCAR_GEN3 },
> > +   { .compatible = "renesas,i2c-rcar", .data = (v

[PATCH pci/next] PCI: rcar: Add gen3 fallback compatibility string for pcie-rcar

2016-12-01 Thread Simon Horman
Add fallback compatibility string for the  R-Car Gen 3 family.  This is in
keeping with the both the existing fallback compatibility string for the
R-Car Gen 2 family and the fallback scheme being adopted wherever
appropriate for drivers for Renesas SoCs.

Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/pci/rcar-pci.txt | 1 +
 drivers/pci/host/pcie-rcar.c   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/pci/rcar-pci.txt 
b/Documentation/devicetree/bindings/pci/rcar-pci.txt
index 6cf99690eef9..eee518db90b9 100644
--- a/Documentation/devicetree/bindings/pci/rcar-pci.txt
+++ b/Documentation/devicetree/bindings/pci/rcar-pci.txt
@@ -7,6 +7,7 @@ compatible: "renesas,pcie-r8a7779" for the R8A7779 SoC;
"renesas,pcie-r8a7793" for the R8A7793 SoC;
"renesas,pcie-r8a7795" for the R8A7795 SoC;
"renesas,pcie-rcar-gen2" for a generic R-Car Gen2 compatible device.
+   "renesas,pcie-rcar-gen3" for a generic R-Car Gen3 compatible device.
 
When compatible with the generic version, nodes must list the
SoC-specific version corresponding to the platform first
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 62700d1896f4..962aa3942107 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -1077,6 +1077,8 @@ static const struct of_device_id rcar_pcie_of_match[] = {
  .data = rcar_pcie_hw_init_gen2 },
{ .compatible = "renesas,pcie-r8a7791",
  .data = rcar_pcie_hw_init_gen2 },
+   { .compatible = "renesas,pcie-rcar-gen3",
+ .data = rcar_pcie_hw_init_hw_init },
{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
{},
 };
-- 
2.7.0.rc3.207.g0ac5344



Re: [PATCH/RFC v2 i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Geert Uytterhoeven
Hi Simon,

On Thu, Dec 1, 2016 at 4:41 PM, Simon Horman  wrote:
> In the case of Renesas R-Car hardware we know that there are generations of
> SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
> relationship between IP blocks might be. For example, I believe that
> r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
> descendant of the former or vice versa.
>
> We can, however, by examining the documentation and behaviour of the
> hardware at run-time observe that the current driver implementation appears
> to be compatible with the IP blocks on SoCs within a given generation.
>
> For the above reasons and convenience when enabling new SoCs a
> per-generation fallback compatibility string scheme being adopted for
> drivers for Renesas SoCs.
>
> Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
> compatible with R-Car Gen 1. It also appears unused in mainline.
>
> Signed-off-by: Simon Horman 
> ---
> Include accidently omitted i2c-rcar.c portion of patch
> ---
>  Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 32 
> ++
>  drivers/i2c/busses/i2c-rcar.c  |  5 +++-
>  2 files changed, 24 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
> b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> index 239632a0d709..8c679b17c4c6 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> @@ -1,17 +1,25 @@
>  I2C for R-Car platforms
>
>  Required properties:
> -- compatible: Must be one of
> -   "renesas,i2c-rcar"
> -   "renesas,i2c-r8a7778"
> -   "renesas,i2c-r8a7779"
> -   "renesas,i2c-r8a7790"
> -   "renesas,i2c-r8a7791"
> -   "renesas,i2c-r8a7792"
> -   "renesas,i2c-r8a7793"
> -   "renesas,i2c-r8a7794"
> -   "renesas,i2c-r8a7795"
> -   "renesas,i2c-r8a7796"
> +- compatible:
> +   "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC.
> +   "renesas,i2c-r8a7779" if the device is a part of a R8A7797 SoC.
> +   "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
> +   "renesas,i2c-r8a7791" if the device is a part of a R8A7791 SoC.
> +   "renesas,i2c-r8a7792" if the device is a part of a R8A7792 SoC.
> +   "renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
> +   "renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
> +   "renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
> +   "renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
> +   "renesas,i2c-rcar-gen1" for a generic R-Car Gen1 compatible device.
> +   "renesas,i2c-rcar-gen2" for a generic R-Car Gen2 compatible device.
> +   "renesas,i2c-rcar-gen3" for a generic R-Car Gen3 compatible device.

"renesas,rcar-gen1-i2c" etc.

> +   "renesas,i2c-rcar" (deprecated)
> +
> +   When compatible with the generic version, nodes must list the
> +   SoC-specific version corresponding to the platform first followed
> +   by the generic version.
> +
>  - reg: physical base address of the controller and length of memory mapped
>region.
>  - interrupts: interrupt specifier.
> @@ -33,7 +41,7 @@ Examples :
>  i2c0: i2c@e6508000 {
> #address-cells = <1>;
> #size-cells = <0>;
> -   compatible = "renesas,i2c-r8a7791";
> +   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";

"renesas,rcar-gen2-i2c"

> reg = <0 0xe6508000 0 0x40>;
> interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 726615e54f2a..622def6b43e2 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -793,7 +793,6 @@ static const struct i2c_algorithm rcar_i2c_algo = {
>  };
>
>  static const struct of_device_id rcar_i2c_dt_ids[] = {
> -   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
> { .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 
> },
> { .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 
> },
> { .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 
> },
> @@ -803,6 +802,10 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
> { .compatible = "renesas,i2c-r8a7794", .data = (void *)I2C_RCAR_GEN2 
> },
> { .compatible = "renesas,i2c-r8a7795", .data = (void *)I2C_RCAR_GEN3 
> },
> { .compatible = "renesas,i2c-r8a7796", .data = (void *)I2C_RCAR_GEN3 
> },
> +   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },  
>   // Deprecated
> +   { .compatible = "renesas,rcar-gen1-i2c", .data = (void 
> *)I2C_RCAR_GEN1 },
> +   { .compatible = "renesas,rcar-gen2-i2c", .data = (void 
> *)I2C_RCAR_GEN2 },
> +   { .compatible = "renesas,rcar-gen3-i2c", .data = (void 
> *)I2

[PATCH/RFC v2 i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Simon Horman
In the case of Renesas R-Car hardware we know that there are generations of
SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
relationship between IP blocks might be. For example, I believe that
r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
descendant of the former or vice versa.

We can, however, by examining the documentation and behaviour of the
hardware at run-time observe that the current driver implementation appears
to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a
per-generation fallback compatibility string scheme being adopted for
drivers for Renesas SoCs.

Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
compatible with R-Car Gen 1. It also appears unused in mainline.

Signed-off-by: Simon Horman 
---
Include accidently omitted i2c-rcar.c portion of patch
---
 Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 32 ++
 drivers/i2c/busses/i2c-rcar.c  |  5 +++-
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index 239632a0d709..8c679b17c4c6 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -1,17 +1,25 @@
 I2C for R-Car platforms
 
 Required properties:
-- compatible: Must be one of
-   "renesas,i2c-rcar"
-   "renesas,i2c-r8a7778"
-   "renesas,i2c-r8a7779"
-   "renesas,i2c-r8a7790"
-   "renesas,i2c-r8a7791"
-   "renesas,i2c-r8a7792"
-   "renesas,i2c-r8a7793"
-   "renesas,i2c-r8a7794"
-   "renesas,i2c-r8a7795"
-   "renesas,i2c-r8a7796"
+- compatible:
+   "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC.
+   "renesas,i2c-r8a7779" if the device is a part of a R8A7797 SoC.
+   "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
+   "renesas,i2c-r8a7791" if the device is a part of a R8A7791 SoC.
+   "renesas,i2c-r8a7792" if the device is a part of a R8A7792 SoC.
+   "renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
+   "renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
+   "renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
+   "renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
+   "renesas,i2c-rcar-gen1" for a generic R-Car Gen1 compatible device.
+   "renesas,i2c-rcar-gen2" for a generic R-Car Gen2 compatible device.
+   "renesas,i2c-rcar-gen3" for a generic R-Car Gen3 compatible device.
+   "renesas,i2c-rcar" (deprecated)
+
+   When compatible with the generic version, nodes must list the
+   SoC-specific version corresponding to the platform first followed
+   by the generic version.
+
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: interrupt specifier.
@@ -33,7 +41,7 @@ Examples :
 i2c0: i2c@e6508000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6508000 0 0x40>;
interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 726615e54f2a..622def6b43e2 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -793,7 +793,6 @@ static const struct i2c_algorithm rcar_i2c_algo = {
 };
 
 static const struct of_device_id rcar_i2c_dt_ids[] = {
-   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
@@ -803,6 +802,10 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
{ .compatible = "renesas,i2c-r8a7794", .data = (void *)I2C_RCAR_GEN2 },
{ .compatible = "renesas,i2c-r8a7795", .data = (void *)I2C_RCAR_GEN3 },
{ .compatible = "renesas,i2c-r8a7796", .data = (void *)I2C_RCAR_GEN3 },
+   { .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
// Deprecated
+   { .compatible = "renesas,rcar-gen1-i2c", .data = (void *)I2C_RCAR_GEN1 
},
+   { .compatible = "renesas,rcar-gen2-i2c", .data = (void *)I2C_RCAR_GEN2 
},
+   { .compatible = "renesas,rcar-gen3-i2c", .data = (void *)I2C_RCAR_GEN3 
},
{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
-- 
2.7.0.rc3.207.g0ac5344



Re: [PATCH/RFC i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Simon Horman
On Thu, Dec 01, 2016 at 04:18:14PM +0100, Simon Horman wrote:
> In the case of Renesas R-Car hardware we know that there are generations of
> SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
> relationship between IP blocks might be. For example, I believe that
> r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
> descendant of the former or vice versa.
> 
> We can, however, by examining the documentation and behaviour of the
> hardware at run-time observe that the current driver implementation appears
> to be compatible with the IP blocks on SoCs within a given generation.
> 
> For the above reasons and convenience when enabling new SoCs a
> per-generation fallback compatibility string scheme being adopted for
> drivers for Renesas SoCs.
> 
> Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
> compatible with R-Car Gen 1. It also appears unused in mainline.
> 
> Signed-off-by: Simon Horman 

Sorry, I seem to have omitted the driver (C code) portion of this change.
I send v2.


Re: [PATCH/RFC i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Geert Uytterhoeven
Hi Simon,

On Thu, Dec 1, 2016 at 4:18 PM, Simon Horman  wrote:
> In the case of Renesas R-Car hardware we know that there are generations of
> SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
> relationship between IP blocks might be. For example, I believe that
> r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
> descendant of the former or vice versa.
>
> We can, however, by examining the documentation and behaviour of the
> hardware at run-time observe that the current driver implementation appears
> to be compatible with the IP blocks on SoCs within a given generation.
>
> For the above reasons and convenience when enabling new SoCs a
> per-generation fallback compatibility string scheme being adopted for
> drivers for Renesas SoCs.
>
> Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
> compatible with R-Car Gen 1. It also appears unused in mainline.
>
> Signed-off-by: Simon Horman 
> ---
>  Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 32 
> ++
>  1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
> b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> index 239632a0d709..8c679b17c4c6 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
> @@ -1,17 +1,25 @@
>  I2C for R-Car platforms
>
>  Required properties:
> -- compatible: Must be one of
> -   "renesas,i2c-rcar"
> -   "renesas,i2c-r8a7778"
> -   "renesas,i2c-r8a7779"
> -   "renesas,i2c-r8a7790"
> -   "renesas,i2c-r8a7791"
> -   "renesas,i2c-r8a7792"
> -   "renesas,i2c-r8a7793"
> -   "renesas,i2c-r8a7794"
> -   "renesas,i2c-r8a7795"
> -   "renesas,i2c-r8a7796"
> +- compatible:
> +   "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC.
> +   "renesas,i2c-r8a7779" if the device is a part of a R8A7797 SoC.
> +   "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
> +   "renesas,i2c-r8a7791" if the device is a part of a R8A7791 SoC.
> +   "renesas,i2c-r8a7792" if the device is a part of a R8A7792 SoC.
> +   "renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
> +   "renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
> +   "renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
> +   "renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
> +   "renesas,i2c-rcar-gen1" for a generic R-Car Gen1 compatible device.
> +   "renesas,i2c-rcar-gen2" for a generic R-Car Gen2 compatible device.
> +   "renesas,i2c-rcar-gen3" for a generic R-Car Gen3 compatible device.

Please use "renesas,-" when adding family-specific
compatible values where non are defined yet.

I.e.
"renesas,rcar-gen1-i2c"
"renesas,rcar-gen1-i2c"
"renesas,rcar-gen1-i2c"

> +   "renesas,i2c-rcar" (deprecated)
> +
> +   When compatible with the generic version, nodes must list the
> +   SoC-specific version corresponding to the platform first followed
> +   by the generic version.
> +
>  - reg: physical base address of the controller and length of memory mapped
>region.
>  - interrupts: interrupt specifier.
> @@ -33,7 +41,7 @@ Examples :
>  i2c0: i2c@e6508000 {
> #address-cells = <1>;
> #size-cells = <0>;
> -   compatible = "renesas,i2c-r8a7791";
> +   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";

"renesas,rcar-gen2-i2c".

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH/RFC i2c/for-next] i2c: rcar: Add per-Generation fallback bindings

2016-12-01 Thread Simon Horman
In the case of Renesas R-Car hardware we know that there are generations of
SoCs, e.g. Gen 2 and Gen 3. But beyond that its not clear what the
relationship between IP blocks might be. For example, I believe that
r8a7790 is older than r8a7791 but that doesn't imply that the latter is a
descendant of the former or vice versa.

We can, however, by examining the documentation and behaviour of the
hardware at run-time observe that the current driver implementation appears
to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a
per-generation fallback compatibility string scheme being adopted for
drivers for Renesas SoCs.

Also deprecate renesas,i2c-rcar. It seems poorly named as it is only
compatible with R-Car Gen 1. It also appears unused in mainline.

Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 32 ++
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index 239632a0d709..8c679b17c4c6 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -1,17 +1,25 @@
 I2C for R-Car platforms
 
 Required properties:
-- compatible: Must be one of
-   "renesas,i2c-rcar"
-   "renesas,i2c-r8a7778"
-   "renesas,i2c-r8a7779"
-   "renesas,i2c-r8a7790"
-   "renesas,i2c-r8a7791"
-   "renesas,i2c-r8a7792"
-   "renesas,i2c-r8a7793"
-   "renesas,i2c-r8a7794"
-   "renesas,i2c-r8a7795"
-   "renesas,i2c-r8a7796"
+- compatible:
+   "renesas,i2c-r8a7778" if the device is a part of a R8A7778 SoC.
+   "renesas,i2c-r8a7779" if the device is a part of a R8A7797 SoC.
+   "renesas,i2c-r8a7790" if the device is a part of a R8A7790 SoC.
+   "renesas,i2c-r8a7791" if the device is a part of a R8A7791 SoC.
+   "renesas,i2c-r8a7792" if the device is a part of a R8A7792 SoC.
+   "renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
+   "renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
+   "renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
+   "renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
+   "renesas,i2c-rcar-gen1" for a generic R-Car Gen1 compatible device.
+   "renesas,i2c-rcar-gen2" for a generic R-Car Gen2 compatible device.
+   "renesas,i2c-rcar-gen3" for a generic R-Car Gen3 compatible device.
+   "renesas,i2c-rcar" (deprecated)
+
+   When compatible with the generic version, nodes must list the
+   SoC-specific version corresponding to the platform first followed
+   by the generic version.
+
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: interrupt specifier.
@@ -33,7 +41,7 @@ Examples :
 i2c0: i2c@e6508000 {
#address-cells = <1>;
#size-cells = <0>;
-   compatible = "renesas,i2c-r8a7791";
+   compatible = "renesas,i2c-r8a7791", "renesas,i2c-rcar-gen2";
reg = <0 0xe6508000 0 0x40>;
interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
-- 
2.7.0.rc3.207.g0ac5344



[RFC] mmc: tmio: use SDIO master interrupt bit only when allowed

2016-12-01 Thread Wolfram Sang
The master bit to enable SDIO interrupts can only be accessed if
SCLKDIVEN bit allows that. However, the core uses the SDIO enable
callback at times when SCLKDIVEN forbids the change. This leads to
"timeout waiting for SD bus idle" messages.

We now activate the master bit in probe once if SDIO is supported. IRQ
en-/disabling will be done now by the individual IRQ enablement bits
only.

Signed-off-by: Wolfram Sang 
---

Compile tested only, due to no testcase.

 drivers/mmc/host/tmio_mmc_pio.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 700567603107a0..476c4e1094a014 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -140,12 +140,10 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host 
*mmc, int enable)
 
host->sdio_irq_mask = TMIO_SDIO_MASK_ALL &
~TMIO_SDIO_STAT_IOIRQ;
-   sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);
sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
} else if (!enable && host->sdio_irq_enabled) {
host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
-   sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x);
 
host->sdio_irq_enabled = false;
pm_runtime_mark_last_busy(mmc_dev(mmc));
@@ -1137,7 +1135,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
sd_ctrl_write16(_host, CTL_SDIO_IRQ_MASK, _host->sdio_irq_mask);
-   sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x);
+   sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0001);
}
 
spin_lock_init(&_host->lock);
@@ -1185,6 +1183,9 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
struct platform_device *pdev = host->pdev;
struct mmc_host *mmc = host->mmc;
 
+   if (host->pdata->flags & TMIO_MMC_SDIO_IRQ)
+   sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x);
+
if (!host->native_hotplug)
pm_runtime_get_sync(&pdev->dev);
 
-- 
2.10.2



Re: mmc: tmio: why enable/disable SDIO irq on every transaction with IOMOD?

2016-12-01 Thread Wolfram Sang
Hi,

> Is Arnd Hannemann, the author, around these days by any chance?

According to git history, he is sending a patch occasionally, but all
his SH involvement was from 2010. I don't know him.

> We don't have it yet.  A question we have is that where should we
> enable / disable the IOMOD?

I think unconditionally in probe. I will send an RFC with some
explanations in a minute.

Thanks,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH 0/4] ARM, arm64: dts: Use usb-phy fallback bindings

2016-12-01 Thread Geert Uytterhoeven
On Thu, Dec 1, 2016 at 3:25 PM, Simon Horman  wrote:
> this short series makes use of fallback bindings for Renesas R-Car PHY
> drivers in the DT of SoCs which already use those drivers.
>
> Simon Horman (4):
>   ARM: dts: r8a7790: Use renesas,rcar-gen2-usb-phy fallback binding
>   ARM: dts: r8a7791: Use renesas,rcar-gen2-usb-phy fallback binding
>   ARM: dts: r8a7794: Use renesas,rcar-gen2-usb-phy fallback binding
>   arm64: dts: r8a7795: Use renesas,rcar-gen3-usb2-phy fallback binding

Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Geert Uytterhoeven
Hi Chris,

On Thu, Dec 1, 2016 at 3:06 PM, Chris Brandt  wrote:
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = {
>
> .ecsr_value = ECSR_ICD,
> .ecsipr_value   = ECSIPR_ICDIP,
> -   .eesipr_value   = 0xff7f009f,
> +   .eesipr_value   = 0xe77f009f,

Comment not directly related to the merits of this patch: the EESIPR bit
definitions seem to be identical to those for EESR, so we can get rid of the
hardcoded values here?

>
> .tx_check   = EESR_TC1 | EESR_FTC,
> .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] PM / Domains: Do not print PM domain add error message if EPROBE_DEFER

2016-12-01 Thread Rafael J. Wysocki
On Wednesday, November 30, 2016 01:24:56 PM Geert Uytterhoeven wrote:
> EPROBE_DEFER is not an error, hence printing an error message like
> 
> renesas_irqc e61c.interrupt-controller: failed to add to PM domain 
> always-on: -517
> 
> may confuse the user.
> 
> Suppress the error message in case of EPROBE_DEFER to fix this.
> 
> Reported-by: Yoshihiro Shimoda 
> Signed-off-by: Geert Uytterhoeven 
> ---
>  drivers/base/power/domain.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 64164aac6ae3990a..f22137b52dcb641b 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2032,8 +2032,9 @@ int genpd_dev_pm_attach(struct device *dev)
>   mutex_unlock(&gpd_list_lock);
>  
>   if (ret < 0) {
> - dev_err(dev, "failed to add to PM domain %s: %d",
> - pd->name, ret);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "failed to add to PM domain %s: %d",
> + pd->name, ret);
>   goto out;
>   }
>  
> 

Applied (with ACKs etc).

Thanks,
Rafael



[PATCH 2/4] ARM: dts: r8a7791: Use renesas,rcar-gen2-usb-phy fallback binding

2016-12-01 Thread Simon Horman
A fallback binding for the Renesas R-Car Gen2 PHY driver was
added by commit cb8ba08d ("phy: rcar-gen2: add fallback binding").
This patch makes use of this binding in the DT for the r8a7791 SoC.

Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7791.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 4c50de2faef1..a14f0ae8c8dd 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -934,7 +934,8 @@
};
 
usbphy: usb-phy@e6590100 {
-   compatible = "renesas,usb-phy-r8a7791";
+   compatible = "renesas,usb-phy-r8a7791",
+"renesas,rcar-gen2-usb-phy";
reg = <0 0xe6590100 0 0x100>;
#address-cells = <1>;
#size-cells = <0>;
-- 
2.7.0.rc3.207.g0ac5344



[PATCH 3/4] ARM: dts: r8a7794: Use renesas,rcar-gen2-usb-phy fallback binding

2016-12-01 Thread Simon Horman
A fallback binding for the Renesas R-Car Gen2 PHY driver was
added by commit cb8ba08d ("phy: rcar-gen2: add fallback binding").
This patch makes use of this binding in the DT for the r8a7794 SoC.

Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7794.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 63dc7f29d216..5caa8b9181d8 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -878,7 +878,8 @@
};
 
usbphy: usb-phy@e6590100 {
-   compatible = "renesas,usb-phy-r8a7794";
+   compatible = "renesas,usb-phy-r8a7794",
+"renesas,rcar-gen2-usb-phy";
reg = <0 0xe6590100 0 0x100>;
#address-cells = <1>;
#size-cells = <0>;
-- 
2.7.0.rc3.207.g0ac5344



[PATCH 4/4] arm64: dts: r8a7795: Use renesas,rcar-gen3-usb2-phy fallback binding

2016-12-01 Thread Simon Horman
A fallback binding for the Renesas R-Car Gen3 for USB2.0 PHY driver was
added by commit cde7bc367f09 ("phy: rcar-gen3-usb2: add fallback binding").
This patch makes use of this binding in the DT for the r8a7795 SoC.

Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index a39a702b904d..080f1f422cfc 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1141,7 +1141,8 @@
};
 
usb2_phy0: usb-phy@ee080200 {
-   compatible = "renesas,usb2-phy-r8a7795";
+   compatible = "renesas,usb2-phy-r8a7795",
+"renesas,rcar-gen3-usb2-phy";
reg = <0 0xee080200 0 0x700>;
interrupts = ;
clocks = <&cpg CPG_MOD 703>;
@@ -1151,7 +1152,8 @@
};
 
usb2_phy1: usb-phy@ee0a0200 {
-   compatible = "renesas,usb2-phy-r8a7795";
+   compatible = "renesas,usb2-phy-r8a7795",
+"renesas,rcar-gen3-usb2-phy";
reg = <0 0xee0a0200 0 0x700>;
clocks = <&cpg CPG_MOD 702>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
@@ -1160,7 +1162,8 @@
};
 
usb2_phy2: usb-phy@ee0c0200 {
-   compatible = "renesas,usb2-phy-r8a7795";
+   compatible = "renesas,usb2-phy-r8a7795",
+"renesas,rcar-gen3-usb2-phy";
reg = <0 0xee0c0200 0 0x700>;
clocks = <&cpg CPG_MOD 701>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
-- 
2.7.0.rc3.207.g0ac5344



[PATCH 1/4] ARM: dts: r8a7790: Use renesas,rcar-gen2-usb-phy fallback binding

2016-12-01 Thread Simon Horman
A fallback binding for the Renesas R-Car Gen2 PHY driver was
added by commit cb8ba08d ("phy: rcar-gen2: add fallback binding").
This patch makes use of this binding in the DT for the r8a7790 SoC.

Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7790.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index f554ef3c8096..38111bddbd05 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -883,7 +883,8 @@
};
 
usbphy: usb-phy@e6590100 {
-   compatible = "renesas,usb-phy-r8a7790";
+   compatible = "renesas,usb-phy-r8a7790",
+"renesas,rcar-gen2-usb-phy";
reg = <0 0xe6590100 0 0x100>;
#address-cells = <1>;
#size-cells = <0>;
-- 
2.7.0.rc3.207.g0ac5344



[PATCH 0/4] ARM, arm64: dts: Use usb-phy fallback bindings

2016-12-01 Thread Simon Horman
Hi,

this short series makes use of fallback bindings for Renesas R-Car PHY
drivers in the DT of SoCs which already use those drivers.

Simon Horman (4):
  ARM: dts: r8a7790: Use renesas,rcar-gen2-usb-phy fallback binding
  ARM: dts: r8a7791: Use renesas,rcar-gen2-usb-phy fallback binding
  ARM: dts: r8a7794: Use renesas,rcar-gen2-usb-phy fallback binding
  arm64: dts: r8a7795: Use renesas,rcar-gen3-usb2-phy fallback binding

 arch/arm/boot/dts/r8a7790.dtsi   | 3 ++-
 arch/arm/boot/dts/r8a7791.dtsi   | 3 ++-
 arch/arm/boot/dts/r8a7794.dtsi   | 3 ++-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 9 ++---
 4 files changed, 12 insertions(+), 6 deletions(-)

-- 
2.7.0.rc3.207.g0ac5344



[PATCH v2] sh_eth: remove unchecked interrupts

2016-12-01 Thread Chris Brandt
When streaming a lot of data and the RZ can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.

irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 
---
v2:
* switched from modifying eesr_err_check to modifying eesipr_value
---
 drivers/net/ethernet/renesas/sh_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c 
b/drivers/net/ethernet/renesas/sh_eth.c
index 05b0dc5..1a92de7 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = {
 
.ecsr_value = ECSR_ICD,
.ecsipr_value   = ECSIPR_ICDIP,
-   .eesipr_value   = 0xff7f009f,
+   .eesipr_value   = 0xe77f009f,
 
.tx_check   = EESR_TC1 | EESR_FTC,
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
-- 
2.10.1




Re: [PATCH] pinctrl: sh-pfc: r8a7793: Implement voltage switching for SDHI

2016-12-01 Thread Geert Uytterhoeven
On Thu, Dec 1, 2016 at 2:21 PM, Simon Horman  wrote:
> Voltage switching is the same as on the r8a7791.
>
> Cc: Wolfram Sang 
> Signed-off-by: Simon Horman 

Reviewed-by: Geert Uytterhoeven 

Will queue in sh-pfc-for-v4.11.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] pinctrl: sh-pfc: r8a7793: Implement voltage switching for SDHI

2016-12-01 Thread Wolfram Sang
On Thu, Dec 01, 2016 at 02:21:07PM +0100, Simon Horman wrote:
> Voltage switching is the same as on the r8a7791.
> 
> Cc: Wolfram Sang 
> Signed-off-by: Simon Horman 

Reviewed-by: Wolfram Sang 



signature.asc
Description: PGP signature


[PATCH] pinctrl: sh-pfc: r8a7793: Implement voltage switching for SDHI

2016-12-01 Thread Simon Horman
Voltage switching is the same as on the r8a7791.

Cc: Wolfram Sang 
Signed-off-by: Simon Horman 
---
Based on sh-pfc-for-v4.10-tag2
---
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 7ca37c3019ab..e8de975b3a58 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
@@ -6455,6 +6455,7 @@ const struct sh_pfc_soc_info r8a7791_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7793
 const struct sh_pfc_soc_info r8a7793_pinmux_info = {
.name = "r8a77930_pfc",
+   .ops = &r8a7791_pinmux_ops,
.unlock_reg = 0xe606, /* PMMR */
 
.function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
-- 
2.7.0.rc3.207.g0ac5344



Re: [PATCH] can: rcar_canfd: Correct order of interrupt specifiers

2016-12-01 Thread Marc Kleine-Budde
On 11/23/2016 02:44 PM, Geert Uytterhoeven wrote:
> According to both DTS (example and actual files), and Linux driver code,
> the first interrupt specifier should be the Channel interrupt, while the
> second interrupt specifier should be the Global interrupt.
> 
> Signed-off-by: Geert Uytterhoeven 

Added to can-next.

Thanks,
Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


RE: [PATCH] sh_eth: add missing checks for status bits

2016-12-01 Thread Chris Brandt
On 12/1/2016, Sergei Shtylyov wrote:

> Hello!
> 
> Please always CC me on the sh_eth/ravb driver patches as directed by
> scripts/get_maintainer.pl.

OK. I'm sorry.


> On 11/30/2016 11:01 PM, Chris Brandt wrote:
> 
> > When streaming a lot of data and the RZ can't keep up, some status
> > bits will get set that are not being checked or cleared which cause
> > the following messages and the Ethernet driver to stop working. This
> > patch fixes that issue.
> 
> Perhaps we should just clear the correspoding bits in EESIPR instead?
> They are not set for any other SoC...


That's a good point. If we don't plan on doing anything with those bits, they 
should not be causing interrupts.

I will try change and then re-test.


Chris



Re: mmc: tmio: why enable/disable SDIO irq on every transaction with IOMOD?

2016-12-01 Thread Yasushi SHOJI
Hi Wolfram,

On Thu, 01 Dec 2016 19:46:22 +0900,
Wolfram Sang wrote:
> 
> > > So my question is that "What is the reason behind to disable IRQ with
> > > SDIO_MODE?  Is there any situation which masking with SDIO_INFO1_MASK
> > > is not enough?
> 
> The code was introduced with 845ecd20239c28 ("mmc: tmio_mmc: implement
> SDIO IRQ support") which was in 2010. I don't have that old datasheets
> to check if the SCLKDIVEN restriction was already present in the SDHI
> cores which were available back then.

Is Arnd Hannemann, the author, around these days by any chance?

Or does anyone on the list have a shareable old datasheet?  The one we
have is the one for R-Mobile A1 and has CONFIDENTIAL on it.

> My assumption is that it was not, or it was overlooked. So, it might be
> just for completeness that not only the individual IRQs have been
> disabled but also the big master switch (IOMOD) was turned off.
> 
> My further assumption is that it is very likely good enough to disable
> the individual IRQs. If we can't guarantee the conditions to set IOMOD,
> it seems okay to me to just leave it.

Yes that's what we think and what we see with our test code, which is
just the original without IOMOD removed.

> Do you have a patch which works for you?

We don't have it yet.  A question we have is that where should we
enable / disable the IOMOD?

Do we have to keep it disabled while the controller is in non-SDIO?
The spec says that we don't get SDIO irq while in non-SDIO mode.  But
should we trust?

Or, should we disable it when we switch back to non-SDIO mode and
enable when we detect SDIO?

Please enlighten us this area.  We'll submit the proper fix once we
know how we should do it.

Thanks,
-- 
yashi


Re: mmc: tmio: why enable/disable SDIO irq on every transaction with IOMOD?

2016-12-01 Thread Wolfram Sang
Hi,

thanks for the report and thanks to Ulf for forwarding. Adding
renesas-soc list, too.

> > So my question is that "What is the reason behind to disable IRQ with
> > SDIO_MODE?  Is there any situation which masking with SDIO_INFO1_MASK
> > is not enough?

This code predates the time since I took over maintainership of the
driver, so I had to dig in git history.

The code was introduced with 845ecd20239c28 ("mmc: tmio_mmc: implement
SDIO IRQ support") which was in 2010. I don't have that old datasheets
to check if the SCLKDIVEN restriction was already present in the SDHI
cores which were available back then.

My assumption is that it was not, or it was overlooked. So, it might be
just for completeness that not only the individual IRQs have been
disabled but also the big master switch (IOMOD) was turned off.

My further assumption is that it is very likely good enough to disable
the individual IRQs. If we can't guarantee the conditions to set IOMOD,
it seems okay to me to just leave it.

Do you have a patch which works for you?

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH] arm64: dts: r8a7795: salvator-x: Set drive-strength for ravb pins

2016-12-01 Thread Geert Uytterhoeven
Hi Niklas,

On Thu, Dec 1, 2016 at 11:29 AM, Niklas Söderlund
 wrote:
> On 2016-12-01 10:13:56 +0100, Geert Uytterhoeven wrote:
>> On Mon, Nov 28, 2016 at 12:46 PM, Niklas Söderlund
>> > diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
>> > b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
>> > index b1eab68..7f49d19 100644
>> > --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
>> > +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
>> > @@ -225,8 +225,32 @@
>> > };
>> >
>> > avb_pins: avb {
>> > -   groups = "avb_mdc";
>> > -   function = "avb";
>> > +   mux {
>> > +   groups = "avb_mdc", "avb_mii";
>> > +   function = "avb";
>> > +   };
>> > +
>> > +   pins_mdc {
>> > +   groups = "avb_mdc";
>> > +   drive-strength = <24>;
>> > +   };
>> > +
>> > +   pins_mii_tx {
>> > +   pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", 
>> > "PIN_AVB_TD0",
>> > +  "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
>> > +   drive-strength = <12>;
>> > +   };
>> > +
>> > +   pins_mii_rx {
>> > +   pins = "PIN_AVB_RX_CTL", "PIN_AVB_RXC", 
>> > "PIN_AVB_RD0",
>> > +  "PIN_AVB_RD1", "PIN_AVB_RD2", "PIN_AVB_RD3";
>> > +   drive-strength = <24>;
>> > +   };
>> > +
>> > +   pins_mii_clk {
>> > +   pins = "PIN_AVB_TXCREFCLK";
>> > +   drive-strength = <24>;
>> > +   };
>> > };
>> >
>> > du_pins: du {
>>
>> What about AVB_PHY_INT and AVB_LINK?
>> Or don't you need to specify their drive strengths, as they are input 
>> signals?
>> Then what about pins_mii_rx, they're also input signals?
>
> Wops, I was not aware of the u-boot repository you link bellow so was
> looking at git://git.denx.de/u-boot-sh.git which also have some
> salvator-x code, but nothing for EtherAVB.
>
> My assumption hence was that it only used the pins from the avb_mdc
> group and pins which could not be muxed, this is incorrect since u-boot
> setup more pinmuxing.  So there are more pin groups which should be
> added to the mux section (at least).  If I look at the u-boot code pins
> missing in DT are:
>
> - AVB_AVTP_CAPTURE_A
> - AVB_AVTP_MATCH_A
> - AVB_LINK
> - AVB_PHY_INT
> - AVB_MAGIC
>
> I will add the pin groups which contain those pins to the mux section.

Note that AVB_AVTP_CAPTURE_A, AVB_AVTP_MATCH_A, and AVB_MAGIC are not
used on Salvator-X.

>> BTW, the latest public U-Boot seems to configure just AVB_TX_CTL, AVB_TXC,
>> and AVB_TXD[0-3] for 12 mA, cfr.
>> https://github.com/renesas-rcar/u-boot/blob/v2015.04/rcar-3.4.0/board/renesas/salvator-x/salvator-x.c#L158
>>
>> According to the datasheet, the reset values of all signals are 15 mA on H3 
>> ES1,
>> and 24 mA on M3-W and H3 ES2.0.
>
> This is good information, but how to make best use of it? Should I in DT
> set the drive-strength for all pins or just the pins which diverge from
> the reset default values? I think it's best to set them for all pins
> since we should not depend on the bootloader, do you agree?

For input-only pins, drive strength should not matter at all, so I think you
should leave it out.
For other (used) pins, I think it should be specified.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] Platform: vsp1: Clean up file handle in open() error path.

2016-12-01 Thread Laurent Pinchart
Hi Shailendra,

Thank you for the patch.

On Thursday 01 Dec 2016 10:20:18 Shailendra Verma wrote:
> v4l2_fh_init is already done.So call the v4l2_fh_exit in error condition
> before returing from the function.
> 
> Signed-off-by: Shailendra Verma 

Reviewed-by: Laurent Pinchart 

and applied to my tree for v4.11.

> ---
>  drivers/media/platform/vsp1/vsp1_video.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> b/drivers/media/platform/vsp1/vsp1_video.c index d351b9c..cc58163 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -1044,6 +1044,7 @@ static int vsp1_video_open(struct file *file)
>   ret = vsp1_device_get(video->vsp1);
>   if (ret < 0) {
>   v4l2_fh_del(vfh);
> + v4l2_fh_exit(vfh);
>   kfree(vfh);
>   }

-- 
Regards,

Laurent Pinchart



Re: [PATCH] arm64: dts: r8a7795: salvator-x: Set drive-strength for ravb pins

2016-12-01 Thread Niklas Söderlund
Hi Geert,

Thanks for your feedback.

On 2016-12-01 10:13:56 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Mon, Nov 28, 2016 at 12:46 PM, Niklas Söderlund
>  wrote:
> > The EthernetAVB should not depend on the bootloader to setup correct
> > drive-strength values. Values for drive-strength where found by examine
> 
> examining
> 
> > the registers after the bootloader have configured the registers and
> 
> has
> 

Thanks.

> > successfully used the EthernetAVB.
> >
> > Signed-off-by: Niklas Söderlund 
> > ---
> >  arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 28 
> > --
> >  1 file changed, 26 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
> > b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> > index b1eab68..7f49d19 100644
> > --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> > +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> > @@ -225,8 +225,32 @@
> > };
> >
> > avb_pins: avb {
> > -   groups = "avb_mdc";
> > -   function = "avb";
> > +   mux {
> > +   groups = "avb_mdc", "avb_mii";
> > +   function = "avb";
> > +   };
> > +
> > +   pins_mdc {
> > +   groups = "avb_mdc";
> > +   drive-strength = <24>;
> > +   };
> > +
> > +   pins_mii_tx {
> > +   pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", 
> > "PIN_AVB_TD0",
> > +  "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
> > +   drive-strength = <12>;
> > +   };
> > +
> > +   pins_mii_rx {
> > +   pins = "PIN_AVB_RX_CTL", "PIN_AVB_RXC", 
> > "PIN_AVB_RD0",
> > +  "PIN_AVB_RD1", "PIN_AVB_RD2", "PIN_AVB_RD3";
> > +   drive-strength = <24>;
> > +   };
> > +
> > +   pins_mii_clk {
> > +   pins = "PIN_AVB_TXCREFCLK";
> > +   drive-strength = <24>;
> > +   };
> > };
> >
> > du_pins: du {
> 
> What about AVB_PHY_INT and AVB_LINK?
> Or don't you need to specify their drive strengths, as they are input signals?
> Then what about pins_mii_rx, they're also input signals?

Wops, I was not aware of the u-boot repository you link bellow so was 
looking at git://git.denx.de/u-boot-sh.git which also have some 
salvator-x code, but nothing for EtherAVB.

My assumption hence was that it only used the pins from the avb_mdc 
group and pins which could not be muxed, this is incorrect since u-boot 
setup more pinmuxing.  So there are more pin groups which should be 
added to the mux section (at least).  If I look at the u-boot code pins 
missing in DT are:

- AVB_AVTP_CAPTURE_A
- AVB_AVTP_MATCH_A
- AVB_LINK
- AVB_PHY_INT
- AVB_MAGIC

I will add the pin groups which contain those pins to the mux section.

> 
> BTW, the latest public U-Boot seems to configure just AVB_TX_CTL, AVB_TXC,
> and AVB_TXD[0-3] for 12 mA, cfr.
> https://github.com/renesas-rcar/u-boot/blob/v2015.04/rcar-3.4.0/board/renesas/salvator-x/salvator-x.c#L158
> 
> According to the datasheet, the reset values of all signals are 15 mA on H3 
> ES1,
> and 24 mA on M3-W and H3 ES2.0.

This is good information, but how to make best use of it? Should I in DT 
set the drive-strength for all pins or just the pins which diverge from 
the reset default values? I think it's best to set them for all pins 
since we should not depend on the bootloader, do you agree?

> 
> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds

-- 
Regards,
Niklas Söderlund


Re: [PATCH] sh_eth: add missing checks for status bits

2016-12-01 Thread Sergei Shtylyov

Hello!

   Please always CC me on the sh_eth/ravb driver patches as directed by 
scripts/get_maintainer.pl.


On 11/30/2016 11:01 PM, Chris Brandt wrote:


When streaming a lot of data and the RZ can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.


   Perhaps we should just clear the correspoding bits in EESIPR instead? They 
are not set for any other SoC...



irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 


MBR, Sergei



Re: [PATCH] sh_eth: add missing checks for status bits

2016-12-01 Thread Sergei Shtylyov

Hello!

On 12/1/2016 11:52 AM, Simon Horman wrote:


When streaming a lot of data and the RZ can't keep up, some status bits
will get set that are not being checked or cleared which cause the
following messages and the Ethernet driver to stop working. This
patch fixes that issue.

irq 21: nobody cared (try booting with the "irqpoll" option)
handlers:
[] sh_eth_interrupt
Disabling IRQ #21

Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
Signed-off-by: Chris Brandt 


Hi Chris,

I am wondering if the EESR_FRC but should also be checked.


   EESR.FRC is not an error bit and it's part of EESR_RX_CHECK already.

MBR, Sergei



Re: [PATCH] arm64: dts: r8a7795: salvator-x: Set drive-strength for ravb pins

2016-12-01 Thread Geert Uytterhoeven
Hi Niklas,

On Mon, Nov 28, 2016 at 12:46 PM, Niklas Söderlund
 wrote:
> The EthernetAVB should not depend on the bootloader to setup correct
> drive-strength values. Values for drive-strength where found by examine

examining

> the registers after the bootloader have configured the registers and

has

> successfully used the EthernetAVB.
>
> Signed-off-by: Niklas Söderlund 
> ---
>  arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 28 
> --
>  1 file changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
> b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> index b1eab68..7f49d19 100644
> --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> @@ -225,8 +225,32 @@
> };
>
> avb_pins: avb {
> -   groups = "avb_mdc";
> -   function = "avb";
> +   mux {
> +   groups = "avb_mdc", "avb_mii";
> +   function = "avb";
> +   };
> +
> +   pins_mdc {
> +   groups = "avb_mdc";
> +   drive-strength = <24>;
> +   };
> +
> +   pins_mii_tx {
> +   pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", "PIN_AVB_TD0",
> +  "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
> +   drive-strength = <12>;
> +   };
> +
> +   pins_mii_rx {
> +   pins = "PIN_AVB_RX_CTL", "PIN_AVB_RXC", "PIN_AVB_RD0",
> +  "PIN_AVB_RD1", "PIN_AVB_RD2", "PIN_AVB_RD3";
> +   drive-strength = <24>;
> +   };
> +
> +   pins_mii_clk {
> +   pins = "PIN_AVB_TXCREFCLK";
> +   drive-strength = <24>;
> +   };
> };
>
> du_pins: du {

What about AVB_PHY_INT and AVB_LINK?
Or don't you need to specify their drive strengths, as they are input signals?
Then what about pins_mii_rx, they're also input signals?

BTW, the latest public U-Boot seems to configure just AVB_TX_CTL, AVB_TXC,
and AVB_TXD[0-3] for 12 mA, cfr.
https://github.com/renesas-rcar/u-boot/blob/v2015.04/rcar-3.4.0/board/renesas/salvator-x/salvator-x.c#L158

According to the datasheet, the reset values of all signals are 15 mA on H3 ES1,
and 24 mA on M3-W and H3 ES2.0.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [GIT PULL] Renesas ARM Based SoC Match Updates for v4.10

2016-12-01 Thread Arnd Bergmann
On Thursday, December 1, 2016 9:47:58 AM CET Simon Horman wrote:

> Thanks for pulling this and other outstanding pull requests from Geert and
> myself. I don't think we have anything more outstanding at this time.

Ok, thanks for the confirmation!

Arnd


[PATCH] arm64: dts: h3ulcb: Provide sd0_uhs node

2016-12-01 Thread Simon Horman
Provide separaate sd0 and sd0_uhs nodes rather than duplicate sd0 nodes.

Cc: Vladimir Barinov 
Cc: Sergei Shtylyov 
Fixes: 93373c309a70 ("arm64: dts: h3ulcb: rename SDHI0 pins")
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index 6ffb0517421a..dbea2c3d8f0c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -169,7 +169,7 @@
power-source = <3300>;
};
 
-   sdhi0_pins_uhs: sd0 {
+   sdhi0_pins_uhs: sd0_uhs {
groups = "sdhi0_data4", "sdhi0_ctrl";
function = "sdhi0";
power-source = <1800>;
-- 
2.7.0.rc3.207.g0ac5344



Re: [PATCH] pinctrl: sh-pfc: r8a7791: Add ADI pinconf support

2016-12-01 Thread Geert Uytterhoeven
Hi Jacopo,

On Tue, Nov 29, 2016 at 10:11 AM, Jacopo Mondi  wrote:
> Add pin configuration support for Gyro-ADC, named ADI on r8a7791 SoC.
>
> The Gyro-ADC supports three different configurations:
> a single ADC (adi and adi_b groups), 2 ADCs selectable through a single
> channel select signal (adi_chsel1 and adi_chsel1_b groups), up to 4 ADCs
> through 2 channel select signals (adi_chsel2 and adi_chsel2_b groups)
> and up to 8 ADCs through 3 channel select signals (adi_chsel3 and
> adi_chsel3_b groups)
>
> Signed-off-by: Jacopo Mondi 

> +static const char * const adi_groups[] = {
> +   "adi",

As the group names below have a suffix ("_chselX"), I think it would be
good to have a suffix in this group name, too.
Usually we have splits like "data" and "ctrl", but in this case, the group
covers both data and control signals.
"adi_common"? "adi_base"? "adi_spi" (but it's only SPI in mode 2/3)?

I'm out of inspiration...

> +   "adi_chsel1",
> +   "adi_chsel2",
> +   "adi_chsel3",

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] sh_eth: add missing checks for status bits

2016-12-01 Thread Simon Horman
On Wed, Nov 30, 2016 at 03:01:48PM -0500, Chris Brandt wrote:
> When streaming a lot of data and the RZ can't keep up, some status bits
> will get set that are not being checked or cleared which cause the
> following messages and the Ethernet driver to stop working. This
> patch fixes that issue.
> 
> irq 21: nobody cared (try booting with the "irqpoll" option)
> handlers:
> [] sh_eth_interrupt
> Disabling IRQ #21
> 
> Fixes: db893473d313a4ad ("sh_eth: Add support for r7s72100")
> Signed-off-by: Chris Brandt 

Hi Chris,

I am wondering if the EESR_FRC but should also be checked.

> ---
>  drivers/net/ethernet/renesas/sh_eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c 
> b/drivers/net/ethernet/renesas/sh_eth.c
> index 05b0dc5..079f10e 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -523,7 +523,7 @@ static struct sh_eth_cpu_data r7s72100_data = {
>   .tx_check   = EESR_TC1 | EESR_FTC,
>   .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
> EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
> -   EESR_TDE | EESR_ECI,
> +   EESR_TDE | EESR_ECI | EESR_TUC | EESR_ROC,
>   .fdr_value  = 0x070f,
>  
>   .no_psr = 1,
> -- 
> 2.10.1
> 
> 


Re: [GIT PULL] Renesas ARM Based SoC Match Updates for v4.10

2016-12-01 Thread Simon Horman
On Wed, Nov 30, 2016 at 04:50:20PM +0100, Arnd Bergmann wrote:
> On Wednesday, November 23, 2016 9:13:31 PM CET Simon Horman wrote:
> > This pull request is based on the pull request "soc_device_match()
> > interface for matching against soc_bus attributes" sent by Geert
> > Uytterhoeven which corresponds to the soc-device-match-tag1 tag in his
> > renesas-driver's tree. It provides infrastructure used by changes in this
> > pull request.
> > 
> > This pull request is broken out of an earlier pull request,
> > "Second Round of Renesas ARM Based SoC Drivers Updates for v4.10".
> > The motivation for breaking up the pull request is to provide
> > branches with minimal dependencies.
> > 
> > This pull request is targeted at the next/drivers branch of the arm-soc 
> > tree.
> > 
> > It introduces some minor merge conflicts in drivers/soc/renesas/Makefile.
> > The resolution is to take both sides.  A sample merge resolution is
> > provided in the renesas-next-20161123v2-v4.9-rc1 tag of the renesas tree.
> > 
> 
> Pulled into next/drivers, thanks!

Thanks for pulling this and other outstanding pull requests from Geert and
myself. I don't think we have anything more outstanding at this time.