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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox