From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ip2.televic.com ([81.82.194.222]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PpgN6-0007D9-A7 for barebox@lists.infradead.org; Wed, 16 Feb 2011 12:20:41 +0000 From: Vanalme Filip Date: Wed, 16 Feb 2011 13:20:36 +0100 Message-ID: <6EE7D1502C48E44E92DCADF9DD3E0DB9017FF3B00817@SRV-VS06.TELEVIC.COM> Content-Language: en-US MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: PMIC device driver To: "barebox@lists.infradead.org" > -----Original Message----- > From: Vanalme Filip > Sent: woensdag 16 februari 2011 9:38 > To: 'barebox@lists.infradead.org' > Subject: PMIC device driver > > Up till now, I could not start up the network on my i.mx27PDK board. After > measuring on the device, I could see that power was missing for the PHY. Good > reason, of course, for not starting up... > To enable the missing power, I have to adjust some registers in the PMIC device > (mc13783). > If I look into the mc13783.c file, I could see that this has similarities with Linux > device drivers. So, to access the PMIC, I guess I have to do an open("/dev/pmic") > and then a read or write. However, when I look to the pmic_read() and pmic_write() > function, they have, besides the device pointer, buffer pointer and buffer size, an > offset parameter that indicate the register within the PMIC to read/write. On the > other hand, the standard read and write functions only take 3 parameters (device, > buffer, buffersize). How do I pass that offset to these functions ? How do I use the > PMIC device driver ? > (Maybe this is a general Linux device driver question, but I'm not that familiar with > device drivers, so...) > > Is it the best way to do it like this (open, read, write), or do I better call those > functions directly ? (I have to set the PMIC registers in the "late_init" function of > the barebox startup sequence) > > Filip Vanalme > [Filip] Think I found how it works. I have to use the normal read, write and lseek functions to read/write PMIC registers. The 'offset' and 'flag' parameters in read and write functions are for internal use only. Correct. When reading, an internal index is incremented. A following read starts where the previous ended. With lseek, one can move that index to address the correct register. Right ? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox