Re: [PATCH v11 10/10] media: vsp1: Move video configuration to a cached dlb

2018-05-18 Thread Laurent Pinchart
Hi Kieran,

Thank you for the patch.

On Friday, 18 May 2018 23:42:03 EEST Kieran Bingham wrote:
> From: Kieran Bingham 
> 
> We are now able to configure a pipeline directly into a local display
> list body. Take advantage of this fact, and create a cacheable body to
> store the configuration of the pipeline in the video object.

s/video object/pipeline object/

> 
> vsp1_video_pipeline_run() is now the last user of the pipe->dl object.
> Convert this function to use the cached video->config body and obtain a

s/video->config/pipe->stream_config/

> local display list reference.
> 
> Attach the video->stream_config body to the display list when needed

s/video/pipe/

> before committing to hardware.
> 
> Use a flag 'configured' to know when we should attach our stream_config
> to the next outgoing display list to reconfigure the hardware in the
> event of our first frame, or the first frame following a suspend/resume
> cycle.
> 
> Our video DL usage now looks like the below output:
> 
> dl->body0 contains our disposable runtime configuration. Max 41.
> dl_child->body0 is our partition specific configuration. Max 12.
> dl->bodies shows our constant configuration and LUTs.
> 
>   These two are LUT/CLU:
>  * dl->bodies[x]->num_entries 256 / max 256
>  * dl->bodies[x]->num_entries 4914 / max 4914
> 
> Which shows that our 'constant' configuration cache is currently
> utilised to a maximum of 64 entries.
> 
> trace-cmd report | \
> grep max | sed 's/.*vsp1_dl_list_commit://g' | sort | uniq;
> 
>   dl->body0->num_entries 13 / max 128
>   dl->body0->num_entries 14 / max 128
>   dl->body0->num_entries 16 / max 128
>   dl->body0->num_entries 20 / max 128
>   dl->body0->num_entries 27 / max 128
>   dl->body0->num_entries 34 / max 128
>   dl->body0->num_entries 41 / max 128
>   dl_child->body0->num_entries 10 / max 128
>   dl_child->body0->num_entries 12 / max 128
>   dl->bodies[x]->num_entries 15 / max 128
>   dl->bodies[x]->num_entries 16 / max 128
>   dl->bodies[x]->num_entries 17 / max 128
>   dl->bodies[x]->num_entries 18 / max 128
>   dl->bodies[x]->num_entries 20 / max 128
>   dl->bodies[x]->num_entries 21 / max 128
>   dl->bodies[x]->num_entries 256 / max 256
>   dl->bodies[x]->num_entries 31 / max 128
>   dl->bodies[x]->num_entries 32 / max 128
>   dl->bodies[x]->num_entries 39 / max 128
>   dl->bodies[x]->num_entries 40 / max 128
>   dl->bodies[x]->num_entries 47 / max 128
>   dl->bodies[x]->num_entries 48 / max 128
>   dl->bodies[x]->num_entries 4914 / max 4914
>   dl->bodies[x]->num_entries 55 / max 128
>   dl->bodies[x]->num_entries 56 / max 128
>   dl->bodies[x]->num_entries 63 / max 128
>   dl->bodies[x]->num_entries 64 / max 128
> 
> Signed-off-by: Kieran Bingham 
> ---
> v11:
>  - Remove dlbs pool from video object.
>Utilise the DLM pool for video->stream_config
>  - Improve comments
>  - clear the video->stream_config after it is released
>object.
>  - stream_config and configured flag return to the pipe object.
> 
> v10:
>  - Removed pipe->configured flag, and use
>pipe->state == VSP1_PIPELINE_STOPPED instead.
> 
> v8:
>  - Fix comments
>  - Rename video->pipe_config -> video->stream_config
> 
> v4:
>  - Adjust pipe configured flag to be reset on resume rather than suspend
>  - rename dl_child, dl_next
> 
> v3:
>  - 's/fragment/body/', 's/fragments/bodies/'
>  - video dlb cache allocation increased from 2 to 3 dlbs
> 
>  drivers/media/platform/vsp1/vsp1_dl.c| 10 +++-
>  drivers/media/platform/vsp1/vsp1_dl.h|  1 +-
>  drivers/media/platform/vsp1/vsp1_pipe.h  |  6 +-
>  drivers/media/platform/vsp1/vsp1_video.c | 69 +++--
>  4 files changed, 56 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_dl.c
> b/drivers/media/platform/vsp1/vsp1_dl.c index c7fa1cb088cd..0f97305de965
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_dl.c
> +++ b/drivers/media/platform/vsp1/vsp1_dl.c
> @@ -813,6 +813,11 @@ void vsp1_dlm_reset(struct vsp1_dl_manager *dlm)
>   dlm->pending = NULL;
>  }
> 
> +struct vsp1_dl_body *vsp1_dlm_dl_body_get(struct vsp1_dl_manager *dlm)
> +{
> + return vsp1_dl_body_get(dlm->pool);
> +}
> +
>  struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
>   unsigned int index,
>   unsigned int prealloc)
> @@ -838,13 +843,14 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct
> vsp1_device *vsp1,
>* Initialize the display list body and allocate DMA memory for the body
>* and the optional header. Both are allocated together to avoid memory
>* fragmentation, with the header located right after the body in
> -  * memory.
> +  * memory. An extra body is allocated on top of the prealloc to account
> +  * for the cached body used by the vsp1_video object.

s/vsp1_video/vsp1_pipeline/

Apart from that,

Reviewed-by: 

Re: [PATCH v11 01/10] media: v4l: vsp1: Release buffers for each video node

2018-05-18 Thread Kieran Bingham

On 18/05/18 21:53, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Friday, 18 May 2018 23:41:54 EEST Kieran Bingham wrote:
>> From: Kieran Bingham 
>>
>> Commit 372b2b0399fc ("media: v4l: vsp1: Release buffers in
>> start_streaming error path") introduced a helper to clean up buffers on
>> error paths, but inadvertently changed the code such that only the
>> output WPF buffers were cleaned, rather than the video node being
>> operated on.
>>
>> Since then vsp1_video_cleanup_pipeline() has grown to perform both video
>> node cleanup, as well as pipeline cleanup. Split the implementation into
>> two distinct functions that perform the required work, so that each
>> video node can release it's buffers correctly on streamoff. The pipe
> 
> s/it's/its/
> 
>> cleanup that was performed in the vsp1_video_stop_streaming() (releasing
>> the pipe->dl) is moved to the function for clarity.
>>
>> Fixes: 372b2b0399fc ("media: v4l: vsp1: Release buffers in start_streaming
>> error path")
>> Cc: sta...@vger.kernel.org # v4.13+
> 
> Commit 372b2b0399fc was introduced in v4.14, should this be v4.14+ ?

Yes, thank you - that's me mis-interpreting my own scripts to get the version
for fixes.


>>
>> Signed-off-by: Kieran Bingham 
> 
> Reviewed-by: Laurent Pinchart 
> 
> No need to resubmit for this, I'll fix the commit message when applying.

Great.

--
Kieran

> 
>> ---
>>  drivers/media/platform/vsp1/vsp1_video.c | 21 +
>>  1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
>> b/drivers/media/platform/vsp1/vsp1_video.c index c8c12223a267..ba89dd176a13
>> 100644
>> --- a/drivers/media/platform/vsp1/vsp1_video.c
>> +++ b/drivers/media/platform/vsp1/vsp1_video.c
>> @@ -842,9 +842,8 @@ static int vsp1_video_setup_pipeline(struct
>> vsp1_pipeline *pipe) return 0;
>>  }
>>
>> -static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
>> +static void vsp1_video_release_buffers(struct vsp1_video *video)
>>  {
>> -struct vsp1_video *video = pipe->output->video;
>>  struct vsp1_vb2_buffer *buffer;
>>  unsigned long flags;
>>
>> @@ -854,12 +853,18 @@ static void vsp1_video_cleanup_pipeline(struct
>> vsp1_pipeline *pipe) vb2_buffer_done(>buf.vb2_buf,
>> VB2_BUF_STATE_ERROR);
>>  INIT_LIST_HEAD(>irqqueue);
>>  spin_unlock_irqrestore(>irqlock, flags);
>> +}
>> +
>> +static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
>> +{
>> +lockdep_assert_held(>lock);
>>
>>  /* Release our partition table allocation */
>> -mutex_lock(>lock);
>>  kfree(pipe->part_table);
>>  pipe->part_table = NULL;
>> -mutex_unlock(>lock);
>> +
>> +vsp1_dl_list_put(pipe->dl);
>> +pipe->dl = NULL;
>>  }
>>
>>  static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int
>> count) @@ -874,8 +879,9 @@ static int vsp1_video_start_streaming(struct
>> vb2_queue *vq, unsigned int count) if (pipe->stream_count ==
>> pipe->num_inputs) {
>>  ret = vsp1_video_setup_pipeline(pipe);
>>  if (ret < 0) {
>> -mutex_unlock(>lock);
>> +vsp1_video_release_buffers(video);
>>  vsp1_video_cleanup_pipeline(pipe);
>> +mutex_unlock(>lock);
>>  return ret;
>>  }
>>
>> @@ -925,13 +931,12 @@ static void vsp1_video_stop_streaming(struct vb2_queue
>> *vq) if (ret == -ETIMEDOUT)
>>  dev_err(video->vsp1->dev, "pipeline stop timeout\n");
>>
>> -vsp1_dl_list_put(pipe->dl);
>> -pipe->dl = NULL;
>> +vsp1_video_cleanup_pipeline(pipe);
>>  }
>>  mutex_unlock(>lock);
>>
>>  media_pipeline_stop(>video.entity);
>> -vsp1_video_cleanup_pipeline(pipe);
>> +vsp1_video_release_buffers(video);
>>  vsp1_video_pipeline_put(pipe);
>>  }
> 


Re: [PATCH v11 02/10] media: vsp1: Move video suspend resume handling to video object

2018-05-18 Thread Laurent Pinchart
Hi Kieran,

Thank you for the patch.

On Friday, 18 May 2018 23:41:55 EEST Kieran Bingham wrote:
> From: Kieran Bingham 
> 
> The suspend and resume handlers are only utilised by video pipelines,
> yet the functions currently reside in the vsp1_pipe object.
> 
> This causes an issue with resume, as the functions incorrectly call
> vsp1_pipeline_run() directly instead of processing the video object
> through vsp1_video_pipeline_run().
> 
> Move the functions to the video object, renaming accordingly and update
> the resume handler to call vsp1_video_pipeline_run() as appropriate.
> 
> Signed-off-by: Kieran Bingham 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/platform/vsp1/vsp1_drv.c   |  4 +-
>  drivers/media/platform/vsp1/vsp1_pipe.c  | 70 +---
>  drivers/media/platform/vsp1/vsp1_pipe.h  |  3 +-
>  drivers/media/platform/vsp1/vsp1_video.c | 75 +-
>  drivers/media/platform/vsp1/vsp1_video.h |  3 +-
>  5 files changed, 80 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c
> b/drivers/media/platform/vsp1/vsp1_drv.c index d29f9c4baebe..5d82f6ee56ea
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -589,7 +589,7 @@ static int __maybe_unused vsp1_pm_suspend(struct device
> *dev) * restarted explicitly by the DU.
>*/
>   if (!vsp1->drm)
> - vsp1_pipelines_suspend(vsp1);
> + vsp1_video_suspend(vsp1);
> 
>   pm_runtime_force_suspend(vsp1->dev);
> 
> @@ -607,7 +607,7 @@ static int __maybe_unused vsp1_pm_resume(struct device
> *dev) * restarted explicitly by the DU.
>*/
>   if (!vsp1->drm)
> - vsp1_pipelines_resume(vsp1);
> + vsp1_video_resume(vsp1);
> 
>   return 0;
>  }
> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c
> b/drivers/media/platform/vsp1/vsp1_pipe.c index 6fde4c0b9844..da21f1a7cd75
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_pipe.c
> +++ b/drivers/media/platform/vsp1/vsp1_pipe.c
> @@ -386,73 +386,3 @@ void vsp1_pipeline_propagate_partition(struct
> vsp1_pipeline *pipe, }
>  }
> 
> -void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
> -{
> - unsigned long flags;
> - unsigned int i;
> - int ret;
> -
> - /*
> -  * To avoid increasing the system suspend time needlessly, loop over the
> -  * pipelines twice, first to set them all to the stopping state, and
> -  * then to wait for the stop to complete.
> -  */
> - for (i = 0; i < vsp1->info->wpf_count; ++i) {
> - struct vsp1_rwpf *wpf = vsp1->wpf[i];
> - struct vsp1_pipeline *pipe;
> -
> - if (wpf == NULL)
> - continue;
> -
> - pipe = wpf->entity.pipe;
> - if (pipe == NULL)
> - continue;
> -
> - spin_lock_irqsave(>irqlock, flags);
> - if (pipe->state == VSP1_PIPELINE_RUNNING)
> - pipe->state = VSP1_PIPELINE_STOPPING;
> - spin_unlock_irqrestore(>irqlock, flags);
> - }
> -
> - for (i = 0; i < vsp1->info->wpf_count; ++i) {
> - struct vsp1_rwpf *wpf = vsp1->wpf[i];
> - struct vsp1_pipeline *pipe;
> -
> - if (wpf == NULL)
> - continue;
> -
> - pipe = wpf->entity.pipe;
> - if (pipe == NULL)
> - continue;
> -
> - ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
> -  msecs_to_jiffies(500));
> - if (ret == 0)
> - dev_warn(vsp1->dev, "pipeline %u stop timeout\n",
> -  wpf->entity.index);
> - }
> -}
> -
> -void vsp1_pipelines_resume(struct vsp1_device *vsp1)
> -{
> - unsigned long flags;
> - unsigned int i;
> -
> - /* Resume all running pipelines. */
> - for (i = 0; i < vsp1->info->wpf_count; ++i) {
> - struct vsp1_rwpf *wpf = vsp1->wpf[i];
> - struct vsp1_pipeline *pipe;
> -
> - if (wpf == NULL)
> - continue;
> -
> - pipe = wpf->entity.pipe;
> - if (pipe == NULL)
> - continue;
> -
> - spin_lock_irqsave(>irqlock, flags);
> - if (vsp1_pipeline_ready(pipe))
> - vsp1_pipeline_run(pipe);
> - spin_unlock_irqrestore(>irqlock, flags);
> - }
> -}
> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h
> b/drivers/media/platform/vsp1/vsp1_pipe.h index 663d7fed7929..69858ba6cb31
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_pipe.h
> +++ b/drivers/media/platform/vsp1/vsp1_pipe.h
> @@ -164,9 +164,6 @@ void vsp1_pipeline_propagate_partition(struct
> vsp1_pipeline *pipe, unsigned int index,
>  

Re: [PATCH v11 01/10] media: v4l: vsp1: Release buffers for each video node

2018-05-18 Thread Laurent Pinchart
Hi Kieran,

Thank you for the patch.

On Friday, 18 May 2018 23:41:54 EEST Kieran Bingham wrote:
> From: Kieran Bingham 
> 
> Commit 372b2b0399fc ("media: v4l: vsp1: Release buffers in
> start_streaming error path") introduced a helper to clean up buffers on
> error paths, but inadvertently changed the code such that only the
> output WPF buffers were cleaned, rather than the video node being
> operated on.
> 
> Since then vsp1_video_cleanup_pipeline() has grown to perform both video
> node cleanup, as well as pipeline cleanup. Split the implementation into
> two distinct functions that perform the required work, so that each
> video node can release it's buffers correctly on streamoff. The pipe

s/it's/its/

> cleanup that was performed in the vsp1_video_stop_streaming() (releasing
> the pipe->dl) is moved to the function for clarity.
> 
> Fixes: 372b2b0399fc ("media: v4l: vsp1: Release buffers in start_streaming
> error path")
> Cc: sta...@vger.kernel.org # v4.13+

Commit 372b2b0399fc was introduced in v4.14, should this be v4.14+ ?

> 
> Signed-off-by: Kieran Bingham 

Reviewed-by: Laurent Pinchart 

No need to resubmit for this, I'll fix the commit message when applying.

> ---
>  drivers/media/platform/vsp1/vsp1_video.c | 21 +
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> b/drivers/media/platform/vsp1/vsp1_video.c index c8c12223a267..ba89dd176a13
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -842,9 +842,8 @@ static int vsp1_video_setup_pipeline(struct
> vsp1_pipeline *pipe) return 0;
>  }
> 
> -static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
> +static void vsp1_video_release_buffers(struct vsp1_video *video)
>  {
> - struct vsp1_video *video = pipe->output->video;
>   struct vsp1_vb2_buffer *buffer;
>   unsigned long flags;
> 
> @@ -854,12 +853,18 @@ static void vsp1_video_cleanup_pipeline(struct
> vsp1_pipeline *pipe) vb2_buffer_done(>buf.vb2_buf,
> VB2_BUF_STATE_ERROR);
>   INIT_LIST_HEAD(>irqqueue);
>   spin_unlock_irqrestore(>irqlock, flags);
> +}
> +
> +static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
> +{
> + lockdep_assert_held(>lock);
> 
>   /* Release our partition table allocation */
> - mutex_lock(>lock);
>   kfree(pipe->part_table);
>   pipe->part_table = NULL;
> - mutex_unlock(>lock);
> +
> + vsp1_dl_list_put(pipe->dl);
> + pipe->dl = NULL;
>  }
> 
>  static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int
> count) @@ -874,8 +879,9 @@ static int vsp1_video_start_streaming(struct
> vb2_queue *vq, unsigned int count) if (pipe->stream_count ==
> pipe->num_inputs) {
>   ret = vsp1_video_setup_pipeline(pipe);
>   if (ret < 0) {
> - mutex_unlock(>lock);
> + vsp1_video_release_buffers(video);
>   vsp1_video_cleanup_pipeline(pipe);
> + mutex_unlock(>lock);
>   return ret;
>   }
> 
> @@ -925,13 +931,12 @@ static void vsp1_video_stop_streaming(struct vb2_queue
> *vq) if (ret == -ETIMEDOUT)
>   dev_err(video->vsp1->dev, "pipeline stop timeout\n");
> 
> - vsp1_dl_list_put(pipe->dl);
> - pipe->dl = NULL;
> + vsp1_video_cleanup_pipeline(pipe);
>   }
>   mutex_unlock(>lock);
> 
>   media_pipeline_stop(>video.entity);
> - vsp1_video_cleanup_pipeline(pipe);
> + vsp1_video_release_buffers(video);
>   vsp1_video_pipeline_put(pipe);
>  }

-- 
Regards,

Laurent Pinchart





[PATCH v11 04/10] media: vsp1: Protect bodies against overflow

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

The body write function relies on the code never asking it to write more
than the entries available in the list.

Currently with each list body containing 256 entries, this is fine, but
we can reduce this number greatly saving memory. In preparation of this
add a level of protection to catch any buffer overflows.

