Hi Magnus, Thanks for your patch! On Mon, Dec 21, 2020 at 4:31 PM Magnus Damm <damm@xxxxxxxxxxxxx> wrote: > From: Magnus Damm <damm+renesas@xxxxxxxxxxxxx> > > This patch contains kernel modificatons to allow some basic testing from > user space of the CMT0 device included on the r8a77965 SoC. > > Not suitable for upstream merge. No attempt has been made to turn this into > somewhat clean code, so consider this a rough hack. The patch is a combination > of the following: > - Device Tree modifications to expose CMT0 via UIO > - code to add UIO driver debug code > - adjustment for the compat string matching in MODULE_DEVICE_TABLE() > > As Geert kindly pointed out there might be better ways to do this. > > For the kernel, simply apply the kernel patch (including a few debug printouts) > and make sure to extend your kernel config with CONFIG_UIO_PDRV_GENIRQ=y. > > The code in this patch is similar to earlier posted series but has been > ported from r8a77965 to r8a77961. > > [PATCH 0/2] r8a77961 CMT test setup using UIO > [PATCH 1/2] r8a77961 CMT0 device exposed via UIO > [PATCH 2/2] UIO CMT test program > > The most tricky challenge was to trim down the kernel size to be able to > boot with the old boot loader. The user space UIO test app remains the same > as for r8a77961 and can be located in the mailing list archives. Does the size issue go away if you load the Image at 0x60000000 and the DTB at 0x68000000? That works for me on R-Car H3 ES1.0. > --- 0001/arch/arm64/boot/dts/renesas/r8a77965.dtsi > +++ work/arch/arm64/boot/dts/renesas/r8a77965.dtsi 2020-12-21 22:20:47.036998593 +0900 > @@ -334,19 +334,6 @@ > reg = <0 0xe6060000 0 0x50c>; > }; > > - cmt0: timer@e60f0000 { > - compatible = "renesas,r8a77965-cmt0", > - "renesas,rcar-gen3-cmt0"; > - reg = <0 0xe60f0000 0 0x1004>; > - interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, > - <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; > - clocks = <&cpg CPG_MOD 303>; > - clock-names = "fck"; > - power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; > - resets = <&cpg 303>; > - status = "disabled"; > - }; > - > cmt1: timer@e6130000 { > compatible = "renesas,r8a77965-cmt1", > "renesas,rcar-gen3-cmt1"; > @@ -414,6 +401,16 @@ > #reset-cells = <1>; > }; > > + cmt0: timer@e60f0000 { > + compatible = "uio_pdrv_genirq"; > + reg = <0 0xe60f0000 0 0x1004>; > + interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&cpg CPG_MOD 303>; > + clock-names = "fck"; > + power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; > + resets = <&cpg 303>; > + }; Why move the node? This would be easier to review if you wouldn't move the node. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx 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