mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* FW: Writing to I2C device during Barebox boot
       [not found] <CE7B48EC.8D30%ivor@veriline.co.za>
@ 2013-10-10  1:59 ` Ivor Kruger
  2013-10-10  7:42   ` Jan Lübbe
  0 siblings, 1 reply; 4+ messages in thread
From: Ivor Kruger @ 2013-10-10  1:59 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: Writing to I2C device during Barebox boot
  2013-10-10  1:59 ` FW: Writing to I2C device during Barebox boot Ivor Kruger
@ 2013-10-10  7:42   ` Jan Lübbe
  2013-10-10 13:10     ` Ivor Kruger
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Lübbe @ 2013-10-10  7:42 UTC (permalink / raw)
  To: barebox

On Wed, 2013-10-09 at 18:59 -0700, Ivor Kruger wrote:
> 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.

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
-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing to I2C device during Barebox boot
  2013-10-10  7:42   ` Jan Lübbe
@ 2013-10-10 13:10     ` Ivor Kruger
  2013-10-14  8:27       ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ivor Kruger @ 2013-10-10 13:10 UTC (permalink / raw)
  To: 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

On 2013/10/10 12:42 AM, "Jan Lübbe" <jlu@pengutronix.de> wrote:

>On Wed, 2013-10-09 at 18:59 -0700, Ivor Kruger wrote:
>> 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.
>
>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
>-- 
>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



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Writing to I2C device during Barebox boot
  2013-10-10 13:10     ` Ivor Kruger
@ 2013-10-14  8:27       ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-10-14  8:27 UTC (permalink / raw)
  To: Ivor Kruger; +Cc: barebox

Hi Ivor,

On Thu, Oct 10, 2013 at 06:10:42AM -0700, Ivor Kruger wrote:
> 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.

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

-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-14  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CE7B48EC.8D30%ivor@veriline.co.za>
2013-10-10  1:59 ` FW: Writing to I2C device during Barebox boot Ivor Kruger
2013-10-10  7:42   ` Jan Lübbe
2013-10-10 13:10     ` Ivor Kruger
2013-10-14  8:27       ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox