RE: [PATCH 0/5] usb: gadget: udc: renesas_usb3: add DMAC support

2017-05-22 Thread Yoshihiro Shimoda
Hi Felipe,

> -Original Message-
> From: Yoshihiro Shimoda
> Sent: Wednesday, April 26, 2017 8:50 PM
> 
> This patch set is based on the latest Feribe's usb.git / testing/next branch
> (the commit id = 28ea6be01e2cf244c461a40c8e9593816f894412.)

I'm afraid but, would you review this patch set?
This patch set can be applied on the today's testing/next branch.

Best regards,
Yoshihiro Shimoda

> This patch set has 2 things:
>  - Fixes some minor issues.
>  - Add support for dedicated DMAC.
> 
> If possible, I want the patches [1/5] to [4/5] to be applied to v4.12-rcN.
> I think the patch [5/5] will be applied to v4.13 (or later).
> Should I submit them sepaletely?
> 
> Yoshihiro Shimoda (5):
>   usb: gadget: udc: renesas_usb3: fix pm_runtime functions calling
>   usb: gadget: udc: renesas_usb3: fix deadlock by spinlock
>   usb: gadget: udc: renesas_usb3: lock for PN_ registers access
>   usb: gadget: udc: renesas_usb3: Fix PN_INT_ENA disabling timing
>   usb: gadget: udc: renesas_usb3: add support for dedicated DMAC
> 
>  drivers/usb/gadget/udc/renesas_usb3.c | 438 
> +-
>  1 file changed, 425 insertions(+), 13 deletions(-)
> 
> --
> 1.9.1



Re: [PATCH v5 6/6] spi: slave: Add SPI slave handler controlling system state

2017-05-22 Thread Andy Shevchenko
On Mon, May 22, 2017 at 4:11 PM, Geert Uytterhoeven
 wrote:
> Add an example SPI slave handler to allow remote control of system
> reboot, power off, halt, and suspend.
>

FWIW:
Reviewed-by: Andy Shevchenko 

> Signed-off-by: Geert Uytterhoeven 
> ---
> v5:
>   - Add usage documentation to file header,
>   - Use network byte order for commands, to match the "-p" parameter of
> spidev_test,
>   - Replace pr_*() by dev_*(), stop printing __func__,
>   - Remove spi_setup() call to configure 8 bits per word, as that's the
> default,
>
> v3, v4:
>   - No changes,
>
> v2:
>   - Use spi_async() instead of spi_read(),
>   - Submit the next transfer from the previous transfer's completion
> callback, removing the need for a thread,
>   - Let .remove() call spi_slave_abort() to cancel the current ongoing
> transfer, and wait for the completion to terminate,
>   - Remove FIXME about hanging kthread_stop(),
>   - Fix copy-and-pasted module description.
> ---
>  drivers/spi/Kconfig|   6 ++
>  drivers/spi/Makefile   |   1 +
>  drivers/spi/spi-slave-system-control.c | 154 
> +
>  3 files changed, 161 insertions(+)
>  create mode 100644 drivers/spi/spi-slave-system-control.c
>
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 9972ee2a8454a2fc..82cd818aa06293f5 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -803,6 +803,12 @@ config SPI_SLAVE_TIME
>   SPI slave handler responding with the time of reception of the last
>   SPI message.
>
> +config SPI_SLAVE_SYSTEM_CONTROL
> +   tristate "SPI slave handler controlling system state"
> +   help
> + SPI slave handler to allow remote control of system reboot, power
> + off, halt, and suspend.
> +
>  endif # SPI_SLAVE
>
>  endif # SPI
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index fb078693dbe40da4..1d7923e8c63bc22b 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -108,3 +108,4 @@ obj-$(CONFIG_SPI_ZYNQMP_GQSPI)  += 
> spi-zynqmp-gqspi.o
>
>  # SPI slave protocol handlers
>  obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
> +obj-$(CONFIG_SPI_SLAVE_SYSTEM_CONTROL) += spi-slave-system-control.o
> diff --git a/drivers/spi/spi-slave-system-control.c 
> b/drivers/spi/spi-slave-system-control.c
> new file mode 100644
> index ..c0257e937995ec53
> --- /dev/null
> +++ b/drivers/spi/spi-slave-system-control.c
> @@ -0,0 +1,154 @@
> +/*
> + * SPI slave handler controlling system state
> + *
> + * This SPI slave handler allows remote control of system reboot, power off,
> + * halt, and suspend.
> + *
> + * Copyright (C) 2016-2017 Glider bvba
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + *
> + * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
> + * system):
> + *
> + *   # reboot='\x7c\x50'
> + *   # poweroff='\x71\x3f'
> + *   # halt='\x38\x76'
> + *   # suspend='\x1b\x1b'
> + *   # spidev_test -D /dev/spidev2.0 -p $suspend # or $reboot, $poweroff, 
> $halt
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/*
> + * The numbers are chosen to display something human-readable on two 
> 7-segment
> + * displays connected to two 74HC595 shift registers
> + */
> +#define CMD_REBOOT 0x7c50  /* rb */
> +#define CMD_POWEROFF   0x713f  /* OF */
> +#define CMD_HALT   0x3876  /* HL */
> +#define CMD_SUSPEND0x1b1b  /* ZZ */
> +
> +struct spi_slave_system_control_priv {
> +   struct spi_device *spi;
> +   struct completion finished;
> +   struct spi_transfer xfer;
> +   struct spi_message msg;
> +   __be16 cmd;
> +};
> +
> +static
> +int spi_slave_system_control_submit(struct spi_slave_system_control_priv 
> *priv);
> +
> +static void spi_slave_system_control_complete(void *arg)
> +{
> +   struct spi_slave_system_control_priv *priv = arg;
> +   u16 cmd;
> +   int ret;
> +
> +   if (priv->msg.status)
> +   goto terminate;
> +
> +   cmd = be16_to_cpu(priv->cmd);
> +   switch (cmd) {
> +   case CMD_REBOOT:
> +   dev_info(&priv->spi->dev, "Rebooting system...\n");
> +   kernel_restart(NULL);
> +
> +   case CMD_POWEROFF:
> +   dev_info(&priv->spi->dev, "Powering off system...\n");
> +   kernel_power_off();
> +   break;
> +
> +   case CMD_HALT:
> +   dev_info(&priv->spi->dev, "Halting system...\n");
> +   kernel_halt();
> +   break;
> +
> +   case CMD_SUSPEND:
> +   dev_info(&priv->spi->dev, "Suspending system...\n");
> +   pm_suspend(PM_SUSPEND_MEM);
> +   break;
> +
> +   default:
> +   dev_warn(&priv->spi->dev, "Unknown command 0x%x\n", cmd);
> + 

Re: [PATCH v5 5/6] spi: slave: Add SPI slave handler reporting uptime at previous message

2017-05-22 Thread Andy Shevchenko
On Mon, May 22, 2017 at 4:11 PM, Geert Uytterhoeven
 wrote:
> Add an example SPI slave handler responding with the uptime at the time
> of reception of the last SPI message.
>
> This can be used by an external microcontroller as a dead man's switch.
>

FWIW:
Reviewed-by: Andy Shevchenko 

> Signed-off-by: Geert Uytterhoeven 
> ---
> v5:
>   - Add usage documentation to file header,
>   - Replace pr_*() by dev_*(), stop printing __func__,
>   - Rename rem_ns to rem_us, as the remainder is in microseconds,
>   - Remove spi_setup() call to configure 8 bits per word, as that's the
> default,
>
> v4:
>   - No changes,
>
> v3:
>   - Add #include ,
>
> v2:
>   - Resolve semantic differences in patch description, file header, and
> module description,
>   - Use spi_async() instead of spi_read(),
>   - Submit the next transfer from the previous transfer's completion
> callback, removing the need for a thread,
>   - Let .remove() call spi_slave_abort() to cancel the current ongoing
> transfer, and wait for the completion to terminate,
>   - Remove FIXME about hanging kthread_stop().
> ---
>  drivers/spi/Kconfig  |   6 ++
>  drivers/spi/Makefile |   1 +
>  drivers/spi/spi-slave-time.c | 129 
> +++
>  3 files changed, 136 insertions(+)
>  create mode 100644 drivers/spi/spi-slave-time.c
>
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index f21499b1f71ab7c3..9972ee2a8454a2fc 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -797,6 +797,12 @@ config SPI_SLAVE
>
>  if SPI_SLAVE
>
> +config SPI_SLAVE_TIME
> +   tristate "SPI slave handler reporting boot up time"
> +   help
> + SPI slave handler responding with the time of reception of the last
> + SPI message.
> +
>  endif # SPI_SLAVE
>
>  endif # SPI
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index e50852c6fcb87d8b..fb078693dbe40da4 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -107,3 +107,4 @@ obj-$(CONFIG_SPI_XTENSA_XTFPGA) += 
> spi-xtensa-xtfpga.o
>  obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
>
>  # SPI slave protocol handlers
> +obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
> diff --git a/drivers/spi/spi-slave-time.c b/drivers/spi/spi-slave-time.c
> new file mode 100644
> index ..f2e07a392d6863ea
> --- /dev/null
> +++ b/drivers/spi/spi-slave-time.c
> @@ -0,0 +1,129 @@
> +/*
> + * SPI slave handler reporting uptime at reception of previous SPI message
> + *
> + * This SPI slave handler sends the time of reception of the last SPI message
> + * as two 32-bit unsigned integers in binary format and in network byte 
> order,
> + * representing the number of seconds and fractional seconds (in 
> microseconds)
> + * since boot up.
> + *
> + * Copyright (C) 2016-2017 Glider bvba
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + *
> + * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
> + * system):
> + *
> + *   # spidev_test -D /dev/spidev2.0 -p dummy-8B
> + *   spi mode: 0x0
> + *   bits per word: 8
> + *   max speed: 50 Hz (500 KHz)
> + *   RX | 00 00 04 6D 00 09 5B BB ...
> + * ^
> + * seconds  microseconds
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +
> +struct spi_slave_time_priv {
> +   struct spi_device *spi;
> +   struct completion finished;
> +   struct spi_transfer xfer;
> +   struct spi_message msg;
> +   __be32 buf[2];
> +};
> +
> +static int spi_slave_time_submit(struct spi_slave_time_priv *priv);
> +
> +static void spi_slave_time_complete(void *arg)
> +{
> +   struct spi_slave_time_priv *priv = arg;
> +   int ret;
> +
> +   ret = priv->msg.status;
> +   if (ret)
> +   goto terminate;
> +
> +   ret = spi_slave_time_submit(priv);
> +   if (ret)
> +   goto terminate;
> +
> +   return;
> +
> +terminate:
> +   dev_info(&priv->spi->dev, "Terminating\n");
> +   complete(&priv->finished);
> +}
> +
> +static int spi_slave_time_submit(struct spi_slave_time_priv *priv)
> +{
> +   u32 rem_us;
> +   int ret;
> +   u64 ts;
> +
> +   ts = local_clock();
> +   rem_us = do_div(ts, 10) / 1000;
> +
> +   priv->buf[0] = cpu_to_be32(ts);
> +   priv->buf[1] = cpu_to_be32(rem_us);
> +
> +   spi_message_init_with_transfers(&priv->msg, &priv->xfer, 1);
> +
> +   priv->msg.complete = spi_slave_time_complete;
> +   priv->msg.context = priv;
> +
> +   ret = spi_async(priv->spi, &priv->msg);
> +   if (ret)
> +   dev_err(&priv->spi->dev, "spi_async() failed %d\n", ret);
> +
> +   return ret;
> +}
> +
> +static int spi_slave_time_probe(struct spi_device *spi)
> +{
> +   struct spi_s

[PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-22 Thread Kieran Bingham
From: Kieran Bingham 

Provide a helper to obtain the parent device fwnode without first
parsing the remote-endpoint as per fwnode_graph_get_remote_port_parent.

Signed-off-by: Kieran Bingham 

---
v2:
 - Rebase on top of Sakari's acpi-graph-clean branch and simplify

v3:
 - Fix up kerneldoc
 - Get the 'port' of the endpoint to find the parent of the port

 drivers/base/property.c  | 15 +++
 include/linux/property.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index b311a6fa7d0c..fdbc644fd743 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1169,6 +1169,21 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle 
*fwnode,
 EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
 
 /**
+ * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
+ * @endpoint: Endpoint firmware node of the port
+ *
+ * Return: the firmware node of the device the @endpoint belongs to.
+ */
+struct fwnode_handle *
+fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
+{
+   struct fwnode_handle *port = fwnode_get_next_parent(endpoint);
+
+   return fwnode_call_ptr_op(port, graph_get_port_parent);
+}
+EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent);
+
+/**
  * fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
  * @fwnode: Endpoint firmware node pointing to the remote endpoint
  *
diff --git a/include/linux/property.h b/include/linux/property.h
index b9f4838d9882..af95d5d84192 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -275,6 +275,8 @@ void *device_get_mac_address(struct device *dev, char 
*addr, int alen);
 
 struct fwnode_handle *fwnode_graph_get_next_endpoint(
struct fwnode_handle *fwnode, struct fwnode_handle *prev);
+struct fwnode_handle *fwnode_graph_get_port_parent(
+   struct fwnode_handle *fwnode);
 struct fwnode_handle *fwnode_graph_get_remote_port_parent(
struct fwnode_handle *fwnode);
 struct fwnode_handle *fwnode_graph_get_remote_port(
-- 
git-series 0.9.1


[PATCH v3 2/2] v4l: async: Match parent devices

2017-05-22 Thread Kieran Bingham
From: Kieran Bingham 

Devices supporting multiple endpoints on a single device node must set
their subdevice fwnode to the endpoint to allow distinct comparisons.

Adapt the match_fwnode call to compare against the provided fwnodes
first, but also to search for a comparison against the parent fwnode.

This allows notifiers to pass the endpoint for comparison and still
support existing subdevices which store their default parent device
node.

Signed-off-by: Kieran Bingham 

---
v2:
 - Added documentation comments
 - simplified the OF match by adding match_fwnode_of()

v3:
 - Fix comments
 - Fix sd_parent, and asd_parent usage

 drivers/media/v4l2-core/v4l2-async.c | 36 -
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index cbd919d4edd2..12c0707851fd 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -41,14 +41,40 @@ static bool match_devname(struct v4l2_subdev *sd,
return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
 }
 
+/*
+ * Check whether the two device_node pointers refer to the same OF node. We
+ * can't compare pointers directly as they can differ if overlays have been
+ * applied.
+ */
+static bool match_fwnode_of(struct fwnode_handle *a, struct fwnode_handle *b)
+{
+   return !of_node_cmp(of_node_full_name(to_of_node(a)),
+   of_node_full_name(to_of_node(b)));
+}
+
+/*
+ * As a measure to support drivers which have not been converted to use
+ * endpoint matching, we also find the parent devices for cross-matching.
+ *
+ * When all devices use endpoint matching, this code can be simplified, and the
+ * parent comparisons can be removed.
+ */
 static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
-   if (!is_of_node(sd->fwnode) || !is_of_node(asd->match.fwnode.fwnode))
-   return sd->fwnode == asd->match.fwnode.fwnode;
+   struct fwnode_handle *asd_fwnode = asd->match.fwnode.fwnode;
+   struct fwnode_handle *sd_parent, *asd_parent;
+
+   sd_parent = fwnode_graph_get_port_parent(sd->fwnode);
+   asd_parent = fwnode_graph_get_port_parent(asd_fwnode);
+
+   if (!is_of_node(sd->fwnode) || !is_of_node(asd_fwnode))
+   return sd->fwnode == asd_fwnode ||
+  sd_parent == asd_fwnode ||
+  sd->fwnode == asd_parent;
 
-   return !of_node_cmp(of_node_full_name(to_of_node(sd->fwnode)),
-   of_node_full_name(
-   to_of_node(asd->match.fwnode.fwnode)));
+   return match_fwnode_of(sd->fwnode, asd_fwnode) ||
+  match_fwnode_of(sd_parent, asd_fwnode) ||
+  match_fwnode_of(sd->fwnode, asd_parent);
 }
 
 static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
-- 
git-series 0.9.1


[PATCH v3 0/2] v4l: async: Match parent devices

2017-05-22 Thread Kieran Bingham
From: Kieran Bingham 

As devices become more complicated, it becomes necessary (and more
accurate) to match devices based on their endpoint, as devices may
have multiple subdevices.

To support using endpoints in the V4L2 async subdev framework, while
some devices still use their device fwnode, we need to be able to parse
a fwnode for the device from the endpoint.

By providing a helper fwnode_graph_get_port_parent(), we can use it in
the match_fwnode to support matches during the transition to endpoint
matching.

This series is dependant upon Sakari's v4l2-acpi and acpi-graph-cleaned
branch

v2:
 - Rebased on top of git.linuxtv.org/sailus/media_tree.git #acpi-graph-cleaned

v3:
 - Fixed uninitialised asd_parent
 - Improved kerneldocs
 - Get the 'port' of the endpoint in fwnode_graph_get_port_parent

Kieran Bingham (2):
  device property: Add fwnode_graph_get_port_parent
  v4l: async: Match parent devices

 drivers/base/property.c  | 15 -
 drivers/media/v4l2-core/v4l2-async.c | 36 -
 include/linux/property.h |  2 ++-
 3 files changed, 48 insertions(+), 5 deletions(-)

base-commit: d043978c7c919c727fb76b6593c71d0e697a5d66
-- 
git-series 0.9.1


Re: [PATCH v2 2/2] v4l: async: Match parent devices

2017-05-22 Thread Kieran Bingham
Reviewing my own post:

On 19/05/17 17:16, Kieran Bingham wrote:
> From: Kieran Bingham 
> 
> Devices supporting multiple endpoints on a single device node must set
> their subdevice fwnode to the endpoint to allow distinct comparisons.
> 
> Adapt the match_fwnode call to compare against the provided fwnodes
> first, but also to search for a comparison against the parent fwnode.
> 
> This allows notifiers to pass the endpoint for comparison and still
> support existing subdevices which store their default parent device
> node.
> 
> Signed-off-by: Kieran Bingham 
> 
> ---
> v2:
>  - Added documentation comments
>  - simplified the OF match by adding match_fwnode_of()
> 
>  drivers/media/v4l2-core/v4l2-async.c | 33 -
>  1 file changed, 28 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index cbd919d4edd2..2473c0a1f7a8 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -41,14 +41,37 @@ static bool match_devname(struct v4l2_subdev *sd,
>   return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
>  }
>  
> +static bool match_fwnode_of(struct fwnode_handle *a, struct fwnode_handle *b)
> +{
> + return !of_node_cmp(of_node_full_name(to_of_node(a)),
> + of_node_full_name(to_of_node(b)));
> +}
> +
> +/*
> + * Compare the sd with the notifier.
> + *
> + * As a measure to support drivers which have not been converted to use
> + * endpoint matching, we also find the parent device of the node in the
> + * notifier, and compare the sd against that device.
> + */
>  static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev 
> *asd)
>  {
> - if (!is_of_node(sd->fwnode) || !is_of_node(asd->match.fwnode.fwnode))
> - return sd->fwnode == asd->match.fwnode.fwnode;
> + struct fwnode_handle *asd_fwnode = asd->match.fwnode.fwnode;
> + struct fwnode_handle *sd_parent, *asd_parent;
> +

The keen eyed will notice that sd_parent is not initialised here before use:
Fixed in the next version, pending testing and repost.

> + asd_parent = fwnode_graph_get_port_parent(asd_fwnode);
> +
> + if (!is_of_node(sd->fwnode) || !is_of_node(asd_fwnode))
> + return sd->fwnode == asd_fwnode ||
> +sd_parent == asd_fwnode ||
> +sd->fwnode == asd_parent;
>  
> - return !of_node_cmp(of_node_full_name(to_of_node(sd->fwnode)),
> - of_node_full_name(
> - to_of_node(asd->match.fwnode.fwnode)));
> + /*
> +  * Compare OF nodes with a full match to support removable dt snippets.
> +  */
> + return match_fwnode_of(sd->fwnode, asd_fwnode) ||
> +match_fwnode_of(sd_parent, asd_fwnode) ||
> +match_fwnode_of(sd->fwnode, asd_parent);
>  }
>  
>  static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev 
> *asd)
> 


Re: [PATCH v2 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-22 Thread Kieran Bingham
Hi Sakari,

On 19/05/17 22:51, Sakari Ailus wrote:
> Hi Kieran,
> 
> On Fri, May 19, 2017 at 05:16:02PM +0100, Kieran Bingham wrote:
>> +struct fwnode_handle *
>> +fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
>> +{
>> +return fwnode_call_ptr_op(endpoint, graph_get_port_parent);
> 
> graph_get_port_parent op will actually get the parent of the port. But it
> expects a port node, not an endpoint node. This is implemented so in order
> to center the ops around primitives rather than end user APIs that may
> change over time.
> 
> I think you'll need:
> 
>   return fwnode_call_ptr_op(fwnode_graph_get_next_parent(endpoint),
> graph_get_port_parent);
> 
> Or something like that.

Aha - that explains why I remember thinking to ask you if the implementation of
graph_get_port_parent checked enough levels up :)

I've added the fwnode_graph_get_next_parent() call, but separated it out so that
the code fits cleanly:

struct fwnode_handle *
fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
{
struct fwnode_handle *port = fwnode_get_next_parent(endpoint);

return fwnode_call_ptr_op(port, graph_get_port_parent);
}
EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent);

I will include this in my testing and rebasing before I repost.
--
Regards

Kieran


Re: [PATCH v1 3/3] v4l: async: Match parent devices

2017-05-22 Thread Kieran Bingham
Hi Laurent,

On 18/05/17 15:01, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Wednesday 17 May 2017 16:03:39 Kieran Bingham wrote:
>> From: Kieran Bingham 
>>
>> Devices supporting multiple endpoints on a single device node must set
>> their subdevice fwnode to the endpoint to allow distinct comparisons.
>>
>> Adapt the match_fwnode call to compare against the provided fwnodes
>> first, but also to search for a comparison against the parent fwnode.
>>
>> This allows notifiers to pass the endpoint for comparison and still
>> support existing subdevices which store their default parent device
>> node.
>>
>> Signed-off-by: Kieran Bingham 
>> ---
>>  drivers/media/v4l2-core/v4l2-async.c | 20 
>>  1 file changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-async.c
>> b/drivers/media/v4l2-core/v4l2-async.c index e1e181db90f7..65735a5c4350
>> 100644
>> --- a/drivers/media/v4l2-core/v4l2-async.c
>> +++ b/drivers/media/v4l2-core/v4l2-async.c
>> @@ -41,14 +41,26 @@ static bool match_devname(struct v4l2_subdev *sd,
>>  return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
>>  }
>>
> /*
>  * Check whether the two device_node pointers refer to the same OF node. We
>  * can't compare pointers directly as they can differ if overlays have been
>  * applied.
>  */

Thanks - that's a good addition - I've put it in.

> 
>> +static bool match_of(struct device_node *a, struct device_node *b)
>> +{
>> +return !of_node_cmp(of_node_full_name(a), of_node_full_name(b));
>> +}
>> +
>>  static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev
>> *asd)
>> {
>> +struct device_node *sdnode;
>> +struct fwnode_handle *async_device;
> 
> I would name this asd_fwnode, and to be consistent rename sdnode to sd_ofnode.

Actually, now that I agree with Sakari, and the parent of both the SD and the
ASD should be cross-referenced, I have used:

sd_parent = fwnode_graph_get_port_parent(sd->fwnode);
asd_parent = fwnode_graph_get_port_parent(asd_fwnode);

> 
>> +
>> +async_device = fwnode_graph_get_port_parent(asd->match.fwnode.fwnode);
>> +
>>  if (!is_of_node(sd->fwnode) || !is_of_node(asd->match.fwnode.fwnode))
>> -return sd->fwnode == asd->match.fwnode.fwnode;
>> +return sd->fwnode == asd->match.fwnode.fwnode ||
>> +   sd->fwnode == async_device;
> 
> I wonder whether we could simplify this by changing the 
> fwnode_graph_get_port_parent() API. At the moment the function walks two or 
> three levels up depending on whether there's a ports name or not. If we 
> turned 
> in into a function that accepts an endpoint, port or device node, and returns 
> the device node unconditionally (basically, returning the argument if its 
> name 
> is not "port(@[0-9]+)?" or "endpoint(@[0-9]+)?", and walking up until it 
> reaches the device node otherwise), you could write the above
> 
>   asd_fwnode = fwnode_graph_get_port_parent(asd->match.fwnode.fwnode);
> 
>   if (!is_of_node(sd->fwnode) || !is_of_node(asd_fwnode))
>  sd->fwnode == asd_fwnode;
> 
>   sdnode = to_of_node(sd->fwnode);
>  
>   return match_of(sdnode, to_of_node(asd_node));


I don't think that would help here. I want the function to do comparisons on the
endpoint when provided - I don't want helpers to suddenly bring the comparison
up to the device level.

> 
>> +
>> +sdnode = to_of_node(sd->fwnode);
>>
>> -return !of_node_cmp(of_node_full_name(to_of_node(sd->fwnode)),
>> -of_node_full_name(
>> -to_of_node(asd->match.fwnode.fwnode)));
>> +return match_of(sdnode, to_of_node(asd->match.fwnode.fwnode)) ||
>> +   match_of(sdnode, to_of_node(async_device));
> 
> This is getting a bit complex, could you document the function ?

I've added comments, and improved helpers - I think it's looking a lot better 
now :)

> 
>>  }
>>
>>  static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev
>> *asd)
> 

--
Kieran


[PATCH v4 09/20] ARM: dts: r7s72100: Add generic compatible string for I2C EEPROM

2017-05-22 Thread Javier Martinez Canillas
The at24 driver allows to register I2C EEPROM chips using different vendor
and devices, but the I2C subsystem does not take the vendor into account
when matching using the I2C table since it only has device entries.

But when matching using an OF table, both the vendor and device has to be
taken into account so the driver defines only a set of compatible strings
using the "atmel" vendor as a generic fallback for compatible I2C devices.

So add this generic fallback to the device node compatible string to make
the device to match the driver using the OF device ID table.

Signed-off-by: Javier Martinez Canillas 
Reviewed-by: Geert Uytterhoeven 

---

Changes in v4:
- Only use the atmel manufacturer in the compatible string instead of
  keeping the deprecated ones (Rob Herring).

Changes in v3:
- Add Geert Uytterhoeven reviewed-by tag.

Changes in v2: None

 arch/arm/boot/dts/r7s72100-genmai.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts 
b/arch/arm/boot/dts/r7s72100-genmai.dts
index 52a7b586bac7..0184490ce0ad 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -57,7 +57,7 @@
clock-frequency = <40>;
 
eeprom@50 {
-   compatible = "renesas,24c128";
+   compatible = "atmel,24c128";
reg = <0x50>;
pagesize = <64>;
};
-- 
2.9.3



[PATCH v4 10/20] ARM: dts: koelsch: Add generic compatible string for I2C EEPROM

2017-05-22 Thread Javier Martinez Canillas
The at24 driver allows to register I2C EEPROM chips using different vendor
and devices, but the I2C subsystem does not take the vendor into account
when matching using the I2C table since it only has device entries.

But when matching using an OF table, both the vendor and device has to be
taken into account so the driver defines only a set of compatible strings
using the "atmel" vendor as a generic fallback for compatible I2C devices.

So add this generic fallback to the device node compatible string to make
the device to match the driver using the OF device ID table.

Signed-off-by: Javier Martinez Canillas 
Reviewed-by: Geert Uytterhoeven 

---

Changes in v4:
- Only use the atmel manufacturer in the compatible string instead of
  keeping the deprecated ones (Rob Herring).

Changes in v3:
- Add Geert Uytterhoeven reviewed-by tag.

Changes in v2: None

 arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 001e6116c47c..4234667da2b8 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -702,7 +702,7 @@
};
 
eeprom@50 {
-   compatible = "renesas,24c02";
+   compatible = "atmel,24c02";
reg = <0x50>;
pagesize = <16>;
};
-- 
2.9.3



[PATCH 29/35] arm64: dts: renesas: salvator-x: Add DU external dot clock sources

2017-05-22 Thread Simon Horman
From: Laurent Pinchart 

The DU1 and DU2 external dot clocks are fixed frequency clock generators
running at 33MHz, while the DU0 and DU3 external dot clocks are
generated by an I2C-controlled programmable clock generator.

All those clock generators are available on both the H3 and M3-W
Salvator-X boards. Add them to the salvator-x.dtsi file.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/salvator-x.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi 
b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
index 7240bcd75918..35cd7e367234 100644
--- a/arch/arm64/boot/dts/renesas/salvator-x.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
@@ -198,6 +198,25 @@
#clock-cells = <0>;
clock-frequency = <24576000>;
};
+
+   /* 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>;
+   };
+
+   x23_clk: x23-clock {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2500>;
+   };
 };
 
 &audio_clk_a {
@@ -296,6 +315,14 @@
 &i2c4 {
status = "okay";
 
+   versaclock5: clock-generator@6a {
+   compatible = "idt,5p49v5923";
+   reg = <0x6a>;
+   #clock-cells = <1>;
+   clocks = <&x23_clk>;
+   clock-names = "xin";
+   };
+
csa_vdd: adc@7c {
compatible = "maxim,max9611";
reg = <0x7c>;
-- 
2.1.4



[PATCH 22/35] arm64: dts: r8a7796: add Sound SRC support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 54 
 1 file changed, 54 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index a1d08c89ceed..778275a980d3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1191,6 +1191,11 @@
 <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
 <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
 <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
+<&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
+<&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
+<&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
+<&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
+<&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
 <&audio_clk_a>, <&audio_clk_b>,
 <&audio_clk_c>,
 <&cpg CPG_CORE R8A7796_CLK_S0D4>;
@@ -1198,6 +1203,9 @@
  "ssi.9", "ssi.8", "ssi.7", "ssi.6",
  "ssi.5", "ssi.4", "ssi.3", "ssi.2",
  "ssi.1", "ssi.0",
+ "src.9", "src.8", "src.7", "src.6",
+ "src.5", "src.4", "src.3", "src.2",
+ "src.1", "src.0",
  "clk_a", "clk_b", "clk_c", "clk_i";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
@@ -1212,8 +1220,54 @@
 
rcar_sound,src {
src0: src-0 {
+   interrupts = ;
+   dmas = <&audma0 0x85>, <&audma1 0x9a>;
+   dma-names = "rx", "tx";
};
src1: src-1 {
+   interrupts = ;
+   dmas = <&audma0 0x87>, <&audma1 0x9c>;
+   dma-names = "rx", "tx";
+   };
+   src2: src-2 {
+   interrupts = ;
+   dmas = <&audma0 0x89>, <&audma1 0x9e>;
+   dma-names = "rx", "tx";
+   };
+   src3: src-3 {
+   interrupts = ;
+   dmas = <&audma0 0x8b>, <&audma1 0xa0>;
+   dma-names = "rx", "tx";
+   };
+   src4: src-4 {
+   interrupts = ;
+   dmas = <&audma0 0x8d>, <&audma1 0xb0>;
+   dma-names = "rx", "tx";
+   };
+   src5: src-5 {
+   interrupts = ;
+   dmas = <&audma0 0x8f>, <&audma1 0xb2>;
+   dma-names = "rx", "tx";
+   };
+   src6: src-6 {
+   interrupts = ;
+   dmas = <&audma0 0x91>, <&audma1 0xb4>;
+   dma-names = "rx", "tx";
+   };
+   src7: src-7 {
+   interrupts = ;
+   dmas = <&audma0 0x93>, <&audma1 0xb6>;
+   dma-names = "rx", "tx";
+   };
+   src8: src-8 {
+   interrupts = ;
+   dmas = <&audma0 0x95>, <&audma1 0xb8>;
+   dma-names = "rx", "tx";
+   };
+   src9: src-9 {
+   interrupts = ;
+   dmas = <&audma0 0x97>, <&audma1 0xba>;
+   dma-names = "rx", "tx";
};
};
 
-- 
2.1.4



[PATCH 26/35] arm64: dts: r8a7796: Add PWM device nodes

2017-05-22 Thread Simon Horman
From: Takeshi Kihara 

This patch adds PWM{0,1,2,3,4,5,6} device nodes for R8A7796 SoC.

Signed-off-by: Takeshi Kihara 
[uli: added resets, shortened reg lengths to 8]
Signed-off-by: Ulrich Hecht 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 70 
 1 file changed, 70 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 8651fc93304d..b418a66f4cec 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -395,6 +395,76 @@
status = "disabled";
};
 
+   pwm0: pwm@e6e3 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e3 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm1: pwm@e6e31000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e31000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm2: pwm@e6e32000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e32000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm3: pwm@e6e33000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e33000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm4: pwm@e6e34000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e34000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm5: pwm@e6e35000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e35000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   pwm6: pwm@e6e36000 {
+   compatible = "renesas,pwm-r8a7796", "renesas,pwm-rcar";
+   reg = <0 0xe6e36000 0 8>;
+   #pwm-cells = <2>;
+   clocks = <&cpg CPG_MOD 523>;
+   resets = <&cpg 523>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
i2c0: i2c@e650 {
#address-cells = <1>;
#size-cells = <0>;
-- 
2.1.4



[PATCH 30/35] arm64: dts: renesas: salvator-x: Add HDMI output connectors

2017-05-22 Thread Simon Horman
From: Laurent Pinchart 

The Salvator-X board has two HDMI output connectors. Add them to the
common salvator-x.dtsi.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/salvator-x.dtsi | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi 
b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
index 35cd7e367234..5f0d4bdcd3b4 100644
--- a/arch/arm64/boot/dts/renesas/salvator-x.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
@@ -161,6 +161,28 @@
  180 0>;
};
 
+   hdmi0-out {
+   compatible = "hdmi-connector";
+   label = "HDMI0 OUT";
+   type = "a";
+
+   port {
+   hdmi0_con: endpoint {
+   };
+   };
+   };
+
+   hdmi1-out {
+   compatible = "hdmi-connector";
+   label = "HDMI1 OUT";
+   type = "a";
+
+   port {
+   hdmi1_con: endpoint {
+   };
+   };
+   };
+
vga {
compatible = "vga-connector";
 
-- 
2.1.4



[PATCH 28/35] arm64: dts: renesas: r8a7795: Add HDMI encoder support

2017-05-22 Thread Simon Horman
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 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 52 
 1 file changed, 52 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 7d87dff70ac8..ee0129634cdf 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1758,6 +1758,56 @@
renesas,fcp = <&fcpf2>;
};
 
+   hdmi0: hdmi0@fead {
+   compatible = "renesas,r8a7795-hdmi", 
"renesas,rcar-gen3-hdmi";
+   reg = <0 0xfead 0 0x1>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 729>, <&cpg CPG_CORE 
R8A7795_CLK_HDMI>;
+   clock-names = "iahb", "isfr";
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   resets = <&cpg 729>;
+   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 = ;
+   clocks = <&cpg CPG_MOD 728>, <&cpg CPG_CORE 
R8A7795_CLK_HDMI>;
+   clock-names = "iahb", "isfr";
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   resets = <&cpg 728>;
+   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>;
+   };
+   };
+   };
+
du: display@feb0 {
compatible = "renesas,du-r8a7795";
reg = <0 0xfeb0 0 0x8>,
@@ -1789,11 +1839,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 {
-- 
2.1.4



[PATCH 20/35] arm64: dts: r8a7796: add Sound SSI PIO support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 64 +++-
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 0a76a1c53082..5c6e54a1e27a 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1165,7 +1165,42 @@
};
 
rcar_sound: sound@ec50 {
-   /* placeholder */
+   /*
+* #sound-dai-cells is required
+*
+* Single DAI : #sound-dai-cells = <0>; <&rcar_sound>;
+* Multi  DAI : #sound-dai-cells = <1>; <&rcar_sound N>;
+*/
+   /*
+* #clock-cells is required for audio_clkout0/1/2/3
+*
+* clkout   : #clock-cells = <0>;   <&rcar_sound>;
+* clkout0/1/2/3: #clock-cells = <1>;   <&rcar_sound N>;
+*/
+   compatible =  "renesas,rcar_sound-r8a7796", 
"renesas,rcar_sound-gen3";
+   reg =   <0 0xec50 0 0x1000>, /* SCU */
+   <0 0xec5a 0 0x100>,  /* ADG */
+   <0 0xec54 0 0x1000>, /* SSIU */
+   <0 0xec541000 0 0x280>,  /* SSI */
+   <0 0xec74 0 0x200>;  /* Audio DMAC peri 
peri*/
+   reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
+
+   clocks = <&cpg CPG_MOD 1005>,
+<&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
+<&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
+<&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
+<&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
+<&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
+<&audio_clk_a>, <&audio_clk_b>,
+<&audio_clk_c>,
+<&cpg CPG_CORE R8A7796_CLK_S0D4>;
+   clock-names = "ssi-all",
+ "ssi.9", "ssi.8", "ssi.7", "ssi.6",
+ "ssi.5", "ssi.4", "ssi.3", "ssi.2",
+ "ssi.1", "ssi.0",
+ "clk_a", "clk_b", "clk_c", "clk_i";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
 
rcar_sound,dvc {
dvc0: dvc-0 {
@@ -1184,9 +1219,34 @@
 
rcar_sound,ssi {
ssi0: ssi-0 {
+   interrupts = ;
};
-
ssi1: ssi-1 {
+   interrupts = ;
+   };
+   ssi2: ssi-2 {
+   interrupts = ;
+   };
+   ssi3: ssi-3 {
+   interrupts = ;
+   };
+   ssi4: ssi-4 {
+   interrupts = ;
+   };
+   ssi5: ssi-5 {
+   interrupts = ;
+   };
+   ssi6: ssi-6 {
+   interrupts = ;
+   };
+   ssi7: ssi-7 {
+   interrupts = ;
+   };
+   ssi8: ssi-8 {
+   interrupts = ;
+   };
+   ssi9: ssi-9 {
+   interrupts = ;
};
};
};
-- 
2.1.4



[PATCH 32/35] arm64: dts: renesas: r8a7795-salvator-x: Enable HDMI outputs

2017-05-22 Thread Simon Horman
From: Koji Matsuoka 

Enable the HDMI encoders for the H3 Salvator-X board. The number of
encoders varies between the H3 and M3-W SoCs, so they can't be enabled
in the common salvator-x.dtsi file.

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

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 2a5358b8f229..fcd9ca73f2c7 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -58,6 +58,40 @@
status = "okay";
 };
 
+&hdmi0 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi0_out: endpoint {
+   remote-endpoint = <&hdmi0_con>;
+   };
+   };
+   };
+};
+
+&hdmi0_con {
+   remote-endpoint = <&rcar_dw_hdmi0_out>;
+};
+
+&hdmi1 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi1_out: endpoint {
+   remote-endpoint = <&hdmi1_con>;
+   };
+   };
+   };
+};
+
+&hdmi1_con {
+   remote-endpoint = <&rcar_dw_hdmi1_out>;
+};
+
 &ohci2 {
status = "okay";
 };
-- 
2.1.4



[PATCH 18/35] arm64: dts: salvator-x: Add current sense amplifiers

2017-05-22 Thread Simon Horman
From: Jacopo Mondi 

Add device nodes for two Maxim max961x current sense amplifiers
sensing VDD_08 and DVFS_08 lines.

Signed-off-by: Jacopo Mondi 
[geert: r8a7796-salvator-x.dts => salvator-x.dtsi]
Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/salvator-x.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi 
b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
index 47a482f20c9d..d5eb022d247c 100644
--- a/arch/arm64/boot/dts/renesas/salvator-x.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
@@ -283,6 +283,24 @@
};
 };
 
+&i2c4 {
+   status = "okay";
+
+   csa_vdd: adc@7c {
+   compatible = "maxim,max9611";
+   reg = <0x7c>;
+
+   shunt-resistor-micro-ohms = <5000>;
+   };
+
+   csa_dvfs: adc@7f {
+   compatible = "maxim,max9611";
+   reg = <0x7f>;
+
+   shunt-resistor-micro-ohms = <5000>;
+   };
+};
+
 &i2c_dvfs {
status = "okay";
 };
-- 
2.1.4



[PATCH 31/35] arm64: dts: renesas: r8a7795-salvator-x: Add DU external dot clocks

2017-05-22 Thread Simon Horman
From: Laurent Pinchart 

The DU1 and DU2 external dot clocks are provided by the fixed frequency
clock generators X21 and X22, while the DU0 and DU3 clocks are provided
by the programmable Versaclock5 clock generator.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 52fce67df341..2a5358b8f229 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -40,6 +40,20 @@
};
 };
 
+&du {
+   clocks = <&cpg CPG_MOD 724>,
+<&cpg CPG_MOD 723>,
+<&cpg CPG_MOD 722>,
+<&cpg CPG_MOD 721>,
+<&cpg CPG_MOD 727>,
+<&versaclock5 1>,
+<&x21_clk>,
+<&x22_clk>,
+<&versaclock5 2>;
+   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+ "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
+};
+
 &ehci2 {
status = "okay";
 };
-- 
2.1.4



[PATCH 33/35] arm64: dts: ulcb: Set drive-strength for ravb pins

2017-05-22 Thread Simon Horman
The EthernetAVB should not depend on the bootloader to setup correct
drive-strength values.  Values for drive-strength where found by
examining the registers after the bootloader has configured the
registers and successfully used the EthernetAVB.

Based on:
* commit 7d73a4da2681 ("arm64: dts: r8a7795: salvator-x: Set drive-strength
  for ravb pins")
* commit 4903987033be ("arm64: dts: r8a7796: salvator-x: Set drive-strength
  for ravb pins")

Cc: Geert Uytterhoeven 
Cc: Niklas Söderlund 
Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/ulcb.dtsi | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi 
b/arch/arm64/boot/dts/renesas/ulcb.dtsi
index 2bc7ceb2efa4..41e83c8530f7 100644
--- a/arch/arm64/boot/dts/renesas/ulcb.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi
@@ -198,8 +198,22 @@
pinctrl-names = "default";
 
avb_pins: avb {
-   groups = "avb_mdc";
-   function = "avb";
+   mux {
+   groups = "avb_link", "avb_phy_int", "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>;
+   };
};
 
i2c2_pins: i2c2 {
-- 
2.1.4



[PATCH 27/35] arm64: dts: salvator-x: Add panel backlight support

2017-05-22 Thread Simon Horman
From: Laurent Pinchart 

The panel backlight is controlled through a GPIO and a PWM channel.

Signed-off-by: Laurent Pinchart 
[simon: apply to salvator-x.dtsi instead of r8a7795-salvator-x.dts]
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/salvator-x.dtsi | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi 
b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
index d5eb022d247c..7240bcd75918 100644
--- a/arch/arm64/boot/dts/renesas/salvator-x.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-x.dtsi
@@ -58,6 +58,16 @@
clock-frequency = <11289600>;
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <&pwm1 0 5>;
+
+   brightness-levels = <256 128 64 16 8 4 0>;
+   default-brightness-level = <6>;
+
+   enable-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
+   };
+
reg_1p8v: regulator0 {
compatible = "regulator-fixed";
regulator-name = "fixed-1.8V";
@@ -358,6 +368,11 @@
function = "i2c2";
};
 
+   pwm1_pins: pwm {
+   groups = "pwm1_a";
+   function = "pwm1";
+   };
+
scif1_pins: scif1 {
groups = "scif1_data_a", "scif1_ctrl";
function = "scif1";
@@ -443,6 +458,13 @@
};
 };
 
+&pwm1 {
+   pinctrl-0 = <&pwm1_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
+
 &rcar_sound {
pinctrl-0 = <&sound_pins &sound_clk_pins>;
pinctrl-names = "default";
-- 
2.1.4



[PATCH 34/35] arm64: dts: r8a7795: Add support for R-Car H3 ES2.0

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Update r8a7795.dtsi so it corresponds to R-Car H3 ES2.0 or later:
  - The following devices no longer exist on ES2.0, and are thus removed:
fcpf2, fcpvd3, fcpvi2, fdp1-2, usb3-if1, vspd3, vspi2.
  - The DU <-> VSPD topology is different on ES2.0, hence remove the
"compatible" and "vsps" properties from the DU node until the driver
can handle this.

Move support for the ES1.x revision of the R-Car H3 SoC into a
separate file.  To avoid duplication, r8a7795-es1.dtsi includes
r8a7795.dtsi, and adds device nodes and properties where needed.
Note that while currently r8a7795-es1.dtsi only adds device nodes,
removal of devices nodes and properties can be implemented using the
/delete-node/ and /delete-property/ keywords, as shown below:

&soc {
/delete-node/ @;
};

& {
/delete-property/ ;
};

Switch r8a7795-salvator-x.dts and r8a7795-h3ulcb.dts from r8a7795.dtsi
to r8a7795-es1.dtsi to preserve compatibility.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi   | 84 ++
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts |  4 +-
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  4 +-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   | 71 +-
 4 files changed, 89 insertions(+), 74 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi
new file mode 100644
index ..a0ba7bd21ea3
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi
@@ -0,0 +1,84 @@
+/*
+ * Device Tree Source for the r8a7795 ES1.x SoC
+ *
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include "r8a7795.dtsi"
+
+&soc {
+   xhci1: usb@ee040 {
+   compatible = "renesas,xhci-r8a7795", "renesas,rcar-gen3-xhci";
+   reg = <0 0xee04 0 0xc00>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 327>;
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   resets = <&cpg 327>;
+   status = "disabled";
+   };
+
+   fcpf2: fcp@fe952000 {
+   compatible = "renesas,fcpf";
+   reg = <0 0xfe952000 0 0x200>;
+   clocks = <&cpg CPG_MOD 613>;
+   power-domains = <&sysc R8A7795_PD_A3VP>;
+   resets = <&cpg 613>;
+   };
+
+   vspi2: vsp@fe9c {
+   compatible = "renesas,vsp2";
+   reg = <0 0xfe9c 0 0x8000>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 629>;
+   power-domains = <&sysc R8A7795_PD_A3VP>;
+   resets = <&cpg 629>;
+
+   renesas,fcp = <&fcpvi2>;
+   };
+
+   fcpvi2: fcp@fe9cf000 {
+   compatible = "renesas,fcpv";
+   reg = <0 0xfe9cf000 0 0x200>;
+   clocks = <&cpg CPG_MOD 609>;
+   power-domains = <&sysc R8A7795_PD_A3VP>;
+   resets = <&cpg 609>;
+   };
+
+   vspd3: vsp@fea38000 {
+   compatible = "renesas,vsp2";
+   reg = <0 0xfea38000 0 0x4000>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 620>;
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   resets = <&cpg 620>;
+
+   renesas,fcp = <&fcpvd3>;
+   };
+
+   fcpvd3: fcp@fea3f000 {
+   compatible = "renesas,fcpv";
+   reg = <0 0xfea3f000 0 0x200>;
+   clocks = <&cpg CPG_MOD 600>;
+   power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+   resets = <&cpg 600>;
+   };
+
+   fdp1@fe948000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe948000 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 117>;
+   power-domains = <&sysc R8A7795_PD_A3VP>;
+   resets = <&cpg 117>;
+   renesas,fcp = <&fcpf2>;
+   };
+};
+
+&du {
+   compatible = "renesas,du-r8a7795";
+   vsps = <&vspd0 &vspd1 &vspd2 &vspd3>;
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index a1fbf0ab8ad8..95fe207cb6a3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -12,11 +12,11 @@
 #define CPG_AUDIO_CLK_IR8A7795_CLK_S0D4
 
 /dts-v1/;
-#include "r8a7795.dtsi"
+#include "r8a7795-es1.dtsi"
 #include "ulcb.dtsi"
 
 / {
-   model = "Renesas H3ULCB board based on r8a7795";
+   model = "Renesas H3ULCB board based on r8a7795 ES1.x";
compatible = "renesas,h3

[PATCH 24/35] arm64: dts: r8a7796: add Sound CTU support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 156c0f8a81ba..7b74da1d1568 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1196,6 +1196,7 @@
 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
+<&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
 <&audio_clk_a>, <&audio_clk_b>,
 <&audio_clk_c>,
@@ -1207,6 +1208,7 @@
  "src.9", "src.8", "src.7", "src.6",
  "src.5", "src.4", "src.3", "src.2",
  "src.1", "src.0",
+ "ctu.1", "ctu.0",
  "dvc.0", "dvc.1",
  "clk_a", "clk_b", "clk_c", "clk_i";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
@@ -1223,6 +1225,17 @@
};
};
 
+   rcar_sound,ctu {
+   ctu00: ctu-0 { };
+   ctu01: ctu-1 { };
+   ctu02: ctu-2 { };
+   ctu03: ctu-3 { };
+   ctu10: ctu-4 { };
+   ctu11: ctu-5 { };
+   ctu12: ctu-6 { };
+   ctu13: ctu-7 { };
+   };
+
rcar_sound,src {
src0: src-0 {
interrupts = ;
-- 
2.1.4



[PATCH 16/35] arm64: dts: renesas: Extract common Salvator-X board support

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

The Renesas Salvator-X development board can be equipped with either an
R-Car H3 or M3-W SiP, which are pin-compatible.  Both boards use
different DTBs.

Reduce duplication by extracting common Salvator-X board support into
its own .dtsi file.  References to SoC-specific clocks are handled
through cpp definitions.  Sort device nodes while at it.

For boards with an R-Car H3 SiP, there are no functional changes.

For boards with an R-Car M3-W SiP, the following new devices are now
described in DT:
  - External audio, CAN, and PCIe clocks,
  - USB Vbus regulator,
  - CS2000 clock generator,
  - AK4613 Audio Codec,
  - VGA.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 543 +---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 259 +-
 arch/arm64/boot/dts/renesas/salvator-x.dtsi| 555 +
 3 files changed, 563 insertions(+), 794 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/salvator-x.dtsi

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index ff68bac4cd7e..52fce67df341 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -8,48 +8,16 @@
  * kind, whether express or implied.
  */
 
-/*
- * SSI-AK4613
- *
- * This command is required when Playback/Capture
- *
- * amixer set "DVC Out" 100%
- * amixer set "DVC In" 100%
- *
- * You can use Mute
- *
- * amixer set "DVC Out Mute" on
- * amixer set "DVC In Mute" on
- *
- * You can use Volume Ramp
- *
- * amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
- * amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
- * amixer set "DVC Out Ramp" on
- * aplay xxx.wav &
- * amixer set "DVC Out"  80%  // Volume Down
- * amixer set "DVC Out" 100%  // Volume Up
- */
+#define CPG_AUDIO_CLK_IR8A7795_CLK_S0D4
 
 /dts-v1/;
 #include "r8a7795.dtsi"
-#include 
+#include "salvator-x.dtsi"
 
 / {
model = "Renesas Salvator-X board based on r8a7795";
compatible = "renesas,salvator-x", "renesas,r8a7795";
 
-   aliases {
-   serial0 = &scif2;
-   serial1 = &scif1;
-   ethernet0 = &avb;
-   };
-
-   chosen {
-   bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
-   stdout-path = "serial0:115200n8";
-   };
-
memory@4800 {
device_type = "memory";
/* first 128MB is reserved for secure area. */
@@ -70,531 +38,30 @@
device_type = "memory";
reg = <0x7 0x 0x0 0x4000>;
};
-
-   x12_clk: x12 {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <24576000>;
-   };
-
-   reg_1p8v: regulator0 {
-   compatible = "regulator-fixed";
-   regulator-name = "fixed-1.8V";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
-   reg_3p3v: regulator1 {
-   compatible = "regulator-fixed";
-   regulator-name = "fixed-3.3V";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
-   vcc_sdhi0: regulator-vcc-sdhi0 {
-   compatible = "regulator-fixed";
-
-   regulator-name = "SDHI0 Vcc";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-   enable-active-high;
-   };
-
-   vccq_sdhi0: regulator-vccq-sdhi0 {
-   compatible = "regulator-gpio";
-
-   regulator-name = "SDHI0 VccQ";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-   gpios-states = <1>;
-   states = <330 1
- 180 0>;
-   };
-
-   vcc_sdhi3: regulator-vcc-sdhi3 {
-   compatible = "regulator-fixed";
-
-   regulator-name = "SDHI3 Vcc";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>;
-   enable-active-high;
-   };
-
-   vccq_sdhi3: regulator-vccq-sdhi3 {
-   compatible = "regulator-gpio";
-
-   regulator-name = "SDHI3 VccQ";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <&gpio3 14 GPIO_ACTIVE_HI

[PATCH 35/35] arm64: dts: r8a7795: salvator-x: Add support for R-Car H3 ES2.0

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Split off support for Salvator-X boards with the ES1.x revision of the
R-Car H3 SoC into a separate file.  The main r8a7795-salvator-x.dts file
now corresponds to Salvator-X with R-Car H3 ES2.0 or later.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/Makefile   |   1 +
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts| 115 +
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |   4 +-
 3 files changed, 118 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts

diff --git a/arch/arm64/boot/dts/renesas/Makefile 
b/arch/arm64/boot/dts/renesas/Makefile
index 1618e0a3c81d..b6c723d8f687 100644
--- a/arch/arm64/boot/dts/renesas/Makefile
+++ b/arch/arm64/boot/dts/renesas/Makefile
@@ -1,4 +1,5 @@
 dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-salvator-x.dtb r8a7795-h3ulcb.dtb
+dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-es1-salvator-x.dtb
 dtb-$(CONFIG_ARCH_R8A7796) += r8a7796-salvator-x.dtb r8a7796-m3ulcb.dtb
 
 always := $(dtb-y)
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
new file mode 100644
index ..b84c156ed696
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
@@ -0,0 +1,115 @@
+/*
+ * Device Tree Source for the Salvator-X board
+ *
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#define CPG_AUDIO_CLK_IR8A7795_CLK_S0D4
+
+/dts-v1/;
+#include "r8a7795-es1.dtsi"
+#include "salvator-x.dtsi"
+
+/ {
+   model = "Renesas Salvator-X board based on r8a7795 ES1.x";
+   compatible = "renesas,salvator-x", "renesas,r8a7795";
+
+   memory@4800 {
+   device_type = "memory";
+   /* first 128MB is reserved for secure area. */
+   reg = <0x0 0x4800 0x0 0x3800>;
+   };
+
+   memory@5 {
+   device_type = "memory";
+   reg = <0x5 0x 0x0 0x4000>;
+   };
+
+   memory@6 {
+   device_type = "memory";
+   reg = <0x6 0x 0x0 0x4000>;
+   };
+
+   memory@7 {
+   device_type = "memory";
+   reg = <0x7 0x 0x0 0x4000>;
+   };
+};
+
+&du {
+   clocks = <&cpg CPG_MOD 724>,
+<&cpg CPG_MOD 723>,
+<&cpg CPG_MOD 722>,
+<&cpg CPG_MOD 721>,
+<&cpg CPG_MOD 727>,
+<&versaclock5 1>,
+<&x21_clk>,
+<&x22_clk>,
+<&versaclock5 2>;
+   clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0",
+ "dclkin.0", "dclkin.1", "dclkin.2", "dclkin.3";
+};
+
+&ehci2 {
+   status = "okay";
+};
+
+&hdmi0 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi0_out: endpoint {
+   remote-endpoint = <&hdmi0_con>;
+   };
+   };
+   };
+};
+
+&hdmi0_con {
+   remote-endpoint = <&rcar_dw_hdmi0_out>;
+};
+
+&hdmi1 {
+   status = "okay";
+
+   ports {
+   port@1 {
+   reg = <1>;
+   rcar_dw_hdmi1_out: endpoint {
+   remote-endpoint = <&hdmi1_con>;
+   };
+   };
+   };
+};
+
+&hdmi1_con {
+   remote-endpoint = <&rcar_dw_hdmi1_out>;
+};
+
+&ohci2 {
+   status = "okay";
+};
+
+&pfc {
+   usb2_pins: usb2 {
+   groups = "usb2";
+   function = "usb2";
+   };
+};
+
+&sata {
+   status = "okay";
+};
+
+&usb2_phy2 {
+   pinctrl-0 = <&usb2_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index b84c156ed696..684fb3b9d154 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -11,11 +11,11 @@
 #define CPG_AUDIO_CLK_IR8A7795_CLK_S0D4
 
 /dts-v1/;
-#include "r8a7795-es1.dtsi"
+#include "r8a7795.dtsi"
 #include "salvator-x.dtsi"
 
 / {
-   model = "Renesas Salvator-X board based on r8a7795 ES1.x";
+   model = "Renesas Salvator-X board based on r8a7795 ES2.0+";
compatible = "renesas,salvator-x", "renesas,r8a7795";
 
memory@4800 {
-- 
2.1.4



[PATCH 25/35] arm64: dts: r8a7796: add Sound MIX support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 7b74da1d1568..8651fc93304d 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1197,6 +1197,7 @@
 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
+<&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
 <&audio_clk_a>, <&audio_clk_b>,
 <&audio_clk_c>,
@@ -1208,6 +1209,7 @@
  "src.9", "src.8", "src.7", "src.6",
  "src.5", "src.4", "src.3", "src.2",
  "src.1", "src.0",
+ "mix.1", "mix.0",
  "ctu.1", "ctu.0",
  "dvc.0", "dvc.1",
  "clk_a", "clk_b", "clk_c", "clk_i";
@@ -1225,6 +1227,11 @@
};
};
 
+   rcar_sound,mix {
+   mix0: mix-0 { };
+   mix1: mix-1 { };
+   };
+
rcar_sound,ctu {
ctu00: ctu-0 { };
ctu01: ctu-1 { };
-- 
2.1.4



[PATCH 23/35] arm64: dts: r8a7796: add Sound DVC support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 778275a980d3..156c0f8a81ba 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1196,6 +1196,7 @@
 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
+<&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
 <&audio_clk_a>, <&audio_clk_b>,
 <&audio_clk_c>,
 <&cpg CPG_CORE R8A7796_CLK_S0D4>;
@@ -1206,15 +1207,19 @@
  "src.9", "src.8", "src.7", "src.6",
  "src.5", "src.4", "src.3", "src.2",
  "src.1", "src.0",
+ "dvc.0", "dvc.1",
  "clk_a", "clk_b", "clk_c", "clk_i";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
 
rcar_sound,dvc {
dvc0: dvc-0 {
+   dmas = <&audma1 0xbc>;
+   dma-names = "tx";
};
-
dvc1: dvc-1 {
+   dmas = <&audma1 0xbe>;
+   dma-names = "tx";
};
};
 
-- 
2.1.4



[PATCH 09/35] arm64: dts: m3ulcb: Fix EthernetAVB PHY timing

2017-05-22 Thread Simon Horman
Set PHY rxc-skew-ps to 1500 and all other values to their default values.

This is intended to to address failures in the case of 1Gbps communication
using the salvator-x board with the KSZ9031RNX phy. This has been
reported to occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.

Based in a similar patch for the r8a7796 salvator-x by Kazuya Mizuguchi.

Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index c2a4549d3738..440d93e8388d 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -169,18 +169,7 @@
status = "okay";
 
phy0: ethernet-phy@0 {
-   rxc-skew-ps = <900>;
-   rxdv-skew-ps = <0>;
-   rxd0-skew-ps = <0>;
-   rxd1-skew-ps = <0>;
-   rxd2-skew-ps = <0>;
-   rxd3-skew-ps = <0>;
-   txc-skew-ps = <900>;
-   txen-skew-ps = <0>;
-   txd0-skew-ps = <0>;
-   txd1-skew-ps = <0>;
-   txd2-skew-ps = <0>;
-   txd3-skew-ps = <0>;
+   rxc-skew-ps = <1500>;
reg = <0>;
interrupt-parent = <&gpio2>;
interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
-- 
2.1.4



[PATCH 15/35] arm64: dts: r8a7796: Add placeholders for various devices

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Add empty device nodes serving as placeholders for devices that are not
yet supported and/or tested on R-Car M3-W, but are supported and used on
Salvator-X or H3ULCB boards equipped with an R-Car H3 SoC.

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

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 8e2aab8b6b10..60a4289d0b14 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -961,6 +961,38 @@
dma-channels = <16>;
};
 
+   hsusb: usb@e659 {
+   /* placeholder */
+   };
+
+   xhci0: usb@ee00 {
+   /* placeholder */
+   };
+
+   ohci0: usb@ee08 {
+   /* placeholder */
+   };
+
+   ehci0: usb@ee080100 {
+   /* placeholder */
+   };
+
+   usb2_phy0: usb-phy@ee080200 {
+   /* placeholder */
+   };
+
+   ohci1: usb@ee0a {
+   /* placeholder */
+   };
+
+   ehci1: usb@ee0a0100 {
+   /* placeholder */
+   };
+
+   usb2_phy1: usb-phy@ee0a0200 {
+   /* placeholder */
+   };
+
sdhi0: sd@ee10 {
compatible = "renesas,sdhi-r8a7796";
reg = <0 0xee10 0 0x2000>;
@@ -1063,5 +1095,55 @@
};
};
};
+
+   rcar_sound: sound@ec50 {
+   /* placeholder */
+
+   rcar_sound,dvc {
+   dvc0: dvc-0 {
+   };
+
+   dvc1: dvc-1 {
+   };
+   };
+
+   rcar_sound,src {
+   src0: src-0 {
+   };
+   src1: src-1 {
+   };
+   };
+
+   rcar_sound,ssi {
+   ssi0: ssi-0 {
+   };
+
+   ssi1: ssi-1 {
+   };
+   };
+   };
+
+   pciec0: pcie@fe00 {
+   /* placeholder */
+   };
+
+   pciec1: pcie@ee80 {
+   /* placeholder */
+   };
+
+   du: display@feb0 {
+   /* placeholder */
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   du_out_rgb: endpoint {
+   };
+   };
+   };
+   };
};
 };
-- 
2.1.4



[PATCH 08/35] arm64: dts: h3ulcb: enable HS200 for eMMC

2017-05-22 Thread Simon Horman
From: Vladimir Barinov 

This supports HS200 mode for eMMC on H3ULCB board

Signed-off-by: Vladimir Barinov 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index ab352159de65..3574965e0747 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -328,6 +328,7 @@
vmmc-supply = <®_3p3v>;
vqmmc-supply = <®_1p8v>;
bus-width = <8>;
+   mmc-hs200-1_8v;
non-removable;
status = "okay";
 };
-- 
2.1.4



[PATCH 19/35] arm64: dts: r8a7796: add AUDIO_DMAC support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 68 
 1 file changed, 68 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 60a4289d0b14..0a76a1c53082 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -961,6 +961,74 @@
dma-channels = <16>;
};
 
+   audma0: dma-controller@ec70 {
+   compatible = "renesas,dmac-r8a7796",
+"renesas,rcar-dmac";
+   reg = <0 0xec70 0 0x1>;
+   interrupts = ;
+   interrupt-names = "error",
+   "ch0", "ch1", "ch2", "ch3",
+   "ch4", "ch5", "ch6", "ch7",
+   "ch8", "ch9", "ch10", "ch11",
+   "ch12", "ch13", "ch14", "ch15";
+   clocks = <&cpg CPG_MOD 502>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   resets = <&cpg 502>;
+   #dma-cells = <1>;
+   dma-channels = <16>;
+   };
+
+   audma1: dma-controller@ec72 {
+   compatible = "renesas,dmac-r8a7796",
+"renesas,rcar-dmac";
+   reg = <0 0xec72 0 0x1>;
+   interrupts = ;
+   interrupt-names = "error",
+   "ch0", "ch1", "ch2", "ch3",
+   "ch4", "ch5", "ch6", "ch7",
+   "ch8", "ch9", "ch10", "ch11",
+   "ch12", "ch13", "ch14", "ch15";
+   clocks = <&cpg CPG_MOD 501>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   resets = <&cpg 501>;
+   #dma-cells = <1>;
+   dma-channels = <16>;
+   };
+
hsusb: usb@e659 {
/* placeholder */
};
-- 
2.1.4



[PATCH 21/35] arm64: dts: r8a7796: add Sound SSI DMA support

2017-05-22 Thread Simon Horman
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 5c6e54a1e27a..a1d08c89ceed 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -1220,33 +1220,53 @@
rcar_sound,ssi {
ssi0: ssi-0 {
interrupts = ;
+   dmas = <&audma0 0x01>, <&audma1 0x02>, 
<&audma0 0x15>, <&audma1 0x16>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi1: ssi-1 {
interrupts = ;
+   dmas = <&audma0 0x03>, <&audma1 0x04>, 
<&audma0 0x49>, <&audma1 0x4a>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi2: ssi-2 {
interrupts = ;
+   dmas = <&audma0 0x05>, <&audma1 0x06>, 
<&audma0 0x63>, <&audma1 0x64>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi3: ssi-3 {
interrupts = ;
+   dmas = <&audma0 0x07>, <&audma1 0x08>, 
<&audma0 0x6f>, <&audma1 0x70>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi4: ssi-4 {
interrupts = ;
+   dmas = <&audma0 0x09>, <&audma1 0x0a>, 
<&audma0 0x71>, <&audma1 0x72>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi5: ssi-5 {
interrupts = ;
+   dmas = <&audma0 0x0b>, <&audma1 0x0c>, 
<&audma0 0x73>, <&audma1 0x74>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi6: ssi-6 {
interrupts = ;
+   dmas = <&audma0 0x0d>, <&audma1 0x0e>, 
<&audma0 0x75>, <&audma1 0x76>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi7: ssi-7 {
interrupts = ;
+   dmas = <&audma0 0x0f>, <&audma1 0x10>, 
<&audma0 0x79>, <&audma1 0x7a>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi8: ssi-8 {
interrupts = ;
+   dmas = <&audma0 0x11>, <&audma1 0x12>, 
<&audma0 0x7b>, <&audma1 0x7c>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
ssi9: ssi-9 {
interrupts = ;
+   dmas = <&audma0 0x13>, <&audma1 0x14>, 
<&audma0 0x7d>, <&audma1 0x7e>;
+   dma-names = "rx", "tx", "rxu", "txu";
};
};
};
-- 
2.1.4



[PATCH 07/35] arm64: dts: m3ulcb: enable HS200 for eMMC

2017-05-22 Thread Simon Horman
From: Vladimir Barinov 

This supports HS200 mode for eMMC on M3ULCB board

Signed-off-by: Vladimir Barinov 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index 75974b246dd1..c2a4549d3738 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -209,6 +209,7 @@
vmmc-supply = <®_3p3v>;
vqmmc-supply = <®_1p8v>;
bus-width = <8>;
+   mmc-hs200-1_8v;
non-removable;
status = "okay";
 };
-- 
2.1.4



[PATCH 17/35] arm64: dts: renesas: Extract common ULCB board support

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

The Renesas ULCB development board can be equipped with either an R-Car
H3 or M3-W SiP, which are pin-compatible.  Both boards use different
DTBs.

Reduce duplication by extracting common ULCB board support into its own
.dtsi file.  References to SoC-specific clocks are handled through cpp
definitions.  Sort device nodes while at it.

For H3ULCB, there are no functional changes.

For M3ULCB, the following new devices are now described in DT:
  - External audio, CAN, and PCIe clocks,
  - CS2000 clock generator,
  - AK4613 Audio Codec.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts | 341 +---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 201 +-
 arch/arm64/boot/dts/renesas/ulcb.dtsi  | 353 +
 3 files changed, 359 insertions(+), 536 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/ulcb.dtsi

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index 3574965e0747..a1fbf0ab8ad8 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -9,24 +9,16 @@
  * kind, whether express or implied.
  */
 
+#define CPG_AUDIO_CLK_IR8A7795_CLK_S0D4
+
 /dts-v1/;
 #include "r8a7795.dtsi"
-#include 
-#include 
+#include "ulcb.dtsi"
 
 / {
model = "Renesas H3ULCB board based on r8a7795";
compatible = "renesas,h3ulcb", "renesas,r8a7795";
 
-   aliases {
-   serial0 = &scif2;
-   ethernet0 = &avb;
-   };
-
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
memory@4800 {
device_type = "memory";
/* first 128MB is reserved for secure area. */
@@ -47,331 +39,4 @@
device_type = "memory";
reg = <0x7 0x 0x0 0x4000>;
};
-
-   leds {
-   compatible = "gpio-leds";
-
-   led5 {
-   gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>;
-   };
-   led6 {
-   gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
-   };
-   };
-
-   keyboard {
-   compatible = "gpio-keys";
-
-   key-1 {
-   linux,code = ;
-   label = "SW3";
-   wakeup-source;
-   debounce-interval = <20>;
-   gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
-   };
-   };
-
-   x12_clk: x12 {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <24576000>;
-   };
-
-   reg_1p8v: regulator0 {
-   compatible = "regulator-fixed";
-   regulator-name = "fixed-1.8V";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <180>;
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
-   reg_3p3v: regulator1 {
-   compatible = "regulator-fixed";
-   regulator-name = "fixed-3.3V";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   regulator-boot-on;
-   regulator-always-on;
-   };
-
-   vcc_sdhi0: regulator-vcc-sdhi0 {
-   compatible = "regulator-fixed";
-
-   regulator-name = "SDHI0 Vcc";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-
-   gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
-   enable-active-high;
-   };
-
-   vccq_sdhi0: regulator-vccq-sdhi0 {
-   compatible = "regulator-gpio";
-
-   regulator-name = "SDHI0 VccQ";
-   regulator-min-microvolt = <180>;
-   regulator-max-microvolt = <330>;
-
-   gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
-   gpios-states = <1>;
-   states = <330 1
- 180 0>;
-   };
-
-   audio_clkout: audio-clkout {
-   /*
-* This is same as <&rcar_sound 0>
-* but needed to avoid cs2000/rcar_sound probe dead-lock
-*/
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <11289600>;
-   };
-
-   rsnd_ak4613: sound {
-   compatible = "simple-audio-card";
-
-   simple-audio-card,format = "left_j";
-   simple-audio-card,bitclock-master = <&sndcpu>;
-   simple-audio-card,frame-master = <&sndcpu>;
-
-   sndcpu: simple-audio-card,cpu {
-   sound-dai = <&rcar_sound>;
-   };
-
-   sndcodec: simple-audio-card,codec {
-   sound-dai = <&ak46

[PATCH 12/35] arm64: dts: r8a7795: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e606.pfc and pfc@e606 to
e606.pin-controller and pin-controller@e606.

Signed-off-by: Simon Horman 
Acked-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index e99d6443b3e4..7d87dff70ac8 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -398,7 +398,7 @@
#power-domain-cells = <1>;
};
 
-   pfc: pfc@e606 {
+   pfc: pin-controller@e606 {
compatible = "renesas,pfc-r8a7795";
reg = <0 0xe606 0 0x50c>;
};
-- 
2.1.4



[PATCH 04/35] arm64: dts: r8a7795: salvator-x: Update memory node to 4 GiB map

2017-05-22 Thread Simon Horman
From: Takeshi Kihara 

This patch addes memory region:

  - After changes, the Salvator-X board has the following map:
Bank0: 1GiB RAM : 0x4800 -> 0x0007fff
Bank1: 1GiB RAM : 0x0005 -> 0x0053fff
Bank2: 1GiB RAM : 0x0006 -> 0x0063fff
Bank3: 1GiB RAM : 0x0007 -> 0x0073fff

  - Before changes, the old map looked like this:
Bank0: 1GiB RAM : 0x4800 -> 0x0007fff

Signed-off-by: Takeshi Kihara 
Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 639aa085d996..f1b6ad3def15 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -56,6 +56,21 @@
reg = <0x0 0x4800 0x0 0x3800>;
};
 
+   memory@5 {
+   device_type = "memory";
+   reg = <0x5 0x 0x0 0x4000>;
+   };
+
+   memory@6 {
+   device_type = "memory";
+   reg = <0x6 0x 0x0 0x4000>;
+   };
+
+   memory@7 {
+   device_type = "memory";
+   reg = <0x7 0x 0x0 0x4000>;
+   };
+
x12_clk: x12 {
compatible = "fixed-clock";
#clock-cells = <0>;
-- 
2.1.4



[PATCH 02/35] arm64: dts: m3ulcb: Update memory node to 2 GiB map

2017-05-22 Thread Simon Horman
From: Vladimir Barinov 

This patch updates memory region:

  - After changes, the new map of the m3ulcb board on R8A7796 SoC
Bank0: 1GiB RAM : 0x4800 -> 0x0007fff
Bank1: 1GiB RAM : 0x0006 -> 0x0063fff

  - Before changes, the old map looked like this:
Bank0: 1GiB RAM : 0x4800 -> 0x0007fff

Signed-off-by: Vladimir Barinov 
Tested-by: Sjoerd Simons 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index 5554b555b874..02051a3236a5 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -32,6 +32,11 @@
reg = <0x0 0x4800 0x0 0x3800>;
};
 
+   memory@6 {
+   device_type = "memory";
+   reg = <0x6 0x 0x0 0x4000>;
+   };
+
leds {
compatible = "gpio-leds";
 
-- 
2.1.4



[PATCH 10/35] arm64: dts: r8a7796: salvator-x: Enable NFS root

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Cfr. commit b2407c566ba29215 ("arm64: dts: r8a7795: enable nfs root on
Salvator-X board").

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 7f0ac6a9d49b..18b478be484c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -23,7 +23,7 @@
};
 
chosen {
-   bootargs = "ignore_loglevel";
+   bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
stdout-path = "serial0:115200n8";
};
 
-- 
2.1.4



[PATCH 05/35] arm64: dts: r8a7795: salvator-x: enable HS200 for eMMC

2017-05-22 Thread Simon Horman
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index f1b6ad3def15..ff68bac4cd7e 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -482,6 +482,7 @@
vmmc-supply = <®_3p3v>;
vqmmc-supply = <®_1p8v>;
bus-width = <8>;
+   mmc-hs200-1_8v;
non-removable;
status = "okay";
 };
-- 
2.1.4



[PATCH 14/35] arm64: dts: r8a7796: Add external PCIe bus clock

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Add the external PCIe bus clock as a zero Hz fixed-frequency clock.
Boards that provide this clock should override it.

Based on r8a7795.dtsi.

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

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 101cd41d693a..8e2aab8b6b10 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -157,6 +157,13 @@
clock-frequency = <0>;
};
 
+   /* External PCIe clock - can be overridden by the board */
+   pcie_bus_clk: pcie_bus {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
soc {
compatible = "simple-bus";
interrupt-parent = <&gic>;
-- 
2.1.4



[PATCH 06/35] arm64: dts: r8a7796: salvator-x: enable HS200 for eMMC

2017-05-22 Thread Simon Horman
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index c9f59b6ce33f..7f0ac6a9d49b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -216,6 +216,7 @@
vmmc-supply = <®_3p3v>;
vqmmc-supply = <®_1p8v>;
bus-width = <8>;
+   mmc-hs200-1_8v;
non-removable;
status = "okay";
 };
-- 
2.1.4



[PATCH 11/35] arm64: dts: r8a7796: salvator-x: Set drive-strength for ravb pins

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

The EthernetAVB should not depend on the bootloader to setup correct
drive-strength values.  Values for drive-strength where found by
examining the registers after the bootloader has configured the
registers and successfully used the EthernetAVB.

Based on commit 7d73a4da2681dc5d ("arm64: dts: r8a7795: salvator-x: Set
drive-strength for ravb pins").

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 18b478be484c..31f02219ed2f 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -110,8 +110,22 @@
pinctrl-names = "default";
 
avb_pins: avb {
-   groups = "avb_mdc";
-   function = "avb";
+   mux {
+   groups = "avb_link", "avb_phy_int", "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>;
+   };
};
 
scif1_pins: scif1 {
-- 
2.1.4



[PATCH 13/35] arm64: dts: r8a7796: Add external audio clocks

2017-05-22 Thread Simon Horman
From: Geert Uytterhoeven 

Add the external audio clocks as zero Hz fixed-frequency clocks.
Boards that provide these clocks should override them.

Based on commit 623197b90c7aa97c ("arm64: renesas: r8a7795: Sound SSI
PIO support").

Signed-off-by: Geert Uytterhoeven 
Acked-by: Kuninori Morimoto 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 2ec1ed5f4991..101cd41d693a 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -120,6 +120,29 @@
clock-frequency = <0>;
};
 
+   /*
+* The external audio clocks are configured as 0 Hz fixed frequency
+* clocks by default.
+* Boards that provide audio clocks should override them.
+*/
+   audio_clk_a: audio_clk_a {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   audio_clk_b: audio_clk_b {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   audio_clk_c: audio_clk_c {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
/* External CAN clock - to be overridden by boards that provide it */
can_clk: can {
compatible = "fixed-clock";
-- 
2.1.4



[PATCH 03/35] arm64: dts: m3ulcb: enable EthernetAVB

2017-05-22 Thread Simon Horman
From: Vladimir Barinov 

This supports Ethernet AVB on M3ULCB board

Signed-off-by: Vladimir Barinov 
Tested-by: Sjoerd Simons 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 32 ++
 1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index 02051a3236a5..75974b246dd1 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -20,6 +20,7 @@
 
aliases {
serial0 = &scif2;
+   ethernet0 = &avb;
};
 
chosen {
@@ -115,6 +116,11 @@
pinctrl-0 = <&scif_clk_pins>;
pinctrl-names = "default";
 
+   avb_pins: avb {
+   groups = "avb_mdc";
+   function = "avb";
+   };
+
scif2_pins: scif2 {
groups = "scif2_data_a";
function = "scif2";
@@ -155,6 +161,32 @@
};
 };
 
+&avb {
+   pinctrl-0 = <&avb_pins>;
+   pinctrl-names = "default";
+   renesas,no-ether-link;
+   phy-handle = <&phy0>;
+   status = "okay";
+
+   phy0: ethernet-phy@0 {
+   rxc-skew-ps = <900>;
+   rxdv-skew-ps = <0>;
+   rxd0-skew-ps = <0>;
+   rxd1-skew-ps = <0>;
+   rxd2-skew-ps = <0>;
+   rxd3-skew-ps = <0>;
+   txc-skew-ps = <900>;
+   txen-skew-ps = <0>;
+   txd0-skew-ps = <0>;
+   txd1-skew-ps = <0>;
+   txd2-skew-ps = <0>;
+   txd3-skew-ps = <0>;
+   reg = <0>;
+   interrupt-parent = <&gpio2>;
+   interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
+   };
+};
+
 &sdhi0 {
pinctrl-0 = <&sdhi0_pins>;
pinctrl-1 = <&sdhi0_pins_uhs>;
-- 
2.1.4



[PATCH 01/35] arm64: dts: m3ulcb: enable I2C

2017-05-22 Thread Simon Horman
From: Vladimir Barinov 

This supports I2C2 bus on M3ULCB board

Signed-off-by: Vladimir Barinov 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
index 372b2a944716..5554b555b874 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts
@@ -120,6 +120,11 @@
function = "scif_clk";
};
 
+   i2c2_pins: i2c2 {
+   groups = "i2c2_a";
+   function = "i2c2";
+   };
+
sdhi0_pins: sd0 {
groups = "sdhi0_data4", "sdhi0_ctrl";
function = "sdhi0";
@@ -182,6 +187,13 @@
clock-frequency = <14745600>;
 };
 
+&i2c2 {
+   pinctrl-0 = <&i2c2_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
+
 &wdt0 {
timeout-sec = <60>;
status = "okay";
-- 
2.1.4



[GIT PULL] Renesas ARM64 Based SoC DT Updates for v4.13

2017-05-22 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

Please consider these Renesas ARM64 based SoC DT updates for v4.13.


The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6:

  Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
tags/renesas-arm64-dt-for-v4.13

for you to fetch changes up to 0b03c32db03d63de695c1e0ab1950eb12b135fa7:

  arm64: dts: r8a7795: salvator-x: Add support for R-Car H3 ES2.0 (2017-05-22 
14:54:57 +0200)


Renesas ARM64 Based SoC DT Updates for v4.13

* Add support for R-Car H3 ES2.0
* Break out common board support
* Set drive-strength for ravb pins for r8a7795/h3ulcb and r8a7796/m3ulcb
* Enable HDMI outputs on r8a7795/salvator-x
* Add R-Car audio to DT of r8a7796 SoC
* Add current sense amplifiers to DT of r8a779[56]/salvator-x
* Enable NFS-root on r8a7796/salvator-x
* Enable HS200 for eMMC on r8a779[56]/salvator-x,
  r8a7795/h3ulcb and r8a7796/m3ulcb
* Enable EthernetAVB, I2C r8a7796/m3ulcb
* Update memory node to 2 GiB map on r8a7796/m3ulcb


Geert Uytterhoeven (9):
  arm64: dts: r8a7796: salvator-x: Enable NFS root
  arm64: dts: r8a7796: salvator-x: Set drive-strength for ravb pins
  arm64: dts: r8a7796: Add external audio clocks
  arm64: dts: r8a7796: Add external PCIe bus clock
  arm64: dts: r8a7796: Add placeholders for various devices
  arm64: dts: renesas: Extract common Salvator-X board support
  arm64: dts: renesas: Extract common ULCB board support
  arm64: dts: r8a7795: Add support for R-Car H3 ES2.0
  arm64: dts: r8a7795: salvator-x: Add support for R-Car H3 ES2.0

Jacopo Mondi (1):
  arm64: dts: salvator-x: Add current sense amplifiers

Koji Matsuoka (1):
  arm64: dts: renesas: r8a7795-salvator-x: Enable HDMI outputs

Kuninori Morimoto (7):
  arm64: dts: r8a7796: add AUDIO_DMAC support
  arm64: dts: r8a7796: add Sound SSI PIO support
  arm64: dts: r8a7796: add Sound SSI DMA support
  arm64: dts: r8a7796: add Sound SRC support
  arm64: dts: r8a7796: add Sound DVC support
  arm64: dts: r8a7796: add Sound CTU support
  arm64: dts: r8a7796: add Sound MIX support

Laurent Pinchart (4):
  arm64: dts: salvator-x: Add panel backlight support
  arm64: dts: renesas: salvator-x: Add DU external dot clock sources
  arm64: dts: renesas: salvator-x: Add HDMI output connectors
  arm64: dts: renesas: r8a7795-salvator-x: Add DU external dot clocks

Simon Horman (3):
  arm64: dts: m3ulcb: Fix EthernetAVB PHY timing
  arm64: dts: r8a7795: update PFC node name to pin-controller
  arm64: dts: ulcb: Set drive-strength for ravb pins

Takeshi Kihara (2):
  arm64: dts: r8a7795: salvator-x: Update memory node to 4 GiB map
  arm64: dts: r8a7796: Add PWM device nodes

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

Vladimir Barinov (5):
  arm64: dts: m3ulcb: enable I2C
  arm64: dts: m3ulcb: Update memory node to 2 GiB map
  arm64: dts: m3ulcb: enable EthernetAVB
  arm64: dts: m3ulcb: enable HS200 for eMMC
  arm64: dts: h3ulcb: enable HS200 for eMMC

Wolfram Sang (2):
  arm64: dts: r8a7795: salvator-x: enable HS200 for eMMC
  arm64: dts: r8a7796: salvator-x: enable HS200 for eMMC

 arch/arm64/boot/dts/renesas/Makefile   |   1 +
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts| 115 
 arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi   |  84 +++
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts | 344 +--
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 565 ++
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   | 121 ++--
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts | 168 +-
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 244 +---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   | 409 +
 arch/arm64/boot/dts/renesas/salvator-x.dtsi| 644 +
 arch/arm64/boot/dts/renesas/ulcb.dtsi  | 367 
 11 files changed, 1734 insertions(+), 1328 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
 create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1.dtsi
 create mode 100644 arch/arm64/boot/dts/renesas/salvator-x.dtsi
 create mode 100644 arch/arm64/boot/dts/renesas/ulcb.dtsi


Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Kieran Bingham
On 22/05/17 14:23, Laurent Pinchart wrote:
> Hello Geert and Kieran,
> 
> On Monday 22 May 2017 15:00:27 Geert Uytterhoeven wrote:
>> On Mon, May 22, 2017 at 2:52 PM, Kieran Bingham wrote:
>>> My only distaste there is having to then add the [i-1] index to the
>>> sg_tables.
>>>
>>> I have just experimented with:
>>>
>>> fail:
>>> for (; i-- != 0;) {
>>> struct sg_table *sgt = &rstate->sg_tables[i];
>>> ...
>>> }
>>>
>>> This performs the correct loops, with the correct indexes, but does the
>>> decrement in the condition offend coding styles ?
>>>
>>> If that's disliked even more I'll just apply your suggestion.
>>
>> You can still use "i-- > 0", which looks a little bit better IMHO.
> 
> I'm fine with that option too.
> 

Of course for(; X ;) is just while(X), which is also more readable ;)

And while (i-- > 0) simplifies cleanly to while (i--) which I'm sure is quite
readable.

I'll clean up and post the updated series including linux-media.

--

Kieran


Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Laurent Pinchart
Hello Geert and Kieran,

On Monday 22 May 2017 15:00:27 Geert Uytterhoeven wrote:
> On Mon, May 22, 2017 at 2:52 PM, Kieran Bingham wrote:
> > My only distaste there is having to then add the [i-1] index to the
> > sg_tables.
> > 
> > I have just experimented with:
> > 
> > fail:
> > for (; i-- != 0;) {
> > struct sg_table *sgt = &rstate->sg_tables[i];
> > ...
> > }
> > 
> > This performs the correct loops, with the correct indexes, but does the
> > decrement in the condition offend coding styles ?
> > 
> > If that's disliked even more I'll just apply your suggestion.
> 
> You can still use "i-- > 0", which looks a little bit better IMHO.

I'm fine with that option too.

-- 
Regards,

Laurent Pinchart



[PATCH v5 4/6] spi: sh-msiof: Add slave mode support

2017-05-22 Thread Geert Uytterhoeven
From: Hisashi Nakamura 

Add slave mode support to the MSIOF driver, in both PIO and DMA mode.

For now this only supports the transmission of messages with a size
that is known in advance.

Signed-off-by: Hisashi Nakamura 
Signed-off-by: Hiromitsu Yamasaki 
[geert: Timeout handling cleanup, spi core integration, cancellation,
rewording]
Signed-off-by: Geert Uytterhoeven 
Acked-by: Rob Herring 
---
v5:
  - No changes,

v4:
  - Add Acked-by,
  - Use slave_aborted flag and complete() instead of messing with
internal completion and thread state,

v3:
  - Clear TIF_SIGPENDING when interrupted to fix cancellation,
  - Extract sh_msiof_wait_for_completion(),
  - Add #include ,
  - Convert to use spi_alloc_slave(),

v2:
  - Document "spi-slave" property in DT bindings,
  - Use spi_controller_is_slave() helper,
  - Check for "spi-slave" property instead of "slave" child node,
  - Replace SPI_MASTER_IS_SLAVE by SPI_CONTROLLER_IS_SLAVE,
  - Implement cancellation.
---
 Documentation/devicetree/bindings/spi/sh-msiof.txt |   2 +
 drivers/spi/spi-sh-msiof.c | 111 +++--
 include/linux/spi/sh_msiof.h   |   6 ++
 3 files changed, 86 insertions(+), 33 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt 
b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index dc975064fa273c36..64ee489571c42f88 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -38,6 +38,8 @@ Optional properties:
 specifiers, one for transmission, and one for
 reception.
 - dma-names: Must contain a list of two DMA names, "tx" and "rx".
+- spi-slave: Empty property indicating the SPI controller is used
+in slave mode.
 - renesas,dtdl : delay sync signal (setup) in transmit mode.
 Must contain one of the following values:
 0   (no bit delay)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 2ce15ca977828668..c304c7167866d2db 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -2,7 +2,8 @@
  * SuperH MSIOF SPI Master Interface
  *
  * Copyright (c) 2009 Magnus Damm
- * Copyright (C) 2014 Glider bvba
+ * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2014-2017 Glider bvba
  *
  * 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
@@ -33,7 +34,6 @@
 
 #include 
 
-
 struct sh_msiof_chipdata {
u16 tx_fifo_size;
u16 rx_fifo_size;
@@ -53,6 +53,7 @@ struct sh_msiof_spi_priv {
void *rx_dma_page;
dma_addr_t tx_dma_addr;
dma_addr_t rx_dma_addr;
+   bool slave_aborted;
 };
 
 #define TMDR1  0x00/* Transmit Mode Register 1 */
@@ -337,7 +338,10 @@ static void sh_msiof_spi_set_pin_regs(struct 
sh_msiof_spi_priv *p,
tmp |= !cs_high << MDR1_SYNCAC_SHIFT;
tmp |= lsb_first << MDR1_BITLSB_SHIFT;
tmp |= sh_msiof_spi_get_dtdl_and_syncdl(p);
-   sh_msiof_write(p, TMDR1, tmp | MDR1_TRMD | TMDR1_PCON);
+   if (spi_controller_is_slave(p->master))
+   sh_msiof_write(p, TMDR1, tmp | TMDR1_PCON);
+   else
+   sh_msiof_write(p, TMDR1, tmp | MDR1_TRMD | TMDR1_PCON);
if (p->master->flags & SPI_MASTER_MUST_TX) {
/* These bits are reserved if RX needs TX */
tmp &= ~0x;
@@ -564,17 +568,19 @@ static int sh_msiof_prepare_message(struct spi_master 
*master,
 
 static int sh_msiof_spi_start(struct sh_msiof_spi_priv *p, void *rx_buf)
 {
-   int ret;
+   bool slave = spi_controller_is_slave(p->master);
+   int ret = 0;
 
/* setup clock and rx/tx signals */
-   ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
+   if (!slave)
+   ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
if (rx_buf && !ret)
ret = sh_msiof_modify_ctr_wait(p, 0, CTR_RXE);
if (!ret)
ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TXE);
 
/* start by setting frame bit */
-   if (!ret)
+   if (!ret && !slave)
ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TFSE);
 
return ret;
@@ -582,20 +588,49 @@ static int sh_msiof_spi_start(struct sh_msiof_spi_priv 
*p, void *rx_buf)
 
 static int sh_msiof_spi_stop(struct sh_msiof_spi_priv *p, void *rx_buf)
 {
-   int ret;
+   bool slave = spi_controller_is_slave(p->master);
+   int ret = 0;
 
/* shut down frame, rx/tx and clock signals */
-   ret = sh_msiof_modify_ctr_wait(p, CTR_TFSE, 0);
+   if (!slave)
+   ret = sh_msiof_modify_ctr_wait(p, CTR_TFSE, 0);
if (!ret)
ret = sh_msiof_modify_ctr_wait(p, CTR_TXE, 0);
if (rx_buf && !ret)
ret = sh_msiof_modify_ctr_wait(p, C

[PATCH v5 5/6] spi: slave: Add SPI slave handler reporting uptime at previous message

2017-05-22 Thread Geert Uytterhoeven
Add an example SPI slave handler responding with the uptime at the time
of reception of the last SPI message.

This can be used by an external microcontroller as a dead man's switch.

Signed-off-by: Geert Uytterhoeven 
---
v5:
  - Add usage documentation to file header,
  - Replace pr_*() by dev_*(), stop printing __func__,
  - Rename rem_ns to rem_us, as the remainder is in microseconds,
  - Remove spi_setup() call to configure 8 bits per word, as that's the
default,

v4:
  - No changes,

v3:
  - Add #include ,

v2:
  - Resolve semantic differences in patch description, file header, and
module description,
  - Use spi_async() instead of spi_read(),
  - Submit the next transfer from the previous transfer's completion
callback, removing the need for a thread,
  - Let .remove() call spi_slave_abort() to cancel the current ongoing
transfer, and wait for the completion to terminate,
  - Remove FIXME about hanging kthread_stop().
---
 drivers/spi/Kconfig  |   6 ++
 drivers/spi/Makefile |   1 +
 drivers/spi/spi-slave-time.c | 129 +++
 3 files changed, 136 insertions(+)
 create mode 100644 drivers/spi/spi-slave-time.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index f21499b1f71ab7c3..9972ee2a8454a2fc 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -797,6 +797,12 @@ config SPI_SLAVE
 
 if SPI_SLAVE
 
+config SPI_SLAVE_TIME
+   tristate "SPI slave handler reporting boot up time"
+   help
+ SPI slave handler responding with the time of reception of the last
+ SPI message.
+
 endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index e50852c6fcb87d8b..fb078693dbe40da4 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -107,3 +107,4 @@ obj-$(CONFIG_SPI_XTENSA_XTFPGA) += 
spi-xtensa-xtfpga.o
 obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
 
 # SPI slave protocol handlers
+obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
diff --git a/drivers/spi/spi-slave-time.c b/drivers/spi/spi-slave-time.c
new file mode 100644
index ..f2e07a392d6863ea
--- /dev/null
+++ b/drivers/spi/spi-slave-time.c
@@ -0,0 +1,129 @@
+/*
+ * SPI slave handler reporting uptime at reception of previous SPI message
+ *
+ * This SPI slave handler sends the time of reception of the last SPI message
+ * as two 32-bit unsigned integers in binary format and in network byte order,
+ * representing the number of seconds and fractional seconds (in microseconds)
+ * since boot up.
+ *
+ * Copyright (C) 2016-2017 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
+ * system):
+ *
+ *   # spidev_test -D /dev/spidev2.0 -p dummy-8B
+ *   spi mode: 0x0
+ *   bits per word: 8
+ *   max speed: 50 Hz (500 KHz)
+ *   RX | 00 00 04 6D 00 09 5B BB ...
+ * ^
+ * seconds  microseconds
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+
+struct spi_slave_time_priv {
+   struct spi_device *spi;
+   struct completion finished;
+   struct spi_transfer xfer;
+   struct spi_message msg;
+   __be32 buf[2];
+};
+
+static int spi_slave_time_submit(struct spi_slave_time_priv *priv);
+
+static void spi_slave_time_complete(void *arg)
+{
+   struct spi_slave_time_priv *priv = arg;
+   int ret;
+
+   ret = priv->msg.status;
+   if (ret)
+   goto terminate;
+
+   ret = spi_slave_time_submit(priv);
+   if (ret)
+   goto terminate;
+
+   return;
+
+terminate:
+   dev_info(&priv->spi->dev, "Terminating\n");
+   complete(&priv->finished);
+}
+
+static int spi_slave_time_submit(struct spi_slave_time_priv *priv)
+{
+   u32 rem_us;
+   int ret;
+   u64 ts;
+
+   ts = local_clock();
+   rem_us = do_div(ts, 10) / 1000;
+
+   priv->buf[0] = cpu_to_be32(ts);
+   priv->buf[1] = cpu_to_be32(rem_us);
+
+   spi_message_init_with_transfers(&priv->msg, &priv->xfer, 1);
+
+   priv->msg.complete = spi_slave_time_complete;
+   priv->msg.context = priv;
+
+   ret = spi_async(priv->spi, &priv->msg);
+   if (ret)
+   dev_err(&priv->spi->dev, "spi_async() failed %d\n", ret);
+
+   return ret;
+}
+
+static int spi_slave_time_probe(struct spi_device *spi)
+{
+   struct spi_slave_time_priv *priv;
+   int ret;
+
+   priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
+
+   priv->spi = spi;
+   init_completion(&priv->finished);
+   priv->xfer.tx_buf = priv->buf;
+   priv->xfer.len = sizeof(priv->buf);
+
+   ret = spi_slave_time_submit(priv);
+   if (ret)
+   return ret;
+
+ 

[PATCH v5 1/6] spi: Document DT bindings for SPI controllers in slave mode

2017-05-22 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Rob Herring 
---
v5:
  - No changes,

v4:
  - Add Reviewed-by,

v3:
  - In SPI slave mode, represent the (single) slave device again as a
child of the controller node, which is now optional, and must be
named "slave" if present,
  - Split slave node properties in master mode, slave mode, and common
properties,

v2:
  - Do not create a child node in SPI slave mode. Instead, add an
"spi-slave" property, and put the mode properties in the controller
node.
---
 Documentation/devicetree/bindings/spi/spi-bus.txt | 76 ++-
 1 file changed, 45 insertions(+), 31 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 4b1d6e74c744fe96..1f6e86f787efd229 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -1,17 +1,23 @@
 SPI (Serial Peripheral Interface) busses
 
-SPI busses can be described with a node for the SPI master device
-and a set of child nodes for each SPI slave on the bus.  For this
-discussion, it is assumed that the system's SPI controller is in
-SPI master mode.  This binding does not describe SPI controllers
-in slave mode.
+SPI busses can be described with a node for the SPI controller device
+and a set of child nodes for each SPI slave on the bus.  The system's SPI
+controller may be described for use in SPI master mode or in SPI slave mode,
+but not for both at the same time.
 
-The SPI master node requires the following properties:
+The SPI controller node requires the following properties:
+- compatible  - Name of SPI bus controller following generic names
+   recommended practice.
+
+In master mode, the SPI controller node requires the following additional
+properties:
 - #address-cells  - number of cells required to define a chip select
address on the SPI bus.
 - #size-cells - should be zero.
-- compatible  - name of SPI bus controller following generic names
-   recommended practice.
+
+In slave mode, the SPI controller node requires one additional property:
+- spi-slave   - Empty property.
+
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,7 +27,7 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
-Optional properties:
+Optional properties (master mode only):
 - cs-gpios   - gpios chip select.
 - num-cs - total number of chipselects.
 
@@ -41,28 +47,36 @@ cs1 : native
 cs2 : &gpio1 1 0
 cs3 : &gpio1 2 0
 
-SPI slave nodes must be children of the SPI master node and can
-contain the following properties.
-- reg - (required) chip select address of device.
-- compatible  - (required) name of SPI device following generic names
-   recommended practice.
-- spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz.
-- spi-cpol- (optional) Empty property indicating device requires
-   inverse clock polarity (CPOL) mode.
-- spi-cpha- (optional) Empty property indicating device requires
-   shifted clock phase (CPHA) mode.
-- spi-cs-high - (optional) Empty property indicating device requires
-   chip select active high.
-- spi-3wire   - (optional) Empty property indicating device requires
-   3-wire mode.
-- spi-lsb-first   - (optional) Empty property indicating device requires
-   LSB first mode.
-- spi-tx-bus-width - (optional) The bus width (number of data wires) that is
-  used for MOSI. Defaults to 1 if not present.
-- spi-rx-bus-width - (optional) The bus width (number of data wires) that is
-  used for MISO. Defaults to 1 if not present.
-- spi-rx-delay-us  - (optional) Microsecond delay after a read transfer.
-- spi-tx-delay-us  - (optional) Microsecond delay after a write transfer.
+
+SPI slave nodes must be children of the SPI controller node.
+
+In master mode, one or more slave nodes (up to the number of chip selects) can
+be present.  Required properties are:
+- compatible  - Name of SPI device following generic names recommended
+   practice.
+- reg - Chip select address of device.
+- spi-max-frequency - Maximum SPI clocking speed of device in Hz.
+
+In slave mode, the (single) slave node is optional.
+If present, it must be called "slave".  Required properties are:
+- compatible  - Name of SPI device following generic names recommended
+   practice.
+
+All slave nodes can contain the following optional properties:
+- spi-cpol- Empty property indicating

[PATCH v5 0/6] spi: Add slave mode support

2017-05-22 Thread Geert Uytterhoeven
Hi Mark,

This patch series adds support for SPI slave controllers to the Linux
SPI subsystem, including:
  - DT binding updates for SPI slave support,
  - Core support for SPI slave controllers,
  - SPI slave support for the Renesas MSIOF device driver (thanks to
Nakamura-san for the initial implementation in the R-Car BSP!),
  - Sample SPI slave handlers.

Due to the nature of SPI slave (simultaneous transmit and receive, while
everything runs at the pace of the master), it has hard real-time
requirements: once an SPI transfer is started by the SPI master, a
software SPI slave must have prepared all data to be sent back to the
SPI master.  Hence without additional hardware support, an SPI slave
response can never be a reply to a command being simultaneously
transmitted, and SPI slave replies must be received by the SPI master in
a subsequent SPI transfer.

Examples of possible use cases:
  - Receiving streams of data in fixed-size messages (e.g. from a
tuner),
  - Receiving and transmitting fixed-size messages of data (e.g. network
frames),
  - Sending commands, and querying for responses,
  - ...

Binding an SPI slave handler to the SPI slave device represented by an
SPI slave controller can either be done from DT, or through sysfs.
The latter, which also allows unregistering, is done through a sysfs
virtual file named "slave", cfr. Documentation/spi/spi-summary.

Originally I wanted to implement a simple SPI slave handler that could
interface with an existing Linux SPI slave driver, cfr. Wolfram Sang's
I2C slave mode EEPROM simulator for the i2c subsystem.
Unfortunately I couldn't find any existing driver using an SPI slave
protocol that fulfills the above requirements. The Nordic Semiconductor
nRF8001 BLE controller seems to use a suitable protocol, but I couldn't
find a Linux driver for it.  Hence I created two sample SPI slave
protocols and drivers myself:
  1. "spi-slave-time" responds with the system uptime at the time of
 reception of the last SPI message, which can be used by an external
 microcontroller as a dead man's switch.
  2. "spi-slave-system-control" allows remote control of system reboot,
 power off, halt, and suspend.

For some use cases, using spidev from user space may be a more appropriate
solution than an in-kernel SPI protocol handler, and this is fully
supported.

>From the point of view of an SPI slave protocol handler, an SPI slave
controller looks almost like an ordinary SPI master controller. The only
exception is that a transfer request will block on the remote SPI
master, and may be cancelled using spi_slave_abort().
Hence "struct spi_master" has become a misnomer.  I'll send an RFC
follow-up patch to fix that.

For now, the MSIOF SPI slave driver only supports the transmission of
messages with a size that is known in advance (the hardware can provide
an interrupt when CS is deasserted before, though).
I.e. when the SPI master sends a shorter message, the slave won't
receive it.  When the SPI master sends a longer message, the slave will
receive the first part, and the rest will remain in the FIFO.

Handshaking (5-pin SPI, RDY-signal) is optional, and not yet
implemented.  An RDY-signal may be used for one or both of:
  1. The SPI slave asserts RDY when it has data available, and wants to
 be queried by the SPI master.
   -> This can be handled on top, in the SPI slave protocol handler,
  using a GPIO.
  2. After the SPI master has asserted CS, the SPI slave asserts RDY
 when it is ready to accept the transfer.
   -> This may need hardware support in the SPI slave controller,
  or dynamic GPIO vs. CS pinmuxing.

Changes compared to v4, all to the sample SPI slave handlers:
  - Add usage documentation to file header,
  - Replace pr_*() by dev_*(), stop printing __func__,
  - Rename rem_ns to rem_us, as the remainder is in microseconds,
  - Remove spi_setup() call to configure 8 bits per word, as that's the
default,
  - Use network byte order for commands, to match the "-p" parameter of
spidev_test,

Changes compared to v3:
  - Add Reviewed-by, Acked-by,
  - Add missing kerneldoc for spi_master.slave,
  - Use slave_aborted flag and complete() instead of messing with
internal completion and thread state,

Changes compared to v2 (highlights only, see individual patches for
more details):
  - In SPI slave mode, represent the (single) slave device again as a
child of the controller node, which is now optional, and must be
named "slave" if present,
  - Introduce a separate spi_alloc_slave() function,
  - Replace the SPI_CONTROLLER_IS_SLAVE flag in spi_master.flags by a
bool in spi_master,
  - Fix cancellation in the spi-sh-msiof driver,
  - Drop "spi: core: Extract of_spi_parse_dt()", which was applied,

Changes compared to v1 (highlights only, see individual patches for
more details):
  - Do not create a child node in SPI slave mode. Instead, add an
"spi-slave" property, and put the mode 

[PATCH v5 6/6] spi: slave: Add SPI slave handler controlling system state

2017-05-22 Thread Geert Uytterhoeven
Add an example SPI slave handler to allow remote control of system
reboot, power off, halt, and suspend.

Signed-off-by: Geert Uytterhoeven 
---
v5:
  - Add usage documentation to file header,
  - Use network byte order for commands, to match the "-p" parameter of
spidev_test,
  - Replace pr_*() by dev_*(), stop printing __func__,
  - Remove spi_setup() call to configure 8 bits per word, as that's the
default,

v3, v4:
  - No changes,

v2:
  - Use spi_async() instead of spi_read(),
  - Submit the next transfer from the previous transfer's completion
callback, removing the need for a thread,
  - Let .remove() call spi_slave_abort() to cancel the current ongoing
transfer, and wait for the completion to terminate,
  - Remove FIXME about hanging kthread_stop(),
  - Fix copy-and-pasted module description.
---
 drivers/spi/Kconfig|   6 ++
 drivers/spi/Makefile   |   1 +
 drivers/spi/spi-slave-system-control.c | 154 +
 3 files changed, 161 insertions(+)
 create mode 100644 drivers/spi/spi-slave-system-control.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 9972ee2a8454a2fc..82cd818aa06293f5 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -803,6 +803,12 @@ config SPI_SLAVE_TIME
  SPI slave handler responding with the time of reception of the last
  SPI message.
 
+config SPI_SLAVE_SYSTEM_CONTROL
+   tristate "SPI slave handler controlling system state"
+   help
+ SPI slave handler to allow remote control of system reboot, power
+ off, halt, and suspend.
+
 endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index fb078693dbe40da4..1d7923e8c63bc22b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -108,3 +108,4 @@ obj-$(CONFIG_SPI_ZYNQMP_GQSPI)  += 
spi-zynqmp-gqspi.o
 
 # SPI slave protocol handlers
 obj-$(CONFIG_SPI_SLAVE_TIME)   += spi-slave-time.o
+obj-$(CONFIG_SPI_SLAVE_SYSTEM_CONTROL) += spi-slave-system-control.o
diff --git a/drivers/spi/spi-slave-system-control.c 
b/drivers/spi/spi-slave-system-control.c
new file mode 100644
index ..c0257e937995ec53
--- /dev/null
+++ b/drivers/spi/spi-slave-system-control.c
@@ -0,0 +1,154 @@
+/*
+ * SPI slave handler controlling system state
+ *
+ * This SPI slave handler allows remote control of system reboot, power off,
+ * halt, and suspend.
+ *
+ * Copyright (C) 2016-2017 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Usage (assuming /dev/spidev2.0 corresponds to the SPI master on the remote
+ * system):
+ *
+ *   # reboot='\x7c\x50'
+ *   # poweroff='\x71\x3f'
+ *   # halt='\x38\x76'
+ *   # suspend='\x1b\x1b'
+ *   # spidev_test -D /dev/spidev2.0 -p $suspend # or $reboot, $poweroff, $halt
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * The numbers are chosen to display something human-readable on two 7-segment
+ * displays connected to two 74HC595 shift registers
+ */
+#define CMD_REBOOT 0x7c50  /* rb */
+#define CMD_POWEROFF   0x713f  /* OF */
+#define CMD_HALT   0x3876  /* HL */
+#define CMD_SUSPEND0x1b1b  /* ZZ */
+
+struct spi_slave_system_control_priv {
+   struct spi_device *spi;
+   struct completion finished;
+   struct spi_transfer xfer;
+   struct spi_message msg;
+   __be16 cmd;
+};
+
+static
+int spi_slave_system_control_submit(struct spi_slave_system_control_priv 
*priv);
+
+static void spi_slave_system_control_complete(void *arg)
+{
+   struct spi_slave_system_control_priv *priv = arg;
+   u16 cmd;
+   int ret;
+
+   if (priv->msg.status)
+   goto terminate;
+
+   cmd = be16_to_cpu(priv->cmd);
+   switch (cmd) {
+   case CMD_REBOOT:
+   dev_info(&priv->spi->dev, "Rebooting system...\n");
+   kernel_restart(NULL);
+
+   case CMD_POWEROFF:
+   dev_info(&priv->spi->dev, "Powering off system...\n");
+   kernel_power_off();
+   break;
+
+   case CMD_HALT:
+   dev_info(&priv->spi->dev, "Halting system...\n");
+   kernel_halt();
+   break;
+
+   case CMD_SUSPEND:
+   dev_info(&priv->spi->dev, "Suspending system...\n");
+   pm_suspend(PM_SUSPEND_MEM);
+   break;
+
+   default:
+   dev_warn(&priv->spi->dev, "Unknown command 0x%x\n", cmd);
+   break;
+   }
+
+   ret = spi_slave_system_control_submit(priv);
+   if (ret)
+   goto terminate;
+
+   return;
+
+terminate:
+   dev_info(&priv->spi->dev, "Terminating\n");
+   complete(&priv->finished);
+}
+
+static
+int spi_slave_system_control_submit(struct spi_slave_system_control_priv *priv)
+{
+   int ret;
+
+   spi_message_i

[PATCH v5 2/6] spi: core: Add support for registering SPI slave controllers

2017-05-22 Thread Geert Uytterhoeven
Add support for registering SPI slave controllers using the existing SPI
master framework:
  - SPI slave controllers must use spi_alloc_slave() instead of
spi_alloc_master(), and should provide an additional callback
"slave_abort" to abort an ongoing SPI transfer request,
  - SPI slave controllers are added to a new "spi_slave" device class,
  - SPI slave handlers can be bound to the SPI slave device represented
by an SPI slave controller using a DT child node named "slave",
  - Alternatively, (un)binding an SPI slave handler to the SPI slave
device represented by an SPI slave controller can be done by
(un)registering the slave device through a sysfs virtual file named
"slave".

>From the point of view of an SPI slave protocol handler, an SPI slave
controller looks almost like an ordinary SPI master controller. The only
exception is that a transfer request will block on the remote SPI
master, and may be cancelled using spi_slave_abort().

Signed-off-by: Geert Uytterhoeven 
---
v5:
  - No changes,

v4:
  - Add missing kerneldoc for spi_master.slave,

v3:
  - Introduce a separate spi_alloc_slave() function, which sets up the
spi_slave_class instead of the spi_master class, to avoid the WARN()
in device_release(),
  - Wrap spi_alloc_{master,slave}() around __spi_alloc_controller(),
  - Replace the SPI_CONTROLLER_IS_SLAVE flag in spi_master.flags (set by
the SPI controller driver) by a bool in spi_master (set by
__spi_alloc_controller()),
  - Revert parsing of slave-specific mode properties in the SPI slave
controller DT node for the (single) slave device,
  - Register again children from DT or ACPI for SPI slave controllers;
the single optional slave child node must be called "slave",
  - Let {acpi,of}_spi_notify() also search spi_slave_class devices,
  - Use octal instead of symbolic permissions,
  - s/hander/handler/,

v2:
  - Attach SPI slave controllers to a new "spi_slave" device class,
  - Don't call of_spi_register_master() instead of letting it return
early for SPI slave controllers,
  - Skip registration of children from DT or ACPI for SPI slave
controllers,
  - Use a "slave" virtual file in sysfs to (un)register the (single)
slave device for an SPI slave controller, incl. specifying the slave
protocol handler,
  - Parse slave-specific mode properties in the SPI slave controller DT
node for the (single) slave device using of_spi_parse_dt(),
  - Add cancellation support using spi_master.slave_abort() and
spi_slave_abort(),
  - Rename flag SPI_MASTER_IS_SLAVE to SPI_CONTROLLER_IS_SLAVE,
  - Introduce helper function spi_controller_is_slave(), making it easy
to leave out SPI slave support where appropriate.
---
 drivers/spi/Kconfig |  14 +++-
 drivers/spi/Makefile|   2 +
 drivers/spi/spi.c   | 179 +---
 include/linux/spi/spi.h |  35 --
 4 files changed, 201 insertions(+), 29 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 097883362036416f..f21499b1f71ab7c3 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -785,6 +785,18 @@ config SPI_TLE62X0
 
 endif # SPI_MASTER
 
-# (slave support would go here)
+#
+# SLAVE side ... listening to other SPI masters
+#
+
+config SPI_SLAVE
+   bool "SPI slave protocol handlers"
+   help
+ If your system has a slave-capable SPI controller, you can enable
+ slave protocol handlers.
+
+if SPI_SLAVE
+
+endif # SPI_SLAVE
 
 endif # SPI
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index b375a7a892160b76..e50852c6fcb87d8b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -105,3 +105,5 @@ obj-$(CONFIG_SPI_XILINX)+= spi-xilinx.o
 obj-$(CONFIG_SPI_XLP)  += spi-xlp.o
 obj-$(CONFIG_SPI_XTENSA_XTFPGA)+= spi-xtensa-xtfpga.o
 obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
+
+# SPI slave protocol handlers
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 6f87fec409b5f6fd..c3f6b524b3ceb6c1 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1535,15 +1535,6 @@ static int of_spi_parse_dt(struct spi_master *master, 
struct spi_device *spi,
u32 value;
int rc;
 
-   /* Device address */
-   rc = of_property_read_u32(nc, "reg", &value);
-   if (rc) {
-   dev_err(&master->dev, "%s has no valid 'reg' property (%d)\n",
-   nc->full_name, rc);
-   return rc;
-   }
-   spi->chip_select = value;
-
/* Mode (clock phase/polarity/etc.) */
if (of_find_property(nc, "spi-cpha", NULL))
spi->mode |= SPI_CPHA;
@@ -1593,6 +1584,24 @@ static int of_spi_parse_dt(struct spi_master *master, 
struct spi_device *spi,
}
}
 
+   if (spi_controller_is_slave(master)) {
+   if (strcmp(nc->name, "slave")) {
+   dev_err(&master->dev, "%s is not called 'slave'

[PATCH v5 3/6] spi: Document SPI slave controller support

2017-05-22 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven 
---
v3, v4, v5:
  - No changes,

v2:
  - New.
---
 Documentation/spi/spi-summary | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index d1824b399b2d1d79..1721c1b570c32466 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -62,8 +62,8 @@ chips described as using "three wire" signaling: SCK, data, 
nCSx.
 (That data line is sometimes called MOMI or SISO.)
 
 Microcontrollers often support both master and slave sides of the SPI
-protocol.  This document (and Linux) currently only supports the master
-side of SPI interactions.
+protocol.  This document (and Linux) supports both the master and slave
+sides of SPI interactions.
 
 
 Who uses it?  On what kinds of systems?
@@ -154,9 +154,8 @@ control audio interfaces, present touchscreen sensors as 
input interfaces,
 or monitor temperature and voltage levels during industrial processing.
 And those might all be sharing the same controller driver.
 
-A "struct spi_device" encapsulates the master-side interface between
-those two types of driver.  At this writing, Linux has no slave side
-programming interface.
+A "struct spi_device" encapsulates the controller-side interface between
+those two types of drivers.
 
 There is a minimal core of SPI programming interfaces, focussing on
 using the driver model to connect controller and protocol drivers using
@@ -177,10 +176,24 @@ shows up in sysfs in several locations:
/sys/bus/spi/drivers/D ... driver for one or more spi*.* devices
 
/sys/class/spi_master/spiB ... symlink (or actual device node) to
-   a logical node which could hold class related state for the
-   controller managing bus "B".  All spiB.* devices share one
+   a logical node which could hold class related state for the SPI
+   master controller managing bus "B".  All spiB.* devices share one
physical SPI bus segment, with SCLK, MOSI, and MISO.
 
+   /sys/devices/.../CTLR/slave ... virtual file for (un)registering the
+   slave device for an SPI slave controller.
+   Writing the driver name of an SPI slave handler to this file
+   registers the slave device; writing "(null)" unregisters the slave
+   device.
+   Reading from this file shows the name of the slave device ("(null)"
+   if not registered).
+
+   /sys/class/spi_slave/spiB ... symlink (or actual device node) to
+   a logical node which could hold class related state for the SPI
+   slave controller on bus "B".  When registered, a single spiB.*
+   device is present here, possible sharing the physical SPI bus
+   segment with other SPI slave devices.
+
 Note that the actual location of the controller's class state depends
 on whether you enabled CONFIG_SYSFS_DEPRECATED or not.  At this time,
 the only class-specific state is the bus number ("B" in "spiB"), so
-- 
2.7.4



Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Geert Uytterhoeven
On Mon, May 22, 2017 at 2:52 PM, Kieran Bingham
 wrote:
> My only distaste there is having to then add the [i-1] index to the sg_tables.
>
> I have just experimented with:
>
> fail:
> for (; i-- != 0;) {
> struct sg_table *sgt = &rstate->sg_tables[i];
> ...
> }
>
> This performs the correct loops, with the correct indexes, but does the
> decrement in the condition offend coding styles ?
>
> If that's disliked even more I'll just apply your suggestion.

You can still use "i-- > 0", which looks a little bit better IMHO.

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 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Kieran Bingham
Hi Laurent,

On 22/05/17 13:24, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Monday 22 May 2017 13:16:11 Kieran Bingham wrote:
>> On 17/05/17 00:20, Laurent Pinchart wrote:
>>> For planes handled by a VSP instance, map the framebuffer memory through
>>> the VSP to ensure proper IOMMU handling.
>>>
>>> Signed-off-by: Laurent Pinchart
>>> 
>>
>> Looks good except for a small unsigned int comparison causing an infinite
>> loop on fail case.
>>
>> With the loop fixed:
>>
>> Reviewed-by: Kieran Bingham 
>>
>>> ---
>>>
>>>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 74 +++---
>>>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 +
>>>  2 files changed, 70 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
>>> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index b0ff304ce3dc..1b874cfd40f3
>>> 100644
>>> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
>>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> 
> [snip]
> 
> 
>>> @@ -187,6 +186,67 @@ static void rcar_du_vsp_plane_setup(struct
>>> rcar_du_vsp_plane *plane)
>>> vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
>>>  }
>>>
>>> +static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
>>> +   struct drm_plane_state *state)
>>> +{
>>> +   struct rcar_du_vsp_plane_state *rstate = 
> to_rcar_vsp_plane_state(state);
>>> +   struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
>>> +   struct rcar_du_device *rcdu = vsp->dev;
>>> +   unsigned int i;
>>
>> Unsigned here..
>>
>>> +   int ret;
>>> +
>>> +   if (!state->fb)
>>> +   return 0;
>>> +
>>> +   for (i = 0; i < rstate->format->planes; ++i) {
>>> +   struct drm_gem_cma_object *gem =
>>> +   drm_fb_cma_get_gem_obj(state->fb, i);
>>> +   struct sg_table *sgt = &rstate->sg_tables[i];
>>> +
>>> +   ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr,
>>> + gem->base.size);
>>> +   if (ret)
>>> +   goto fail;
>>> +
>>> +   ret = vsp1_du_map_sg(vsp->vsp, sgt);
>>> +   if (!ret) {
>>> +   sg_free_table(sgt);
>>> +   ret = -ENOMEM;
>>> +   goto fail;
>>> +   }
>>> +   }
>>> +
>>> +   return 0;
>>> +
>>> +fail:
>>> +   for (i--; i >= 0; i--) {
>>
>> Means that this loop will never exit; i will always be >= 0;
>>
>> I'd propose just making signed for this usage.
>>
>> I've checked the i values for the breakouts - so they are good, and we need
>> to use i == 0 to unmap the last table.
>>
>>> +   struct sg_table *sgt = &rstate->sg_tables[i];
> 
> How about keep i unsigned and using
> 
>   for (; i > 0; i--) {
>   struct sg_table *sgt = &rstate->sg_tables[i-1];
>   ...
>   }

My only distaste there is having to then add the [i-1] index to the sg_tables.

I have just experimented with:

fail:
for (; i-- != 0;) {
struct sg_table *sgt = &rstate->sg_tables[i];
...
}

This performs the correct loops, with the correct indexes, but does the
decrement in the condition offend coding styles ?

If that's disliked even more I'll just apply your suggestion.

--
Kieran


> 
> If you want to fix while applying, you can pick your favourite version.
> 
>>> +
>>> +   vsp1_du_unmap_sg(vsp->vsp, sgt);
>>> +   sg_free_table(sgt);
>>> +   }
>>> +
>>> +   return ret;
>>> +}
> 


[PATCH 14/14] ARM: dts: renesas: Switch to panel-lvds bindings for Mitsubishi panels

2017-05-22 Thread Simon Horman
From: Laurent Pinchart 

The aa104xd12 and aa121td01 panels are LVDS panels, not DPI panels.
Use the correct DT bindings.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi | 3 ++-
 arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi 
b/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi
index 65cb50f0c29f..238d14bb0ebe 100644
--- a/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi
+++ b/arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi
@@ -10,10 +10,11 @@
 
 / {
panel {
-   compatible = "mitsubishi,aa104xd12", "panel-dpi";
+   compatible = "mitsubishi,aa104xd12", "panel-lvds";
 
width-mm = <210>;
height-mm = <158>;
+   data-mapping = "jeida-18";
 
panel-timing {
/* 1024x768 @65Hz */
diff --git a/arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi 
b/arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi
index a07ebf8f6938..04aafd479775 100644
--- a/arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi
+++ b/arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi
@@ -10,10 +10,11 @@
 
 / {
panel {
-   compatible = "mitsubishi,aa121td01", "panel-dpi";
+   compatible = "mitsubishi,aa121td01", "panel-lvds";
 
width-mm = <261>;
height-mm = <163>;
+   data-mapping = "jeida-18";
 
panel-timing {
/* 1280x800 @60Hz */
-- 
2.1.4



[PATCH 12/14] ARM: dts: r8a7793: set maximum frequency for SDHI clocks

2017-05-22 Thread Simon Horman
Define the upper limit otherwise the driver cannot utilize max speeds.

Signed-off-by: Simon Horman 
Acked-by: Wolfram Sang 
---
 arch/arm/boot/dts/r8a7793.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 728b5bca5bdb..13b980f27bbc 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -542,6 +542,7 @@
dmas = <&dmac0 0xcd>, <&dmac0 0xce>,
   <&dmac1 0xcd>, <&dmac1 0xce>;
dma-names = "tx", "rx", "tx", "rx";
+   max-frequency = <19500>;
power-domains = <&sysc R8A7793_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -554,6 +555,7 @@
dmas = <&dmac0 0xc1>, <&dmac0 0xc2>,
   <&dmac1 0xc1>, <&dmac1 0xc2>;
dma-names = "tx", "rx", "tx", "rx";
+   max-frequency = <9750>;
power-domains = <&sysc R8A7793_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -566,6 +568,7 @@
dmas = <&dmac0 0xd3>, <&dmac0 0xd4>,
   <&dmac1 0xd3>, <&dmac1 0xd4>;
dma-names = "tx", "rx", "tx", "rx";
+   max-frequency = <9750>;
power-domains = <&sysc R8A7793_PD_ALWAYS_ON>;
status = "disabled";
};
-- 
2.1.4



[GIT PULL] Renesas ARM Based SoC DT Updates for v4.13

2017-05-22 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

Please consider these Renesas ARM based SoC DT updates for v4.13.

This pull request is based on "Renesas ARM Based SoC DT Bindings Updates
for v4.13", dt-bindings-for-v4.13, which I have also sent a pull-request
for.


The following changes since commit 40c9bbea140e64a4257b794969e759c2c481c399:

  ARM: dts: r7s72100: add USB bit definitions (2017-05-15 09:02:37 +0200)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
tags/renesas-dt-for-v4.13

for you to fetch changes up to 2ae0fcc57e00c11fae80678e2a9fabbeec82a185:

  ARM: dts: renesas: Switch to panel-lvds bindings for Mitsubishi panels 
(2017-05-15 11:14:39 +0200)


Renesas ARM Based SoC DT Updates for v4.13

* Switch to panel-lvds bindings for Mitsubishi panels
* Clean up PFC node names
* Enable UHS-I SDR-50 and SDR-104 on r8a7793/Gose
* Add GyroADC clock and device for r8a7791 SoC
* Add USB clocks to device tree for r7s72100 SoC


Chris Brandt (1):
  ARM: dts: r7s72100: add usb clocks to device tree

Laurent Pinchart (1):
  ARM: dts: renesas: Switch to panel-lvds bindings for Mitsubishi panels

Marek Vasut (1):
  ARM: dts: r8a7791: Add GyroADC clock and device node

Simon Horman (11):
  ARM: dts: emev2: update PFC node name to pin-controller
  ARM: dts: r8a73a4: update PFC node name to pin-controller
  ARM: dts: r8a7740: update PFC node name to pin-controller
  ARM: dts: r8a7778: update PFC node name to pin-controller
  ARM: dts: r8a7779: update PFC node name to pin-controller
  ARM: dts: r8a7790: update PFC node name to pin-controller
  ARM: dts: r8a7791: update PFC node name to pin-controller
  ARM: dts: r8a7793: update PFC node name to pin-controller
  ARM: dts: sh73a0: update PFC node name to pin-controller
  ARM: dts: r8a7793: set maximum frequency for SDHI clocks
  ARM: dts: gose: Enable UHS-I SDR-50 and SDR-104

 arch/arm/boot/dts/emev2.dtsi   |  2 +-
 arch/arm/boot/dts/r7s72100.dtsi|  6 ++---
 arch/arm/boot/dts/r8a73a4.dtsi |  2 +-
 arch/arm/boot/dts/r8a7740.dtsi |  2 +-
 arch/arm/boot/dts/r8a7778.dtsi |  2 +-
 arch/arm/boot/dts/r8a7779.dtsi |  2 +-
 arch/arm/boot/dts/r8a7790.dtsi |  2 +-
 arch/arm/boot/dts/r8a7791.dtsi | 16 ++--
 arch/arm/boot/dts/r8a7793-gose.dts | 34 +++---
 arch/arm/boot/dts/r8a7793.dtsi |  5 +++-
 arch/arm/boot/dts/r8a77xx-aa104xd12-panel.dtsi |  3 ++-
 arch/arm/boot/dts/r8a77xx-aa121td01-panel.dtsi |  3 ++-
 arch/arm/boot/dts/sh73a0.dtsi  |  2 +-
 13 files changed, 63 insertions(+), 18 deletions(-)


[PATCH 1/3] ARM: dts: r8a7791: add GyroADC clock

2017-05-22 Thread Simon Horman
From: Marek Vasut 

Add the GyroADC clock to the R8A7791 device tree.

Signed-off-by: Marek Vasut 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 include/dt-bindings/clock/r8a7791-clock.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/r8a7791-clock.h 
b/include/dt-bindings/clock/r8a7791-clock.h
index adc50dc31ab3..ef692134146b 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -109,6 +109,7 @@
 #define R8A7791_CLK_SATA0  15
 
 /* MSTP9 */
+#define R8A7791_CLK_GYROADC1
 #define R8A7791_CLK_GPIO7  4
 #define R8A7791_CLK_GPIO6  5
 #define R8A7791_CLK_GPIO5  7
-- 
2.1.4



[PATCH 07/14] ARM: dts: r8a7791: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e606.pfc and pfc@e606 to
e606.pin-controller and pin-controller@e606.

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

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 4d0c2ce59900..540c5b27b842 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -562,7 +562,7 @@
status = "disabled";
};
 
-   pfc: pfc@e606 {
+   pfc: pin-controller@e606 {
compatible = "renesas,pfc-r8a7791";
reg = <0 0xe606 0 0x250>;
};
-- 
2.1.4



[PATCH 06/14] ARM: dts: r8a7790: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e606.pfc and pfc@e606 to
e606.pin-controller and pin-controller@e606.

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

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 99269aaca6fc..416956a42c93 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -614,7 +614,7 @@
max-frequency = <9750>;
};
 
-   pfc: pfc@e606 {
+   pfc: pin-controller@e606 {
compatible = "renesas,pfc-r8a7790";
reg = <0 0xe606 0 0x250>;
};
-- 
2.1.4



[PATCH 09/14] ARM: dts: sh73a0: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e605.pfc and pfc@e605 to
e605.pin-controller and pin-controller@e605.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/sh73a0.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 6b01ab354e88..4ea5c5a16c57 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -444,7 +444,7 @@
status = "disabled";
};
 
-   pfc: pfc@e605 {
+   pfc: pin-controller@e605 {
compatible = "renesas,pfc-sh73a0";
reg = <0xe605 0x8000>,
  <0xe605801c 0x1c>;
-- 
2.1.4



[PATCH 08/14] ARM: dts: r8a7793: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e606.pfc and pfc@e606 to
e606.pin-controller and pin-controller@e606.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/r8a7793.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 4de6041d61f9..728b5bca5bdb 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -529,7 +529,7 @@
status = "disabled";
};
 
-   pfc: pfc@e606 {
+   pfc: pin-controller@e606 {
compatible = "renesas,pfc-r8a7793";
reg = <0 0xe606 0 0x250>;
};
-- 
2.1.4



[PATCH 01/14] ARM: dts: emev2: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e0140200.pfc and pfc@e0140200 to
e0140200.pin-controller and pin-controller@e0140200.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/emev2.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index 0124faf175c8..42ea246e71cb 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -197,7 +197,7 @@
clock-names = "sclk";
};
 
-   pfc: pfc@e0140200 {
+   pfc: pin-controller@e0140200 {
compatible = "renesas,pfc-emev2";
reg = <0xe0140200 0x100>;
};
-- 
2.1.4



[PATCH 13/14] ARM: dts: gose: Enable UHS-I SDR-50 and SDR-104

2017-05-22 Thread Simon Horman
Add the "1v8" pinctrl state and sd-uhs-sdr50 property to SDHI{0,1,2}.
And the sd-uhs-sdr104 property to SDHI0.

Signed-off-by: Simon Horman 
Acked-by: Wolfram Sang 
---
 arch/arm/boot/dts/r8a7793-gose.dts | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 806c93f6ae8b..95e51b79c1d7 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -348,16 +348,37 @@
sdhi0_pins: sd0 {
groups = "sdhi0_data4", "sdhi0_ctrl";
function = "sdhi0";
+   power-source = <3300>;
+   };
+
+   sdhi0_pins_uhs: sd0_uhs {
+   groups = "sdhi0_data4", "sdhi0_ctrl";
+   function = "sdhi0";
+   power-source = <1800>;
};
 
sdhi1_pins: sd1 {
groups = "sdhi1_data4", "sdhi1_ctrl";
function = "sdhi1";
+   power-source = <3300>;
+   };
+
+   sdhi1_pins_uhs: sd1_uhs {
+   groups = "sdhi1_data4", "sdhi1_ctrl";
+   function = "sdhi1";
+   power-source = <1800>;
};
 
sdhi2_pins: sd2 {
groups = "sdhi2_data4", "sdhi2_ctrl";
function = "sdhi2";
+   power-source = <3300>;
+   };
+
+   sdhi2_pins_uhs: sd2_uhs {
+   groups = "sdhi2_data4", "sdhi2_ctrl";
+   function = "sdhi2";
+   power-source = <1800>;
};
 
qspi_pins: qspi {
@@ -416,33 +437,40 @@
 
 &sdhi0 {
pinctrl-0 = <&sdhi0_pins>;
-   pinctrl-names = "default";
+   pinctrl-1 = <&sdhi0_pins_uhs>;
+   pinctrl-names = "default", "state_uhs";
 
vmmc-supply = <&vcc_sdhi0>;
vqmmc-supply = <&vccq_sdhi0>;
cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
+   sd-uhs-sdr50;
+   sd-uhs-sdr104;
status = "okay";
 };
 
 &sdhi1 {
pinctrl-0 = <&sdhi1_pins>;
-   pinctrl-names = "default";
+   pinctrl-1 = <&sdhi1_pins_uhs>;
+   pinctrl-names = "default", "state_uhs";
 
vmmc-supply = <&vcc_sdhi1>;
vqmmc-supply = <&vccq_sdhi1>;
cd-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio6 15 GPIO_ACTIVE_HIGH>;
+   sd-uhs-sdr50;
status = "okay";
 };
 
 &sdhi2 {
pinctrl-0 = <&sdhi2_pins>;
-   pinctrl-names = "default";
+   pinctrl-1 = <&sdhi2_pins_uhs>;
+   pinctrl-names = "default", "state_uhs";
 
vmmc-supply = <&vcc_sdhi2>;
vqmmc-supply = <&vccq_sdhi2>;
cd-gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;
+   sd-uhs-sdr50;
status = "okay";
 };
 
-- 
2.1.4



[PATCH 10/14] ARM: dts: r7s72100: add usb clocks to device tree

2017-05-22 Thread Simon Horman
From: Chris Brandt 

This adds the USB0 and USB1 clocks to the device tree.

Signed-off-by: Chris Brandt 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r7s72100.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index 0423996e4dcc..5cf53e9943af 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -144,9 +144,9 @@
#clock-cells = <1>;
compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
reg = <0xfcfe0430 4>;
-   clocks = <&b_clk>;
-   clock-indices = ;
-   clock-output-names = "ether";
+   clocks = <&b_clk>, <&p1_clk>, <&p1_clk>;
+   clock-indices = ;
+   clock-output-names = "ether", "usb0", "usb1";
};
 
mstp8_clks: mstp8_clks@fcfe0434 {
-- 
2.1.4



[PATCH 11/14] ARM: dts: r8a7791: Add GyroADC clock and device node

2017-05-22 Thread Simon Horman
From: Marek Vasut 

Add node for the GyroADC block and it's associated clock.

Signed-off-by: Marek Vasut 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7791.dtsi | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 540c5b27b842..b730c889a404 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -776,6 +776,15 @@
status = "disabled";
};
 
+   adc: adc@e6e54000 {
+   compatible = "renesas,r8a7791-gyroadc", "renesas,rcar-gyroadc";
+   reg = <0 0xe6e54000 0 64>;
+   clocks = <&mstp9_clks R8A7791_CLK_GYROADC>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
scif2: serial@e6e58000 {
compatible = "renesas,scif-r8a7791", "renesas,rcar-gen2-scif",
 "renesas,scif";
@@ -1425,13 +1434,15 @@
mstp9_clks: mstp9_clks@e6150994 {
compatible = "renesas,r8a7791-mstp-clocks", 
"renesas,cpg-mstp-clocks";
reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
-   clocks = <&cp_clk>, <&cp_clk>, <&cp_clk>, <&cp_clk>,
+   clocks = <&p_clk>,
+<&cp_clk>, <&cp_clk>, <&cp_clk>, <&cp_clk>,
 <&cp_clk>, <&cp_clk>, <&cp_clk>, <&cp_clk>,
 <&p_clk>, <&p_clk>, <&cpg_clocks 
R8A7791_CLK_QSPI>, <&hp_clk>,
 <&cp_clk>, <&hp_clk>, <&hp_clk>, <&hp_clk>,
 <&hp_clk>, <&hp_clk>;
#clock-cells = <1>;
clock-indices = <
+   R8A7791_CLK_GYROADC
R8A7791_CLK_GPIO7 R8A7791_CLK_GPIO6 
R8A7791_CLK_GPIO5 R8A7791_CLK_GPIO4
R8A7791_CLK_GPIO3 R8A7791_CLK_GPIO2 
R8A7791_CLK_GPIO1 R8A7791_CLK_GPIO0
R8A7791_CLK_RCAN1 R8A7791_CLK_RCAN0 
R8A7791_CLK_QSPI_MOD R8A7791_CLK_I2C5
@@ -1439,6 +1450,7 @@
R8A7791_CLK_I2C1 R8A7791_CLK_I2C0
>;
clock-output-names =
+   "gyroadc",
"gpio7", "gpio6", "gpio5", "gpio4", "gpio3", 
"gpio2", "gpio1", "gpio0",
"rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", 
"i2c4", "i2c3", "i2c2",
"i2c1", "i2c0";
-- 
2.1.4



[PATCH 2/3] ARM: dts: r7s72100: add Renesas RZ/A1 pinctrl header

2017-05-22 Thread Simon Horman
From: Jacopo Mondi 

Add dt-bindings for Renesas r7s72100 pin controller header file.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 include/dt-bindings/pinctrl/r7s72100-pinctrl.h | 16 
 1 file changed, 16 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/r7s72100-pinctrl.h

diff --git a/include/dt-bindings/pinctrl/r7s72100-pinctrl.h 
b/include/dt-bindings/pinctrl/r7s72100-pinctrl.h
new file mode 100644
index ..6b609fe10910
--- /dev/null
+++ b/include/dt-bindings/pinctrl/r7s72100-pinctrl.h
@@ -0,0 +1,16 @@
+/*
+ * Defines macros and constants for Renesas RZ/A1 pin controller pin
+ * muxing functions.
+ */
+#ifndef __DT_BINDINGS_PINCTRL_RENESAS_RZA1_H
+#define __DT_BINDINGS_PINCTRL_RENESAS_RZA1_H
+
+#define RZA1_PINS_PER_PORT 16
+
+/*
+ * Create the pin index from its bank and position numbers and store in
+ * the upper 16 bits the alternate function identifier
+ */
+#define RZA1_PINMUX(b, p, f)   ((b) * RZA1_PINS_PER_PORT + (p) | (f << 16))
+
+#endif /* __DT_BINDINGS_PINCTRL_RENESAS_RZA1_H */
-- 
2.1.4



[PATCH 03/14] ARM: dts: r8a7740: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e605.pfc and pfc@e605 to
e605.pin-controller and pin-controller@e605.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/r8a7740.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 34159a8349de..d37d22682a63 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -299,7 +299,7 @@
status = "disabled";
};
 
-   pfc: pfc@e605 {
+   pfc: pin-controller@e605 {
compatible = "renesas,pfc-r8a7740";
reg = <0xe605 0x8000>,
  <0xe605800c 0x20>;
-- 
2.1.4



[PATCH 05/14] ARM: dts: r8a7779: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from fffc.pfc and pfc@fffc to
fffc.pin-controller and pin-controller@fffc.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/r8a7779.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index ae2d9a9c65af..8ee0b2ca5d39 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -286,7 +286,7 @@
status = "disabled";
};
 
-   pfc: pfc@fffc {
+   pfc: pin-controller@fffc {
compatible = "renesas,pfc-r8a7779";
reg = <0xfffc 0x23c>;
};
-- 
2.1.4



[PATCH 04/14] ARM: dts: r8a7778: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from fffc.pfc and pfc@fffc to
fffc.pin-controller and pin-controller@fffc.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/r8a7778.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 1e93c94a9eac..8f3156c0e575 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -142,7 +142,7 @@
interrupt-controller;
};
 
-   pfc: pfc@fffc {
+   pfc: pin-controller@fffc {
compatible = "renesas,pfc-r8a7778";
reg = <0xfffc 0x118>;
};
-- 
2.1.4



[PATCH 02/14] ARM: dts: r8a73a4: update PFC node name to pin-controller

2017-05-22 Thread Simon Horman
The device trees for Renesas SoCs use either pfc or pin-controller as the
node name for the PFC device. This patch is intended to take a step towards
unifying the node name used as pin-controller which appears to be the more
generic of the two and thus more in keeping with the DT specs.

My analysis is that this is a user-visible change to the extent that kernel
logs, and sysfs entries change from e605.pfc and pfc@e605 to
e605.pin-controller and pin-controller@e605.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
---
 arch/arm/boot/dts/r8a73a4.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 1f5c9f6dddba..310222634570 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -219,7 +219,7 @@
power-domains = <&pd_c4>;
};
 
-   pfc: pfc@e605 {
+   pfc: pin-controller@e605 {
compatible = "renesas,pfc-r8a73a4";
reg = <0 0xe605 0 0x9000>;
gpio-controller;
-- 
2.1.4



[PATCH 3/3] ARM: dts: r7s72100: add USB bit definitions

2017-05-22 Thread Simon Horman
From: Chris Brandt 

Add the bit locations that correspond to the USB clocks.

Signed-off-by: Chris Brandt 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 include/dt-bindings/clock/r7s72100-clock.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/r7s72100-clock.h 
b/include/dt-bindings/clock/r7s72100-clock.h
index bc256d31099a..dcd2072151fc 100644
--- a/include/dt-bindings/clock/r7s72100-clock.h
+++ b/include/dt-bindings/clock/r7s72100-clock.h
@@ -34,6 +34,8 @@
 
 /* MSTP7 */
 #define R7S72100_CLK_ETHER 4
+#define R7S72100_CLK_USB0  1
+#define R7S72100_CLK_USB1  0
 
 /* MSTP8 */
 #define R7S72100_CLK_MMCIF 4
-- 
2.1.4



[GIT PULL] Renesas ARM Based SoC DT Bindings Updates for v4.13

2017-05-22 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

Please consider these Renesas ARM based SoC DT bindings updates for v4.13.


The following changes since commit 2ea659a9ef488125eb46da6eb571de5eae5c43f6:

  Linux 4.12-rc1 (2017-05-13 13:19:49 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
tags/renesas-dt-bindings-for-v4.13

for you to fetch changes up to 40c9bbea140e64a4257b794969e759c2c481c399:

  ARM: dts: r7s72100: add USB bit definitions (2017-05-15 09:02:37 +0200)


Renesas ARM Based SoC DT Bindings Updates for v4.13

* Add USB bit definitions and pinctrl header for r7s72100 SoC
* Add GyroADC clock for r8a7791 SoC


Chris Brandt (1):
  ARM: dts: r7s72100: add USB bit definitions

Jacopo Mondi (1):
  ARM: dts: r7s72100: add Renesas RZ/A1 pinctrl header

Marek Vasut (1):
  ARM: dts: r8a7791: add GyroADC clock

 include/dt-bindings/clock/r7s72100-clock.h |  2 ++
 include/dt-bindings/clock/r8a7791-clock.h  |  1 +
 include/dt-bindings/pinctrl/r7s72100-pinctrl.h | 16 
 3 files changed, 19 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/r7s72100-pinctrl.h


Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Laurent Pinchart
Hi Kieran,

On Monday 22 May 2017 13:16:11 Kieran Bingham wrote:
> On 17/05/17 00:20, Laurent Pinchart wrote:
> > For planes handled by a VSP instance, map the framebuffer memory through
> > the VSP to ensure proper IOMMU handling.
> > 
> > Signed-off-by: Laurent Pinchart
> > 
> 
> Looks good except for a small unsigned int comparison causing an infinite
> loop on fail case.
> 
> With the loop fixed:
> 
> Reviewed-by: Kieran Bingham 
> 
> > ---
> > 
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 74 +++---
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 +
> >  2 files changed, 70 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index b0ff304ce3dc..1b874cfd40f3
> > 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c

[snip]


> > @@ -187,6 +186,67 @@ static void rcar_du_vsp_plane_setup(struct
> > rcar_du_vsp_plane *plane)
> > vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
> >  }
> > 
> > +static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
> > +   struct drm_plane_state *state)
> > +{
> > +   struct rcar_du_vsp_plane_state *rstate = 
to_rcar_vsp_plane_state(state);
> > +   struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
> > +   struct rcar_du_device *rcdu = vsp->dev;
> > +   unsigned int i;
> 
> Unsigned here..
> 
> > +   int ret;
> > +
> > +   if (!state->fb)
> > +   return 0;
> > +
> > +   for (i = 0; i < rstate->format->planes; ++i) {
> > +   struct drm_gem_cma_object *gem =
> > +   drm_fb_cma_get_gem_obj(state->fb, i);
> > +   struct sg_table *sgt = &rstate->sg_tables[i];
> > +
> > +   ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr,
> > + gem->base.size);
> > +   if (ret)
> > +   goto fail;
> > +
> > +   ret = vsp1_du_map_sg(vsp->vsp, sgt);
> > +   if (!ret) {
> > +   sg_free_table(sgt);
> > +   ret = -ENOMEM;
> > +   goto fail;
> > +   }
> > +   }
> > +
> > +   return 0;
> > +
> > +fail:
> > +   for (i--; i >= 0; i--) {
> 
> Means that this loop will never exit; i will always be >= 0;
> 
> I'd propose just making signed for this usage.
> 
> I've checked the i values for the breakouts - so they are good, and we need
> to use i == 0 to unmap the last table.
> 
> > +   struct sg_table *sgt = &rstate->sg_tables[i];

How about keep i unsigned and using

for (; i > 0; i--) {
struct sg_table *sgt = &rstate->sg_tables[i-1];
...
}

If you want to fix while applying, you can pick your favourite version.

> > +
> > +   vsp1_du_unmap_sg(vsp->vsp, sgt);
> > +   sg_free_table(sgt);
> > +   }
> > +
> > +   return ret;
> > +}

-- 
Regards,

Laurent Pinchart



Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Kieran Bingham
Hi Laurent,

Thankyou for the patch.

On 17/05/17 00:20, Laurent Pinchart wrote:
> For planes handled by a VSP instance, map the framebuffer memory through
> the VSP to ensure proper IOMMU handling.
> 
> Signed-off-by: Laurent Pinchart 

Looks good except for a small unsigned int comparison causing an infinite loop
on fail case.

With the loop fixed:

Reviewed-by: Kieran Bingham 

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 74 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 +
>  2 files changed, 70 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index b0ff304ce3dc..1b874cfd40f3 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -19,7 +19,9 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
> +#include 
>  #include 
>  
>  #include 
> @@ -170,12 +172,9 @@ static void rcar_du_vsp_plane_setup(struct 
> rcar_du_vsp_plane *plane)
>   cfg.dst.width = state->state.crtc_w;
>   cfg.dst.height = state->state.crtc_h;
>  
> - for (i = 0; i < state->format->planes; ++i) {
> - struct drm_gem_cma_object *gem;
> -
> - gem = drm_fb_cma_get_gem_obj(fb, i);
> - cfg.mem[i] = gem->paddr + fb->offsets[i];
> - }
> + for (i = 0; i < state->format->planes; ++i)
> + cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl)
> ++ fb->offsets[i];
>  
>   for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
>   if (formats_kms[i] == state->format->fourcc) {
> @@ -187,6 +186,67 @@ static void rcar_du_vsp_plane_setup(struct 
> rcar_du_vsp_plane *plane)
>   vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
>  }
>  
> +static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
> + struct drm_plane_state *state)
> +{
> + struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> + struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
> + struct rcar_du_device *rcdu = vsp->dev;
> + unsigned int i;

Unsigned here..

> + int ret;
> +
> + if (!state->fb)
> + return 0;
> +
> + for (i = 0; i < rstate->format->planes; ++i) {
> + struct drm_gem_cma_object *gem =
> + drm_fb_cma_get_gem_obj(state->fb, i);
> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr,
> +   gem->base.size);
> + if (ret)
> + goto fail;
> +
> + ret = vsp1_du_map_sg(vsp->vsp, sgt);
> + if (!ret) {
> + sg_free_table(sgt);
> + ret = -ENOMEM;
> + goto fail;
> + }
> + }
> +
> + return 0;
> +
> +fail:
> + for (i--; i >= 0; i--) {

Means that this loop will never exit; i will always be >= 0;

I'd propose just making signed for this usage.

I've checked the i values for the breakouts - so they are good, and we need to
use i == 0 to unmap the last table.

> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + vsp1_du_unmap_sg(vsp->vsp, sgt);
> + sg_free_table(sgt);
> + }
> +
> + return ret;
> +}
> +
> +static void rcar_du_vsp_plane_cleanup_fb(struct drm_plane *plane,
> +  struct drm_plane_state *state)
> +{
> + struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> + struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
> + unsigned int i;
> +
> + if (!state->fb)
> + return;
> +
> + for (i = 0; i < rstate->format->planes; ++i) {
> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + vsp1_du_unmap_sg(vsp->vsp, sgt);
> + sg_free_table(sgt);
> + }
> +}
> +
>  static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane,
> struct drm_plane_state *state)
>  {
> @@ -227,6 +287,8 @@ static void rcar_du_vsp_plane_atomic_update(struct 
> drm_plane *plane,
>  }
>  
>  static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
> + .prepare_fb = rcar_du_vsp_plane_prepare_fb,
> + .cleanup_fb = rcar_du_vsp_plane_cleanup_fb,
>   .atomic_check = rcar_du_vsp_plane_atomic_check,
>   .atomic_update = rcar_du_vsp_plane_atomic_update,
>  };
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> index f1d0f1824528..8861661590ff 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> @@ -43,6 +43,7 @@ static inline struct rcar_du_vsp_plane 
> *to_rcar_vsp_plane(struct drm_plane *p)
>   * struct rcar_du_vsp_plane_state - Driver-specific plane state
>   * @state: base DRM plane state
>   * 

Re: [PATCH v2 5/5] drm: rcar-du: Map memory through the VSP device

2017-05-22 Thread Kieran Bingham
Hi Laurent,

Thankyou for the patch.

On 17/05/17 00:20, Laurent Pinchart wrote:
> For planes handled by a VSP instance, map the framebuffer memory through
> the VSP to ensure proper IOMMU handling.
> 
> Signed-off-by: Laurent Pinchart 

Looks good except for a small unsigned int comparison causing an infinite loop
on fail case.

With the loop fixed:

Reviewed-by: Kieran Bingham 

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 74 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 +
>  2 files changed, 70 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index b0ff304ce3dc..1b874cfd40f3 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -19,7 +19,9 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
> +#include 
>  #include 
>  
>  #include 
> @@ -170,12 +172,9 @@ static void rcar_du_vsp_plane_setup(struct 
> rcar_du_vsp_plane *plane)
>   cfg.dst.width = state->state.crtc_w;
>   cfg.dst.height = state->state.crtc_h;
>  
> - for (i = 0; i < state->format->planes; ++i) {
> - struct drm_gem_cma_object *gem;
> -
> - gem = drm_fb_cma_get_gem_obj(fb, i);
> - cfg.mem[i] = gem->paddr + fb->offsets[i];
> - }
> + for (i = 0; i < state->format->planes; ++i)
> + cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl)
> ++ fb->offsets[i];
>  
>   for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
>   if (formats_kms[i] == state->format->fourcc) {
> @@ -187,6 +186,67 @@ static void rcar_du_vsp_plane_setup(struct 
> rcar_du_vsp_plane *plane)
>   vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg);
>  }
>  
> +static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
> + struct drm_plane_state *state)
> +{
> + struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> + struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
> + struct rcar_du_device *rcdu = vsp->dev;
> + unsigned int i;

Unsigned here..

> + int ret;
> +
> + if (!state->fb)
> + return 0;
> +
> + for (i = 0; i < rstate->format->planes; ++i) {
> + struct drm_gem_cma_object *gem =
> + drm_fb_cma_get_gem_obj(state->fb, i);
> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr,
> +   gem->base.size);
> + if (ret)
> + goto fail;
> +
> + ret = vsp1_du_map_sg(vsp->vsp, sgt);
> + if (!ret) {
> + sg_free_table(sgt);
> + ret = -ENOMEM;
> + goto fail;
> + }
> + }
> +
> + return 0;
> +
> +fail:
> + for (i--; i >= 0; i--) {

Means that this loop will never exit; i will always be >= 0;

I'd propose just making signed for this usage.

I've checked the i values for the breakouts - so they are good, and we need to
use i == 0 to unmap the last table.

> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + vsp1_du_unmap_sg(vsp->vsp, sgt);
> + sg_free_table(sgt);
> + }
> +
> + return ret;
> +}
> +
> +static void rcar_du_vsp_plane_cleanup_fb(struct drm_plane *plane,
> +  struct drm_plane_state *state)
> +{
> + struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> + struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
> + unsigned int i;
> +
> + if (!state->fb)
> + return;
> +
> + for (i = 0; i < rstate->format->planes; ++i) {
> + struct sg_table *sgt = &rstate->sg_tables[i];
> +
> + vsp1_du_unmap_sg(vsp->vsp, sgt);
> + sg_free_table(sgt);
> + }
> +}
> +
>  static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane,
> struct drm_plane_state *state)
>  {
> @@ -227,6 +287,8 @@ static void rcar_du_vsp_plane_atomic_update(struct 
> drm_plane *plane,
>  }
>  
>  static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
> + .prepare_fb = rcar_du_vsp_plane_prepare_fb,
> + .cleanup_fb = rcar_du_vsp_plane_cleanup_fb,
>   .atomic_check = rcar_du_vsp_plane_atomic_check,
>   .atomic_update = rcar_du_vsp_plane_atomic_update,
>  };
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> index f1d0f1824528..8861661590ff 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> @@ -43,6 +43,7 @@ static inline struct rcar_du_vsp_plane 
> *to_rcar_vsp_plane(struct drm_plane *p)
>   * struct rcar_du_vsp_plane_state - Driver-specific plane state
>   * @state: base DRM plane state
>   * 

Re: [PATCH v2 0/6] tmio/sdhi: add cmd23 support

2017-05-22 Thread Ulf Hansson
On 19 May 2017 at 15:31, Wolfram Sang  wrote:
> This series adds CMD23 support to SDHI. It was tested on H2 (Gen2, Lager) and
> M3W (Gen3, Salvator-X). The test procedure can be found here:
>
> http://elinux.org/Tests:SDHI-CMD23
>
> Patches are based on mmc/next from today. A branch can be found here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
> renesas/topic/sdhi-cmd23
>
> Changes since RFC:
>
> * rebased on top of Simon's DMA rework now in mmc/next
> * added Geerts tags
> * cosmetic change in patch 6, put new capability in a separate line
>
> Thanks,
>
>Wolfram
>
>
> Wolfram Sang (6):
>   mmc: tmio: make tmio_mmc_request function more readable
>   mmc: tmio: refactor handling mrq
>   mmc: tmio: remove outdated comment
>   mmc: tmio: move finish_request function further down
>   mmc: tmio: add CMD23 support
>   mmc: sdhi: add CMD23 support to R-Car Gen2 & Gen3
>
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c |   6 +-
>  drivers/mmc/host/tmio_mmc_core.c | 135 
> ++-
>  2 files changed, 82 insertions(+), 59 deletions(-)


Thanks, applied for next!

Kind regards
Uffe


Re: [PATCH v2 4/5] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP

2017-05-22 Thread Kieran Bingham
Hi Laurent,

On 17/05/17 00:20, Laurent Pinchart wrote:
> The display buffers must be mapped for DMA through the device that
> performs memory access. Expose an API to map and unmap memory through
> the VSP device to be used by the DU.
> 
> As all the buffers allocated by the DU driver are coherent, we can skip
> cache handling when mapping and unmapping them. This will need to be
> revisited when support for non-coherent buffers will be added to the DU
> driver.

Thankyou for the patch

> Signed-off-by: Laurent Pinchart 

With the small nitpick fixed:

Reviewed-by: Kieran Bingham 


> ---
>  drivers/media/platform/vsp1/vsp1_drm.c | 25 +
>  include/media/vsp1.h   |  3 +++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
> b/drivers/media/platform/vsp1/vsp1_drm.c
> index 9d235e830f5a..c809c2aadca0 100644
> --- a/drivers/media/platform/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/vsp1/vsp1_drm.c
> @@ -12,9 +12,11 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  
>  #include 
> +#include 

This header isn't used here.
(Presumably it was before you cached the fcp dev as the vsp1->bus_master).

I'll fix this while applying locally. No need to resend.

>  #include 
>  #include 
>  
> @@ -524,6 +526,29 @@ void vsp1_du_atomic_flush(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
>  
> +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt)
> +{
> + struct vsp1_device *vsp1 = dev_get_drvdata(dev);
> +
> + /*
> +  * As all the buffers allocated by the DU driver are coherent, we can
> +  * skip cache sync. This will need to be revisited when support for
> +  * non-coherent buffers will be added to the DU driver.
> +  */
> + return dma_map_sg_attrs(vsp1->bus_master, sgt->sgl, sgt->nents,
> + DMA_TO_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
> +}
> +EXPORT_SYMBOL_GPL(vsp1_du_map_sg);
> +
> +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt)
> +{
> + struct vsp1_device *vsp1 = dev_get_drvdata(dev);
> +
> + dma_unmap_sg_attrs(vsp1->bus_master, sgt->sgl, sgt->nents,
> +DMA_TO_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
> +}
> +EXPORT_SYMBOL_GPL(vsp1_du_unmap_sg);
> +
>  /* 
> -
>   * Initialization
>   */
> diff --git a/include/media/vsp1.h b/include/media/vsp1.h
> index 38aac554dbba..6aa630c9f7af 100644
> --- a/include/media/vsp1.h
> +++ b/include/media/vsp1.h
> @@ -13,6 +13,7 @@
>  #ifndef __MEDIA_VSP1_H__
>  #define __MEDIA_VSP1_H__
>  
> +#include 
>  #include 
>  #include 
>  
> @@ -46,5 +47,7 @@ void vsp1_du_atomic_begin(struct device *dev);
>  int vsp1_du_atomic_update(struct device *dev, unsigned int rpf,
> const struct vsp1_du_atomic_config *cfg);
>  void vsp1_du_atomic_flush(struct device *dev);
> +int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
> +void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
>  
>  #endif /* __MEDIA_VSP1_H__ */
> 


Re: [PATCH v2 0/6] mmc: renesas-sdhi: refactor DMA support

2017-05-22 Thread Simon Horman
On Fri, May 19, 2017 at 10:30:07AM +0200, Ulf Hansson wrote:
> On 18 May 2017 at 22:14, Wolfram Sang  wrote:
> > On Wed, May 10, 2017 at 11:25:24AM +0200, Simon Horman wrote:
> >> Hi Wolfram, Hi Ulf, Hi Arnd, Hi all,
> >>
> >> the intention of this patch-set is to refactor the DMA support in
> >> the Renesas SDHI driver in order to make it easier to add support
> >> for using the SDHI hardware with different DMA implementations.
> >>
> >> This is based on earlier work, posted as "[PATCH/RFC v3 0/6] mmc:
> >> renesas_sdhi: add R-Car Gen-3 DMA support". It attempts to implement
> >> the reworking of the driver proposed by Arnd[1] in his review of that
> >> patch-set.
> >>
> >> [1] http://www.spinics.net/lists/linux-mmc/msg38004.html
> >>
> >> Unlike that patch-set this patch-set does not add support for
> >> R-Car Gen-3 DMA. Rather it focuses on refactoring the code.
> >>
> >> Changes between RFC and v2:
> >>
> >> * Drop filenames from comment at top of source
> >> * Consistently check for if (host->dma_ops) before using dma_ops.
> >>
> >>
> >> Simon Horman (6):
> >>   mmc: tmio: drop filenames from comment at top of source
> >>   mmc: renesas-sdhi, tmio: make dma more modular
> >>   mmc: tmio: rename tmio_mmc_{pio => core}.c
> >>   mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c
> >>   mmc: renesas-sdhi: rename sh_mobile_sdhi.c => renesas_sdhi_core.c
> >>   mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file
> >
> > Thanks Simon for this series! The file layout looks in deed much better
> > now. And some light testing on my Lager didn't show any regressions. I
> > have only minor comments which do not have anything to do with the code,
> > so already here:
> >
> > Reviewed-by: Wolfram Sang 
> >
> > The comments:
> >
> > * MAINTAINERS file needs updating because of the new filenames
> > * I'd prefer the _GPL variant of EXPORT_SYMBOL unless we have a reason
> >   to not use it?
> > * maybe this is also a good time to update the Renesas copyrights in
> >   file headers?
> > * checkpatch reports some whitespace errors on patch 6. I assume they
> >   were already there in the code you moved around. Still, it might be
> >   a nice occasion to fix those?
> >
> > Thanks again, nice work!
> >
> >Wolfram
> >
> 
> I have applied this for next, assuming Simon addresses Wolfram's
> comments on top.

Thanks a lot! I will follow-up on Wolfram's comments.


Re: [PATCH v2 3/5] v4l: vsp1: Map the DL and video buffers through the proper bus master

2017-05-22 Thread Kieran Bingham
Hi Laurent,

Thanks for the patch:

On 17/05/17 00:20, Laurent Pinchart wrote:
> From: Magnus Damm 
> 
> On Gen2 hardware the VSP1 is a bus master and accesses the display list
> and video buffers through DMA directly. On Gen3 hardware, however,
> memory accesses go through a separate IP core called FCP.
> 
> The VSP1 driver unconditionally maps DMA buffers through the VSP device.
> While this doesn't cause any practical issue so far, DMA mappings will
> be incorrect as soon as we will enable IOMMU support for the FCP on Gen3
> platforms, resulting in IOMMU faults.
> 
> Fix this by mapping all buffers through the FCP device if present, and
> through the VSP1 device as usual otherwise.
> 
> Suggested-by: Magnus Damm 
> [Cache the bus master device]
> Signed-off-by: Laurent Pinchart 


Reviewed-by: Kieran Bingham 


> ---
>  drivers/media/platform/vsp1/vsp1.h   | 1 +
>  drivers/media/platform/vsp1/vsp1_dl.c| 4 ++--
>  drivers/media/platform/vsp1/vsp1_drv.c   | 9 +
>  drivers/media/platform/vsp1/vsp1_video.c | 2 +-
>  4 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1.h 
> b/drivers/media/platform/vsp1/vsp1.h
> index 85387a64179a..847963b6e9eb 100644
> --- a/drivers/media/platform/vsp1/vsp1.h
> +++ b/drivers/media/platform/vsp1/vsp1.h
> @@ -74,6 +74,7 @@ struct vsp1_device {
>  
>   void __iomem *mmio;
>   struct rcar_fcp_device *fcp;
> + struct device *bus_master;
>  
>   struct vsp1_bru *bru;
>   struct vsp1_clu *clu;
> diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
> b/drivers/media/platform/vsp1/vsp1_dl.c
> index 7d8f37772b56..445d1c31fff3 100644
> --- a/drivers/media/platform/vsp1/vsp1_dl.c
> +++ b/drivers/media/platform/vsp1/vsp1_dl.c
> @@ -137,7 +137,7 @@ static int vsp1_dl_body_init(struct vsp1_device *vsp1,
>   dlb->vsp1 = vsp1;
>   dlb->size = size;
>  
> - dlb->entries = dma_alloc_wc(vsp1->dev, dlb->size, &dlb->dma,
> + dlb->entries = dma_alloc_wc(vsp1->bus_master, dlb->size, &dlb->dma,
>   GFP_KERNEL);
>   if (!dlb->entries)
>   return -ENOMEM;
> @@ -150,7 +150,7 @@ static int vsp1_dl_body_init(struct vsp1_device *vsp1,
>   */
>  static void vsp1_dl_body_cleanup(struct vsp1_dl_body *dlb)
>  {
> - dma_free_wc(dlb->vsp1->dev, dlb->size, dlb->entries, dlb->dma);
> + dma_free_wc(dlb->vsp1->bus_master, dlb->size, dlb->entries, dlb->dma);
>  }
>  
>  /**
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
> b/drivers/media/platform/vsp1/vsp1_drv.c
> index 048446af5ae7..95c26edead85 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -764,6 +764,15 @@ static int vsp1_probe(struct platform_device *pdev)
>   PTR_ERR(vsp1->fcp));
>   return PTR_ERR(vsp1->fcp);
>   }
> +
> + /*
> +  * When the FCP is present, it handles all bus master accesses
> +  * for the VSP and must thus be used in place of the VSP device
> +  * to map DMA buffers.
> +  */
> + vsp1->bus_master = rcar_fcp_get_device(vsp1->fcp);
> + } else {
> + vsp1->bus_master = vsp1->dev;
>   }
>  
>   /* Configure device parameters based on the version register. */
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
> b/drivers/media/platform/vsp1/vsp1_video.c
> index eab3c3ea85d7..5af3486afe07 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -1197,7 +1197,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
> *vsp1,
>   video->queue.ops = &vsp1_video_queue_qops;
>   video->queue.mem_ops = &vb2_dma_contig_memops;
>   video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
> - video->queue.dev = video->vsp1->dev;
> + video->queue.dev = video->vsp1->bus_master;
>   ret = vb2_queue_init(&video->queue);
>   if (ret < 0) {
>   dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n");
> 


Re: [PATCH v2 2/5] v4l: rcar-fcp: Add an API to retrieve the FCP device

2017-05-22 Thread Kieran Bingham
Hi Laurent,

Thankyou for the patch:

On 17/05/17 00:20, Laurent Pinchart wrote:
> The new rcar_fcp_get_device() function retrieves the struct device
> related to the FCP device. This is useful to handle DMA mapping through
> the right device.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Kieran Bingham 

> ---
>  drivers/media/platform/rcar-fcp.c | 6 ++
>  include/media/rcar-fcp.h  | 5 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-fcp.c 
> b/drivers/media/platform/rcar-fcp.c
> index e9f609edf513..2988031d285d 100644
> --- a/drivers/media/platform/rcar-fcp.c
> +++ b/drivers/media/platform/rcar-fcp.c
> @@ -78,6 +78,12 @@ void rcar_fcp_put(struct rcar_fcp_device *fcp)
>  }
>  EXPORT_SYMBOL_GPL(rcar_fcp_put);
>  
> +struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
> +{
> + return fcp->dev;
> +}
> +EXPORT_SYMBOL_GPL(rcar_fcp_get_device);
> +
>  /**
>   * rcar_fcp_enable - Enable an FCP
>   * @fcp: The FCP instance
> diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
> index 8723f05c6321..b60a7b176c37 100644
> --- a/include/media/rcar-fcp.h
> +++ b/include/media/rcar-fcp.h
> @@ -19,6 +19,7 @@ struct rcar_fcp_device;
>  #if IS_ENABLED(CONFIG_VIDEO_RENESAS_FCP)
>  struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np);
>  void rcar_fcp_put(struct rcar_fcp_device *fcp);
> +struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp);
>  int rcar_fcp_enable(struct rcar_fcp_device *fcp);
>  void rcar_fcp_disable(struct rcar_fcp_device *fcp);
>  #else
> @@ -27,6 +28,10 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const 
> struct device_node *np)
>   return ERR_PTR(-ENOENT);
>  }
>  static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
> +static inline struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
> +{
> + return NULL;
> +}
>  static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
>  {
>   return 0;
> 


Re: [PATCH v2 1/5] v4l: rcar-fcp: Don't get/put module reference

2017-05-22 Thread Kieran Bingham
Hi Laurent,

Thanks for the patch:

On 17/05/17 00:20, Laurent Pinchart wrote:
> Direct callers of the FCP API hold a reference to the FCP module due to
> module linkage, there's no need to take another one manually. Take a
> reference to the device instead to ensure that it won't disappear behind
> the caller's back.
> 
> Signed-off-by: Laurent Pinchart 

Reviewed-by: Kieran Bingham 

> ---
>  drivers/media/platform/rcar-fcp.c | 11 ++-
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-fcp.c 
> b/drivers/media/platform/rcar-fcp.c
> index 7146fc5ef168..e9f609edf513 100644
> --- a/drivers/media/platform/rcar-fcp.c
> +++ b/drivers/media/platform/rcar-fcp.c
> @@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct 
> device_node *np)
>   if (fcp->dev->of_node != np)
>   continue;
>  
> - /*
> -  * Make sure the module won't be unloaded behind our back. This
> -  * is a poor man's safety net, the module should really not be
> -  * unloaded while FCP users can be active.
> -  */
> - if (!try_module_get(fcp->dev->driver->owner))
> - fcp = NULL;
> -
> + get_device(fcp->dev);
>   goto done;
>   }
>  
> @@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get);
>  void rcar_fcp_put(struct rcar_fcp_device *fcp)
>  {
>   if (fcp)
> - module_put(fcp->dev->driver->owner);
> + put_device(fcp->dev);
>  }
>  EXPORT_SYMBOL_GPL(rcar_fcp_put);
>  
> 


Re: [PATCH v4 5/6] spi: slave: Add SPI slave handler reporting uptime at previous message

2017-05-22 Thread Andy Shevchenko
On Mon, May 22, 2017 at 1:13 PM, Geert Uytterhoeven
 wrote:
> On Thu, May 18, 2017 at 6:01 PM, Andy Shevchenko
>  wrote:
>> On Wed, May 17, 2017 at 3:47 PM, Geert Uytterhoeven
>>  wrote:

>>> +   rem_ns = do_div(ts, 10) / 1000;
>>
>> You divide ts by 10^9, which makes it seconds if it was nanoseconds.
>> But reminder is still in nanoseconds and you divide it by 10^3.
>
>> If I didn't miss anything it should be called like
>> rem_ns -> reminder_ms
>
> Thanks, that must be a remainder from before I reworked the calculation.
> Will change it to rem_us (it's in microseconds, not milliseconds).

Yeah, correct, thanks.

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH v4 5/6] spi: slave: Add SPI slave handler reporting uptime at previous message

2017-05-22 Thread Geert Uytterhoeven
Hi Andy,

On Thu, May 18, 2017 at 6:01 PM, Andy Shevchenko
 wrote:
> On Wed, May 17, 2017 at 3:47 PM, Geert Uytterhoeven
>  wrote:
>> Add an example SPI slave handler responding with the uptime at the time
>> of reception of the last SPI message.
>>
>> This can be used by an external microcontroller as a dead man's switch.
>
>> +static int spi_slave_time_submit(struct spi_slave_time_priv *priv)
>> +{
>> +   u32 rem_ns;
>> +   int ret;
>> +   u64 ts;
>> +
>> +   ts = local_clock();
>> +   rem_ns = do_div(ts, 10) / 1000;
>
> You divide ts by 10^9, which makes it seconds if it was nanoseconds.
>
> But reminder is still in nanoseconds and you divide it by 10^3.

> If I didn't miss anything it should be called like
>
> rem_ns -> reminder_ms

Thanks, that must be a remainder from before I reworked the calculation.

Will change it to rem_us (it's in microseconds, not milliseconds).

>> +   priv->buf[0] = cpu_to_be32(ts);
>> +   priv->buf[1] = cpu_to_be32(rem_ns);
>> +
>> +   spi_message_init_with_transfers(&priv->msg, &priv->xfer, 1);
>> +
>> +   priv->msg.complete = spi_slave_time_complete;
>> +   priv->msg.context = priv;
>> +
>> +   ret = spi_async(priv->spi, &priv->msg);
>> +   if (ret)
>> +   pr_err("%s: spi_async() failed %d\n", __func__, ret);
>
> Perhaps dev_err() ?

OK, and after that the __func__ is no longer needed.

>> +static int spi_slave_time_probe(struct spi_device *spi)
>> +{
>> +   struct spi_slave_time_priv *priv;
>> +   int ret;
>> +
>> +   /*
>> +* bits_per_word cannot be configured in platform data
>> +*/
>> +   spi->bits_per_word = 8;
>
> Is it worth to define it? If so, can we use device properties for that?

No, it can be removed, as 8 is the default.

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: r8a7792: Add SCIF1 pin groups

2017-05-22 Thread Geert Uytterhoeven
Hi Ulrich,

On Fri, May 19, 2017 at 3:07 PM, Ulrich Hecht
 wrote:
> Add SCIF1 pin groups to the R8A7792 PFC driver.
>
> Signed-off-by: Ulrich Hecht 

Thanks for your patch!

> These are the pins the MAX9260 deserializers are connected to on Blanche.

Only RX and TX are connected, not SCK ;-)

> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7792.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7792.c
> @@ -1137,6 +1137,21 @@ static const unsigned int scif0_ctrl_pins[] = {
>  static const unsigned int scif0_ctrl_mux[] = {
> RTS0_N_MARK, CTS0_N_MARK,
>  };
> +/* - SCIF1 
> -- */
> +static const unsigned int scif1_data_pins[] = {
> +   /* RX, TX */
> +   RCAR_GP_PIN(10, 19), RCAR_GP_PIN(10, 18),
> +};
> +static const unsigned int scif1_data_mux[] = {
> +   RX1_MARK, TX1_MARK,
> +};
> +static const unsigned int scif1_clk_pins[] = {
> +   /* SCK */
> +   RCAR_GP_PIN(10, 15),
> +};
> +static const unsigned int scif1_clk_mux[] = {
> +   SCK1_MARK,
> +};

Can you please add scif1_ctrl_pins, too?

BTW, do you mind adding SCIF2? Then we have all SCIF instances covered.

Thanks!

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