[PULL REQUEST] renesas/topic/sdhi-8bit-emmc for renesas drivers

2016-09-14 Thread Wolfram Sang
Hi Geert,

here is a topic branch for renesas-drivers. This branch is based on
Simon's topic/sdr104-v7 branch which I needed for M3 SDHI enablement.
Please pull.

Kind regards,

   Wolfram


The following changes since commit 6d1414d3fd219406b067af28bb96316626edefe4:

  gpio: rcar: Add r8a7796 (R-Car M3-W) support (2016-09-13 11:59:47 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
renesas/topic/sdhi-8bit-emmc

for you to fetch changes up to 9eaf0e179ad52ee2f5f14cb9f51864f9d691c8e7:

  arm64: dts: r8a7796: salvator: enable on board eMMC (2016-09-14 18:16:06 
+0200)


Wolfram Sang (7):
  hotfix for sdr104-v7
  mmc: add define for R1 response without CRC
  mmc: rtsx_pci: use new macro for R1 without CRC
  mmc: rtsx_usb: use new macro for R1 without CRC
  mmc: tmio: add eMMC support
  arm64: dts: r8a7795: salvator: enable on-board eMMC
  arm64: dts: r8a7796: salvator: enable on board eMMC

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 +
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 44 +-
 drivers/mmc/host/rtsx_pci_sdmmc.c  |  2 +-
 drivers/mmc/host/rtsx_usb_sdmmc.c  |  2 +-
 drivers/mmc/host/sh_mobile_sdhi.c  |  2 +-
 drivers/mmc/host/tmio_mmc.h|  3 ++
 drivers/mmc/host/tmio_mmc_pio.c| 29 --
 include/linux/mmc/core.h   |  3 ++
 8 files changed, 112 insertions(+), 16 deletions(-)


signature.asc
Description: PGP signature


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

2016-09-14 Thread Arnd Bergmann
On Wednesday, September 7, 2016 9:41:38 AM CEST Simon Horman wrote:
> Renesas ARM Based SoC Updates for v4.9
> 
> Clean-up:
> * Only use smp_init when SMP is selected
> 
> Enablement:
> * Add debug-ll support for r8a7992
> 

Pulled into next/soc, thanks!

Arnd


Re: [GIT PULL] Renesas ARM64 Based SoC Defconfig Updates for v4.9

2016-09-14 Thread Arnd Bergmann
On Wednesday, September 7, 2016 9:41:26 AM CEST Simon Horman wrote:
> Renesas ARM64 Based SoC Defconfig Updates for v4.9
> 
> * Enable HSUSB and SDHI
> 

Pulled into next/arm64, thanks!

Arnd



Re: [PATCH] pcie-rcar: fix some checkpatch warnings

2016-09-14 Thread Bjorn Helgaas
On Fri, Sep 09, 2016 at 01:26:18AM +0300, Sergei Shtylyov wrote:
> The R-Car PCIe driver causes 13 warnings from scripts/checkpatch.pl --
> let's fix at least 10 easier ones:
> 
> - line over 80 characters;
> 
> - blank line missing after declarations;
> 
> - statements not starting on a tabstop.
> 
> Signed-off-by: Sergei Shtylyov 

Applied with Simon's ack to pci/host-rcar, thanks!

> ---
> The patch is against the 'next' branch of Bjorn Helgaas' 'pci.git' repo plus
> two patches  posted  earlier...
> 
>  drivers/pci/host/pcie-rcar.c |   29 +++--
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> Index: pci/drivers/pci/host/pcie-rcar.c
> ===
> --- pci.orig/drivers/pci/host/pcie-rcar.c
> +++ pci/drivers/pci/host/pcie-rcar.c
> @@ -1034,12 +1034,16 @@ static int rcar_pcie_inbound_ranges(stru
>* Set up 64-bit inbound regions as the range parser doesn't
>* distinguish between 32 and 64-bit types.
>*/
> - rcar_pci_write_reg(pcie, lower_32_bits(pci_addr), 
> PCIEPRAR(idx));
> + rcar_pci_write_reg(pcie, lower_32_bits(pci_addr),
> +PCIEPRAR(idx));
>   rcar_pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
> - rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags, 
> PCIELAMR(idx));
> + rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags,
> +PCIELAMR(idx));
>  
> - rcar_pci_write_reg(pcie, upper_32_bits(pci_addr), 
> PCIEPRAR(idx+1));
> - rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr), 
> PCIELAR(idx+1));
> + rcar_pci_write_reg(pcie, upper_32_bits(pci_addr),
> +PCIEPRAR(idx + 1));
> + rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr),
> +PCIELAR(idx + 1));
>   rcar_pci_write_reg(pcie, 0, PCIELAMR(idx + 1));
>  
>   pci_addr += size;
> @@ -1088,6 +1092,7 @@ static int rcar_pcie_parse_map_dma_range
>   /* Get the dma-ranges from DT */
>   for_each_of_pci_range(&parser, &range) {
>   u64 end = range.cpu_addr + range.size - 1;
> +
>   dev_dbg(pcie->dev, "0x%08x 0x%016llx..0x%016llx -> 0x%016llx\n",
>   range.flags, range.cpu_addr, end, range.pci_addr);
>  
> @@ -1101,9 +1106,12 @@ static int rcar_pcie_parse_map_dma_range
>  
>  static const struct of_device_id rcar_pcie_of_match[] = {
>   { .compatible = "renesas,pcie-r8a7779", .data = rcar_pcie_hw_init_h1 },
> - { .compatible = "renesas,pcie-rcar-gen2", .data = 
> rcar_pcie_hw_init_gen2 },
> - { .compatible = "renesas,pcie-r8a7790", .data = rcar_pcie_hw_init_gen2 
> },
> - { .compatible = "renesas,pcie-r8a7791", .data = rcar_pcie_hw_init_gen2 
> },
> + { .compatible = "renesas,pcie-rcar-gen2",
> +   .data = rcar_pcie_hw_init_gen2 },
> + { .compatible = "renesas,pcie-r8a7790",
> +   .data = rcar_pcie_hw_init_gen2 },
> + { .compatible = "renesas,pcie-r8a7791",
> +   .data = rcar_pcie_hw_init_gen2 },
>   { .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
>   {},
>  };
> @@ -1116,7 +1124,8 @@ static int rcar_pcie_parse_request_of_pc
>   resource_size_t iobase;
>   struct resource_entry *win;
>  
> - err = of_pci_get_host_bridge_resources(np, 0, 0xff, &pci->resources, 
> &iobase);
> + err = of_pci_get_host_bridge_resources(np, 0, 0xff, &pci->resources,
> +&iobase);
>   if (err)
>   return err;
>  
> @@ -1167,8 +1176,8 @@ static int rcar_pcie_probe(struct platfo
>   return err;
>   }
>  
> -  err = rcar_pcie_parse_map_dma_ranges(pcie, pdev->dev.of_node);
> -  if (err)
> + err = rcar_pcie_parse_map_dma_ranges(pcie, pdev->dev.of_node);
> + if (err)
>   return err;
>  
>   of_id = of_match_device(rcar_pcie_of_match, pcie->dev);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pcie-rcar: MSI range allocation support

2016-09-14 Thread Bjorn Helgaas
On Thu, Sep 08, 2016 at 10:32:59PM +0300, Sergei Shtylyov wrote:
> From: Grigory Kletsko 
> 
> Impelment MSI setup_irqs() method which enables allocation of several MSIs
> at once.
> 
> [Sergei Shtylyov: removed unrelated/unneeded changes, fixed too long lines,
> reordered the variable declarations, reworded the summary/description.]
> 
> Signed-off-by: Grigory Kletsko 
> Signed-off-by: Sergei Shtylyov 

Applied with Simon's ack to pci/host-rcar for v4.9, thanks!

> ---
> The patch is against the 'next' branch of Bjorn Helgaas' 'pci.git' repo plus
> the patch posted yesterday.
> 
>  drivers/pci/host/pcie-rcar.c |   72 
> +--
>  1 file changed, 70 insertions(+), 2 deletions(-)
> 
> Index: pci/drivers/pci/host/pcie-rcar.c
> ===
> --- pci.orig/drivers/pci/host/pcie-rcar.c
> +++ pci/drivers/pci/host/pcie-rcar.c
> @@ -673,6 +673,18 @@ static int rcar_msi_alloc(struct rcar_ms
>   return msi;
>  }
>  
> +static int rcar_msi_alloc_region(struct rcar_msi *chip, int no_irqs)
> +{
> + int msi;
> +
> + mutex_lock(&chip->lock);
> + msi = bitmap_find_free_region(chip->used, INT_PCI_MSI_NR,
> +   order_base_2(no_irqs));
> + mutex_unlock(&chip->lock);
> +
> + return msi;
> +}
> +
>  static void rcar_msi_free(struct rcar_msi *chip, unsigned long irq)
>  {
>   mutex_lock(&chip->lock);
> @@ -768,7 +780,7 @@ static int rcar_msi_setup_irq(struct msi
>   if (hwirq < 0)
>   return hwirq;
>  
> - irq = irq_create_mapping(msi->domain, hwirq);
> + irq = irq_find_mapping(msi->domain, hwirq);
>   if (!irq) {
>   rcar_msi_free(msi, hwirq);
>   return -EINVAL;
> @@ -785,6 +797,58 @@ static int rcar_msi_setup_irq(struct msi
>   return 0;
>  }
>  
> +static int rcar_msi_setup_irqs(struct msi_controller *chip,
> +struct pci_dev *pdev, int nvec, int type)
> +{
> + struct rcar_pcie *pcie = container_of(chip, struct rcar_pcie, msi.chip);
> + struct rcar_msi *msi = to_rcar_msi(chip);
> + struct msi_desc *desc;
> + struct msi_msg msg;
> + unsigned int irq;
> + int hwirq;
> + int i;
> +
> + /* MSI-X interrupts are not supported */
> + if (type == PCI_CAP_ID_MSIX)
> + return -EINVAL;
> +
> + WARN_ON(!list_is_singular(&pdev->dev.msi_list));
> + desc = list_entry(pdev->dev.msi_list.next, struct msi_desc, list);
> +
> + hwirq = rcar_msi_alloc_region(msi, nvec);
> + if (hwirq < 0)
> + return -ENOSPC;
> +
> + irq = irq_find_mapping(msi->domain, hwirq);
> + if (!irq)
> + return -ENOSPC;
> +
> + for (i = 0; i < nvec; i++) {
> + /*
> +  * irq_create_mapping() called from rcar_pcie_probe() pre-
> +  * allocates descs,  so there is no need to allocate descs here.
> +  * We can therefore assume that if irq_find_mapping() above
> +  * returns non-zero, then the descs are also successfully
> +  * allocated.
> +  */
> + if (irq_set_msi_desc_off(irq, i, desc)) {
> + /* TODO: clear */
> + return -EINVAL;
> + }
> + }
> +
> + desc->nvec_used = nvec;
> + desc->msi_attrib.multiple = order_base_2(nvec);
> +
> + msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
> + msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
> + msg.data = hwirq;
> +
> + pci_write_msi_msg(irq, &msg);
> +
> + return 0;
> +}
> +
>  static void rcar_msi_teardown_irq(struct msi_controller *chip, unsigned int 
> irq)
>  {
>   struct rcar_msi *msi = to_rcar_msi(chip);
> @@ -819,12 +883,13 @@ static int rcar_pcie_enable_msi(struct r
>   struct platform_device *pdev = to_platform_device(pcie->dev);
>   struct rcar_msi *msi = &pcie->msi;
>   unsigned long base;
> - int err;
> + int err, i;
>  
>   mutex_init(&msi->lock);
>  
>   msi->chip.dev = pcie->dev;
>   msi->chip.setup_irq = rcar_msi_setup_irq;
> + msi->chip.setup_irqs = rcar_msi_setup_irqs;
>   msi->chip.teardown_irq = rcar_msi_teardown_irq;
>  
>   msi->domain = irq_domain_add_linear(pcie->dev->of_node, INT_PCI_MSI_NR,
> @@ -834,6 +899,9 @@ static int rcar_pcie_enable_msi(struct r
>   return -ENOMEM;
>   }
>  
> + for (i = 0; i < INT_PCI_MSI_NR; i++)
> + irq_create_mapping(msi->domain, i);
> +
>   /* Two irqs are for MSI, but they are also used for non-MSI irqs */
>   err = devm_request_irq(&pdev->dev, msi->irq1, rcar_pcie_msi_irq,
>  IRQF_SHARED | IRQF_NO_THREAD,
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pcie-rcar: try setting PCIe speed to 5 GT/s at boot

2016-09-14 Thread Bjorn Helgaas
On Wed, Sep 07, 2016 at 11:22:14PM +0300, Sergei Shtylyov wrote:
> From: Grigory Kletsko 
> 
> Initially, the PCIe link speed is set up only at 2.5 GT/s.
> For better performance,  we're trying to increase link speed to 5 GT/s.
> 
> [Sergei Shtylyov: indented the macro definitions with tabs, renamed the
> SPCHG register bits for consistency, renamed the link speed field/values,
> fixed too long lines, fixed redundancy in clearing the MACSR register bits,
> fixed grammar/typos in  the comments/messages, removed unrelated/useless
> changes, fixed bugs in rcar_rwm32() calls done to set the bits, removed
> unneeded braces, removed non-informative comment, reworded the patch
> summary/description.]
> 
> Signed-off-by: Grigory Kletsko 
> Signed-off-by: Sergei Shtylyov 
> 
> ---
> The patch is against the 'next' branch of Bjorn Helgaas' 'pci.git' repo.
> 
>  drivers/pci/host/pcie-rcar.c |  103 
> +++
>  1 file changed, 103 insertions(+)
> 
> Index: pci/drivers/pci/host/pcie-rcar.c
> ===
> --- pci.orig/drivers/pci/host/pcie-rcar.c
> +++ pci/drivers/pci/host/pcie-rcar.c
> @@ -48,6 +48,10 @@
>  #define  CFINIT  1
>  #define PCIETSTR 0x02004
>  #define  DATA_LINK_ACTIVE1
> +#define PCIEINTR 0x02008
> +#define  PCIEINTMAC  (1 << 13)
> +#define PCIEINTER0x0200C
> +#define  PCIEINTMACE (1 << 13)
>  #define PCIEERRFR0x02020
>  #define  UNSUPPORTED_REQUEST (1 << 4)
>  #define PCIEMSIFR0x02044
> @@ -84,8 +88,21 @@
>  #define IDSETR1  0x011004
>  #define TLCTLR   0x011048
>  #define MACSR0x011054
> +#define  SPCHG   (1 << 5)
> +#define  SPCHGFIN(1 << 4)
> +#define  SPCHGSUC(1 << 7)
> +#define  SPCHGFAIL   (1 << 6)
> +#define  LINK_SPEED  (0xf << 16)
> +#define  LINK_SPEED_2_5GTS   (1 << 16)
> +#define  LINK_SPEED_5_0GTS   (2 << 16)
>  #define MACCTLR  0x011058
> +#define  SPEED_CHANGE(1 << 24)
>  #define  SCRAMBLE_DISABLE(1 << 27)
> +#define MACINTENR0x01106C
> +#define  SPCHGFINE   (1 << 4)
> +#define MACS2R   0x011078
> +#define MACCGSPSETR  0x011084
> +#define  SPCNGRSN(1 << 31)
>  
>  /* R-Car H1 PHY */
>  #define H1_PCIEPHYADRR   0x04000c
> @@ -385,6 +402,51 @@ static int rcar_pcie_setup(struct list_h
>   return 1;
>  }
>  
> +void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
> +{
> + u32 macsr;
> +
> + dev_info(pcie->dev, "Trying speed up to 5 GT/s\n");
> +
> + if ((rcar_pci_read_reg(pcie, MACSR) & SPCHGFIN) ||
> + (rcar_pci_read_reg(pcie, MACCTLR) & SPEED_CHANGE)) {
> + dev_err(pcie->dev, "Speed changing is in progress\n");

Are these messages all really errors?

> + return;
> + }
> +
> + if ((rcar_pci_read_reg(pcie, MACSR) & LINK_SPEED) ==
> + LINK_SPEED_5_0GTS) {
> + dev_err(pcie->dev, "Current link speed is already 5 GT/s\n");
> + return;
> + }
> +
> + if ((rcar_pci_read_reg(pcie, MACS2R) & LINK_SPEED) !=
> + LINK_SPEED_5_0GTS) {
> + dev_err(pcie->dev,
> + "Current max support link speed not 5 GT/s\n");
> + return;
> + }
> +
> + /* Set target link speed to 5.0 GT/s */
> + rcar_rmw32(pcie, EXPCAP(12), PCI_EXP_LNKSTA_CLS,
> +PCI_EXP_LNKSTA_CLS_5_0GB);
> +
> + /* Set speed change reason as intentional factor */
> + rcar_rmw32(pcie, MACCGSPSETR, SPCNGRSN, 0);
> +
> + /* Clear SPCHGFIN, SPCHGSUC, and SPCHGFAIL */
> + macsr = rcar_pci_read_reg(pcie, MACSR);
> + if (macsr & (SPCHGFIN | SPCHGSUC | SPCHGFAIL))
> + rcar_pci_write_reg(pcie, macsr, MACSR);
> +
> + /* Enable interrupt */
> + rcar_rmw32(pcie, MACINTENR, SPCHGFINE, SPCHGFINE);
> + rcar_rmw32(pcie, PCIEINTER, PCIEINTMACE, PCIEINTMACE);
> +
> + /* Start link speed change */
> + rcar_rmw32(pcie, MACCTLR, SPEED_CHANGE, SPEED_CHANGE);
> +}
> +
>  static int rcar_pcie_enable(struct rcar_pcie *pcie)
>  {
>   struct pci_bus *bus, *child;
> @@ -416,6 +478,9 @@ static int rcar_pcie_enable(struct rcar_
>  
>   pci_bus_add_devices(bus);
>  
> + /* Try setting 5 GT/s link speed */
> + rcar_pcie_force_speedup(pcie);

I assume it's safe to change the link speed even while the downstream
devices are in use?  As soon as we call pci_bus_add_devices(), drivers
can claim the devices and start using them.

>   return 0;
>  }
>  
> @@ -621,6 +686,44 @@ static irqreturn_t rcar_pcie_msi_irq(int
>   struct rcar_msi *msi = &pcie->msi;
>   unsigned long reg;
>  
> + if (rcar_pci_read_reg(pcie, PCIEINTR) & PCIEINTMAC) {
> + dev_dbg(pcie->dev, "MAC interrupt received\n");

I guess you don'

Re: [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images

2016-09-14 Thread Laurent Pinchart
Hi Niklas,

On Wednesday 14 Sep 2016 21:27:33 Niklas Söderlund wrote:
> On 2016-09-14 02:17:04 +0300, Laurent Pinchart wrote:
> > From: Kieran Bingham 
> > 
> > The partition algorithm needs to determine the capabilities of each
> > entity in the pipeline to identify the correct maximum partition width.
> > 
> > Extend the vsp1 entity operations to provide a max_width operation and
> > use this call to calculate the number of partitions that will be
> > processed by the algorithm.
> > 
> > Gen 2 hardware does not require multiple partitioning, and as such
> > will always return a single partition.
> > 
> > Signed-off-by: Kieran Bingham 
> > Signed-off-by: Laurent Pinchart
> > 
> 
> I can't find the information about the partition limitations for SRU or
> UDS in any of the documents I have.

That's because it's not documented in the datasheet :-(

> But for the parts not relating to the logic of figuring out the hscale from
> the input/output formats width:
> 
> Reviewed-by: Niklas Söderlund 

Thanks.

-- 
Regards,

Laurent Pinchart



Re: [PATCH 02/13] v4l: vsp1: Protect against race conditions between get and set format

2016-09-14 Thread Laurent Pinchart
Hi Niklas,

Thank you for the review.

On Wednesday 14 Sep 2016 20:23:18 Niklas Söderlund wrote:
> On 2016-09-14 02:16:55 +0300, Laurent Pinchart wrote:
> > The subdev userspace API isn't serialized in the core, serialize access
> > to formats and selection rectangles in the driver.
> > 
> > Signed-off-by: Laurent Pinchart
> > 
> > ---
> > 
> >  drivers/media/platform/vsp1/vsp1_bru.c| 28 +++-
> >  drivers/media/platform/vsp1/vsp1_clu.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_entity.c | 22 +---
> >  drivers/media/platform/vsp1/vsp1_entity.h |  4 ++-
> >  drivers/media/platform/vsp1/vsp1_hsit.c   | 15 ---
> >  drivers/media/platform/vsp1/vsp1_lif.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_lut.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_rwpf.c   | 44 +++---
> >  drivers/media/platform/vsp1/vsp1_sru.c| 26 +-
> >  drivers/media/platform/vsp1/vsp1_uds.c| 26 +-
> >  10 files changed, 161 insertions(+), 49 deletions(-)
> > 
> > diff --git a/drivers/media/platform/vsp1/vsp1_bru.c
> > b/drivers/media/platform/vsp1/vsp1_bru.c index 8268b87727a7..26b9e2282a41
> > 100644
> > --- a/drivers/media/platform/vsp1/vsp1_bru.c
> > +++ b/drivers/media/platform/vsp1/vsp1_bru.c
> > @@ -142,10 +142,15 @@ static int bru_set_format(struct v4l2_subdev
> > *subdev,
> > 
> > struct vsp1_bru *bru = to_bru(subdev);
> > struct v4l2_subdev_pad_config *config;
> > struct v4l2_mbus_framefmt *format;
> > 
> > +   int ret = 0;
> > +
> > +   mutex_lock(&bru->entity.lock);
> > 
> > config = vsp1_entity_get_pad_config(&bru->entity, cfg, fmt->which);
> > 
> > -   if (!config)
> > -   return -EINVAL;
> > +   if (!config) {
> > +   goto done;
> > +   ret = -EINVAL;
> 
> This looks funny to me, you probably intended to do that in the other
> order right?

Oops, good catch !

> If you fix this feel free to add my:
> 
> Acked-by: Niklas Söderlund 

Fixed and applied your ack (with +renesas as mentioned in your other email).

> > +   }
> > 
> > bru_try_format(bru, config, fmt->pad, &fmt->format);

-- 
Regards,

Laurent Pinchart



Re: [PATCH 02/13] v4l: vsp1: Protect against race conditions between get and set format

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 20:23:17 +0200, Niklas Söderlund wrote:
> Hi Laurent,
> 
> Thanks for your patch.
> 
> On 2016-09-14 02:16:55 +0300, Laurent Pinchart wrote:
> > The subdev userspace API isn't serialized in the core, serialize access
> > to formats and selection rectangles in the driver.
> > 
> > Signed-off-by: Laurent Pinchart 
> > ---
> >  drivers/media/platform/vsp1/vsp1_bru.c| 28 +++-
> >  drivers/media/platform/vsp1/vsp1_clu.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_entity.c | 22 +---
> >  drivers/media/platform/vsp1/vsp1_entity.h |  4 ++-
> >  drivers/media/platform/vsp1/vsp1_hsit.c   | 15 ---
> >  drivers/media/platform/vsp1/vsp1_lif.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_lut.c| 15 ---
> >  drivers/media/platform/vsp1/vsp1_rwpf.c   | 44 
> > +++
> >  drivers/media/platform/vsp1/vsp1_sru.c| 26 +-
> >  drivers/media/platform/vsp1/vsp1_uds.c| 26 +-
> >  10 files changed, 161 insertions(+), 49 deletions(-)
> > 
> > diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
> > b/drivers/media/platform/vsp1/vsp1_bru.c
> > index 8268b87727a7..26b9e2282a41 100644
> > --- a/drivers/media/platform/vsp1/vsp1_bru.c
> > +++ b/drivers/media/platform/vsp1/vsp1_bru.c
> > @@ -142,10 +142,15 @@ static int bru_set_format(struct v4l2_subdev *subdev,
> > struct vsp1_bru *bru = to_bru(subdev);
> > struct v4l2_subdev_pad_config *config;
> > struct v4l2_mbus_framefmt *format;
> > +   int ret = 0;
> > +
> > +   mutex_lock(&bru->entity.lock);
> >  
> > config = vsp1_entity_get_pad_config(&bru->entity, cfg, fmt->which);
> > -   if (!config)
> > -   return -EINVAL;
> > +   if (!config) {
> > +   goto done;
> > +   ret = -EINVAL;
> 
> This looks funny to me, you probably intended to do that in the other 
> order right? If you fix this feel free to add my:
> 
> Acked-by: Niklas Söderlund 

Wops, forgot +renesas in the email. If you fix the issue and want to 
collect my Ack, please use:

Acked-by: Niklas Söderlund 

Sorry for the noise.

> 
> > +   }
> >  
> > bru_try_format(bru, config, fmt->pad, &fmt->format);
> >  
> > @@ -174,7 +179,9 @@ static int bru_set_format(struct v4l2_subdev *subdev,
> > }
> > }
> >  
> > -   return 0;
> > +done:
> > +   mutex_unlock(&bru->entity.lock);
> > +   return ret;
> >  }
> >  
> >  static int bru_get_selection(struct v4l2_subdev *subdev,
> > @@ -201,7 +208,9 @@ static int bru_get_selection(struct v4l2_subdev *subdev,
> > if (!config)
> > return -EINVAL;
> >  
> > +   mutex_lock(&bru->entity.lock);
> > sel->r = *bru_get_compose(bru, config, sel->pad);
> > +   mutex_unlock(&bru->entity.lock);
> > return 0;
> >  
> > default:
> > @@ -217,6 +226,7 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
> > struct v4l2_subdev_pad_config *config;
> > struct v4l2_mbus_framefmt *format;
> > struct v4l2_rect *compose;
> > +   int ret = 0;
> >  
> > if (sel->pad == bru->entity.source_pad)
> > return -EINVAL;
> > @@ -224,9 +234,13 @@ static int bru_set_selection(struct v4l2_subdev 
> > *subdev,
> > if (sel->target != V4L2_SEL_TGT_COMPOSE)
> > return -EINVAL;
> >  
> > +   mutex_lock(&bru->entity.lock);
> > +
> > config = vsp1_entity_get_pad_config(&bru->entity, cfg, sel->which);
> > -   if (!config)
> > -   return -EINVAL;
> > +   if (!config) {
> > +   ret = -EINVAL;
> > +   goto done;
> > +   }
> >  
> > /* The compose rectangle top left corner must be inside the output
> >  * frame.
> > @@ -246,7 +260,9 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
> > compose = bru_get_compose(bru, config, sel->pad);
> > *compose = sel->r;
> >  
> > -   return 0;
> > +done:
> > +   mutex_unlock(&bru->entity.lock);
> > +   return ret;
> >  }
> >  
> >  static const struct v4l2_subdev_pad_ops bru_pad_ops = {
> > diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
> > b/drivers/media/platform/vsp1/vsp1_clu.c
> > index b63d2dbe5ea3..e1fd03811dda 100644
> > --- a/drivers/media/platform/vsp1/vsp1_clu.c
> > +++ b/drivers/media/platform/vsp1/vsp1_clu.c
> > @@ -148,10 +148,15 @@ static int clu_set_format(struct v4l2_subdev *subdev,
> > struct vsp1_clu *clu = to_clu(subdev);
> > struct v4l2_subdev_pad_config *config;
> > struct v4l2_mbus_framefmt *format;
> > +   int ret = 0;
> > +
> > +   mutex_lock(&clu->entity.lock);
> >  
> > config = vsp1_entity_get_pad_config(&clu->entity, cfg, fmt->which);
> > -   if (!config)
> > -   return -EINVAL;
> > +   if (!config) {
> > +   ret = -EINVAL;
> > +   goto done;
> > +   }
> >  
> > /* Default to YUV if the requested format is not supported. */
> > if (fmt->format.code != MEDIA_BUS_FMT_ARGB_1X32 &&
> > @@ -164,7 +169,7 @@ static int clu_set_format(

Re: [PATCH 14/13] v4l: vsp1: Fix spinlock in mixed IRQ context function

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:29:08 +0300, Laurent Pinchart wrote:
> The wpf_configure() function can be called both from IRQ and non-IRQ
> contexts, use spin_lock_irqsave().
> 
> Signed-off-by: Laurent Pinchart 

Acked-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_wpf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
> b/drivers/media/platform/vsp1/vsp1_wpf.c
> index b4ecffbaa3e3..c483fead3e98 100644
> --- a/drivers/media/platform/vsp1/vsp1_wpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_wpf.c
> @@ -251,11 +251,12 @@ static void wpf_configure(struct vsp1_entity *entity,
>   if (params == VSP1_ENTITY_PARAMS_RUNTIME) {
>   const unsigned int mask = BIT(WPF_CTRL_VFLIP)
>   | BIT(WPF_CTRL_HFLIP);
> + unsigned long flags;
>  
> - spin_lock(&wpf->flip.lock);
> + spin_lock_irqsave(&wpf->flip.lock, flags);
>   wpf->flip.active = (wpf->flip.active & ~mask)
>| (wpf->flip.pending & mask);
> - spin_unlock(&wpf->flip.lock);
> + spin_unlock_irqrestore(&wpf->flip.lock, flags);
>  
>   outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt;
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund


Re: [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:17:04 +0300, Laurent Pinchart wrote:
> From: Kieran Bingham 
> 
> The partition algorithm needs to determine the capabilities of each
> entity in the pipeline to identify the correct maximum partition width.
> 
> Extend the vsp1 entity operations to provide a max_width operation and
> use this call to calculate the number of partitions that will be
> processed by the algorithm.
> 
> Gen 2 hardware does not require multiple partitioning, and as such
> will always return a single partition.
> 
> Signed-off-by: Kieran Bingham 
> Signed-off-by: Laurent Pinchart 

I can't find the information about the partition limitations for SRU or 
UDS in any of the documents I have. But for the parts not relating to 
the logic of figuring out the hscale from the input/output formats 
width:

Reviewed-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_entity.h |  3 +++
>  drivers/media/platform/vsp1/vsp1_pipe.h   |  5 
>  drivers/media/platform/vsp1/vsp1_sru.c| 19 +++
>  drivers/media/platform/vsp1/vsp1_uds.c| 25 +++
>  drivers/media/platform/vsp1/vsp1_video.c  | 40 
> +++
>  5 files changed, 92 insertions(+)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_entity.h 
> b/drivers/media/platform/vsp1/vsp1_entity.h
> index 0e3e394c44cd..90a4d95c0a50 100644
> --- a/drivers/media/platform/vsp1/vsp1_entity.h
> +++ b/drivers/media/platform/vsp1/vsp1_entity.h
> @@ -77,11 +77,14 @@ struct vsp1_route {
>   * @destroy: Destroy the entity.
>   * @configure:   Setup the hardware based on the entity state (pipeline, 
> formats,
>   *   selection rectangles, ...)
> + * @max_width:   Return the max supported width of data that the entity 
> can
> + *   process in a single operation.
>   */
>  struct vsp1_entity_operations {
>   void (*destroy)(struct vsp1_entity *);
>   void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *,
> struct vsp1_dl_list *, enum vsp1_entity_params);
> + unsigned int (*max_width)(struct vsp1_entity *, struct vsp1_pipeline *);
>  };
>  
>  struct vsp1_entity {
> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
> b/drivers/media/platform/vsp1/vsp1_pipe.h
> index d20d997b1fda..af4cd23d399b 100644
> --- a/drivers/media/platform/vsp1/vsp1_pipe.h
> +++ b/drivers/media/platform/vsp1/vsp1_pipe.h
> @@ -77,6 +77,8 @@ enum vsp1_pipeline_state {
>   * @uds_input: entity at the input of the UDS, if the UDS is present
>   * @entities: list of entities in the pipeline
>   * @dl: display list associated with the pipeline
> + * @div_size: The maximum allowed partition size for the pipeline
> + * @partitions: The number of partitions used to process one frame
>   */
>  struct vsp1_pipeline {
>   struct media_pipeline pipe;
> @@ -104,6 +106,9 @@ struct vsp1_pipeline {
>   struct list_head entities;
>  
>   struct vsp1_dl_list *dl;
> +
> + unsigned int div_size;
> + unsigned int partitions;
>  };
>  
>  void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
> diff --git a/drivers/media/platform/vsp1/vsp1_sru.c 
> b/drivers/media/platform/vsp1/vsp1_sru.c
> index 9d4a1afb6634..b4e568a3b4ed 100644
> --- a/drivers/media/platform/vsp1/vsp1_sru.c
> +++ b/drivers/media/platform/vsp1/vsp1_sru.c
> @@ -306,8 +306,27 @@ static void sru_configure(struct vsp1_entity *entity,
>   vsp1_sru_write(sru, dl, VI6_SRU_CTRL2, param->ctrl2);
>  }
>  
> +static unsigned int sru_max_width(struct vsp1_entity *entity,
> +   struct vsp1_pipeline *pipe)
> +{
> + struct vsp1_sru *sru = to_sru(&entity->subdev);
> + struct v4l2_mbus_framefmt *input;
> + struct v4l2_mbus_framefmt *output;
> +
> + input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config,
> +SRU_PAD_SINK);
> + output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config,
> + SRU_PAD_SOURCE);
> +
> + if (input->width != output->width)
> + return 512;
> + else
> + return 256;
> +}
> +
>  static const struct vsp1_entity_operations sru_entity_ops = {
>   .configure = sru_configure,
> + .max_width = sru_max_width,
>  };
>  
>  /* 
> -
> diff --git a/drivers/media/platform/vsp1/vsp1_uds.c 
> b/drivers/media/platform/vsp1/vsp1_uds.c
> index 62beae5d6944..706b6e85f47d 100644
> --- a/drivers/media/platform/vsp1/vsp1_uds.c
> +++ b/drivers/media/platform/vsp1/vsp1_uds.c
> @@ -311,8 +311,33 @@ static void uds_configure(struct vsp1_entity *entity,
>  (output->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
>  }
>  
> +static unsigned int uds_max_width(struct vsp1_entity *entity,
> +   struct vsp1_pipeline *pipe)
> +{
> + struct vsp1_uds *uds = to_uds(&entity->subdev);
> + const struct v4l2_mbus_framefmt *output;
>

Re: [PATCH 08/13] v4l: vsp1: Pass parameter type to entity configuration operation

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:17:01 +0300, Laurent Pinchart wrote:
> Replace the current boolean parameter (full / !full) with an explicit
> enum.
> 
> - VSP1_ENTITY_PARAMS_INIT for parameters to be configured at pipeline
>   initialization time only (V4L2 stream on or DRM atomic update)
> - VSP1_ENTITY_PARAMS_RUNTIME for all parameters that can be freely
>   modified at runtime (through V4L2 controls)
> 
> This will allow future extensions when implementing image partitioning
> support.
> 
> Signed-off-by: Laurent Pinchart 

Acked-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_bru.c|  5 ++--
>  drivers/media/platform/vsp1/vsp1_clu.c| 43 
> +--
>  drivers/media/platform/vsp1/vsp1_drm.c|  6 +++--
>  drivers/media/platform/vsp1/vsp1_entity.h | 12 -
>  drivers/media/platform/vsp1/vsp1_hsit.c   |  5 ++--
>  drivers/media/platform/vsp1/vsp1_lif.c|  5 ++--
>  drivers/media/platform/vsp1/vsp1_lut.c| 24 ++---
>  drivers/media/platform/vsp1/vsp1_rpf.c|  5 ++--
>  drivers/media/platform/vsp1/vsp1_sru.c|  5 ++--
>  drivers/media/platform/vsp1/vsp1_uds.c|  5 ++--
>  drivers/media/platform/vsp1/vsp1_video.c  |  6 +++--
>  drivers/media/platform/vsp1/vsp1_wpf.c|  5 ++--
>  12 files changed, 78 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
> b/drivers/media/platform/vsp1/vsp1_bru.c
> index 26b9e2282a41..80fb948860d5 100644
> --- a/drivers/media/platform/vsp1/vsp1_bru.c
> +++ b/drivers/media/platform/vsp1/vsp1_bru.c
> @@ -285,14 +285,15 @@ static const struct v4l2_subdev_ops bru_ops = {
>  
>  static void bru_configure(struct vsp1_entity *entity,
> struct vsp1_pipeline *pipe,
> -   struct vsp1_dl_list *dl, bool full)
> +   struct vsp1_dl_list *dl,
> +   enum vsp1_entity_params params)
>  {
>   struct vsp1_bru *bru = to_bru(&entity->subdev);
>   struct v4l2_mbus_framefmt *format;
>   unsigned int flags;
>   unsigned int i;
>  
> - if (!full)
> + if (params != VSP1_ENTITY_PARAMS_INIT)
>   return;
>  
>   format = vsp1_entity_get_pad_format(&bru->entity, bru->entity.config,
> diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
> b/drivers/media/platform/vsp1/vsp1_clu.c
> index e1fd03811dda..a0a69dfc38fc 100644
> --- a/drivers/media/platform/vsp1/vsp1_clu.c
> +++ b/drivers/media/platform/vsp1/vsp1_clu.c
> @@ -214,42 +214,47 @@ static const struct v4l2_subdev_ops clu_ops = {
>  
>  static void clu_configure(struct vsp1_entity *entity,
> struct vsp1_pipeline *pipe,
> -   struct vsp1_dl_list *dl, bool full)
> +   struct vsp1_dl_list *dl,
> +   enum vsp1_entity_params params)
>  {
>   struct vsp1_clu *clu = to_clu(&entity->subdev);
>   struct vsp1_dl_body *dlb;
>   unsigned long flags;
>   u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN;
>  
> - /* The format can't be changed during streaming, only verify it at
> -  * stream start and store the information internally for future partial
> -  * reconfiguration calls.
> -  */
> - if (full) {
> + switch (params) {
> + case VSP1_ENTITY_PARAMS_INIT: {
> + /* The format can't be changed during streaming, only verify it
> +  * at setup time and store the information internally for future
> +  * runtime configuration calls.
> +  */
>   struct v4l2_mbus_framefmt *format;
>  
>   format = vsp1_entity_get_pad_format(&clu->entity,
>   clu->entity.config,
>   CLU_PAD_SINK);
>   clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32;
> - return;
> + break;
>   }
>  
> - /* 2D mode can only be used with the YCbCr pixel encoding. */
> - if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode)
> - ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D
> -  |  VI6_CLU_CTRL_OS0_2D | VI6_CLU_CTRL_OS1_2D
> -  |  VI6_CLU_CTRL_OS2_2D | VI6_CLU_CTRL_M2D;
> + case VSP1_ENTITY_PARAMS_RUNTIME:
> + /* 2D mode can only be used with the YCbCr pixel encoding. */
> + if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode)
> + ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D
> +  |  VI6_CLU_CTRL_OS0_2D | VI6_CLU_CTRL_OS1_2D
> +  |  VI6_CLU_CTRL_OS2_2D | VI6_CLU_CTRL_M2D;
>  
> - vsp1_clu_write(clu, dl, VI6_CLU_CTRL, ctrl);
> + vsp1_clu_write(clu, dl, VI6_CLU_CTRL, ctrl);
>  
> - spin_lock_irqsave(&clu->lock, flags);
> - dlb = clu->clu;
> - clu->clu = NULL;
> - spin_unlock_irqrestore(&clu->lock, flags);
> + spin_lock

Re: [PATCH 06/13] v4l: vsp1: Disable cropping on WPF sink pad

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:16:59 +0300, Laurent Pinchart wrote:
> Cropping on the WPF sink pad restricts the left and top coordinates to
> 0-255. The same result can be obtained by cropping on the RPF without
> any such restriction, this feature isn't useful. Disable it.
> 
> Signed-off-by: Laurent Pinchart 

Acked-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_rwpf.c | 37 
> +
>  drivers/media/platform/vsp1/vsp1_wpf.c  | 18 +++-
>  2 files changed, 26 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c 
> b/drivers/media/platform/vsp1/vsp1_rwpf.c
> index 8cb87e96b78b..a3ace8df7f4d 100644
> --- a/drivers/media/platform/vsp1/vsp1_rwpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c
> @@ -66,7 +66,6 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
>   struct vsp1_rwpf *rwpf = to_rwpf(subdev);
>   struct v4l2_subdev_pad_config *config;
>   struct v4l2_mbus_framefmt *format;
> - struct v4l2_rect *crop;
>   int ret = 0;
>  
>   mutex_lock(&rwpf->entity.lock);
> @@ -103,12 +102,16 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev 
> *subdev,
>  
>   fmt->format = *format;
>  
> - /* Update the sink crop rectangle. */
> - crop = vsp1_rwpf_get_crop(rwpf, config);
> - crop->left = 0;
> - crop->top = 0;
> - crop->width = fmt->format.width;
> - crop->height = fmt->format.height;
> + if (rwpf->entity.type == VSP1_ENTITY_RPF) {
> + struct v4l2_rect *crop;
> +
> + /* Update the sink crop rectangle. */
> + crop = vsp1_rwpf_get_crop(rwpf, config);
> + crop->left = 0;
> + crop->top = 0;
> + crop->width = fmt->format.width;
> + crop->height = fmt->format.height;
> + }
>  
>   /* Propagate the format to the source pad. */
>   format = vsp1_entity_get_pad_format(&rwpf->entity, config,
> @@ -129,8 +132,10 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev 
> *subdev,
>   struct v4l2_mbus_framefmt *format;
>   int ret = 0;
>  
> - /* Cropping is implemented on the sink pad. */
> - if (sel->pad != RWPF_PAD_SINK)
> + /* Cropping is only supported on the RPF and is implemented on the sink
> +  * pad.
> +  */
> + if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK)
>   return -EINVAL;
>  
>   mutex_lock(&rwpf->entity.lock);
> @@ -175,8 +180,10 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev 
> *subdev,
>   struct v4l2_rect *crop;
>   int ret = 0;
>  
> - /* Cropping is implemented on the sink pad. */
> - if (sel->pad != RWPF_PAD_SINK)
> + /* Cropping is only supported on the RPF and is implemented on the sink
> +  * pad.
> +  */
> + if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK)
>   return -EINVAL;
>  
>   if (sel->target != V4L2_SEL_TGT_CROP)
> @@ -190,9 +197,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev 
> *subdev,
>   goto done;
>   }
>  
> - /* Make sure the crop rectangle is entirely contained in the image. The
> -  * WPF top and left offsets are limited to 255.
> -  */
> + /* Make sure the crop rectangle is entirely contained in the image. */
>   format = vsp1_entity_get_pad_format(&rwpf->entity, config,
>   RWPF_PAD_SINK);
>  
> @@ -208,10 +213,6 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev 
> *subdev,
>  
>   sel->r.left = min_t(unsigned int, sel->r.left, format->width - 2);
>   sel->r.top = min_t(unsigned int, sel->r.top, format->height - 2);
> - if (rwpf->entity.type == VSP1_ENTITY_WPF) {
> - sel->r.left = min_t(unsigned int, sel->r.left, 255);
> - sel->r.top = min_t(unsigned int, sel->r.top, 255);
> - }
>   sel->r.width = min_t(unsigned int, sel->r.width,
>format->width - sel->r.left);
>   sel->r.height = min_t(unsigned int, sel->r.height,
> diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
> b/drivers/media/platform/vsp1/vsp1_wpf.c
> index 748f5af90b7e..f3a593196282 100644
> --- a/drivers/media/platform/vsp1/vsp1_wpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_wpf.c
> @@ -212,7 +212,6 @@ static void wpf_configure(struct vsp1_entity *entity,
>   struct vsp1_device *vsp1 = wpf->entity.vsp1;
>   const struct v4l2_mbus_framefmt *source_format;
>   const struct v4l2_mbus_framefmt *sink_format;
> - const struct v4l2_rect *crop;
>   unsigned int i;
>   u32 outfmt = 0;
>   u32 srcrpf = 0;
> @@ -237,16 +236,6 @@ static void wpf_configure(struct vsp1_entity *entity,
>   return;
>   }
>  
> - /* Cropping */
> - crop = vsp1_rwpf_get_crop(wpf, wpf->entity.config);
> -
> - vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |
> -(crop->left << VI6_WPF_SZCLIP_OFST_SHIFT) 

Re: [PATCH 05/13] v4l: vsp1: Use DFE instead of FRE for frame end

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:16:58 +0300, Laurent Pinchart wrote:
> From: Kieran Bingham 
> 
> The DFE and FRE interrupts are both fired at frame completion, as each
> display list processes a single frame. This won't be true anymore when
> using image partitioning, switch to DFE in preparation.
> 
> Signed-off-by: Laurent Pinchart 
> Signed-off-by: Kieran Bingham 

Acked-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_drv.c | 2 +-
>  drivers/media/platform/vsp1/vsp1_wpf.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
> b/drivers/media/platform/vsp1/vsp1_drv.c
> index 92418fc09511..57c713a4e1df 100644
> --- a/drivers/media/platform/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/vsp1/vsp1_drv.c
> @@ -60,7 +60,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
>   status = vsp1_read(vsp1, VI6_WPF_IRQ_STA(i));
>   vsp1_write(vsp1, VI6_WPF_IRQ_STA(i), ~status & mask);
>  
> - if (status & VI6_WFP_IRQ_STA_FRE) {
> + if (status & VI6_WFP_IRQ_STA_DFE) {
>   vsp1_pipeline_frame_end(wpf->pipe);
>   ret = IRQ_HANDLED;
>   }
> diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c 
> b/drivers/media/platform/vsp1/vsp1_wpf.c
> index 31983169c24a..748f5af90b7e 100644
> --- a/drivers/media/platform/vsp1/vsp1_wpf.c
> +++ b/drivers/media/platform/vsp1/vsp1_wpf.c
> @@ -318,7 +318,7 @@ static void wpf_configure(struct vsp1_entity *entity,
>   /* Enable interrupts */
>   vsp1_dl_list_write(dl, VI6_WPF_IRQ_STA(wpf->entity.index), 0);
>   vsp1_dl_list_write(dl, VI6_WPF_IRQ_ENB(wpf->entity.index),
> -VI6_WFP_IRQ_ENB_FREE);
> +VI6_WFP_IRQ_ENB_DFEE);
>  }
>  
>  static const struct vsp1_entity_operations wpf_entity_ops = {
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund


Re: [PATCH 03/13] v4l: vsp1: Ensure pipeline locking in resume path

2016-09-14 Thread Niklas Söderlund
On 2016-09-14 02:16:56 +0300, Laurent Pinchart wrote:
> From: Kieran Bingham 
> 
> The vsp1_pipeline_ready() and vsp1_pipeline_run() functions must be
> called with the pipeline lock held, fix the resume code path.
> 
> Signed-off-by: Kieran Bingham 
> Signed-off-by: Laurent Pinchart 

Acked-by: Niklas Söderlund 

> ---
>  drivers/media/platform/vsp1/vsp1_pipe.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
> b/drivers/media/platform/vsp1/vsp1_pipe.c
> index 3e75fb3fcace..474de82165d8 100644
> --- a/drivers/media/platform/vsp1/vsp1_pipe.c
> +++ b/drivers/media/platform/vsp1/vsp1_pipe.c
> @@ -365,6 +365,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
>  
>  void vsp1_pipelines_resume(struct vsp1_device *vsp1)
>  {
> + unsigned long flags;
>   unsigned int i;
>  
>   /* Resume all running pipelines. */
> @@ -379,7 +380,9 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1)
>   if (pipe == NULL)
>   continue;
>  
> + spin_lock_irqsave(&pipe->irqlock, flags);
>   if (vsp1_pipeline_ready(pipe))
>   vsp1_pipeline_run(pipe);
> + spin_unlock_irqrestore(&pipe->irqlock, flags);
>   }
>  }
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund


Re: [PATCH 02/13] v4l: vsp1: Protect against race conditions between get and set format

2016-09-14 Thread Niklas Söderlund
Hi Laurent,

Thanks for your patch.

On 2016-09-14 02:16:55 +0300, Laurent Pinchart wrote:
> The subdev userspace API isn't serialized in the core, serialize access
> to formats and selection rectangles in the driver.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/media/platform/vsp1/vsp1_bru.c| 28 +++-
>  drivers/media/platform/vsp1/vsp1_clu.c| 15 ---
>  drivers/media/platform/vsp1/vsp1_entity.c | 22 +---
>  drivers/media/platform/vsp1/vsp1_entity.h |  4 ++-
>  drivers/media/platform/vsp1/vsp1_hsit.c   | 15 ---
>  drivers/media/platform/vsp1/vsp1_lif.c| 15 ---
>  drivers/media/platform/vsp1/vsp1_lut.c| 15 ---
>  drivers/media/platform/vsp1/vsp1_rwpf.c   | 44 
> +++
>  drivers/media/platform/vsp1/vsp1_sru.c| 26 +-
>  drivers/media/platform/vsp1/vsp1_uds.c| 26 +-
>  10 files changed, 161 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_bru.c 
> b/drivers/media/platform/vsp1/vsp1_bru.c
> index 8268b87727a7..26b9e2282a41 100644
> --- a/drivers/media/platform/vsp1/vsp1_bru.c
> +++ b/drivers/media/platform/vsp1/vsp1_bru.c
> @@ -142,10 +142,15 @@ static int bru_set_format(struct v4l2_subdev *subdev,
>   struct vsp1_bru *bru = to_bru(subdev);
>   struct v4l2_subdev_pad_config *config;
>   struct v4l2_mbus_framefmt *format;
> + int ret = 0;
> +
> + mutex_lock(&bru->entity.lock);
>  
>   config = vsp1_entity_get_pad_config(&bru->entity, cfg, fmt->which);
> - if (!config)
> - return -EINVAL;
> + if (!config) {
> + goto done;
> + ret = -EINVAL;

This looks funny to me, you probably intended to do that in the other 
order right? If you fix this feel free to add my:

Acked-by: Niklas Söderlund 

> + }
>  
>   bru_try_format(bru, config, fmt->pad, &fmt->format);
>  
> @@ -174,7 +179,9 @@ static int bru_set_format(struct v4l2_subdev *subdev,
>   }
>   }
>  
> - return 0;
> +done:
> + mutex_unlock(&bru->entity.lock);
> + return ret;
>  }
>  
>  static int bru_get_selection(struct v4l2_subdev *subdev,
> @@ -201,7 +208,9 @@ static int bru_get_selection(struct v4l2_subdev *subdev,
>   if (!config)
>   return -EINVAL;
>  
> + mutex_lock(&bru->entity.lock);
>   sel->r = *bru_get_compose(bru, config, sel->pad);
> + mutex_unlock(&bru->entity.lock);
>   return 0;
>  
>   default:
> @@ -217,6 +226,7 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
>   struct v4l2_subdev_pad_config *config;
>   struct v4l2_mbus_framefmt *format;
>   struct v4l2_rect *compose;
> + int ret = 0;
>  
>   if (sel->pad == bru->entity.source_pad)
>   return -EINVAL;
> @@ -224,9 +234,13 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
>   if (sel->target != V4L2_SEL_TGT_COMPOSE)
>   return -EINVAL;
>  
> + mutex_lock(&bru->entity.lock);
> +
>   config = vsp1_entity_get_pad_config(&bru->entity, cfg, sel->which);
> - if (!config)
> - return -EINVAL;
> + if (!config) {
> + ret = -EINVAL;
> + goto done;
> + }
>  
>   /* The compose rectangle top left corner must be inside the output
>* frame.
> @@ -246,7 +260,9 @@ static int bru_set_selection(struct v4l2_subdev *subdev,
>   compose = bru_get_compose(bru, config, sel->pad);
>   *compose = sel->r;
>  
> - return 0;
> +done:
> + mutex_unlock(&bru->entity.lock);
> + return ret;
>  }
>  
>  static const struct v4l2_subdev_pad_ops bru_pad_ops = {
> diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
> b/drivers/media/platform/vsp1/vsp1_clu.c
> index b63d2dbe5ea3..e1fd03811dda 100644
> --- a/drivers/media/platform/vsp1/vsp1_clu.c
> +++ b/drivers/media/platform/vsp1/vsp1_clu.c
> @@ -148,10 +148,15 @@ static int clu_set_format(struct v4l2_subdev *subdev,
>   struct vsp1_clu *clu = to_clu(subdev);
>   struct v4l2_subdev_pad_config *config;
>   struct v4l2_mbus_framefmt *format;
> + int ret = 0;
> +
> + mutex_lock(&clu->entity.lock);
>  
>   config = vsp1_entity_get_pad_config(&clu->entity, cfg, fmt->which);
> - if (!config)
> - return -EINVAL;
> + if (!config) {
> + ret = -EINVAL;
> + goto done;
> + }
>  
>   /* Default to YUV if the requested format is not supported. */
>   if (fmt->format.code != MEDIA_BUS_FMT_ARGB_1X32 &&
> @@ -164,7 +169,7 @@ static int clu_set_format(struct v4l2_subdev *subdev,
>   if (fmt->pad == CLU_PAD_SOURCE) {
>   /* The CLU output format can't be modified. */
>   fmt->format = *format;
> - return 0;
> + goto done;
>   }
>  
>   format->code = fmt->format.code;
> @@ -182,7 +187,9 @@ static int clu_set_format(struct v4l2_subdev *su

Re: [git pull] clk: renesas: Updates for v4.9 (take three)

2016-09-14 Thread Stephen Boyd
On 09/14, Geert Uytterhoeven wrote:
>   Hi Mike, Stephen,
> 
> The following changes since commit 074969813350cda4c624a585489cc1b3550414bc:
> 
>   clk: renesas: r8a7796: Add SDIF clocks (2016-08-23 10:30:41 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git 
> tags/clk-renesas-for-v4.9-tag3
> 
> for you to fetch changes up to 5fad71f58f4c236118358c98f65a7251e9c718f7:
> 
>   clk: renesas: r8a7796: Add CMT clocks (2016-09-12 11:08:01 +0200)

Thanks. Pulled.

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


[PATCH 1/2] arm64: dts: r8a7795: salvator: enable on-board eMMC

2016-09-14 Thread Wolfram Sang
Signed-off-by: Wolfram Sang 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 ++
 1 file changed, 43 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 8964b1ea3cea69..c299919e5e2fdc 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -62,6 +62,24 @@
clock-frequency = <24576000>;
};
 
+   reg_1p8v: regulator0 {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator1 {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
vcc_sdhi0: regulator-vcc-sdhi0 {
compatible = "regulator-fixed";
 
@@ -246,6 +264,18 @@
power-source = <1800>;
};
 
+   sdhi2_pins: sd2 {
+   groups = "sdhi2_data8", "sdhi2_ctrl";
+   function = "sdhi2";
+   power-source = <3300>;
+   };
+
+   sdhi2_pins_uhs: sd2 {
+   groups = "sdhi2_data8", "sdhi2_ctrl";
+   function = "sdhi2";
+   power-source = <1800>;
+   };
+
sdhi3_pins: sd3 {
groups = "sdhi3_data4", "sdhi3_ctrl";
function = "sdhi3";
@@ -398,6 +428,19 @@
status = "okay";
 };
 
+&sdhi2 {
+   /* used for on-board 8bit eMMC */
+   pinctrl-0 = <&sdhi2_pins>;
+   pinctrl-1 = <&sdhi2_pins_uhs>;
+   pinctrl-names = "default", "state_uhs";
+
+   vmmc-supply = <®_3p3v>;
+   vqmmc-supply = <®_1p8v>;
+   bus-width = <8>;
+   status = "okay";
+   /* 'non-removable;' does not work currently. Needs PM fixes. */
+};
+
 &sdhi3 {
pinctrl-0 = <&sdhi3_pins>;
pinctrl-1 = <&sdhi3_pins_uhs>;
-- 
2.9.3



[PATCH 2/2] arm64: dts: r8a7796: salvator: enable on board eMMC

2016-09-14 Thread Wolfram Sang
Signed-off-by: Wolfram Sang 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 44 +-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 91440eb2237e72..db27615fc6ff9f 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -31,6 +31,24 @@
reg = <0x0 0x4800 0x0 0x7800>;
};
 
+   reg_1p8v: regulator0 {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator1 {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
vcc_sdhi0: regulator-vcc-sdhi0 {
compatible = "regulator-fixed";
 
@@ -78,7 +96,6 @@
states = <330 1
  180 0>;
};
-
 };
 
 &pfc {
@@ -106,6 +123,18 @@
power-source = <1800>;
};
 
+   sdhi2_pins: sd2 {
+   groups = "sdhi2_data8", "sdhi2_ctrl";
+   function = "sdhi2";
+   power-source = <3300>;
+   };
+
+   sdhi2_pins_uhs: sd2 {
+   groups = "sdhi2_data8", "sdhi2_ctrl";
+   function = "sdhi2";
+   power-source = <1800>;
+   };
+
sdhi3_pins: sd3 {
groups = "sdhi3_data4", "sdhi3_ctrl";
function = "sdhi3";
@@ -138,6 +167,19 @@
status = "okay";
 };
 
+&sdhi2 {
+   /* used for on-board 8bit eMMC */
+   pinctrl-0 = <&sdhi2_pins>;
+   pinctrl-1 = <&sdhi2_pins_uhs>;
+   pinctrl-names = "default", "state_uhs";
+
+   vmmc-supply = <®_3p3v>;
+   vqmmc-supply = <®_1p8v>;
+   bus-width = <8>;
+   status = "okay";
+   /* 'non-removable;' does not work currently. Needs PM fixes. */
+};
+
 &sdhi3 {
pinctrl-0 = <&sdhi3_pins>;
pinctrl-1 = <&sdhi3_pins_uhs>;
-- 
2.9.3



[PATCH 0/2] gen3: dts: enable on-board eMMC

2016-09-14 Thread Wolfram Sang
From: Wolfram Sang 

Here are the DTS changes to enable the on-board eMMC memory at 8 bit bus
widths on R-Car Gen3 Salvator-X boards.

Note that 'non-removable' is not supported yet because of Runtime PM issues. It
seems we need to overhaul Runtime PM handling for other reasons as well, so I
suggest the basic support goes in like this and DTS do not use 'non-removable'
for now.

Note also that I decided to use the pattern that pinctrl-0 is 3.3v and
pinctrl-1 is 1.8v, although the eMMC is fixed at 1.8v. I tried a few ways to
only use pinctrl-0 being 1.8v here, but they all ended up to be confusing for
users IMO, so I sticked to the most consistent solution after all.

These patches are based on top of Simon's sdr104-v7 patches and the accompanied
driver patches sent a minute ago. A branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
renesas/topic/sdhi-8bit-emmc

Please review, comment, apply...

   Wolfram

Wolfram Sang (2):
  arm64: dts: r8a7795: salvator: enable on-board eMMC
  arm64: dts: r8a7796: salvator: enable on board eMMC

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 +
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 44 +-
 2 files changed, 86 insertions(+), 1 deletion(-)

-- 
2.9.3



[PATCH 3/4] mmc: rtsx_usb: use new macro for R1 without CRC

2016-09-14 Thread Wolfram Sang
Signed-off-by: Wolfram Sang 
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c 
b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 6c71fc9f76c7ec..4106295527b9d0 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -324,7 +324,7 @@ static void sd_send_cmd_get_rsp(struct rtsx_usb_sdmmc *host,
case MMC_RSP_R1:
rsp_type = SD_RSP_TYPE_R1;
break;
-   case MMC_RSP_R1 & ~MMC_RSP_CRC:
+   case MMC_RSP_R1_NO_CRC:
rsp_type = SD_RSP_TYPE_R1 | SD_NO_CHECK_CRC7;
break;
case MMC_RSP_R1B:
-- 
2.9.3



[PATCH 1/4] mmc: add define for R1 response without CRC

2016-09-14 Thread Wolfram Sang
The core uses it for polling. Give drivers a proper define to handle
this case like all other response types.

Signed-off-by: Wolfram Sang 
---
 include/linux/mmc/core.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b01e77de1a74de..4caee099b63a28 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -55,6 +55,9 @@ struct mmc_command {
 #define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
 #define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
 
+/* Can be used by core to poll after switch to MMC HS mode */
+#define MMC_RSP_R1_NO_CRC  (MMC_RSP_PRESENT|MMC_RSP_OPCODE)
+
 #define mmc_resp_type(cmd) ((cmd)->flags & 
(MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
 
 /*
-- 
2.9.3



[PATCH 2/4] mmc: rtsx_pci: use new macro for R1 without CRC

2016-09-14 Thread Wolfram Sang
Signed-off-by: Wolfram Sang 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 396c9b7e4121b0..3ccaa1415f33b2 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -126,7 +126,7 @@ static int sd_response_type(struct mmc_command *cmd)
return SD_RSP_TYPE_R0;
case MMC_RSP_R1:
return SD_RSP_TYPE_R1;
-   case MMC_RSP_R1 & ~MMC_RSP_CRC:
+   case MMC_RSP_R1_NO_CRC:
return SD_RSP_TYPE_R1 | SD_NO_CHECK_CRC7;
case MMC_RSP_R1B:
return SD_RSP_TYPE_R1b;
-- 
2.9.3



[PATCH 0/4] tmio: add support for eMMC with 8 bit bus width

2016-09-14 Thread Wolfram Sang
From: Wolfram Sang 

This series enables SDHI instances on R-Car Gen3 to access eMMC with 8 bit bus
width. I think the patch descriptions speak for themselves.

I decided to not protect this new feature with a flag because it needs
specifically to be enabled by setting the bus width to 8. No legacy platform
does that.

The DTS changes for R-Car Gen3 will come via a seperate series. Note that
'non-removable' is not supported yet because of Runtime PM issues. It seems we
need to overhaul Runtime PM handling for other reasons as well, so I suggest
the basic support goes in like this and DTS do not use 'non-removable' for now.

These patches are based on top of Simon's sdr104-v7 patches but they apply to
current mmc/next as well. A branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
renesas/topic/sdhi-8bit-emmc-driver

Please review, comment, apply...

   Wolfram


Wolfram Sang (4):
  mmc: add define for R1 response without CRC
  mmc: rtsx_pci: use new macro for R1 without CRC
  mmc: rtsx_usb: use new macro for R1 without CRC
  mmc: tmio: add eMMC support

 drivers/mmc/host/rtsx_pci_sdmmc.c |  2 +-
 drivers/mmc/host/rtsx_usb_sdmmc.c |  2 +-
 drivers/mmc/host/tmio_mmc.h   |  3 +++
 drivers/mmc/host/tmio_mmc_pio.c   | 29 +
 include/linux/mmc/core.h  |  3 +++
 5 files changed, 25 insertions(+), 14 deletions(-)

-- 
2.9.3



[PATCH 4/4] mmc: tmio: add eMMC support

2016-09-14 Thread Wolfram Sang
We need to add R1 without CRC support, refactor the bus width routine a
little and extend a quirk check.

Signed-off-by: Wolfram Sang 
---
 drivers/mmc/host/tmio_mmc.h |  3 +++
 drivers/mmc/host/tmio_mmc_pio.c | 29 +
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 4b501f2d529f6e..637581faf756b1 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -79,6 +79,9 @@
 #defineCLK_CTL_DIV_MASK0xff
 #defineCLK_CTL_SCLKEN  BIT(8)
 
+#define CARD_OPT_WIDTH8BIT(13)
+#define CARD_OPT_WIDTH BIT(15)
+
 #define TMIO_BBS   512 /* Boot block size */
 
 /* Definitions for values the CTRL_SDIO_STATUS register can take. */
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 46b5a456243b84..f21c92ec7121cc 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -340,7 +340,9 @@ static int tmio_mmc_start_command(struct tmio_mmc_host 
*host, struct mmc_command
 
switch (mmc_resp_type(cmd)) {
case MMC_RSP_NONE: c |= RESP_NONE; break;
-   case MMC_RSP_R1:   c |= RESP_R1;   break;
+   case MMC_RSP_R1:
+   case MMC_RSP_R1_NO_CRC:
+  c |= RESP_R1;   break;
case MMC_RSP_R1B:  c |= RESP_R1B;  break;
case MMC_RSP_R2:   c |= RESP_R2;   break;
case MMC_RSP_R3:   c |= RESP_R3;   break;
@@ -737,12 +739,13 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
pr_debug("setup data transfer: blocksize %08x  nr_blocks %d\n",
 data->blksz, data->blocks);
 
-   /* Some hardware cannot perform 2 byte requests in 4 bit mode */
-   if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
+   /* Some hardware cannot perform 2 byte requests in 4/8 bit mode */
+   if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4 ||
+   host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) {
int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;
 
if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {
-   pr_err("%s: %d byte block unsupported in 4 bit mode\n",
+   pr_err("%s: %d byte block unsupported in 4/8 bit 
mode\n",
   mmc_hostname(host->mmc), data->blksz);
return -EINVAL;
}
@@ -922,14 +925,16 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)
 static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
unsigned char bus_width)
 {
-   switch (bus_width) {
-   case MMC_BUS_WIDTH_1:
-   sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
-   break;
-   case MMC_BUS_WIDTH_4:
-   sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
-   break;
-   }
+   u16 reg = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT)
+   & ~(CARD_OPT_WIDTH | CARD_OPT_WIDTH8);
+
+   /* reg now applies to MMC_BUS_WIDTH_4 */
+   if (bus_width == MMC_BUS_WIDTH_1)
+   reg |= CARD_OPT_WIDTH;
+   else if (bus_width == MMC_BUS_WIDTH_8)
+   reg |= CARD_OPT_WIDTH8;
+
+   sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, reg);
 }
 
 /* Set MMC clock / power.
-- 
2.9.3



[PATCH] arm64: dts: r8a7796 salvator-x: External SCIF3/HSCIF3 loop

2016-09-14 Thread Ulrich Hecht
Add SCIF3 and HSCIF3 as two new serial ports to the r8a7796
Salvator-X DT file.

Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index bdf6e05..2636742 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -18,6 +18,8 @@
 
aliases {
serial0 = &scif2;
+   serial2 = &scif3;
+   serial3 = &hscif3;
};
 
chosen {
@@ -89,6 +91,14 @@
groups = "scif2_data_a";
function = "scif2";
};
+   scif3_pins: scif3 { /* TX: 1_11, RX: 1_8 */
+   groups = "scif3_data_b";
+   function = "scif3";
+   };
+   hscif3_pins: hscif3 { /* TX: 2_8, RX: 2_7 */
+   groups = "hscif3_data_d";
+   function = "hscif3";
+   };
scif_clk_pins: scif_clk {
groups = "scif_clk_a";
function = "scif_clk";
@@ -138,6 +148,22 @@
status = "okay";
 };
 
+&scif3 {
+   pinctrl-0 = <&scif3_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
+
+/* SCIF3 TX -> HSCIF3 RX, HSCIF3 TX -> SCIF3 RX */
+
+&hscif3 {
+   pinctrl-0 = <&hscif3_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
+
 &scif2 {
pinctrl-0 = <&scif2_pins>;
pinctrl-names = "default";
-- 
2.9.3



[PATCH 2/3] arm64: renesas: r8a7796: Add all SCIF nodes

2016-09-14 Thread Ulrich Hecht
Add the device nodes for all R-Car H3 SCIF serial ports, incl. clocks
and clock domain.

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

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 7c4d11c..e59ded4 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -347,6 +347,32 @@
status = "disabled";
};
 
+   scif0: serial@e6e6 {
+   compatible = "renesas,scif-r8a7796",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6e6 0 64>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 207>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif1: serial@e6e68000 {
+   compatible = "renesas,scif-r8a7796",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6e68000 0 64>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 206>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
scif2: serial@e6e88000 {
compatible = "renesas,scif-r8a7796",
 "renesas,rcar-gen3-scif", "renesas,scif";
@@ -360,6 +386,45 @@
status = "disabled";
};
 
+   scif3: serial@e6c5 {
+   compatible = "renesas,scif-r8a7796",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6c5 0 64>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 204>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif4: serial@e6c4 {
+   compatible = "renesas,scif-r8a7796",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6c4 0 64>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 203>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif5: serial@e6f3 {
+   compatible = "renesas,scif-r8a7796",
+"renesas,rcar-gen3-scif", "renesas,scif";
+   reg = <0 0xe6f3 0 64>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 202>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
dmac0: dma-controller@e670 {
compatible = "renesas,dmac-r8a7796",
 "renesas,rcar-dmac";
-- 
2.9.3



[PATCH 1/4] clk: shmobile: r8a7796: Add HSCIF clocks

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c 
b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index 2c1f597..555aff4 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -128,6 +128,11 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] 
__initconst = {
DEF_MOD("sdif0", 314,   R8A7796_CLK_SD0),
DEF_MOD("rwdt0", 402,   R8A7796_CLK_R),
DEF_MOD("intc-ap",   408,   R8A7796_CLK_S3D1),
+   DEF_MOD("hscif4",516,   R8A7796_CLK_S3D1),
+   DEF_MOD("hscif3",517,   R8A7796_CLK_S3D1),
+   DEF_MOD("hscif2",518,   R8A7796_CLK_S3D1),
+   DEF_MOD("hscif1",519,   R8A7796_CLK_S3D1),
+   DEF_MOD("hscif0",520,   R8A7796_CLK_S3D1),
DEF_MOD("thermal",   522,   R8A7796_CLK_CP),
DEF_MOD("etheravb",  812,   R8A7796_CLK_S0D6),
DEF_MOD("gpio7", 905,   R8A7796_CLK_S3D4),
-- 
2.9.3



[PATCH 1/3] clk: shmobile: r8a7796: Add SCIF clocks

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c 
b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index 5cabcaa..2c1f597 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -109,6 +109,11 @@ static const struct cpg_core_clk r8a7796_core_clks[] 
__initconst = {
 };
 
 static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
+   DEF_MOD("scif5", 202,   R8A7796_CLK_S3D4),
+   DEF_MOD("scif4", 203,   R8A7796_CLK_S3D4),
+   DEF_MOD("scif3", 204,   R8A7796_CLK_S3D4),
+   DEF_MOD("scif1", 206,   R8A7796_CLK_S3D4),
+   DEF_MOD("scif0", 207,   R8A7796_CLK_S3D4),
DEF_MOD("sys-dmac2", 217,   R8A7796_CLK_S3D1),
DEF_MOD("sys-dmac1", 218,   R8A7796_CLK_S3D1),
DEF_MOD("sys-dmac0", 219,   R8A7796_CLK_S3D1),
-- 
2.9.3



[PATCH 3/3] arm64: renesas: r8a7796: Enable SCIF DMA

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index e59ded4..d2bbf92 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -356,6 +356,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x51>, <&dmac1 0x50>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -369,6 +371,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x53>, <&dmac1 0x52>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -382,6 +386,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x13>, <&dmac1 0x12>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -395,6 +401,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac0 0x57>, <&dmac0 0x56>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -408,6 +416,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac0 0x59>, <&dmac0 0x58>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -421,6 +431,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x5b>, <&dmac1 0x5a>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
-- 
2.9.3



[PATCH 0/3] r8a7796 SCIF integration

2016-09-14 Thread Ulrich Hecht
Hi!

This enables SCIFs 0, 1, 3, 4, and 5.

Based on renesas-drivers-2016-09-13-v4.8-rc6. The last patch enables DMA for
all SCIFs and depends on the "r8a7796 SYS-DMAC integration" series posted
earlier.

CU
Uli


Ulrich Hecht (3):
  clk: shmobile: r8a7796: Add SCIF clocks
  arm64: renesas: r8a7796: Add all SCIF nodes
  arm64: renesas: r8a7796: Enable SCIF DMA

 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 77 
 drivers/clk/renesas/r8a7796-cpg-mssr.c   |  5 +++
 2 files changed, 82 insertions(+)

-- 
2.9.3



[PATCH 4/4] arm64: renesas: r8a7796: Enable HSCIF DMA

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index df3b7df..085a6fa9b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -357,6 +357,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x31>, <&dmac1 0x30>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -371,6 +373,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x33>, <&dmac1 0x32>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -385,6 +389,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac1 0x35>, <&dmac1 0x34>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -399,6 +405,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac0 0x37>, <&dmac0 0x36>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
@@ -413,6 +421,8 @@
 <&cpg CPG_CORE R8A7796_CLK_S3D1>,
 <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
+   dmas = <&dmac0 0x39>, <&dmac0 0x38>;
+   dma-names = "tx", "rx";
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
-- 
2.9.3



[PATCH 0/4] r8a7796 HSCIF integration

2016-09-14 Thread Ulrich Hecht
Hi!

This enables all HSCIFs on r8a7796.

Based on renesas-drivers-2016-09-13-v4.8-rc6. The last patch enables DMA and
depends on the "r8a7796 SYS-DMAC integration" series posted earlier.

CU
Uli


Ulrich Hecht (4):
  clk: shmobile: r8a7796: Add HSCIF clocks
  pinctrl: sh-pfc: r8a7796: Add HSCIF pins, groups, and functions
  arm64: renesas: r8a7796 dtsi: Add all HSCIF nodes
  arm64: renesas: r8a7796: Enable HSCIF DMA

 arch/arm64/boot/dts/renesas/r8a7796.dtsi |  80 ++
 drivers/clk/renesas/r8a7796-cpg-mssr.c   |   5 +
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 255 +++
 3 files changed, 340 insertions(+)

-- 
2.9.3



[PATCH 3/4] arm64: renesas: r8a7796 dtsi: Add all HSCIF nodes

2016-09-14 Thread Ulrich Hecht
Add the device nodes for all HSCIF serial ports, incl. clocks, and
clock domain.

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

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index d2bbf92..df3b7df 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -347,6 +347,76 @@
status = "disabled";
};
 
+   hscif0: serial@e654 {
+   compatible = "renesas,hscif-r8a7796",
+"renesas,rcar-gen3-hscif",
+"renesas,hscif";
+   reg = <0 0xe654 0 96>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 520>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif1: serial@e655 {
+   compatible = "renesas,hscif-r8a7796",
+"renesas,rcar-gen3-hscif",
+"renesas,hscif";
+   reg = <0 0xe655 0 96>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 519>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif2: serial@e656 {
+   compatible = "renesas,hscif-r8a7796",
+"renesas,rcar-gen3-hscif",
+"renesas,hscif";
+   reg = <0 0xe656 0 96>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 518>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif3: serial@e66a {
+   compatible = "renesas,hscif-r8a7796",
+"renesas,rcar-gen3-hscif",
+"renesas,hscif";
+   reg = <0 0xe66a 0 96>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 517>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif4: serial@e66b {
+   compatible = "renesas,hscif-r8a7796",
+"renesas,rcar-gen3-hscif",
+"renesas,hscif";
+   reg = <0 0xe66b 0 96>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 516>,
+<&cpg CPG_CORE R8A7796_CLK_S3D1>,
+<&scif_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
scif0: serial@e6e6 {
compatible = "renesas,scif-r8a7796",
 "renesas,rcar-gen3-scif", "renesas,scif";
-- 
2.9.3



[PATCH 2/4] pinctrl: sh-pfc: r8a7796: Add HSCIF pins, groups, and functions

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 255 +++
 1 file changed, 255 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
index 42db745..607adf7 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
@@ -1490,6 +1490,191 @@ static const struct sh_pfc_pin pinmux_pins[] = {
PINMUX_GPIO_GP_ALL(),
 };
 
+/* - HSCIF0 - 
*/
+static const unsigned int hscif0_data_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 14),
+};
+static const unsigned int hscif0_data_mux[] = {
+   HRX0_MARK, HTX0_MARK,
+};
+static const unsigned int hscif0_clk_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(5, 12),
+};
+static const unsigned int hscif0_clk_mux[] = {
+   HSCK0_MARK,
+};
+static const unsigned int hscif0_ctrl_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(5, 16), RCAR_GP_PIN(5, 15),
+};
+static const unsigned int hscif0_ctrl_mux[] = {
+   HRTS0_N_MARK, HCTS0_N_MARK,
+};
+/* - HSCIF1 - 
*/
+static const unsigned int hscif1_data_a_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(5, 5), RCAR_GP_PIN(5, 6),
+};
+static const unsigned int hscif1_data_a_mux[] = {
+   HRX1_A_MARK, HTX1_A_MARK,
+};
+static const unsigned int hscif1_clk_a_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(6, 21),
+};
+static const unsigned int hscif1_clk_a_mux[] = {
+   HSCK1_A_MARK,
+};
+static const unsigned int hscif1_ctrl_a_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(5, 8), RCAR_GP_PIN(5, 7),
+};
+static const unsigned int hscif1_ctrl_a_mux[] = {
+   HRTS1_N_A_MARK, HCTS1_N_A_MARK,
+};
+
+static const unsigned int hscif1_data_b_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
+};
+static const unsigned int hscif1_data_b_mux[] = {
+   HRX1_B_MARK, HTX1_B_MARK,
+};
+static const unsigned int hscif1_clk_b_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(5, 0),
+};
+static const unsigned int hscif1_clk_b_mux[] = {
+   HSCK1_B_MARK,
+};
+static const unsigned int hscif1_ctrl_b_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(5, 4), RCAR_GP_PIN(5, 3),
+};
+static const unsigned int hscif1_ctrl_b_mux[] = {
+   HRTS1_N_B_MARK, HCTS1_N_B_MARK,
+};
+/* - HSCIF2 - 
*/
+static const unsigned int hscif2_data_a_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(6, 8), RCAR_GP_PIN(6, 9),
+};
+static const unsigned int hscif2_data_a_mux[] = {
+   HRX2_A_MARK, HTX2_A_MARK,
+};
+static const unsigned int hscif2_clk_a_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(6, 10),
+};
+static const unsigned int hscif2_clk_a_mux[] = {
+   HSCK2_A_MARK,
+};
+static const unsigned int hscif2_ctrl_a_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(6, 7), RCAR_GP_PIN(6, 6),
+};
+static const unsigned int hscif2_ctrl_a_mux[] = {
+   HRTS2_N_A_MARK, HCTS2_N_A_MARK,
+};
+
+static const unsigned int hscif2_data_b_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(6, 17), RCAR_GP_PIN(6, 18),
+};
+static const unsigned int hscif2_data_b_mux[] = {
+   HRX2_B_MARK, HTX2_B_MARK,
+};
+static const unsigned int hscif2_clk_b_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(6, 21),
+};
+static const unsigned int hscif2_clk_b_mux[] = {
+   HSCK1_B_MARK,
+};
+static const unsigned int hscif2_ctrl_b_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 19),
+};
+static const unsigned int hscif2_ctrl_b_mux[] = {
+   HRTS2_N_B_MARK, HCTS2_N_B_MARK,
+};
+/* - HSCIF3 - 
*/
+static const unsigned int hscif3_data_a_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(1, 23), RCAR_GP_PIN(1, 24),
+};
+static const unsigned int hscif3_data_a_mux[] = {
+   HRX3_A_MARK, HTX3_A_MARK,
+};
+static const unsigned int hscif3_clk_pins[] = {
+   /* SCK */
+   RCAR_GP_PIN(1, 22),
+};
+static const unsigned int hscif3_clk_mux[] = {
+   HSCK3_MARK,
+};
+static const unsigned int hscif3_ctrl_pins[] = {
+   /* RTS, CTS */
+   RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 25),
+};
+static const unsigned int hscif3_ctrl_mux[] = {
+   HRTS3_N_MARK, HCTS3_N_MARK,
+};
+
+static const unsigned int hscif3_data_b_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+};
+static const unsigned int hscif3_data_b_mux[] = {
+   HRX3_B_MARK, HTX3_B_MARK,
+};
+static const unsigned int hscif3_data_c_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
+};
+static const unsigned int hscif3_data_c_mux[] = {
+   HRX3_C_MARK, HTX3_C_MARK,
+};
+static const unsigned int hscif3_data_d_pins[] = {
+   /* RX, TX */
+   RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
+};
+static const uns

[PATCH 5/6] arm64: renesas: r8a7796: Enable I2C DMA

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index a4d8b76..7c4d11c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -257,6 +257,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 931>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac1 0x91>, <&dmac1 0x90>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <110>;
status = "disabled";
};
@@ -269,6 +271,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 930>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac1 0x93>, <&dmac1 0x92>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <6>;
status = "disabled";
};
@@ -281,6 +285,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 929>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac1 0x95>, <&dmac1 0x94>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <6>;
status = "disabled";
};
@@ -293,6 +299,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 928>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac0 0x97>, <&dmac0 0x96>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <110>;
status = "disabled";
};
@@ -305,6 +313,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 927>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac0 0x99>, <&dmac0 0x98>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <110>;
status = "disabled";
};
@@ -317,6 +327,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 919>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac0 0x9b>, <&dmac0 0x9a>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <110>;
status = "disabled";
};
@@ -329,6 +341,8 @@
interrupts = ;
clocks = <&cpg CPG_MOD 918>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   dmas = <&dmac0 0x9d>, <&dmac0 0x9c>;
+   dma-names = "tx", "rx";
i2c-scl-internal-delay-ns = <6>;
status = "disabled";
};
-- 
2.9.3



[PATCH 3/6] pinctrl: sh-pfc: r8a7796: add I2C pin support

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 77 
 1 file changed, 77 insertions(+)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
index dc9b671..42db745 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7796.c
@@ -1490,6 +1490,57 @@ static const struct sh_pfc_pin pinmux_pins[] = {
PINMUX_GPIO_GP_ALL(),
 };
 
+/* - I2C  
*/
+static const unsigned int i2c1_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 10),
+};
+static const unsigned int i2c1_a_mux[] = {
+   SDA1_A_MARK, SCL1_A_MARK,
+};
+static const unsigned int i2c1_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 23),
+};
+static const unsigned int i2c1_b_mux[] = {
+   SDA1_B_MARK, SCL1_B_MARK,
+};
+static const unsigned int i2c2_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(5, 0), RCAR_GP_PIN(5, 4),
+};
+static const unsigned int i2c2_a_mux[] = {
+   SDA2_A_MARK, SCL2_A_MARK,
+};
+static const unsigned int i2c2_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 12),
+};
+static const unsigned int i2c2_b_mux[] = {
+   SDA2_B_MARK, SCL2_B_MARK,
+};
+static const unsigned int i2c6_a_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(1, 8), RCAR_GP_PIN(1, 11),
+};
+static const unsigned int i2c6_a_mux[] = {
+   SDA6_A_MARK, SCL6_A_MARK,
+};
+static const unsigned int i2c6_b_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 25),
+};
+static const unsigned int i2c6_b_mux[] = {
+   SDA6_B_MARK, SCL6_B_MARK,
+};
+static const unsigned int i2c6_c_pins[] = {
+   /* SDA, SCL */
+   RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 14),
+};
+static const unsigned int i2c6_c_mux[] = {
+   SDA6_C_MARK, SCL6_C_MARK,
+};
+
 /* - SCIF0 -- 
*/
 static const unsigned int scif0_data_pins[] = {
/* RX, TX */
@@ -1912,6 +1963,13 @@ static const unsigned int sdhi3_ds_mux[] = {
 };
 
 static const struct sh_pfc_pin_group pinmux_groups[] = {
+   SH_PFC_PIN_GROUP(i2c1_a),
+   SH_PFC_PIN_GROUP(i2c1_b),
+   SH_PFC_PIN_GROUP(i2c2_a),
+   SH_PFC_PIN_GROUP(i2c2_b),
+   SH_PFC_PIN_GROUP(i2c6_a),
+   SH_PFC_PIN_GROUP(i2c6_b),
+   SH_PFC_PIN_GROUP(i2c6_c),
SH_PFC_PIN_GROUP(scif0_data),
SH_PFC_PIN_GROUP(scif0_clk),
SH_PFC_PIN_GROUP(scif0_ctrl),
@@ -1969,6 +2027,22 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(sdhi3_ds),
 };
 
+static const char * const i2c1_groups[] = {
+   "i2c1_a",
+   "i2c1_b",
+};
+
+static const char * const i2c2_groups[] = {
+   "i2c2_a",
+   "i2c2_b",
+};
+
+static const char * const i2c6_groups[] = {
+   "i2c6_a",
+   "i2c6_b",
+   "i2c6_c",
+};
+
 static const char * const scif0_groups[] = {
"scif0_data",
"scif0_clk",
@@ -2058,6 +2132,9 @@ static const char * const sdhi3_groups[] = {
 };
 
 static const struct sh_pfc_function pinmux_functions[] = {
+   SH_PFC_FUNCTION(i2c1),
+   SH_PFC_FUNCTION(i2c2),
+   SH_PFC_FUNCTION(i2c6),
SH_PFC_FUNCTION(scif0),
SH_PFC_FUNCTION(scif1),
SH_PFC_FUNCTION(scif2),
-- 
2.9.3



[PATCH 6/6] arm64: renesas: r8a7796: salvator-x: enable I2C

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index a8373c2..bdf6e05 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -94,6 +94,11 @@
function = "scif_clk";
};
 
+   i2c2_pins: i2c2 {
+   groups = "i2c2_a";
+   function = "i2c2";
+   };
+
sdhi0_pins: sd0 {
groups = "sdhi0_data4", "sdhi0_ctrl";
function = "sdhi0";
@@ -144,6 +149,13 @@
status = "okay";
 };
 
+&i2c2 {
+   pinctrl-0 = <&i2c2_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+};
+
 &wdt0 {
timeout-sec = <60>;
status = "okay";
-- 
2.9.3



[PATCH 4/6] arm64: renesas: r8a7796: add I2C support

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 94 
 1 file changed, 94 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index d7590c3..a4d8b76 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -17,6 +17,16 @@
#address-cells = <2>;
#size-cells = <2>;
 
+   aliases {
+   i2c0 = &i2c0;
+   i2c1 = &i2c1;
+   i2c2 = &i2c2;
+   i2c3 = &i2c3;
+   i2c4 = &i2c4;
+   i2c5 = &i2c5;
+   i2c6 = &i2c6;
+   };
+
psci {
compatible = "arm,psci-0.2";
method = "smc";
@@ -239,6 +249,90 @@
#power-domain-cells = <1>;
};
 
+   i2c0: i2c@e650 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe650 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 931>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <110>;
+   status = "disabled";
+   };
+
+   i2c1: i2c@e6508000 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe6508000 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 930>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <6>;
+   status = "disabled";
+   };
+
+   i2c2: i2c@e651 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe651 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 929>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <6>;
+   status = "disabled";
+   };
+
+   i2c3: i2c@e66d {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe66d 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 928>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <110>;
+   status = "disabled";
+   };
+
+   i2c4: i2c@e66d8000 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe66d8000 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 927>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <110>;
+   status = "disabled";
+   };
+
+   i2c5: i2c@e66e {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe66e 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 919>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <110>;
+   status = "disabled";
+   };
+
+   i2c6: i2c@e66e8000 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "renesas,i2c-r8a7796";
+   reg = <0 0xe66e8000 0 0x40>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 918>;
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   i2c-scl-internal-delay-ns = <6>;
+   status = "disabled";
+   };
+
scif2: serial@e6e88000 {
compatible = "renesas,scif-r8a7796",
 "renesas,rcar-gen3-scif", "renesas,scif";
-- 
2.9.3



[PATCH 1/6] i2c: rcar: add support for r8a7796 (R-Car M3-W)

2016-09-14 Thread Ulrich Hecht
Same as r8a7795.

Signed-off-by: Ulrich Hecht 
---
 Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 1 +
 drivers/i2c/busses/i2c-rcar.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt 
b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index 5f0cb50..239632a 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -11,6 +11,7 @@ Required properties:
"renesas,i2c-r8a7793"
"renesas,i2c-r8a7794"
"renesas,i2c-r8a7795"
+   "renesas,i2c-r8a7796"
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: interrupt specifier.
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index e96ea24..726615e 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -802,6 +802,7 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
{ .compatible = "renesas,i2c-r8a7793", .data = (void *)I2C_RCAR_GEN2 },
{ .compatible = "renesas,i2c-r8a7794", .data = (void *)I2C_RCAR_GEN2 },
{ .compatible = "renesas,i2c-r8a7795", .data = (void *)I2C_RCAR_GEN3 },
+   { .compatible = "renesas,i2c-r8a7796", .data = (void *)I2C_RCAR_GEN3 },
{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
-- 
2.9.3



[PATCH 1/3] clk: renesas: r8a7796: Add SYS-DMAC clocks

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c 
b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index eb347ed..c02fe34 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -109,6 +109,9 @@ static const struct cpg_core_clk r8a7796_core_clks[] 
__initconst = {
 };
 
 static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
+   DEF_MOD("sys-dmac2", 217,   R8A7796_CLK_S3D1),
+   DEF_MOD("sys-dmac1", 218,   R8A7796_CLK_S3D1),
+   DEF_MOD("sys-dmac0", 219,   R8A7796_CLK_S3D1),
DEF_MOD("cmt3",  300,   R8A7796_CLK_R),
DEF_MOD("cmt2",  301,   R8A7796_CLK_R),
DEF_MOD("cmt1",  302,   R8A7796_CLK_R),
-- 
2.9.3



[PATCH 2/6] clk: renesas: r8a7796: Add I2C clocks

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/clk/renesas/r8a7796-cpg-mssr.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c 
b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index c02fe34..d851c42 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -133,6 +133,13 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] 
__initconst = {
DEF_MOD("gpio2", 910,   R8A7796_CLK_S3D4),
DEF_MOD("gpio1", 911,   R8A7796_CLK_S3D4),
DEF_MOD("gpio0", 912,   R8A7796_CLK_S3D4),
+   DEF_MOD("i2c6",  918,   R8A7796_CLK_S0D6),
+   DEF_MOD("i2c5",  919,   R8A7796_CLK_S0D6),
+   DEF_MOD("i2c4",  927,   R8A7796_CLK_S0D6),
+   DEF_MOD("i2c3",  928,   R8A7796_CLK_S0D6),
+   DEF_MOD("i2c2",  929,   R8A7796_CLK_S3D2),
+   DEF_MOD("i2c1",  930,   R8A7796_CLK_S3D2),
+   DEF_MOD("i2c0",  931,   R8A7796_CLK_S3D2),
 };
 
 static const unsigned int r8a7796_crit_mod_clks[] __initconst = {
-- 
2.9.3



[PATCH 0/6] r8a7796 I2C integration

2016-09-14 Thread Ulrich Hecht
Hi!

This enables the I2C controllers on r8a7796. The only difference to r8a7795
is the clock for channels three to six (S0D6 instead of S3D2).

Based on renesas-drivers-2016-09-13-v4.8-rc6. The DMA enablement depends on
the "r8a7796 SYS-DMAC integration" series posted earlier.

CU
Uli


Ulrich Hecht (6):
  i2c: rcar: add support for r8a7796 (R-Car M3-W)
  clk: renesas: r8a7796: Add I2C clocks
  pinctrl: sh-pfc: r8a7796: add I2C pin support
  arm64: renesas: r8a7796: add I2C support
  arm64: renesas: r8a7796: Enable I2C DMA
  arm64: renesas: r8a7796: salvator-x: enable I2C

 Documentation/devicetree/bindings/i2c/i2c-rcar.txt |   1 +
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |  12 +++
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   | 108 +
 drivers/clk/renesas/r8a7796-cpg-mssr.c |   7 ++
 drivers/i2c/busses/i2c-rcar.c  |   1 +
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c   |  77 +++
 6 files changed, 206 insertions(+)

-- 
2.9.3



[PATCH 2/3] arm64: renesas: r8a7796: add SYS-DMAC controller nodes

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 99 
 1 file changed, 99 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 3aae29f..d7590c3 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -252,6 +252,105 @@
status = "disabled";
};
 
+   dmac0: dma-controller@e670 {
+   compatible = "renesas,dmac-r8a7796",
+"renesas,rcar-dmac";
+   reg = <0 0xe670 0 0x1>;
+   interrupts = ;
+   interrupt-names = "error",
+   "ch0", "ch1", "ch2", "ch3",
+   "ch4", "ch5", "ch6", "ch7",
+   "ch8", "ch9", "ch10", "ch11",
+   "ch12", "ch13", "ch14", "ch15";
+   clocks = <&cpg CPG_MOD 219>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   #dma-cells = <1>;
+   dma-channels = <16>;
+   };
+
+   dmac1: dma-controller@e730 {
+   compatible = "renesas,dmac-r8a7796",
+"renesas,rcar-dmac";
+   reg = <0 0xe730 0 0x1>;
+   interrupts = ;
+   interrupt-names = "error",
+   "ch0", "ch1", "ch2", "ch3",
+   "ch4", "ch5", "ch6", "ch7",
+   "ch8", "ch9", "ch10", "ch11",
+   "ch12", "ch13", "ch14", "ch15";
+   clocks = <&cpg CPG_MOD 218>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   #dma-cells = <1>;
+   dma-channels = <16>;
+   };
+
+   dmac2: dma-controller@e731 {
+   compatible = "renesas,dmac-r8a7796",
+"renesas,rcar-dmac";
+   reg = <0 0xe731 0 0x1>;
+   interrupts = ;
+   interrupt-names = "error",
+   "ch0", "ch1", "ch2", "ch3",
+   "ch4", "ch5", "ch6", "ch7",
+   "ch8", "ch9", "ch10", "ch11",
+   "ch12", "ch13", "ch14", "ch15";
+   clocks = <&cpg CPG_MOD 217>;
+   clock-names = "fck";
+   power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+   #dma-cells = <1>;
+   dma-channels = <16>;
+   };
+
sdhi0: sd@ee10 {
compatible = "renesas,sdhi-r8a7796";
reg = <0 0xee10 0 0x2000>;
-- 
2.9.3



[PATCH 0/3] r8a7796 SYS-DMAC integration

2016-09-14 Thread Ulrich Hecht
Hi!

This enables the three DMA controllers. Identical to the setup on r8a7795.
Based on renesas-drivers-2016-09-13-v4.8-rc6.

CU
Uli


Ulrich Hecht (3):
  clk: renesas: r8a7796: Add SYS-DMAC clocks
  arm64: renesas: r8a7796: add SYS-DMAC controller nodes
  dmaengine: rcar-dmac: Document R-Car M3-W bindings

 .../devicetree/bindings/dma/renesas,rcar-dmac.txt  |  1 +
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   | 99 ++
 drivers/clk/renesas/r8a7796-cpg-mssr.c |  3 +
 3 files changed, 103 insertions(+)

-- 
2.9.3



[PATCH 3/3] dmaengine: rcar-dmac: Document R-Car M3-W bindings

2016-09-14 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt 
b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
index 5b902ac..5df8f4e 100644
--- a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
+++ b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
@@ -22,6 +22,7 @@ Required Properties:
- "renesas,dmac-r8a7793" (R-Car M2-N)
- "renesas,dmac-r8a7794" (R-Car E2)
- "renesas,dmac-r8a7795" (R-Car H3)
+   - "renesas,dmac-r8a7796" (R-Car M3-W)
 
 - reg: base address and length of the registers block for the DMAC
 
-- 
2.9.3



[PULL REQUEST] VSP1 Image Partitioning algorithm

2016-09-14 Thread Kieran Bingham
Hi Geert,

Please consider integrating the latest VSP1 next branch to provide the
image partitioning algorithm into renesas-drivers

Regards

Kieran


The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git vsp1/next

for you to fetch changes up to 9f39e31fbb3fb6ebd75d7012d3574def2f5da596:

  v4l: vsp1: Fix spinlock in mixed IRQ context function (2016-09-14 13:06:51 
+0300)


Kieran Bingham (6):
  v4l: vsp1: Ensure pipeline locking in resume path
  v4l: vsp1: Repair race between frame end and qbuf handler
  v4l: vsp1: Use DFE instead of FRE for frame end
  v4l: vsp1: Support chained display lists
  v4l: vsp1: Determine partition requirements for scaled images
  v4l: vsp1: Support multiple partitions per frame

Laurent Pinchart (8):
  v4l: vsp1: Prevent pipelines from running when not streaming
  v4l: vsp1: Protect against race conditions between get and set format
  v4l: vsp1: Disable cropping on WPF sink pad
  v4l: vsp1: Fix RPF cropping
  v4l: vsp1: Pass parameter type to entity configuration operation
  v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION
  v4l: vsp1: wpf: Implement rotation support
  v4l: vsp1: Fix spinlock in mixed IRQ context function

 drivers/media/platform/vsp1/vsp1_bru.c|  33 +++-
 drivers/media/platform/vsp1/vsp1_clu.c|  61 ---
 drivers/media/platform/vsp1/vsp1_dl.c | 119 +++--
 drivers/media/platform/vsp1/vsp1_dl.h |   1 +
 drivers/media/platform/vsp1/vsp1_drm.c|  15 +-
 drivers/media/platform/vsp1/vsp1_drv.c|   2 +-
 drivers/media/platform/vsp1/vsp1_entity.c |  22 ++-
 drivers/media/platform/vsp1/vsp1_entity.h |  25 ++-
 drivers/media/platform/vsp1/vsp1_hsit.c   |  20 ++-
 drivers/media/platform/vsp1/vsp1_lif.c|  20 ++-
 drivers/media/platform/vsp1/vsp1_lut.c|  42 +++--
 drivers/media/platform/vsp1/vsp1_pipe.c   |   3 +
 drivers/media/platform/vsp1/vsp1_pipe.h   |   8 +
 drivers/media/platform/vsp1/vsp1_rpf.c| 106 
 drivers/media/platform/vsp1/vsp1_rwpf.c   |  86 +
 drivers/media/platform/vsp1/vsp1_rwpf.h   |  16 +-
 drivers/media/platform/vsp1/vsp1_sru.c|  50 +-
 drivers/media/platform/vsp1/vsp1_uds.c|  71 ++--
 drivers/media/platform/vsp1/vsp1_video.c  | 188 ++--
 drivers/media/platform/vsp1/vsp1_wpf.c| 279 ++
 20 files changed, 883 insertions(+), 284 deletions(-)


Re: [PATCH v7 0/6] UHS-I SDR-104 support for sh_mobile_sdhi

2016-09-14 Thread Wolfram Sang
On Tue, Sep 13, 2016 at 02:48:26PM +0200, Ulf Hansson wrote:
> On 13 September 2016 at 12:56, Simon Horman  
> wrote:
> >
> > Hi,
> >
> > this series is based on work by Ai Kyuse to add UHS-I SDR-104 support for
> > sh_mobile_sdhi. It builds on work by Shinobu Uehara, Rob Taylor, William
> > Towle and Ian Molton, Ben Hutchings, Wolfram Sang and others to add UHS-I
> > SDR-50 support to the same driver.
> >
> > It is based on a merge of the next branches of the mmc tree.
> >
> > To aid review the following git branch is provided:
> > * https:://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
> > topic/sdr104-driver-v7
> >
> > Overview of changes since v6:
> > * Address review by Ulf
> >   - Detailed in per-patch changelogs
> > * Move integration (arm/arm64 dt) patches to separate patchset
> >
> > Please see http://elinux.org/Tests:SD-SDHI-SDR104 for indicative tests
> > results.
> >
> >
> > Ai Kyuse (3):
> >   mmc: tmio: enhance illegal sequence handling
> >   mmc: tmio: Add hw reset support
> >   mmc: tmio: Add tuning support
> >
> > Simon Horman (3):
> >   mmc: core: Add helper to see if a host can be retuned
> >   mmc: tmio: document mandatory and optional callbacks
> >   mmc: sh_mobile_sdhi: Add tuning support
> >
> >  drivers/mmc/host/sh_mobile_sdhi.c | 265 
> > +-
> >  drivers/mmc/host/tmio_mmc.h   |  18 ++-
> >  drivers/mmc/host/tmio_mmc_pio.c   |  87 -
> >  include/linux/mmc/host.h  |   5 +
> >  4 files changed, 367 insertions(+), 8 deletions(-)
> >
> > --
> > 2.7.0.rc3.207.g0ac5344
> >
> 
> This looks good to me, although I would like to get an ack from
> Wolfram before I queue this up.

So, I did test this on my M3-W Salvator-X (with the fixup patch
Simon sent on top of this series):

+ My SanDisk card always gets properly tuned; re-inserting works

+ My Samsung card gets properly tuned if it is the first card
  inserted to a slot.

- The Samsung card does not get tuned when it was not the first card in
  a slot, i.e. it was re-inserted or the SanDisk card had been used in
  that slot before:

[   56.799203] mmc2: tuning execution failed: -5
[   56.803565] mmc2: error -5 whilst initialising SD card

Note that if I re-insert the SanDisk card to this slot, it will be tuned
correctly. Just the Samsung card will continue to fail.

Any pointers? Maybe some more re-initialization?

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [GIT PULL] Renesas ARM64 Based SoC DT Updates for v4.9

2016-09-14 Thread Arnd Bergmann
On Thursday, September 8, 2016 9:43:24 AM CEST Simon Horman wrote:
> Hi Olof, Hi Kevin, Hi Arnd,
> 
> Please consider these Renesas ARM64 based SoC DT updates for v4.9.
> 
> This pull request is based on the sh-pfc-for-v4.9-tag2 of
> Geert Uytterhoeven's renesas-driver's tree which is included in the
> devel and for-next branches of Linus Walleij's linux-pinctrl tree.
> 
> 

Pulled into next/late because of the dependency.

We'll send it during the merge window after the dependencies
are all merged upstream. Thanks,

Arnd



RE: How to put an 'if' statement in a dts?

2016-09-14 Thread Chris Brandt
Hi Geert,

Thank you for your reply.

On 9/14/2016, Geert Uytterhoeven write:
> > B) Leave one as 'status = "disabled"', and then the user just has to
> > switch around the 'status' properties before boot (either modify the
> > dts file or change it in u-boot with the fdt command)
> 
> I take it you can actually use both SDHI or MMC on RSK, without changing a
> jumper?

Correct. Just change the pin mux. So that will be part of the mmc/sdhi node 
definition in the dts file (once I add a pfc driver).


> Probably SDHI is the best performing option?

It's the most popular (SDIO for WiFi).
But, there are some using eMMC, so I'd like to show those people a correct 
setup as well.


> You could also provide a DT overlay for switching to MMC.
> But upstream DT overlay support is incomplete.
> Cfr. http://elinux.org/R-Car/DT-Overlays

That is interesting. I'll have to read some more about that.


> On Genmai, the regulator setup is more complex (seem to support both 3.3V
> and 5V), so if we add support for that, there's a second example.

From what I've seen on product boards, with this level of device (RZ/A1), 
things are not nearly as complicated as GENMAI or RSK. But, you're idea is good 
(use GENMAI as another example platform).



For the upstream rskrza1.dts, am I allowed to submit something like this?
(CN1 is label of the card socket)

&mmcif {
vmmc-supply = <&d3_3v>;
vqmmc-supply = <&d3_3v>;
bus-width = <8>;
non-removable;
status = "disabled"; /* shares CN1 with sdhi1 */
};

&sdhi1 {
status = "okay"; /* shares CN1 with mmcif */
};



Chris




Re: How to put an 'if' statement in a dts?

2016-09-14 Thread Geert Uytterhoeven
Hi Chris,

On Wed, Sep 14, 2016 at 2:35 PM, Chris Brandt  wrote:
> On the RZ/A1 RSK board, the one card slot can be used for SDHI or MMC (SDHI1 
> and MMC share the same pins).
>
> For the r7s72100-rskrza1.dts, I would like to add in support for both SDHI1 
> and MMC for someone to use as reference. Of course they should only pick one.
>
> So my options are:
>
> A) Make some type of an 'if' statement in the dts that can be selected at 
> boot time

Ugh, doesn't sound right.

> B) Leave one as 'status = "disabled"', and then the user just has to switch 
> around the 'status' properties before boot (either modify the dts file or 
> change it in u-boot with the fdt command)

I take it you can actually use both SDHI or MMC on RSK, without
changing a jumper?

> C) Pick one and forget about the other (because you're not allowed to have 
> inactive nodes in your board dts files)

Probably SDHI is the best performing option?

You could also provide a DT overlay for switching to MMC.
But upstream DT overlay support is incomplete.
Cfr. http://elinux.org/R-Car/DT-Overlays

> The MMC also needs a 3.3v "regulator-fixed" node, so it would be nice to put 
> that in the 'if' statement too, but since the dts for the rskrza1 board is 
> mostly for reference, it's not a big deal if that one is just always active.

On Genmai, the regulator setup is more complex (seem to support both
3.3V and 5V),
so if we add support for that, there's a second example.

Gr{oetje,eeting}s,

Geert

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

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


Re: [git pull] pinctrl: sh-pfc: Updates for v4.9 (take three)

2016-09-14 Thread Linus Walleij
On Wed, Sep 14, 2016 at 9:59 AM, Geert Uytterhoeven
 wrote:

> Hi Linus,
>
> The following changes since commit 374cf6992de89fc38d4d923c89b40816d341d678:
>
>   pinctrl: sh-pfc: r8a7796: Add SDHI pins, groups and functions (2016-08-19 
> 09:37:20 +0200)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git 
> tags/sh-pfc-for-v4.9-tag3
>
> for you to fetch changes up to 77fd4136e58c642482f03d293d5717658a569b4b:
>
>   pinctrl: sh-pfc: r8a7794: Implement voltage switching for SDHI (2016-09-14 
> 09:26:54 +0200)

Thanks, pulled in and pushed to the autobuilders for test.

Yours,
Linus Walleij


How to put an 'if' statement in a dts?

2016-09-14 Thread Chris Brandt
On the RZ/A1 RSK board, the one card slot can be used for SDHI or MMC (SDHI1 
and MMC share the same pins).

For the r7s72100-rskrza1.dts, I would like to add in support for both SDHI1 and 
MMC for someone to use as reference. Of course they should only pick one.

So my options are:

A) Make some type of an 'if' statement in the dts that can be selected at boot 
time

B) Leave one as 'status = "disabled"', and then the user just has to switch 
around the 'status' properties before boot (either modify the dts file or 
change it in u-boot with the fdt command)

C) Pick one and forget about the other (because you're not allowed to have 
inactive nodes in your board dts files)


The MMC also needs a 3.3v "regulator-fixed" node, so it would be nice to put 
that in the 'if' statement too, but since the dts for the rskrza1 board is 
mostly for reference, it's not a big deal if that one is just always active.

In the current RZ/A1 BSP, I basically put everything in the board-rskrza1.c 
file so all users had to do was delete what was not relevant to their design 
(deleting code is easier than trying to figure out what to add). So, now I'm 
trying to figure out how to do something similar with DT.

Thank you,
Chris



[PATCH v4 0/2] ARM: cleanup PCI specific configs

2016-09-14 Thread Kishon Vijay Abraham I
This series was initially sent to add support for two PCIe
ports in dra7. This included selecting PCI_DOMAINS config
in SOC_DRA7XX.

However from the review, PCI_DOMAINS can instead be selected
from ARCH_MULTIPLATFORM. This is fixed in this series along
with removing PCI_DOMAINS from other configs.

Changes from v3:
*) Added *Acked-by:*
*) Fixed $subject to not have *Fix*

Kishon Vijay Abraham I (2):
  ARM: stop *MIGHT_HAVE_PCI* config from being selected redundantly
  ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM

 arch/arm/Kconfig |1 +
 arch/arm/mach-at91/Kconfig   |1 -
 arch/arm/mach-axxia/Kconfig  |2 --
 arch/arm/mach-cns3xxx/Kconfig|1 -
 arch/arm/mach-exynos/Kconfig |2 --
 arch/arm/mach-imx/Kconfig|2 --
 arch/arm/mach-integrator/Kconfig |1 -
 arch/arm/mach-keystone/Kconfig   |2 --
 arch/arm/mach-shmobile/Kconfig   |1 -
 arch/arm/mach-spear/Kconfig  |1 -
 arch/arm/mach-versatile/Kconfig  |1 -
 11 files changed, 1 insertion(+), 14 deletions(-)

