[PATCH] arm64: dts: renesas: r8a77990: ebisu: Enable watchdog timer

2018-06-05 Thread Geert Uytterhoeven
From: Takeshi Kihara 

Add a device node for the Watchdog Timer (WDT) controller on the
R8A77990 SoC, and enable the watchdog on the Ebisu board.

Signed-off-by: Takeshi Kihara 
[geert: Squashed 2 commits]
Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |  5 +
 arch/arm64/boot/dts/renesas/r8a77990.dtsi  | 10 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts 
b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
index 7a09d0524f9b0663..28945a8b980080f2 100644
--- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
@@ -60,6 +60,11 @@
};
 };
 
+ {
+   timeout-sec = <60>;
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi 
b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
index 6d597a1c7636784f..735881d4e57ac1ad 100644
--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
@@ -69,6 +69,16 @@
#size-cells = <2>;
ranges;
 
+   rwdt: watchdog@e602 {
+   compatible = "renesas,r8a77990-wdt",
+"renesas,rcar-gen3-wdt";
+   reg = <0 0xe602 0 0x0c>;
+   clocks = < CPG_MOD 402>;
+   power-domains = < 32>;
+   resets = < 402>;
+   status = "disabled";
+   };
+
gpio0: gpio@e605 {
compatible = "renesas,gpio-r8a77990",
 "renesas,rcar-gen3-gpio";
-- 
2.7.4



[PATCH] dt-bindings: watchdog: renesas-wdt: Add support for the R8A77990 wdt

2018-06-05 Thread Geert Uytterhoeven
From: Masaharu Hayakawa 

Document support for the Watchdog Timer (WDT) Controller in the Renesas
R-Car E3 (R8A77990) SoC.

No driver update is needed.

Signed-off-by: Masaharu Hayakawa 
Signed-off-by: Geert Uytterhoeven 
---
 Documentation/devicetree/bindings/watchdog/renesas-wdt.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt 
b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
index f24d802b8056f6c6..5d47a262474cfe0e 100644
--- a/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/renesas-wdt.txt
@@ -16,6 +16,7 @@ Required properties:
 - "renesas,r8a7796-wdt" (R-Car M3-W)
 - "renesas,r8a77965-wdt" (R-Car M3-N)
 - "renesas,r8a77970-wdt" (R-Car V3M)
+- "renesas,r8a77990-wdt" (R-Car E3)
 - "renesas,r8a77995-wdt" (R-Car D3)
 - "renesas,r7s72100-wdt" (RZ/A1)
The generic compatible string must be:
-- 
2.7.4



[PATCH] arm64: dts: renesas: r8a77990: Add secondary CA53 CPU core

2018-06-05 Thread Geert Uytterhoeven
Add a device node for the second Cortex-A53 CPU core on the Renesas
R-Car E3 (r8a77990) SoC, and adjust the interrupt delivery masks for ARM
Generic Interrupt Controller and Architectured Timer.

Based on a patch in the BSP by Takeshi Kihara.

Signed-off-by: Geert Uytterhoeven 
---
Note that the PSCI implementation on Ebisu may be a preliminary version
with some familiar quirks:
  - SMP bringup works, and both CPUs can be used,
  - CPU1 can be offlined, but trying to bring it online again crashes
the system.

I'm confident this will be fixed in future firmware versions, just like
on H3/Salvator-X.
---
 arch/arm64/boot/dts/renesas/r8a77990.dtsi | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi 
b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
index be4f519711a1b029..6d597a1c7636784f 100644
--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
@@ -17,16 +17,24 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   /* 1 core only at this point */
a53_0: cpu@0 {
compatible = "arm,cortex-a53", "arm,armv8";
-   reg = <0x0>;
+   reg = <0>;
device_type = "cpu";
power-domains = < 5>;
next-level-cache = <_CA53>;
enable-method = "psci";
};
 
+   a53_1: cpu@1 {
+   compatible = "arm,cortex-a53", "arm,armv8";
+   reg = <1>;
+   device_type = "cpu";
+   power-domains = < 6>;
+   next-level-cache = <_CA53>;
+   enable-method = "psci";
+   };
+
L2_CA53: cache-controller-0 {
compatible = "cache";
power-domains = < 21>;
@@ -44,8 +52,9 @@
 
pmu_a53 {
compatible = "arm,cortex-a53-pmu";
-   interrupts-extended = < GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
-   interrupt-affinity = <_0>;
+   interrupts-extended = < GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>,
+ < GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
+   interrupt-affinity = <_0>, <_1>;
};
 
psci {
@@ -258,7 +267,7 @@
  <0x0 0xf104 0 0x2>,
  <0x0 0xf106 0 0x2>;
interrupts = ;
+   (GIC_CPU_MASK_SIMPLE(2) | 
IRQ_TYPE_LEVEL_HIGH)>;
clocks = < CPG_MOD 408>;
clock-names = "clk";
power-domains = < 32>;
@@ -273,9 +282,9 @@
 
timer {
compatible = "arm,armv8-timer";
-   interrupts-extended = < GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) 
| IRQ_TYPE_LEVEL_LOW)>,
- < GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) 
| IRQ_TYPE_LEVEL_LOW)>;
+   interrupts-extended = < GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) 
| IRQ_TYPE_LEVEL_LOW)>,
+ < GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) 
| IRQ_TYPE_LEVEL_LOW)>;
};
 };
