Accessing registers from another driver
lroluk at gmail.com
Wed Sep 27 05:58:12 EDT 2017
in a watchdog driver on an ARM platform, I have the need to write a hw
register managed by another driver (system reset controller).
I'm wondering what is the correct/clean way of doing that.
What I've done until now is adding a second couple in the "reg" property
of the device-tree
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_wdog>;
reg = <0x30280000 0x10000>, <0x30390000 0x10000>;
and then in the wdog driver adding the following code:
static void __iomem *src_base;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
src_base = devm_ioremap(&pdev->dev, res->start, res->end - res->start + 1);
writel(0x3, src_base + 4);
In this way it works as expected, but I'm not sure if this is correct?
More information about the Kernelnewbies