-- 
1.7.9.5



[PATCH v4 2/2] ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM

2016-09-14 Thread Kishon Vijay Abraham I
PCI_DOMAINS config should be selected for any SoCs
having more than a single PCIe controller. Without PCI_DOMAINS
config, only one PCIe controller gets registered.

Select PCI_DOMAINS in ARCH_MULTIPLATFORM if PCI is selected, since
it doesn't harm even if a platform has a single PCIe port.
Also remove PCI_DOMAINS being selected from other platform
specific configs.

Signed-off-by: Kishon Vijay Abraham I 
Acked-by: Krzysztof Kozlowski 
---
 arch/arm/Kconfig   |1 +
 arch/arm/mach-axxia/Kconfig|1 -
 arch/arm/mach-cns3xxx/Kconfig  |1 -
 arch/arm/mach-exynos/Kconfig   |1 -
 arch/arm/mach-imx/Kconfig  |2 --
 arch/arm/mach-keystone/Kconfig |1 -
 arch/arm/mach-shmobile/Kconfig |1 -
 7 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a9c4e48..fb1b867 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -337,6 +337,7 @@ config ARCH_MULTIPLATFORM
select GENERIC_CLOCKEVENTS
select MIGHT_HAVE_PCI
select MULTI_IRQ_HANDLER
+   select PCI_DOMAINS if PCI
select SPARSE_IRQ
select USE_OF
 
diff --git a/arch/arm/mach-axxia/Kconfig b/arch/arm/mach-axxia/Kconfig
index ee2e131..fe627cb 100644
--- a/arch/arm/mach-axxia/Kconfig
+++ b/arch/arm/mach-axxia/Kconfig
@@ -7,7 +7,6 @@ config ARCH_AXXIA
select ARM_TIMER_SP804
select HAVE_ARM_ARCH_TIMER
select MFD_SYSCON
-   select PCI_DOMAINS if PCI
select ZONE_DMA
help
  This enables support for the LSI Axxia devices.
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index eb14a0f..5fd836b 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -2,7 +2,6 @@ menuconfig ARCH_CNS3XXX
bool "Cavium Networks CNS3XXX family"
depends on ARCH_MULTI_V6
select ARM_GIC
-   select PCI_DOMAINS if PCI
help
  Support for Cavium Networks CNS3XXX platform.
 
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index ee8a99c..18f0c85 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -126,7 +126,6 @@ config SOC_EXYNOS5440
select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select HAVE_ARM_ARCH_TIMER
select AUTO_ZRELADDR
-   select PCI_DOMAINS if PCI
select PINCTRL_EXYNOS5440
select PM_OPP
help
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ee9a318..757cd11 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -523,7 +523,6 @@ config SOC_IMX6Q
select ARM_ERRATA_764369 if SMP
select HAVE_ARM_SCU if SMP
select HAVE_ARM_TWD
-   select PCI_DOMAINS if PCI
select PINCTRL_IMX6Q
select SOC_IMX6
 
@@ -569,7 +568,6 @@ config SOC_LS1021A
bool "Freescale LS1021A support"
select ARM_GIC
select HAVE_ARM_ARCH_TIMER
-   select PCI_DOMAINS if PCI
select ZONE_DMA if ARM_LPAE
help
  This enables support for Freescale LS1021A processor.
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index 1507287..24bd64d 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -8,7 +8,6 @@ config ARCH_KEYSTONE
select COMMON_CLK_KEYSTONE
select ARCH_SUPPORTS_BIG_ENDIAN
select ZONE_DMA if ARM_LPAE
-   select PCI_DOMAINS if PCI
select PINCTRL
help
  Support for boards based on the Texas Instruments Keystone family of
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 4a48c9f..09817ba 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -22,7 +22,6 @@ config ARCH_RCAR_GEN2
select PM_GENERIC_DOMAINS
select RENESAS_IRQC
select SYS_SUPPORTS_SH_CMT
-   select PCI_DOMAINS if PCI
 
 config ARCH_RMOBILE
bool
-- 
1.7.9.5



[PATCH v4 1/2] ARM: stop *MIGHT_HAVE_PCI* config from being selected redundantly

2016-09-14 Thread Kishon Vijay Abraham I
*MIGHT_HAVE_PCI* config is already selected in ARCH_MULTIPLATFORM.
Don't select it redundantly in all ARCH_MULTIPLATFORM based machines.

Signed-off-by: Kishon Vijay Abraham I 
Acked-by: Alexandre Belloni 
Acked-by: Krzysztof Kozlowski 
---
 arch/arm/mach-at91/Kconfig   |1 -
 arch/arm/mach-axxia/Kconfig  |1 -
 arch/arm/mach-exynos/Kconfig |1 -
 arch/arm/mach-integrator/Kconfig |1 -
 arch/arm/mach-keystone/Kconfig   |1 -
 arch/arm/mach-spear/Kconfig  |1 -
 arch/arm/mach-versatile/Kconfig  |1 -
 7 files changed, 7 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 5204395..841e924 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -55,7 +55,6 @@ config SOC_AT91RM9200
select ATMEL_ST
select CPU_ARM920T
select HAVE_AT91_USB_CLK
-   select MIGHT_HAVE_PCI
select PINCTRL_AT91
select SOC_SAM_V4_V5
select SRAM if PM
diff --git a/arch/arm/mach-axxia/Kconfig b/arch/arm/mach-axxia/Kconfig
index 6c6d5e7..ee2e131 100644
--- a/arch/arm/mach-axxia/Kconfig
+++ b/arch/arm/mach-axxia/Kconfig
@@ -7,7 +7,6 @@ config ARCH_AXXIA
select ARM_TIMER_SP804
select HAVE_ARM_ARCH_TIMER
select MFD_SYSCON
-   select MIGHT_HAVE_PCI
select PCI_DOMAINS if PCI
select ZONE_DMA
help
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 8f820de..ee8a99c 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -126,7 +126,6 @@ config SOC_EXYNOS5440
select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
select HAVE_ARM_ARCH_TIMER
select AUTO_ZRELADDR
-   select MIGHT_HAVE_PCI
select PCI_DOMAINS if PCI
select PINCTRL_EXYNOS5440
select PM_OPP
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index 599f973..cefe44f 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -21,7 +21,6 @@ if ARCH_INTEGRATOR
 config ARCH_INTEGRATOR_AP
bool "Support Integrator/AP and Integrator/PP2 platforms"
select INTEGRATOR_AP_TIMER
-   select MIGHT_HAVE_PCI
select SERIAL_AMBA_PL010 if TTY
select SERIAL_AMBA_PL010_CONSOLE if TTY
select SOC_BUS
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index 8ff61be..1507287 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -8,7 +8,6 @@ config ARCH_KEYSTONE
select COMMON_CLK_KEYSTONE
select ARCH_SUPPORTS_BIG_ENDIAN
select ZONE_DMA if ARM_LPAE
-   select MIGHT_HAVE_PCI
select PCI_DOMAINS if PCI
select PINCTRL
help
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index b7260c2..1b6cae5 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -20,7 +20,6 @@ config ARCH_SPEAR13XX
select HAVE_ARM_TWD if SMP
select PINCTRL
select MFD_SYSCON
-   select MIGHT_HAVE_PCI
help
  Supports for ARM's SPEAR13XX family
 
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index b0cc262..c257d40 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -9,7 +9,6 @@ config ARCH_VERSATILE
select CPU_ARM926T
select ICST
select MFD_SYSCON
-   select MIGHT_HAVE_PCI
select PLAT_VERSATILE
select POWER_RESET
select POWER_RESET_VERSATILE
-- 
1.7.9.5



Re: [PATCH 3/4] pinctrl: sh-pfc: r8a7795: Add group for AVB MDIO and MII pins

2016-09-14 Thread Sergei Shtylyov

On 9/13/2016 5:03 PM, Niklas Söderlund wrote:


Group the AVB pins into similar groups found in other sh-pfc drivers.
The pins can not be muxed between functions other then AVB but there
drive strength can be controlled.

The group avb_mdc containing ADV_MDC and ADV_MDIO are on other SoCs
called avb_mdio. In pfc-r8a7795 the adv_mdc group already existed and

  ^^^ avb_mdc?


is in use in DT. Therefor the ADV_MDIO pin to the existing group


   Therefore. And you missed a verb.


instead of renaming it.

Signed-off-by: Niklas Söderlund 
---
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 30 +++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c 
b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
index 4a60f15..7b9a355 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c

[...]

 static const unsigned int can0_data_a_pins[] = {
@@ -3632,6 +3654,7 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
SH_PFC_PIN_GROUP(avb_avtp_capture_a),
SH_PFC_PIN_GROUP(avb_avtp_match_b),
SH_PFC_PIN_GROUP(avb_avtp_capture_b),
+   SH_PFC_PIN_GROUP(avb_mii),
SH_PFC_PIN_GROUP(can0_data_a),
SH_PFC_PIN_GROUP(can0_data_b),
SH_PFC_PIN_GROUP(can1_data),
@@ -3928,6 +3951,7 @@ static const char * const avb_groups[] = {
"avb_avtp_capture_a",
"avb_avtp_match_b",
"avb_avtp_capture_b",
+   "avb_mii",


   I'd prefer if this group preceded the capture/match groups.

[...]

MBR, Sergei



Re: [PATCH v7 0/6] UHS-I SDR-104 support for sh_mobile_sdhi

2016-09-14 Thread Simon Horman
On Tue, Sep 13, 2016 at 02:58:25PM +0200, Wolfram Sang wrote:
> On Tue, Sep 13, 2016 at 02:48:26PM +0200, Ulf Hansson wrote:
> > On 13 September 2016 at 12:56, Simon Horman  
> > wrote:
> > >
> > > Hi,
> > >
> > > this series is based on work by Ai Kyuse to add UHS-I SDR-104 support for
> > > sh_mobile_sdhi. It builds on work by Shinobu Uehara, Rob Taylor, William
> > > Towle and Ian Molton, Ben Hutchings, Wolfram Sang and others to add UHS-I
> > > SDR-50 support to the same driver.
> > >
> > > It is based on a merge of the next branches of the mmc tree.
> > >
> > > To aid review the following git branch is provided:
> > > * https:://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git 
> > > topic/sdr104-driver-v7
> > >
> > > Overview of changes since v6:
> > > * Address review by Ulf
> > >   - Detailed in per-patch changelogs
> > > * Move integration (arm/arm64 dt) patches to separate patchset
> > >
> > > Please see http://elinux.org/Tests:SD-SDHI-SDR104 for indicative tests
> > > results.
> > >
> > >
> > > Ai Kyuse (3):
> > >   mmc: tmio: enhance illegal sequence handling
> > >   mmc: tmio: Add hw reset support
> > >   mmc: tmio: Add tuning support
> > >
> > > Simon Horman (3):
> > >   mmc: core: Add helper to see if a host can be retuned
> > >   mmc: tmio: document mandatory and optional callbacks
> > >   mmc: sh_mobile_sdhi: Add tuning support
> > >
> > >  drivers/mmc/host/sh_mobile_sdhi.c | 265 
> > > +-
> > >  drivers/mmc/host/tmio_mmc.h   |  18 ++-
> > >  drivers/mmc/host/tmio_mmc_pio.c   |  87 -
> > >  include/linux/mmc/host.h  |   5 +
> > >  4 files changed, 367 insertions(+), 8 deletions(-)
> > >
> > > --
> > > 2.7.0.rc3.207.g0ac5344
> > >
> > 
> > This looks good to me, although I would like to get an ack from
> > Wolfram before I queue this up.
> 
> I'll test today or tomorrow. Same for the r7s72100 patches.

Thanks!

I found a logic error in the last patch of the series,
I proposed a fix in a sub-thread for that patch.

If you could use my proposed one-line fix when testing that would be great.



Re: [PATCH v7 6/6] mmc: sh_mobile_sdhi: Add tuning support

2016-09-14 Thread Simon Horman
On Tue, Sep 13, 2016 at 12:56:15PM +0200, Simon Horman wrote:
> Add tuning support for use with SDR104 mode
> This includes adding support for the sampling clock controller (SCC).
> 
> Based on work by Ai Kyuse.
> 
> Cc: Ai Kyuse 
> Signed-off-by: Simon Horman 

...

> Signed-off-by: Simon Horman 
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c | 265 
> +-
>  1 file changed, 264 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c 
> b/drivers/mmc/host/sh_mobile_sdhi.c
> index 49edff7fee49..32d3e01e0840 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c


...

> +static void sh_mobile_sdhi_hw_reset(struct tmio_mmc_host *host)
> +{
> + struct sh_mobile_sdhi *priv;
> +
> + if (host->mmc->caps & MMC_CAP_UHS_SDR104)
> + return;

The logic above is inverted, it should be:

if (!(host->mmc->caps & MMC_CAP_UHS_SDR104))
return;

An observable side effect of the above is that on the r8a7796/Salvator-X
a card is not detected after being ejected and re-inserted.


[git pull] pinctrl: sh-pfc: Updates for v4.9 (take three)

2016-09-14 Thread Geert Uytterhoeven
Hi Linus,

The following changes since commit 374cf6992de89fc38d4d923c89b40816d341d678:

  pinctrl: sh-pfc: r8a7796: Add SDHI pins, groups and functions (2016-08-19 
09:37:20 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git 
tags/sh-pfc-for-v4.9-tag3

for you to fetch changes up to 77fd4136e58c642482f03d293d5717658a569b4b:

  pinctrl: sh-pfc: r8a7794: Implement voltage switching for SDHI (2016-09-14 
09:26:54 +0200)


pinctrl: sh-pfc: Updates for v4.9 (take three)

  - Return pinconf with arguments in packed format,
  - MSIOF and QSPI pin groups on R-Car V2H,
  - Voltage switching for SDHI on R-Car M2-W, E2, and M3-W.

Thanks for pulling!

Niklas Söderlund (1):
  pinctrl: sh-pfc: Return pinconf with arguments in packed format

Sergei Shtylyov (2):
  pinctrl: sh-pfc: r8a7792: Add QSPI pin groups
  pinctrl: sh-pfc: r8a7792: Add MSIOF pin groups

Simon Horman (4):
  pinctrl: sh-pfc: r8a7796: Add voltage switch operations for SDHI
  pinctrl: sh-pfc: Add PORT_GP_24 helper macro
  pinctrl: sh-pfc: r8a7791: Implement voltage switching for SDHI
  pinctrl: sh-pfc: r8a7794: Implement voltage switching for SDHI

 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |  29 -
 drivers/pinctrl/sh-pfc/pfc-r8a7792.c | 115 +++
 drivers/pinctrl/sh-pfc/pfc-r8a7794.c |  28 -
 drivers/pinctrl/sh-pfc/pfc-r8a7796.c |  28 -
 drivers/pinctrl/sh-pfc/pinctrl.c |   8 ++-
 drivers/pinctrl/sh-pfc/sh_pfc.h  |   8 ++-
 6 files changed, 207 insertions(+), 9 deletions(-)

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


[git pull] clk: renesas: Updates for v4.9 (take three)

2016-09-14 Thread Geert Uytterhoeven
Hi Mike, Stephen,

The following changes since commit 074969813350cda4c624a585489cc1b3550414bc:

  clk: renesas: r8a7796: Add SDIF clocks (2016-08-23 10:30:41 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git 
tags/clk-renesas-for-v4.9-tag3

for you to fetch changes up to 5fad71f58f4c236118358c98f65a7251e9c718f7:

  clk: renesas: r8a7796: Add CMT clocks (2016-09-12 11:08:01 +0200)


clk: renesas: Updates for v4.9 (take three)

  - External crystal selection for RZ/A1,
  - CMT clocks for R-Car H3 and M3-W,
  - RAVB and Thermal clocks for R-Car M3-W.

Thanks for pulling!

Bui Duc Phuc (2):
  clk: renesas: r8a7795: Add CMT clocks
  clk: renesas: r8a7796: Add CMT clocks

Chris Brandt (1):
  clk: renesas: rz: Select EXTAL vs USB clock

Khiem Nguyen (1):
  clk: renesas: r8a7796: Add THS/TSC clock

Laurent Pinchart (1):
  clk: renesas: r8a7796: Add RAVB clock

 drivers/clk/renesas/clk-rz.c   | 24 ++--
 drivers/clk/renesas/r8a7795-cpg-mssr.c |  4 
 drivers/clk/renesas/r8a7796-cpg-mssr.c |  6 ++
 3 files changed, 32 insertions(+), 2 deletions(-)

Gr{oetje,eeting}s,

Geert

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

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


Re: [PATCH 04/13] v4l: vsp1: Repair race between frame end and qbuf handler

2016-09-14 Thread Kieran Bingham
On 14/09/16 00:16, Laurent Pinchart wrote:
> From: Kieran Bingham 
> 
> The frame-end function releases and completes the buffers on the input
> and output entities of the pipe before marking the pipe->state as
> 'STOPPED'. This introduces a race whereby with the pipe->state still
> 'RUNNING', a QBUF handler can commence processing a frame before the
> frame_end function has completed.
> 
> In the event that this happens, a frame queued by QBUF hangs due to the
> incorrect pipe->state setting which prevents vsp1_pipeline_run from
> issuing a CMD_STRCMD.
> 
> By locking the entire function we prevent this from occurring, but we
> also change the locking state of the buffer release code. This has been
> analysed visually as acceptable, but it must be considered that this now
> causes the video->irqlock to be taken under the pipe->irqlock context.
> 
> Signed-off-by: Laurent Pinchart 


This patch is of course perfectly welcome to my SoB:
Signed-off-by: Kieran Bingham 

> ---
>  drivers/media/platform/vsp1/vsp1_video.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
> b/drivers/media/platform/vsp1/vsp1_video.c
> index ed9759e8a6fc..cd7d215ed455 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -234,18 +234,13 @@ static void vsp1_video_frame_end(struct vsp1_pipeline 
> *pipe,
>  {
>   struct vsp1_video *video = rwpf->video;
>   struct vsp1_vb2_buffer *buf;
> - unsigned long flags;
>  
>   buf = vsp1_video_complete_buffer(video);
>   if (buf == NULL)
>   return;
>  
> - spin_lock_irqsave(&pipe->irqlock, flags);
> -
>   video->rwpf->mem = buf->mem;
>   pipe->buffers_ready |= 1 << video->pipe_index;
> -
> - spin_unlock_irqrestore(&pipe->irqlock, flags);
>  }
>  
>  static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe)
> @@ -285,6 +280,8 @@ static void vsp1_video_pipeline_frame_end(struct 
> vsp1_pipeline *pipe)
>   unsigned long flags;
>   unsigned int i;
>  
> + spin_lock_irqsave(&pipe->irqlock, flags);
> +
>   /* Complete buffers on all video nodes. */
>   for (i = 0; i < vsp1->info->rpf_count; ++i) {
>   if (!pipe->inputs[i])
> @@ -295,8 +292,6 @@ static void vsp1_video_pipeline_frame_end(struct 
> vsp1_pipeline *pipe)
>  
>   vsp1_video_frame_end(pipe, pipe->output);
>  
> - spin_lock_irqsave(&pipe->irqlock, flags);
> -
>   state = pipe->state;
>   pipe->state = VSP1_PIPELINE_STOPPED;
>  
>