Writing to I2C device during Barebox boot
A message that is not in the archive (sent off-list or not yet received): CE7B48EC.8D30%[email protected]
I can hardly believe it myself but I have succeeded (i think) in writing a new driver for a I2C chip I use.
I probe the driver/device during boot and all seems well.
The device shows up in the device tree.
So before the init process for the board ends, I would like to write a few values to the device (it controls the PSU, thus the reason for doing it in barebox).
I want to do this in the board.c file at the end of the pcm049_devices_init function. Is this the right place?
But this is where my linux knowledge is letting me down.
How do I get a "handle" to the device in order to call the write_reg function?
Your pointers and help is much appreciated.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines · Ivor Kruger
But this is where my linux knowledge is letting me down.
How do I get a "handle" to the device in order to call the
write_regfunction?Your pointers and help is much appreciated.
Could you show us your code? That would make helping you much easier. Please see 'man git-send-email' on how to send patches with git.
Regards,
Jan
Signature · 10 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Jan, thanks for the reply, I will look into using git-send-email a bit later since I am going to travel this morning fro a few hours.
My question was however a little bit more generic. Take for example the PCM049 board.c file. One of the I2C components it loads is the TWL6030. If I wish to write to a register on this device, how would I go about it.
By the way, I am using PHYTEC_PD13_Linux from pengutronix. It includes barebox-2013-06.0
Thanks for your help.
Ivor
Quoted 6 lines · Jan Lübbe
Quoted 5 lines · Ivor Kruger
But this is where my linux knowledge is letting me down.
How do I get a "handle" to the device in order to call the
write_regfunction?
Quoted 18 lines
Quoted 1 line
Your pointers and help is much appreciated.
Could you show us your code? That would make helping you much easier. Please see 'man git-send-email' on how to send patches with git.
Regards,
JanSignature · 10 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Ivor,
Quoted 6 lines · Ivor Kruger
Jan, thanks for the reply, I will look into using git-send-email a bit later since I am going to travel this morning fro a few hours.
My question was however a little bit more generic. Take for example the PCM049
board.cfile. One of the I2C components it loads is the TWL6030. If I wish to write to a register on this device, how would I go about it.
When the driver is probed you should see a /dev/twl6030. You can read the registers doing:
md -s /dev/twl6030
And you can write registers like this:
mw -d /dev/twl6030 <offset> <value>
If you wish to read/write registers from code grep the code for twl6030_get.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox