[PATCH v3] drm: bridge: add DesignWare HDMI I2S audio support

2016-11-01 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Current dw-hdmi is supporting sound via AHB bus, but it has
I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
This HDMI I2S is supported by using ALSA SoC common HDMI encoder
driver.

Tested-by: Jose Abreu 
Signed-off-by: Kuninori Morimoto 
---
v2 -> v3

 - add .remove and call platform_device_unregister()
 - add missing Tested-by: Jose Abreu on log

 drivers/gpu/drm/bridge/Kconfig |   8 ++
 drivers/gpu/drm/bridge/Makefile|   1 +
 drivers/gpu/drm/bridge/dw-hdmi-audio.h |   7 ++
 drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c | 142 +
 drivers/gpu/drm/bridge/dw-hdmi.c   |  22 -
 drivers/gpu/drm/bridge/dw-hdmi.h   |  21 +
 6 files changed, 199 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 10e12e7..3129f8d 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -39,6 +39,14 @@ config DRM_DW_HDMI_AHB_AUDIO
  Designware HDMI block.  This is used in conjunction with
  the i.MX6 HDMI driver.
 
+config DRM_DW_HDMI_I2S_AUDIO
+   tristate "Synopsis Designware I2S Audio interface"
+   depends on DRM_DW_HDMI
+   select SND_SOC_HDMI_CODEC
+   help
+ Support the I2S Audio interface which is part of the Synopsis
+ Designware HDMI block.
+
 config DRM_NXP_PTN3460
tristate "NXP PTN3460 DP/LVDS bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index cdf3a3c..9a54f2a 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
 obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
+obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
 obj-$(CONFIG_DRM_SII902X) += sii902x.o
diff --git a/drivers/gpu/drm/bridge/dw-hdmi-audio.h 
b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
index 91f631b..fd1f745 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi-audio.h
+++ b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
@@ -11,4 +11,11 @@ struct dw_hdmi_audio_data {
u8 *eld;
 };
 
+struct dw_hdmi_i2s_audio_data {
+   struct dw_hdmi *hdmi;
+
+   void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+   u8 (*read)(struct dw_hdmi *hdmi, int offset);
+};
+
 #endif
diff --git a/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c 
b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
new file mode 100644
index 000..44880d8
--- /dev/null
+++ b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
@@ -0,0 +1,142 @@
+/*
+ * dw-hdmi-i2s-audio.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+
+#include 
+
+#include "dw-hdmi.h"
+#include "dw-hdmi-audio.h"
+
+#define DRIVER_NAME "dw-hdmi-i2s-audio"
+
+static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio,
+ u8 val, int offset)
+{
+   struct dw_hdmi *hdmi = audio->hdmi;
+
+   audio->write(hdmi, val, offset);
+}
+
+static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
+{
+   struct dw_hdmi *hdmi = audio->hdmi;
+
+   return audio->read(hdmi, offset);
+}
+
+static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
+struct hdmi_codec_daifmt *fmt,
+struct hdmi_codec_params *hparms)
+{
+   struct dw_hdmi_i2s_audio_data *audio = data;
+   struct dw_hdmi *hdmi = audio->hdmi;
+   u8 conf0 = 0;
+   u8 conf1 = 0;
+   u8 inputclkfs = 0;
+
+   /* it cares I2S only */
+   if ((fmt->fmt != HDMI_I2S) ||
+   (fmt->bit_clk_master | fmt->frame_clk_master)) {
+   dev_err(dev, "unsupported format/settings\n");
+   return -EINVAL;
+   }
+
+   inputclkfs  = HDMI_AUD_INPUTCLKFS_64FS;
+   conf0   = HDMI_AUD_CONF0_I2S_ALL_ENABLE;
+
+   switch (hparms->sample_width) {
+   case 16:
+   conf1 = HDMI_AUD_CONF1_WIDTH_16;
+   break;
+   case 24:
+   case 32:
+   conf1 = HDMI_AUD_CONF1_WIDTH_24;
+   break;
+   }
+
+   dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate);
+
+   hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS);
+   hdmi_write(audio, conf0, HDMI_AUD_CONF0);
+   hdmi_write(audio, conf1, HDMI_AUD_CONF1);
+
+   

RE: [PATCH v2] phy: rcar-gen3-usb2: add sysfs for usb role swap

2016-11-01 Thread Yoshihiro Shimoda
Hi Peter,

> From: Peter Chen [mailto:hzpeterc...@gmail.com]
> Sent: Tuesday, November 01, 2016 8:38 PM
> 
> On Tue, Nov 01, 2016 at 04:01:58PM +0900, Yoshihiro Shimoda wrote:
> > This patch adds sysfs "otg_inputs" for usb role swap. This parameter
> > is write-only and if you use them as the following, you can swap
> > the usb role.
> >
> > For example:
> >  1) connect a usb cable using 2 salvator-x boards
> >  2) On A-device (as host), you input the following command:
> ># echo a_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> >  3) On B-device (as peripheral), you input the following command:
> ># echo b_bus_req > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> >
> > Then, the A-device acts as a peripheral (A-peripheral) and the B-device
> > acts as a host (B-host).
> > Please note that A-device must input the following command if you
> > want the board to act as a host again. (even if you disconnect the usb
> > cable, since id state may be the same, the condition keeps "A-peripheral".)
> >  # echo a_bus_drop > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> >
> > Also you can use the following command if you want the B-device board to
> > act as a peripheral again.
> >  # echo b_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> >
> > Signed-off-by: Yoshihiro Shimoda 
> > ---
> >  This patch is based on the latest linux-phy.git / next branch.
> >  (commit id = 7809cd2ce6abd4f431e4b14e6b1276a7cc842ac4)
> >
> >  Since this patch is related to usb, I added email addresses of Greg, 
> > Felipe,
> >  Peter and USB ML as CC. (This patch doesn't use USB OTG FSM though.)
> >
> >  Changed from v1:
> >   - rebase the latest next branch.
> >
> >  .../ABI/testing/sysfs-platform-phy-rcar-gen3-usb2  |  11 ++
> >  drivers/phy/phy-rcar-gen3-usb2.c   | 124 
> > -
> >  2 files changed, 134 insertions(+), 1 deletion(-)
> >  create mode 100644 
> > Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> >
> > diff --git a/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> > new file mode 100644
> > index 000..c7e715af
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> > @@ -0,0 +1,11 @@
> > +What:  /sys/devices/platform//otg-inputs
> > +Date:  October 2016
> > +KernelVersion: 4.10
> > +Contact:   Yoshihiro Shimoda 
> > +Description:
> > +   This write-only file changes the phy mode for role swap of usb.
> > +   This file accepts the following strings:
> > +"a_bus_req/" - switching from A-Host to A-Peripheral
> > +"a_bus_drop" - switching from A-Peripheral to A-Host
> > +"b_bus_req"  - switching from B-Peripheral to B-Host
> > +"b_bus_req/" - switching from B-Host to B-Peripheral
> 
> Would you really care OTG FSM state machine? If not, you could just use
> "host" and "peripheral" to stand for current USB role, and implement
> role switch sysfs like: /sys/devices/platform//role.

Thank you for the comment!
Since I would not care OTG FSM state machine for now, I will modify the patch to
use "host" and "peripheral" that you suggested.

Best regards,
Yoshihiro Shimoda

> Peter
> 


Re: [PATCH] clk: renesas: cpg-mssr: Fix inverted debug check

2016-11-01 Thread Stephen Boyd
On 10/04, Geert Uytterhoeven wrote:
> The intention was to enable the checks if debugging is enabled, not
> disabled.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


Re: [PATCH] clk: renesas: r8a7796: Add DRIF clock

2016-11-01 Thread Stephen Boyd
On 10/13, Ramesh Shanmugasundaram wrote:
> This patch adds DRIF module clocks for r8a7796 SoC.
> 
> Signed-off-by: Ramesh Shanmugasundaram 
> 
> ---

Doesn't apply to clk-next so I assume Geert will pick it up?

Acked-by: Stephen Boyd 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[PATCH 0/2] Add r8a7796 clocks to capture video

2016-11-01 Thread Niklas Söderlund
Hi Geert and everyone else,

Add the clocks for VIN and CSI2 which are needed to be able to capture 
video on r8a7796. Tested by capturing video using the VIN and CSI2 IP 
cores on M3-W.

Niklas Söderlund (2):
  clk: renesas: r8a7796: Add CSI2 clocks
  clk: renesas: r8a7796: Add VIN clocks

 drivers/clk/renesas/r8a7796-cpg-mssr.c | 12 
 1 file changed, 12 insertions(+)

-- 
2.10.2



Re: [RFC 3/3] v4l: vsp1: Provide a writeback video device

2016-11-01 Thread Kieran Bingham
Looks like I forgot to run checkpatch here, and it picked up a few things.

Please disregard them in your review, and they will be fixed for next
version.


On 27/10/16 15:01, Kieran Bingham wrote:
> When the VSP1 is used in an active display pipeline, the output of the
> WPF can supply the LIF entity directly and simultaneously write to
> memory.
> 
> Support this functionality in the VSP1 driver, by extending the WPF
> source pads, and establishing a V4L2 video device node connected to the
> new source.
> 
> The source will be able to perform pixel format conversion, but not
> rescaling, and as such the output from the memory node will always be
> of the same dimensions as the display output.
> 
> Signed-off-by: Kieran Bingham 
> ---
>  drivers/media/platform/vsp1/vsp1.h   |   1 +
>  drivers/media/platform/vsp1/vsp1_drm.c   |  20 
>  drivers/media/platform/vsp1/vsp1_drv.c   |   5 +-
>  drivers/media/platform/vsp1/vsp1_rwpf.c  |  15 ++-
>  drivers/media/platform/vsp1/vsp1_rwpf.h  |   2 +
>  drivers/media/platform/vsp1/vsp1_video.c | 161 
> ++-
>  drivers/media/platform/vsp1/vsp1_video.h |   5 +
>  drivers/media/platform/vsp1/vsp1_wpf.c   |  23 -
>  8 files changed, 219 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1.h 
> b/drivers/media/platform/vsp1/vsp1.h
> index 85387a64179a..a2d462264312 100644
> --- a/drivers/media/platform/vsp1/vsp1.h
> +++ b/drivers/media/platform/vsp1/vsp1.h
> @@ -54,6 +54,7 @@ struct vsp1_uds;
>  #define VSP1_HAS_WPF_HFLIP   (1 << 6)
>  #define VSP1_HAS_HGO (1 << 7)
>  #define VSP1_HAS_HGT (1 << 8)
> +#define VSP1_HAS_WPF_WRITEBACK   (1 << 9)
>  
>  struct vsp1_device_info {
>   u32 version;
> diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
> b/drivers/media/platform/vsp1/vsp1_drm.c
> index 0daf5f2c06e2..446188a06a92 100644
> --- a/drivers/media/platform/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/vsp1/vsp1_drm.c
> @@ -27,6 +27,7 @@
>  #include "vsp1_lif.h"
>  #include "vsp1_pipe.h"
>  #include "vsp1_rwpf.h"
> +#include "vsp1_video.h"
>  
>  
>  /* 
> -
> @@ -479,6 +480,13 @@ void vsp1_du_atomic_flush(struct device *dev)
>   __func__, rpf->entity.index);
>   }
>  
> + /*
> +  * If we have a writeback node attached, we use this opportunity to
> +  * update the video buffers.
> +  */
> + if (pipe->output->video && pipe->output->video->frame_end)
> + pipe->output->video->frame_end(pipe);
> +
>   /* Configure all entities in the pipeline. */
>   list_for_each_entry(entity, >entities, list_pipe) {
>   /* Disconnect unused RPFs from the pipeline. */
> @@ -590,6 +598,17 @@ int vsp1_drm_create_links(struct vsp1_device *vsp1)
>   if (ret < 0)
>   return ret;
>  
> + if (!(vsp1->info->features & VSP1_HAS_WPF_WRITEBACK))
> + return 0;
> +
> + /* Connect the video device to the WPF for Writeback support */
> + ret = media_create_pad_link(>wpf[0]->entity.subdev.entity,
> + RWPF_PAD_SOURCE_WB,
> + >wpf[0]->video->video.entity,
> + 0, flags);
> + if (ret < 0)
> + return ret;
> +
>   return 0;
>  }
>  
> @@ -620,6 +639,7 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
>   pipe->bru = >bru->entity;
>   pipe->lif = >lif->entity;
>   pipe->output = vsp1->wpf[0];
> + pipe->output->pipe = pipe;
>  
>   return 0;
>  }
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
> b/drivers/media/platform/vsp1/vsp1_drv.c
> index 3b084976094b..42fa822b38d3 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -408,7 +408,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
>   vsp1->wpf[i] = wpf;
>   list_add_tail(>entity.list_dev, >entities);
>  
> - if (vsp1->info->uapi) {
> + if (vsp1->info->uapi || wpf->has_writeback) {
>   struct vsp1_video *video = vsp1_video_create(vsp1, wpf);
>  
>   if (IS_ERR(video)) {
> @@ -705,7 +705,8 @@ static const struct vsp1_device_info vsp1_device_infos[] 
> = {
>   .version = VI6_IP_VERSION_MODEL_VSPD_GEN3,
>   .model = "VSP2-D",
>   .gen = 3,
> - .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP,
> + .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP
> +   | VSP1_HAS_WPF_WRITEBACK,
>   .rpf_count = 5,
>   .wpf_count = 2,
>   .num_bru_inputs = 5,
> diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c 
> b/drivers/media/platform/vsp1/vsp1_rwpf.c
> index 7deb6b9acf0b..7ad3ed097d50 100644
> --- 

Re: [PATCH v2] phy: rcar-gen3-usb2: add sysfs for usb role swap

2016-11-01 Thread Peter Chen
On Tue, Nov 01, 2016 at 04:01:58PM +0900, Yoshihiro Shimoda wrote:
> This patch adds sysfs "otg_inputs" for usb role swap. This parameter
> is write-only and if you use them as the following, you can swap
> the usb role.
> 
> For example:
>  1) connect a usb cable using 2 salvator-x boards
>  2) On A-device (as host), you input the following command:
># echo a_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
>  3) On B-device (as peripheral), you input the following command:
># echo b_bus_req > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> 
> Then, the A-device acts as a peripheral (A-peripheral) and the B-device
> acts as a host (B-host).
> Please note that A-device must input the following command if you
> want the board to act as a host again. (even if you disconnect the usb
> cable, since id state may be the same, the condition keeps "A-peripheral".)
>  # echo a_bus_drop > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> 
> Also you can use the following command if you want the B-device board to
> act as a peripheral again.
>  # echo b_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
> 
> Signed-off-by: Yoshihiro Shimoda 
> ---
>  This patch is based on the latest linux-phy.git / next branch.
>  (commit id = 7809cd2ce6abd4f431e4b14e6b1276a7cc842ac4)
> 
>  Since this patch is related to usb, I added email addresses of Greg, Felipe,
>  Peter and USB ML as CC. (This patch doesn't use USB OTG FSM though.)
> 
>  Changed from v1:
>   - rebase the latest next branch.
> 
>  .../ABI/testing/sysfs-platform-phy-rcar-gen3-usb2  |  11 ++
>  drivers/phy/phy-rcar-gen3-usb2.c   | 124 
> -
>  2 files changed, 134 insertions(+), 1 deletion(-)
>  create mode 100644 
> Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> 
> diff --git a/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 
> b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> new file mode 100644
> index 000..c7e715af
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
> @@ -0,0 +1,11 @@
> +What:/sys/devices/platform//otg-inputs
> +Date:October 2016
> +KernelVersion:   4.10
> +Contact: Yoshihiro Shimoda 
> +Description:
> + This write-only file changes the phy mode for role swap of usb.
> + This file accepts the following strings:
> +  "a_bus_req/" - switching from A-Host to A-Peripheral
> +  "a_bus_drop" - switching from A-Peripheral to A-Host
> +  "b_bus_req"  - switching from B-Peripheral to B-Host
> +  "b_bus_req/" - switching from B-Host to B-Peripheral

Would you really care OTG FSM state machine? If not, you could just use
"host" and "peripheral" to stand for current USB role, and implement
role switch sysfs like: /sys/devices/platform//role.

Peter

> diff --git a/drivers/phy/phy-rcar-gen3-usb2.c 
> b/drivers/phy/phy-rcar-gen3-usb2.c
> index 3d97ead..80f5bcc 100644
> --- a/drivers/phy/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/phy-rcar-gen3-usb2.c
> @@ -70,6 +70,7 @@
>  #define USB2_LINECTRL1_DP_RPDBIT(18)
>  #define USB2_LINECTRL1_DMRPD_EN  BIT(17)
>  #define USB2_LINECTRL1_DM_RPDBIT(16)
> +#define USB2_LINECTRL1_OPMODE_NODRV  BIT(6)
>  
>  /* ADPCTRL */
>  #define USB2_ADPCTRL_OTGSESSVLD  BIT(20)
> @@ -161,6 +162,43 @@ static void rcar_gen3_init_for_peri(struct 
> rcar_gen3_chan *ch)
>   schedule_work(>work);
>  }
>  
> +static void rcar_gen3_init_for_b_host(struct rcar_gen3_chan *ch)
> +{
> + void __iomem *usb2_base = ch->base;
> + u32 val;
> +
> + val = readl(usb2_base + USB2_LINECTRL1);
> + writel(val | USB2_LINECTRL1_OPMODE_NODRV, usb2_base + USB2_LINECTRL1);
> +
> + rcar_gen3_set_linectrl(ch, 1, 1);
> + rcar_gen3_set_host_mode(ch, 1);
> + rcar_gen3_enable_vbus_ctrl(ch, 0);
> +
> + val = readl(usb2_base + USB2_LINECTRL1);
> + writel(val & ~USB2_LINECTRL1_OPMODE_NODRV, usb2_base + USB2_LINECTRL1);
> +}
> +
> +static void rcar_gen3_init_for_a_peri(struct rcar_gen3_chan *ch)
> +{
> + rcar_gen3_set_linectrl(ch, 0, 1);
> + rcar_gen3_set_host_mode(ch, 0);
> + rcar_gen3_enable_vbus_ctrl(ch, 1);
> +}
> +
> +static void rcar_gen3_init_from_a_peri_to_a_host(struct rcar_gen3_chan *ch)
> +{
> + void __iomem *usb2_base = ch->base;
> + u32 val;
> +
> + val = readl(usb2_base + USB2_OBINTEN);
> + writel(val & ~USB2_OBINT_BITS, usb2_base + USB2_OBINTEN);
> +
> + rcar_gen3_enable_vbus_ctrl(ch, 0);
> + rcar_gen3_init_for_host(ch);
> +
> + writel(val | USB2_OBINT_BITS, usb2_base + USB2_OBINTEN);
> +}
> +
>  static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
>  {
>   return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
> @@ -174,6 +212,71 @@ static void 

Re: [PATCH/RFC 4/5] arm64: dts: r8a7796: Enable ipmmu_ds0 and ipmmu_mm

2016-11-01 Thread Sergei Shtylyov

Hello.

On 10/31/2016 8:08 PM, Geert Uytterhoeven wrote:


Enable the IPMMU for Ethernet AVB.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index f6d15805b75031bb..dc416c300968b0e2 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -303,7 +303,7 @@
reg = <0 0xe674 0 0x1000>; /* IPMMU-DS0 */
renesas,ipmmu-main = <_mm 0>;
#iommu-cells = <1>;
-   status = "disabled";
+   status = "okay";
};

ipmmu_ds1: mmu@e774 {
@@ -320,7 +320,7 @@
interrupts = ,
 ;
#iommu-cells = <1>;
-   status = "disabled";
+   status = "okay";


   You could just omit the "status" prop in .dtsi -- the result should be the 
same.


[...]

MBR, Sergei



Re: [PATCH] ARM: shmobile: r8a7779/marzen: Add board part number to DT bindings

2016-11-01 Thread Simon Horman
On Mon, Oct 31, 2016 at 02:43:04PM +0100, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven 

Thanks, I have queued this up.


Re: [PATCH][resend] drm: bridge: add DesignWare HDMI I2S audio support

2016-11-01 Thread Russell King - ARM Linux
On Tue, Nov 01, 2016 at 12:36:29AM +, Kuninori Morimoto wrote:
> 
> Hi Russell again
> 
> > > > +static struct platform_driver snd_dw_hdmi_driver = {
> > > > +   .probe  = snd_dw_hdmi_probe,
> > > 
> > > The driver must have a .remove function, because the platform device it
> > > is binding against can appear and disappear.
> > 
> > Thank you for your feedback
> > OK, I will add it
> 
> This driver uses platform_device_register_full() and calls hdmi-codec
> driver. This driver itself doesn't register sound card, like 
> dw-hdmi-ahb-audio.c
> Then, what does .remove should do in this case ?

Remove the platform device that was created by
platform_device_register_full().

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


Re: [PATCH/RFC] ravb: Support 1Gbps on R-Car H3 ES1.1+ and R-Car M3-W

2016-11-01 Thread Simon Horman
On Mon, Oct 31, 2016 at 01:24:31PM -0400, David Miller wrote:
> From: Geert Uytterhoeven 
> Date: Mon, 31 Oct 2016 18:13:38 +0100
> 
> > The limitation to 10/100Mbit speeds on R-Car Gen3 is valid for R-Car H3
> > ES1.0 only. Check for the exact SoC model to allow 1Gbps on newer
> > revisions of R-Car H3, and on R-Car M3-W.
> > 
> > Signed-off-by: Geert Uytterhoeven 
> > ---
> > Tested on:
> >   - r8a7795/salvator-x with R-Car H3 ES1.0 (limited to 100Mbps),
> >   - r8a7795/salvator-x with R-Car H3 ES1.1 (1Gbps),
> >   - r8a7796/salvator-x with R-Car M3-W ES1.0 (1Gbps).
> > 
> > This is marked as an RFC because it depends on:
> >   A) the soc_device_match() infrastructure,
> >   B) Renesas SoC core ESx.y handling.
> > Hence I think the best merge strategy is to let this patch go in through
> > Simon's Renesas tree.
> > 
> > David: If you agree, can you please provide your ack? Thanks!
> 
> Sure, no problem:
> 
> Acked-by: David S. Miller 

Thanks Dave.

Geert, please repost or otherwise ping me once the dependencies are in
place and I should queue this up.


Re: [PATCH] clk: fix link error for rcar-gen2

2016-11-01 Thread Simon Horman
On Mon, Oct 31, 2016 at 11:02:36AM +0100, Geert Uytterhoeven wrote:
> On Mon, Oct 31, 2016 at 10:52 AM, Simon Horman  wrote:
> > From: Simon Horman 
> > Subject: [PATCH] ARM: shmobile: only call rcar_gen2_clocks_init() if present
> >
> > The RZ/G1M (r8a7743) uses the R-Car Gen2 core, but not the R-Car Gen2 clock
> > driver. This is a harbinger of a transition for R-Car Gen2 SoCs. As the
> > process to get all the required pieces in place is somewhat complex it
> > seems useful to try to disentangle dependencies where possible.
> >
> > The approach here is to temporarily disable calling rcar_gen2_clocks_init()
> > if no R-Car Gen2 SoC are configured and thus the symbol will not be
> 
> SoCs
> 
> > present.
> >
> > Fixes: 1254f607fc3d ("ARM: shmobile: r8a7743: basic SoC support")
> > Signed-off-by: Simon Horman 
> 
> Acked-by: Geert Uytterhoeven 

Thanks, I will queue this up.


Re: [PATCH] ARM: dts: r8a7794: remove Z clock

2016-11-01 Thread Simon Horman
On Sun, Oct 30, 2016 at 12:31:27AM +0300, Sergei Shtylyov wrote:
> R8A7794 doesn't have Cortex-A15 CPUs, thus there's no Z clock...
> 
> Fixes: 0dce5454d5c2 ("ARM: shmobile: Initial r8a7794 SoC device tree")
> Signed-off-by: Sergei Shtylyov 
> 
> ---
> The patch is against the 'master' branch of Simon Horman's 'renesas.git' repo.

Thanks, I have queued this up.


Re: [PATCH v3 2/3] mmc: tmio-mmc: add support for 32bit data port

2016-11-01 Thread Wolfram Sang
Hi Chris,

On Mon, Sep 12, 2016 at 10:15:06AM -0400, Chris Brandt wrote:
> For the r7s72100 SOC, the DATA_PORT register was changed to 32-bits wide.
> Therefore a new flag has been created that will allow 32-bit reads/writes
> to the DATA_PORT register instead of 16-bit (because 16-bits accesses are
> not supported).
> 
> Signed-off-by: Chris Brandt 

Okay, I have a sketch how to add this feature to R-Car SoCs at a later
stage. This patch is fine with one minor nit which can be done now or I
can do it later when I add the R-Car support.

> + * Some controllers have a 32-bit wide data port register
> + */
> +#define TMIO_MMC_32BIT_DATA_PORT (1 << 9)

Since R-Car Gen3 has 64 bit port, I'd suggest to use
TMIO_MMC_BIG_DATA_PORT or something. But as I said, I can also do this
later. So

Reviewed-by: Wolfram Sang 



signature.asc
Description: PGP signature


[PATCH v2] phy: rcar-gen3-usb2: add sysfs for usb role swap

2016-11-01 Thread Yoshihiro Shimoda
This patch adds sysfs "otg_inputs" for usb role swap. This parameter
is write-only and if you use them as the following, you can swap
the usb role.

For example:
 1) connect a usb cable using 2 salvator-x boards
 2) On A-device (as host), you input the following command:
   # echo a_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs
 3) On B-device (as peripheral), you input the following command:
   # echo b_bus_req > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs

Then, the A-device acts as a peripheral (A-peripheral) and the B-device
acts as a host (B-host).
Please note that A-device must input the following command if you
want the board to act as a host again. (even if you disconnect the usb
cable, since id state may be the same, the condition keeps "A-peripheral".)
 # echo a_bus_drop > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs

Also you can use the following command if you want the B-device board to
act as a peripheral again.
 # echo b_bus_req/ > /sys/devices/platform/soc/ee080200.usb-phy/otg_inputs

Signed-off-by: Yoshihiro Shimoda 
---
 This patch is based on the latest linux-phy.git / next branch.
 (commit id = 7809cd2ce6abd4f431e4b14e6b1276a7cc842ac4)

 Since this patch is related to usb, I added email addresses of Greg, Felipe,
 Peter and USB ML as CC. (This patch doesn't use USB OTG FSM though.)

 Changed from v1:
  - rebase the latest next branch.

 .../ABI/testing/sysfs-platform-phy-rcar-gen3-usb2  |  11 ++
 drivers/phy/phy-rcar-gen3-usb2.c   | 124 -
 2 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2

diff --git a/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2 
b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
new file mode 100644
index 000..c7e715af
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-platform-phy-rcar-gen3-usb2
@@ -0,0 +1,11 @@
+What:  /sys/devices/platform//otg-inputs
+Date:  October 2016
+KernelVersion: 4.10
+Contact:   Yoshihiro Shimoda 
+Description:
+   This write-only file changes the phy mode for role swap of usb.
+   This file accepts the following strings:
+"a_bus_req/" - switching from A-Host to A-Peripheral
+"a_bus_drop" - switching from A-Peripheral to A-Host
+"b_bus_req"  - switching from B-Peripheral to B-Host
+"b_bus_req/" - switching from B-Host to B-Peripheral
diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index 3d97ead..80f5bcc 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -70,6 +70,7 @@
 #define USB2_LINECTRL1_DP_RPD  BIT(18)
 #define USB2_LINECTRL1_DMRPD_ENBIT(17)
 #define USB2_LINECTRL1_DM_RPD  BIT(16)
+#define USB2_LINECTRL1_OPMODE_NODRVBIT(6)
 
 /* ADPCTRL */
 #define USB2_ADPCTRL_OTGSESSVLDBIT(20)
@@ -161,6 +162,43 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan 
*ch)
schedule_work(>work);
 }
 