-- 
2.7.4



[PATCH] soc: renesas: rcar-sysc: Make PM domain initialization more robust

2018-06-05 Thread Geert Uytterhoeven
The quirk for R-Car E3 ES1.0 added in commit 086b399965a7ee7e ("soc:
renesas: r8a77990-sysc: Add workaround for 3DG-{A,B}") makes the 3DG-A
PM domain a subdomain of the 3DG-B PM domain.  However, registering
3DG-A with its parent fails silently, as the 3DG-B PM domain hasn't been
registered yet, and such failures are never reported.

Fix this by:
  1. Splitting PM Domain initialization in two steps, so all PM domains
 are registered before any child-parent links are established,
  2. Reporting any failures in establishing child-parent relations.

Check for and report pm_genpd_init() failures, too, as that function
gained a return value in commit 7eb231c337e00735 ("PM / Domains: Convert
pm_genpd_init() to return an error code").

Fixes: 086b399965a7ee7e ("soc: renesas: r8a77990-sysc: Add workaround for 
3DG-{A,B}")
Signed-off-by: Geert Uytterhoeven 
---
 drivers/soc/renesas/rcar-sysc.c | 35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index 4db53fa38abc5cf3..99e926f68299878d 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -379,11 +379,12 @@ static int rcar_sysc_pd_power_on(struct generic_pm_domain 
*genpd)
 
 static bool has_cpg_mstp;
 
-static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd)
+static int __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd)
 {
struct generic_pm_domain *genpd = >genpd;
const char *name = pd->genpd.name;
struct dev_power_governor *gov = _qos_governor;
+   int error;
 
if (pd->flags & PD_CPU) {
/*
@@ -436,7 +437,11 @@ static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd 
*pd)
rcar_sysc_power_up(>ch);
 
 finalize:
-   pm_genpd_init(genpd, gov, false);
+   error = pm_genpd_init(genpd, gov, false);
+   if (error)
+   pr_err("Failed to init PM domain %s: %d\n", name, error);
+
+   return error;
 }
 
 static const struct of_device_id rcar_sysc_matches[] __initconst = {
@@ -560,6 +565,9 @@ static int __init rcar_sysc_pd_init(void)
pr_debug("%pOF: syscier = 0x%08x\n", np, syscier);
iowrite32(syscier, base + SYSCIER);
 
+   /*
+* First, create all PM domains
+*/
for (i = 0; i < info->num_areas; i++) {
const struct rcar_sysc_area *area = >areas[i];
struct rcar_sysc_pd *pd;
@@ -582,14 +590,29 @@ static int __init rcar_sysc_pd_init(void)
pd->ch.isr_bit = area->isr_bit;
pd->flags = area->flags;
 
-   rcar_sysc_pd_setup(pd);
-   if (area->parent >= 0)
-   pm_genpd_add_subdomain(domains->domains[area->parent],
-  >genpd);
+   error = rcar_sysc_pd_setup(pd);
+   if (error)
+   goto out_put;
 
domains->domains[area->isr_bit] = >genpd;
}
 
+   /*
+* Second, link all PM domains to their parents
+*/
+   for (i = 0; i < info->num_areas; i++) {
+   const struct rcar_sysc_area *area = >areas[i];
+
+   if (!area->name || area->parent < 0)
+   continue;
+
+   error = pm_genpd_add_subdomain(domains->domains[area->parent],
+  domains->domains[area->isr_bit]);
+   if (error)
+   pr_warn("Failed to add PM subdomain %s to parent %u\n",
+   area->name, area->parent);
+   }
+
error = of_genpd_add_provider_onecell(np, >onecell_data);
 
 out_put:
-- 
2.7.4



renesas-drivers-2018-06-05-v4.17

2018-06-05 Thread Geert Uytterhoeven
I have pushed renesas-drivers-2018-06-05-v4.17 to
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git

This tree is meant to ease development of platform support and drivers
for Renesas ARM SoCs. It is created by merging (a) the for-next branches
of various subsystem trees and (b) branches with driver code submitted
or planned for submission to maintainers into the development branch of
Simon Horman's renesas.git tree.

Today's version is based on renesas-devel-20180604-v4.17.

Included branches with driver code:
  - clk-renesas
  - sh-pfc
  - topic/bd9571-ddr-backup-mode-driver-v3
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git#topic/ipmmu-driver-v6
  - git://linuxtv.org/pinchartl/media.git#drm-du-iommu-v1-20171115
  - git://git.ragnatech.se/linux#for-renesas-drivers
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/kbingham/rcar.git#tags/vsp1/du/interlaced/v4.5

Included fixes:
  - [LOCAL] arm64: defconfig: Update renesas_defconfig

Included subsystem trees (the last four are due to an issue with Mark
Brown's for-next branches):
  - git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git#linux-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git#clk-next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git#for-next
  - git://git.infradead.org/users/dedekind/l2-mtd-2.6.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git#tty-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git#i2c/for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git#usb-next
  - git://people.freedesktop.org/~airlied/linux#drm-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git#next
  - git://linuxtv.org/media_tree.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git#for-next
  - git://git.linaro.org/people/daniel.lezcano/linux.git#clockevents/next
  - git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git#testing/next
  - git://git.infradead.org/users/vkoul/slave-dma.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git#staging-next
  - git://git.armlinux.org.uk/~rmk/linux-arm.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git#next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git#for-next
  - git://git.infradead.org/users/jcooper/linux.git#irqchip/for-next
  - git://github.com/bzolnier/linux.git#fbdev-for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git#for-next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git#for-next
  - git://www.linux-watchdog.org/linux-watchdog-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git#for-next/core
  - git://anongit.freedesktop.org/drm/drm-misc#for-linux-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
  - git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git#next
  - git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git#for-mfd-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git#for-next
  - 
git://git.armlinux.org.uk/~rmk/linux-arm.git#/git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
 spi-v4.18
  - 
git://git.armlinux.org.uk/~rmk/linux-arm.git#/git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
 regmap-v4.18
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git#a9ac77cd2b0ee009
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git#7a5421d2f6c16eab

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 V3] ARM: shmobile: Rework the PMIC IRQ line quirk

2018-06-05 Thread Marek Vasut
On 06/05/2018 10:07 AM, Simon Horman wrote:
> On Mon, Jun 04, 2018 at 07:59:11PM +0200, Marek Vasut wrote:
>> Rather than hard-coding the quirk topology, which stopped scaling,
>> parse the information from DT. The code looks for all compatible
>> PMICs -- da9036 and da9210 -- and checks if their IRQ line is tied
>> to the same pin. If so, the code sends a matching sequence to the
>> PMIC to deassert the IRQ.
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Geert Uytterhoeven 
>> Cc: Kuninori Morimoto 
>> Cc: Simon Horman 
>> Cc: Wolfram Sang 
>> Cc: linux-renesas-soc@vger.kernel.org
>> ---
>> V2: - Replace the DT shared IRQ check loop with memcmp()
>> - Send the I2C message to deassert the IRQ line to all PMICs
>>   in the list with shared IRQ line instead of just one
>> - Add comment that this works only in case all the PMICs are
>>   on the same I2C bus
>> V3: - Drop the addr = 0x00 init
>> - Drop reinit of argsa in rcar_gen2_regulator_quirk
>> ---
>>  arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 114 
>> -
>>  1 file changed, 90 insertions(+), 24 deletions(-)
>>
>> diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c 
>> b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
>> index 93f628acfd94..b919073aa27e 100644
>> --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
>> +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
>> @@ -31,8 +31,10 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  
>>  
>> @@ -44,34 +46,45 @@
>>  /* start of DA9210 System Control and Event Registers */
>>  #define DA9210_REG_MASK_A   0x54
>>  
>> +struct regulator_quirk {
>> +struct list_headlist;
>> +const struct of_device_id   *id;
>> +struct of_phandle_args  irq_args;
>> +struct i2c_msg  i2c_msg;
>> +boolshared; /* IRQ line is shared */
>> +};
>> +
>> +static LIST_HEAD(quirk_list);
>>  static void __iomem *irqc;
>>  
>>  /* first byte sets the memory pointer, following are consecutive reg values 
>> */
>>  static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 
>> 0xff };
>>  static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff };
>>  
>> -static struct i2c_msg da9xxx_msgs[3] = {
>> -{
>> -.addr = 0x58,
>> -.len = ARRAY_SIZE(da9063_irq_clr),
>> -.buf = da9063_irq_clr,
>> -}, {
>> -.addr = 0x68,
>> -.len = ARRAY_SIZE(da9210_irq_clr),
>> -.buf = da9210_irq_clr,
>> -}, {
>> -.addr = 0x70,
>> -.len = ARRAY_SIZE(da9210_irq_clr),
>> -.buf = da9210_irq_clr,
>> -},
>> +static struct i2c_msg da9063_msgs = {
>> +.len = ARRAY_SIZE(da9063_irq_clr),
>> +.buf = da9063_irq_clr,
>> +};
>> +
>> +static struct i2c_msg da9210_msgs = {
>> +.len = ARRAY_SIZE(da9210_irq_clr),
>> +.buf = da9210_irq_clr,
>> +};
>> +
>> +static const struct of_device_id rcar_gen2_quirk_match[] = {
>> +{ .compatible = "dlg,da9063", .data = _msgs },
>> +{ .compatible = "dlg,da9210", .data = _msgs },
>> +{},
>>  };
>>  
>>  static int regulator_quirk_notify(struct notifier_block *nb,
>>unsigned long action, void *data)
>>  {
>> +struct regulator_quirk *pos, *tmp;
>>  struct device *dev = data;
>>  struct i2c_client *client;
>>  static bool done;
>> +int ret;
>>  u32 mon;
>>  
>>  if (done)
>> @@ -88,17 +101,20 @@ static int regulator_quirk_notify(struct notifier_block 
>> *nb,
>>  client = to_i2c_client(dev);
>>  dev_dbg(dev, "Detected %s\n", client->name);
>>  
>> -if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) ||
>> -(client->addr == 0x68 && !strcmp(client->name, "da9210")) ||
>> -(client->addr == 0x70 && !strcmp(client->name, "da9210"))) {
>> -int ret, len;
>> +/*
>> + * Send message to all PMICs that share an IRQ line to deassert it.
>> + *
>> + * WARNING: This works only if all the PMICs are on the same I2C bus.
>> + */
>> +list_for_each_entry(pos, _list, list) {
>> +if (!pos->shared)
>> +continue;
>>  
>> -/* There are two DA9210 on Stout, one on the other boards. */
>> -len = of_machine_is_compatible("renesas,stout") ? 3 : 2;
>> +dev_info(>dev, "clearing %s@0x%02x interrupts\n",
>> + pos->id->compatible, pos->i2c_msg.addr);
>>  
>> -dev_info(>dev, "clearing da9063/da9210 interrupts\n");
>> -ret = i2c_transfer(client->adapter, da9xxx_msgs, len);
>> -if (ret != len)
>> +ret = i2c_transfer(client->adapter, >i2c_msg, 1);
>> +if (ret != 1)
>>  dev_err(>dev, "i2c error %d\n", ret);
>>  }
>>  
>> @@ -111,6 +127,11 @@ static int regulator_quirk_notify(struct 

Re: [PATCH V3] ARM: shmobile: Rework the PMIC IRQ line quirk

2018-06-05 Thread Marek Vasut
On 06/05/2018 11:21 AM, Wolfram Sang wrote:
> Hi Marek,
> 
> On Tue, Jun 05, 2018 at 10:07:28AM +0200, Simon Horman wrote:
>> On Mon, Jun 04, 2018 at 07:59:11PM +0200, Marek Vasut wrote:
>>> Rather than hard-coding the quirk topology, which stopped scaling,
>>> parse the information from DT. The code looks for all compatible
>>> PMICs -- da9036 and da9210 -- and checks if their IRQ line is tied
>>> to the same pin. If so, the code sends a matching sequence to the
>>> PMIC to deassert the IRQ.
>>>
>>> Signed-off-by: Marek Vasut 
>>> Cc: Geert Uytterhoeven 
>>> Cc: Kuninori Morimoto 
>>> Cc: Simon Horman 
>>> Cc: Wolfram Sang 
> 
> From an I2C point of view:
> 
> Acked-by: Wolfram Sang 
> 
> Minor nits:
> 
>>> @@ -122,7 +143,13 @@ static struct notifier_block regulator_quirk_nb = {
>>>  
>>>  static int __init rcar_gen2_regulator_quirk(void)
>>>  {
>>> -   u32 mon;
>>> +   struct device_node *np;
>>> +   const struct of_device_id *id;
>>> +   struct regulator_quirk *quirk;
>>> +   struct regulator_quirk *pos;
> 
> Merge the last two lines into one?
> 
>>> +   struct of_phandle_args *argsa, *argsb;
>>> +   u32 mon, addr;
>>> +   int ret;
>>>  
>>> if (!of_machine_is_compatible("renesas,koelsch") &&
>>> !of_machine_is_compatible("renesas,lager") &&
>>> @@ -130,6 +157,45 @@ static int __init rcar_gen2_regulator_quirk(void)
>>> !of_machine_is_compatible("renesas,gose"))
>>> return -ENODEV;
>>>  
>>> +   for_each_matching_node_and_match(np, rcar_gen2_quirk_match, ) {
>>> +   if (!np || !of_device_is_available(np))
> 
> Can '!np' actually happen? This is the exit condition of the for-loop,
> or am I overlooking something?

I had to take a look again, no, it's not needed.

-- 
Best regards,
Marek Vasut


[PATCH v5 0/2] R-Car DU: Convert DT to new DU and LVDS bindings

2018-06-05 Thread Laurent Pinchart
Hello,

This small patch series contains the last two remaining patches from
"[PATCH v4 00/16] R-Car DU: Convert LVDS code to bridge driver". Apart from
the individual SoC patches being squashed together as requested by the ARM-SoC
maintainers there's nothing special here.

Laurent Pinchart (2):
  ARM: dts: rcar-gen2: Convert to new DU DT bindings
  arm64: dts: renesas: Convert to new LVDS DT bindings

 arch/arm/boot/dts/r8a7792.dtsi |  1 -
 arch/arm/boot/dts/r8a7794.dtsi |  1 -
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts|  3 +-
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  3 +-
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   | 36 ++
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |  3 +-
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   | 36 ++
 10 files changed, 66 insertions(+), 26 deletions(-)

-- 
Regards,

Laurent Pinchart



Re: [PATCH V3] ARM: shmobile: Rework the PMIC IRQ line quirk

2018-06-05 Thread Wolfram Sang
Hi Marek,

On Tue, Jun 05, 2018 at 10:07:28AM +0200, Simon Horman wrote:
> On Mon, Jun 04, 2018 at 07:59:11PM +0200, Marek Vasut wrote:
> > Rather than hard-coding the quirk topology, which stopped scaling,
> > parse the information from DT. The code looks for all compatible
> > PMICs -- da9036 and da9210 -- and checks if their IRQ line is tied
> > to the same pin. If so, the code sends a matching sequence to the
> > PMIC to deassert the IRQ.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Geert Uytterhoeven 
> > Cc: Kuninori Morimoto 
> > Cc: Simon Horman 
> > Cc: Wolfram Sang 

From an I2C point of view:

Acked-by: Wolfram Sang 

Minor nits:

> > @@ -122,7 +143,13 @@ static struct notifier_block regulator_quirk_nb = {
> >  
> >  static int __init rcar_gen2_regulator_quirk(void)
> >  {
> > -   u32 mon;
> > +   struct device_node *np;
> > +   const struct of_device_id *id;
> > +   struct regulator_quirk *quirk;
> > +   struct regulator_quirk *pos;

Merge the last two lines into one?

> > +   struct of_phandle_args *argsa, *argsb;
> > +   u32 mon, addr;
> > +   int ret;
> >  
> > if (!of_machine_is_compatible("renesas,koelsch") &&
> > !of_machine_is_compatible("renesas,lager") &&
> > @@ -130,6 +157,45 @@ static int __init rcar_gen2_regulator_quirk(void)
> > !of_machine_is_compatible("renesas,gose"))
> > return -ENODEV;
> >  
> > +   for_each_matching_node_and_match(np, rcar_gen2_quirk_match, ) {
> > +   if (!np || !of_device_is_available(np))

Can '!np' actually happen? This is the exit condition of the for-loop,
or am I overlooking something?

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH v4 00/16] R-Car DU: Convert LVDS code to bridge driver

2018-06-05 Thread Simon Horman
On Mon, May 28, 2018 at 12:29:15PM +0200, Simon Horman wrote:
> On Mon, May 28, 2018 at 12:45:32PM +0300, Laurent Pinchart wrote:
> > Hi Simon,
> > 
> > On Monday, 28 May 2018 12:39:17 EEST Simon Horman wrote:
> > > On Fri, May 25, 2018 at 01:23:53PM +0300, Laurent Pinchart wrote:
> > > > On Friday, 25 May 2018 13:13:20 EEST Simon Horman wrote:
> > > >> On Thu, May 24, 2018 at 11:00:52AM +0300, Laurent Pinchart wrote:
> > > >>> On Wednesday, 21 February 2018 18:39:25 EEST Simon Horman wrote:
> > >  On Wed, Feb 21, 2018 at 01:10:30AM +0200, Laurent Pinchart wrote:
> > > > 
> > > > [snip]
> > > > 
> > > > Laurent Pinchart (11):
> > > >   dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
> > > >   dt-bindings: display: renesas: Deprecate LVDS support in the DU
> > > > bindings
> > > >   drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
> > > >   drm: rcar-du: Convert LVDS encoder code to bridge driver
> > > >   ARM: dts: r8a7790: Convert to new LVDS DT bindings
> > > >   ARM: dts: r8a7791: Convert to new LVDS DT bindings
> > > >   ARM: dts: r8a7792: Convert to new DU DT bindings
> > > >   ARM: dts: r8a7793: Convert to new LVDS DT bindings
> > > >   ARM: dts: r8a7794: Convert to new DU DT bindings
> > > >   arm64: dts: renesas: r8a7795: Convert to new LVDS DT bindings
> > > >   arm64: dts: renesas: r8a7796: Convert to new LVDS DT bindings
> > >  
> > >  I have marked the dts patches above as deferred as they depend
> > >  on the driver changes not to cause a regression. Please repost them
> > >  or otherwise ping me once the driver dependencies are present in an
> > >  rc release.
> > > >>> 
> > > >>> The driver changes have made it to v4.17-rc1. Is it too late for v4.18
> > > >>> ?
> > > >> 
> > > >> Unfortunately it is. Shall I apply them for v4.19?
> > > > 
> > > > Please do.
> > > 
> > > Hi Laurent,
> > > 
> > > I'm sorry to have to ask this, but in the light of Olof Johansson's recent
> > > comments in ("Re: [GIT PULL] Renesas ARM64 Based SoC DT Updates for 
> > > v4.18")
> > > please consider squashing the DTS patches and reposting.
> > 
> > It's about time we stopped trying to game the kernel patch statistics :-)
> > 
> > Before I repost, has there been a consensus on the new rule ? And how are 
> > we 
> > expected to proceed from now on ?
> 
> No, there has not been. And I think there needs to be.

Here is my general advice:

When making changes to several files, if you feel that its the same change
made to those several files, then please consider one patch instead
of per-file patches.

What I am suggesting by the above is that we tweak our processes to
reduce the number of patches. If this goes poorly we can learn and go back
to the old patch per-file model. If it goes well we can consider further
patch consolidation.

I know that this is not a hard rule. But for now I'd like to leave people
with some discretion. Lets guide each other via the review process
as this tweaking of our process evolves.


Re: [PATCH V3] ARM: shmobile: Rework the PMIC IRQ line quirk

2018-06-05 Thread Simon Horman
On Mon, Jun 04, 2018 at 07:59:11PM +0200, Marek Vasut wrote:
> Rather than hard-coding the quirk topology, which stopped scaling,
> parse the information from DT. The code looks for all compatible
> PMICs -- da9036 and da9210 -- and checks if their IRQ line is tied
> to the same pin. If so, the code sends a matching sequence to the
> PMIC to deassert the IRQ.
> 
> Signed-off-by: Marek Vasut 
> Cc: Geert Uytterhoeven 
> Cc: Kuninori Morimoto 
> Cc: Simon Horman 
> Cc: Wolfram Sang 
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> V2: - Replace the DT shared IRQ check loop with memcmp()
> - Send the I2C message to deassert the IRQ line to all PMICs
>   in the list with shared IRQ line instead of just one
> - Add comment that this works only in case all the PMICs are
>   on the same I2C bus
> V3: - Drop the addr = 0x00 init
> - Drop reinit of argsa in rcar_gen2_regulator_quirk
> ---
>  arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 114 
> -
>  1 file changed, 90 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c 
> b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
> index 93f628acfd94..b919073aa27e 100644
> --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
> +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
> @@ -31,8 +31,10 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  
> @@ -44,34 +46,45 @@
>  /* start of DA9210 System Control and Event Registers */
>  #define DA9210_REG_MASK_A0x54
>  
> +struct regulator_quirk {
> + struct list_headlist;
> + const struct of_device_id   *id;
> + struct of_phandle_args  irq_args;
> + struct i2c_msg  i2c_msg;
> + boolshared; /* IRQ line is shared */
> +};
> +
> +static LIST_HEAD(quirk_list);
>  static void __iomem *irqc;
>  
>  /* first byte sets the memory pointer, following are consecutive reg values 
> */
>  static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff 
> };
>  static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff };
>  
> -static struct i2c_msg da9xxx_msgs[3] = {
> - {
> - .addr = 0x58,
> - .len = ARRAY_SIZE(da9063_irq_clr),
> - .buf = da9063_irq_clr,
> - }, {
> - .addr = 0x68,
> - .len = ARRAY_SIZE(da9210_irq_clr),
> - .buf = da9210_irq_clr,
> - }, {
> - .addr = 0x70,
> - .len = ARRAY_SIZE(da9210_irq_clr),
> - .buf = da9210_irq_clr,
> - },
> +static struct i2c_msg da9063_msgs = {
> + .len = ARRAY_SIZE(da9063_irq_clr),
> + .buf = da9063_irq_clr,
> +};
> +
> +static struct i2c_msg da9210_msgs = {
> + .len = ARRAY_SIZE(da9210_irq_clr),
> + .buf = da9210_irq_clr,
> +};
> +
> +static const struct of_device_id rcar_gen2_quirk_match[] = {
> + { .compatible = "dlg,da9063", .data = _msgs },
> + { .compatible = "dlg,da9210", .data = _msgs },
> + {},
>  };
>  
>  static int regulator_quirk_notify(struct notifier_block *nb,
> unsigned long action, void *data)
>  {
> + struct regulator_quirk *pos, *tmp;
>   struct device *dev = data;
>   struct i2c_client *client;
>   static bool done;
> + int ret;
>   u32 mon;
>  
>   if (done)
> @@ -88,17 +101,20 @@ static int regulator_quirk_notify(struct notifier_block 
> *nb,
>   client = to_i2c_client(dev);
>   dev_dbg(dev, "Detected %s\n", client->name);
>  
> - if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) ||
> - (client->addr == 0x68 && !strcmp(client->name, "da9210")) ||
> - (client->addr == 0x70 && !strcmp(client->name, "da9210"))) {
> - int ret, len;
> + /*
> +  * Send message to all PMICs that share an IRQ line to deassert it.
> +  *
> +  * WARNING: This works only if all the PMICs are on the same I2C bus.
> +  */
> + list_for_each_entry(pos, _list, list) {
> + if (!pos->shared)
> + continue;
>  
> - /* There are two DA9210 on Stout, one on the other boards. */
> - len = of_machine_is_compatible("renesas,stout") ? 3 : 2;
> + dev_info(>dev, "clearing %s@0x%02x interrupts\n",
> +  pos->id->compatible, pos->i2c_msg.addr);
>  
> - dev_info(>dev, "clearing da9063/da9210 interrupts\n");
> - ret = i2c_transfer(client->adapter, da9xxx_msgs, len);
> - if (ret != len)
> + ret = i2c_transfer(client->adapter, >i2c_msg, 1);
> + if (ret != 1)
>   dev_err(>dev, "i2c error %d\n", ret);
>   }
>  
> @@ -111,6 +127,11 @@ static int regulator_quirk_notify(struct notifier_block 
> *nb,
>  remove:
>   dev_info(dev, "IRQ2 is not asserted, removing quirk\n");
>  
> + 

Re: [PATCH] arm64: dts: renesas: r8a7796: Add PCIe device nodes

2018-06-05 Thread Simon Horman
On Tue, Jun 05, 2018 at 02:49:08AM +0900, Yoshihiro Kaneko wrote:
> From: Harunobu Kurokawa 
> 
> This patch adds PCIe{0,1} device nodes for R8A7796 SoC.
> 
> Signed-off-by: Harunobu Kurokawa 
> Signed-off-by: Takeshi Kihara 
> Signed-off-by: Yoshihiro Kaneko 

Hi,

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

Reviewed-by: Simon Horman