Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource: sh_mtu2: Add DT support

Document DT bindings and parse them in the MTU2 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>

+47
+39
Documentation/devicetree/bindings/timer/renesas,mtu2.txt
··· 1 + * Renesas R-Car Multi-Function Timer Pulse Unit 2 (MTU2) 2 + 3 + The MTU2 is a multi-purpose, multi-channel timer/counter with configurable 4 + clock inputs and programmable compare match. 5 + 6 + Channels share hardware resources but their counter and compare match value 7 + are independent. The MTU2 hardware supports five channels indexed from 0 to 4. 8 + 9 + Required Properties: 10 + 11 + - compatible: must contain "renesas,mtu2" 12 + 13 + - reg: base address and length of the registers block for the timer module. 14 + 15 + - interrupts: interrupt specifiers for the timer, one for each entry in 16 + interrupt-names. 17 + - interrupt-names: must contain one entry named "tgi?a" for each enabled 18 + channel, where "?" is the channel index expressed as one digit from "0" to 19 + "4". 20 + 21 + - clocks: a list of phandle + clock-specifier pairs, one for each entry 22 + in clock-names. 23 + - clock-names: must contain "fck" for the functional clock. 24 + 25 + 26 + Example: R7S72100 (RZ/A1H) MTU2 node 27 + 28 + mtu2: timer@fcff0000 { 29 + compatible = "renesas,mtu2"; 30 + reg = <0xfcff0000 0x400>; 31 + interrupts = <0 139 IRQ_TYPE_LEVEL_HIGH>, 32 + <0 146 IRQ_TYPE_LEVEL_HIGH>, 33 + <0 150 IRQ_TYPE_LEVEL_HIGH>, 34 + <0 154 IRQ_TYPE_LEVEL_HIGH>, 35 + <0 159 IRQ_TYPE_LEVEL_HIGH>; 36 + interrupt-names = "tgi0a", "tgi1a", "tgi2a", "tgi3a", "tgi4a"; 37 + clocks = <&mstp3_clks R7S72100_CLK_MTU2>; 38 + clock-names = "fck"; 39 + };
+8
drivers/clocksource/sh_mtu2.c
··· 23 23 #include <linux/ioport.h> 24 24 #include <linux/irq.h> 25 25 #include <linux/module.h> 26 + #include <linux/of.h> 26 27 #include <linux/platform_device.h> 27 28 #include <linux/pm_domain.h> 28 29 #include <linux/pm_runtime.h> ··· 501 500 }; 502 501 MODULE_DEVICE_TABLE(platform, sh_mtu2_id_table); 503 502 503 + static const struct of_device_id sh_mtu2_of_table[] __maybe_unused = { 504 + { .compatible = "renesas,mtu2" }, 505 + { } 506 + }; 507 + MODULE_DEVICE_TABLE(of, sh_mtu2_of_table); 508 + 504 509 static struct platform_driver sh_mtu2_device_driver = { 505 510 .probe = sh_mtu2_probe, 506 511 .remove = sh_mtu2_remove, 507 512 .driver = { 508 513 .name = "sh_mtu2", 514 + .of_match_table = of_match_ptr(sh_mtu2_of_table), 509 515 }, 510 516 .id_table = sh_mtu2_id_table, 511 517 };