+static void rcar_gen3_init_for_b_host(struct rcar_gen3_chan *ch)
+{
+   void __iomem *usb2_base = ch->base;
+   u32 val;
+
+   val = readl(usb2_base + USB2_LINECTRL1);
+   writel(val | USB2_LINECTRL1_OPMODE_NODRV, usb2_base + USB2_LINECTRL1);
+
+   rcar_gen3_set_linectrl(ch, 1, 1);
+   rcar_gen3_set_host_mode(ch, 1);
+   rcar_gen3_enable_vbus_ctrl(ch, 0);
+
+   val = readl(usb2_base + USB2_LINECTRL1);
+   writel(val & ~USB2_LINECTRL1_OPMODE_NODRV, usb2_base + USB2_LINECTRL1);
+}
+
+static void rcar_gen3_init_for_a_peri(struct rcar_gen3_chan *ch)
+{
+   rcar_gen3_set_linectrl(ch, 0, 1);
+   rcar_gen3_set_host_mode(ch, 0);
+   rcar_gen3_enable_vbus_ctrl(ch, 1);
+}
+
+static void rcar_gen3_init_from_a_peri_to_a_host(struct rcar_gen3_chan *ch)
+{
+   void __iomem *usb2_base = ch->base;
+   u32 val;
+
+   val = readl(usb2_base + USB2_OBINTEN);
+   writel(val & ~USB2_OBINT_BITS, usb2_base + USB2_OBINTEN);
+
+   rcar_gen3_enable_vbus_ctrl(ch, 0);
+   rcar_gen3_init_for_host(ch);
+
+   writel(val | USB2_OBINT_BITS, usb2_base + USB2_OBINTEN);
+}
+
 static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 {
return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
@@ -174,6 +212,71 @@ static void rcar_gen3_device_recognition(struct 
rcar_gen3_chan *ch)
rcar_gen3_init_for_peri(ch);
 }
 
+/*
+ * The following table is a state transition for usb phy mode:
+ * State   Event   Next state
+ * disconnected:   E1  a_host
+ * E2  b_peripheral
+ * A-Device - a_host:  E2  b_peripheral
+ * E3  disconnected
+ * E4  a_suspend
+ * A-Device -