kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Accessing registers from another driver
@ 2017-09-27  9:58 Luca Ellero
  0 siblings, 0 replies; only message in thread
From: Luca Ellero @ 2017-09-27  9:58 UTC (permalink / raw)
  To: kernelnewbies

Hi,

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

&wdog1 {
 ??????? pinctrl-names = "default";
 ??????? pinctrl-0 = <&pinctrl_wdog>;
reg = <0x30280000 0x10000>, <0x30390000 0x10000>;
 ??????? fsl,wdog_b;
 ?};

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);
if (IS_ERR(src_base))
 ??????? return PTR_ERR(src_base);

...

writel(0x3, src_base + 4);


In this way it works as expected, but I'm not sure if this is correct?

Thanks

Best regards

Luca

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-27  9:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27  9:58 Accessing registers from another driver Luca Ellero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).