Re: [PATCH v2 0/4] arm64: dts: r8a7795: Add HSUSB device node and enable channel 0 of USB2.0
On Tue, May 24, 2016 at 07:34:14PM +0900, Yoshihiro Shimoda wrote: > This patch is based on the renesas-drivers / renesas-drivers-2016-05-17-v4.6 > tag. Thanks, I have queued this up for v4.8. Please let me know if that was not your intention.
Re: [PATCH v3 1/3] arm64: dts: r8a7796: Add Renesas R8A7796 SoC support
On Wed, May 25, 2016 at 09:38:23AM +0200, Dirk Behme wrote: > On 24.05.2016 03:54, Simon Horman wrote: > >Basic support for the Gen 3 R-Car M3-W SoC. > > > >Based on work for the r8a7795 and r8a7796 SoCs by > >Takeshi Kihara, Dirk Behme and Geert Uytterhoeven. > > > >Signed-off-by: Simon Horman> >Reviewed-by: Geert Uytterhoeven > >--- > >v3 > >* As suggested by Geert Uytterhoeven: > > - Drop 0x from unit address of gic > >* As suggested by Khiem Nguyen: > > - Use psci-0.2 > >* Added Reviewed-by tag from Geert Uytterhoeven > > > >v2 > >* As suggested by Geert Uytterhoeven: > > - Move L2_CA57 node under cpus node and include reg property > > - Omit status = "disabled" from scif_clk node > >--- > > Documentation/devicetree/bindings/arm/shmobile.txt | 4 + > > arch/arm64/Kconfig.platforms | 6 ++ > > arch/arm64/boot/dts/renesas/r8a7796.dtsi | 120 > > + > > 3 files changed, 130 insertions(+) > > create mode 100644 arch/arm64/boot/dts/renesas/r8a7796.dtsi > > > >diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt > >b/Documentation/devicetree/bindings/arm/shmobile.txt > >index 9cf67e48f222..d5ed554830d7 100644 > >--- a/Documentation/devicetree/bindings/arm/shmobile.txt > >+++ b/Documentation/devicetree/bindings/arm/shmobile.txt > >@@ -29,6 +29,8 @@ SoCs: > > compatible = "renesas,r8a7794" > > - R-Car H3 (R8A77950) > > compatible = "renesas,r8a7795" > >+ - R-Car M3-W (R8A77960) > >+compatible = "renesas,r8a7796" > > > > > > Boards: > >@@ -61,5 +63,7 @@ Boards: > > compatible = "renesas,porter", "renesas,r8a7791" > > - Salvator-X (RTP0RC7795SIPB0010S) > > compatible = "renesas,salvator-x", "renesas,r8a7795"; > >+ - Salvator-X > >+compatible = "renesas,salvator-x", "renesas,r8a7796"; > > - SILK (RTP0RC7794LCB00011S) > > compatible = "renesas,silk", "renesas,r8a7794" > >diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms > >index efa77c146415..16d8d26839ea 100644 > >--- a/arch/arm64/Kconfig.platforms > >+++ b/arch/arm64/Kconfig.platforms > >@@ -114,6 +114,12 @@ config ARCH_R8A7795 > > help > > This enables support for the Renesas R-Car H3 SoC. > > > >+config ARCH_R8A7796 > >+bool "Renesas R-Car M3-W SoC Platform" > >+depends on ARCH_RENESAS > >+help > >+ This enables support for the Renesas R-Car M3-W SoC. > >+ > > config ARCH_STRATIX10 > > bool "Altera's Stratix 10 SoCFPGA Family" > > help > >diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi > >b/arch/arm64/boot/dts/renesas/r8a7796.dtsi > >new file mode 100644 > >index ..178debf68318 > >--- /dev/null > >+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi > >@@ -0,0 +1,120 @@ > >+/* > >+ * Device Tree Source for the r8a7796 SoC > >+ * > >+ * Copyright (C) 2016 Renesas Electronics Corp. > >+ * > >+ * This file is licensed under the terms of the GNU General Public License > >+ * version 2. This program is licensed "as is" without any warranty of any > >+ * kind, whether express or implied. > >+ */ > >+ > >+#include > >+#include > >+ > >+/ { > >+compatible = "renesas,r8a7796"; > >+#address-cells = <2>; > >+#size-cells = <2>; > >+ > >+psci { > >+compatible = "arm,psci-0.2"; > >+method = "smc"; > >+}; > >+ > >+cpus { > >+#address-cells = <1>; > >+#size-cells = <0>; > >+ > >+/* 1 core only at this point */ > >+a57_0: cpu@0 { > >+compatible = "arm,cortex-a57", "arm,armv8"; > >+reg = <0x0>; > >+device_type = "cpu"; > >+next-level-cache = <_CA57>; > >+enable-method = "psci"; > >+}; > >+ > >+L2_CA57: cache-controller@0 { > >+compatible = "cache"; > >+reg = <0>; > >+cache-unified; > >+cache-level = <2>; > >+}; > >+}; > > > It looks to me that in the r8a7795.dtsi the cache-controller node is outside > the cpus node? I'd think that we should keep is consistent. As of c10cdf93a119 ("arm64: dts: r8a7795: Fix W=1 dtc warnings"), which was recently added to the devel branch of the renesas tree, the cache-controller is inside the cpu node on the r8a7795.dtsi. This patch aims to be consistent with that change.
Re: [PATCH v3 1/3] arm64: dts: r8a7796: Add Renesas R8A7796 SoC support
Hi Dirk, On Wed, May 25, 2016 at 07:10:26AM +0200, Dirk Behme wrote: > Hi Simon, > > On 25.05.2016 02:48, Simon Horman wrote: > >Hi Dirk, > > > >On Tue, May 24, 2016 at 07:30:17AM +0200, Dirk Behme wrote: > >>Hi Simon, > > > >[...] > > > >>With Renesas R-Car3 we will get a whole family of SoCs. I.e. different > >>computing power (e.g. different number of Cores) with more or less similar > >>peripherals. > >> > >>I would think that we want to reflect this in the device tree, too. > >>Therefore I think what we want is a hierarchy of device trees. Similar > >>what's done with other SoC families (compare e.g. i.MX6). > >> > >>E.g. we want an initial rcar3.dtsi, which contains all common parts of all > >>R-Car3 SoCs. E.g. one CA57 core, the SCIF where its common etc. > >> > >>Then you will have the r8a779x.dtsi which includes the rcar3.dtsi and > >>extends it for SoC specific parts. Which then will be included by the board > >>device trees, as already done, now. > >> > >>Or in other words: As soon as you have similar parts in the r8a779x.dtsi's, > >>it's time to think about moving the parts one hierarchy level up into the > >>rcar3.dtsi. Else you will end up in a maintenance hell once you have to > >>change/fix anything. > > > >Thanks for raising this issue. > > > >I agree entirely that we should work towards a situation where maintenance > >is as easy as it can be. However, due to the per-SoC binding scheme that > >we are using for IP related to Renesas SoCs I suspect that very few DT nodes > >can be shared between SoCs verbatim. > > > Could you kindly share an example for this? Looking into the H3 and the M3-W > manual, it looks to me that ~90% (?) of the peripherals are the same. The background is that this is a conversation that has been going around for years. The basic thinking is that at this point we have documentation that indicates that many hardware blocks on the H3 and M3-W are the same. But we do not have insight into the internal versioning of the IP blocks nor if they are really the same. And furthermore even if they are currently the same we don't really know if that will continue to be the case. Probably it is. Maybe it isn't. The response has been to take a conservative approach to DT bindings to give us the flexibility to update the driver implementation to reflect any differences that subsequently surface. And by providing per-SoC bindings these driver changes can be activated on a per-SoC basis without updating DTB files (which may be burned into ROMs). There is of course scope to take a different approach. But getting consensus on this is frankly difficult. And at the very least I would expect it to take time. > >Probably some sort of scheme can be cooked up using preprocessor macros. > >And probably there are other ways to resolve this problem. But I would > >prefer if we worked towards resolving this maintenance problem in parallel > >with rather than as a dependency of merging r8a7796 support into mainline. > > > I'd propose to do it correct from the beginning. > > Doing it later would either be more work or forgotten, and never be done, > then. I'm sorry but I don't agree. I think that having r8a7796 support in mainline is a higher priority than sorting this out. > For a starting point, I'd propose to put the r8a7795.dtsi and r8a7796.dtsi > into a graphical diff tool and move all common parts to a rcar3.dtsi (I'd be > happy to discuss the name, though) I'm not opposed to that. But being consistent with my statement above I would prefer it to be done as follow-up work. My suspicion is that right now much of the proposed r8a7796.dtsi can be moved into a hypothetical rcar3.dtsi. But that this is because the proposed r8a7796.dtsi is very small. I would not expect nearly such a large proportion of r8a7795.dtsi to be able to be moved into rcar3.dtsi because it enables more hardware blocks and they typically have (or should have in keeping with the prevailing policy as described above) per-SoC bindings. I believe that there is also a another issue which is that we wish to control enabling features on different SoCs once they are known to work. Of course things slip through the cracks. But blindly assuming all IP blocks enabled for one SoC work on another, even if based on the documentation, seems to be asking for trouble to me. For one thing it implies that the level of firmware support is the same. As for a name, I suggest rcar-gen3.dtsi.
Re: R8A7795 FDP1 clock parentage
Hi Kieran > Just to add to this request, could you ask the HW engineers to confirm > the clock parents for the FCPF (0,1,2) as well please? > > They too are currently listed as R8A7795_CLK_S2D1, however now that I am > trying to enable the FCPF and read registers from it - the VCR is > returning as 0x00 (I expect 0x0101) and then I'm getting > "Bad mode in Error handler detected, code 0xbf02 -- SError" > > My suspicion is that my clock has not been enabled correctly :) About FCP, I had same request from Laurent, and its answer was this thread. http://thread.gmane.org/gmane.linux.kernel.renesas-soc/662/focus=1304 # I think this "parent clock" settings itself is not super critical # (= it works anyway with wrong settings) # it seems other issues ? Best regards --- Kuninori Morimoto
[PATCH] clk: renesas: add R8A7792 support
Renesas R-Car V2H (R8A7792) clocks are handled by R-Car gen2 clock driver. Signed-off-by: Sergei Shtylyov--- The patch is against the 'clk-next' branch of CLK group's 'linux.git' repo. drivers/clk/renesas/Kconfig |1 + drivers/clk/renesas/Makefile |1 + 2 files changed, 2 insertions(+) Index: linux/drivers/clk/renesas/Kconfig === --- linux.orig/drivers/clk/renesas/Kconfig +++ linux/drivers/clk/renesas/Kconfig @@ -11,6 +11,7 @@ config CLK_RENESAS_CPG_MSTP default y if ARCH_R8A7779 default y if ARCH_R8A7790 default y if ARCH_R8A7791 + default y if ARCH_R8A7792 default y if ARCH_R8A7793 default y if ARCH_R8A7794 default y if ARCH_SH73A0 Index: linux/drivers/clk/renesas/Makefile === --- linux.orig/drivers/clk/renesas/Makefile +++ linux/drivers/clk/renesas/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_R8A7778) += clk-r8a77 obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o clk-div6.o obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o clk-div6.o +obj-$(CONFIG_ARCH_R8A7792) += clk-rcar-gen2.o clk-div6.o obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o clk-div6.o obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o clk-div6.o obj-$(CONFIG_ARCH_R8A7795) += r8a7795-cpg-mssr.o
[PATCH 6/8] [media] rcar-vin: add shared subdevice groups
From: Niklas SöderlundThis is done to prepare for Gen3 support where there are more than one subdevice and the usage of them are complex and can be shared between multiple rcar-vin instances. There are a few trouble areas with Gen3 that needs to be solved in order to be able to capture video. 1. There can be up to 4 CSI-2 sources, CSI20, CSI21, CSI40 and CSI41. Each CSI-2 source can be used simultaneously by more then one VIN instance, as shown below. This requires that more then one rcar-vin instance be able to to use the same set of subdevices at the same time. 2. There can be up to 8 VIN instances, VIN0-VIN7. Each instance can capture video simultaneous as any other instance, but they are not fully independent of each other. There is one register which controls what input source is used that is only present in VIN0 and VIN4. The register in VIN0 controls input source for VIN0-VIN3 and the register in VIN4 input source for VIN4-7. To further complicate input selection it is not possible to independently select an input for a specific VIN instance, the whole group of VIN0-3 or VIN4-7 are needs to be set according to these predetermined selections. - VIN0-3 controlled by chsel bits in VnCSI_IFMD register in VIN0 chselVIN0VIN1VIN2VIN3 0CSI40/VC0 CSI20/VC0 CSI21/VC0 CSI40/VC1 1CSI20/VC0 CSI21/VC0 CSI40/VC0 CSI20/VC1 2CSI21/VC0 CSI40/VC0 CSI20/VC0 CSI21/VC1 3CSI40/VC0 CSI40/VC1 CSI40/VC2 CSI40/VC3 4CSI20/VC0 CSI20/VC1 CSI20/VC2 CSI20/VC3 5CSI21/VC0 CSI21/VC1 CSI21/VC2 CSI21/VC3 - VIN4-7 controlled by chsel bits in VnCSI_IFMD register in VIN4 chselVIN4VIN5VIN6VIN7 0CSI41/VC0 CSI20/VC0 CSI21/VC0 CSI41/VC1 1CSI20/VC0 CSI21/VC0 CSI41/VC0 CSI20/VC1 2CSI21/VC0 CSI41/VC0 CSI20/VC0 CSI21/VC1 3CSI41/VC0 CSI41/VC1 CSI41/VC2 CSI41/VC3 4CSI20/VC0 CSI20/VC1 CSI20/VC2 CSI20/VC3 5CSI21/VC0 CSI21/VC1 CSI21/VC2 CSI21/VC3 3. Some VIN instances (VIN4 and VIN5) can in addition the shared CSI-2 sources described above have access to a private digital input channel. This patch tries to solve this problem by adding a group concept to the rcar-vin driver. One VIN instance is in DT described to be the group master. It can be any VIN node but preferably it should be VIN0 or VIN4 since at lest one of those nodes are required to control the chsel bits. To allow CSI-2 input for VIN0-3 the VIN0 node must be present and the same is true for VIN4-7 and VIN4. One can even have two separate groups one for VIN0-3 and one for VIN4-7 provided the two groups don't want to share a CSI-2 input source. Each rcar-vin instance will register itself as a v4l2 subdevice in addition to a video device. This subdevice serves a few purposes: 1. Allow for the group master to find all rcar-vin members of its group and bind them. 2. Allow for the group master to control the chsel bits using the only operation implemented on the subdevice, s_gpio. This operation is only valid for VIN0 and VIN4 instances of rcar-vin. 3. Allow for the slave rcar-vin members to access the group API exposed by the master by use of the subdevice v4l2_dev pointer. The master rcar-vin instance will bind to all subdevices needed by the group. That is all the rcar-vin slave nodes, CSI-2 nodes and the video source subdevices which is connected to the other end of the CSI-2 nodes. It will expose an API to the slave nodes by setting the subdevice v4l2_dev pointer. The group API exposed by the master allows each slave rcar-vin instance to operate on the correct set of subdevices for the current chsel value simply by using the operation rvin_subdev_call() instead of v4l2_subdev_call(). There is one special case for the operations involved in input enumeration (g_input_status, g_tvnorms, dv_timings_cap and *enum_dv_timings), where an extension is made v4l2_subdev_call_input() which allows for the slave to specify which of its inputs it wish to operate on. Inside the group API there is refcounting keeping track of s_power and s_stream calls so they are not called multiple times for the same set of subdevices. This is needed since more then one rcar-vin slave can view the same input. The second instance will simply join an ongoing stream. Each rcar-vin slave can request for the input to be changed (chsel value) for its subgroup (VIN0-3 or VIN4-7). But there are a few restrictions on if the input changed is allowed. These restrictions exist to prevent one rcar-vin instance from pulling the rug from another. 1. It is only allowed to change input if the request is coming from a sole user of the subgroup. That is to say if there is exactly one open video device in the
[PATCH 5/8] [media] rcar-vin: add Gen3 HW registers
From: Niklas SöderlundAdd the register needed to work with Gen3 hardware. This patch just adds the logic for how to work with the Gen3 hardware. More work is required to enable the subdevice structure needed to support capturing. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 99 +++-- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 - drivers/media/platform/rcar-vin/rcar-vin.h | 1 + 3 files changed, 80 insertions(+), 35 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index b3d3c5e..5196395 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -33,21 +33,23 @@ #define VNELPRC_REG0x10/* Video n End Line Pre-Clip Register */ #define VNSPPRC_REG0x14/* Video n Start Pixel Pre-Clip Register */ #define VNEPPRC_REG0x18/* Video n End Pixel Pre-Clip Register */ -#define VNSLPOC_REG0x1C/* Video n Start Line Post-Clip Register */ -#define VNELPOC_REG0x20/* Video n End Line Post-Clip Register */ -#define VNSPPOC_REG0x24/* Video n Start Pixel Post-Clip Register */ -#define VNEPPOC_REG0x28/* Video n End Pixel Post-Clip Register */ #define VNIS_REG 0x2C/* Video n Image Stride Register */ #define VNMB_REG(m)(0x30 + ((m) << 2)) /* Video n Memory Base m Register */ #define VNIE_REG 0x40/* Video n Interrupt Enable Register */ #define VNINTS_REG 0x44/* Video n Interrupt Status Register */ #define VNSI_REG 0x48/* Video n Scanline Interrupt Register */ #define VNMTC_REG 0x4C/* Video n Memory Transfer Control Register */ -#define VNYS_REG 0x50/* Video n Y Scale Register */ -#define VNXS_REG 0x54/* Video n X Scale Register */ #define VNDMR_REG 0x58/* Video n Data Mode Register */ #define VNDMR2_REG 0x5C/* Video n Data Mode Register 2 */ #define VNUVAOF_REG0x60/* Video n UV Address Offset Register */ + +/* Register offsets specific for Gen2 */ +#define VNSLPOC_REG0x1C/* Video n Start Line Post-Clip Register */ +#define VNELPOC_REG0x20/* Video n End Line Post-Clip Register */ +#define VNSPPOC_REG0x24/* Video n Start Pixel Post-Clip Register */ +#define VNEPPOC_REG0x28/* Video n End Pixel Post-Clip Register */ +#define VNYS_REG 0x50/* Video n Y Scale Register */ +#define VNXS_REG 0x54/* Video n X Scale Register */ #define VNC1A_REG 0x80/* Video n Coefficient Set C1A Register */ #define VNC1B_REG 0x84/* Video n Coefficient Set C1B Register */ #define VNC1C_REG 0x88/* Video n Coefficient Set C1C Register */ @@ -73,9 +75,13 @@ #define VNC8B_REG 0xF4/* Video n Coefficient Set C8B Register */ #define VNC8C_REG 0xF8/* Video n Coefficient Set C8C Register */ +/* Register offsets specific for Gen3 */ +#define VNCSI_IFMD_REG 0x20 /* Video n CSI2 Interface Mode Register */ /* Register bit fields for R-Car VIN */ /* Video n Main Control Register bits */ +#define VNMC_DPINE (1 << 27) /* Gen3 specific */ +#define VNMC_SCLE (1 << 26) /* Gen3 specific */ #define VNMC_FOC (1 << 21) #define VNMC_YCAL (1 << 19) #define VNMC_INF_YUV8_BT656(0 << 16) @@ -118,6 +124,12 @@ #define VNDMR2_FTEV(1 << 17) #define VNDMR2_VLV(n) ((n & 0xf) << 12) +/* Video n CSI2 Interface Mode Register (Gen3) */ +#define VNCSI_IFMD_DES2(1 << 27) +#define VNCSI_IFMD_DES1(1 << 26) +#define VNCSI_IFMD_DES0(1 << 25) +#define VNCSI_IFMD_CSI_CHSEL(n) ((n & 0xf) << 0) + static void rvin_write(struct rvin_dev *vin, u32 value, u32 offset) { iowrite32(value, vin->base + offset); @@ -196,7 +208,10 @@ static int rvin_setup(struct rvin_dev *vin) } /* Enable VSYNC Field Toogle mode after one VSYNC input */ - dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); + if (vin->chip == RCAR_GEN3) + dmr2 = VNDMR2_FTEV; + else + dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); /* Hsync Signal Polarity Select */ if (!(mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) @@ -232,7 +247,8 @@ static int rvin_setup(struct rvin_dev *vin) dmr = 0; break; case V4L2_PIX_FMT_XBGR32: - if (vin->chip == RCAR_GEN2 || vin->chip == RCAR_H1) { + if (vin->chip == RCAR_GEN2 || vin->chip == RCAR_H1 || + vin->chip == RCAR_GEN3) { dmr = VNDMR_EXRGB; break; } @@ -250,6 +266,14 @@ static int rvin_setup(struct rvin_dev *vin) if (input_is_yuv == output_is_yuv) vnmc |= VNMC_BPS; + if (vin->chip == RCAR_GEN3) { +
[PATCH 8/8] [media] rcar-vin: add Gen2 and Gen3 fallback compatibility strings
From: Niklas SöderlundThese are present in the soc-camera version of this driver and it's time to add them to this driver as well. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 520690c..87041db 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -33,6 +33,8 @@ static const struct of_device_id rvin_of_id_table[] = { { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 }, { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 }, { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 }, + { .compatible = "renesas,rcar-gen3-vin", .data = (void *)RCAR_GEN3 }, + { .compatible = "renesas,rcar-gen2-vin", .data = (void *)RCAR_GEN2 }, { }, }; MODULE_DEVICE_TABLE(of, rvin_of_id_table); -- 2.8.2
[PATCH 3/8] media: rcar-vin: add DV timings support
From: Ulrich HechtAdds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS, and QUERY_DV_TIMINGS. Signed-off-by: Ulrich Hecht Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 82 + 1 file changed, 82 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 3788f8a..10a5c10 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -400,6 +400,10 @@ static int rvin_enum_input(struct file *file, void *priv, i->type = V4L2_INPUT_TYPE_CAMERA; i->std = vin->vdev.tvnorms; + + if (v4l2_subdev_has_op(sd, pad, dv_timings_cap)) + i->capabilities = V4L2_IN_CAP_DV_TIMINGS; + strlcpy(i->name, "Camera", sizeof(i->name)); return 0; @@ -478,6 +482,78 @@ static int rvin_subscribe_event(struct v4l2_fh *fh, return v4l2_ctrl_subscribe_event(fh, sub); } +static int rvin_enum_dv_timings(struct file *file, void *priv_fh, + struct v4l2_enum_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + int pad, ret; + + pad = timings->pad; + timings->pad = vin->src_pad_idx; + + ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings); + + timings->pad = pad; + + return ret; +} + +static int rvin_s_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + int err; + + err = v4l2_subdev_call(sd, + video, s_dv_timings, timings); + if (!err) { + vin->source.width = timings->bt.width; + vin->source.height = timings->bt.height; + vin->format.width = timings->bt.width; + vin->format.height = timings->bt.height; + } + return err; +} + +static int rvin_g_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + + return v4l2_subdev_call(sd, + video, g_dv_timings, timings); +} + +static int rvin_query_dv_timings(struct file *file, void *priv_fh, + struct v4l2_dv_timings *timings) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + + return v4l2_subdev_call(sd, + video, query_dv_timings, timings); +} + +static int rvin_dv_timings_cap(struct file *file, void *priv_fh, + struct v4l2_dv_timings_cap *cap) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + int pad, ret; + + pad = cap->pad; + cap->pad = vin->src_pad_idx; + + ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap); + + cap->pad = pad; + + return ret; +} + static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_querycap= rvin_querycap, .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap, @@ -494,6 +570,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_g_input = rvin_g_input, .vidioc_s_input = rvin_s_input, + .vidioc_dv_timings_cap = rvin_dv_timings_cap, + .vidioc_enum_dv_timings = rvin_enum_dv_timings, + .vidioc_g_dv_timings= rvin_g_dv_timings, + .vidioc_s_dv_timings= rvin_s_dv_timings, + .vidioc_query_dv_timings= rvin_query_dv_timings, + .vidioc_querystd= rvin_querystd, .vidioc_g_std = rvin_g_std, .vidioc_s_std = rvin_s_std, -- 2.8.2
[PATCH 7/8] [media] rcar-vin: enable Gen3
From: Niklas SöderlundSigned-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/rcar-vin/rcar-core.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/Kconfig b/drivers/media/platform/rcar-vin/Kconfig index b2ff2d4..ca3ea91 100644 --- a/drivers/media/platform/rcar-vin/Kconfig +++ b/drivers/media/platform/rcar-vin/Kconfig @@ -5,7 +5,7 @@ config VIDEO_RCAR_VIN select VIDEOBUF2_DMA_CONTIG ---help--- Support for Renesas R-Car Video Input (VIN) driver. - Supports R-Car Gen2 SoCs. + Supports R-Car Gen2 and Gen3 SoCs. To compile this driver as a module, choose M here: the module will be called rcar-vin. diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index d901ad0..520690c 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -26,6 +26,7 @@ #include "rcar-vin.h" static const struct of_device_id rvin_of_id_table[] = { + { .compatible = "renesas,vin-r8a7795", .data = (void *)RCAR_GEN3 }, { .compatible = "renesas,vin-r8a7794", .data = (void *)RCAR_GEN2 }, { .compatible = "renesas,vin-r8a7793", .data = (void *)RCAR_GEN2 }, { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 }, -- 2.8.2
[PATCH 2/8] media: rcar_vin: Use correct pad number in try_fmt
From: Ulrich HechtFix rcar_vin_try_fmt's use of an inappropriate pad number when calling the subdev set_fmt function - for the ADV7612, IDs should be non-zero. Signed-off-by: William Towle Reviewed-by: Rob Taylor Acked-by: Hans Verkuil [uli: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 929816b..3788f8a 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -98,7 +98,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, struct rvin_source_fmt *source) { struct v4l2_subdev *sd; - struct v4l2_subdev_pad_config pad_cfg; + struct v4l2_subdev_pad_config *pad_cfg; struct v4l2_subdev_format format = { .which = which, }; @@ -108,10 +108,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin, v4l2_fill_mbus_format(, pix, vin->source.code); + pad_cfg = v4l2_subdev_alloc_pad_config(sd); + if (pad_cfg == NULL) + return -ENOMEM; + + format.pad = vin->src_pad_idx; + ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt, -_cfg, ); +pad_cfg, ); if (ret < 0) - return ret; + goto cleanup; v4l2_fill_pix_format(pix, ); @@ -121,6 +127,8 @@ static int __rvin_try_format_source(struct rvin_dev *vin, vin_dbg(vin, "Source resolution: %ux%u\n", source->width, source->height); +cleanup: + v4l2_subdev_free_pad_config(pad_cfg); return 0; } -- 2.8.2
[PATCH 0/8] rcar-vin: Enable Gen3 support
From: Niklas SöderlundHi, This series enable Gen3 support for the rcar-vin driver. It is based on top of the media_tree: git://linuxtv.org/media_tree.git master And it depends on the first rcar-vin patch at which I hope soon will enter the media tree: https://patchwork.linuxtv.org/patch/34129/ This is a rather large patch since unfortunately the subdevice and input selection on Gen3 are much more complex than on Gen2, see individual patches for a more detailed explanation. - Patch 1-3 picks up work done by Ulrich so that effort is not wasted before the driver is updated for Gen3. - Patch 4-6 are the big patches where the driver learns how to work with Gen3. - Patch 7-8 add compatible strings for Gen3 and fallback strings that are present in the old soc-camera driver but not in this new driver. The series is tested on Koelsch for Gen2 and it works as expected. If one wants to test the HDMI input the patch 'r8a7791-koelsch.dts: add HDMI input' from Hans Verkuil are needed to add it to DT . The driver passes a v4l2-compliance on Gen2 without errors or warnings. And there are no problems grabbing frames using the CVBS or HDMI input sources using qv4l2. For Gen3 there are more drivers needed to get working video input running. To be able to grab frames drivers are needed for the R-Car CSI-2 interface and the ADV7482 devices which are not yet present in the kernel. Prototypes for thees two drivers exist and a wiki page at http://elinux.org/R-Car/Tests:rcar-vin talks about how to test it all together. Whit thees prototype drivers for CSI-2 and ADV7482 the rcar-vin driver pass the v4l2-compliance tool without errors or warnings on CVBS inputs. On HDMI inputs it complains about missing DV features, this is because the prototype ADV7482 do not yet implement thees operations and are not a fault in the rcar-vin driver. Disregarding the v4l2-compliance result there is no issue grabbing frames from both CVBS and HDMI input sources on Salvator-X. But more work is needed on the prototype drivers before they are ready to be submitted for upstream. Niklas Söderlund (5): [media] rcar-vin: allow subdevices to be bound late [media] rcar-vin: add Gen3 HW registers [media] rcar-vin: add shared subdevice groups [media] rcar-vin: enable Gen3 [media] rcar-vin: add Gen2 and Gen3 fallback compatibility strings Ulrich Hecht (3): media: rcar-vin: pad-aware driver initialisation media: rcar_vin: Use correct pad number in try_fmt media: rcar-vin: add DV timings support .../devicetree/bindings/media/rcar_vin.txt | 218 +++- drivers/media/platform/rcar-vin/Kconfig|2 +- drivers/media/platform/rcar-vin/Makefile |2 +- drivers/media/platform/rcar-vin/rcar-core.c| 474 ++--- drivers/media/platform/rcar-vin/rcar-dma.c | 202 +++- drivers/media/platform/rcar-vin/rcar-group.c | 1122 drivers/media/platform/rcar-vin/rcar-group.h | 139 +++ drivers/media/platform/rcar-vin/rcar-v4l2.c| 449 drivers/media/platform/rcar-vin/rcar-vin.h | 83 +- 9 files changed, 2253 insertions(+), 438 deletions(-) create mode 100644 drivers/media/platform/rcar-vin/rcar-group.c create mode 100644 drivers/media/platform/rcar-vin/rcar-group.h -- 2.8.2
[PATCH 1/8] media: rcar-vin: pad-aware driver initialisation
From: Ulrich HechtAdd detection of source pad number for drivers aware of the media controller API, so that rcar-vin can create device nodes to support modern drivers such as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite) underneath. Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in line with requirements for building the drivers associated with it. Signed-off-by: William Towle Signed-off-by: Rob Taylor [uli: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 16 drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 0bc4487..929816b 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -683,6 +683,9 @@ int rvin_v4l2_probe(struct rvin_dev *vin) struct v4l2_mbus_framefmt *mf = struct video_device *vdev = >vdev; struct v4l2_subdev *sd = vin_to_source(vin); +#if defined(CONFIG_MEDIA_CONTROLLER) + int pad_idx; +#endif int ret; v4l2_set_subdev_hostdata(sd, vin); @@ -729,6 +732,19 @@ int rvin_v4l2_probe(struct rvin_dev *vin) vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + vin->src_pad_idx = 0; +#if defined(CONFIG_MEDIA_CONTROLLER) + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++) + if (sd->entity.pads[pad_idx].flags + == MEDIA_PAD_FL_SOURCE) + break; + if (pad_idx >= sd->entity.num_pads) + return -EINVAL; + + vin->src_pad_idx = pad_idx; +#endif + fmt.pad = vin->src_pad_idx; + /* Try to improve our guess of a reasonable window format */ ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, ); if (ret) { diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 544a3b3..a6dd6db 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -87,6 +87,7 @@ struct rvin_graph_entity { * * @vdev: V4L2 video device associated with VIN * @v4l2_dev: V4L2 device + * @src_pad_idx: source pad index for media controller drivers * @ctrl_handler: V4L2 control handler * @notifier: V4L2 asynchronous subdevs notifier * @entity:entity in the DT for subdevice @@ -117,6 +118,7 @@ struct rvin_dev { struct video_device vdev; struct v4l2_device v4l2_dev; + int src_pad_idx; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_async_notifier notifier; struct rvin_graph_entity entity; -- 2.8.2
Re: [PATCH 3/7] watchdog: softdog: consistently use softdog_ prefix
On Wed, May 25, 2016 at 08:37:45AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > And move module_init/exit to the proper place while here. > > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 21 ++--- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index a9ad27dd46502b..0a29f5a0833787 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -54,12 +54,12 @@ module_param(soft_panic, int, 0); > MODULE_PARM_DESC(soft_panic, > "Softdog action, set to 1 to panic, 0 to reboot (default=0)"); > > -static void watchdog_fire(unsigned long); > +static void softdog_fire(unsigned long); > > -static struct timer_list watchdog_ticktock = > - TIMER_INITIALIZER(watchdog_fire, 0, 0); > +static struct timer_list softdog_ticktock = > + TIMER_INITIALIZER(softdog_fire, 0, 0); > > -static void watchdog_fire(unsigned long data) > +static void softdog_fire(unsigned long data) > { > module_put(THIS_MODULE); > if (soft_noboot) > @@ -76,14 +76,14 @@ static void watchdog_fire(unsigned long data) > > static int softdog_ping(struct watchdog_device *w) > { > - if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) > + if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) > __module_get(THIS_MODULE); > return 0; > } > > static int softdog_stop(struct watchdog_device *w) > { > - if (del_timer(_ticktock)) > + if (del_timer(_ticktock)) > module_put(THIS_MODULE); > > return 0; > @@ -115,7 +115,7 @@ static struct watchdog_device softdog_dev = { > .timeout = TIMER_MARGIN, > }; > > -static int __init watchdog_init(void) > +static int __init softdog_init(void) > { > int ret; > > @@ -132,14 +132,13 @@ static int __init watchdog_init(void) > > return 0; > } > +module_init(softdog_init); > > -static void __exit watchdog_exit(void) > +static void __exit softdog_exit(void) > { > watchdog_unregister_device(_dev); > } > - > -module_init(watchdog_init); > -module_exit(watchdog_exit); > +module_exit(softdog_exit); > > MODULE_AUTHOR("Alan Cox"); > MODULE_DESCRIPTION("Software Watchdog Device Driver"); > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] watchdog: softdog: remove forward declaration
On Wed, May 25, 2016 at 08:37:46AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 8 +++- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index 0a29f5a0833787..42faa3d424d5ca 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -54,11 +54,6 @@ module_param(soft_panic, int, 0); > MODULE_PARM_DESC(soft_panic, > "Softdog action, set to 1 to panic, 0 to reboot (default=0)"); > > -static void softdog_fire(unsigned long); > - > -static struct timer_list softdog_ticktock = > - TIMER_INITIALIZER(softdog_fire, 0, 0); > - > static void softdog_fire(unsigned long data) > { > module_put(THIS_MODULE); > @@ -74,6 +69,9 @@ static void softdog_fire(unsigned long data) > } > } > > +static struct timer_list softdog_ticktock = > + TIMER_INITIALIZER(softdog_fire, 0, 0); > + > static int softdog_ping(struct watchdog_device *w) > { > if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/7] watchdog: softdog: sort includes to avoid duplicates
On Wed, May 25, 2016 at 08:37:47AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index 42faa3d424d5ca..ab0e02fc81a276 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -21,15 +21,15 @@ > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > +#include > +#include > +#include > #include > #include > -#include > +#include > #include > +#include > #include > -#include > -#include > -#include > -#include > > #define TIMER_MARGIN 60 /* Default is 60 seconds */ > static unsigned int soft_margin = TIMER_MARGIN; /* in seconds */ > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] watchdog: softdog: drop superfluous set_timeout callback
On Wed, May 25, 2016 at 08:37:48AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > If we leave set_timeout empty, the core will do exactly what is > implemented here anyway. > > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 7 --- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index ab0e02fc81a276..5e3a30b99d4415 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -87,12 +87,6 @@ static int softdog_stop(struct watchdog_device *w) > return 0; > } > > -static int softdog_set_timeout(struct watchdog_device *w, unsigned int t) > -{ > - w->timeout = t; > - return 0; > -} > - > static struct watchdog_info softdog_info = { > .identity = "Software Watchdog", > .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, > @@ -102,7 +96,6 @@ static struct watchdog_ops softdog_ops = { > .owner = THIS_MODULE, > .start = softdog_ping, > .stop = softdog_stop, > - .set_timeout = softdog_set_timeout, > }; > > static struct watchdog_device softdog_dev = { > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] watchdog: softdog: improve coding style
On Wed, May 25, 2016 at 08:37:49AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index 5e3a30b99d4415..b067edf246dff2 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -57,9 +57,9 @@ MODULE_PARM_DESC(soft_panic, > static void softdog_fire(unsigned long data) > { > module_put(THIS_MODULE); > - if (soft_noboot) > + if (soft_noboot) { > pr_crit("Triggered - Reboot ignored\n"); > - else if (soft_panic) { > + } else if (soft_panic) { > pr_crit("Initiating panic\n"); > panic("Software Watchdog Timer expired"); > } else { > @@ -74,7 +74,7 @@ static struct timer_list softdog_ticktock = > > static int softdog_ping(struct watchdog_device *w) > { > - if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) > + if (!mod_timer(_ticktock, jiffies + (w->timeout * HZ))) > __module_get(THIS_MODULE); > return 0; > } > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/7] watchdog: softdog: use watchdog core to init timeout value
On Wed, May 25, 2016 at 08:37:44AM +0200, Wolfram Sang wrote: > From: Wolfram Sang> > Error string and comment say we fall back to a default, but in reality > we bailed out. Refactor the code to use the core helper which then > matches the described behaviour. While updating the init message anyhow, > shorten it while we are here; no need for versioning there as well and > the name is already given via pr_fmt. > > Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck > --- > drivers/watchdog/softdog.c | 17 + > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c > index 8bc0b164afc94b..a9ad27dd46502b 100644 > --- a/drivers/watchdog/softdog.c > +++ b/drivers/watchdog/softdog.c > @@ -111,22 +111,15 @@ static struct watchdog_device softdog_dev = { > .info = _info, > .ops = _ops, > .min_timeout = 1, > - .max_timeout = 0x > + .max_timeout = 65535, > + .timeout = TIMER_MARGIN, > }; > > static int __init watchdog_init(void) > { > int ret; > > - /* Check that the soft_margin value is within it's range; > -if not reset to the default */ > - if (soft_margin < 1 || soft_margin > 65535) { > - pr_info("soft_margin must be 0 < soft_margin < 65536, using > %d\n", > - TIMER_MARGIN); > - return -EINVAL; > - } > - softdog_dev.timeout = soft_margin; > - > + watchdog_init_timeout(_dev, soft_margin, NULL); > watchdog_set_nowayout(_dev, nowayout); > watchdog_stop_on_reboot(_dev); > > @@ -134,8 +127,8 @@ static int __init watchdog_init(void) > if (ret) > return ret; > > - pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d > soft_margin=%d sec soft_panic=%d (nowayout=%d)\n", > - soft_noboot, soft_margin, soft_panic, nowayout); > + pr_info("initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d > (nowayout=%d)\n", > + soft_noboot, softdog_dev.timeout, soft_panic, nowayout); > > return 0; > } > -- > 2.8.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: R8A7795 FDP1 clock parentage
On 25/05/16 09:49, Kuninori Morimoto wrote: > > Hi Kieran > >> I have added an initial patch to support the FDP1 in the clock >> framework, but I have not been able to correctly identify the actual >> clock parent. >> >> For now I have assumed that it is R8A7795_CLK_S2D1. >> >> Could you please confirm this selection, or help identify the true >> parent please? > > OK, please wait Thanks, Just to add to this request, could you ask the HW engineers to confirm the clock parents for the FCPF (0,1,2) as well please? They too are currently listed as R8A7795_CLK_S2D1, however now that I am trying to enable the FCPF and read registers from it - the VCR is returning as 0x00 (I expect 0x0101) and then I'm getting "Bad mode in Error handler detected, code 0xbf02 -- SError" My suspicion is that my clock has not been enabled correctly :) Thanks again for your help -- Regards Kieran Bingham
[RFC 0/2] watchdog: pretimeout: userspace governor
So, here is the RFC series implementing the userspace governor. This is merely meant as a proof-of-concept, so my patch series will have the same capabilities as Vladimir's series. It does work (for me (tm)) and shows how the bottom half handling can be better put to the watchdog device code, making the pretimeout code a lot simpler. However, I am not sure if a uevent on the watchdog device is a good userspace notification. Setting the governor is done vis sysfs, okay. But setting the pretimeout is done via the character device, so I wonder if the response shouldn't go there as well? But do we want to introduce select/poll support only for pretimeouts? Other ideas? Thanks, Wolfram Vladimir Zapolskiy (1): watchdog: pretimeout: add userspace notifier pretimeout governor Wolfram Sang (1): watchdog: dev: add helper for creating uevent on dev drivers/watchdog/Kconfig| 16 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/pretimeout_userspace.c | 47 + drivers/watchdog/watchdog_dev.c | 20 ++ drivers/watchdog/watchdog_pretimeout.h | 2 ++ include/linux/watchdog.h| 3 +++ 6 files changed, 89 insertions(+) create mode 100644 drivers/watchdog/pretimeout_userspace.c -- 2.8.1
[RFC 1/2] watchdog: dev: add helper for creating uevent on dev
From: Wolfram SangMechanisms like pretimeout governors may want to notify userspace via uevents. Add a helper because all the needed data is private to the watchdog device. To allow calling it in atomic contexts, put actual signalling to a workqueue. Signed-off-by: Wolfram Sang --- drivers/watchdog/watchdog_dev.c | 20 include/linux/watchdog.h| 3 +++ 2 files changed, 23 insertions(+) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 9e2e668e1c6b2d..2a7d04034641dc 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -63,6 +63,7 @@ struct watchdog_core_data { struct kref kref; struct cdev cdev; struct watchdog_device *wdd; + struct device *dev; struct mutex lock; unsigned long last_keepalive; unsigned long last_hw_keepalive; @@ -70,6 +71,7 @@ struct watchdog_core_data { unsigned long status; /* Internal status bits */ #define _WDOG_DEV_OPEN 0 /* Opened ? */ #define _WDOG_ALLOW_RELEASE1 /* Did we receive the magic char ? */ + struct work_struct uevent_work; }; /* the dev_t structure to store the dynamically allocated watchdog devices */ @@ -821,6 +823,21 @@ static struct miscdevice watchdog_miscdev = { .fops = _fops, }; +void watchdog_dev_uevent(struct watchdog_device *wdd) +{ + queue_work(watchdog_wq, >wd_data->uevent_work); +} + +static void watchdog_dev_uevent_work(struct work_struct *work) +{ + struct watchdog_core_data *wd_data = container_of(work, struct watchdog_core_data, + uevent_work); + + mutex_lock(_data->lock); + kobject_uevent(_data->dev->kobj, KOBJ_CHANGE); + mutex_unlock(_data->lock); +} + /* * watchdog_cdev_register: register watchdog character device * @wdd: watchdog device @@ -849,6 +866,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno) return -ENODEV; INIT_DELAYED_WORK(_data->work, watchdog_ping_work); + INIT_WORK(_data->uevent_work, watchdog_dev_uevent_work); if (wdd->id == 0) { old_wd_data = wd_data; @@ -968,6 +986,8 @@ int watchdog_dev_register(struct watchdog_device *wdd) watchdog_cdev_unregister(wdd); } + wdd->wd_data->dev = dev; + return ret; } diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 496e52e5b91fc7..f0f77f06d9813b 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -194,6 +194,9 @@ extern int watchdog_init_timeout(struct watchdog_device *wdd, extern int watchdog_register_device(struct watchdog_device *); extern void watchdog_unregister_device(struct watchdog_device *); +/* drivers/watchdog/watchdog_dev.c */ +void watchdog_dev_uevent(struct watchdog_device *wdd); + /* drivers/watchdog/watchdog_pretimeout.c */ #ifdef CONFIG_WATCHDOG_PRETIMEOUT_GOV void watchdog_notify_pretimeout(struct watchdog_device *wdd); -- 2.8.1
[RFC 2/2] watchdog: pretimeout: add userspace notifier pretimeout governor
From: Vladimir ZapolskiyUserspace notifier watchdog pretimeout governor, on watchdog pretimeout event sends a notification to userspace for further handling. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Wolfram Sang --- drivers/watchdog/Kconfig| 16 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/pretimeout_userspace.c | 47 + drivers/watchdog/watchdog_pretimeout.h | 2 ++ 4 files changed, 66 insertions(+) create mode 100644 drivers/watchdog/pretimeout_userspace.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3682ae9d8a50ca..e69c17f518ef43 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1800,6 +1800,15 @@ config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP governor is selected by a user, write a short message to the kernel log buffer and don't do any system changes. +config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_USERSPACE + bool "userspace" + select WATCHDOG_PRETIMEOUT_GOV_USERSPACE + help + Use userspace watchdog pretimeout governor by default, + the governor sends a device state change uevent + notification, if a pretimeout event a reported by a + watchdog. + endchoice config WATCHDOG_PRETIMEOUT_GOV_PANIC @@ -1816,6 +1825,13 @@ config WATCHDOG_PRETIMEOUT_GOV_NOOP governor, only an informational message is added to the kernel log buffer, if watchdog pretimeout is happened. +config WATCHDOG_PRETIMEOUT_GOV_USERSPACE + tristate "Userspace notifier watchdog pretimeout governor" + help + Userspace notifier watchdog pretimeout governor, on watchdog + pretimeout event send a notification to userspace for + further handling. + endif # WATCHDOG_PRETIMEOUT_GOV endif # WATCHDOG diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 9330e4cabd8f9c..23423b8b73620c 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -10,6 +10,7 @@ watchdog-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV) += watchdog_pretimeout.o obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC) += pretimeout_panic.o obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP) += pretimeout_noop.o +obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_USERSPACE) += pretimeout_userspace.o # Only one watchdog can succeed. We probe the ISA/PCI/USB based # watchdog-cards first, then the architecture specific watchdog diff --git a/drivers/watchdog/pretimeout_userspace.c b/drivers/watchdog/pretimeout_userspace.c new file mode 100644 index 00..cf7b03765f3254 --- /dev/null +++ b/drivers/watchdog/pretimeout_userspace.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Mentor Graphics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include + +#include "watchdog_pretimeout.h" + +/** + * pretimeout_userspace - Notify userspace on watchdog pretimeout event + * @wdd - watchdog_device + * + * Send watchdog device uevent to userspace to handle pretimeout event + */ +static void pretimeout_userspace(struct watchdog_device *wdd) +{ + watchdog_dev_uevent(wdd); +} + +static struct watchdog_governor watchdog_gov_userspace = { + .name = "userspace", + .pretimeout = pretimeout_userspace, + .owner = THIS_MODULE, +}; + +static int __init watchdog_gov_userspace_register(void) +{ + return watchdog_register_governor(_gov_userspace); +} +module_init(watchdog_gov_userspace_register); + +static void __exit watchdog_gov_userspace_unregister(void) +{ + watchdog_unregister_governor(_gov_userspace); +} +module_exit(watchdog_gov_userspace_unregister); + +MODULE_AUTHOR("Vladimir Zapolskiy "); +MODULE_DESCRIPTION("Userspace notifier watchdog pretimeout governor"); +MODULE_LICENSE("GPL"); diff --git a/drivers/watchdog/watchdog_pretimeout.h b/drivers/watchdog/watchdog_pretimeout.h index 2e60450a2be64e..8365cd78f2507b 100644 --- a/drivers/watchdog/watchdog_pretimeout.h +++ b/drivers/watchdog/watchdog_pretimeout.h @@ -23,6 +23,8 @@ void watchdog_unregister_governor(struct watchdog_governor *gov); #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"panic" #elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP) #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"noop" +#elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_USERSPACE) +#define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"userspace" #else #error "Default watchdog pretimeout governor is not set." #endif -- 2.8.1
[PATCH 3/7] watchdog: pretimeout: add noop pretimeout governor
From: Vladimir ZapolskiyNoop watchdog pretimeout governor, only an informational message is added to the kernel log buffer. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Wolfram Sang --- Changes since Vladimir's last version: * rebased * use pr_* now since device pointer became private drivers/watchdog/Kconfig | 15 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/pretimeout_noop.c | 47 ++ drivers/watchdog/watchdog_pretimeout.h | 2 ++ 4 files changed, 65 insertions(+) create mode 100644 drivers/watchdog/pretimeout_noop.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 36b7d1f83b3c51..a3ef2bcd94f10c 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1800,6 +1800,14 @@ config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC a watchdog pretimeout event happens, consider that a watchdog feeder is dead and reboot is unavoidable. +config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP + bool "noop" + select WATCHDOG_PRETIMEOUT_GOV_NOOP + help + Use noop watchdog pretimeout governor by default. If noop + governor is selected by a user, write a short message to + the kernel log buffer and don't do any system changes. + endchoice config WATCHDOG_PRETIMEOUT_GOV_PANIC @@ -1809,6 +1817,13 @@ config WATCHDOG_PRETIMEOUT_GOV_PANIC governor, on a watchdog pretimeout event the kernel shall panic before an expected system reboot. +config WATCHDOG_PRETIMEOUT_GOV_NOOP + tristate "Noop watchdog pretimeout governor" + help + Select this option to enable noop watchdog pretimeout + governor, only an informational message is added to the + kernel log buffer, if watchdog pretimeout is happened. + endif # WATCHDOG_PRETIMEOUT_GOV endif # WATCHDOG diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 56dfadc0cee2a9..3ad68029916e00 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -9,6 +9,7 @@ watchdog-y += watchdog_core.o watchdog_dev.o watchdog-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV) += watchdog_pretimeout.o obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC) += pretimeout_panic.o +obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP) += pretimeout_noop.o # Only one watchdog can succeed. We probe the ISA/PCI/USB based # watchdog-cards first, then the architecture specific watchdog diff --git a/drivers/watchdog/pretimeout_noop.c b/drivers/watchdog/pretimeout_noop.c new file mode 100644 index 00..91f36aa533b398 --- /dev/null +++ b/drivers/watchdog/pretimeout_noop.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Mentor Graphics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include + +#include "watchdog_pretimeout.h" + +/** + * pretimeout_noop - No operation on watchdog pretimeout event + * @wdd - watchdog_device + * + * This function prints a message about pretimeout to kernel log. + */ +static void pretimeout_noop(struct watchdog_device *wdd) +{ + pr_info("watchdog%d: pretimeout event\n", wdd->id); +} + +static struct watchdog_governor watchdog_gov_noop = { + .name = "noop", + .pretimeout = pretimeout_noop, + .owner = THIS_MODULE, +}; + +static int __init watchdog_gov_noop_register(void) +{ + return watchdog_register_governor(_gov_noop); +} +module_init(watchdog_gov_noop_register); + +static void __exit watchdog_gov_noop_unregister(void) +{ + watchdog_unregister_governor(_gov_noop); +} +module_exit(watchdog_gov_noop_unregister); + +MODULE_AUTHOR("Vladimir Zapolskiy "); +MODULE_DESCRIPTION("Noop watchdog pretimeout governor"); +MODULE_LICENSE("GPL"); diff --git a/drivers/watchdog/watchdog_pretimeout.h b/drivers/watchdog/watchdog_pretimeout.h index 8b03fd480cb533..2e60450a2be64e 100644 --- a/drivers/watchdog/watchdog_pretimeout.h +++ b/drivers/watchdog/watchdog_pretimeout.h @@ -21,6 +21,8 @@ void watchdog_unregister_governor(struct watchdog_governor *gov); #if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC) #define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"panic" +#elif IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_NOOP) +#define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"noop" #else #error "Default watchdog pretimeout governor is not set." #endif -- 2.8.1
[PATCH 2/7] watchdog: pretimeout: add panic pretimeout governor
From: Vladimir ZapolskiyPanic watchdog pretimeout governor, on watchdog pretimeout event the kernel shall panic. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Wolfram Sang --- Changes since Vladimir's last version: * rebased * shortened the panic message a little (removed redundancy) drivers/watchdog/Kconfig | 29 + drivers/watchdog/Makefile | 2 ++ drivers/watchdog/pretimeout_panic.c| 47 ++ drivers/watchdog/watchdog_pretimeout.h | 6 - 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 drivers/watchdog/pretimeout_panic.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 909d1021de5cbc..36b7d1f83b3c51 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1782,4 +1782,33 @@ config WATCHDOG_PRETIMEOUT_GOV help The option allows to select watchdog pretimeout governors. +if WATCHDOG_PRETIMEOUT_GOV + +choice + prompt "Default Watchdog Pretimeout Governor" + default WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC + help + This option selects a default watchdog pretimeout governor. + The governor takes its action, if a watchdog is capable + to report a pretimeout event. + +config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC + bool "panic" + select WATCHDOG_PRETIMEOUT_GOV_PANIC + help + Use panic watchdog pretimeout governor by default, if + a watchdog pretimeout event happens, consider that + a watchdog feeder is dead and reboot is unavoidable. + +endchoice + +config WATCHDOG_PRETIMEOUT_GOV_PANIC + tristate "Panic watchdog pretimeout governor" + help + Select this option to enable panic watchdog pretimeout + governor, on a watchdog pretimeout event the kernel shall + panic before an expected system reboot. + +endif # WATCHDOG_PRETIMEOUT_GOV + endif # WATCHDOG diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 820860cf3e8d62..56dfadc0cee2a9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -8,6 +8,8 @@ obj-$(CONFIG_WATCHDOG_CORE) += watchdog.o watchdog-y += watchdog_core.o watchdog_dev.o watchdog-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV) += watchdog_pretimeout.o +obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC) += pretimeout_panic.o + # Only one watchdog can succeed. We probe the ISA/PCI/USB based # watchdog-cards first, then the architecture specific watchdog # drivers and then the architecture independent "softdog" driver. diff --git a/drivers/watchdog/pretimeout_panic.c b/drivers/watchdog/pretimeout_panic.c new file mode 100644 index 00..f8c2410d993f02 --- /dev/null +++ b/drivers/watchdog/pretimeout_panic.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Mentor Graphics + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include + +#include "watchdog_pretimeout.h" + +/** + * pretimeout_panic - Panic on watchdog pretimeout event + * @wdd - watchdog_device + * + * Panic, watchdog has not been fed till pretimeout event. + */ +static void pretimeout_panic(struct watchdog_device *wdd) +{ + panic("watchdog pretimeout event"); +} + +static struct watchdog_governor watchdog_gov_panic = { + .name = "panic", + .pretimeout = pretimeout_panic, + .owner = THIS_MODULE, +}; + +static int __init watchdog_gov_panic_register(void) +{ + return watchdog_register_governor(_gov_panic); +} +module_init(watchdog_gov_panic_register); + +static void __exit watchdog_gov_panic_unregister(void) +{ + watchdog_unregister_governor(_gov_panic); +} +module_exit(watchdog_gov_panic_unregister); + +MODULE_AUTHOR("Vladimir Zapolskiy "); +MODULE_DESCRIPTION("Panic watchdog pretimeout governor"); +MODULE_LICENSE("GPL"); diff --git a/drivers/watchdog/watchdog_pretimeout.h b/drivers/watchdog/watchdog_pretimeout.h index 38965cdd23bebe..8b03fd480cb533 100644 --- a/drivers/watchdog/watchdog_pretimeout.h +++ b/drivers/watchdog/watchdog_pretimeout.h @@ -19,7 +19,11 @@ void watchdog_unregister_governor(struct watchdog_governor *gov); /* Interfaces to watchdog_core.c */ #ifdef CONFIG_WATCHDOG_PRETIMEOUT_GOV -#define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"none" +#if IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_PANIC) +#define WATCHDOG_PRETIMEOUT_DEFAULT_GOV"panic" +#else +#error "Default watchdog pretimeout governor is not set." +#endif int watchdog_register_pretimeout(struct watchdog_device *wdd, struct device *dev); void watchdog_unregister_pretimeout(struct watchdog_device *wdd); -- 2.8.1
[PATCH 7/7] watchdog: softdog: implement pretimeout support
From: Wolfram SangGive devices which do not have hardware support for pretimeout at least a software version of it. Signed-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index b067edf246dff2..adfb3899296f0f 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -72,10 +72,25 @@ static void softdog_fire(unsigned long data) static struct timer_list softdog_ticktock = TIMER_INITIALIZER(softdog_fire, 0, 0); +static struct watchdog_device softdog_dev; + +static void softdog_pretimeout(unsigned long data) +{ + watchdog_notify_pretimeout(_dev); +} + +static struct timer_list softdog_preticktock = + TIMER_INITIALIZER(softdog_pretimeout, 0, 0); + static int softdog_ping(struct watchdog_device *w) { if (!mod_timer(_ticktock, jiffies + (w->timeout * HZ))) __module_get(THIS_MODULE); + + if (w->pretimeout) + mod_timer(_preticktock, jiffies + + (w->timeout - w->pretimeout) * HZ); + return 0; } @@ -84,12 +99,15 @@ static int softdog_stop(struct watchdog_device *w) if (del_timer(_ticktock)) module_put(THIS_MODULE); + del_timer(_preticktock); + return 0; } static struct watchdog_info softdog_info = { .identity = "Software Watchdog", - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | + WDIOF_PRETIMEOUT, }; static struct watchdog_ops softdog_ops = { -- 2.8.1
[PATCH 5/7] watchdog: add pretimeout support to the core
From: Wolfram SangSince the watchdog framework centrializes the IOCTL interfaces of device drivers now, SETPRETIMEOUT and GETPRETIMEOUT need to be added in the common code. Signed-off-by: Robin Gong Signed-off-by: Wolfram Sang --- Changes since Robin's last version: * rebased * 0 is valid and means disable pretimeout add code and docs for that * add docs that drivers must update pretimeout when a new timeout is set * reworded some documentation * core handles wdd->pretimeout if set_pretimeout() is not populated * add pretimeout to sysfs Documentation/watchdog/watchdog-kernel-api.txt | 20 ++ drivers/watchdog/watchdog_dev.c| 53 +- include/linux/watchdog.h | 11 ++ 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index a9a65f8c0de9f0..4d4e0db6750c5f 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt @@ -50,6 +50,7 @@ struct watchdog_device { const struct watchdog_ops *ops; unsigned int bootstatus; unsigned int timeout; + unsigned int pretimeout; unsigned int min_timeout; unsigned int max_timeout; unsigned int min_hw_heartbeat_ms; @@ -77,6 +78,7 @@ It contains following fields: * timeout: the watchdog timer's timeout value (in seconds). This is the time after which the system will reboot if user space does not send a heartbeat request if WDOG_ACTIVE is set. +* pretimeout: the watchdog timer's pretimeout value (in seconds). * min_timeout: the watchdog timer's minimum timeout value (in seconds). If set, the minimum configurable value for 'timeout'. * max_timeout: the watchdog timer's maximum timeout value (in seconds), @@ -120,6 +122,7 @@ struct watchdog_ops { int (*ping)(struct watchdog_device *); unsigned int (*status)(struct watchdog_device *); int (*set_timeout)(struct watchdog_device *, unsigned int); + int (*set_pretimeout)(struct watchdog_device *, unsigned int); unsigned int (*get_timeleft)(struct watchdog_device *); int (*restart)(struct watchdog_device *); void (*ref)(struct watchdog_device *) __deprecated; @@ -183,6 +186,23 @@ they are supported. These optional routines/operations are: set_timeout is not provided but WDIOF_SETTIMEOUT is set, the watchdog infrastructure updates the timeout value of the watchdog_device internally to the requested value. + If the pretimeout feature is used (WDIOF_PRETIMEOUT), then set_timeout must + also take care of checking if pretimeout is still valid and set up the timer + accordingly. This can't be done in the core without races, so it is the + duty of the driver. +* set_pretimeout: this routine checks and changes the pretimeout value of + the watchdog. It is optional because not all watchdogs support pretimeout + notification. The timeout value is not an absolute time, but the number of + seconds before the actual timeout would happen. It returns 0 on success, + -EINVAL for "parameter out of range" and -EIO for "could not write value to + the watchdog". A value of 0 disables pretimeout notification. + (Note: the WDIOF_PRETIMEOUT needs to be set in the options field of the + watchdog's info structure). + If the watchdog driver does not have to perform any action but setting the + watchdog_device.pretimeout, this callback can be omitted. That means if + set_pretimeout is not provided but WDIOF_PRETIMEOUT is set, the watchdog + infrastructure updates the pretimeout value of the watchdog_device internally + to the requested value. * get_timeleft: this routines returns the time that's left before a reset. * restart: this routine restarts the machine. It returns 0 on success or a negative errno code for failure. diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 5d028f94a90743..ad9f4032f02d18 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -308,10 +308,14 @@ static int watchdog_set_timeout(struct watchdog_device *wdd, if (watchdog_timeout_invalid(wdd, timeout)) return -EINVAL; - if (wdd->ops->set_timeout) + if (wdd->ops->set_timeout) { err = wdd->ops->set_timeout(wdd, timeout); - else + } else { wdd->timeout = timeout; + /* Disable pretimeout if it doesn't fit the new timeout */ + if (wdd->pretimeout > wdd->timeout) + wdd->pretimeout = 0; + } watchdog_update_worker(wdd); @@ -319,6 +323,31 @@ static int watchdog_set_timeout(struct watchdog_device *wdd, } /* + * watchdog_set_pretimeout: set the watchdog timer pretimeout + * @wdd: the watchdog device
[PATCH 4/7] watchdog: documentation: squash paragraphs about 'no set_timeout'
From: Wolfram SangThose paragraphs deal with the same topic, so tie them together for easier reading. Signed-off-by: Wolfram Sang --- Documentation/watchdog/watchdog-kernel-api.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index 917eeeabfa5eae..a9a65f8c0de9f0 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt @@ -179,8 +179,8 @@ they are supported. These optional routines/operations are: (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the watchdog's info structure). If the watchdog driver does not have to perform any action but setting the - watchdog_device.timeout, this callback can be omitted. - If set_timeout is not provided but, WDIOF_SETTIMEOUT is set, the watchdog + watchdog_device.timeout, this callback can be omitted. That means if + set_timeout is not provided but WDIOF_SETTIMEOUT is set, the watchdog infrastructure updates the timeout value of the watchdog_device internally to the requested value. * get_timeleft: this routines returns the time that's left before a reset. -- 2.8.1
[PATCH 1/7] watchdog: add watchdog pretimeout framework
From: Wolfram SangThe change adds a simple watchdog pretimeout framework infrastructure, its purpose is to allow users to select a desired handling of watchdog pretimeout events, which may be generated by a watchdog driver. By design every watchdog pretimeout governor may be compiled as a kernel module, a user selects a default watchdog pretimeout governor during compilation stage and can select another governor in runtime. Watchdogs with WDIOF_PRETIMEOUT capability now have two device attributes in sysfs: read/write pretimeout_governor attribute and read only pretimeout_available_governors attribute. Watchdogs with no WDIOF_PRETIMEOUT capability has no changes in sysfs. Signed-off-by: Vladimir Zapolskiy Signed-off-by: Wolfram Sang --- Changes since Vladimir's last version: * rebased adapt to the internal data reorganization, especially the now private struct device *dev * dropped can_sleep support! The additional lock, list, and workqueue made the code quite complex. The only user was the userspace governor which can be reworked to let the watchdog device code do the bottom half. In addition, I am not fully convinced sending a uevent is the proper thing to do, but this needs to be discussed in another thread. Removing this support makes the code much easier to follow (locking!), saves 30% of LoC + a list + a workqueue. * moved pretimeout registration from watchdog_core to watchdog_dev Let's handle it exactly where the device is created, so we have access to the now private device pointer for adding the sysfs files. * don't export watchdog_(un)register_pretimeout since they are linked to the core anyhow * whitespace cleanups drivers/watchdog/Kconfig | 8 + drivers/watchdog/Makefile | 6 +- drivers/watchdog/watchdog_dev.c| 8 + drivers/watchdog/watchdog_pretimeout.c | 269 + drivers/watchdog/watchdog_pretimeout.h | 35 + include/linux/watchdog.h | 10 ++ 6 files changed, 334 insertions(+), 2 deletions(-) create mode 100644 drivers/watchdog/watchdog_pretimeout.c create mode 100644 drivers/watchdog/watchdog_pretimeout.h diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3902c9ca7f099d..909d1021de5cbc 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1774,4 +1774,12 @@ config USBPCWATCHDOG Most people will say N. +comment "Watchdog Pretimeout Governors" + +config WATCHDOG_PRETIMEOUT_GOV + bool "Enable watchdog pretimeout governors" + default n + help + The option allows to select watchdog pretimeout governors. + endif # WATCHDOG diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 2cbc9709852d0e..820860cf3e8d62 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -3,8 +3,10 @@ # # The WatchDog Timer Driver Core. -watchdog-objs += watchdog_core.o watchdog_dev.o -obj-$(CONFIG_WATCHDOG_CORE)+= watchdog.o +obj-$(CONFIG_WATCHDOG_CORE) += watchdog.o + +watchdog-y += watchdog_core.o watchdog_dev.o +watchdog-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV) += watchdog_pretimeout.o # Only one watchdog can succeed. We probe the ISA/PCI/USB based # watchdog-cards first, then the architecture specific watchdog diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 3595cffa24ea49..5d028f94a90743 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -49,6 +49,7 @@ #include /* For copy_to_user/put_user/... */ #include "watchdog_core.h" +#include "watchdog_pretimeout.h" /* * struct watchdog_core_data - watchdog core internal data @@ -911,6 +912,12 @@ int watchdog_dev_register(struct watchdog_device *wdd) return PTR_ERR(dev); } + ret = watchdog_register_pretimeout(wdd, dev); + if (ret) { + device_destroy(_class, devno); + watchdog_cdev_unregister(wdd); + } + return ret; } @@ -924,6 +931,7 @@ int watchdog_dev_register(struct watchdog_device *wdd) void watchdog_dev_unregister(struct watchdog_device *wdd) { + watchdog_unregister_pretimeout(wdd); device_destroy(_class, wdd->wd_data->cdev.dev); watchdog_cdev_unregister(wdd); } diff --git a/drivers/watchdog/watchdog_pretimeout.c b/drivers/watchdog/watchdog_pretimeout.c new file mode 100644 index 00..87a10ebeaacc7e --- /dev/null +++ b/drivers/watchdog/watchdog_pretimeout.c @@ -0,0 +1,269 @@ +/* + * Watchdog pretimout governor framework + * + * Copyright (C) 2015 Mentor Graphics + * Copyright (C) 2016 Renesas Electronics Corporation + * Copyright (C) 2016 Sang Engineering, Wolfram Sang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the
Re: [PATCH] sh-sci: SysRq support on EARLYCON
Hi Sato-san, CC linux-serial On Wed, Apr 27, 2016 at 5:49 PM, Yoshinori Satowrote: > Add missing flag condition. > > Signed-off-by: Yoshinori Sato Acked-by: Geert Uytterhoeven Unfortunately magic SysRq only works if CONFIG_SERIAL_SH_SCI_DMA=n. > --- > drivers/tty/serial/sh-sci.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c > index 0130feb..5a73620 100644 > --- a/drivers/tty/serial/sh-sci.c > +++ b/drivers/tty/serial/sh-sci.c > @@ -18,7 +18,9 @@ > * License. See the file "COPYING" in the main directory of this archive > * for more details. > */ > -#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) > +#if (defined(CONFIG_SERIAL_SH_SCI_CONSOLE) || \ > + defined(CONFIG_SERIAL_SH_SCI_EARLYCON)) && \ > + defined(CONFIG_MAGIC_SYSRQ) > #define SUPPORT_SYSRQ > #endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH 3/4] ARM: Renesas: R-Car3: Add cpu and revision handlers
The Renesas R-Car3 product register (PRR) helps us to identify the SoC and revision we are running on. Add helper functions to check for this easily in code where it's needed. Signed-off-by: Dirk Behme--- include/linux/soc/renesas/rcar3-prr.h | 51 +++ 1 file changed, 51 insertions(+) create mode 100644 include/linux/soc/renesas/rcar3-prr.h diff --git a/include/linux/soc/renesas/rcar3-prr.h b/include/linux/soc/renesas/rcar3-prr.h new file mode 100644 index 000..9bbe369 --- /dev/null +++ b/include/linux/soc/renesas/rcar3-prr.h @@ -0,0 +1,51 @@ +/* + * R-Car3 Product Register (PRR) support + * + * Copyright (C) 2016 Robert Bosch Car Multimedia GmbH + * Dirk Behme + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#ifndef __SOC_RENESAS_RCAR3_PRR_H__ +#define __SOC_RENESAS_RCAR3_PRR_H__ + +#define PRODUCT_MASK (0x7f << 8) +#define PRODUCT_H3 (0x4f << 8) +#define PRODUCT_M3W(0x52 << 8) + +#define CUT_MASK (0x00ff) +#define CUT_ES1(0x0 << 0) +#define CUT_ES2(0x1 << 4) +#define CUT_ES3(0x1 << 5) + +extern unsigned int __rcar3_prr; + +static inline bool cpu_is_rcar3_h3(void) +{ + return (__rcar3_prr & PRODUCT_MASK) == PRODUCT_H3; +} + +static inline bool cpu_is_rcar3_m3w(void) +{ + return (__rcar3_prr & PRODUCT_MASK) == PRODUCT_M3W; +} + +static inline bool revision_is_rcar3_es1(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES1; +} + +static inline bool revision_is_rcar3_es2(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES2; +} + +static inline bool revision_is_rcar3_es3(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES3; +} + +#endif /* __SOC_RENESAS_RCAR3_PRR_H__ */ -- 2.8.0
[PATCH 4/4] drm: rcar-du: Use product register framework
Instead of hard coding the product register in the rcar-du, use the framework for it to get the SoC version and the revision needed for the enabling the workaround. Signed-off-by: Dirk Behme--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index e10943b..ee639a6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -30,12 +31,6 @@ #include "rcar_du_regs.h" #include "rcar_du_vsp.h" -#define PRODUCT_REG0xfff00044 -#define PRODUCT_H3_BIT (0x4f << 8) -#define PRODUCT_MASK (0x7f << 8) -#define CUT_ES1(0x00) -#define CUT_ES1_MASK (0x00ff) - static u32 rcar_du_crtc_read(struct rcar_du_crtc *rcrtc, u32 reg) { struct rcar_du_device *rcdu = rcrtc->group->dev; @@ -167,7 +162,6 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) u32 div; u32 dpll_reg = 0; struct dpll_info *dpll; - void __iomem *product_reg; bool h3_es1_workaround = false; dpll = kzalloc(sizeof(*dpll), GFP_KERNEL); @@ -175,11 +169,8 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) return; /* DU2 DPLL Clock Select bit workaround in R-Car H3(ES1.0) */ - product_reg = ioremap(PRODUCT_REG, 0x04); - if (((readl(product_reg) & PRODUCT_MASK) == PRODUCT_H3_BIT) - && ((readl(product_reg) & CUT_ES1_MASK) == CUT_ES1)) + if (cpu_is_rcar3_h3() && revision_is_rcar3_es1()) h3_es1_workaround = true; - iounmap(product_reg); /* Compute the clock divisor and select the internal or external dot * clock based on the requested frequency. -- 2.8.0
R8A7795 FDP1 clock parentage
Hi Morimoto-san, I have added an initial patch to support the FDP1 in the clock framework, but I have not been able to correctly identify the actual clock parent. For now I have assumed that it is R8A7795_CLK_S2D1. Could you please confirm this selection, or help identify the true parent please? -- Regards Kieran
Re: [PATCH v3 1/3] arm64: dts: r8a7796: Add Renesas R8A7796 SoC support
On 24.05.2016 03:54, Simon Horman wrote: Basic support for the Gen 3 R-Car M3-W SoC. Based on work for the r8a7795 and r8a7796 SoCs by Takeshi Kihara, Dirk Behme and Geert Uytterhoeven. Signed-off-by: Simon HormanReviewed-by: Geert Uytterhoeven --- v3 * As suggested by Geert Uytterhoeven: - Drop 0x from unit address of gic * As suggested by Khiem Nguyen: - Use psci-0.2 * Added Reviewed-by tag from Geert Uytterhoeven v2 * As suggested by Geert Uytterhoeven: - Move L2_CA57 node under cpus node and include reg property - Omit status = "disabled" from scif_clk node --- Documentation/devicetree/bindings/arm/shmobile.txt | 4 + arch/arm64/Kconfig.platforms | 6 ++ arch/arm64/boot/dts/renesas/r8a7796.dtsi | 120 + 3 files changed, 130 insertions(+) create mode 100644 arch/arm64/boot/dts/renesas/r8a7796.dtsi diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt index 9cf67e48f222..d5ed554830d7 100644 --- a/Documentation/devicetree/bindings/arm/shmobile.txt +++ b/Documentation/devicetree/bindings/arm/shmobile.txt @@ -29,6 +29,8 @@ SoCs: compatible = "renesas,r8a7794" - R-Car H3 (R8A77950) compatible = "renesas,r8a7795" + - R-Car M3-W (R8A77960) +compatible = "renesas,r8a7796" Boards: @@ -61,5 +63,7 @@ Boards: compatible = "renesas,porter", "renesas,r8a7791" - Salvator-X (RTP0RC7795SIPB0010S) compatible = "renesas,salvator-x", "renesas,r8a7795"; + - Salvator-X +compatible = "renesas,salvator-x", "renesas,r8a7796"; - SILK (RTP0RC7794LCB00011S) compatible = "renesas,silk", "renesas,r8a7794" diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index efa77c146415..16d8d26839ea 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -114,6 +114,12 @@ config ARCH_R8A7795 help This enables support for the Renesas R-Car H3 SoC. +config ARCH_R8A7796 + bool "Renesas R-Car M3-W SoC Platform" + depends on ARCH_RENESAS + help + This enables support for the Renesas R-Car M3-W SoC. + config ARCH_STRATIX10 bool "Altera's Stratix 10 SoCFPGA Family" help diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi new file mode 100644 index ..178debf68318 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi @@ -0,0 +1,120 @@ +/* + * Device Tree Source for the r8a7796 SoC + * + * Copyright (C) 2016 Renesas Electronics Corp. + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include +#include + +/ { + compatible = "renesas,r8a7796"; + #address-cells = <2>; + #size-cells = <2>; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + /* 1 core only at this point */ + a57_0: cpu@0 { + compatible = "arm,cortex-a57", "arm,armv8"; + reg = <0x0>; + device_type = "cpu"; + next-level-cache = <_CA57>; + enable-method = "psci"; + }; + + L2_CA57: cache-controller@0 { + compatible = "cache"; + reg = <0>; + cache-unified; + cache-level = <2>; + }; + }; It looks to me that in the r8a7795.dtsi the cache-controller node is outside the cpus node? I'd think that we should keep is consistent. Best regards Dirk
Re: [PATCH v3 1/3] arm64: dts: r8a7796: Add Renesas R8A7796 SoC support
On 25.05.2016 07:10, Dirk Behme wrote: Hi Simon, On 25.05.2016 02:48, Simon Horman wrote: Hi Dirk, On Tue, May 24, 2016 at 07:30:17AM +0200, Dirk Behme wrote: Hi Simon, [...] With Renesas R-Car3 we will get a whole family of SoCs. I.e. different computing power (e.g. different number of Cores) with more or less similar peripherals. I would think that we want to reflect this in the device tree, too. Therefore I think what we want is a hierarchy of device trees. Similar what's done with other SoC families (compare e.g. i.MX6). E.g. we want an initial rcar3.dtsi, which contains all common parts of all R-Car3 SoCs. E.g. one CA57 core, the SCIF where its common etc. Then you will have the r8a779x.dtsi which includes the rcar3.dtsi and extends it for SoC specific parts. Which then will be included by the board device trees, as already done, now. Or in other words: As soon as you have similar parts in the r8a779x.dtsi's, it's time to think about moving the parts one hierarchy level up into the rcar3.dtsi. Else you will end up in a maintenance hell once you have to change/fix anything. Thanks for raising this issue. I agree entirely that we should work towards a situation where maintenance is as easy as it can be. However, due to the per-SoC binding scheme that we are using for IP related to Renesas SoCs I suspect that very few DT nodes can be shared between SoCs verbatim. Could you kindly share an example for this? Looking into the H3 and the M3-W manual, it looks to me that ~90% (?) of the peripherals are the same. Probably some sort of scheme can be cooked up using preprocessor macros. And probably there are other ways to resolve this problem. But I would prefer if we worked towards resolving this maintenance problem in parallel with rather than as a dependency of merging r8a7796 support into mainline. I'd propose to do it correct from the beginning. Doing it later would either be more work or forgotten, and never be done, then. For a starting point, I'd propose to put the r8a7795.dtsi and r8a7796.dtsi into a graphical diff tool and move all common parts to a rcar3.dtsi (I'd be happy to discuss the name, though) To give an example what I'm talking about kindly have a look to the attached (draft) patch. Best regards Dirk P.S.: This also results in the question why we need similar r8a7795-cpg-mssr.h and r8a7796-cpg-mssr.h with just different "numbers" for the same clocks. Can't we use the same numbers on all SoCs, with just having wholes in the list where the clocks don't exist on a SoC? I haven't looked into the manual if these numbers are given by the hardware, though. >From 08078bf12780176ab116fe5f39a378f5ee374ae3 Mon Sep 17 00:00:00 2001 From: Dirk BehmeDate: Wed, 25 May 2016 09:23:58 +0200 Subject: [PATCH] arm64: dts: Renesas R-Car3: Introduce common rcar3.dtsi The R-Car3 SoC family will contain several similar SoCs, sharing several peripherals. Introduce a common rcar3.dtsi containing the common parts of all R-Car3 family SoCs. Signed-off-by: Dirk Behme --- arch/arm64/boot/dts/renesas/r8a7795.dtsi | 109 ++ arch/arm64/boot/dts/renesas/r8a7796.dtsi | 109 ++ arch/arm64/boot/dts/renesas/rcar3.dtsi | 112 +++ 3 files changed, 125 insertions(+), 205 deletions(-) create mode 100644 arch/arm64/boot/dts/renesas/rcar3.dtsi diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi index a7315eb..0737ed2 100644 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi @@ -10,11 +10,10 @@ #include #include +#include "rcar3.dtsi" / { compatible = "renesas,r8a7795"; - #address-cells = <2>; - #size-cells = <2>; aliases { i2c0 = @@ -26,23 +25,7 @@ i2c6 = }; - psci { - compatible = "arm,psci-0.2"; - method = "smc"; - }; - cpus { - #address-cells = <1>; - #size-cells = <0>; - - a57_0: cpu@0 { - compatible = "arm,cortex-a57", "arm,armv8"; - reg = <0x0>; - device_type = "cpu"; - next-level-cache = <_CA57>; - enable-method = "psci"; - }; - a57_1: cpu@1 { compatible = "arm,cortex-a57","arm,armv8"; reg = <0x1>; @@ -66,32 +49,12 @@ }; }; - L2_CA57: cache-controller@0 { - compatible = "cache"; - cache-unified; - cache-level = <2>; - }; - L2_CA53: cache-controller@1 { compatible = "cache"; cache-unified; cache-level = <2>; }; - extal_clk: extal { -
[PATCH 5/7] watchdog: softdog: sort includes to avoid duplicates
From: Wolfram SangSigned-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 42faa3d424d5ca..ab0e02fc81a276 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -21,15 +21,15 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include +#include +#include #include #include -#include +#include #include +#include #include -#include -#include -#include -#include #define TIMER_MARGIN 60 /* Default is 60 seconds */ static unsigned int soft_margin = TIMER_MARGIN;/* in seconds */ -- 2.8.1
[PATCH 3/7] watchdog: softdog: consistently use softdog_ prefix
From: Wolfram SangAnd move module_init/exit to the proper place while here. Signed-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index a9ad27dd46502b..0a29f5a0833787 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -54,12 +54,12 @@ module_param(soft_panic, int, 0); MODULE_PARM_DESC(soft_panic, "Softdog action, set to 1 to panic, 0 to reboot (default=0)"); -static void watchdog_fire(unsigned long); +static void softdog_fire(unsigned long); -static struct timer_list watchdog_ticktock = - TIMER_INITIALIZER(watchdog_fire, 0, 0); +static struct timer_list softdog_ticktock = + TIMER_INITIALIZER(softdog_fire, 0, 0); -static void watchdog_fire(unsigned long data) +static void softdog_fire(unsigned long data) { module_put(THIS_MODULE); if (soft_noboot) @@ -76,14 +76,14 @@ static void watchdog_fire(unsigned long data) static int softdog_ping(struct watchdog_device *w) { - if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) + if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) __module_get(THIS_MODULE); return 0; } static int softdog_stop(struct watchdog_device *w) { - if (del_timer(_ticktock)) + if (del_timer(_ticktock)) module_put(THIS_MODULE); return 0; @@ -115,7 +115,7 @@ static struct watchdog_device softdog_dev = { .timeout = TIMER_MARGIN, }; -static int __init watchdog_init(void) +static int __init softdog_init(void) { int ret; @@ -132,14 +132,13 @@ static int __init watchdog_init(void) return 0; } +module_init(softdog_init); -static void __exit watchdog_exit(void) +static void __exit softdog_exit(void) { watchdog_unregister_device(_dev); } - -module_init(watchdog_init); -module_exit(watchdog_exit); +module_exit(softdog_exit); MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("Software Watchdog Device Driver"); -- 2.8.1
[PATCH 0/7] watchdog: softdog: cleanups
While working on another series where I need the softdog, this series already came out of it. It gets the driver prepared for the interesting stuff (coming later today hopefully) but is orthogonal from that. Buildbot is happy, branch is here: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/softdog_cleanup Please review, comment, apply... Thanks, Wolfram Wolfram Sang (7): watchdog: softdog: remove obsolete comments watchdog: softdog: use watchdog core to init timeout value watchdog: softdog: consistently use softdog_ prefix watchdog: softdog: remove forward declaration watchdog: softdog: sort includes to avoid duplicates watchdog: softdog: drop superfluous set_timeout callback watchdog: softdog: improve coding style drivers/watchdog/softdog.c | 92 +++--- 1 file changed, 21 insertions(+), 71 deletions(-) -- 2.8.1
[PATCH 2/7] watchdog: softdog: use watchdog core to init timeout value
From: Wolfram SangError string and comment say we fall back to a default, but in reality we bailed out. Refactor the code to use the core helper which then matches the described behaviour. While updating the init message anyhow, shorten it while we are here; no need for versioning there as well and the name is already given via pr_fmt. Signed-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 8bc0b164afc94b..a9ad27dd46502b 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -111,22 +111,15 @@ static struct watchdog_device softdog_dev = { .info = _info, .ops = _ops, .min_timeout = 1, - .max_timeout = 0x + .max_timeout = 65535, + .timeout = TIMER_MARGIN, }; static int __init watchdog_init(void) { int ret; - /* Check that the soft_margin value is within it's range; - if not reset to the default */ - if (soft_margin < 1 || soft_margin > 65535) { - pr_info("soft_margin must be 0 < soft_margin < 65536, using %d\n", - TIMER_MARGIN); - return -EINVAL; - } - softdog_dev.timeout = soft_margin; - + watchdog_init_timeout(_dev, soft_margin, NULL); watchdog_set_nowayout(_dev, nowayout); watchdog_stop_on_reboot(_dev); @@ -134,8 +127,8 @@ static int __init watchdog_init(void) if (ret) return ret; - pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n", - soft_noboot, soft_margin, soft_panic, nowayout); + pr_info("initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n", + soft_noboot, softdog_dev.timeout, soft_panic, nowayout); return 0; } -- 2.8.1
[PATCH 1/7] watchdog: softdog: remove obsolete comments
From: Wolfram SangThe history is obsolete, especially since we switched to watchdog framework. The section markers also don't make sense anymore given the small size of the driver. Signed-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 33 - 1 file changed, 33 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 99a06f9e393064..8bc0b164afc94b 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -17,23 +17,6 @@ * * Software only watchdog driver. Unlike its big brother the WDT501P * driver this won't always recover a failed machine. - * - * 03/96: Angelo Haritsis : - * Modularised. - * Added soft_margin; use upon insmod to change the timer delay. - * NB: uses same minor as wdt (WATCHDOG_MINOR); we could use separate - * minors. - * - * 19980911 Alan Cox - * Made SMP safe for 2.3.x - * - * 20011127 Joel Becker (jl...@evilplan.org> - * Added soft_noboot; Allows testing the softdog trigger without - * requiring a recompile. - * Added WDIOC_GETTIMEOUT and WDIOC_SETTIMOUT. - * - * 20020530 Joel Becker - * Added Matt Domsch's nowayout module option. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -71,19 +54,11 @@ module_param(soft_panic, int, 0); MODULE_PARM_DESC(soft_panic, "Softdog action, set to 1 to panic, 0 to reboot (default=0)"); -/* - * Our timer - */ - static void watchdog_fire(unsigned long); static struct timer_list watchdog_ticktock = TIMER_INITIALIZER(watchdog_fire, 0, 0); -/* - * If the timer expires.. - */ - static void watchdog_fire(unsigned long data) { module_put(THIS_MODULE); @@ -99,10 +74,6 @@ static void watchdog_fire(unsigned long data) } } -/* - * Softdog operations - */ - static int softdog_ping(struct watchdog_device *w) { if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) @@ -124,10 +95,6 @@ static int softdog_set_timeout(struct watchdog_device *w, unsigned int t) return 0; } -/* - * Kernel Interfaces - */ - static struct watchdog_info softdog_info = { .identity = "Software Watchdog", .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, -- 2.8.1
[PATCH 6/7] watchdog: softdog: drop superfluous set_timeout callback
From: Wolfram SangIf we leave set_timeout empty, the core will do exactly what is implemented here anyway. Signed-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index ab0e02fc81a276..5e3a30b99d4415 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -87,12 +87,6 @@ static int softdog_stop(struct watchdog_device *w) return 0; } -static int softdog_set_timeout(struct watchdog_device *w, unsigned int t) -{ - w->timeout = t; - return 0; -} - static struct watchdog_info softdog_info = { .identity = "Software Watchdog", .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, @@ -102,7 +96,6 @@ static struct watchdog_ops softdog_ops = { .owner = THIS_MODULE, .start = softdog_ping, .stop = softdog_stop, - .set_timeout = softdog_set_timeout, }; static struct watchdog_device softdog_dev = { -- 2.8.1
[PATCH 4/7] watchdog: softdog: remove forward declaration
From: Wolfram SangSigned-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 0a29f5a0833787..42faa3d424d5ca 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -54,11 +54,6 @@ module_param(soft_panic, int, 0); MODULE_PARM_DESC(soft_panic, "Softdog action, set to 1 to panic, 0 to reboot (default=0)"); -static void softdog_fire(unsigned long); - -static struct timer_list softdog_ticktock = - TIMER_INITIALIZER(softdog_fire, 0, 0); - static void softdog_fire(unsigned long data) { module_put(THIS_MODULE); @@ -74,6 +69,9 @@ static void softdog_fire(unsigned long data) } } +static struct timer_list softdog_ticktock = + TIMER_INITIALIZER(softdog_fire, 0, 0); + static int softdog_ping(struct watchdog_device *w) { if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) -- 2.8.1
[PATCH 7/7] watchdog: softdog: improve coding style
From: Wolfram SangSigned-off-by: Wolfram Sang --- drivers/watchdog/softdog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 5e3a30b99d4415..b067edf246dff2 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -57,9 +57,9 @@ MODULE_PARM_DESC(soft_panic, static void softdog_fire(unsigned long data) { module_put(THIS_MODULE); - if (soft_noboot) + if (soft_noboot) { pr_crit("Triggered - Reboot ignored\n"); - else if (soft_panic) { + } else if (soft_panic) { pr_crit("Initiating panic\n"); panic("Software Watchdog Timer expired"); } else { @@ -74,7 +74,7 @@ static struct timer_list softdog_ticktock = static int softdog_ping(struct watchdog_device *w) { - if (!mod_timer(_ticktock, jiffies+(w->timeout*HZ))) + if (!mod_timer(_ticktock, jiffies + (w->timeout * HZ))) __module_get(THIS_MODULE); return 0; } -- 2.8.1