Re: [PATCH 3/3] arm64: dts: renesas: draak: Describe HDMI input

2018-05-13 Thread Laurent Pinchart
Hello,

On Sunday, 13 May 2018 15:57:55 EEST Niklas Söderlund wrote:
> On 2018-05-11 12:00:02 +0200, Jacopo Mondi wrote:
> > Describe HDMI input connected to VIN4 interface for R-Car D3 Draak
> > development board.
> > 
> > Signed-off-by: Jacopo Mondi 
> > ---
> > 
> >  arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 68 +
> >  1 file changed, 68 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> > b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts index d03f194..e0ce462
> > 100644
> > --- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> > +++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> > @@ -59,6 +59,17 @@
> > 
> > };
> > 
> > };
> > 
> > +   hdmi-in {
> > +   compatible = "hdmi-connector";
> > +   type = "a";
> > +
> > +   port {
> > +   hdmi_con_in: endpoint {
> > +   remote-endpoint = <_in>;
> > +   };
> > +   };
> > +   };
> > +
> > 
> > memory@4800 {
> > 
> > device_type = "memory";
> > /* first 128MB is reserved for secure area. */
> > 
> > @@ -142,6 +153,11 @@
> > 
> > groups = "usb0";
> > function = "usb0";
> > 
> > };
> > 
> > +
> > +   vin4_pins: vin4 {
> > +   groups = "vin4_data24", "vin4_sync", "vin4_clk", "vin4_clkenb";
> > +   function = "vin4";
> > +   };
> > 
> >  };
> >  
> >   {
> > 
> > @@ -154,6 +170,35 @@
> > 
> > reg = <0x50>;
> > pagesize = <8>;
> > 
> > };
> > 
> > +
> > +   hdmi-decoder@4c {
> > +   compatible = "adi,adv7612";
> > +   reg = <0x4c>;
> > +   default-input = <0>;
> > +
> > +   ports {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   port@0 {
> > +   reg = <0>;
> > +   adv7612_in: endpoint {
> > +   remote-endpoint = <_con_in>;
> > +   };
> > +   };
> > +
> > +   port@2 {
> > +   reg = <2>;
> > +   adv7612_out: endpoint {
> > +   pclk-sample = <0>;
> > +   hsync-active = <0>;
> > +   vsync-active = <0>;
> 
> This differs from the Gen2 DT bindings which is a very similar hardware
> setup using the same components. Defining these properties will make the
> bus marked as V4L2_MBUS_PARALLEL instead of V4L2_MBUS_BT656.
> 
> This will change how the hardware is configured for capture if the media
> bus is in a UYVY format, see VNMC_INF register in rvin_setup(). Maybe
> this it not an issue here but still I'm curious to why this differ
> between Gen2 and Gen3 :-)
> 
> > +
> > +   remote-endpoint = <_in>;
> > +   };
> > +   };
> > +   };
> > +   };
> > 
> >  };
> >  
> >   {
> > 
> > @@ -246,3 +291,26 @@
> > 
> > timeout-sec = <60>;
> > status = "okay";
> >  
> >  };
> > 
> > +
> > + {
> > +   pinctrl-0 = <_pins>;
> > +   pinctrl-names = "default";
> > +
> > +   status = "okay";
> > +
> > +   ports {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +
> > +   port@0 {
> > +   reg = <0>;
> > +
> > +   vin4_in: endpoint {
> > +   hsync-active = <0>;
> > +   vsync-active = <0>;
> 
> Comparing this to the Gen2 bindings some properties are missing,
> 
> bus-width = <24>;
> pclk-sample = <1>;
> data-active = <1>;
> 
> This is not a big deal as the VIN driver don't use these properties so
> no functional change should come of this but still a difference.

I think the VIN DT bindings should be updated to explicitly list the endpoint 
properties that are mandatory, optional, or not allowed.

> Over all I'm happy with this change but before I add my tag I would like
> to understand why it differs from the Gen2 configuration for the adv7612
> properties.
> 
> Also on a side not it is possible with hardware switches on the board
> switch the VIN4 source to a completely different pipeline CVBS connector
> -> adv7180 -> VIN4. But I think it's best we keep the HDMI as default as
> this seems to be how the boards are shipped. But maybe mentioning this
> in the commit message would not hurt if you end-up resending the patch.
> 
> > +
> > +   remote-endpoint = <_out>;
> > +   };
> > +   };
> > +   };
> > +};

-- 
Regards,

Laurent Pinchart





Re: [PATCH 2/3] arm64: dts: renesas: r8a77995: Add VIN4

2018-05-13 Thread Laurent Pinchart
Hello,

On Friday, 11 May 2018 16:45:16 EEST Simon Horman wrote:
> On Fri, May 11, 2018 at 01:25:23PM +0200, Niklas Söderlund wrote:
> > Hi Jacopo,
> > 
> > Thanks for your work.
> > 
> > On 2018-05-11 12:00:01 +0200, Jacopo Mondi wrote:
> > > Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> > > 
> > > Signed-off-by: Jacopo Mondi 
> > 
> > Acked-by: Niklas Söderlund 
> > 
> >> ---
> >> 
> >>  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++
> >>  1 file changed, 11 insertions(+)
> >> 
> >> diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> >> b/arch/arm64/boot/dts/renesas/r8a77995.dtsi index 82aed7e..bdf7017
> >> 100644
> >> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> >> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> >> @@ -783,6 +783,17 @@
> >>};
> >>};
> >>};
> >> +
> >> +  vin4: video@e6ef4000 {
> >> +  compatible = "renesas,vin-r8a77995";
> >> +  reg = <0 0xe6ef4000 0 0x1000>;
> >> +  interrupts = ;
> >> +  clocks = < CPG_MOD 807>;
> >> +  power-domains = < R8A77995_PD_ALWAYS_ON>;
> >> +  resets = < 807>;
> >> +  renesas,id = <4>;
> >> +  status = "disabled";
> >> +  };
> >>};
> 
> Thanks, I have moved the new node to preserve sorting of nodes by bus
> address and applied the result. It is as follows:
> 
> From: Jacopo Mondi 
> Subject: [PATCH] arm64: dts: renesas: r8a77995: Add VIN4
> 
> Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> 
> Signed-off-by: Jacopo Mondi 
> Acked-by: Niklas Söderlund 
> [simon: sorted node by bus address]
> Signed-off-by: Simon Horman 

Reviewed-by: Laurent Pinchart 

> ---
>  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> b/arch/arm64/boot/dts/renesas/r8a77995.dtsi index
> ba98865b0c9b..2506f46293e8 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> @@ -610,6 +610,17 @@
>   status = "disabled";
>   };
> 
> + vin4: video@e6ef4000 {
> + compatible = "renesas,vin-r8a77995";
> + reg = <0 0xe6ef4000 0 0x1000>;
> + interrupts = ;
> + clocks = < CPG_MOD 807>;
> + power-domains = < R8A77995_PD_ALWAYS_ON>;
> + resets = < 807>;
> + renesas,id = <4>;
> + status = "disabled";
> + };
> +
>   ohci0: usb@ee08 {
>   compatible = "generic-ohci";
>   reg = <0 0xee08 0 0x100>;

-- 
Regards,

Laurent Pinchart





Re: [PATCH 1/3] dt-bindings: media: rcar-vin: Add R8A77995 support

2018-05-13 Thread Laurent Pinchart
Hi Jacopo,

Thank you for the patch.

On Friday, 11 May 2018 13:00:00 EEST Jacopo Mondi wrote:
> Add compatible string for R-Car D3 R8A7795 to list of SoCs supported by
> rcar-vin driver.
> 
> Signed-off-by: Jacopo Mondi 

Reviewed-by: Laurent Pinchart 

> ---
>  Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt
> b/Documentation/devicetree/bindings/media/rcar_vin.txt index
> a19517e1..5c6f2a7 100644
> --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
> +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> @@ -22,6 +22,7 @@ on Gen3 platforms to a CSI-2 receiver.
> - "renesas,vin-r8a7795" for the R8A7795 device
> - "renesas,vin-r8a7796" for the R8A7796 device
> - "renesas,vin-r8a77970" for the R8A77970 device
> +   - "renesas,vin-r8a77995" for the R8A77995 device
> - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
>   device.

-- 
Regards,

Laurent Pinchart





RE: [PATCH/RFC v2 1/6] dt-bindings: usb: add Renesas R-Car USB 3.0 role switch

2018-05-13 Thread Yoshihiro Shimoda
Hi Rob,

> From: Rob Herring, Sent: Saturday, May 12, 2018 1:07 AM
> 
> On Mon, May 7, 2018 at 9:43 PM, Yoshihiro Shimoda
>  wrote:
> > Hi Rob,
> >
> > Sorry for the delayed response. I had a vacation in last week.
> >
> >> From: Rob Herring, Sent: Saturday, April 28, 2018 5:06 AM
> >>
> >> On Thu, Apr 26, 2018 at 08:26:41PM +0900, Yoshihiro Shimoda wrote:
> >> > This patch adds a new documentation for Renesas R-Car USB 3.0 role
> >> > switch that can change the USB 3.0 role to either host or peripheral
> >> > by a hardware register that is included in USB3.0 peripheral module.
> >> >
> >> > Signed-off-by: Yoshihiro Shimoda 
> >> > ---
> >> >  .../bindings/usb/renesas,rcar-usb3-role-sw.txt | 47 
> >> > ++
> >> >  1 file changed, 47 insertions(+)
> >> >  create mode 100644 
> >> > Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
> >> >
> >> > diff --git 
> >> > a/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
> >> b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
> >> > new file mode 100644
> >> > index 000..e074c03
> >> > --- /dev/null
> >> > +++ b/Documentation/devicetree/bindings/usb/renesas,rcar-usb3-role-sw.txt
> >> > @@ -0,0 +1,47 @@
> >> > +Renesas Electronics R-Car USB 3.0 role switch
> >> > +
> >> > +A renesas_usb3's node can contain this node.
> >> > +
> >> > +Required properties:
> >> > + - compatible: Must contain "renesas,rcar-usb3-role-switch".
> >> > +
> >> > +Required nodes:
> >> > + - The connection to a usb3.0 host node needs by using OF graph 
> >> > bindings.
> >> > +  - port@0 = USB 3.0 host port
> >> > +  - port@1 = USB 3.0 peripheral port
> >> > +
> >> > +Example of R-Car H3 ES2.0:
> >> > +   usb3_peri0: usb@ee02 {
> >> > +   compatible = "renesas,r8a7795-usb3-peri",
> >> > +"renesas,rcar-gen3-usb3-peri";
> >> > +   reg = <0 0xee02 0 0x400>;
> >> > +   interrupts = ;
> >> > +   clocks = < CPG_MOD 328>;
> >> > +   power-domains = < R8A7795_PD_ALWAYS_ON>;
> >> > +   resets = < 328>;
> >> > +
> >> > +   usb3-role-sw {
> >> > +   compatible = "renesas,rcar-usb3-role-switch";
> >>
> >> You don't define any h/w resources. How is this device accessed?
> >
> > This device accesses one of registers in the usb3_peri0.
> > In the detail, the usb3-role-sw uses 0xee020218 (32-bit register) only.
> > (Unfortunately, the hardware design is not good...)
> >
> > In this case, should I describe the following in the usb3-role-sw node?
> >
> > reg = <0 0xee020218 0 4>;
> >
> > Or, shouldn't I add the usb3-role-sw node and a driver for usb3_peri0 should
> > take care for it?
> 
> IMO, the driver should take care of it.

Thank you for the reply. I'll modify the usb3_peri0 driver for role switch.

Best regards,
Yoshihiro Shimoda

> Rob


Re: [PATCH] media: rcar-vin: enable support for r8a77965

2018-05-13 Thread Laurent Pinchart
Hi Niklas,

Thank you for the patch.

On Sunday, 13 May 2018 22:00:23 EEST Niklas Söderlund wrote:
> Add the SoC specific information for Renesas r8a77965.
> 
> Signed-off-by: Niklas Söderlund 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 48 +
>  1 file changed, 48 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c
> b/drivers/media/platform/rcar-vin/rcar-core.c index
> d3072e166a1ca24f..f7bfd05accbfde67 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -974,6 +974,50 @@ static const struct rvin_info rcar_info_r8a7796 = {
>   .routes = rcar_info_r8a7796_routes,
>  };
> 
> +static const struct rvin_group_route _rcar_info_r8a77965_routes[] = {
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
> + { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
> + { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
> + { .csi = RVIN_CSI40, .channel = 0, .vin = 6, .mask = BIT(1) },
> + { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
> + { .csi = RVIN_CSI40, .channel = 2, .vin = 6, .mask = BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
> + { .csi = RVIN_CSI40, .channel = 1, .vin = 7, .mask = BIT(0) },
> + { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
> + { .csi = RVIN_CSI40, .channel = 3, .vin = 7, .mask = BIT(3) },
> + { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
> + { /* Sentinel */ }
> +};
> +
> +static const struct rvin_info rcar_info_r8a77965 = {
> + .model = RCAR_GEN3,
> + .use_mc = true,
> + .max_width = 4096,
> + .max_height = 4096,
> + .routes = _rcar_info_r8a77965_routes,
> +};
> +
>  static const struct rvin_group_route _rcar_info_r8a77970_routes[] = {
>   { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
>   { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
> @@ -1030,6 +1074,10 @@ static const struct of_device_id rvin_of_id_table[] =
> { .compatible = "renesas,vin-r8a7796",
>   .data = _info_r8a7796,
>   },
> + {
> + .compatible = "renesas,vin-r8a77965",
> + .data = _info_r8a77965,
> + },
>   {
>   .compatible = "renesas,vin-r8a77970",
>   .data = _info_r8a77970,

-- 
Regards,

Laurent Pinchart





Re: [PATCH v15 0/2] rcar-csi2: add Renesas R-Car MIPI CSI-2

2018-05-13 Thread Laurent Pinchart
Hi Niklas,

On Sunday, 13 May 2018 22:19:15 EEST Niklas Söderlund wrote:
> Hi,
> 
> This is the latest incarnation of R-Car MIPI CSI-2 receiver driver. It's
> based on top of the media-tree and are tested on Renesas Salvator-X and
> Salvator-XS together with adv7482 and the now in tree rcar-vin driver :-)
> 
> I hope this is the last incarnation of this patch-set, I do think it is
> ready for upstream consumption :-)
> 
> * Changes since v14.
> - Data sheet update changed init sequence for PHY forcing a restructure
>   of the driver. The restructure was so big I felt compel to drop all
>   review tags :-(

I'll review the patches again then, no worries.

> - The change was that the Renesas H3 procedure was aligned with other
>   SoC in the Gen3 family procedure. I had kept the rework as separate
>   patches and was planing to post once original driver with H3 and M3-W
>   support where merged. As review tags are dropped I chosen to squash
>   those patches into 2/2.

I think this calls for allowing some interpretation of hardware initialization 
(and all other operations really) documented in datasheets. I've been asked in 
the past to modify the DU LVDS initialization code to follow exactly the 
documented sequence of operations, even though no hardware misoperation was 
noticed. This resulted in slightly more complex code in the driver, which I 
wasn't very happy about.

When a set of registers need to be written before flipping an enable bit, it 
usually doesn't matter in which order those registers are written, but 
datasheets sometimes specify a particular order that is the random order the 
documentation writer picked on that day. The real hardware requirements are 
not captured, and documentation is passed down until it reaches people who 
don't know those requirements. When it reaches us, we're asked to restructure 
code, sometimes needlessly.

> - Add support for Gen3 M3-N.
> - Add support for Gen3 V3M.
> - Set PHTC_TESTCLR when stopping the PHY.
> - Revert back to the v12 and earlier phypll calculation as it turns out
>   it was correct after all.
> - Added compatible string for R8A77965 and R8A77970.
> - s/Port 0/port@0/
> - s/Port 1/port@1/
> - s/Endpoint 0/endpoint@0/
> 
> * Changes since v13
> - Change return rcar_csi2_formats + i to return _csi2_formats[i].
> - Add define for PHCLM_STOPSTATECKL.
> - Update spelling in comments.
> - Update calculation in rcar_csi2_calc_phypll() according to
>   https://linuxtv.org/downloads/v4l-dvb-apis/kapi/csi2.html. The one
>   before v14 did not take into account that 2 bits per sample is
>   transmitted.
> - Use Geert's suggestion of (1 << priv->lanes) - 1 instead of switch
>   statement to set correct number of lanes to enable.
> - Change hex constants in hsfreqrange_m3w_h3es1[] to lower case to match
>   style of rest of file.
> - Switch to %u instead of 0x%x when printing bus type.
> - Switch to %u instead of %d for priv->lanes which is unsigned.
> - Add MEDIA_BUS_FMT_YUYV8_1X16 to the list of supported formats in
>   rcar_csi2_formats[].
> - Fixed bps for MEDIA_BUS_FMT_YUYV10_2X10 to 20 and not 16.
> - Set INTSTATE after PL-11 is confirmed to match flow chart in
>   datasheet.
> - Change priv->notifier.subdevs == NULL to !priv->notifier.subdevs.
> - Add Maxime's and laurent's tags.
> 
> * Changes since v12
> - Fixed spelling mistakes in commit messages and documentation patch,
>   thanks Laurent.
> - Mark endpoints in port 1 as optional as it is allowed to not connect a
>   VIN to the CSI-2 and instead have it only use its parallel input
>   source (for those VIN that have one).
> - Added Ack from Sakari, thanks!
> - Media bus codes are u32 not unsigned int.
> - Ignore error check for v4l2_subdev_call(sd, video, s_stream, 0)
> - Do not set subdev host data as it's not used,
>   v4l2_set_subdev_hostdata().
> - Fixed spelling errors in commit message.
> - Add SPDX header
> - Rename badly named variable tmp to vcdt_part.
> - Cache subdevice in bound callback instead of looking it up in the
>   media graph. By doing this rcar_csi2_sd_info() can be removed.
> - Print unsigned using %u not %d.
> - Call pm_runtime_enable() before calling v4l2_async_register_subdev().
> - Dropped of_match_ptr() as OF is required.
> 
> * Changes since v11
> - Added missing call to v4l2_async_notifier_unregister().
> - Fixed missing reg popery in bindings documentation.
> - Add Rob's ack to 01/02.
> - Dropped 'media:' prefix from patch subjects as it seems they are added
>   first when a patch is picked up by the maintainer.
> - Fixed typo in comment enpoint -> endpoint, thanks Hans.
> - Added Hans Reviewed-by to driver.
> 
> * Changes since v10
> - Renamed Documentation/devicetree/bindings/media/rcar-csi2.txt to
>   Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
> - Add extra newline in rcar_csi2_code_to_fmt()
> - Use locally stored format information instead of reading it from the
>   remote subdevice, Sakari pointed out that the pipeline is validated
>   

[PATCH v15 1/2] rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver documentation

2018-05-13 Thread Niklas Söderlund
Documentation for Renesas R-Car MIPI CSI-2 receiver. The CSI-2 receivers
are located between the video sources (CSI-2 transmitters) and the video
grabbers (VIN) on Gen3 of Renesas R-Car SoC.

Each CSI-2 device is connected to more than one VIN device which
simultaneously can receive video from the same CSI-2 device. Each VIN
device can also be connected to more than one CSI-2 device. The routing
of which links are used is controlled by the VIN devices. There are only
a few possible routes which are set by hardware limitations, which are
different for each SoC in the Gen3 family.

Signed-off-by: Niklas Söderlund 
Acked-by: Rob Herring 
Acked-by: Sakari Ailus 
Reviewed-by: Laurent Pinchart 

---

* Changes since v14.
- Added compatible string for R8A77965 and R8A77970.
- s/Port 0/port@0/
- s/Port 1/port@1/
- s/Endpoint 0/endpoint@0/

* Changes since v13
- Add Laurent's tag.
---
 .../bindings/media/renesas,rcar-csi2.txt  | 101 ++
 MAINTAINERS   |   1 +
 2 files changed, 102 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt

diff --git a/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt 
b/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
new file mode 100644
index ..2d385b65b275bc58
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
@@ -0,0 +1,101 @@
+Renesas R-Car MIPI CSI-2
+
+
+The R-Car CSI-2 receiver device provides MIPI CSI-2 capabilities for the
+Renesas R-Car family of devices. It is used in conjunction with the
+R-Car VIN module, which provides the video capture capabilities.
+
+Mandatory properties
+
+ - compatible: Must be one or more of the following
+   - "renesas,r8a7795-csi2" for the R8A7795 device.
+   - "renesas,r8a7796-csi2" for the R8A7796 device.
+   - "renesas,r8a77965-csi2" for the R8A77965 device.
+   - "renesas,r8a77970-csi2" for the R8A77970 device.
+
+ - reg: the register base and size for the device registers
+ - interrupts: the interrupt for the device
+ - clocks: reference to the parent clock
+
+The device node shall contain two 'port' child nodes according to the
+bindings defined in Documentation/devicetree/bindings/media/
+video-interfaces.txt. port@0 shall connect to the CSI-2 source. port@1
+shall connect to all the R-Car VIN modules that have a hardware
+connection to the CSI-2 receiver.
+
+- port@0- Video source (mandatory)
+   - endpoint@0 - sub-node describing the endpoint that is the video source
+
+- port@1 - VIN instances (optional)
+   - One endpoint sub-node for every R-Car VIN instance which is connected
+ to the R-Car CSI-2 receiver.
+
+Example:
+
+   csi20: csi2@fea8 {
+   compatible = "renesas,r8a7796-csi2";
+   reg = <0 0xfea8 0 0x1>;
+   interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < CPG_MOD 714>;
+   power-domains = < R8A7796_PD_ALWAYS_ON>;
+   resets = < 714>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   reg = <0>;
+
+   csi20_in: endpoint@0 {
+   reg = <0>;
+   clock-lanes = <0>;
+   data-lanes = <1>;
+   remote-endpoint = <_txb>;
+   };
+   };
+
+   port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   reg = <1>;
+
+   csi20vin0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <>;
+   };
+   csi20vin1: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <>;
+   };
+   csi20vin2: endpoint@2 {
+   reg = <2>;
+   remote-endpoint = <>;
+   };
+   csi20vin3: endpoint@3 {
+   reg = <3>;
+   remote-endpoint = <>;
+   };
+   csi20vin4: endpoint@4 {
+   reg = <4>;
+ 

[PATCH] media: rcar-vin: enable support for r8a77965

2018-05-13 Thread Niklas Söderlund
Add the SoC specific information for Renesas r8a77965.

Signed-off-by: Niklas Söderlund 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 48 +
 1 file changed, 48 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index d3072e166a1ca24f..f7bfd05accbfde67 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -974,6 +974,50 @@ static const struct rvin_info rcar_info_r8a7796 = {
.routes = rcar_info_r8a7796_routes,
 };
 
+static const struct rvin_group_route _rcar_info_r8a77965_routes[] = {
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
+   { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
+   { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
+   { .csi = RVIN_CSI40, .channel = 0, .vin = 6, .mask = BIT(1) },
+   { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
+   { .csi = RVIN_CSI40, .channel = 2, .vin = 6, .mask = BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
+   { .csi = RVIN_CSI40, .channel = 1, .vin = 7, .mask = BIT(0) },
+   { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
+   { .csi = RVIN_CSI40, .channel = 3, .vin = 7, .mask = BIT(3) },
+   { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
+   { /* Sentinel */ }
+};
+
+static const struct rvin_info rcar_info_r8a77965 = {
+   .model = RCAR_GEN3,
+   .use_mc = true,
+   .max_width = 4096,
+   .max_height = 4096,
+   .routes = _rcar_info_r8a77965_routes,
+};
+
 static const struct rvin_group_route _rcar_info_r8a77970_routes[] = {
{ .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
{ .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
@@ -1030,6 +1074,10 @@ static const struct of_device_id rvin_of_id_table[] = {
.compatible = "renesas,vin-r8a7796",
.data = _info_r8a7796,
},
+   {
+   .compatible = "renesas,vin-r8a77965",
+   .data = _info_r8a77965,
+   },
{
.compatible = "renesas,vin-r8a77970",
.data = _info_r8a77970,
-- 
2.17.0



[PATCH] media: dt-bindings: media: rcar_vin: add support for r8a77965

2018-05-13 Thread Niklas Söderlund
Signed-off-by: Niklas Söderlund 
---
 Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt 
b/Documentation/devicetree/bindings/media/rcar_vin.txt
index a19517e1c669eb35..c2c57dcf73f4851b 100644
--- a/Documentation/devicetree/bindings/media/rcar_vin.txt
+++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
@@ -21,6 +21,7 @@ on Gen3 platforms to a CSI-2 receiver.
- "renesas,vin-r8a7794" for the R8A7794 device
- "renesas,vin-r8a7795" for the R8A7795 device
- "renesas,vin-r8a7796" for the R8A7796 device
+   - "renesas,vin-r8a77965" for the R8A77965 device
- "renesas,vin-r8a77970" for the R8A77970 device
- "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
  device.
-- 
2.17.0



Re: [PATCH 2/3] arm64: dts: renesas: r8a77995: Add VIN4

2018-05-13 Thread jacopo mondi
Hi Simon,

On Fri, May 11, 2018 at 03:45:16PM +0200, Simon Horman wrote:
> On Fri, May 11, 2018 at 01:25:23PM +0200, Niklas Söderlund wrote:
> > Hi Jacopo,
> > 
> > Thanks for your work.
> > 
> > On 2018-05-11 12:00:01 +0200, Jacopo Mondi wrote:
> > > Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> > > 
> > > Signed-off-by: Jacopo Mondi 
> > 
> > Acked-by: Niklas Söderlund 
> > 
> > > ---
> > >  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi 
> > > b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > > index 82aed7e..bdf7017 100644
> > > --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > > +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > > @@ -783,6 +783,17 @@
> > >   };
> > >   };
> > >   };
> > > +
> > > + vin4: video@e6ef4000 {
> > > + compatible = "renesas,vin-r8a77995";
> > > + reg = <0 0xe6ef4000 0 0x1000>;
> > > + interrupts = ;
> > > + clocks = < CPG_MOD 807>;
> > > + power-domains = < R8A77995_PD_ALWAYS_ON>;
> > > + resets = < 807>;
> > > + renesas,id = <4>;
> > > + status = "disabled";
> > > + };
> > >   };
> 
> Thanks, I have moved the new node to preserve sorting of nodes by bus
> address and applied the result. It is as follows:

Great, thanks for doing this, I should have take care of sorting nodes
opprtunely.

Thanks
   j

> 
> From: Jacopo Mondi 
> Subject: [PATCH] arm64: dts: renesas: r8a77995: Add VIN4
> 
> Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> 
> Signed-off-by: Jacopo Mondi 
> Acked-by: Niklas Söderlund 
> [simon: sorted node by bus address]
> Signed-off-by: Simon Horman 
> ---
>  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi 
> b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> index ba98865b0c9b..2506f46293e8 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> @@ -610,6 +610,17 @@
>   status = "disabled";
>   };
s  
> + vin4: video@e6ef4000 {
> + compatible = "renesas,vin-r8a77995";
> + reg = <0 0xe6ef4000 0 0x1000>;
> + interrupts = ;
> + clocks = < CPG_MOD 807>;
> + power-domains = < R8A77995_PD_ALWAYS_ON>;
> + resets = < 807>;
> + renesas,id = <4>;
> + status = "disabled";
> + };
> +
>   ohci0: usb@ee08 {
>   compatible = "generic-ohci";
>   reg = <0 0xee08 0 0x100>;
> -- 
> 2.11.0
> 


Re: [PATCH] media: rcar-vin: Drop unnecessary register properties from example vin port

2018-05-13 Thread Niklas Söderlund
Hi Simon,

Thanks for your patch.

On 2018-05-09 20:45:58 +0200, Simon Horman wrote:
> The example vin port node does not have an address and thus does not
> need address-cells or address size-properties.
> 
> Signed-off-by: Simon Horman 

Acked-by: Niklas Söderlund 

> ---
>  Documentation/devicetree/bindings/media/rcar_vin.txt | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt 
> b/Documentation/devicetree/bindings/media/rcar_vin.txt
> index a19517e1c669..2a0c59e97f40 100644
> --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
> +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> @@ -107,9 +107,6 @@ Board setup example for Gen2 platforms (vin1 composite 
> video input)
>  status = "okay";
>  
>  port {
> -#address-cells = <1>;
> -#size-cells = <0>;
> -
>  vin1ep0: endpoint {
>  remote-endpoint = <>;
>  bus-width = <8>;
> -- 
> 2.11.0
> 

-- 
Regards,
Niklas Söderlund


Re: [PATCH 3/3] arm64: dts: renesas: draak: Describe HDMI input

2018-05-13 Thread Niklas Söderlund
Hi Jacopo,

Thanks for your patch.

On 2018-05-11 12:00:02 +0200, Jacopo Mondi wrote:
> Describe HDMI input connected to VIN4 interface for R-Car D3 Draak
> development board.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 68 
> ++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts 
> b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> index d03f194..e0ce462 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> @@ -59,6 +59,17 @@
>   };
>   };
>  
> + hdmi-in {
> + compatible = "hdmi-connector";
> + type = "a";
> +
> + port {
> + hdmi_con_in: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> + };
> +
>   memory@4800 {
>   device_type = "memory";
>   /* first 128MB is reserved for secure area. */
> @@ -142,6 +153,11 @@
>   groups = "usb0";
>   function = "usb0";
>   };
> +
> + vin4_pins: vin4 {
> + groups = "vin4_data24", "vin4_sync", "vin4_clk", "vin4_clkenb";
> + function = "vin4";
> + };
>  };
>  
>   {
> @@ -154,6 +170,35 @@
>   reg = <0x50>;
>   pagesize = <8>;
>   };
> +
> + hdmi-decoder@4c {
> + compatible = "adi,adv7612";
> + reg = <0x4c>;
> + default-input = <0>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + adv7612_in: endpoint {
> + remote-endpoint = <_con_in>;
> + };
> + };
> +
> + port@2 {
> + reg = <2>;
> + adv7612_out: endpoint {
> + pclk-sample = <0>;
> + hsync-active = <0>;
> + vsync-active = <0>;

This differs from the Gen2 DT bindings which is a very similar hardware 
setup using the same components. Defining these properties will make the 
bus marked as V4L2_MBUS_PARALLEL instead of V4L2_MBUS_BT656.

This will change how the hardware is configured for capture if the media 
bus is in a UYVY format, see VNMC_INF register in rvin_setup(). Maybe 
this it not an issue here but still I'm curious to why this differ 
between Gen2 and Gen3 :-)

> +
> + remote-endpoint = <_in>;
> + };
> + };
> + };
> + };
>  };
>  
>   {
> @@ -246,3 +291,26 @@
>   timeout-sec = <60>;
>   status = "okay";
>  };
> +
> + {
> + pinctrl-0 = <_pins>;
> + pinctrl-names = "default";
> +
> + status = "okay";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + vin4_in: endpoint {
> + hsync-active = <0>;
> + vsync-active = <0>;

Comparing this to the Gen2 bindings some properties are missing,

bus-width = <24>;
pclk-sample = <1>;
data-active = <1>;

This is not a big deal as the VIN driver don't use these properties so 
no functional change should come of this but still a difference.  

Over all I'm happy with this change but before I add my tag I would like 
to understand why it differs from the Gen2 configuration for the adv7612 
properties.

Also on a side not it is possible with hardware switches on the board 
switch the VIN4 source to a completely different pipeline CVBS connector 
-> adv7180 -> VIN4. But I think it's best we keep the HDMI as default as 
this seems to be how the boards are shipped. But maybe mentioning this 
in the commit message would not hurt if you end-up resending the patch.

> +
> + remote-endpoint = <_out>;
> + };
> + };
> + };
> +};
> -- 
> 2.7.4
> 

-- 
Regards,
Niklas Söderlund


Re: [PATCH 3/3] arm64: dts: renesas: draak: Describe HDMI input

2018-05-13 Thread Niklas Söderlund
Hi Simon,

On 2018-05-13 10:17:50 +0200, Simon Horman wrote:
> On Fri, May 11, 2018 at 12:00:02PM +0200, Jacopo Mondi wrote:
> > Describe HDMI input connected to VIN4 interface for R-Car D3 Draak
> > development board.
> > 
> > Signed-off-by: Jacopo Mondi 
> 
> Hi Niklas,
> 
> As you reviewed the rest of the series I'm wondering if you're planning
> to review this patch too.

Yes, I did not have schematics for D3 on hand when reviewing the rest of 
the series. Will review it now that I do, thanks for the ping :-)

-- 
Regards,
Niklas Söderlund


Re: [RFT] arm64: dts: r8a77965: add I2C support

2018-05-13 Thread Niklas Söderlund
Hi Simon,

On 2018-05-13 10:19:13 +0200, Simon Horman wrote:
> On Fri, May 11, 2018 at 04:00:29PM +0200, Niklas Söderlund wrote:
> > Signed-off-by: Niklas Söderlund 
> > ---
> >  arch/arm64/boot/dts/renesas/r8a77965.dtsi | 99 ---
> >  1 file changed, 90 insertions(+), 9 deletions(-)
> > 
> > Hi Simon,
> > 
> > I have only tested i2c4 and the adv7482 which is connected there. But it 
> > seemed silly to post this patch without enable all i2c as they are 
> > according to the datasheet are the same as on H3 and M3-W.
> 
> Thanks Niklas,
> 
> I agree this makes sense. Do we have any way to test those nodes?

Looking at the DT for M3-N the i2c busses used are i2c2 and i2c4. I 
already verified i2c4 and for i2c2 it turned out some PFC parts where 
missing, I just sent a patch for that [1]. Using that patch i2c2 also 
successfully finds the devices described in DT.

> If not I'm inclined to accept the patch without testing.

I also think it would be OK for you to pickup this patch without testing 
all the buses.

1. [PATCH] pinctrl: sh-pfc: r8a77965: Add I2C pin support

-- 
Regards,
Niklas Söderlund


[PATCH] pinctrl: sh-pfc: r8a77965: Add I2C pin support

2018-05-13 Thread Niklas Söderlund
Signed-off-by: Niklas Söderlund 
---
 drivers/pinctrl/sh-pfc/pfc-r8a77965.c | 77 +++
 1 file changed, 77 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77965.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a77965.c
index cea9d0599c1281a7..0c786fd78011376a 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a77965.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a77965.c
@@ -1662,6 +1662,57 @@ static const unsigned int avb_avtp_capture_b_mux[] = {
AVB_AVTP_CAPTURE_B_MARK,
 };
 
+/* - I2C  
*/
+static const unsigned int i2c1_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 10),
+};
+static const unsigned int i2c1_a_mux[] = {
+   SDA1_A_MARK, SCL1_A_MARK,
+};
+static const unsigned int i2c1_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 23),
+};
+static const unsigned int i2c1_b_mux[] = {
+   SDA1_B_MARK, SCL1_B_MARK,
+};
+static const unsigned int i2c2_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 0), RCAR_GP_PIN(5, 4),
+};
+static const unsigned int i2c2_a_mux[] = {
+   SDA2_A_MARK, SCL2_A_MARK,
+};
+static const unsigned int i2c2_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 12),
+};
+static const unsigned int i2c2_b_mux[] = {
+   SDA2_B_MARK, SCL2_B_MARK,
+};
+static const unsigned int i2c6_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(1, 8), RCAR_GP_PIN(1, 11),
+};
+static const unsigned int i2c6_a_mux[] = {
+   SDA6_A_MARK, SCL6_A_MARK,
+};
+static const unsigned int i2c6_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 25),
+};
+static const unsigned int i2c6_b_mux[] = {
+   SDA6_B_MARK, SCL6_B_MARK,
+};
+static const unsigned int i2c6_c_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 14),
+};
+static const unsigned int i2c6_c_mux[] = {
+   SDA6_C_MARK, SCL6_C_MARK,
+};
+
 /* - INTC-EX  
*/
 static const unsigned int intc_ex_irq0_pins[] = {
/* IRQ0 */
@@ -1959,6 +2010,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(avb_avtp_capture_a),
SH_PFC_PIN_GROUP(avb_avtp_match_b),
SH_PFC_PIN_GROUP(avb_avtp_capture_b),
+   SH_PFC_PIN_GROUP(i2c1_a),
+   SH_PFC_PIN_GROUP(i2c1_b),
+   SH_PFC_PIN_GROUP(i2c2_a),
+   SH_PFC_PIN_GROUP(i2c2_b),
+   SH_PFC_PIN_GROUP(i2c6_a),
+   SH_PFC_PIN_GROUP(i2c6_b),
+   SH_PFC_PIN_GROUP(i2c6_c),
SH_PFC_PIN_GROUP(intc_ex_irq0),
SH_PFC_PIN_GROUP(intc_ex_irq1),
SH_PFC_PIN_GROUP(intc_ex_irq2),
@@ -2013,6 +2071,22 @@ static const char * const avb_groups[] = {
"avb_avtp_capture_b",
 };
 
+static const char * const i2c1_groups[] = {
+   "i2c1_a",
+   "i2c1_b",
+};
+
+static const char * const i2c2_groups[] = {
+   "i2c2_a",
+   "i2c2_b",
+};
+
+static const char * const i2c6_groups[] = {
+   "i2c6_a",
+   "i2c6_b",
+   "i2c6_c",
+};
+
 static const char * const intc_ex_groups[] = {
"intc_ex_irq0",
"intc_ex_irq1",
@@ -2085,6 +2159,9 @@ static const char * const usb30_groups[] = {
 
 static const struct sh_pfc_function pinmux_functions[] = {
SH_PFC_FUNCTION(avb),
+   SH_PFC_FUNCTION(i2c1),
+   SH_PFC_FUNCTION(i2c2),
+   SH_PFC_FUNCTION(i2c6),
SH_PFC_FUNCTION(intc_ex),
SH_PFC_FUNCTION(scif0),
SH_PFC_FUNCTION(scif1),
-- 
2.17.0



Re: [PATCH 4/4] arm64: dts: renesas: r8a77990: ebisu: Enable EthernetAVB

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 01:31:21PM +0900, Yoshihiro Shimoda wrote:
> This patch enables EthernetAVB for r8a77990 Ebisu board.
> 
> Based on a patch from Takeshi Kihara 
> 
> Signed-off-by: Yoshihiro Shimoda 

This looks fine but I will wait to see if there are other reviews before
applying.

Reviewed-by: Simon Horman 


Re: [PATCH 3/4] arm64: dts: renesas: r8a77990: Add EthernetAVB device nodes

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 01:31:20PM +0900, Yoshihiro Shimoda wrote:
> This patch adds EthernetAVB node for r8a77990 (R-Car E3).
> 
> Based on a patch from Takeshi Kihara 
> 
> Signed-off-by: Yoshihiro Shimoda 

This looks fine but I will wait to see if there are other reviews before
applying.

Reviewed-by: Simon Horman 



Re: [PATCH] arm64: dts: renesas: r8a77990: Add GPIO device nodes

2018-05-13 Thread Sergei Shtylyov

Hello!

On 5/13/2018 12:08 PM, Simon Horman wrote:


The compat string renesas,gpio-rcar has been deprecated since v4.14,
the same release that r8a77990 SoC support was added. Thus
renesas,gpio-rcar can safely be removed without any risk of behaviour
changes between old and new mainline kernels and DTBs.


   This hardly matches the subject. :-)


Signed-off-by: Simon Horman 

[...]

MBR, Sergei


[PATCH] arm64: dts: renesas: r8a77990: Add GPIO device nodes

2018-05-13 Thread Simon Horman
The compat string renesas,gpio-rcar has been deprecated since v4.14,
the same release that r8a77990 SoC support was added. Thus
renesas,gpio-rcar can safely be removed without any risk of behaviour
changes between old and new mainline kernels and DTBs.

Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a77995.dtsi | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

 Based on renesas-devel-20180511-v4.17-rc4

diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi 
b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
index 2506f46293e8..f3426266b5ea 100644
--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
@@ -88,8 +88,7 @@
 
gpio0: gpio@e605 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe605 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -104,8 +103,7 @@
 
gpio1: gpio@e6051000 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6051000 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -120,8 +118,7 @@
 
gpio2: gpio@e6052000 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6052000 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -136,8 +133,7 @@
 
gpio3: gpio@e6053000 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6053000 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -152,8 +148,7 @@
 
gpio4: gpio@e6054000 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6054000 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -168,8 +163,7 @@
 
gpio5: gpio@e6055000 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6055000 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
@@ -184,8 +178,7 @@
 
gpio6: gpio@e6055400 {
compatible = "renesas,gpio-r8a77995",
-"renesas,rcar-gen3-gpio",
-"renesas,gpio-rcar";
+"renesas,rcar-gen3-gpio";
reg = <0 0xe6055400 0 0x50>;
interrupts = ;
#gpio-cells = <2>;
-- 
2.11.0



Re: [PATCH 2/4] arm64: dts: renesas: r8a77990: Add GPIO device nodes

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 01:31:19PM +0900, Yoshihiro Shimoda wrote:
> This patch adds GPIO nodes for r8a77990 (R-Car E3).
> 
> Based on a patch from Takeshi Kihara 
> 
> Signed-off-by: Yoshihiro Shimoda 
> ---
>  arch/arm64/boot/dts/renesas/r8a77990.dtsi | 112 
> ++
>  1 file changed, 112 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi 
> b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> index efc3c0b..d94e047 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> @@ -60,6 +60,118 @@
>   #size-cells = <2>;
>   ranges;
>  
> + gpio0: gpio@e605 {
> + compatible = "renesas,gpio-r8a77990",
> +  "renesas,rcar-gen3-gpio",
> +  "renesas,gpio-rcar";

"renesas,gpio-rcar" is deprecated and thus should not be added to DT any
more. I will see about removing it from r8a77995.dtsi which seems to be the
only place that it used in mainline.

Otherwise this patch looks good to me.

> + reg = <0 0xe605 0 0x50>;
> + interrupts = ;
> + #gpio-cells = <2>;
> + gpio-controller;
> + gpio-ranges = < 0 0 18>;
> + #interrupt-cells = <2>;
> + interrupt-controller;
> + clocks = < CPG_MOD 912>;
> + power-domains = < 32>;
> + resets = < 912>;
> + };

...


Re: [PATCH 0/2] Disable EtherAVB by default on R8A779{7|8}0 SoCs

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 11:18:36PM +0300, Sergei Shtylyov wrote:
> Hello!
> 
> Here's the set of 2 patches against Simon Horman's 'renesas.git' repo's
> 'renesas-devel-20180511-v4.17-rc4' tag. I'm fixing the issue in the EtherAVB
> device nodes in the R8A779{7|8}0 device trees that missed the "status" prop,
> usually disabling the SoC devices in anticipation that the board device trees
> enable the devices according to their needs. There should be no issues with
> the current R8A779{7|8}0 board device trees, as all of them use EtherAVB
> anyway, so I'm sending the patches generated against the 'devel' branch...
> 
> [1/2] arm64: dts: renesas: r8a77970: disable EtherAVB
> [2/2] arm64: dts: renesas: r8a77980: disable EtherAVB

Thanks, applied.


Re: [PATCH v4 0/4] mmc: renesas_sdhi: add eMMC HS400 mode support

2018-05-13 Thread Simon Horman
Hi Ulf,

On Wed, Apr 18, 2018 at 11:56:56AM +0200, Simon Horman wrote:
> Hi,
> 
> this patch-set provides SDHI driver support for eMMC HS400.
> 
> Based on mmc-v4.17-2
> 
> Dependencies for applying these patches:
> * none
> 
> Dependencies to test eMMC HS400:
> * [PATCH] clk: renesas: rcar-gen3: Fix SD divider setting
> * [PATCH v2] arm64: dts: salvator-common: Enable HS400 of SDHI2
> 
> To assist testing and review this patch and the above mentioned
> dependencies, which are necessary and sufficient to enable HS400 on H3 /
> Salvator-X, M3-W 1.0 / Salvator-X and H3 ES2.0 Salvator-XS are available
> at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
> topic/hs400-v4
> 
> Changes since v3:
> * As a follow-up to discussion with Ulf and Wolfram I have proposed
>   two new HS400 tuning host operations. These are provided, and explained,
>   in "mmc: core: more fine-grained hooks for HS400 tuning".
> 
>   The following driver patches have been updated to use these new operations.
> 
>   And "mmc: tmio: add eMMC HS400 mode support" proposes a minor cleanup
>   to make it a little cleaner to add the proposed new host operations to
>   the MMC core.

I am wondering if you could give me some feedback on the approach that I
have taken here.

> 
> Changes since v2:
> * Consolidate disable_scc and reset_hs400_mode into reset_hs400_tuning
>   callback
> * Reuse renesas_sdhi_reset_hs400_mode() in renesas_sdhi_hw_reset()
> * Factor out renesas_sdhi_reset_scc()
> 
> 
> Masaharu Hayakawa (2):
>   mmc: tmio: add eMMC HS400 mode support
>   mmc: renesas_sdhi: add eMMC HS400 mode support
> 
> Simon Horman (2):
>   mmc: core: select HS400 from HS200 tuning function
>   mmc: core: more fine-grained hooks for HS400 tuning
> 
>  drivers/mmc/core/host.c  |  13 +++-
>  drivers/mmc/core/mmc.c   |  28 +---
>  drivers/mmc/host/renesas_sdhi_core.c | 136 
> +--
>  drivers/mmc/host/tmio_mmc.h  |   9 +++
>  drivers/mmc/host/tmio_mmc_core.c |  49 -
>  include/linux/mmc/host.h |  26 ++-
>  6 files changed, 226 insertions(+), 35 deletions(-)
> 
> -- 
> 2.11.0
> 


Re: [RFT] arm64: dts: r8a77965: add I2C support

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 04:00:29PM +0200, Niklas Söderlund wrote:
> Signed-off-by: Niklas Söderlund 
> ---
>  arch/arm64/boot/dts/renesas/r8a77965.dtsi | 99 ---
>  1 file changed, 90 insertions(+), 9 deletions(-)
> 
> Hi Simon,
> 
> I have only tested i2c4 and the adv7482 which is connected there. But it 
> seemed silly to post this patch without enable all i2c as they are 
> according to the datasheet are the same as on H3 and M3-W.

Thanks Niklas,

I agree this makes sense. Do we have any way to test those nodes?
If not I'm inclined to accept the patch without testing.


Re: [PATCH 3/3] arm64: dts: renesas: draak: Describe HDMI input

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 12:00:02PM +0200, Jacopo Mondi wrote:
> Describe HDMI input connected to VIN4 interface for R-Car D3 Draak
> development board.
> 
> Signed-off-by: Jacopo Mondi 

Hi Niklas,

As you reviewed the rest of the series I'm wondering if you're planning
to review this patch too.


Re: [PATCH 1/2] dt-bindings: arm: document Renesas V3HSK board bindings

2018-05-13 Thread Simon Horman
On Thu, May 10, 2018 at 09:09:40PM +0300, Sergei Shtylyov wrote:
> Document the V3H Starter Kit device tree bindings, listing it as
> a supported board.
> 
> This allows to use checkpatch.pl to validate .dts files referring to
> the V3HSK board.
> 
> Signed-off-by: Sergei Shtylyov 

This looks fine but I will wait to see if there are other reviews before
applying.

Reviewed-by: Simon Horman 

> 
> ---
>  Documentation/devicetree/bindings/arm/shmobile.txt |2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: renesas/Documentation/devicetree/bindings/arm/shmobile.txt
> ===
> --- renesas.orig/Documentation/devicetree/bindings/arm/shmobile.txt
> +++ renesas/Documentation/devicetree/bindings/arm/shmobile.txt
> @@ -132,6 +132,8 @@ Boards:
>  compatible = "renesas,sk-rzg1m", "renesas,r8a7743"
>- Stout (ADAS Starterkit, Y-R-CAR-ADAS-SKH2-BOARD)
>  compatible = "renesas,stout", "renesas,r8a7790"
> +  - V3HSK (Y-ASK-RCAR-V3H-WS10)
> +compatible = "renesas,v3hsk", "renesas,r8a77980"
>- V3MSK (Y-ASK-RCAR-V3M-WS10)
>  compatible = "renesas,v3msk", "renesas,r8a77970"
>- Wheat (RTP0RC7792ASKBJE)
> 


Re: [PATCH 1/4] arm64: dts: renesas: r8a77990: Add PFC device node

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 01:31:18PM +0900, Yoshihiro Shimoda wrote:
> This patch adds PFC device node for r8a77990 (R-Car E3).
> 
> Signed-off-by: Yoshihiro Shimoda 
> ---
>  arch/arm64/boot/dts/renesas/r8a77990.dtsi | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi 
> b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> index 4658029..efc3c0b 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> @@ -60,6 +60,11 @@
>   #size-cells = <2>;
>   ranges;
>  
> + pfc: pin-controller@e606 {
> + compatible = "renesas,pfc-r8a77990";
> + reg = <0 0xe606 0 0x508>;
> + };

Here the register size is 0x508 which matches r8a77995.dtsi in mainline.
Other variants there are:
* 0x50c: r8a7795.dtsi, r8a77965.dtsi, r8a7796.dtsi
* 0x504: r8a77970.dtsi

My reading of the documentation is that the size of the register range is
0x50c. So I suggest we either use that value consistently or move to a
larger value after some rounding-up. Geert?

> +
>   cpg: clock-controller@e615 {
>   compatible = "renesas,r8a77990-cpg-mssr";
>   reg = <0 0xe615 0 0x1000>;
> -- 
> 1.9.1
> 


Re: [PATCH 2/2] arm64: dts: renesas: initial V3HSK board device tree

2018-05-13 Thread Simon Horman
On Thu, May 10, 2018 at 09:12:30PM +0300, Sergei Shtylyov wrote:
> Add the initial device  tree for  the V3H Starter Kit board.
> The board has 1 debug serial port (SCIF0); include support for it,
> so that the serial console can work.
> 
> Based on the original (and large) patch by Vladimir Barinov.
> 
> Signed-off-by: Vladimir Barinov 
> Signed-off-by: Sergei Shtylyov 

This looks fine but I will wait to see if there are other reviews before
applying.

Reviewed-by: Simon Horman 


Re: [PATCH] dt-bindings: net: ravb: Add support for r8a77990 SoC

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 03:59:42PM -0400, David Miller wrote:
> From: Yoshihiro Shimoda 
> Date: Fri, 11 May 2018 12:18:56 +0900
> 
> > Add documentation for r8a77990 compatible string to renesas ravb device
> > tree bindings documentation.
> > 
> > Signed-off-by: Yoshihiro Shimoda 
> 
> I'm assuming this isn't targetted at one of my trees.  Just FYI.

Hi Dave,

I think this is appropriate for net-next but if not I can take it.

Reviewed-by: Simon Horman 


Shimoda-san,

please use "[PATCH net-next]" for non-bugfix networking updates which
are targeted at Dave's net-next tree. Bug fixes should be for "net".
Patches should of course apply cleanly to whichever tree it is targeted at.


Re: [PATCH] dt-bindings: gpio: rcar: Add support for r8a77990

2018-05-13 Thread Simon Horman
On Fri, May 11, 2018 at 12:13:05PM +0900, Yoshihiro Shimoda wrote:
> Add compatible string for R-Car E3 (r8a77990) in gpio-rcar.
> 
> Signed-off-by: Yoshihiro Shimoda 
> ---
>  Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Horman 

> diff --git a/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt 
> b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
> index 9744d42..378f132 100644
> --- a/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
> +++ b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
> @@ -17,6 +17,7 @@ Required Properties:
>  - "renesas,gpio-r8a7796": for R8A7796 (R-Car M3-W) compatible GPIO 
> controller.
>  - "renesas,gpio-r8a77965": for R8A77965 (R-Car M3-N) compatible GPIO 
> controller.
>  - "renesas,gpio-r8a77970": for R8A77970 (R-Car V3M) compatible GPIO 
> controller.
> +- "renesas,gpio-r8a77990": for R8A77990 (R-Car E3) compatible GPIO 
> controller.
>  - "renesas,gpio-r8a77995": for R8A77995 (R-Car D3) compatible GPIO 
> controller.
>  - "renesas,rcar-gen1-gpio": for a generic R-Car Gen1 GPIO controller.
>  - "renesas,rcar-gen2-gpio": for a generic R-Car Gen2 or RZ/G1 GPIO 
> controller.
> -- 
> 1.9.1
> 


Re: [PATCH v2 1/3] dt-bindings: timer: renesas, cmt: Document r8a774[35] CMT support

2018-05-13 Thread Simon Horman
On Tue, Apr 10, 2018 at 09:36:39AM +, Fabrizio Castro wrote:
> Good morning gentlemen,
> 
> I am very sorry to bother you again, but it seems this patch has no
> master. Is anybody willing to take it?

Patchwork tells me this has been Acked by Daniel Lezcano.
So I have decided to take this one in from the cold and apply it to the
renesas tree.