linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Andrianov <vitalya@ti.com>
To: Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>, <linux-kernel@vger.kernel.org>
Subject: using the same regmap by multiple device drivers
Date: Wed, 29 Jun 2016 13:19:37 -0400	[thread overview]
Message-ID: <57740329.1080702@ti.com> (raw)

Hello,

I'm working on two drivers "crypto" and "hwrng", which use the same 
hardware module and the same block of registers. Actually the drivers 
don't need to access the same registers except several common ones.

Here is fragment of dts.

sa_subsys: subsys@1234000 {
	compatible	= "syscon";
	reg		= <0x1234000 0x1000>;
};

crypto@1234000 {
	compatible = "ti,netcp-sa-crypto";
	syscon-subsys = <&sa_subsys>;
	clocks = <&clksa>;
	.....
};

rng@1234000 {
	compatible = "ti,keystone-rng";
	syscon-subsys = <&sa_subsys>;
	clocks = <&clksa>;
};

The both drivers use

regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
				  	"syscon-subsys");

to get pointers to "struct regmap".

Unfortunately I can get the first driver working only. When the second 
driver tries to call regmap_read() kernel gives "Division by zero in 
kernel" error.

Here is my question. Is that actually possible to use in regmap 
framework the same registers in multiple different drivers?

Thank you,
-Vitaly

             reply	other threads:[~2016-06-29 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 17:19 Vitaly Andrianov [this message]
2016-06-29 18:31 ` using the same regmap by multiple device drivers Mark Brown
2016-06-29 18:37   ` Vitaly Andrianov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57740329.1080702@ti.com \
    --to=vitalya@ti.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).