Signed-off-by: Kieran Bingham 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_dl.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
index 083da4f05c20..51965c30dec2 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -46,6 +46,7 @@ struct vsp1_dl_entry {
  * @dma: DMA address of the entries
  * @size: size of the DMA memory in bytes
  * @num_entries: number of stored entries
+ * @max_entries: number of entries available
  */
 struct vsp1_dl_body {
struct list_head list;
@@ -56,6 +57,7 @@ struct vsp1_dl_body {
size_t size;
 
unsigned int num_entries;
+   unsigned int max_entries;
 };
 
 /**
@@ -138,6 +140,7 @@ static int vsp1_dl_body_init(struct vsp1_device *vsp1,
 
dlb->vsp1 = vsp1;
dlb->size = size;
+   dlb->max_entries = num_entries;
 
dlb->entries = dma_alloc_wc(vsp1->bus_master, dlb->size, >dma,
GFP_KERNEL);
@@ -219,6 +222,10 @@ void vsp1_dl_body_free(struct vsp1_dl_body *dlb)
  */
 void vsp1_dl_body_write(struct vsp1_dl_body *dlb, u32 reg, u32 data)
 {
+   if (WARN_ONCE(dlb->num_entries >= dlb->max_entries,
+ "DLB size exceeded (max %u)", dlb->max_entries))
+   return;
+
dlb->entries[dlb->num_entries].addr = reg;
dlb->entries[dlb->num_entries].data = data;
dlb->num_entries++;
-- 
git-series 0.9.1


[PATCH v11 05/10] media: vsp1: Provide a body pool

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

Each display list allocates a body to store register values in a dma
accessible buffer from a dma_alloc_wc() allocation. Each of these
results in an entry in the IOMMU TLB, and a large number of display list
allocations adds pressure to this resource.

Reduce TLB pressure on the IPMMUs by allocating multiple display list
bodies in a single allocation, and providing these to the display list
through a 'body pool'. A pool can be allocated by the display list
manager or entities which require their own body allocations.

Signed-off-by: Kieran Bingham 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_dl.c | 163 +++-
 drivers/media/platform/vsp1/vsp1_dl.h |   8 +-
 2 files changed, 171 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
index 51965c30dec2..41ace89a585b 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -41,6 +41,8 @@ struct vsp1_dl_entry {
 /**
  * struct vsp1_dl_body - Display list body
  * @list: entry in the display list list of bodies
+ * @free: entry in the pool free body list
+ * @pool: pool to which this body belongs
  * @vsp1: the VSP1 device
  * @entries: array of entries
  * @dma: DMA address of the entries
@@ -50,6 +52,9 @@ struct vsp1_dl_entry {
  */
 struct vsp1_dl_body {
struct list_head list;
+   struct list_head free;
+
+   struct vsp1_dl_body_pool *pool;
struct vsp1_device *vsp1;
 
struct vsp1_dl_entry *entries;
@@ -61,6 +66,30 @@ struct vsp1_dl_body {
 };
 
 /**
+ * struct vsp1_dl_body_pool - display list body pool
+ * @dma: DMA address of the entries
+ * @size: size of the full DMA memory pool in bytes
+ * @mem: CPU memory pointer for the pool
+ * @bodies: Array of DLB structures for the pool
+ * @free: List of free DLB entries
+ * @lock: Protects the free list
+ * @vsp1: the VSP1 device
+ */
+struct vsp1_dl_body_pool {
+   /* DMA allocation */
+   dma_addr_t dma;
+   size_t size;
+   void *mem;
+
+   /* Body management */
+   struct vsp1_dl_body *bodies;
+   struct list_head free;
+   spinlock_t lock;
+
+   struct vsp1_device *vsp1;
+};
+
+/**
  * struct vsp1_dl_list - Display list
  * @list: entry in the display list manager lists
  * @dlm: the display list manager
@@ -104,6 +133,7 @@ enum vsp1_dl_mode {
  * @active: list currently being processed (loaded) by hardware
  * @queued: list queued to the hardware (written to the DL registers)
  * @pending: list waiting to be queued to the hardware
+ * @pool: body pool for the display list bodies
  * @gc_work: bodies garbage collector work struct
  * @gc_bodies: array of display list bodies waiting to be freed
  */
@@ -119,6 +149,8 @@ struct vsp1_dl_manager {
struct vsp1_dl_list *queued;
struct vsp1_dl_list *pending;
 
+   struct vsp1_dl_body_pool *pool;
+
struct work_struct gc_work;
struct list_head gc_bodies;
 };
@@ -127,6 +159,137 @@ struct vsp1_dl_manager {
  * Display List Body Management
  */
 
+/**
+ * vsp1_dl_body_pool_create - Create a pool of bodies from a single allocation
+ * @vsp1: The VSP1 device
+ * @num_bodies: The number of bodies to allocate
+ * @num_entries: The maximum number of entries that a body can contain
+ * @extra_size: Extra allocation provided for the bodies
+ *
+ * Allocate a pool of display list bodies each with enough memory to contain 
the
+ * requested number of entries plus the @extra_size.
+ *
+ * Return a pointer to a pool on success or NULL if memory can't be allocated.
+ */
+struct vsp1_dl_body_pool *
+vsp1_dl_body_pool_create(struct vsp1_device *vsp1, unsigned int num_bodies,
+unsigned int num_entries, size_t extra_size)
+{
+   struct vsp1_dl_body_pool *pool;
+   size_t dlb_size;
+   unsigned int i;
+
+   pool = kzalloc(sizeof(*pool), GFP_KERNEL);
+   if (!pool)
+   return NULL;
+
+   pool->vsp1 = vsp1;
+
+   /*
+* TODO: 'extra_size' is only used by vsp1_dlm_create(), to allocate
+* extra memory for the display list header. We need only one header per
+* display list, not per display list body, thus this allocation is
+* extraneous and should be reworked in the future.
+*/
+   dlb_size = num_entries * sizeof(struct vsp1_dl_entry) + extra_size;
+   pool->size = dlb_size * num_bodies;
+
+   pool->bodies = kcalloc(num_bodies, sizeof(*pool->bodies), GFP_KERNEL);
+   if (!pool->bodies) {
+   kfree(pool);
+   return NULL;
+   }
+
+   pool->mem = dma_alloc_wc(vsp1->bus_master, pool->size, >dma,
+GFP_KERNEL);
+   if (!pool->mem) {
+   

[PATCH v11 09/10] media: vsp1: Adapt entities to configure into a body

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

Currently the entities store their configurations into a display list.
Adapt this such that the code can be configured into a body directly,
allowing greater flexibility and control of the content.

All users of vsp1_dl_list_write() are removed in this process, thus it
too is removed.

A helper, vsp1_dl_list_get_body0() is provided to access the internal body0
from the display list.

Signed-off-by: Kieran Bingham 
[Don't remove blank line unnecessarily]
Reviewed-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_brx.c| 22 ++--
 drivers/media/platform/vsp1/vsp1_clu.c| 23 ++---
 drivers/media/platform/vsp1/vsp1_dl.c | 12 ++-
 drivers/media/platform/vsp1/vsp1_dl.h |  2 +-
 drivers/media/platform/vsp1/vsp1_drm.c| 12 ---
 drivers/media/platform/vsp1/vsp1_entity.c | 22 ++--
 drivers/media/platform/vsp1/vsp1_entity.h | 18 ++
 drivers/media/platform/vsp1/vsp1_hgo.c| 16 -
 drivers/media/platform/vsp1/vsp1_hgt.c| 18 +-
 drivers/media/platform/vsp1/vsp1_hsit.c   | 10 +++---
 drivers/media/platform/vsp1/vsp1_lif.c| 15 
 drivers/media/platform/vsp1/vsp1_lut.c| 23 ++---
 drivers/media/platform/vsp1/vsp1_pipe.c   |  4 +-
 drivers/media/platform/vsp1/vsp1_pipe.h   |  3 +-
 drivers/media/platform/vsp1/vsp1_rpf.c| 43 
 drivers/media/platform/vsp1/vsp1_sru.c| 14 
 drivers/media/platform/vsp1/vsp1_uds.c| 25 +++---
 drivers/media/platform/vsp1/vsp1_uds.h|  2 +-
 drivers/media/platform/vsp1/vsp1_uif.c| 21 ++--
 drivers/media/platform/vsp1/vsp1_video.c  | 16 ++---
 drivers/media/platform/vsp1/vsp1_wpf.c| 42 ---
 21 files changed, 194 insertions(+), 169 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_brx.c 
b/drivers/media/platform/vsp1/vsp1_brx.c
index 011edac5ebc1..359917b5d842 100644
--- a/drivers/media/platform/vsp1/vsp1_brx.c
+++ b/drivers/media/platform/vsp1/vsp1_brx.c
@@ -26,10 +26,10 @@
  * Device Access
  */
 
-static inline void vsp1_brx_write(struct vsp1_brx *brx, struct vsp1_dl_list 
*dl,
- u32 reg, u32 data)
+static inline void vsp1_brx_write(struct vsp1_brx *brx,
+ struct vsp1_dl_body *dlb, u32 reg, u32 data)
 {
-   vsp1_dl_list_write(dl, brx->base + reg, data);
+   vsp1_dl_body_write(dlb, brx->base + reg, data);
 }
 
 /* 
-
@@ -283,7 +283,7 @@ static const struct v4l2_subdev_ops brx_ops = {
 
 static void brx_configure_stream(struct vsp1_entity *entity,
 struct vsp1_pipeline *pipe,
-struct vsp1_dl_list *dl)
+struct vsp1_dl_body *dlb)
 {
struct vsp1_brx *brx = to_brx(>subdev);
struct v4l2_mbus_framefmt *format;
@@ -305,7 +305,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,
 * format at the pipeline output is premultiplied.
 */
flags = pipe->output ? pipe->output->format.flags : 0;
-   vsp1_brx_write(brx, dl, VI6_BRU_INCTRL,
+   vsp1_brx_write(brx, dlb, VI6_BRU_INCTRL,
   flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
   0 : VI6_BRU_INCTRL_NRM);
 
@@ -313,12 +313,12 @@ static void brx_configure_stream(struct vsp1_entity 
*entity,
 * Set the background position to cover the whole output image and
 * configure its color.
 */
-   vsp1_brx_write(brx, dl, VI6_BRU_VIRRPF_SIZE,
+   vsp1_brx_write(brx, dlb, VI6_BRU_VIRRPF_SIZE,
   (format->width << VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
   (format->height << VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
-   vsp1_brx_write(brx, dl, VI6_BRU_VIRRPF_LOC, 0);
+   vsp1_brx_write(brx, dlb, VI6_BRU_VIRRPF_LOC, 0);
 
-   vsp1_brx_write(brx, dl, VI6_BRU_VIRRPF_COL, brx->bgcolor |
+   vsp1_brx_write(brx, dlb, VI6_BRU_VIRRPF_COL, brx->bgcolor |
   (0xff << VI6_BRU_VIRRPF_COL_A_SHIFT));
 
/*
@@ -328,7 +328,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,
 * unit.
 */
if (entity->type == VSP1_ENTITY_BRU)
-   vsp1_brx_write(brx, dl, VI6_BRU_ROP,
+   vsp1_brx_write(brx, dlb, VI6_BRU_ROP,
   VI6_BRU_ROP_DSTSEL_BRUIN(1) |
   VI6_BRU_ROP_CROP(VI6_ROP_NOP) |
   VI6_BRU_ROP_AROP(VI6_ROP_NOP));
@@ -370,7 +370,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,
if (!(entity->type == VSP1_ENTITY_BRU && i == 1))
ctrl |= 

[PATCH v11 07/10] media: vsp1: Use reference counting for bodies

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

Extend the display list body with a reference count, allowing bodies to
be kept as long as a reference is maintained. This provides the ability
to keep a cached copy of bodies which will not change, so that they can
be re-applied to multiple display lists.

Signed-off-by: Kieran Bingham 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_clu.c |  7 ++-
 drivers/media/platform/vsp1/vsp1_dl.c  | 16 ++--
 drivers/media/platform/vsp1/vsp1_lut.c |  7 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
b/drivers/media/platform/vsp1/vsp1_clu.c
index 8efa12f5e53f..ea83f1b7d125 100644
--- a/drivers/media/platform/vsp1/vsp1_clu.c
+++ b/drivers/media/platform/vsp1/vsp1_clu.c
@@ -212,8 +212,13 @@ static void clu_configure(struct vsp1_entity *entity,
clu->clu = NULL;
spin_unlock_irqrestore(>lock, flags);
 
-   if (dlb)
+   if (dlb) {
vsp1_dl_list_add_body(dl, dlb);
+
+   /* Release our local reference. */
+   vsp1_dl_body_put(dlb);
+   }
+
break;
}
 }
diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
index 617c46a03dec..1407c90c6880 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -54,6 +55,8 @@ struct vsp1_dl_body {
struct list_head list;
struct list_head free;
 
+   refcount_t refcnt;
+
struct vsp1_dl_body_pool *pool;
struct vsp1_device *vsp1;
 
@@ -258,6 +261,7 @@ struct vsp1_dl_body *vsp1_dl_body_get(struct 
vsp1_dl_body_pool *pool)
if (!list_empty(>free)) {
dlb = list_first_entry(>free, struct vsp1_dl_body, free);
list_del(>free);
+   refcount_set(>refcnt, 1);
}
 
spin_unlock_irqrestore(>lock, flags);
@@ -278,6 +282,9 @@ void vsp1_dl_body_put(struct vsp1_dl_body *dlb)
if (!dlb)
return;
 
+   if (!refcount_dec_and_test(>refcnt))
+   return;
+
dlb->num_entries = 0;
 
spin_lock_irqsave(>pool->lock, flags);
@@ -463,8 +470,11 @@ void vsp1_dl_list_write(struct vsp1_dl_list *dl, u32 reg, 
u32 data)
  * which bodies are added.
  *
  * Adding a body to a display list passes ownership of the body to the list. 
The
- * caller must not touch the body after this call, and must not release it
- * explicitly with vsp1_dl_body_put().
+ * caller retains its reference to the fragment when adding it to the display
+ * list, but is not allowed to add new entries to the body.
+ *
+ * The reference must be explicitly released by a call to vsp1_dl_body_put()
+ * when the body isn't needed anymore.
  *
  * Additional bodies are only usable for display lists in header mode.
  * Attempting to add a body to a header-less display list will return an error.
@@ -475,6 +485,8 @@ int vsp1_dl_list_add_body(struct vsp1_dl_list *dl, struct 
vsp1_dl_body *dlb)
if (dl->dlm->mode != VSP1_DL_MODE_HEADER)
return -EINVAL;
 
+   refcount_inc(>refcnt);
+
list_add_tail(>list, >bodies);
 
return 0;
diff --git a/drivers/media/platform/vsp1/vsp1_lut.c 
b/drivers/media/platform/vsp1/vsp1_lut.c
index 6b358617ce15..b3ea90172439 100644
--- a/drivers/media/platform/vsp1/vsp1_lut.c
+++ b/drivers/media/platform/vsp1/vsp1_lut.c
@@ -168,8 +168,13 @@ static void lut_configure(struct vsp1_entity *entity,
lut->lut = NULL;
spin_unlock_irqrestore(>lock, flags);
 
-   if (dlb)
+   if (dlb) {
vsp1_dl_list_add_body(dl, dlb);
+
+   /* Release our local reference. */
+   vsp1_dl_body_put(dlb);
+   }
+
break;
}
 }
-- 
git-series 0.9.1


[PATCH v11 10/10] media: vsp1: Move video configuration to a cached dlb

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

We are now able to configure a pipeline directly into a local display
list body. Take advantage of this fact, and create a cacheable body to
store the configuration of the pipeline in the video object.

vsp1_video_pipeline_run() is now the last user of the pipe->dl object.
Convert this function to use the cached video->config body and obtain a
local display list reference.

Attach the video->stream_config body to the display list when needed
before committing to hardware.

Use a flag 'configured' to know when we should attach our stream_config
to the next outgoing display list to reconfigure the hardware in the
event of our first frame, or the first frame following a suspend/resume
cycle.

Our video DL usage now looks like the below output:

dl->body0 contains our disposable runtime configuration. Max 41.
dl_child->body0 is our partition specific configuration. Max 12.
dl->bodies shows our constant configuration and LUTs.

  These two are LUT/CLU:
 * dl->bodies[x]->num_entries 256 / max 256
 * dl->bodies[x]->num_entries 4914 / max 4914

Which shows that our 'constant' configuration cache is currently
utilised to a maximum of 64 entries.

trace-cmd report | \
grep max | sed 's/.*vsp1_dl_list_commit://g' | sort | uniq;

  dl->body0->num_entries 13 / max 128
  dl->body0->num_entries 14 / max 128
  dl->body0->num_entries 16 / max 128
  dl->body0->num_entries 20 / max 128
  dl->body0->num_entries 27 / max 128
  dl->body0->num_entries 34 / max 128
  dl->body0->num_entries 41 / max 128
  dl_child->body0->num_entries 10 / max 128
  dl_child->body0->num_entries 12 / max 128
  dl->bodies[x]->num_entries 15 / max 128
  dl->bodies[x]->num_entries 16 / max 128
  dl->bodies[x]->num_entries 17 / max 128
  dl->bodies[x]->num_entries 18 / max 128
  dl->bodies[x]->num_entries 20 / max 128
  dl->bodies[x]->num_entries 21 / max 128
  dl->bodies[x]->num_entries 256 / max 256
  dl->bodies[x]->num_entries 31 / max 128
  dl->bodies[x]->num_entries 32 / max 128
  dl->bodies[x]->num_entries 39 / max 128
  dl->bodies[x]->num_entries 40 / max 128
  dl->bodies[x]->num_entries 47 / max 128
  dl->bodies[x]->num_entries 48 / max 128
  dl->bodies[x]->num_entries 4914 / max 4914
  dl->bodies[x]->num_entries 55 / max 128
  dl->bodies[x]->num_entries 56 / max 128
  dl->bodies[x]->num_entries 63 / max 128
  dl->bodies[x]->num_entries 64 / max 128

Signed-off-by: Kieran Bingham 
---
v11:
 - Remove dlbs pool from video object.
   Utilise the DLM pool for video->stream_config
 - Improve comments
 - clear the video->stream_config after it is released
   object.
 - stream_config and configured flag return to the pipe object.

v10:
 - Removed pipe->configured flag, and use
   pipe->state == VSP1_PIPELINE_STOPPED instead.

v8:
 - Fix comments
 - Rename video->pipe_config -> video->stream_config

v4:
 - Adjust pipe configured flag to be reset on resume rather than suspend
 - rename dl_child, dl_next

v3:
 - 's/fragment/body/', 's/fragments/bodies/'
 - video dlb cache allocation increased from 2 to 3 dlbs

 drivers/media/platform/vsp1/vsp1_dl.c| 10 +++-
 drivers/media/platform/vsp1/vsp1_dl.h|  1 +-
 drivers/media/platform/vsp1/vsp1_pipe.h  |  6 +-
 drivers/media/platform/vsp1/vsp1_video.c | 69 +++--
 4 files changed, 56 insertions(+), 30 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
index c7fa1cb088cd..0f97305de965 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -813,6 +813,11 @@ void vsp1_dlm_reset(struct vsp1_dl_manager *dlm)
dlm->pending = NULL;
 }
 
+struct vsp1_dl_body *vsp1_dlm_dl_body_get(struct vsp1_dl_manager *dlm)
+{
+   return vsp1_dl_body_get(dlm->pool);
+}
+
 struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
unsigned int index,
unsigned int prealloc)
@@ -838,13 +843,14 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct 
vsp1_device *vsp1,
 * Initialize the display list body and allocate DMA memory for the body
 * and the optional header. Both are allocated together to avoid memory
 * fragmentation, with the header located right after the body in
-* memory.
+* memory. An extra body is allocated on top of the prealloc to account
+* for the cached body used by the vsp1_video object.
 */
header_size = dlm->mode == VSP1_DL_MODE_HEADER
? ALIGN(sizeof(struct vsp1_dl_header), 8)
: 0;
 
-   dlm->pool = vsp1_dl_body_pool_create(vsp1, prealloc,
+   dlm->pool = vsp1_dl_body_pool_create(vsp1, prealloc + 1,
 VSP1_DL_NUM_ENTRIES, header_size);
if (!dlm->pool)
return NULL;
diff --git 

[PATCH v11 00/10] vsp1: TLB optimisation and DL caching

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

Each display list currently allocates an area of DMA memory to store register
settings for the VSP1 to process. Each of these allocations adds pressure to
the IPMMU TLB entries.

We can reduce the pressure by pre-allocating larger areas and dividing the area
across multiple bodies represented as a pool.

With this reconfiguration of bodies, we can adapt the configuration code to
separate out constant hardware configuration and cache it for re-use.

The patches provided in this series can be found at:
  git://git.kernel.org/pub/scm/linux/kernel/git/kbingham/rcar.git  
tags/vsp1/tlb-optimise/v11

Changelog:
--
v11:
 - Introduce two new patches as fixes to the VSP1.
  * media: v4l: vsp1: Release buffers for each video node
  * media: vsp1: Move video suspend resume handling to video object

 - media: vsp1: Move video configuration to a cached dlb
   - Now uses dlb's from the DLM pool
   - clears the pipe->stream_config after it is released
   - moves stream_config and configured flags to pipe objects.

v10:
 - Rebase to latest linux-media/master
 - Remove pipe->configured flag, as pipe->state is suitable for the
   same purpose, as:
(!pipe->configured) == (pipe->state == VSP1_PIPELINE_STOPPED)

v9:
 - Pass the DL through configure_partition() calls
 - Remove redundant reference to gc_bodies

v8:
 - Fix formatting and white space
 - Reword vsp1_dl_list_add_body() documentation
 - Update commit message on "Provide a body pool"
 - No longer pass unnecessary dlm->pool through vsp1_dl_list_alloc()
 - Add support for the new UIF entity
 - Fix comment location for clu_configure_stream()
 - Implement configure_partition separation
 - Rename video->pipe_config to video->stream_config

v7:
 - Rebased on to linux-media/master (v4.16-rc4)
 - Clean up the formatting of the vsp1_dl_list_add_body()
 - Fix formatting and white space
 -  s/prepare/configure_stream/
 -  s/configure/configure_frame/

v6:
 - Rebased on to linux-media/master (v4.16-rc1)
 - Removed DRM/UIF (DISCOM/ColorKey) updates

v5:
 - Rebased on to renesas-drivers-2018-01-09-v4.15-rc7 to fix conflicts
   with DRM and UIF updates on VSP1 driver

v4:
 - Rebased to v4.14
 * v4l: vsp1: Use reference counting for bodies
   - Fix up reference handling comments

 * v4l: vsp1: Provide a body pool
   - Provide comment explaining extra allocation on body pool
 highlighting area for optimisation later.

 * v4l: vsp1: Refactor display list configure operations
   - Fix up comment to describe yuv_mode caching rather than format

 * vsp1: Adapt entities to configure into a body
   - Rename vsp1_dl_list_get_body() to vsp1_dl_list_get_body0()

 * v4l: vsp1: Move video configuration to a cached dlb
   - Adjust pipe configured flag to be reset on resume rather than suspend
   - rename dl_child, dl_next

Testing:

The VSP unit tests have been run on this patch set with the following results:

root@Ubuntu-ARM64:~/vsp-tests# ./vsp-tests.sh
--- Test loop 1 ---
- vsp-unit-test-.sh
Test Conditions:
  Platform  Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+
  Kernel release4.17.0-rc4-arm64-renesas-00397-g3d2f6f2901b0
  convert   /usr/bin/convert
  compare   /usr/bin/compare
  killall   /usr/bin/killall
  raw2rgbpnm/usr/bin/raw2rgbpnm
  stress/usr/bin/stress
  yavta /usr/bin/yavta
- vsp-unit-test-0001.sh
Testing WPF packing in RGB332: pass
Testing WPF packing in ARGB555: pass
Testing WPF packing in XRGB555: pass
Testing WPF packing in RGB565: pass
Testing WPF packing in BGR24: pass
Testing WPF packing in RGB24: pass
Testing WPF packing in ABGR32: pass
Testing WPF packing in ARGB32: pass
Testing WPF packing in XBGR32: pass
Testing WPF packing in XRGB32: pass
- vsp-unit-test-0002.sh
Testing WPF packing in NV12M: pass
Testing WPF packing in NV16M: pass
Testing WPF packing in NV21M: pass
Testing WPF packing in NV61M: pass
Testing WPF packing in UYVY: pass
Testing WPF packing in VYUY: skip
Testing WPF packing in YUV420M: pass
Testing WPF packing in YUV422M: pass
Testing WPF packing in YUV444M: pass
Testing WPF packing in YVU420M: pass
Testing WPF packing in YVU422M: pass
Testing WPF packing in YVU444M: pass
Testing WPF packing in YUYV: pass
Testing WPF packing in YVYU: pass
- vsp-unit-test-0003.sh
Testing scaling from 640x640 to 640x480 in RGB24: pass
Testing scaling from 1024x768 to 640x480 in RGB24: pass
Testing scaling from 640x480 to 1024x768 in RGB24: pass
Testing scaling from 640x640 to 640x480 in YUV444M: pass
Testing scaling from 1024x768 to 640x480 in YUV444M: pass
Testing scaling from 640x480 to 1024x768 in YUV444M: pass
- vsp-unit-test-0004.sh
Testing histogram in RGB24: pass
Testing histogram in YUV444M: pass
- vsp-unit-test-0005.sh
Testing RPF.0: pass
Testing RPF.1: pass
Testing RPF.2: pass
Testing RPF.3: pass
Testing RPF.4: pass
- vsp-unit-test-0006.sh
Testing invalid pipeline with no RPF: pass
Testing 

[PATCH v11 02/10] media: vsp1: Move video suspend resume handling to video object

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

The suspend and resume handlers are only utilised by video pipelines,
yet the functions currently reside in the vsp1_pipe object.

This causes an issue with resume, as the functions incorrectly call
vsp1_pipeline_run() directly instead of processing the video object
through vsp1_video_pipeline_run().

Move the functions to the video object, renaming accordingly and update
the resume handler to call vsp1_video_pipeline_run() as appropriate.

Signed-off-by: Kieran Bingham 
---
 drivers/media/platform/vsp1/vsp1_drv.c   |  4 +-
 drivers/media/platform/vsp1/vsp1_pipe.c  | 70 +---
 drivers/media/platform/vsp1/vsp1_pipe.h  |  3 +-
 drivers/media/platform/vsp1/vsp1_video.c | 75 +-
 drivers/media/platform/vsp1/vsp1_video.h |  3 +-
 5 files changed, 80 insertions(+), 75 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index d29f9c4baebe..5d82f6ee56ea 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -589,7 +589,7 @@ static int __maybe_unused vsp1_pm_suspend(struct device 
*dev)
 * restarted explicitly by the DU.
 */
if (!vsp1->drm)
-   vsp1_pipelines_suspend(vsp1);
+   vsp1_video_suspend(vsp1);
 
pm_runtime_force_suspend(vsp1->dev);
 
@@ -607,7 +607,7 @@ static int __maybe_unused vsp1_pm_resume(struct device *dev)
 * restarted explicitly by the DU.
 */
if (!vsp1->drm)
-   vsp1_pipelines_resume(vsp1);
+   vsp1_video_resume(vsp1);
 
return 0;
 }
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
index 6fde4c0b9844..da21f1a7cd75 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -386,73 +386,3 @@ void vsp1_pipeline_propagate_partition(struct 
vsp1_pipeline *pipe,
}
 }
 
-void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
-{
-   unsigned long flags;
-   unsigned int i;
-   int ret;
-
-   /*
-* To avoid increasing the system suspend time needlessly, loop over the
-* pipelines twice, first to set them all to the stopping state, and
-* then to wait for the stop to complete.
-*/
-   for (i = 0; i < vsp1->info->wpf_count; ++i) {
-   struct vsp1_rwpf *wpf = vsp1->wpf[i];
-   struct vsp1_pipeline *pipe;
-
-   if (wpf == NULL)
-   continue;
-
-   pipe = wpf->entity.pipe;
-   if (pipe == NULL)
-   continue;
-
-   spin_lock_irqsave(>irqlock, flags);
-   if (pipe->state == VSP1_PIPELINE_RUNNING)
-   pipe->state = VSP1_PIPELINE_STOPPING;
-   spin_unlock_irqrestore(>irqlock, flags);
-   }
-
-   for (i = 0; i < vsp1->info->wpf_count; ++i) {
-   struct vsp1_rwpf *wpf = vsp1->wpf[i];
-   struct vsp1_pipeline *pipe;
-
-   if (wpf == NULL)
-   continue;
-
-   pipe = wpf->entity.pipe;
-   if (pipe == NULL)
-   continue;
-
-   ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
-msecs_to_jiffies(500));
-   if (ret == 0)
-   dev_warn(vsp1->dev, "pipeline %u stop timeout\n",
-wpf->entity.index);
-   }
-}
-
-void vsp1_pipelines_resume(struct vsp1_device *vsp1)
-{
-   unsigned long flags;
-   unsigned int i;
-
-   /* Resume all running pipelines. */
-   for (i = 0; i < vsp1->info->wpf_count; ++i) {
-   struct vsp1_rwpf *wpf = vsp1->wpf[i];
-   struct vsp1_pipeline *pipe;
-
-   if (wpf == NULL)
-   continue;
-
-   pipe = wpf->entity.pipe;
-   if (pipe == NULL)
-   continue;
-
-   spin_lock_irqsave(>irqlock, flags);
-   if (vsp1_pipeline_ready(pipe))
-   vsp1_pipeline_run(pipe);
-   spin_unlock_irqrestore(>irqlock, flags);
-   }
-}
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
b/drivers/media/platform/vsp1/vsp1_pipe.h
index 663d7fed7929..69858ba6cb31 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -164,9 +164,6 @@ void vsp1_pipeline_propagate_partition(struct vsp1_pipeline 
*pipe,
   unsigned int index,
   struct vsp1_partition_window *window);
 
-void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
-void vsp1_pipelines_resume(struct vsp1_device *vsp1);
-
 const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device 

[PATCH v11 01/10] media: v4l: vsp1: Release buffers for each video node

2018-05-18 Thread Kieran Bingham
From: Kieran Bingham 

Commit 372b2b0399fc ("media: v4l: vsp1: Release buffers in
start_streaming error path") introduced a helper to clean up buffers on
error paths, but inadvertently changed the code such that only the
output WPF buffers were cleaned, rather than the video node being
operated on.

Since then vsp1_video_cleanup_pipeline() has grown to perform both video
node cleanup, as well as pipeline cleanup. Split the implementation into
two distinct functions that perform the required work, so that each
video node can release it's buffers correctly on streamoff. The pipe
cleanup that was performed in the vsp1_video_stop_streaming() (releasing
the pipe->dl) is moved to the function for clarity.

Fixes: 372b2b0399fc ("media: v4l: vsp1: Release buffers in start_streaming 
error path")
Cc: sta...@vger.kernel.org # v4.13+

Signed-off-by: Kieran Bingham 
---
 drivers/media/platform/vsp1/vsp1_video.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index c8c12223a267..ba89dd176a13 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -842,9 +842,8 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline 
*pipe)
return 0;
 }
 
-static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
+static void vsp1_video_release_buffers(struct vsp1_video *video)
 {
-   struct vsp1_video *video = pipe->output->video;
struct vsp1_vb2_buffer *buffer;
unsigned long flags;
 
@@ -854,12 +853,18 @@ static void vsp1_video_cleanup_pipeline(struct 
vsp1_pipeline *pipe)
vb2_buffer_done(>buf.vb2_buf, VB2_BUF_STATE_ERROR);
INIT_LIST_HEAD(>irqqueue);
spin_unlock_irqrestore(>irqlock, flags);
+}
+
+static void vsp1_video_cleanup_pipeline(struct vsp1_pipeline *pipe)
+{
+   lockdep_assert_held(>lock);
 
/* Release our partition table allocation */
-   mutex_lock(>lock);
kfree(pipe->part_table);
pipe->part_table = NULL;
-   mutex_unlock(>lock);
+
+   vsp1_dl_list_put(pipe->dl);
+   pipe->dl = NULL;
 }
 
 static int vsp1_video_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -874,8 +879,9 @@ static int vsp1_video_start_streaming(struct vb2_queue *vq, 
unsigned int count)
if (pipe->stream_count == pipe->num_inputs) {
ret = vsp1_video_setup_pipeline(pipe);
if (ret < 0) {
-   mutex_unlock(>lock);
+   vsp1_video_release_buffers(video);
vsp1_video_cleanup_pipeline(pipe);
+   mutex_unlock(>lock);
return ret;
}
 
@@ -925,13 +931,12 @@ static void vsp1_video_stop_streaming(struct vb2_queue 
*vq)
if (ret == -ETIMEDOUT)
dev_err(video->vsp1->dev, "pipeline stop timeout\n");
 
-   vsp1_dl_list_put(pipe->dl);
-   pipe->dl = NULL;
+   vsp1_video_cleanup_pipeline(pipe);
}
mutex_unlock(>lock);
 
media_pipeline_stop(>video.entity);
-   vsp1_video_cleanup_pipeline(pipe);
+   vsp1_video_release_buffers(video);
vsp1_video_pipeline_put(pipe);
 }
 
-- 
git-series 0.9.1


[PATCH 2/2] arm64: dts: renesas: v3hsk: add GEther support

2018-05-18 Thread Sergei Shtylyov
Define the V3H Starter Kit board dependent part of the GEther device node.

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 

---
 arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts |   21 +
 1 file changed, 21 insertions(+)

Index: renesas/arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts
===
--- renesas.orig/arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts
+++ renesas/arch/arm64/boot/dts/renesas/r8a77980-v3hsk.dts
@@ -15,6 +15,7 @@
 
aliases {
serial0 = 
+   ethernet0 = 
};
 
chosen {
@@ -36,7 +37,27 @@
clock-frequency = <32768>;
 };
 
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   phy-mode = "rgmii";
+   phy-handle = <>;
+   renesas,no-ether-link;
+   status = "okay";
+
+   phy0: ethernet-phy@0 {
+   reg = <0>;
+   };
+};
+
  {
+   gether_pins: gether {
+   groups = "gether_mdio_a", "gether_rgmii",
+"gether_txcrefclk", "gether_txcrefclk_mega";
+   function = "gether";
+   };
+
scif0_pins: scif0 {
groups = "scif0_data";
function = "scif0";


[PATCH 1/2] arm64: dts: renesas: r8a77980: add GEther support

2018-05-18 Thread Sergei Shtylyov
Define the generic R8A77980 part of the GEther device node.

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 

---
 arch/arm64/boot/dts/renesas/r8a77980.dtsi |   11 +++
 1 file changed, 11 insertions(+)

Index: renesas/arch/arm64/boot/dts/renesas/r8a77980.dtsi
===
--- renesas.orig/arch/arm64/boot/dts/renesas/r8a77980.dtsi
+++ renesas/arch/arm64/boot/dts/renesas/r8a77980.dtsi
@@ -417,6 +417,17 @@
dma-channels = <16>;
};
 
+   gether: ethernet@e740 {
+   compatible = "renesas,gether-r8a77980";
+   reg = <0 0xe740 0 0x1000>;
+   interrupts = ;
+   clocks = < CPG_MOD 813>;
+   power-domains = < R8A77980_PD_ALWAYS_ON>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "disabled";
+   };
+
mmc0: mmc@ee14 {
compatible = "renesas,sdhi-r8a77980",
 "renesas,rcar-gen3-sdhi";


[PATCH 0/2] Add R8A77980/V3HSK GEther support

2018-05-18 Thread Sergei Shtylyov
Hello!

Here's the set of 2 patches against Simon Horman's 'renesas.git' repo's
'renesas-devel-20180518-v4.17-rc5' tag plus the R8A77980 SMP support patch.
I'm adding the device tree support for mounting the NFS root on the R8A77980-
based V3H Starter Kit board. The 'sh_eth' driver patches adding R8A77980
GEther support patches needed for these 2 patches to work have been posted
and are close to be merged...

[1/2] arm64: dts: renesas: r8a77980: add GEther support
[2/2] arm64: dts: renesas: v3hsk: add GEther support

WBR, Sergei


Re: [PATCH v2 1/1] sh_eth: add RGMII support

2018-05-18 Thread Andrew Lunn
On Fri, May 18, 2018 at 09:30:18PM +0300, Sergei Shtylyov wrote:
> The R-Car V3H (AKA R8A77980) GEther controller  adds support for the RGMII
> PHY interface mode as a new  value  for the RMII_MII register.
> 
> Based on the original (and large) patch by Vladimir Barinov.
> 
> Signed-off-by: Vladimir Barinov 
> Signed-off-by: Sergei Shtylyov 
> 
> ---
> Changes in version 2:
> - included PHY_INTERFACE_MODE_RGMII_{|RX|TX}ID in the RGMII *case*.
> 
>  drivers/net/ethernet/renesas/sh_eth.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> ===
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -466,6 +466,9 @@ static void sh_eth_select_mii(struct net
>   u32 value;
>  
>   switch (mdp->phy_interface) {
> + case PHY_INTERFACE_MODE_RGMII ... PHY_INTERFACE_MODE_RGMII_TXID:
> + value = 0x3;
> + break;

Ah, your don't see that form used very often.
I just checked, clang/llvm should also support it.

Reviewed-by: Andrew Lunn 

Andrew


[PATCH v2 3/3] sh_eth: add R8A77980 support

2018-05-18 Thread Sergei Shtylyov
Finally, add support for the DT probing of the R-Car V3H (AKA R8A77980) --
it's the only R-Car gen3 SoC having the GEther controller -- others have
only EtherAVB...

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 
Reviewed-by: Simon Horman 

---
Changes in version 2:
- added Simon's tag.

 Documentation/devicetree/bindings/net/sh_eth.txt |1 
 drivers/net/ethernet/renesas/sh_eth.c|   44 +++
 2 files changed, 45 insertions(+)

Index: net-next/Documentation/devicetree/bindings/net/sh_eth.txt
===
--- net-next.orig/Documentation/devicetree/bindings/net/sh_eth.txt
+++ net-next/Documentation/devicetree/bindings/net/sh_eth.txt
@@ -14,6 +14,7 @@ Required properties:
  "renesas,ether-r8a7791"  if the device is a part of R8A7791 SoC.
  "renesas,ether-r8a7793"  if the device is a part of R8A7793 SoC.
  "renesas,ether-r8a7794"  if the device is a part of R8A7794 SoC.
+ "renesas,gether-r8a77980" if the device is a part of R8A77980 SoC.
  "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.
  "renesas,rcar-gen1-ether" for a generic R-Car Gen1 device.
  "renesas,rcar-gen2-ether" for a generic R-Car Gen2 or RZ/G1
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -753,6 +753,49 @@ static struct sh_eth_cpu_data rcar_gen2_
.rmiimode   = 1,
.magic  = 1,
 };
+
+/* R8A77980 */
+static struct sh_eth_cpu_data r8a77980_data = {
+   .soft_reset = sh_eth_soft_reset_gether,
+
+   .set_duplex = sh_eth_set_duplex,
+   .set_rate   = sh_eth_set_rate_gether,
+
+   .register_type  = SH_ETH_REG_GIGABIT,
+
+   .edtrr_trns = EDTRR_TRNS_GETHER,
+   .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
+   .ecsipr_value   = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP |
+ ECSIPR_MPDIP,
+   .eesipr_value   = EESIPR_RFCOFIP | EESIPR_ECIIP |
+ EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP |
+ EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP |
+ EESIPR_RMAFIP | EESIPR_RRFIP |
+ EESIPR_RTLFIP | EESIPR_RTSFIP |
+ EESIPR_PREIP | EESIPR_CERFIP,
+
+   .tx_check   = EESR_FTC | EESR_CD | EESR_RTO,
+   .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
+ EESR_RFE | EESR_RDE | EESR_RFRMER |
+ EESR_TFE | EESR_TDE | EESR_ECI,
+   .fdr_value  = 0x070f,
+
+   .apr= 1,
+   .mpr= 1,
+   .tpauser= 1,
+   .bculr  = 1,
+   .hw_swap= 1,
+   .nbst   = 1,
+   .rpadir = 1,
+   .rpadir_value   = 2 << 16,
+   .no_trimd   = 1,
+   .no_ade = 1,
+   .xdfar_rw   = 1,
+   .hw_checksum= 1,
+   .select_mii = 1,
+   .magic  = 1,
+   .cexcr  = 1,
+};
 #endif /* CONFIG_OF */
 
 static void sh_eth_set_rate_sh7724(struct net_device *ndev)
@@ -3134,6 +3177,7 @@ static const struct of_device_id sh_eth_
{ .compatible = "renesas,ether-r8a7791", .data = _gen2_data },
{ .compatible = "renesas,ether-r8a7793", .data = _gen2_data },
{ .compatible = "renesas,ether-r8a7794", .data = _gen2_data },
+   { .compatible = "renesas,gether-r8a77980", .data = _data },
{ .compatible = "renesas,ether-r7s72100", .data = _data },
{ .compatible = "renesas,rcar-gen1-ether", .data = _gen1_data },
{ .compatible = "renesas,rcar-gen2-ether", .data = _gen2_data },


[PATCH v2 2/3] sh_eth: add EDMR.NBST support

2018-05-18 Thread Sergei Shtylyov
The R-Car V3H (AKA R8A77980) GEther controller adds the DMA burst mode bit
(NBST) in EDMR and the manual tells to always set it before doing any DMA.

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 
Reviewed-by: Simon Horman 

---
Changes in version 2:
- added Simon's tag.

 drivers/net/ethernet/renesas/sh_eth.c |4 
 drivers/net/ethernet/renesas/sh_eth.h |2 ++
 2 files changed, 6 insertions(+)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -1434,6 +1434,10 @@ static int sh_eth_dev_init(struct net_de
 
sh_eth_write(ndev, mdp->cd->trscer_err_mask, TRSCER);
 
+   /* DMA transfer burst mode */
+   if (mdp->cd->nbst)
+   sh_eth_modify(ndev, EDMR, EDMR_NBST, EDMR_NBST);
+
if (mdp->cd->bculr)
sh_eth_write(ndev, 0x800, BCULR);   /* Burst sycle set */
 
Index: net-next/drivers/net/ethernet/renesas/sh_eth.h
===
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ net-next/drivers/net/ethernet/renesas/sh_eth.h
@@ -184,6 +184,7 @@ enum GECMR_BIT {
 
 /* EDMR */
 enum DMAC_M_BIT {
+   EDMR_NBST = 0x80,
EDMR_EL = 0x40, /* Litte endian */
EDMR_DL1 = 0x20, EDMR_DL0 = 0x10,
EDMR_SRST_GETHER = 0x03,
@@ -505,6 +506,7 @@ struct sh_eth_cpu_data {
unsigned bculr:1;   /* EtherC have BCULR */
unsigned tsu:1; /* EtherC have TSU */
unsigned hw_swap:1; /* E-DMAC have DE bit in EDMR */
+   unsigned nbst:1;/* E-DMAC has NBST bit in EDMR */
unsigned rpadir:1;  /* E-DMAC have RPADIR */
unsigned no_trimd:1;/* E-DMAC DO NOT have TRIMD */
unsigned no_ade:1;  /* E-DMAC DO NOT have ADE bit in EESR */


[PATCH v2 1/1] sh_eth: add RGMII support

2018-05-18 Thread Sergei Shtylyov
The R-Car V3H (AKA R8A77980) GEther controller  adds support for the RGMII
PHY interface mode as a new  value  for the RMII_MII register.

Based on the original (and large) patch by Vladimir Barinov.

Signed-off-by: Vladimir Barinov 
Signed-off-by: Sergei Shtylyov 

---
Changes in version 2:
- included PHY_INTERFACE_MODE_RGMII_{|RX|TX}ID in the RGMII *case*.

 drivers/net/ethernet/renesas/sh_eth.c |3 +++
 1 file changed, 3 insertions(+)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -466,6 +466,9 @@ static void sh_eth_select_mii(struct net
u32 value;
 
switch (mdp->phy_interface) {
+   case PHY_INTERFACE_MODE_RGMII ... PHY_INTERFACE_MODE_RGMII_TXID:
+   value = 0x3;
+   break;
case PHY_INTERFACE_MODE_GMII:
value = 0x2;
break;


[PATCH v2 0/3] Add Renesas R8A77980 GEther support

2018-05-18 Thread Sergei Shtylyov
Hello!

Here's a set of 3 patches against DaveM's 'net-next.git' repo. They (gradually)
add R8A77980 GEther support to the 'sh_eth' driver, starting with couple new
register bits/values introduced with this chip, and ending with adding a new
'struct sh_eth_cpu_data' instance connected to the new DT "compatible" prop
value...

[1/1] sh_eth: add RGMII support
[2/3] sh_eth: add EDMR.NBST support
[3/3] sh_eth: add R8A77980 support

MBR, Sergei


Re: [PATCH v2] sh_eth: Change platform check to CONFIG_ARCH_RENESAS

2018-05-18 Thread David Miller
From: Geert Uytterhoeven 
Date: Fri, 18 May 2018 12:52:51 +0200

> Since commit 9b5ba0df4ea4f940 ("ARM: shmobile: Introduce ARCH_RENESAS")
> is CONFIG_ARCH_RENESAS a more appropriate platform check than the legacy
> CONFIG_ARCH_SHMOBILE, hence use the former.
> 
> Renesas SuperH SH-Mobile SoCs are still covered by the CONFIG_CPU_SH4
> check.
> 
> This will allow to drop ARCH_SHMOBILE on ARM and ARM64 in the near
> future.
> 
> Signed-off-by: Geert Uytterhoeven 
> Acked-by: Arnd Bergmann 
> Acked-by: Sergei Shtylyov 
> Reviewed-by: Simon Horman 

Applied.


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

2018-05-18 Thread Laurent Pinchart
Hi Jacopo,

Thank you for the patch.

On Friday, 18 May 2018 17:47:58 EEST Jacopo Mondi wrote:
> Describe HDMI input connector and ADV7612 HDMI decoder installed on
> R-Car Gen3 Draak board.
> 
> The video signal routing to the HDMI decoder to the video input interface
> VIN4 is multiplexed with CVBS input path, and enabled/disabled through
> on-board switches SW-49, SW-50, SW-51 and SW-52.
> 
> As the default board switches configuration connects CVBS input to VIN4,
> leave the HDMI decoder unconnected in DTS.
> 
> Signed-off-by: Jacopo Mondi 
> Reviewed-by: Niklas Söderlund 

Reviewed-by: Laurent Pinchart 

> ---
> v2 -> v3:
> - Add comment on HDMI output port about the shared CVBS/HDMI video path
> - Add Niklas' R-b tag
> ---
>  arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 48 +++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts index 95745fc..1e475a4
> 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> @@ -59,6 +59,17 @@
>   };
>   };
> 
> + hdmi-in {
> + compatible = "hdmi-connector";
> + type = "a";
> +
> + port {
> + hdmi_con_in: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> + };
> +
>   memory@4800 {
>   device_type = "memory";
>   /* first 128MB is reserved for secure area. */
> @@ -176,6 +187,43 @@
>   };
>   };
>   };
> +
> + hdmi-decoder@4c {
> + compatible = "adi,adv7612";
> + reg = <0x4c>;
> + default-input = <0>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + adv7612_in: endpoint {
> + remote-endpoint = <_con_in>;
> + };
> + };
> +
> + port@2 {
> + reg = <2>;
> +
> + /*
> +  * The VIN4 video input path is shared between
> +  * CVBS and HDMI inputs through SW[49-54]
> +  * switches.
> +  *
> +  * CVBS is the default selection, leave HDMI
> +  * not connected here.
> +  */
> + adv7612_out: endpoint {
> + pclk-sample = <0>;
> + hsync-active = <0>;
> + vsync-active = <0>;
> + };
> + };
> + };
> + };
>  };
> 
>   {

-- 
Regards,

Laurent Pinchart





Re: [PATCH v3 2/3] arm64: dts: renesas: draak: Describe CVBS input

2018-05-18 Thread Laurent Pinchart
Hi Jacopo,

Thank you for the patch.

On Friday, 18 May 2018 17:47:57 EEST Jacopo Mondi wrote:
> Describe CVBS video input through analog video decoder ADV7180
> connected to video input interface VIN4.
> 
> The video input signal path is shared with HDMI video input, and
> selected by on-board switches SW-53 and SW-54 with CVBS input selected
> by the default switches configuration.
> 
> Signed-off-by: Jacopo Mondi 
> Reviewed-by: Niklas Söderlund 
> 
> ---
> v2 -> v3:
> - Add comment to describe the shared input video path
> - Add my SoB and Niklas' R-b tags
> ---
>  arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 42 +++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts index 9d73de8..95745fc
> 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
> @@ -142,6 +142,11 @@
>   groups = "usb0";
>   function = "usb0";
>   };
> +
> + vin4_pins_cvbs: vin4 {
> + groups = "vin4_data8", "vin4_sync", "vin4_clk";
> + function = "vin4";
> + };
>  };
> 
>   {
> @@ -154,6 +159,23 @@
>   reg = <0x50>;
>   pagesize = <8>;
>   };
> +
> + analog-video@20 {
> + compatible = "adi,adv7180";
> + reg = <0x20>;
> +
> + port {

The adv7180 DT bindings document the output port as 3 or 6 (respectively for 
the CP and ST versions of the chip). You should thus number the port. Apart 
from that the patch looks good.

> + /*
> +  * The VIN4 video input path is shared between
> +  * CVBS and HDMI inputs through SW[49-54] switches.
> +  *
> +  * CVBS is the default selection, link it to VIN4 here.
> +  */
> + adv7180_out: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> + };
>  };
> 
>   {
> @@ -246,3 +268,23 @@
>   timeout-sec = <60>;
>   status = "okay";
>  };
> +
> + {
> + pinctrl-0 = <_pins_cvbs>;
> + pinctrl-names = "default";
> +
> + status = "okay";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + vin4_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
> + };
> +};

-- 
Regards,

Laurent Pinchart





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

2018-05-18 Thread Jacopo Mondi
Add compatible string for R-Car D3 R8A7795 to list of SoCs supported by
rcar-vin driver.

Signed-off-by: Jacopo Mondi 
Acked-by: Niklas Söderlund 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Simon Horman 
---
 Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
 1 file changed, 1 insertion(+)

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

--
2.7.4



[PATCH v3 2/3] arm64: dts: renesas: draak: Describe CVBS input

2018-05-18 Thread Jacopo Mondi
Describe CVBS video input through analog video decoder ADV7180
connected to video input interface VIN4.

The video input signal path is shared with HDMI video input, and
selected by on-board switches SW-53 and SW-54 with CVBS input selected
by the default switches configuration.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Niklas Söderlund 

---
v2 -> v3:
- Add comment to describe the shared input video path
- Add my SoB and Niklas' R-b tags
---
 arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts 
b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
index 9d73de8..95745fc 100644
--- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
@@ -142,6 +142,11 @@
groups = "usb0";
function = "usb0";
};
+
+   vin4_pins_cvbs: vin4 {
+   groups = "vin4_data8", "vin4_sync", "vin4_clk";
+   function = "vin4";
+   };
 };

  {
@@ -154,6 +159,23 @@
reg = <0x50>;
pagesize = <8>;
};
+
+   analog-video@20 {
+   compatible = "adi,adv7180";
+   reg = <0x20>;
+
+   port {
+   /*
+* The VIN4 video input path is shared between
+* CVBS and HDMI inputs through SW[49-54] switches.
+*
+* CVBS is the default selection, link it to VIN4 here.
+*/
+   adv7180_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
 };

  {
@@ -246,3 +268,23 @@
timeout-sec = <60>;
status = "okay";
 };
+
+ {
+   pinctrl-0 = <_pins_cvbs>;
+   pinctrl-names = "default";
+
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   vin4_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+};
--
2.7.4



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

2018-05-18 Thread Jacopo Mondi
Describe HDMI input connector and ADV7612 HDMI decoder installed on
R-Car Gen3 Draak board.

The video signal routing to the HDMI decoder to the video input interface
VIN4 is multiplexed with CVBS input path, and enabled/disabled through
on-board switches SW-49, SW-50, SW-51 and SW-52.

As the default board switches configuration connects CVBS input to VIN4,
leave the HDMI decoder unconnected in DTS.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Niklas Söderlund 

---
v2 -> v3:
- Add comment on HDMI output port about the shared CVBS/HDMI video path
- Add Niklas' R-b tag
---
 arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 48 ++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts 
b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
index 95745fc..1e475a4 100644
--- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
@@ -59,6 +59,17 @@
};
};

+   hdmi-in {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
memory@4800 {
device_type = "memory";
/* first 128MB is reserved for secure area. */
@@ -176,6 +187,43 @@
};
};
};
+
+   hdmi-decoder@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   default-input = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   adv7612_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   /*
+* The VIN4 video input path is shared between
+* CVBS and HDMI inputs through SW[49-54]
+* switches.
+*
+* CVBS is the default selection, leave HDMI
+* not connected here.
+*/
+   adv7612_out: endpoint {
+   pclk-sample = <0>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   };
+   };
+   };
+   };
 };

  {
--
2.7.4



[PATCH v3 0/3] arm64: dts: Draak: Enable video inputs and VIN4

2018-05-18 Thread Jacopo Mondi
Hello,
  this series enables HDMI, CVBS and VIN4 for R8A77995 Draak board.

Compared to v2, I have added review tags and a missing Signed-off-by line.
Two small comments added to Draak DTS to describe the shared video input path
between CVBS and HDMI. As in v2, CVBS is the default video input and thus is
connected to VIN in DTS.

Switching to HDMI is shown in the patch on top of the following branch:
git://jmondi.org/linux d3/media-master/salvator-x-dts_csi2/d3-hdmi

Simon: once the series this one depends on [1] has been accepted, I guess this
one is ready to get in, right?

The series has been developed on top of media-master tree but applies cleanly
on top of latest renesas-driver.

Thanks
   j

[1] [PATCH v3 0/9] rcar-vin: Add support for parallel input on Gen3

v2 -> v3:
- Add comment to CVBS and HDMI inputs
- Add missing Signed-off-by to [2/3]
- Add Niklas' tag

Jacopo Mondi (3):
  dt-bindings: media: rcar-vin: Add R8A77995 support
  arm64: dts: renesas: draak: Describe CVBS input
  arm64: dts: renesas: draak: Describe HDMI input

 .../devicetree/bindings/media/rcar_vin.txt |  1 +
 arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 90 ++
 2 files changed, 91 insertions(+)

--
2.7.4



[PATCH v3 9/9] media: rcar-vin: Add support for R-Car R8A77995 SoC

2018-05-18 Thread Jacopo Mondi
Add R-Car R8A77995 SoC to the rcar-vin supported ones.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Niklas Söderlund 
Reviewed-by: Laurent Pinchart 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index b740f41..0e088d9 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1079,6 +1079,18 @@ static const struct rvin_info rcar_info_r8a77970 = {
.routes = rcar_info_r8a77970_routes,
 };
 
+static const struct rvin_group_route rcar_info_r8a77995_routes[] = {
+   { /* Sentinel */ }
+};
+
+static const struct rvin_info rcar_info_r8a77995 = {
+   .model = RCAR_GEN3,
+   .use_mc = true,
+   .max_width = 4096,
+   .max_height = 4096,
+   .routes = rcar_info_r8a77995_routes,
+};
+
 static const struct of_device_id rvin_of_id_table[] = {
{
.compatible = "renesas,vin-r8a7778",
@@ -1120,6 +1132,10 @@ static const struct of_device_id rvin_of_id_table[] = {
.compatible = "renesas,vin-r8a77970",
.data = _info_r8a77970,
},
+   {
+   .compatible = "renesas,vin-r8a77995",
+   .data = _info_r8a77995,
+   },
{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rvin_of_id_table);
-- 
2.7.4



[PATCH v3 8/9] media: rcar-vin: Rename _rcar_info to rcar_info

2018-05-18 Thread Jacopo Mondi
Remove trailing underscore to align all rcar_group_route structure
declarations.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index dcebb42..b740f41 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1060,7 +1060,7 @@ static const struct rvin_info rcar_info_r8a7796 = {
.routes = rcar_info_r8a7796_routes,
 };
 
-static const struct rvin_group_route _rcar_info_r8a77970_routes[] = {
+static const struct rvin_group_route rcar_info_r8a77970_routes[] = {
{ .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
{ .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
{ .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
@@ -1076,7 +1076,7 @@ static const struct rvin_info rcar_info_r8a77970 = {
.use_mc = true,
.max_width = 4096,
.max_height = 4096,
-   .routes = _rcar_info_r8a77970_routes,
+   .routes = rcar_info_r8a77970_routes,
 };
 
 static const struct of_device_id rvin_of_id_table[] = {
-- 
2.7.4



[PATCH v3 7/9] media: rcar-vin: Handle parallel subdev in link_notify

2018-05-18 Thread Jacopo Mondi
Handle parallel subdevices in link_notify callback. If the notified link
involves a parallel subdevice, do not change routing of the VIN-CSI-2
devices and mark the VIN instance as using a parallel input. If the
CSI-2 link setup succeeds instead, mark the VIN instance as using CSI-2.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 36 +++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index d13bbcf..dcebb42 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -168,10 +168,37 @@ static int rvin_group_link_notify(struct media_link 
*link, u32 flags,
}
 
/* Add the new link to the existing mask and check if it works. */
-   csi_id = rvin_group_entity_to_csi_id(group, link->source->entity);
channel = rvin_group_csi_pad_to_channel(link->source->index);
-   mask_new = mask & rvin_group_get_mask(vin, csi_id, channel);
+   csi_id = rvin_group_entity_to_csi_id(group, link->source->entity);
+   if (csi_id == -ENODEV) {
+   struct v4l2_subdev *sd;
+   unsigned int i;
+
+   /*
+* Make sure the source entity subdevice is registered as
+* a parallel input of one of the enabled VINs if it is not
+* one of the CSI-2 subdevices.
+*
+* No hardware configuration required for parallel inputs,
+* we can return here.
+*/
+   sd = media_entity_to_v4l2_subdev(link->source->entity);
+   for (i = 0; i < RCAR_VIN_NUM; i++) {
+   if (group->vin[i] && group->vin[i]->parallel &&
+   group->vin[i]->parallel->subdev == sd) {
+   group->vin[i]->is_csi = false;
+   ret = 0;
+   goto out;
+   }
+   }
+
+   vin_err(vin, "Subdevice %s not registered to any VIN\n",
+   link->source->entity->name);
+   ret = -ENODEV;
+   goto out;
+   }
 
+   mask_new = mask & rvin_group_get_mask(vin, csi_id, channel);
vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
 
if (!mask_new) {
@@ -181,6 +208,11 @@ static int rvin_group_link_notify(struct media_link *link, 
u32 flags,
 
/* New valid CHSEL found, set the new value. */
ret = rvin_set_channel_routing(group->vin[master_id], __ffs(mask_new));
+   if (ret)
+   goto out;
+
+   vin->is_csi = true;
+
 out:
mutex_unlock(>lock);
 
-- 
2.7.4



[PATCH v3 6/9] media: rcar-vin: Link parallel input media entities

2018-05-18 Thread Jacopo Mondi
When running with media-controller link the parallel input
media entities with the VIN entities at 'complete' callback time.

To create media links the v4l2_device should be registered first.
Check if the device is already registered, to avoid double registrations.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index 745e8ee..d13bbcf 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -478,6 +478,8 @@ static void rvin_parallel_subdevice_detach(struct rvin_dev 
*vin)
 static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
 {
struct rvin_dev *vin = notifier_to_vin(notifier);
+   struct media_entity *source;
+   struct media_entity *sink;
int ret;
 
ret = v4l2_device_register_subdev_nodes(>v4l2_dev);
@@ -486,7 +488,26 @@ static int rvin_parallel_notify_complete(struct 
v4l2_async_notifier *notifier)
return ret;
}
 
-   return rvin_v4l2_register(vin);
+   if (!video_is_registered(>vdev)) {
+   ret = rvin_v4l2_register(vin);
+   if (ret < 0)
+   return ret;
+   }
+
+   if (!vin->info->use_mc)
+   return 0;
+
+   /* If we're running with media-controller, link the subdevs. */
+   source = >parallel->subdev->entity;
+   sink = >vdev.entity;
+
+   ret = media_create_pad_link(source, vin->parallel->source_pad,
+   sink, vin->parallel->sink_pad, 0);
+   if (ret)
+   vin_err(vin, "Error adding link from %s to %s: %d\n",
+   source->name, sink->name, ret);
+
+   return ret;
 }
 
 static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier,
@@ -611,7 +632,8 @@ static int rvin_group_notify_complete(struct 
v4l2_async_notifier *notifier)
 
/* Register all video nodes for the group. */
for (i = 0; i < RCAR_VIN_NUM; i++) {
-   if (vin->group->vin[i]) {
+   if (vin->group->vin[i] &&
+   !video_is_registered(>group->vin[i]->vdev)) {
ret = rvin_v4l2_register(vin->group->vin[i]);
if (ret)
return ret;
-- 
2.7.4



[PATCH v3 4/9] media: rcar-vin: Cache the mbus configuration flags

2018-05-18 Thread Jacopo Mondi
Media bus configuration flags and media bus type were so far a property
of each VIN instance, as the subdevice they were connected to was
immutable during the whole system life time.

With the forth-coming introduction of parallel input devices support,
a VIN instance can have the subdevice it is connected to switched at
runtime, from a CSI-2 subdevice to a parallel one and viceversa, through
the modification of links between media entities in the media controller
graph. To avoid discarding the per-subdevice configuration flags retrieved by
v4l2_fwnode parsing facilities, cache them in the 'rvin_graph_entity'
member of each VIN instance, opportunely renamed to 'rvin_parallel_entity'.

Also modify the register configuration function to take mbus flags into
account when running on a bus type that supports them.

The media bus type currently in use will be updated in a follow-up patch
to the link state change notification function.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 23 ++-
 drivers/media/platform/rcar-vin/rcar-dma.c  | 24 +---
 drivers/media/platform/rcar-vin/rcar-vin.h  | 22 --
 3 files changed, 43 insertions(+), 26 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index c6e603f..0a35a98 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -524,30 +524,30 @@ static int rvin_parallel_parse_v4l2(struct device *dev,
struct v4l2_async_subdev *asd)
 {
struct rvin_dev *vin = dev_get_drvdata(dev);
-   struct rvin_graph_entity *rvge =
-   container_of(asd, struct rvin_graph_entity, asd);
+   struct rvin_parallel_entity *rvpe =
+   container_of(asd, struct rvin_parallel_entity, asd);
 
if (vep->base.port || vep->base.id)
return -ENOTCONN;
 
-   vin->mbus_cfg.type = vep->bus_type;
+   vin->is_csi = false;
+   vin->parallel = rvpe;
+   vin->parallel->mbus_type = vep->bus_type;
 
-   switch (vin->mbus_cfg.type) {
+   switch (vin->parallel->mbus_type) {
case V4L2_MBUS_PARALLEL:
vin_dbg(vin, "Found PARALLEL media bus\n");
-   vin->mbus_cfg.flags = vep->bus.parallel.flags;
+   vin->parallel->mbus_flags = vep->bus.parallel.flags;
break;
case V4L2_MBUS_BT656:
vin_dbg(vin, "Found BT656 media bus\n");
-   vin->mbus_cfg.flags = 0;
+   vin->parallel->mbus_flags = 0;
break;
default:
vin_err(vin, "Unknown media bus type\n");
return -EINVAL;
}
 
-   vin->parallel = rvge;
-
return 0;
 }
 
@@ -557,7 +557,7 @@ static int rvin_parallel_graph_init(struct rvin_dev *vin)
 
ret = v4l2_async_notifier_parse_fwnode_endpoints(
vin->dev, >notifier,
-   sizeof(struct rvin_graph_entity), rvin_parallel_parse_v4l2);
+   sizeof(struct rvin_parallel_entity), rvin_parallel_parse_v4l2);
if (ret)
return ret;
 
@@ -718,6 +718,7 @@ static int rvin_mc_parse_of_endpoint(struct device *dev,
return -ENOTCONN;
}
 
+   vin->is_csi = true;
vin->group->csi[vep->base.id].fwnode = asd->match.fwnode;
 
vin_dbg(vin, "Add group OF device %pOF to slot %u\n",
@@ -783,10 +784,6 @@ static int rvin_mc_init(struct rvin_dev *vin)
 {
int ret;
 
-   /* All our sources are CSI-2 */
-   vin->mbus_cfg.type = V4L2_MBUS_CSI2;
-   vin->mbus_cfg.flags = 0;
-
vin->pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(>vdev.entity, 1, >pad);
if (ret)
diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c 
b/drivers/media/platform/rcar-vin/rcar-dma.c
index f1c3585..17f291f 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -659,8 +659,12 @@ static int rvin_setup(struct rvin_dev *vin)
break;
case MEDIA_BUS_FMT_UYVY8_2X8:
/* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
-   vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ?
-   VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
+   if (!vin->is_csi &&
+   vin->parallel->mbus_type == V4L2_MBUS_BT656)
+   vnmc |= VNMC_INF_YUV8_BT656;
+   else
+   vnmc |= VNMC_INF_YUV8_BT601;
+
input_is_yuv = true;
break;
case MEDIA_BUS_FMT_RGB888_1X24:
@@ -668,8 +672,12 @@ static int rvin_setup(struct rvin_dev *vin)
break;
case MEDIA_BUS_FMT_UYVY10_2X10:
/* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
-   vnmc |= vin->mbus_cfg.type == 

[PATCH v3 5/9] media: rcar-vin: Parse parallel input on Gen3

2018-05-18 Thread Jacopo Mondi
The rcar-vin driver so far had a mutually exclusive code path for
handling parallel and CSI-2 video input subdevices, with only the CSI-2
use case supporting media-controller. As we add support for parallel
inputs to Gen3 media-controller compliant code path now parse both port@0
and port@1, handling the media-controller use case in the parallel
bound/unbind notifier operations and delay notifier registration to the
last probing VIN instance in case we have links to setup between media
entities.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 114 +---
 1 file changed, 85 insertions(+), 29 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index 0a35a98..745e8ee 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -397,6 +397,11 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev 
*vin,
ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK);
vin->parallel->sink_pad = ret < 0 ? 0 : ret;
 
+   vin->parallel->subdev = subdev;
+
+   if (vin->info->use_mc)
+   return 0;
+
/* Find compatible subdevices mbus format */
vin->mbus_code = 0;
code.index = 0;
@@ -422,46 +427,52 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev 
*vin,
if (!vin->mbus_code) {
vin_err(vin, "Unsupported media bus format for %s\n",
subdev->name);
-   return -EINVAL;
+   ret = -EINVAL;
+   goto error_reset_subdev;
}
 
/* Read tvnorms */
ret = v4l2_subdev_call(subdev, video, g_tvnorms, >vdev.tvnorms);
if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
-   return ret;
+   goto error_reset_subdev;
 
/* Read standard */
vin->std = V4L2_STD_UNKNOWN;
ret = v4l2_subdev_call(subdev, video, g_std, >std);
if (ret < 0 && ret != -ENOIOCTLCMD)
-   return ret;
+   goto error_reset_subdev;
 
/* Add the controls */
ret = v4l2_ctrl_handler_init(>ctrl_handler, 16);
if (ret < 0)
-   return ret;
+   goto error_reset_subdev;
 
ret = v4l2_ctrl_add_handler(>ctrl_handler, subdev->ctrl_handler,
NULL);
if (ret < 0) {
v4l2_ctrl_handler_free(>ctrl_handler);
-   return ret;
+   goto error_reset_subdev;
}
 
vin->vdev.ctrl_handler = >ctrl_handler;
 
-   vin->parallel->subdev = subdev;
-
return 0;
+
+error_reset_subdev:
+   vin->parallel->subdev = NULL;
+
+   return ret;
 }
 
 static void rvin_parallel_subdevice_detach(struct rvin_dev *vin)
 {
rvin_v4l2_unregister(vin);
-   v4l2_ctrl_handler_free(>ctrl_handler);
-
-   vin->vdev.ctrl_handler = NULL;
vin->parallel->subdev = NULL;
+
+   if (!vin->info->use_mc) {
+   v4l2_ctrl_handler_free(>ctrl_handler);
+   vin->vdev.ctrl_handler = NULL;
+   }
 }
 
 static int rvin_parallel_notify_complete(struct v4l2_async_notifier *notifier)
@@ -551,22 +562,26 @@ static int rvin_parallel_parse_v4l2(struct device *dev,
return 0;
 }
 
-static int rvin_parallel_graph_init(struct rvin_dev *vin)
+static int rvin_parallel_init(struct rvin_dev *vin)
 {
int ret;
 
-   ret = v4l2_async_notifier_parse_fwnode_endpoints(
-   vin->dev, >notifier,
-   sizeof(struct rvin_parallel_entity), rvin_parallel_parse_v4l2);
+   ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port(
+   vin->dev, >notifier, sizeof(struct rvin_parallel_entity),
+   0, rvin_parallel_parse_v4l2);
if (ret)
return ret;
 
if (!vin->parallel)
-   return -ENODEV;
+   return -ENOTCONN;
 
vin_dbg(vin, "Found parallel subdevice %pOF\n",
to_of_node(vin->parallel->asd.match.fwnode));
 
+   /* If we use media-controller, notifier registration is post-poned. */
+   if (vin->info->use_mc)
+   return 0;
+
vin->notifier.ops = _parallel_notify_ops;
ret = v4l2_async_notifier_register(>v4l2_dev, >notifier);
if (ret < 0) {
@@ -766,6 +781,30 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
 
mutex_unlock(>group->lock);
 
+   /*
+* Go and register all notifiers for parallel subdevs, and
+* the group notifier for CSI-2 subdevs, if any.
+*/
+   for (i = 0; i < RCAR_VIN_NUM; i++) {
+   struct rvin_dev *ivin = vin->group->vin[i];
+   struct v4l2_async_notifier *inotifier;
+
+   if (!ivin)
+   continue;
+
+   inotifier = >notifier;
+   if (!inotifier->num_subdevs)
+   

[PATCH v3 2/9] media: rcar-vin: Remove two empty lines

2018-05-18 Thread Jacopo Mondi
Remove un-necessary empty lines.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/platform/rcar-vin/rcar-core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index 6b80f98..1aadd90 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -707,11 +707,9 @@ static int rvin_mc_parse_of_endpoint(struct device *dev,
return -EINVAL;
 
if (!of_device_is_available(to_of_node(asd->match.fwnode))) {
-
vin_dbg(vin, "OF device %pOF disabled, ignoring\n",
to_of_node(asd->match.fwnode));
return -ENOTCONN;
-
}
 
if (vin->group->csi[vep->base.id].fwnode) {
-- 
2.7.4



[PATCH v3 0/9] rcar-vin: Add support for parallel input on Gen3

2018-05-18 Thread Jacopo Mondi
Hello,
   this series adds support for parallel video input to the Gen3 version of
rcar-vin driver.

Thanks to Niklas' review of v2, this new version allows the same VIN instance
to have both a parallel and a CSI-2 subdevice connected, and to switch
between them at runtime through the modification of links between the media
controller entities in the media-controller graph.

The series starts with a rename s/digital/parallel, as the use of the term
digital was not appropriate and Niklas agreed on the change.

Then a group-wise notifier is created. As detailed in the commit message, to
avoid registering the same notifier twice, for parallel and CSI-2 subdevices,
a shared one is created and used to collect all CSI-2 subdevs for the group.

As we can now switch between CSI-2 and digital subdevs, the media bus
configuration properties have been removed from the VIN device, and cached
in a dedicated structure. They will be taken into account only when a parallel
subdevice is linked to the VIN instance, as suggested by Niklas.

The parallel input parsing has been moved to probe function, and the involved
functions modified to take the media-controller case into account. Again, this
was initially suggested by Niklas, but I failed to do this in v2.

Once the parallel subdevice is collected and bound, at 'complete' time a link
in the media controller has to be created if we're running on an mc-compliant
configuration. This makes the parallel complete function a bit more verbose.

Last step is to properly handle the link state change notification function,
switching between CSI-2 and parallel inputs. This patch is almost the
same as the v2 one, handling of the 'is_csi' flag apart.

At the end of the series, after a small cleanup requested by Niklas, support
for the R8A77995 SoC is added to the driver.

Testing:
As there are no boards I'm aware of with both CSI-2 and digital subdevs
connected to the same VIN instance, I have faked that on a Salvator-x M3-W
board, registering an adv7612 chip connected to VIN5 instance, where also
a CSI20 and CSI40 are routed to. For the interested, the testing branch is
available at:
git://jmondi.org/linux d3/media-master/salvator-x-dts_csi2/digital_input

Image capture from HDMI input works as expected, as well as link switching.
Of course capturing from adv7612 is not tested, as the chip is not actually
there.

On D3, where a single parallel input provided by an adv7612 is connected to
VIN4, image capture from the HDMI port has been tested using a modified version
of vin-tests available at:
git://jmondi.org/vin-tests d3

and an additional patch to Draak device tree to enable HDMI capture, which is
by default disabled in favor of CVBS one:
git://jmondi.org/linux d3/media-master/salvator-x-dts_csi2/d3-hdmi

Image capture from HDMI works as expected with a 640x480 image source.

No changelog as the series is changed quite significantly from v2 and v1 and
is fully described in this cover letter.

Thanks Niklas for the prompt review of v1 and v2, I hope this one is closer
to what is expected to properly support parallel capture on Gen3 boards.

(On a side note, am I wrong or with this series we may easily move all Gen2
devices to run with media-controller without any major modifications?)

Thanks
   j

Jacopo Mondi (9):
  media: rcar-vin: Rename 'digital' to 'parallel'
  media: rcar-vin: Remove two empty lines
  media: rcar-vin: Create a group notifier
  media: rcar-vin: Cache the mbus configuration flags
  media: rcar-vin: Parse parallel input on Gen3
  media: rcar-vin: Link parallel input media entities
  media: rcar-vin: Handle parallel subdev in link_notify
  media: rcar-vin: Rename _rcar_info to rcar_info
  media: rcar-vin: Add support for R-Car R8A77995 SoC

 drivers/media/platform/rcar-vin/rcar-core.c | 318 +++-
 drivers/media/platform/rcar-vin/rcar-dma.c  |  28 ++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c |  12 +-
 drivers/media/platform/rcar-vin/rcar-vin.h  |  31 ++-
 4 files changed, 260 insertions(+), 129 deletions(-)

--
2.7.4



[PATCH 3/5] ARM: shmobile: r8a7791: Remove legacy SMP fallback code

2018-05-18 Thread Geert Uytterhoeven
As of commit f89a51700d7ae0ef ("ARM: shmobile: r8a7791: Prioritize DT
APMU support") in v4.8, non-DT enablement of SMP was left as a fallback
for backwards compatibility with old DTBs.

The time has come to drop backwards compatibility, hence remove the
fallback code.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm/mach-shmobile/Makefile|  1 -
 arch/arm/mach-shmobile/r8a7791.h   |  7 -
 arch/arm/mach-shmobile/setup-r8a7791.c |  2 --
 arch/arm/mach-shmobile/smp-r8a7791.c   | 53 --
 4 files changed, 63 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/r8a7791.h
 delete mode 100644 arch/arm/mach-shmobile/smp-r8a7791.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 13aca853a162ed5d..38086d0d2f5484a1 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -31,7 +31,6 @@ obj-$(CONFIG_ARCH_R8A7793)+= regulator-quirk-rcar-gen2.o
 smp-y  := $(cpu-y)
 smp-$(CONFIG_ARCH_SH73A0)  += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
 smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
-smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o
 smp-$(CONFIG_ARCH_EMEV2)   += smp-emev2.o headsmp-scu.o platsmp-scu.o
 
 # PM objects
diff --git a/arch/arm/mach-shmobile/r8a7791.h b/arch/arm/mach-shmobile/r8a7791.h
deleted file mode 100644
index 8c794aace938a766..
--- a/arch/arm/mach-shmobile/r8a7791.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_R8A7791_H__
-#define __ASM_R8A7791_H__
-
-extern const struct smp_operations r8a7791_smp_ops;
-
-#endif /* __ASM_R8A7791_H__ */
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c 
b/arch/arm/mach-shmobile/setup-r8a7791.c
index 26e2d181a1904da2..2de32fde1af7caae 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -20,7 +20,6 @@
 #include 
 
 #include "common.h"
-#include "r8a7791.h"
 #include "rcar-gen2.h"
 
 static const char *const r8a7791_boards_compat_dt[] __initconst = {
@@ -30,7 +29,6 @@ static const char *const r8a7791_boards_compat_dt[] 
__initconst = {
 
 DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
.smp_init   = smp_init_ops(shmobile_smp_init_fallback_ops),
-   .smp= smp_ops(r8a7791_smp_ops),
.init_early = shmobile_init_delay,
.init_time  = rcar_gen2_timer_init,
.init_late  = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c 
b/arch/arm/mach-shmobile/smp-r8a7791.c
deleted file mode 100644
index 2948c22cfc53026c..
--- a/arch/arm/mach-shmobile/smp-r8a7791.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SMP support for r8a7791
- *
- * Copyright (C) 2013 Renesas Solutions Corp.
- * Copyright (C) 2013 Magnus Damm
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "common.h"
-#include "platsmp-apmu.h"
-#include "r8a7791.h"
-#include "rcar-gen2.h"
-
-static struct rcar_apmu_config r8a7791_apmu_config[] = {
-   {
-   .iomem = DEFINE_RES_MEM(0xe6152000, 0x188),
-   .cpus = { 0, 1 },
-   }
-};
-
-static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
-{
-   /* let APMU code install data related to shmobile_boot_vector */
-   shmobile_smp_apmu_prepare_cpus(max_cpus,
-  r8a7791_apmu_config,
-  ARRAY_SIZE(r8a7791_apmu_config));
-
-   rcar_gen2_pm_init();
-}
-
-const struct smp_operations r8a7791_smp_ops __initconst = {
-   .smp_prepare_cpus   = r8a7791_smp_prepare_cpus,
-   .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
-#ifdef CONFIG_HOTPLUG_CPU
-   .cpu_can_disable= shmobile_smp_cpu_can_disable,
-   .cpu_die= shmobile_smp_apmu_cpu_die,
-   .cpu_kill   = shmobile_smp_apmu_cpu_kill,
-#endif
-};
-- 
2.7.4



[PATCH 0/5] ARM: shmobile: rcar-gen2: Remove legacy SMP fallback code

2018-05-18 Thread Geert Uytterhoeven
Hi Simon, Magnus,

R-Car H2 and M2-W have been supporting SMP enablement from DT using the
"renesas,apmu" enable-method since v4.8.  A legacy fallback was left in
place for backwards compatibility with old DTBs.

This patch series removes the legacy SMP fallbacks for R-Car H2 and
M2-W, and consolidates their support in the common R-Car Gen2 machine
definition.

For testing, this series is available in the
topic/rcar2-legacy-smp-removal-v1 branch of my renesas-drivers git
repository at
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.

Thanks for applying!

Geert Uytterhoeven (5):
  ARM: shmobile: r8a7790: Remove legacy SMP fallback code
  ARM: shmobile: r8a7790: Use common R-Car Gen2 machine definition
  ARM: shmobile: r8a7791: Remove legacy SMP fallback code
  ARM: shmobile: r8a7791: Use common R-Car Gen2 machine definition
  ARM: shmobile: Remove unused shmobile_smp_init_fallback_ops()

 arch/arm/mach-shmobile/Makefile  |  4 --
 arch/arm/mach-shmobile/common.h  |  1 -
 arch/arm/mach-shmobile/platsmp.c |  9 
 arch/arm/mach-shmobile/r8a7790.h |  7 
 arch/arm/mach-shmobile/r8a7791.h |  7 
 arch/arm/mach-shmobile/setup-r8a7790.c   | 38 -
 arch/arm/mach-shmobile/setup-r8a7791.c   | 39 --
 arch/arm/mach-shmobile/setup-rcar-gen2.c |  6 +--
 arch/arm/mach-shmobile/smp-r8a7790.c | 71 
 arch/arm/mach-shmobile/smp-r8a7791.c | 53 
 10 files changed, 2 insertions(+), 233 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/r8a7790.h
 delete mode 100644 arch/arm/mach-shmobile/r8a7791.h
 delete mode 100644 arch/arm/mach-shmobile/setup-r8a7790.c
 delete mode 100644 arch/arm/mach-shmobile/setup-r8a7791.c
 delete mode 100644 arch/arm/mach-shmobile/smp-r8a7790.c
 delete mode 100644 arch/arm/mach-shmobile/smp-r8a7791.c

-- 
2.7.4

Gr{oetje,eeting}s,

Geert

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

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


[PATCH 5/5] ARM: shmobile: Remove unused shmobile_smp_init_fallback_ops()

2018-05-18 Thread Geert Uytterhoeven
shmobile_smp_init_fallback_ops() became unused after removing
SoC-specific machine definitions that provided legacy SMP initialization
fallbacks.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm/mach-shmobile/common.h  | 1 -
 arch/arm/mach-shmobile/platsmp.c | 9 -
 2 files changed, 10 deletions(-)

diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
index 43c1ac6962741757..5d2b1473e11eb612 100644
--- a/arch/arm/mach-shmobile/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -16,7 +16,6 @@ extern void shmobile_smp_sleep(void);
 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
  unsigned long arg);
 extern bool shmobile_smp_cpu_can_disable(unsigned int cpu);
-extern bool shmobile_smp_init_fallback_ops(void);
 extern void shmobile_boot_apmu(void);
 extern void shmobile_boot_scu(void);
 extern void shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 02e21bceb0856bc5..b23378f3d7e1726b 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -36,12 +36,3 @@ bool shmobile_smp_cpu_can_disable(unsigned int cpu)
return true; /* Hotplug of any CPU is supported */
 }
 #endif
-
-bool __init shmobile_smp_init_fallback_ops(void)
-{
-   /* fallback on PSCI/smp_ops if no other DT based method is detected */
-   if (!IS_ENABLED(CONFIG_SMP))
-   return false;
-
-   return platform_can_secondary_boot() ? true : false;
-}
-- 
2.7.4



[PATCH 4/5] ARM: shmobile: r8a7791: Use common R-Car Gen2 machine definition

2018-05-18 Thread Geert Uytterhoeven
Now r8a7791 no longer needs the SMP initialization fallback, it can use
the common R-Car Gen2 machine definition, and the r8a7791-specific one
can be removed.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm/mach-shmobile/Makefile  |  1 -
 arch/arm/mach-shmobile/setup-r8a7791.c   | 37 
 arch/arm/mach-shmobile/setup-rcar-gen2.c |  5 +
 3 files changed, 1 insertion(+), 42 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/setup-r8a7791.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 38086d0d2f5484a1..2b8d3896e1ebbe6a 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_ARCH_R8A73A4)+= setup-r8a73a4.o
 obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
-obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o
 obj-$(CONFIG_ARCH_EMEV2)   += setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)+= setup-r7s72100.o
 
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c 
b/arch/arm/mach-shmobile/setup-r8a7791.c
deleted file mode 100644
index 2de32fde1af7caae..
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * r8a7791 processor support
- *
- * Copyright (C) 2013  Renesas Electronics Corporation
- * Copyright (C) 2013  Renesas Solutions Corp.
- * Copyright (C) 2013  Magnus Damm
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include 
-
-#include 
-
-#include "common.h"
-#include "rcar-gen2.h"
-
-static const char *const r8a7791_boards_compat_dt[] __initconst = {
-   "renesas,r8a7791",
-   NULL,
-};
-
-DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
-   .smp_init   = smp_init_ops(shmobile_smp_init_fallback_ops),
-   .init_early = shmobile_init_delay,
-   .init_time  = rcar_gen2_timer_init,
-   .init_late  = shmobile_init_late,
-   .reserve= rcar_gen2_reserve,
-   .dt_compat  = r8a7791_boards_compat_dt,
-MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c 
b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index a9860f71ba11fba4..5ba1d215d741d92a 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -186,10 +186,7 @@ void __init rcar_gen2_reserve(void)
 
 static const char * const rcar_gen2_boards_compat_dt[] __initconst = {
"renesas,r8a7790",
-   /*
-* R8A7791 can't be handled here as long as it needs SMP
-* initialization fallback.
-*/
+   "renesas,r8a7791",
"renesas,r8a7792",
"renesas,r8a7793",
"renesas,r8a7794",
-- 
2.7.4



[PATCH 1/5] ARM: shmobile: r8a7790: Remove legacy SMP fallback code

2018-05-18 Thread Geert Uytterhoeven
As of commit f5d70b9cee2282ec ("ARM: shmobile: r8a7790: Prioritize DT
APMU support") in v4.8, non-DT enablement of SMP was left as a fallback
for backwards compatibility with old DTBs.

The time has come to drop backwards compatibility, hence remove the
fallback code.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm/mach-shmobile/Makefile|  1 -
 arch/arm/mach-shmobile/r8a7790.h   |  7 
 arch/arm/mach-shmobile/setup-r8a7790.c |  2 -
 arch/arm/mach-shmobile/smp-r8a7790.c   | 71 --
 4 files changed, 81 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/r8a7790.h
 delete mode 100644 arch/arm/mach-shmobile/smp-r8a7790.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 1939f521579c6357..9133949b5df2c824 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_ARCH_R8A7793)+= regulator-quirk-rcar-gen2.o
 smp-y  := $(cpu-y)
 smp-$(CONFIG_ARCH_SH73A0)  += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
 smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
-smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o
 smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o
 smp-$(CONFIG_ARCH_EMEV2)   += smp-emev2.o headsmp-scu.o platsmp-scu.o
 
diff --git a/arch/arm/mach-shmobile/r8a7790.h b/arch/arm/mach-shmobile/r8a7790.h
deleted file mode 100644
index 669c8cd09e076e9b..
--- a/arch/arm/mach-shmobile/r8a7790.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_R8A7790_H__
-#define __ASM_R8A7790_H__
-
-extern const struct smp_operations r8a7790_smp_ops;
-
-#endif /* __ASM_R8A7790_H__ */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c 
b/arch/arm/mach-shmobile/setup-r8a7790.c
index 78d3e859bd64ad7d..fd2435b39529438e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -19,7 +19,6 @@
 #include 
 
 #include "common.h"
-#include "r8a7790.h"
 #include "rcar-gen2.h"
 
 static const char * const r8a7790_boards_compat_dt[] __initconst = {
@@ -29,7 +28,6 @@ static const char * const r8a7790_boards_compat_dt[] 
__initconst = {
 
 DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
.smp_init   = smp_init_ops(shmobile_smp_init_fallback_ops),
-   .smp= smp_ops(r8a7790_smp_ops),
.init_early = shmobile_init_delay,
.init_time  = rcar_gen2_timer_init,
.init_late  = shmobile_init_late,
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c 
b/arch/arm/mach-shmobile/smp-r8a7790.c
deleted file mode 100644
index 28f26d5362d8d4d2..
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SMP support for r8a7790
- *
- * Copyright (C) 2012-2013 Renesas Solutions Corp.
- * Copyright (C) 2012 Takashi Yoshii 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "common.h"
-#include "platsmp-apmu.h"
-#include "rcar-gen2.h"
-#include "r8a7790.h"
-
-static const struct rcar_sysc_ch r8a7790_ca15_scu = {
-   .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
-   .isr_bit = 12, /* CA15-SCU */
-};
-
-static const struct rcar_sysc_ch r8a7790_ca7_scu = {
-   .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
-   .isr_bit = 21, /* CA7-SCU */
-};
-
-static struct rcar_apmu_config r8a7790_apmu_config[] = {
-   {
-   .iomem = DEFINE_RES_MEM(0xe6152000, 0x188),
-   .cpus = { 0, 1, 2, 3 },
-   },
-   {
-   .iomem = DEFINE_RES_MEM(0xe6151000, 0x188),
-   .cpus = { 0x100, 0x0101, 0x102, 0x103 },
-   }
-};
-
-static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
-{
-   /* let APMU code install data related to shmobile_boot_vector */
-   shmobile_smp_apmu_prepare_cpus(max_cpus,
-  r8a7790_apmu_config,
-  ARRAY_SIZE(r8a7790_apmu_config));
-
-   /* turn on power to SCU */
-   rcar_gen2_pm_init();
-   rcar_sysc_power_up(_ca15_scu);
-   rcar_sysc_power_up(_ca7_scu);
-}
-
-const struct smp_operations r8a7790_smp_ops __initconst = {
-   .smp_prepare_cpus   = r8a7790_smp_prepare_cpus,
-   .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
-#ifdef CONFIG_HOTPLUG_CPU
-   .cpu_can_disable= shmobile_smp_cpu_can_disable,
-   

[PATCH 2/5] ARM: shmobile: r8a7790: Use common R-Car Gen2 machine definition

2018-05-18 Thread Geert Uytterhoeven
Now r8a7790 no longer needs the SMP initialization fallback, it can use
the common R-Car Gen2 machine definition, and the r8a7790-specific one
can be removed.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm/mach-shmobile/Makefile  |  1 -
 arch/arm/mach-shmobile/setup-r8a7790.c   | 36 
 arch/arm/mach-shmobile/setup-rcar-gen2.c |  3 ++-
 3 files changed, 2 insertions(+), 38 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/setup-r8a7790.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 9133949b5df2c824..13aca853a162ed5d 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_ARCH_R8A73A4)+= setup-r8a73a4.o
 obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
-obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
 obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o
 obj-$(CONFIG_ARCH_EMEV2)   += setup-emev2.o
 obj-$(CONFIG_ARCH_R7S72100)+= setup-r7s72100.o
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c 
b/arch/arm/mach-shmobile/setup-r8a7790.c
deleted file mode 100644
index fd2435b39529438e..
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * r8a7790 processor support
- *
- * Copyright (C) 2013  Renesas Solutions Corp.
- * Copyright (C) 2013  Magnus Damm
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include 
-
-#include 
-
-#include "common.h"
-#include "rcar-gen2.h"
-
-static const char * const r8a7790_boards_compat_dt[] __initconst = {
-   "renesas,r8a7790",
-   NULL,
-};
-
-DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
-   .smp_init   = smp_init_ops(shmobile_smp_init_fallback_ops),
-   .init_early = shmobile_init_delay,
-   .init_time  = rcar_gen2_timer_init,
-   .init_late  = shmobile_init_late,
-   .reserve= rcar_gen2_reserve,
-   .dt_compat  = r8a7790_boards_compat_dt,
-MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c 
b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 80de6be912e132f7..a9860f71ba11fba4 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -185,8 +185,9 @@ void __init rcar_gen2_reserve(void)
 }
 
 static const char * const rcar_gen2_boards_compat_dt[] __initconst = {
+   "renesas,r8a7790",
/*
-* R8A7790 and R8A7791 can't be handled here as long as they need SMP
+* R8A7791 can't be handled here as long as it needs SMP
 * initialization fallback.
 */
"renesas,r8a7792",
-- 
2.7.4



Re: [PATCH 0/2] Remove calls to empty arch_setup_pdev_archdata()

2018-05-18 Thread jacopo mondi
Hi Geert,

On Fri, May 18, 2018 at 01:06:49PM +0200, Geert Uytterhoeven wrote:
>   Hi,
>
> Recently, a few calls to arch_setup_pdev_archdata() were added to the
> ecovec and migor board files (copied from platform_device_register())?

I suspect that was me

>
> However, SuperH doesn't implement arch_setup_pdev_archdata(), and falls
> back to the default (empty) implementation.  As this code is
> board-specific, the calls can just be removed.

Thanks for looking into that.

Acked-by: Jacopo Mondi 

Thanks
   j

>
> Thanks!
>
> Geert Uytterhoeven (2):
>   sh: ecovec: Remove calls to empty arch_setup_pdev_archdata()
>   sh: migor: Remove calls to empty arch_setup_pdev_archdata()
>
>  arch/sh/boards/mach-ecovec24/setup.c | 2 --
>  arch/sh/boards/mach-migor/setup.c| 1 -
>  2 files changed, 3 deletions(-)
>
> --
> 2.7.4
>
> 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


signature.asc
Description: PGP signature


[PATCH 14/14] soc: renesas: r8a77990-sysc: Add workaround for 3DG-{A,B}

2018-05-18 Thread Simon Horman
From: Yoshihiro Shimoda 

This patch adds workaround for 3DG-{A,B} of R-Car E3 ES1.0 because
the SoC has a restriction about the order.

Signed-off-by: Yoshihiro Shimoda 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 drivers/soc/renesas/r8a77990-sysc.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/renesas/r8a77990-sysc.c 
b/drivers/soc/renesas/r8a77990-sysc.c
index a8c6417fcd2b..15579ebc5ed2 100644
--- a/drivers/soc/renesas/r8a77990-sysc.c
+++ b/drivers/soc/renesas/r8a77990-sysc.c
@@ -7,12 +7,13 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
 #include "rcar-sysc.h"
 
-static const struct rcar_sysc_area r8a77990_areas[] __initconst = {
+static struct rcar_sysc_area r8a77990_areas[] __initdata = {
{ "always-on",  0, 0, R8A77990_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
{ "ca53-scu",   0x140, 0, R8A77990_PD_CA53_SCU,  R8A77990_PD_ALWAYS_ON,
  PD_SCU },
@@ -27,7 +28,41 @@ static const struct rcar_sysc_area r8a77990_areas[] 
__initconst = {
{ "3dg-b",  0x100, 1, R8A77990_PD_3DG_B,R8A77990_PD_3DG_A },
 };
 
+static void __init rcar_sysc_fix_parent(struct rcar_sysc_area *areas,
+   unsigned int num_areas, u8 id,
+   int new_parent)
+{
+   unsigned int i;
+
+   for (i = 0; i < num_areas; i++)
+   if (areas[i].isr_bit == id) {
+   areas[i].parent = new_parent;
+   return;
+   }
+}
+
+/* Fixups for R-Car E3 ES1.0 revision */
+static const struct soc_device_attribute r8a77990[] __initconst = {
+   { .soc_id = "r8a77990", .revision = "ES1.0" },
+   { /* sentinel */ }
+};
+
+static int __init r8a77990_sysc_init(void)
+{
+   if (soc_device_match(r8a77990)) {
+   rcar_sysc_fix_parent(r8a77990_areas,
+ARRAY_SIZE(r8a77990_areas),
+R8A77990_PD_3DG_A, R8A77990_PD_3DG_B);
+   rcar_sysc_fix_parent(r8a77990_areas,
+ARRAY_SIZE(r8a77990_areas),
+R8A77990_PD_3DG_B, R8A77990_PD_ALWAYS_ON);
+   }
+
+   return 0;
+}
+
 const struct rcar_sysc_info r8a77990_sysc_info __initconst = {
+   .init = r8a77990_sysc_init,
.areas = r8a77990_areas,
.num_areas = ARRAY_SIZE(r8a77990_areas),
 };
-- 
2.11.0



[PATCH 11/14] arm: shmobile: Change platform dependency to ARCH_RENESAS

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Since commit 9b5ba0df4ea4f940 ("ARM: shmobile: Introduce ARCH_RENESAS")
ARCH_RENESAS is a more appropriate platform dependency than the legacy
ARCH_SHMOBILE, hence use the former.

This will allow to drop ARCH_SHMOBILE on ARM in the near future.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/Kconfig  | 2 +-
 arch/arm/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a7f8e7f4b88f..2d34c0a44877 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1467,7 +1467,7 @@ config ARM_PSCI
 config ARCH_NR_GPIO
int
default 2048 if ARCH_SOCFPGA
-   default 1024 if ARCH_BRCMSTB || ARCH_SHMOBILE || ARCH_TEGRA || \
+   default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
ARCH_ZYNQ
default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e4e537f27339..a92f5a876d96 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -212,7 +212,7 @@ machine-$(CONFIG_ARCH_S3C24XX)  += s3c24xx
 machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
 machine-$(CONFIG_ARCH_S5PV210) += s5pv210
 machine-$(CONFIG_ARCH_SA1100)  += sa1100
-machine-$(CONFIG_ARCH_SHMOBILE)+= shmobile
+machine-$(CONFIG_ARCH_RENESAS) += shmobile
 machine-$(CONFIG_ARCH_SIRF)+= prima2
 machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
 machine-$(CONFIG_ARCH_STI) += sti
-- 
2.11.0



[PATCH 13/14] soc: renesas: rcar-sysc: Add support for R-Car E3 power areas

2018-05-18 Thread Simon Horman
From: Takeshi Kihara 

This patch adds Cortex-A53 CPU{0,1}, Cortex-A53 SCU, Cortex-R7, A3VC,
A2VC1 and 3DG-{A,B} power domain areas for the R8A77990 SoC.

Signed-off-by: Takeshi Kihara 
[shimoda: fix 3DG-{A,B} and add SPDX-License-Identifier]
Signed-off-by: Yoshihiro Shimoda 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 .../bindings/power/renesas,rcar-sysc.txt   |  1 +
 drivers/soc/renesas/Kconfig|  5 
 drivers/soc/renesas/Makefile   |  1 +
 drivers/soc/renesas/r8a77990-sysc.c| 33 ++
 drivers/soc/renesas/rcar-sysc.c|  3 ++
 drivers/soc/renesas/rcar-sysc.h|  1 +
 6 files changed, 44 insertions(+)
 create mode 100644 drivers/soc/renesas/r8a77990-sysc.c

diff --git a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt 
b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
index 3e91d2032253..180ae65be753 100644
--- a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
+++ b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
@@ -21,6 +21,7 @@ Required properties:
   - "renesas,r8a77965-sysc" (R-Car M3-N)
   - "renesas,r8a77970-sysc" (R-Car V3M)
   - "renesas,r8a77980-sysc" (R-Car V3H)
+  - "renesas,r8a77990-sysc" (R-Car E3)
   - "renesas,r8a77995-sysc" (R-Car D3)
   - reg: Address start and address range for the device.
   - #power-domain-cells: Must be 1.
diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
index c0e0286a2360..1d824cbd462d 100644
--- a/drivers/soc/renesas/Kconfig
+++ b/drivers/soc/renesas/Kconfig
@@ -19,6 +19,7 @@ config SOC_RENESAS
select SYSC_R8A77965 if ARCH_R8A77965
select SYSC_R8A77970 if ARCH_R8A77970
select SYSC_R8A77980 if ARCH_R8A77980
+   select SYSC_R8A77990 if ARCH_R8A77990
select SYSC_R8A77995 if ARCH_R8A77995
 
 if SOC_RENESAS
@@ -76,6 +77,10 @@ config SYSC_R8A77980
bool "R-Car V3H System Controller support" if COMPILE_TEST
select SYSC_RCAR
 
+config SYSC_R8A77990
+   bool "R-Car E3 System Controller support" if COMPILE_TEST
+   select SYSC_RCAR
+
 config SYSC_R8A77995
bool "R-Car D3 System Controller support" if COMPILE_TEST
select SYSC_RCAR
diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile
index a86ece7b84d1..7dc0f20d7907 100644
--- a/drivers/soc/renesas/Makefile
+++ b/drivers/soc/renesas/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_SYSC_R8A7796)+= r8a7796-sysc.o
 obj-$(CONFIG_SYSC_R8A77965)+= r8a77965-sysc.o
 obj-$(CONFIG_SYSC_R8A77970)+= r8a77970-sysc.o
 obj-$(CONFIG_SYSC_R8A77980)+= r8a77980-sysc.o
+obj-$(CONFIG_SYSC_R8A77990)+= r8a77990-sysc.o
 obj-$(CONFIG_SYSC_R8A77995)+= r8a77995-sysc.o
 
 # Family
diff --git a/drivers/soc/renesas/r8a77990-sysc.c 
b/drivers/soc/renesas/r8a77990-sysc.c
new file mode 100644
index ..a8c6417fcd2b
--- /dev/null
+++ b/drivers/soc/renesas/r8a77990-sysc.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas R-Car E3 System Controller
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a77990_areas[] __initconst = {
+   { "always-on",  0, 0, R8A77990_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
+   { "ca53-scu",   0x140, 0, R8A77990_PD_CA53_SCU,  R8A77990_PD_ALWAYS_ON,
+ PD_SCU },
+   { "ca53-cpu0",  0x200, 0, R8A77990_PD_CA53_CPU0, R8A77990_PD_CA53_SCU,
+ PD_CPU_NOCR },
+   { "ca53-cpu1",  0x200, 1, R8A77990_PD_CA53_CPU1, R8A77990_PD_CA53_SCU,
+ PD_CPU_NOCR },
+   { "cr7",0x240, 0, R8A77990_PD_CR7,  R8A77990_PD_ALWAYS_ON },
+   { "a3vc",   0x380, 0, R8A77990_PD_A3VC, R8A77990_PD_ALWAYS_ON },
+   { "a2vc1",  0x3c0, 1, R8A77990_PD_A2VC1,R8A77990_PD_A3VC },
+   { "3dg-a",  0x100, 0, R8A77990_PD_3DG_A,R8A77990_PD_ALWAYS_ON },
+   { "3dg-b",  0x100, 1, R8A77990_PD_3DG_B,R8A77990_PD_3DG_A },
+};
+
+const struct rcar_sysc_info r8a77990_sysc_info __initconst = {
+   .areas = r8a77990_areas,
+   .num_areas = ARRAY_SIZE(r8a77990_areas),
+};
diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index 99203bdc333a..95120acc4d80 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -296,6 +296,9 @@ static const struct of_device_id rcar_sysc_matches[] 
__initconst = {
 #ifdef CONFIG_SYSC_R8A77980
{ .compatible = "renesas,r8a77980-sysc", .data = _sysc_info },
 #endif
+#ifdef CONFIG_SYSC_R8A77990
+   { .compatible = "renesas,r8a77990-sysc", .data = _sysc_info },
+#endif
 #ifdef CONFIG_SYSC_R8A77995
{ .compatible = "renesas,r8a77995-sysc", .data = 

[PATCH 08/14] soc: renesas: Add r8a77990 SYSC PM Domain Binding Definitions

2018-05-18 Thread Simon Horman
From: Takeshi Kihara 

This patch adds power domain indices for R-Car E3.

Signed-off-by: Takeshi Kihara 
[shimoda: add commit log and SPDX-License-Identifier]
Signed-off-by: Yoshihiro Shimoda 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 include/dt-bindings/power/r8a77990-sysc.h | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 include/dt-bindings/power/r8a77990-sysc.h

diff --git a/include/dt-bindings/power/r8a77990-sysc.h 
b/include/dt-bindings/power/r8a77990-sysc.h
new file mode 100644
index ..944d85beec15
--- /dev/null
+++ b/include/dt-bindings/power/r8a77990-sysc.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+#ifndef __DT_BINDINGS_POWER_R8A77990_SYSC_H__
+#define __DT_BINDINGS_POWER_R8A77990_SYSC_H__
+
+/*
+ * These power domain indices match the numbers of the interrupt bits
+ * representing the power areas in the various Interrupt Registers
+ * (e.g. SYSCISR, Interrupt Status Register)
+ */
+
+#define R8A77990_PD_CA53_CPU0  5
+#define R8A77990_PD_CA53_CPU1  6
+#define R8A77990_PD_CR713
+#define R8A77990_PD_A3VC   14
+#define R8A77990_PD_3DG_A  17
+#define R8A77990_PD_3DG_B  18
+#define R8A77990_PD_CA53_SCU   21
+#define R8A77990_PD_A2VC1  26
+
+/* Always-on power area */
+#define R8A77990_PD_ALWAYS_ON  32
+
+#endif /* __DT_BINDINGS_POWER_R8A77990_SYSC_H__ */
-- 
2.11.0



[PATCH 06/14] ARM: debug-ll: Add support for r8a77470

2018-05-18 Thread Simon Horman
From: Biju Das 

Enable low-level debugging support for RZ/G1C (r8a77470). RZ/G1C uses
SCIF1 for the debug console.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/Kconfig.debug | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 199ebc1c4538..693f84392f1b 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -942,6 +942,13 @@ choice
  via SCIF0 on Renesas RZ/G1M (R8A7743), R-Car H2 (R8A7790),
  M2-W (R8A7791), V2H (R8A7792), or M2-N (R8A7793).
 
+   config DEBUG_RCAR_GEN2_SCIF1
+   bool "Kernel low-level debugging messages via SCIF1 on R8A77470"
+   depends on ARCH_R8A77470
+   help
+ Say Y here if you want kernel low-level debugging support
+ via SCIF1 on Renesas RZ/G1C (R8A77470).
+
config DEBUG_RCAR_GEN2_SCIF2
bool "Kernel low-level debugging messages via SCIF2 on R8A7794"
depends on ARCH_R8A7794
@@ -1495,6 +1502,7 @@ config DEBUG_LL_INCLUDE
default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0
default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2
default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0
+   default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF1
default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2
default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF4
default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
@@ -1617,6 +1625,7 @@ config DEBUG_UART_PHYS
default 0xe6c8 if DEBUG_RMOBILE_SCIFA4
default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2
default 0xe6e6 if DEBUG_RCAR_GEN2_SCIF0
+   default 0xe6e68000 if DEBUG_RCAR_GEN2_SCIF1
default 0xe6ee if DEBUG_RCAR_GEN2_SCIF4
default 0xe8008000 if DEBUG_R7S72100_SCIF2
default 0xfbe0 if ARCH_EBSA110
@@ -1651,8 +1660,8 @@ config DEBUG_UART_PHYS
DEBUG_NETX_UART || \
DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \
DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \
-   DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \
-   DEBUG_RCAR_GEN2_SCIF4 || \
+   DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF1 || \
+   DEBUG_RCAR_GEN2_SCIF2 || DEBUG_RCAR_GEN2_SCIF4 || \
DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
DEBUG_S3C64XX_UART || \
-- 
2.11.0



[PATCH 69/69] ARM: dts: r8a7740: Add CEU1

2018-05-18 Thread Simon Horman
Describe CEU1 peripheral for Renesas R-Mobile A1 R8A7740 Soc.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
Reviewed-by: Jacopo Mondi 
---
 arch/arm/boot/dts/r8a7740.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 180eb9d2a390..eb9a911deefb 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -76,6 +76,15 @@
status = "disabled";
};
 
+   ceu1: ceu@fe914000 {
+   reg = <0xfe914000 0x3000>;
+   compatible = "renesas,r8a7740-ceu";
+   interrupts = ;
+   clocks = <_clks R8A7740_CLK_CEU21>;
+   power-domains = <_a4r>;
+   status = "disabled";
+   };
+
cmt1: timer@e6138000 {
compatible = "renesas,cmt-48-r8a7740", "renesas,cmt-48";
reg = <0xe6138000 0x170>;
-- 
2.11.0



[PATCH 51/69] ARM: dts: silk: Drop unnecessary address properties from vin port node

2018-05-18 Thread Simon Horman
The vin port node does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/r8a7794-silk.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/r8a7794-silk.dts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7794-silk.dts 
b/arch/arm/boot/dts/r8a7794-silk.dts
index e2642d2c2eed..7808aaee6644 100644
--- a/arch/arm/boot/dts/r8a7794-silk.dts
+++ b/arch/arm/boot/dts/r8a7794-silk.dts
@@ -475,9 +475,6 @@
pinctrl-names = "default";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin0ep: endpoint {
remote-endpoint = <>;
bus-width = <8>;
-- 
2.11.0



[PATCH 25/69] ARM: dts: r8a7790: Add watchdog support to SoC dtsi

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This commit adds watchdog support to the r8a7790 dtsi.

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Acked-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7790.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 317325e271c9..7ba62b7aa0ba 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -218,6 +218,16 @@
#size-cells = <2>;
ranges;
 
+   rwdt: watchdog@e602 {
+   compatible = "renesas,r8a7790-wdt",
+"renesas,rcar-gen2-wdt";
+   reg = <0 0xe602 0 0x0c>;
+   clocks = < CPG_MOD 402>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 402>;
+   status = "disabled";
+   };
+
gpio0: gpio@e605 {
compatible = "renesas,gpio-r8a7790",
 "renesas,rcar-gen2-gpio";
-- 
2.11.0



[PATCH 26/69] ARM: dts: r8a7791: Add watchdog support to SoC dtsi

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This commit adds watchdog support to the r8a7791 dtsi.

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Acked-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7791.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 8b05f59738c3..570ca12422c5 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -142,6 +142,16 @@
#size-cells = <2>;
ranges;
 
+   rwdt: watchdog@e602 {
+   compatible = "renesas,r8a7791-wdt",
+"renesas,rcar-gen2-wdt";
+   reg = <0 0xe602 0 0x0c>;
+   clocks = < CPG_MOD 402>;
+   power-domains = < R8A7791_PD_ALWAYS_ON>;
+   resets = < 402>;
+   status = "disabled";
+   };
+
gpio0: gpio@e605 {
compatible = "renesas,gpio-r8a7791",
 "renesas,rcar-gen2-gpio";
-- 
2.11.0



[PATCH 60/69] ARM: dts: r7s72100: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A9
CPU core on RZ/A1H by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r7s72100.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index eb2e6f95a2e8..a54822e97bac 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -77,6 +77,11 @@
clock-div = <6>;
};
 
+   pmu {
+   compatible = "arm,cortex-a9-pmu";
+   interrupts-extended = < GIC_PPI 0 IRQ_TYPE_LEVEL_HIGH>;
+   };
+
rtc_x1_clk: rtc_x1 {
#clock-cells = <0>;
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 49/69] ARM: dts: koelsch: Drop unnecessary address properties from port nodes

2018-05-18 Thread Simon Horman
The vin port nodes does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/r8a7791-koelsch.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property
 arch/arm/boot/dts/r8a7791-koelsch.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef1000/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index fcdd0164142b..68e8272cb90e 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -849,9 +849,6 @@
pinctrl-names = "default";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin0ep2: endpoint {
remote-endpoint = <_out>;
bus-width = <24>;
@@ -870,9 +867,6 @@
pinctrl-names = "default";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin1ep: endpoint {
remote-endpoint = <>;
bus-width = <8>;
-- 
2.11.0



[PATCH 21/69] ARM: dts: r8a7793: Adjust SMP routine size

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adjusts the definition of the SMP routine size according
to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 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 61c58029e03e..72d9b0004928 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -392,7 +392,7 @@
 
smp-sram@0 {
compatible = "renesas,smp-sram";
-   reg = <0 0x10>;
+   reg = <0 0x100>;
};
};
 
-- 
2.11.0



[PATCH 54/69] ARM: dts: r8a7790: Correct mask for GIC PPI interrupts

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

R-Car H2 (r8a7790) contains four Cortex-A15 and four Cortex-A7 cores,
hence the second interrupt specifier cell for Private Peripheral
Interrupts should use "GIC_CPU_MASK_SIMPLE(8)", to make sure interrupts
can be delivered to all 8 processor cores.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7790.dtsi | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index b64d99e3ad9d..0a426548a212 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1554,7 +1554,7 @@
interrupt-controller;
reg = <0 0xf1001000 0 0x1000>, <0 0xf1002000 0 0x2000>,
  <0 0xf1004000 0 0x2000>, <0 0xf1006000 0 0x2000>;
-   interrupts = ;
+   interrupts = ;
clocks = < CPG_MOD 408>;
clock-names = "clk";
power-domains = < R8A7790_PD_ALWAYS_ON>;
@@ -1761,10 +1761,10 @@
 
timer {
compatible = "arm,armv7-timer";
-   interrupts-extended = < GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) 
| IRQ_TYPE_LEVEL_LOW)>;
+   interrupts-extended = < GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) 
| IRQ_TYPE_LEVEL_LOW)>;
};
 
/* External USB clock - can be overridden by the board */
-- 
2.11.0



[PATCH 46/69] ARM: dts: lager: Drop unnecessary address properties from port node

2018-05-18 Thread Simon Horman
The vin port node does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/r8a7790-lager.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef1000/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/r8a7790-lager.dts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 3c66366f7c55..d1e582b0ab66 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -890,9 +890,6 @@
status = "okay";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin1ep0: endpoint {
remote-endpoint = <>;
bus-width = <8>;
-- 
2.11.0



[PATCH 30/69] ARM: dts: r8a7792: Add RWDT node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Add a device node for the Watchdog Timer (WDT) controller on the Renesas
R-Car V2H (r8a7792) SoC.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7792.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi
index bea0f12f03d3..d2cf8dd2d9b0 100644
--- a/arch/arm/boot/dts/r8a7792.dtsi
+++ b/arch/arm/boot/dts/r8a7792.dtsi
@@ -101,6 +101,16 @@
#size-cells = <2>;
ranges;
 
+   rwdt: watchdog@e602 {
+   compatible = "renesas,r8a7792-wdt",
+"renesas,rcar-gen2-wdt";
+   reg = <0 0xe602 0 0x0c>;
+   clocks = < CPG_MOD 402>;
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   resets = < 402>;
+   status = "disabled";
+   };
+
gpio0: gpio@e605 {
compatible = "renesas,gpio-r8a7792",
 "renesas,rcar-gen2-gpio";
-- 
2.11.0



[PATCH 42/69] ARM: dts: renesas: r8a7790: Add FDP1 instances

2018-05-18 Thread Simon Horman
From: Laurent Pinchart 

The r8a7790 has three FDP1 instances.

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

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 7ba62b7aa0ba..0f1948d560d7 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1616,6 +1616,33 @@
resets = < 128>;
};
 
+   fdp1@fe94 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe94 0 0x2400>;
+   interrupts = ;
+   clocks = < CPG_MOD 119>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 119>;
+   };
+
+   fdp1@fe944000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe944000 0 0x2400>;
+   interrupts = ;
+   clocks = < CPG_MOD 118>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 118>;
+   };
+
+   fdp1@fe948000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe948000 0 0x2400>;
+   interrupts = ;
+   clocks = < CPG_MOD 117>;
+   power-domains = < R8A7790_PD_ALWAYS_ON>;
+   resets = < 117>;
+   };
+
vsp@fe938000 {
compatible = "renesas,vsp1";
reg = <0 0xfe938000 0 0x8000>;
-- 
2.11.0



[PATCH 59/69] ARM: dts: r7s72100: Correct RTC interrupt types

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

According to table 7.3 ("List of Interrupt IDs") in the RZ/A1H Hardware
User's Manual rev. 3.00, the realtime clock interrupts are level not
edge interrupts.

Signed-off-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 c7b3dca6d81c..eb2e6f95a2e8 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -682,9 +682,9 @@
rtc: rtc@fcff1000 {
compatible = "renesas,r7s72100-rtc", "renesas,sh-rtc";
reg = <0xfcff1000 0x2e>;
-   interrupts = ;
+   interrupts = ,
+,
+;
interrupt-names = "alarm", "period", "carry";
clocks = <_clks R7S72100_CLK_RTC>, <_x1_clk>,
 <_x3_clk>, <_clk>;
-- 
2.11.0



[PATCH 02/14] soc: renesas: rcar-rst: Add support for RZ/G1C

2018-05-18 Thread Simon Horman
From: Biju Das 

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/reset/renesas,rst.txt | 1 +
 drivers/soc/renesas/rcar-rst.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/reset/renesas,rst.txt 
b/Documentation/devicetree/bindings/reset/renesas,rst.txt
index 294a0dae106a..7be61efc3c8a 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rst.txt
+++ b/Documentation/devicetree/bindings/reset/renesas,rst.txt
@@ -17,6 +17,7 @@ Required properties:
Examples with soctypes are:
  - "renesas,r8a7743-rst" (RZ/G1M)
  - "renesas,r8a7745-rst" (RZ/G1E)
+ - "renesas,r8a77470-rst" (RZ/G1C)
  - "renesas,r8a7778-reset-wdt" (R-Car M1A)
  - "renesas,r8a7779-reset-wdt" (R-Car H1)
  - "renesas,r8a7790-rst" (R-Car H2)
diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c
index 8e9cb7996ab0..66d7dbac2ded 100644
--- a/drivers/soc/renesas/rcar-rst.c
+++ b/drivers/soc/renesas/rcar-rst.c
@@ -44,6 +44,7 @@ static const struct of_device_id rcar_rst_matches[] 
__initconst = {
/* RZ/G is handled like R-Car Gen2 */
{ .compatible = "renesas,r8a7743-rst", .data = _rst_gen2 },
{ .compatible = "renesas,r8a7745-rst", .data = _rst_gen2 },
+   { .compatible = "renesas,r8a77470-rst", .data = _rst_gen2 },
/* R-Car Gen1 */
{ .compatible = "renesas,r8a7778-reset-wdt", .data = _rst_gen1 },
{ .compatible = "renesas,r8a7779-reset-wdt", .data = _rst_gen1 },
-- 
2.11.0



[PATCH 01/14] soc: renesas: Identify RZ/G1C

2018-05-18 Thread Simon Horman
From: Biju Das 

Add support for identifying the RZ/G1C (r8a77470) SoC.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 drivers/soc/renesas/renesas-soc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/soc/renesas/renesas-soc.c 
b/drivers/soc/renesas/renesas-soc.c
index ea71c413c926..3912a71bd417 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -100,6 +100,11 @@ static const struct renesas_soc soc_rz_g1e __initconst 
__maybe_unused = {
.id = 0x4c,
 };
 
+static const struct renesas_soc soc_rz_g1c __initconst __maybe_unused = {
+   .family = _rzg,
+   .id = 0x53,
+};
+
 static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = {
.family = _rcar_gen1,
 };
@@ -192,6 +197,9 @@ static const struct of_device_id renesas_socs[] __initconst 
= {
 #ifdef CONFIG_ARCH_R8A7745
{ .compatible = "renesas,r8a7745",  .data = _rz_g1e },
 #endif
+#ifdef CONFIG_ARCH_R8A77470
+   { .compatible = "renesas,r8a77470", .data = _rz_g1c },
+#endif
 #ifdef CONFIG_ARCH_R8A7778
{ .compatible = "renesas,r8a7778",  .data = _rcar_m1a },
 #endif
-- 
2.11.0



[PATCH 63/69] ARM: dts: r8a7792: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A15
CPU cores on R-Car V2H by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters 
available

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

diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi
index d2cf8dd2d9b0..f44257dd86f6 100644
--- a/arch/arm/boot/dts/r8a7792.dtsi
+++ b/arch/arm/boot/dts/r8a7792.dtsi
@@ -85,6 +85,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a15-pmu";
+   interrupts-extended = < GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 62/69] ARM: dts: r8a7791: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A15
CPU cores on R-Car M2-W by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters 
available

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

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 570ca12422c5..828ad78c3337 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -126,6 +126,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a15-pmu";
+   interrupts-extended = < GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 57/69] ARM: dts: emev2: Add missing interrupt-affinity to PMU node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

The PMU node references two interrupts, but lacks the interrupt-affinity
property, which is required in that case:

hw perfevents: no interrupt-affinity property for /pmu, guessing.

Add the missing property to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/emev2.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
index 42ea246e71cb..fec1241b858f 100644
--- a/arch/arm/boot/dts/emev2.dtsi
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -31,13 +31,13 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   cpu@0 {
+   cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <0>;
clock-frequency = <53300>;
};
-   cpu@1 {
+   cpu1: cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <1>;
@@ -57,6 +57,7 @@
compatible = "arm,cortex-a9-pmu";
interrupts = ,
 ;
+   interrupt-affinity = <>, <>;
};
 
clocks@e011 {
-- 
2.11.0



[PATCH 56/69] ARM: dts: sh73a0: Add missing interrupt-affinity to PMU node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

The PMU node references two interrupts, but lacks the interrupt-affinity
property, which is required in that case:

hw perfevents: no interrupt-affinity property for /pmu, guessing.

Add the missing property to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/sh73a0.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 39cc58672bf4..c953648a5f41 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -22,7 +22,7 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   cpu@0 {
+   cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <0>;
@@ -31,7 +31,7 @@
power-domains = <_a2sl>;
next-level-cache = <>;
};
-   cpu@1 {
+   cpu1: cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a9";
reg = <1>;
@@ -91,6 +91,7 @@
compatible = "arm,cortex-a9-pmu";
interrupts = ,
 ;
+   interrupt-affinity = <>, <>;
};
 
cmt1: timer@e6138000 {
-- 
2.11.0



[PATCH 67/69] ARM: dts: r8a7745: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A7
CPU cores on RZ/G1E by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available

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

diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi
index 3de69cb66c44..1cb7a7ab0418 100644
--- a/arch/arm/boot/dts/r8a7745.dtsi
+++ b/arch/arm/boot/dts/r8a7745.dtsi
@@ -105,6 +105,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a7-pmu";
+   interrupts-extended = < GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 17/69] ARM: dts: r8a7745: Adjust SMP routine size

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adjusts the definition of the SMP routine size according
to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"

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

diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi
index dd49a8b48f3e..0c3f4c5b345b 100644
--- a/arch/arm/boot/dts/r8a7745.dtsi
+++ b/arch/arm/boot/dts/r8a7745.dtsi
@@ -360,7 +360,7 @@
 
smp-sram@0 {
compatible = "renesas,smp-sram";
-   reg = <0 0x10>;
+   reg = <0 0x100>;
};
};
 
-- 
2.11.0



[PATCH 05/14] ARM: shmobile: Add the RZ/N1 arch to the shmobile Kconfig

2018-05-18 Thread Simon Horman
From: Michel Pollet 

Add the RZ/N1 Family (Part #R9A06G0xx) ARCH config to the rest of
the Renesas SoC collection.

Signed-off-by: Michel Pollet 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/mach-shmobile/Kconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 6b9111455a30..96672da02f5f 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -114,6 +114,11 @@ config ARCH_R8A7794
bool "R-Car E2 (R8A77940)"
select ARCH_RCAR_GEN2
 
+config ARCH_RZN1
+   bool "RZ/N1 (R9A06G0xx) Family"
+   select ARM_AMBA
+   select CPU_V7
+
 config ARCH_SH73A0
bool "SH-Mobile AG5 (R8A73A00)"
select ARCH_RMOBILE
-- 
2.11.0



[PATCH 47/69] ARM: dts: porter: Drop unnecessary address properties from vin port node

2018-05-18 Thread Simon Horman
The vin port node does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/r8a7791-porter.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef/port: unnecessary #address-cells/#size-cells without

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/r8a7791-porter.dts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791-porter.dts 
b/arch/arm/boot/dts/r8a7791-porter.dts
index 4dd5a5db2de8..876d38f46367 100644
--- a/arch/arm/boot/dts/r8a7791-porter.dts
+++ b/arch/arm/boot/dts/r8a7791-porter.dts
@@ -386,9 +386,6 @@
pinctrl-names = "default";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin0ep: endpoint {
remote-endpoint = <>;
bus-width = <8>;
-- 
2.11.0



[PATCH 48/69] ARM: dts: gose: Drop unnecessary address properties from port nodes

2018-05-18 Thread Simon Horman
The vin port nodes does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/r8a7793-gose.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property
 arch/arm/boot/dts/r8a7793-gose.dtb: Warning (avoid_unnecessary_addr_size): 
/soc/video@e6ef1000/port: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/r8a7793-gose.dts | 6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 7a66d885e657..ec94e2402bdf 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -759,9 +759,6 @@
pinctrl-names = "default";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin0ep2: endpoint {
remote-endpoint = <_out>;
bus-width = <24>;
@@ -781,9 +778,6 @@
status = "okay";
 
port {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
vin1ep: endpoint {
remote-endpoint = <_out>;
bus-width = <8>;
-- 
2.11.0



[PATCH 53/69] ARM: shmobile: r8a7794: alt: add EEPROM to DTS

2018-05-18 Thread Simon Horman
From: Wolfram Sang 

Same EEPROM as on Koelsch, et al.

Signed-off-by: Wolfram Sang 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7794-alt.dts | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7794-alt.dts 
b/arch/arm/boot/dts/r8a7794-alt.dts
index c210412f80ec..e17027532941 100644
--- a/arch/arm/boot/dts/r8a7794-alt.dts
+++ b/arch/arm/boot/dts/r8a7794-alt.dts
@@ -181,6 +181,12 @@
};
};
};
+
+   eeprom@50 {
+   compatible = "renesas,r1ex24002", "atmel,24c02";
+   reg = <0x50>;
+   pagesize = <16>;
+   };
};
 
/*
-- 
2.11.0



[PATCH 64/69] ARM: dts: r8a7793: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A15
CPU cores on R-Car M2-N by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters 
available

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

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 6975b0efc46c..4c29de510481 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -110,6 +110,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a15-pmu";
+   interrupts-extended = < GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 18/69] ARM: dts: r8a7790: Adjust SMP routine size

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adjusts the definition of the SMP routine size according
to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 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 e4367cecad18..317325e271c9 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -443,7 +443,7 @@
 
smp-sram@0 {
compatible = "renesas,smp-sram";
-   reg = <0 0x10>;
+   reg = <0 0x100>;
};
};
 
-- 
2.11.0



[PATCH 52/69] ARM: dts: kzm9d: Drop unnecessary address properties from gpio_keys node

2018-05-18 Thread Simon Horman
The gpio_keys node does not have an address and thus does not need
address-cells or address size-properties.

This is flagged by dtc as follows:
 # make dtbs W=1
 arch/arm/boot/dts/emev2-kzm9d.dtb: Warning (avoid_unnecessary_addr_size): 
/gpio_keys: unnecessary #address-cells/#size-cells without "ranges" or child 
"reg" property

Signed-off-by: Simon Horman 
Reviewed-by: Niklas Söderlund 
---
 arch/arm/boot/dts/emev2-kzm9d.dts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts 
b/arch/arm/boot/dts/emev2-kzm9d.dts
index c238407133bf..0af44b7eadb9 100644
--- a/arch/arm/boot/dts/emev2-kzm9d.dts
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -34,9 +34,6 @@
 
gpio_keys {
compatible = "gpio-keys";
-   #address-cells = <1>;
-   #size-cells = <0>;
-
one {
debounce-interval = <50>;
wakeup-source;
-- 
2.11.0



[PATCH 55/69] ARM: dts: r8a73a4: Correct mask for GIC PPI interrupts

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

R-Mobile APE6 (r8a73a4) contains four Cortex-A15 and four Cortex-A7
cores, hence the second interrupt specifier cell for Private Peripheral
Interrupts should use "GIC_CPU_MASK_SIMPLE(8)", so GIC interrupts are
delivered to all 8 processor cores.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a73a4.dtsi | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 8e48090e4fdc..080d037f5733 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -57,10 +57,10 @@
 
timer {
compatible = "arm,armv7-timer";
-   interrupts = ,
-,
-,
-;
+   interrupts = ,
+,
+,
+;
};
 
dbsc1: memory-controller@e679 {
@@ -464,7 +464,7 @@
<0 0xf1002000 0 0x2000>,
<0 0xf1004000 0 0x2000>,
<0 0xf1006000 0 0x2000>;
-   interrupts = ;
+   interrupts = ;
clocks = <_clks R8A73A4_CLK_INTC_SYS>;
clock-names = "clk";
power-domains = <_c4>;
-- 
2.11.0



[PATCH 66/69] ARM: dts: r8a7743: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A15
CPU cores on RZ/G1M by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters 
available

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

diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi
index 69d8f7e0f053..142949d7066f 100644
--- a/arch/arm/boot/dts/r8a7743.dtsi
+++ b/arch/arm/boot/dts/r8a7743.dtsi
@@ -125,6 +125,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a15-pmu";
+   interrupts-extended = < GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 33/69] ARM: dts: koelsch: Enable watchdog support

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable the watchdog, so the board can be restarted by a watchdog
timeout.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index f40321a1c917..fcdd0164142b 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -637,6 +637,11 @@
status = "okay";
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
status = "okay";
 };
-- 
2.11.0



[PATCH 03/14] soc: renesas: rcar-sysc: Add r8a77470 support

2018-05-18 Thread Simon Horman
From: Biju Das 

Add support for RZ/G1C (R8A77470) SoC power areas to the R-Car SYSC
driver.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 .../bindings/power/renesas,rcar-sysc.txt   |  1 +
 drivers/soc/renesas/Kconfig|  5 
 drivers/soc/renesas/Makefile   |  1 +
 drivers/soc/renesas/r8a77470-sysc.c| 29 ++
 drivers/soc/renesas/rcar-sysc.c|  3 +++
 drivers/soc/renesas/rcar-sysc.h|  1 +
 include/dt-bindings/power/r8a77470-sysc.h  | 22 
 7 files changed, 62 insertions(+)
 create mode 100644 drivers/soc/renesas/r8a77470-sysc.c
 create mode 100644 include/dt-bindings/power/r8a77470-sysc.h

diff --git a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt 
b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
index ab399e559257..3e91d2032253 100644
--- a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
+++ b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
@@ -9,6 +9,7 @@ Required properties:
   - compatible: Must contain exactly one of the following:
   - "renesas,r8a7743-sysc" (RZ/G1M)
   - "renesas,r8a7745-sysc" (RZ/G1E)
+  - "renesas,r8a77470-sysc" (RZ/G1C)
   - "renesas,r8a7779-sysc" (R-Car H1)
   - "renesas,r8a7790-sysc" (R-Car H2)
   - "renesas,r8a7791-sysc" (R-Car M2-W)
diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
index 3bbe6114a420..96dd93660359 100644
--- a/drivers/soc/renesas/Kconfig
+++ b/drivers/soc/renesas/Kconfig
@@ -7,6 +7,7 @@ config SOC_RENESAS
   ARCH_R8A77970 || ARCH_R8A77980 || ARCH_R8A77995
select SYSC_R8A7743 if ARCH_R8A7743
select SYSC_R8A7745 if ARCH_R8A7745
+   select SYSC_R8A77470 if ARCH_R8A77470
select SYSC_R8A7779 if ARCH_R8A7779
select SYSC_R8A7790 if ARCH_R8A7790
select SYSC_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793
@@ -30,6 +31,10 @@ config SYSC_R8A7745
bool "RZ/G1E System Controller support" if COMPILE_TEST
select SYSC_RCAR
 
+config SYSC_R8A77470
+   bool "RZ/G1C System Controller support" if COMPILE_TEST
+   select SYSC_RCAR
+
 config SYSC_R8A7779
bool "R-Car H1 System Controller support" if COMPILE_TEST
select SYSC_RCAR
diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile
index ccb5ec57a262..a86ece7b84d1 100644
--- a/drivers/soc/renesas/Makefile
+++ b/drivers/soc/renesas/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_SOC_RENESAS)   += renesas-soc.o
 # SoC
 obj-$(CONFIG_SYSC_R8A7743) += r8a7743-sysc.o
 obj-$(CONFIG_SYSC_R8A7745) += r8a7745-sysc.o
+obj-$(CONFIG_SYSC_R8A77470)+= r8a77470-sysc.o
 obj-$(CONFIG_SYSC_R8A7779) += r8a7779-sysc.o
 obj-$(CONFIG_SYSC_R8A7790) += r8a7790-sysc.o
 obj-$(CONFIG_SYSC_R8A7791) += r8a7791-sysc.o
diff --git a/drivers/soc/renesas/r8a77470-sysc.c 
b/drivers/soc/renesas/r8a77470-sysc.c
new file mode 100644
index ..cfa015e208ef
--- /dev/null
+++ b/drivers/soc/renesas/r8a77470-sysc.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas RZ/G1C System Controller
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a77470_areas[] __initconst = {
+   { "always-on",  0, 0, R8A77470_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
+   { "ca7-scu",0x100, 0, R8A77470_PD_CA7_SCU,  R8A77470_PD_ALWAYS_ON,
+ PD_SCU },
+   { "ca7-cpu0",   0x1c0, 0, R8A77470_PD_CA7_CPU0, R8A77470_PD_CA7_SCU,
+ PD_CPU_NOCR },
+   { "ca7-cpu1",   0x1c0, 1, R8A77470_PD_CA7_CPU1, R8A77470_PD_CA7_SCU,
+ PD_CPU_NOCR },
+   { "sgx", 0xc0, 0, R8A77470_PD_SGX, R8A77470_PD_ALWAYS_ON },
+};
+
+const struct rcar_sysc_info r8a77470_sysc_info __initconst = {
+   .areas = r8a77470_areas,
+   .num_areas = ARRAY_SIZE(r8a77470_areas),
+};
diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index faf20e719361..99203bdc333a 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -261,6 +261,9 @@ static const struct of_device_id rcar_sysc_matches[] 
__initconst = {
 #ifdef CONFIG_SYSC_R8A7745
{ .compatible = "renesas,r8a7745-sysc", .data = _sysc_info },
 #endif
+#ifdef CONFIG_SYSC_R8A77470
+   { .compatible = "renesas,r8a77470-sysc", .data = _sysc_info },
+#endif
 #ifdef CONFIG_SYSC_R8A7779
{ .compatible = "renesas,r8a7779-sysc", .data = _sysc_info },
 #endif
diff --git a/drivers/soc/renesas/rcar-sysc.h b/drivers/soc/renesas/rcar-sysc.h
index dcdc9ec8eba7..9b24e3af288f 100644
--- a/drivers/soc/renesas/rcar-sysc.h
+++ 

[PATCH 40/69] ARM: dts: r8a77470: Add SCIF support

2018-05-18 Thread Simon Horman
From: Biju Das 

Describe SCIF ports in the R8A77470 device tree.
Also it fixes the CPG clock index ZS from 6 to 5.

Fixes: 6929dfc5918049 ("ARM: dts: r8a77470: Initial SoC device tree")
Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a77470.dtsi | 69 +++--
 1 file changed, 67 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a77470.dtsi b/arch/arm/boot/dts/r8a77470.dtsi
index 2f89f33f5b88..39549f28be85 100644
--- a/arch/arm/boot/dts/r8a77470.dtsi
+++ b/arch/arm/boot/dts/r8a77470.dtsi
@@ -190,19 +190,84 @@
dma-channels = <15>;
};
 
+   scif0: serial@e6e6 {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6e6 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 721>,
+< CPG_CORE 5>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 721>;
+   status = "disabled";
+   };
+
scif1: serial@e6e68000 {
compatible = "renesas,scif-r8a77470",
 "renesas,rcar-gen2-scif", "renesas,scif";
reg = <0 0xe6e68000 0 0x40>;
interrupts = ;
-   clocks = < CPG_MOD 720>,
-< CPG_CORE 6>, <_clk>;
+   clocks = < CPG_MOD 720>,
+< CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
power-domains = < 32>;
resets = < 720>;
status = "disabled";
};
 
+   scif2: serial@e6e58000 {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6e58000 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 719>,
+< CPG_CORE 5>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 719>;
+   status = "disabled";
+   };
+
+   scif3: serial@e6ea8000 {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6ea8000 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 718>,
+< CPG_CORE 5>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 718>;
+   status = "disabled";
+   };
+
+   scif4: serial@e6ee {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6ee 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 715>,
+< CPG_CORE 5>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 715>;
+   status = "disabled";
+   };
+
+   scif5: serial@e6ee8000 {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6ee8000 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 714>,
+< CPG_CORE 5>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 714>;
+   status = "disabled";
+   };
+
gic: interrupt-controller@f1001000 {
compatible = "arm,gic-400";
#interrupt-cells = <3>;
-- 
2.11.0



[PATCH 41/69] ARM: dts: r8a77470: Add SCIF DMA support

2018-05-18 Thread Simon Horman
From: Biju Das 

Add SCIF DMA support for R8A77470 SoC.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a77470.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r8a77470.dtsi b/arch/arm/boot/dts/r8a77470.dtsi
index 39549f28be85..baec3cae49d5 100644
--- a/arch/arm/boot/dts/r8a77470.dtsi
+++ b/arch/arm/boot/dts/r8a77470.dtsi
@@ -198,6 +198,9 @@
clocks = < CPG_MOD 721>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x29>, < 0x2a>,
+  < 0x29>, < 0x2a>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 721>;
status = "disabled";
@@ -211,6 +214,9 @@
clocks = < CPG_MOD 720>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2d>, < 0x2e>,
+  < 0x2d>, < 0x2e>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 720>;
status = "disabled";
@@ -224,6 +230,9 @@
clocks = < CPG_MOD 719>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2b>, < 0x2c>,
+  < 0x2b>, < 0x2c>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 719>;
status = "disabled";
@@ -237,6 +246,9 @@
clocks = < CPG_MOD 718>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2f>, < 0x30>,
+  < 0x2f>, < 0x30>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 718>;
status = "disabled";
@@ -250,6 +262,9 @@
clocks = < CPG_MOD 715>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0xfb>, < 0xfc>,
+  < 0xfb>, < 0xfc>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 715>;
status = "disabled";
@@ -263,6 +278,9 @@
clocks = < CPG_MOD 714>,
 < CPG_CORE 5>, <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0xfd>, < 0xfe>,
+  < 0xfd>, < 0xfe>;
+   dma-names = "tx", "rx", "tx", "rx";
power-domains = < 32>;
resets = < 714>;
status = "disabled";
-- 
2.11.0



[PATCH 29/69] ARM: dts: iwg22m: Add watchdog support to SoM dtsi

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch enables the watchdog from within the iwg20m SoM dtsi.

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Reviewed-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7745-iwg22m.dtsi 
b/arch/arm/boot/dts/r8a7745-iwg22m.dtsi
index 8d0a392b6811..29b6e10fdf96 100644
--- a/arch/arm/boot/dts/r8a7745-iwg22m.dtsi
+++ b/arch/arm/boot/dts/r8a7745-iwg22m.dtsi
@@ -91,6 +91,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
pinctrl-0 = <_pins>;
pinctrl-names = "default";
-- 
2.11.0



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

2018-05-18 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

Please consider these Renesas ARM based SoC updates for v4.18.


The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:

  Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)

are available in the git repository at:

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

for you to fetch changes up to 086b399965a7ee7e50c3b3c57f2dba30ff0334b0:

  soc: renesas: r8a77990-sysc: Add workaround for 3DG-{A,B} (2018-05-16 
10:57:44 +0200)


Renesas ARM Based SoC Updates for v4.18

* SoC
  - Change platform dependency to ARCH_RENESAS

Geert Uytterhoeven says "The Renesas Fine Display Processor driver is
used on Renesas R-Car SoCs only.  Since commit 9b5ba0df4ea4f940 ("ARM:
shmobile: Introduce ARCH_RENESAS") is ARCH_RENESAS a more appropriate
platform dependency than the legacy ARCH_SHMOBILE, hence use the
former.

This will allow to drop ARCH_SHMOBILE on ARM and ARM64 in the near
future."

  - Add the to Kconfig RZ/N1D (r9a06g032) SoC

In preparation for upstream support of this SoC

  - Identify R-Car E3 (r8a77990) SoC

  - Identify and add minimal support for RZ/G1C (r8a77470) SoC

* R-Car SYSC
  - Add support for R-Car E3 (r8a77990) SoC

Shimoda-san says this adds:
+ "Cortex-A53 CPU{0,1}, Cortex-A53 SCU, Cortex-R7, A3VC,
   A2VC1 and 3DG-{A,B} power domain areas..."

+ "workaround for 3DG-{A,B} of R-Car E3 ES1.0 because
   the SoC has a restriction about the order."

  - Remove unused inclusion of ,

  - Make r8a77995_areas[] const.

* R-Car Reset

  - Add support for R-Car E3 (r8a77990) SoC

This driver is needed for the clock driver to work

* Debug-LL

  - Add support for RZ/G1C (r8a77470) SoC

RZ/G1C uses SCIF1 for the debug console


Biju Das (5):
  soc: renesas: Identify RZ/G1C
  soc: renesas: rcar-rst: Add support for RZ/G1C
  soc: renesas: rcar-sysc: Add r8a77470 support
  ARM: shmobile: r8a77470: basic SoC support
  ARM: debug-ll: Add support for r8a77470

Geert Uytterhoeven (2):
  soc: renesas: r8a77995-sysc: Cleanups
  arm: shmobile: Change platform dependency to ARCH_RENESAS

Michel Pollet (2):
  ARM: shmobile: Add the RZ/N1 arch to the shmobile Kconfig
  arm: shmobile: Add the RZ/N1D (R9A06G032) to the shmobile Kconfig

Takeshi Kihara (4):
  soc: renesas: identify R-Car E3
  soc: renesas: Add r8a77990 SYSC PM Domain Binding Definitions
  soc: renesas: rcar-rst: Add support for R-Car E3
  soc: renesas: rcar-sysc: Add support for R-Car E3 power areas

Yoshihiro Shimoda (1):
  soc: renesas: r8a77990-sysc: Add workaround for 3DG-{A,B}

 Documentation/devicetree/bindings/arm/shmobile.txt |  2 +
 .../bindings/power/renesas,rcar-sysc.txt   |  2 +
 .../devicetree/bindings/reset/renesas,rst.txt  |  2 +
 arch/arm/Kconfig   |  2 +-
 arch/arm/Kconfig.debug | 13 -
 arch/arm/Makefile  |  2 +-
 arch/arm/mach-shmobile/Kconfig | 13 +
 arch/arm/mach-shmobile/setup-rcar-gen2.c   |  2 +
 drivers/soc/renesas/Kconfig| 13 -
 drivers/soc/renesas/Makefile   |  2 +
 drivers/soc/renesas/r8a77470-sysc.c| 29 +
 drivers/soc/renesas/r8a77990-sysc.c| 68 ++
 drivers/soc/renesas/r8a77995-sysc.c|  3 +-
 drivers/soc/renesas/rcar-rst.c |  2 +
 drivers/soc/renesas/rcar-sysc.c|  6 ++
 drivers/soc/renesas/rcar-sysc.h|  2 +
 drivers/soc/renesas/renesas-soc.c  | 16 +
 include/dt-bindings/power/r8a77470-sysc.h  | 22 +++
 include/dt-bindings/power/r8a77990-sysc.h  | 26 +
 19 files changed, 220 insertions(+), 7 deletions(-)
 create mode 100644 drivers/soc/renesas/r8a77470-sysc.c
 create mode 100644 drivers/soc/renesas/r8a77990-sysc.c
 create mode 100644 include/dt-bindings/power/r8a77470-sysc.h
 create mode 100644 include/dt-bindings/power/r8a77990-sysc.h


[PATCH 65/69] ARM: dts: r8a7794: Add PMU device node

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable support for the ARM Performance Monitor Units in the Cortex-A7
CPU cores on R-Car E2 by adding a device node for the PMU.

New Linux output:

hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available

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

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 76aadcdf9d37..736196903d22 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -103,6 +103,13 @@
clock-frequency = <0>;
};
 
+   pmu {
+   compatible = "arm,cortex-a7-pmu";
+   interrupts-extended = < GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <>, <>;
+   };
+
/* External SCIF clock */
scif_clk: scif {
compatible = "fixed-clock";
-- 
2.11.0



[PATCH 34/69] ARM: dts: porter: Enable watchdog support

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable the watchdog, so the board can be restarted by a watchdog
timeout.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7791-porter.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-porter.dts 
b/arch/arm/boot/dts/r8a7791-porter.dts
index c14e6fe9e4f6..4dd5a5db2de8 100644
--- a/arch/arm/boot/dts/r8a7791-porter.dts
+++ b/arch/arm/boot/dts/r8a7791-porter.dts
@@ -471,6 +471,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
shared-pin;
 };
-- 
2.11.0



[PATCH 39/69] ARM: dts: silk: Enable watchdog support

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable the watchdog, so the board can be restarted by a watchdog
timeout.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7794-silk.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7794-silk.dts 
b/arch/arm/boot/dts/r8a7794-silk.dts
index 351cb3b3d966..e2642d2c2eed 100644
--- a/arch/arm/boot/dts/r8a7794-silk.dts
+++ b/arch/arm/boot/dts/r8a7794-silk.dts
@@ -540,6 +540,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
shared-pin;
 };
-- 
2.11.0



[PATCH 22/69] ARM: dts: r8a7794: Adjust SMP routine size

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adjusts the definition of the SMP routine size according
to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"

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

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 56f5fa6a2c0f..34c111907eb7 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -348,7 +348,7 @@
 
smp-sram@0 {
compatible = "renesas,smp-sram";
-   reg = <0 0x10>;
+   reg = <0 0x100>;
};
};
 
-- 
2.11.0



[PATCH 04/14] ARM: shmobile: r8a77470: basic SoC support

2018-05-18 Thread Simon Horman
From: Biju Das 

Add minimal support for the RZ/G1C (R8A77470) SoC.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/arm/shmobile.txt | 2 ++
 arch/arm/mach-shmobile/Kconfig | 4 
 arch/arm/mach-shmobile/setup-rcar-gen2.c   | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt 
b/Documentation/devicetree/bindings/arm/shmobile.txt
index d3d1df97834f..86ac320323a7 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -21,6 +21,8 @@ SoCs:
 compatible = "renesas,r8a7744"
   - RZ/G1E (R8A77450)
 compatible = "renesas,r8a7745"
+  - RZ/G1C (R8A77470)
+compatible = "renesas,r8a77470"
   - R-Car M1A (R8A77781)
 compatible = "renesas,r8a7778"
   - R-Car H1 (R8A77790)
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 280e7312a9e1..6b9111455a30 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -75,6 +75,10 @@ config ARCH_R8A7745
bool "RZ/G1E (R8A77450)"
select ARCH_RCAR_GEN2
 
+config ARCH_R8A77470
+   bool "RZ/G1C (R8A77470)"
+   select ARCH_RCAR_GEN2
+
 config ARCH_R8A7778
bool "R-Car M1A (R8A77781)"
select ARCH_RCAR_GEN1
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c 
b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5561dbed7a33..80de6be912e1 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -73,6 +73,7 @@ void __init rcar_gen2_timer_init(void)
shmobile_init_cntvoff();
 
if (of_machine_is_compatible("renesas,r8a7745") ||
+   of_machine_is_compatible("renesas,r8a77470") ||
of_machine_is_compatible("renesas,r8a7792") ||
of_machine_is_compatible("renesas,r8a7794")) {
freq = 26000 / 8;   /* ZS / 8 */
@@ -205,6 +206,7 @@ MACHINE_END
 static const char * const rz_g1_boards_compat_dt[] __initconst = {
"renesas,r8a7743",
"renesas,r8a7745",
+   "renesas,r8a77470",
NULL,
 };
 
-- 
2.11.0



[PATCH 2/6] dt-bindings: arm: Document R-Car E3 SoC DT bindings

2018-05-18 Thread Simon Horman
From: Yoshihiro Shimoda 

This patch adds device tree bindings documentation for Renesas R-Car
E3 (r8a77990).

Signed-off-by: Yoshihiro Shimoda 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/arm/shmobile.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt 
b/Documentation/devicetree/bindings/arm/shmobile.txt
index 29093ba6c5d0..e1a24708a284 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -45,6 +45,8 @@ SoCs:
 compatible = "renesas,r8a77970"
   - R-Car V3H (R8A77980)
 compatible = "renesas,r8a77980"
+  - R-Car E3 (R8A77990)
+compatible = "renesas,r8a77990"
   - R-Car D3 (R8A77995)
 compatible = "renesas,r8a77995"
 
-- 
2.11.0



[PATCH 028/102] arm64: dts: renesas: Add Renesas R8A77990 SoC support

2018-05-18 Thread Simon Horman
From: Yoshihiro Shimoda 

This patch adds basic support for the Renesas R-Car E3 (R8A77990) SoC:
  - PSCI
  - CPU (single)
  - Cache controller
  - Main clocks and controller
  - Interrupt controller
  - Timer
  - PMU
  - Reset controller
  - Product register
  - System controller
  - UART for console

Inspried by a patch by Takeshi Kihara in the BSP.

Signed-off-by: Yoshihiro Shimoda 
Signed-off-by: Simon Horman 
---
 arch/arm64/boot/dts/renesas/r8a77990.dtsi | 127 ++
 1 file changed, 127 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/r8a77990.dtsi

diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi 
b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
new file mode 100644
index ..3a19b9ebdd6e
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device Tree Source for the r8a77990 SoC
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include 
+#include 
+
+/ {
+   compatible = "renesas,r8a77990";
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* 1 core only at this point */
+   a53_0: cpu@0 {
+   compatible = "arm,cortex-a53", "arm,armv8";
+   reg = <0x0>;
+   device_type = "cpu";
+   power-domains = < 5>;
+   next-level-cache = <_CA53>;
+   enable-method = "psci";
+   };
+
+   L2_CA53: cache-controller@0 {
+   compatible = "cache";
+   reg = <0>;
+   power-domains = < 21>;
+   cache-unified;
+   cache-level = <2>;
+   };
+   };
+
+   extal_clk: extal {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   /* This value must be overridden by the board */
+   clock-frequency = <0>;
+   };
+
+   pmu_a53 {
+   compatible = "arm,cortex-a53-pmu";
+   interrupts-extended = < GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <_0>;
+   };
+
+   psci {
+   compatible = "arm,psci-0.2";
+   method = "smc";
+   };
+
+   soc: soc {
+   compatible = "simple-bus";
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   cpg: clock-controller@e615 {
+   compatible = "renesas,r8a77990-cpg-mssr";
+   reg = <0 0xe615 0 0x1000>;
+   clocks = <_clk>;
+   clock-names = "extal";
+   #clock-cells = <2>;
+   #power-domain-cells = <0>;
+   #reset-cells = <1>;
+   };
+
+   rst: reset-controller@e616 {
+   compatible = "renesas,r8a77990-rst";
+   reg = <0 0xe616 0 0x0200>;
+   };
+
+   sysc: system-controller@e618 {
+   compatible = "renesas,r8a77990-sysc";
+   reg = <0 0xe618 0 0x0400>;
+   #power-domain-cells = <1>;
+   };
+
+   scif2: serial@e6e88000 {
+   compatible = "renesas,scif-r8a77990",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6e88000 0 64>;
+   interrupts = ;
+   clocks = < CPG_MOD 310>;
+   clock-names = "fck";
+   power-domains = < 32>;
+   resets = < 310>;
+   status = "disabled";
+   };
+
+   gic: interrupt-controller@f101 {
+   compatible = "arm,gic-400";
+   #interrupt-cells = <3>;
+   #address-cells = <0>;
+   interrupt-controller;
+   reg = <0x0 0xf101 0 0x1000>,
+ <0x0 0xf102 0 0x2>,
+ <0x0 0xf104 0 0x2>,
+ <0x0 0xf106 0 0x2>;
+   interrupts = ;
+   clocks = < CPG_MOD 408>;
+   clock-names = "clk";
+   power-domains = < 32>;
+   resets = < 408>;
+   };
+
+   prr: chipid@fff00044 {
+   compatible = "renesas,prr";
+   reg = <0 0xfff00044 0 4>;
+   };
+   };
+
+   timer {
+   

[PATCH 3/6] ARM: shmobile: defconfig: Disable CONFIG_FB_SH_MOBILE_MERAM

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

The last Renesas ARM platform using this driver was removed in commit
a521422ea4ae6128 ("ARM: shmobile: mackerel: Remove Legacy C board
code").

Signed-off-by: Geert Uytterhoeven 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Simon Horman 
---
 arch/arm/configs/shmobile_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/configs/shmobile_defconfig 
b/arch/arm/configs/shmobile_defconfig
index dc650db70063..dd95d395f565 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -157,7 +157,6 @@ CONFIG_DRM_DUMB_VGA_DAC=y
 CONFIG_DRM_I2C_ADV7511=y
 CONFIG_DRM_I2C_ADV7511_AUDIO=y
 CONFIG_FB_SH_MOBILE_LCDC=y
-CONFIG_FB_SH_MOBILE_MERAM=y
 # CONFIG_LCD_CLASS_DEVICE is not set
 # CONFIG_BACKLIGHT_GENERIC is not set
 CONFIG_BACKLIGHT_PWM=y
-- 
2.11.0



[PATCH 14/69] ARM: dts: r8a77470: Add IRQC support

2018-05-18 Thread Simon Horman
From: Biju Das 

Describe the IRQC interrupt controller in the R8A77470 device tree.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a77470.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a77470.dtsi b/arch/arm/boot/dts/r8a77470.dtsi
index c39acebc6a72..2f89f33f5b88 100644
--- a/arch/arm/boot/dts/r8a77470.dtsi
+++ b/arch/arm/boot/dts/r8a77470.dtsi
@@ -81,6 +81,26 @@
#power-domain-cells = <1>;
};
 
+   irqc: interrupt-controller@e61c {
+   compatible = "renesas,irqc-r8a77470", "renesas,irqc";
+   #interrupt-cells = <2>;
+   interrupt-controller;
+   reg = <0 0xe61c 0 0x200>;
+   interrupts = ,
+,
+,
+,
+,
+,
+,
+,
+,
+;
+   clocks = < CPG_MOD 407>;
+   power-domains = < 32>;
+   resets = < 407>;
+   };
+
icram0: sram@e63a {
compatible = "mmio-sram";
reg = <0 0xe63a 0 0x12000>;
-- 
2.11.0



[PATCH 03/69] ARM: dts: r7s72100: sort subnodes of soc node

2018-05-18 Thread Simon Horman
Sort the subnodes of the soc node to improve maintainability.
The sort key is the address on the bus with instances of the same
IP block grouped together and sorted alphabetically.

This patch should not introduce any functional change.

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

diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index 0aa74355e24f..0d63dbe11e0d 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -110,187 +110,14 @@
#size-cells = <1>;
ranges;
 
-   /* Special CPG clocks */
-   cpg_clocks: cpg_clocks@fcfe {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-cpg-clocks",
-"renesas,rz-cpg-clocks";
-   reg = <0xfcfe 0x18>;
-   clocks = <_clk>, <_x1_clk>;
-   clock-output-names = "pll", "i", "g";
-   #power-domain-cells = <0>;
-   };
-
-   /* MSTP clocks */
-   mstp3_clks: mstp3_clks@fcfe0420 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0420 4>;
-   clocks = <_clk>;
-   clock-indices = ;
-   clock-output-names = "mtu2";
-   };
-
-   mstp4_clks: mstp4_clks@fcfe0424 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0424 4>;
-   clocks = <_clk>, <_clk>, <_clk>, <_clk>,
-<_clk>, <_clk>, <_clk>, <_clk>;
-   clock-indices = <
-   R7S72100_CLK_SCIF0 R7S72100_CLK_SCIF1 
R7S72100_CLK_SCIF2 R7S72100_CLK_SCIF3
-   R7S72100_CLK_SCIF4 R7S72100_CLK_SCIF5 
R7S72100_CLK_SCIF6 R7S72100_CLK_SCIF7
-   >;
-   clock-output-names = "scif0", "scif1", "scif2", 
"scif3", "scif4", "scif5", "scif6", "scif7";
-   };
-
-   mstp5_clks: mstp5_clks@fcfe0428 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0428 4>;
-   clocks = <_clk>, <_clk>;
-   clock-indices = ;
-   clock-output-names = "ostm0", "ostm1";
-   };
-
-   mstp6_clks: mstp6_clks@fcfe042c {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe042c 4>;
-   clocks = <_clk>;
-   clock-indices = ;
-   clock-output-names = "rtc";
-   };
-
-   mstp7_clks: mstp7_clks@fcfe0430 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0430 4>;
-   clocks = <_clk>, <_clk>, <_clk>;
-   clock-indices = ;
-   clock-output-names = "ether", "usb0", "usb1";
-   };
-
-   mstp8_clks: mstp8_clks@fcfe0434 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0434 4>;
-   clocks = <_clk>;
-   clock-indices = ;
-   clock-output-names = "mmcif";
-   };
-
-   mstp9_clks: mstp9_clks@fcfe0438 {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe0438 4>;
-   clocks = <_clk>, <_clk>, <_clk>, <_clk>;
-   clock-indices = <
-   R7S72100_CLK_I2C0 R7S72100_CLK_I2C1 
R7S72100_CLK_I2C2 R7S72100_CLK_I2C3
-   >;
-   clock-output-names = "i2c0", "i2c1", "i2c2", "i2c3";
-   };
-
-   mstp10_clks: mstp10_clks@fcfe043c {
-   #clock-cells = <1>;
-   compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
-   reg = <0xfcfe043c 4>;
-   clocks = <_clk>, <_clk>, <_clk>, <_clk>,
-  

[PATCH 06/69] ARM: dts: r8a77470: Initial SoC device tree

2018-05-18 Thread Simon Horman
From: Biju Das 

The initial R8A77470 SoC device tree including CPU0, GIC, timer, SYSC, RST,
CPG, and the required clock descriptions.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a77470.dtsi | 154 
 1 file changed, 154 insertions(+)
 create mode 100644 arch/arm/boot/dts/r8a77470.dtsi

diff --git a/arch/arm/boot/dts/r8a77470.dtsi b/arch/arm/boot/dts/r8a77470.dtsi
new file mode 100644
index ..45785828771b
--- /dev/null
+++ b/arch/arm/boot/dts/r8a77470.dtsi
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the r8a77470 SoC
+ *
+ * Copyright (C) 2018 Renesas Electronics Corp.
+ */
+
+#include 
+#include 
+#include 
+/ {
+   compatible = "renesas,r8a77470";
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a7";
+   reg = <0>;
+   clock-frequency = <10>;
+   clocks = < CPG_CORE 0>;
+   power-domains = < 5>;
+   next-level-cache = <_CA7>;
+   };
+
+
+   L2_CA7: cache-controller-0 {
+   compatible = "cache";
+   cache-unified;
+   cache-level = <2>;
+   power-domains = < 21>;
+   };
+   };
+
+   /* External root clock */
+   extal_clk: extal {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   /* This value must be overridden by the board. */
+   clock-frequency = <0>;
+   };
+
+   /* External SCIF clock */
+   scif_clk: scif {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   /* This value must be overridden by the board. */
+   clock-frequency = <0>;
+   };
+
+   soc {
+   compatible = "simple-bus";
+   interrupt-parent = <>;
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   cpg: clock-controller@e615 {
+   compatible = "renesas,r8a77470-cpg-mssr";
+   reg = <0 0xe615 0 0x1000>;
+   clocks = <_clk>, <_extal_clk>;
+   clock-names = "extal", "usb_extal";
+   #clock-cells = <2>;
+   #power-domain-cells = <0>;
+   #reset-cells = <1>;
+   };
+
+   rst: reset-controller@e616 {
+   compatible = "renesas,r8a77470-rst";
+   reg = <0 0xe616 0 0x100>;
+   };
+
+   sysc: system-controller@e618 {
+   compatible = "renesas,r8a77470-sysc";
+   reg = <0 0xe618 0 0x200>;
+   #power-domain-cells = <1>;
+   };
+
+   icram0: sram@e63a {
+   compatible = "mmio-sram";
+   reg = <0 0xe63a 0 0x12000>;
+   };
+
+   icram1: sram@e63c {
+   compatible = "mmio-sram";
+   reg = <0 0xe63c 0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges = <0 0 0xe63c 0x1000>;
+
+   smp-sram@0 {
+   compatible = "renesas,smp-sram";
+   reg = <0 0x100>;
+   };
+   };
+
+   icram2: sram@e630 {
+   compatible = "mmio-sram";
+   reg = <0 0xe630 0 0x2>;
+   };
+
+   scif1: serial@e6e68000 {
+   compatible = "renesas,scif-r8a77470",
+"renesas,rcar-gen2-scif", "renesas,scif";
+   reg = <0 0xe6e68000 0 0x40>;
+   interrupts = ;
+   clocks = < CPG_MOD 720>,
+< CPG_CORE 6>, <_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = < 32>;
+   resets = < 720>;
+   status = "disabled";
+   };
+
+   gic: interrupt-controller@f1001000 {
+   compatible = "arm,gic-400";
+   #interrupt-cells = <3>;
+   #address-cells = <0>;
+ 

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

2018-05-18 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

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


The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:

  Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)

are available in the git repository at:

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

for you to fetch changes up to 7fad92d05887319998b8d2bb40082b8b224d5ef5:

  ARM: dts: r8a7740: Add CEU1 (2018-05-16 10:54:50 +0200)


Renesas ARM Based SoC DT Updates for v4.18

* R-Mobile A1 (r8a7740) SoC
  - Describe CEU, IRQC, SYS-DMAC and USB devices

  - Cleanup for consistency with other Renesas SoCs and enhanced maintainability
+ Stop grouping clocks under a "clocks" subnode
+ Add soc node
+ Sort subnodes of root and soc nodes

* RZ/A1H (r7s72100) SoC
  - Describe CEU device

* R-Car Gen2, RZ/G1 and RZ/A1H SoCs
  - Add PMU device nodes

Geert Uytterhoeven says: "This patch series enables support for the ARM
Performance Monitor Units in Cortex-A7, Cortex-A9, and Cortex-A15 CPU
cores on Renesas RZ/A1, R-Car Gen2, and RZ/G1 SoCs.  This allows for
better performance analysis using the "perf" tool."

* RZ/A1H (r7s72100) SoC
  - Correct interrupt types

Geert Uytterhoeven says "RZ/A1H peripherals use a mix of level and edge
interrupts.

This patch series corrects the interrupt types for watchdog and RTC from
edge to level, to match the datasheet."

* R-Mobile APE6 (r8a73a4) APE4EVM board and SH-Mobile AG5 (sh73a0) SoC
  - Use generic disable-wp instead of now deprecated
toshiba,mmc-wrprotect-disable property

* EMMA Mobile EV2 (emev2) and SH-Mobile AG5 (sh73a0) SoCs
  - Add missing interrupt-affinity to PMU

Geert Uytterhoeven says "The Cortex-A9 PMU nodes on SH-Mobile AG5 and
Emma Mobile EV2 reference two interrupts, but lack interrupt-affinity
properties, leading to:

hw perfevents: no interrupt-affinity property for /pmu, guessing.

This series adds the missing properties to fix this."

* R-Car H2 (r8a7790) and R-Mobile APE6 (r8a73a4) SoCs
  - Correct mask for GIC PPI interrupts

Geert Uytterhoeven says "R-Car H2 and R-Mobile APE6 contain four
Cortex-A15 and four Cortex-A7 cores, hence the second interrupt
specifier cell for Private Peripheral Interrupts should use
"GIC_CPU_MASK_SIMPLE(8)", to make sure interrupts can be delivered to
all 8 processor cores.

This brings the predecessors of R-Car Gen3 in line with what we're
doing on other big.LITTLE SoCs, like R-Car H3 and M3-W."

* Alt board for R-Car E2 (r8a7794) SoC

* RBoards for -Car Gen2 SoCs and kzm9d board for EMMA Mobile EV2 (emev2) SoC
  - Drop unnecessary address properties from VIN port nodes

These are unnecessary as the nodes to not have bus addresses.

* R-Car H2 (r8a7790), M2-W (r8a7791), M2-N (r8a7793) and E2 (r8a7794) SoCs
  - Describe FDP1 instances

* iW-RainboW-G23S board for RZ/G1C (r8a77470) SoC
  - Initial SoC and board support

  - Enable EtherAVB

  - Describe all SCIF devices

* Boards for R-Car Gen2 SoCs
  - Enable watchdog support

Geert Uytterhoeven says "This patch series enables the builtin watchdog
timer on R-Car Gen2 SoCs on all supported boards, and builds on top of
Fabrizio's "[RFC v4 00/26] Fix watchdog on Renesas R-Car Gen2 and
RZ/G1"."

* R-Car Gen2 and RZ/G1 SoCs
  - Describe watchdog devices

  - For R-Car Gen2 this involves updating the SMP routine side as
it is changed by a driver updated to allow watchdog device support

* Wheat board for V2H (r8a7792) SoC
  - Correct ADV7513 address usage

Kieran Bingham says "The r8a7792 Wheat board has two ADV7513 devices
sharing a single I2C bus, however in low power mode the ADV7513 will
reset it's slave maps to use the hardware defined default addresses.

The ADV7511 driver was adapted to allow the two devices to be
registered correctly - but it did not take into account the fault
whereby the devices reset the addresses.

This results in an address conflict between the device using the
default addresses, and the other device if it is in low-power-mode.

Repair this issue by moving both devices away from the default address
definitions."


Biju Das (8):
  ARM: dts: r8a77470: Initial SoC device tree
  ARM: dts: iwg23s-sbc: Add support for iWave G23S-SBC based on RZ/G1C
  ARM: dts: r8a77470: Add SYS-DMAC support
  ARM: dts: r8a77470: Add IRQC support
  ARM: dts: r8a77470: Add SCIF support
  ARM: dts: r8a77470: Add SCIF DMA support
  ARM: dts: r8a77470: Add EtherAVB support
  ARM: dts: iwg23s-sbc: Add EtherAVB support

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

Fabrizio Castro (14):
  ARM: dts: r8a7743: Adjust SMP routine size
  ARM: dts: r8a7745: Adjust SMP routine 

[PATCH 24/69] ARM: dts: r8a7745: Add watchdog support to SoC dtsi

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adds watchdog support to the r8a7745 SoC dtsi.

Signed-off-by: Fabrizio Castro 
Signed-off-by: Ramesh Shanmugasundaram 
Reviewed-by: Geert Uytterhoeven 
Acked-by: Wolfram Sang 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7745.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7745.dtsi b/arch/arm/boot/dts/r8a7745.dtsi
index 0c3f4c5b345b..3de69cb66c44 100644
--- a/arch/arm/boot/dts/r8a7745.dtsi
+++ b/arch/arm/boot/dts/r8a7745.dtsi
@@ -262,6 +262,16 @@
reg = <0 0xe616 0 0x100>;
};
 
+   rwdt: watchdog@e602 {
+   compatible = "renesas,r8a7745-wdt",
+"renesas,rcar-gen2-wdt";
+   reg = <0 0xe602 0 0x0c>;
+   clocks = < CPG_MOD 402>;
+   power-domains = < R8A7745_PD_ALWAYS_ON>;
+   resets = < 402>;
+   status = "disabled";
+   };
+
sysc: system-controller@e618 {
compatible = "renesas,r8a7745-sysc";
reg = <0 0xe618 0 0x200>;
-- 
2.11.0



[PATCH 35/69] ARM: dts: blanche: Enable watchdog support

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable the watchdog, so the board can be restarted by a watchdog
timeout.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7792-blanche.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7792-blanche.dts 
b/arch/arm/boot/dts/r8a7792-blanche.dts
index 9b67dca6c9ef..04fb70931b3b 100644
--- a/arch/arm/boot/dts/r8a7792-blanche.dts
+++ b/arch/arm/boot/dts/r8a7792-blanche.dts
@@ -239,6 +239,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
pinctrl-0 = <_pins>;
pinctrl-names = "default";
-- 
2.11.0



[PATCH 36/69] ARM: dts: wheat: Enable watchdog support

2018-05-18 Thread Simon Horman
From: Geert Uytterhoeven 

Enable the watchdog, so the board can be restarted by a watchdog
timeout.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Fabrizio Castro 
Signed-off-by: Simon Horman 
---
 arch/arm/boot/dts/r8a7792-wheat.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7792-wheat.dts 
b/arch/arm/boot/dts/r8a7792-wheat.dts
index 95aab56a56ab..db01de7a3811 100644
--- a/arch/arm/boot/dts/r8a7792-wheat.dts
+++ b/arch/arm/boot/dts/r8a7792-wheat.dts
@@ -168,6 +168,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
pinctrl-0 = <_pins>;
pinctrl-names = "default";
-- 
2.11.0



[PATCH 20/69] ARM: dts: r8a7792: Adjust SMP routine size

2018-05-18 Thread Simon Horman
From: Fabrizio Castro 

This patch adjusts the definition of the SMP routine size according
to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"

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

diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi
index 268987ff0201..bea0f12f03d3 100644
--- a/arch/arm/boot/dts/r8a7792.dtsi
+++ b/arch/arm/boot/dts/r8a7792.dtsi
@@ -341,7 +341,7 @@
 
smp-sram@0 {
compatible = "renesas,smp-sram";
-   reg = <0 0x10>;
+   reg = <0 0x100>;
};
};
 
-- 
2.11.0



[PATCH 1/6] dt-bindings: arm: Document iW-RainboW-G23S single board computer

2018-05-18 Thread Simon Horman
From: Biju Das 

Document the iW-RainboW-G23S single board computer device tree bindings,
listing it as a supported board.

Signed-off-by: Biju Das 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Simon Horman 
---
 Documentation/devicetree/bindings/arm/shmobile.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt 
b/Documentation/devicetree/bindings/arm/shmobile.txt
index d3d1df97834f..29093ba6c5d0 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -78,6 +78,8 @@ Boards:
 compatible = "renesas,h3ulcb", "renesas,r8a7795"
   - Henninger
 compatible = "renesas,henninger", "renesas,r8a7791"
+  - iWave Systems RZ/G1C Single Board Computer (iW-RainboW-G23S)
+compatible = "iwave,g23s", "renesas,r8a77470"
   - iWave Systems RZ/G1E SODIMM SOM Development Platform (iW-RainboW-G22D)
 compatible = "iwave,g22d", "iwave,g22m", "renesas,r8a7745"
   - iWave Systems RZ/G1E SODIMM System On Module (iW-RainboW-G22M-SM)
-- 
2.11.0



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

2018-05-18 Thread Simon Horman
Hi Olof, Hi Kevin, Hi Arnd,

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


The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:

  Linux 4.17-rc1 (2018-04-15 18:24:20 -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.18

for you to fetch changes up to c92db4a4a4c6c176c34604e456d6d355803d9ada:

  dt-bindings: arm: document Renesas V3HSK board bindings (2018-05-15 09:17:45 
+0200)


Renesas ARM Based SoC DT Bindings Updates for v4.18

Document bindings for:

* V3H Starter Kit, a board used with the R-Car V3H (r8a77980) SoC
* R-Car E3 (R8A77990) SoC and its Ebisu board
* iWave Systems RZ/G1C Single Board Computer (iW-RainboW-G23S)
  which uses an RZ/G1C (R8A77470) SoC
* RZ/G1M (R8A7743) and RZ/G1N (R8A7744) CMT support

Cleanup:
* Consistently name r8a77965 as R-Car M3-N


Biju Das (1):
  dt-bindings: arm: Document iW-RainboW-G23S single board computer

Fabrizio Castro (1):
  dt-bindings: timer: renesas, cmt: Document r8a774[35] CMT support

Sergei Shtylyov (1):
  dt-bindings: arm: document Renesas V3HSK board bindings

Simon Horman (1):
  dt-bindings: arm: consistently name r8a77965 as M3-N

Yoshihiro Shimoda (2):
  dt-bindings: arm: Document R-Car E3 SoC DT bindings
  dt-bindings: arm: Document Renesas Ebisu board DT bindings

 Documentation/devicetree/bindings/arm/shmobile.txt  | 10 +-
 Documentation/devicetree/bindings/timer/renesas,cmt.txt | 14 ++
 2 files changed, 19 insertions(+), 5 deletions(-)


  1   2   3   >