From: Sascha Hauer <s.hauer@pengutronix.de>
To: Uladzimir Bely <u.bely@sam-solutions.net>
Cc: barebox@lists.infradead.org
Subject: Re: Re: [PATCH] imx6: ocotp: Add On-Chip OTP registers write support
Date: Fri, 11 Apr 2014 09:39:06 +0200 [thread overview]
Message-ID: <20140411073906.GN27055@pengutronix.de> (raw)
In-Reply-To: <5346A597.1010008@sam-solutions.net>
On Thu, Apr 10, 2014 at 05:07:19PM +0300, Uladzimir Bely wrote:
> Hello, Sasha.
>
> It seems I've fixed all according your remarks instead of one question.
>
> 10.04.2014 09:16, Sascha Hauer пишет:
> >
> > As suggested in my last mail:
> >
> > Do we need this tool at all? We can add a .macaddr parameter to the
> > ocotp device using dev_add_param_mac() (This function is new and
> > currently only in the -next branch)
> >
>
> How can we to use such parameters (even not macaddr, just bool)?
>
> For example, I'm trying just to add bool parameter in imx_ocotp_probe(),
> for additional FUSE write protection:
>
> > if (IS_ENABLED(CONFIG_IMX_OCOTP_WRITE)) {
> > dev_add_param_bool(dev, "permanent_write_enable",
> > NULL, NULL, &priv->write_enable, NULL);
> > }
>
> and check priv->write_enable instead of CONFIG_IMX_OCOTP_WRITE in write function.
>
> But how to set permanent_write_enable to 1 in barebox shell?
> As I understand, it should be something like ocotp0.permanent_write_enable=1,
> but I don't see any similar.
>
> If I add
>
> > add_generic_device("ocotp", 0, NULL, MX6_OCOTP_BASE_ADDR, 0x2000,
> > IORESOURCE_MEM, NULL);
>
> to board.c, I see something like 21bc000.ocotp.write_enable= available, but
> 21bc000.ocotp.write_enable=1 or 21bc000.ocotp.write_enable=0 doesn't work,
> saying "No such file or directory".
>
> Also, as I understand, it's an incorrect in field of using devicetree.
Sorry, I didn't remember this. Normally this is correct. We use
devname.parametername=value. With devicetree probing the devicename
itself has a dot in it and barebox doesn't handle this propertly. I'm
unsure if we can fix this. What you can do is register a logical device
in the probe function:
struct ocotp_priv {
...
struct device dev;
...
};
int ocotp_probe(struct device_d *dev)
{
...
strcpy(priv->dev.name, "ocotp");
priv->dev.parent = dev;
register_device(&priv->dev);
}
Then register the parameters on the new device and you can access them
with ocotp.write_enable=1.
>
> One more question: is there any way in barebox shell to write to character device
> with offset? For example, ocotptool just writes (reads) 8 bytes to ocotp cdev with offset
> 0x22*4 (MAC offset). How to do it from shell?
You can use md/mw to access offsets. Reading at an offset is:
md -s /dev/ocotp -b 0x10+1
reads one byte at offset 0x10 and:
mw -d /dev/ocotp -b 0x10 0xde
writes 0xde at offset 0x10. See 'help md' or 'help mw' for more
information.
What you can't do is reading bytes into variables.
That said, of cause it's cumbersome to handle MAC addresses with these
commands.
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-04-11 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3C20140403064122.GC17250@pengutronix.de>
2014-04-09 12:11 ` Uladzimir Bely
2014-04-09 12:39 ` Uladzimir Bely
2014-04-10 6:16 ` Sascha Hauer
2014-04-10 14:07 ` Uladzimir Bely
2014-04-11 7:39 ` Sascha Hauer [this message]
2014-04-11 12:06 ` Uladzimir Bely
2014-04-24 11:07 ` Sascha Hauer
2014-04-11 7:39 ` Uladzimir Bely
2014-04-03 6:41 Sascha Hauer
2014-04-03 7:07 ` Uladzimir Bely
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=20140411073906.GN27055@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=u.bely@sam-solutions.net \
/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