From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helmut Raiger Date: Wed, 19 Oct 2011 15:23:27 +0200 Subject: [U-Boot] [PATCH 13/13] misc: pmic: drop old Freescale's pmic driver In-Reply-To: <1318091769-30979-14-git-send-email-sbabic@denx.de> References: <1318091769-30979-1-git-send-email-sbabic@denx.de> <1318091769-30979-14-git-send-email-sbabic@denx.de> Message-ID: <4E9ECF4F.5050802@hale.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/08/2011 06:36 PM, Stefano Babic wrote: > Signed-off-by: Stefano Babic > --- > drivers/misc/Makefile | 1 - > drivers/misc/fsl_pmic.c | 235 ----------------------------------------------- > 2 files changed, 0 insertions(+), 236 deletions(-) > delete mode 100644 drivers/misc/fsl_pmic.c > I just checked PMIC action on our board (i.mx31 and mc13783) and the new code is not working here, it even: TT01> pmic write 20 17 raise: Signal # 8 caught = 32 is invalid. Should be less than 0 TT01> pmic read 20 = 32 is invalid. Should be less than 0 PMIC: Register read failed 0x20: 0x00000000 At first glance I found in pmic_fsl.c: static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write) { if ((val == NULL) && (write)) return *val & ~(1 << 31); else return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF); } which must be wrong. NULL is de-referenced in both cases and this error is even forced by pmic_spi.c: if (write) { pmic_tx = p->hw.spi.prepare_tx(0, NULL, write); pmic_tx &= ~(1 << 31); Probably val == NULL was meant as escape not to touch the pmic_tx value, in the original driver it's done that way. One could fix this by using a static variable in pmic_spi_prepare_tx(), but I'm not sure if this was the intention. I wonder why it was missed during testing as it seems configuration independent. Helmut -- Scanned by MailScanner.