From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] mxs: added driver for OCOTP in i.MX23 and i.MX28
Date: Thu, 18 Jul 2013 08:36:55 +0200 [thread overview]
Message-ID: <20130718063655.GH10380@pengutronix.de> (raw)
In-Reply-To: <1068003072.1131668.1374097392210.open-xchange@email.1und1.de>
On Wed, Jul 17, 2013 at 11:43:12PM +0200, Christoph G. Baumann wrote:
> Hello Sascha,
>
> thanks for your input. I must admit that I didn't do a thorough review of the
> FSL code...
>
>
> > Sascha Hauer <s.hauer@pengutronix.de> hat am 17. Juli 2013 um 21:26
> > geschrieben:
> > [...]
> > > +static DEFINE_MUTEX(otp_mutex);
> > > +static struct kobject *otp_kobj;
> > > +static struct attribute **attrs;
> > > +static struct kobj_attribute *kattr;
> > > +static struct attribute_group attr_group;
> > > +static unsigned long otp_hclk_saved;
> > > +static u32 otp_voltage_saved;
> > > +static resource_size_t otp_base_address;
> > > +struct regulator *regu;
> >
> > Collect your driver data in a struct and pass it around in functions
> > calls. No need to limit this driver to a single instance.
>
> The OTP device is unique in the CPU and several instances i.e. potential
> concurrent access is considered harmful. So I kept this construction
> from FSL.
Yes, this is single instance only in current SoCs. This is no reason
though to make the driver single instance capabable only. It's not
much work to change and it raises less eyebrows if it's properly
written.
In the end I never thought that there ever would be two instances of
the i.MX graphics subsystem (IPU). Now the i.MX6 has two of them...
>
>
> > > +static int otp_write_prepare(void)
> > > +{
> > > +? ? ?struct clk *hclk;
> > > +? ? ?int err = 0;
> > > +
> > > +? ? ?/* [1] HCLK to 24MHz. */
> > > +? ? ?hclk = clk_get_sys("hbus", NULL);
> >
> > This is a driver, so you should use regular clk_get, not clk_get_sys.
> > Besides, this has to be done during probe. clk_get takes a reference to
> > the clock which has to be released.
>
> As far as I remember testing clk_get didn't work in this place.
That is because the clk_register_clkdev() in your other patch is wrong.
Look at the 'clocks' and 'clock-names' properties in the devicetree.
Also look at Documentation/devicetree/bindings/clock/imx28-clock.txt.
In short you have to add a clock to your devicetree node and then use
clk_get(). The struct device * passed to clk_get will make the bridge
between the device and the devicenode and the id argument will be the
same name as in the devicetree.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-07-18 6:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 12:39 [PATCH 0/3] Added support for On Chip OTP in i.MX23/28 Christoph G. Baumann
2013-07-03 12:39 ` [PATCH 1/3] " Christoph G. Baumann
2013-07-05 8:03 ` Maxime Ripard
2013-07-03 12:39 ` [PATCH 2/3] " Christoph G. Baumann
2013-07-05 8:08 ` Maxime Ripard
2013-07-03 12:39 ` [PATCH 3/3] " Christoph G. Baumann
2013-07-05 8:14 ` Maxime Ripard
2013-07-05 7:38 ` [PATCH 0/3] " Maxime Ripard
2013-07-07 21:19 ` Christoph G. Baumann
2013-07-17 16:27 ` [PATCH v2 0/3] mxs: add driver for On Chip OTP Christoph G. Baumann
2013-07-17 16:27 ` [PATCH v2 1/3] mxs: enable ocotp in device tree Christoph G. Baumann
2013-07-17 16:27 ` [PATCH v2 2/3] mxs: register clkdev "hbus" as it is required by OCOTP Christoph G. Baumann
2013-07-17 16:27 ` [PATCH v2 3/3] mxs: added driver for OCOTP in i.MX23 and i.MX28 Christoph G. Baumann
2013-07-17 19:26 ` Sascha Hauer
2013-07-17 21:43 ` Christoph G. Baumann
2013-07-18 6:36 ` Sascha Hauer [this message]
2013-07-18 15:14 ` Christoph G. Baumann
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=20130718063655.GH10380@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).