From patchwork Thu Oct 20 06:28:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Raiger X-Patchwork-Id: 120727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 06F49B708F for ; Thu, 20 Oct 2011 17:29:36 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 58C9B28E40; Thu, 20 Oct 2011 08:29:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OyKYW-q8GWaL; Thu, 20 Oct 2011 08:29:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6714028B4A; Thu, 20 Oct 2011 08:29:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F52028B4A for ; Thu, 20 Oct 2011 08:29:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OptLb2nkTwPq for ; Thu, 20 Oct 2011 08:29:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx.inode.at (mx12.lb01.inode.at [62.99.145.14]) by theia.denx.de (Postfix) with ESMTPS id 5346628B26 for ; Thu, 20 Oct 2011 08:29:20 +0200 (CEST) Received: from [83.64.51.210] (port=9337 helo=gateway1.hale) by smartmx-12.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1RGm7z-00041h-R5; Thu, 20 Oct 2011 08:29:19 +0200 Received: from mail1.hale.at (mail2.hale [192.168.100.12]) by gateway1.hale (8.13.8/8.13.7) with ESMTP id p9K6TFSL024258; Thu, 20 Oct 2011 08:29:17 +0200 Received: from uni24.HALE ([192.168.100.40]) by hale.at with MailEnable ESMTP; Thu, 20 Oct 2011 08:29:08 +0200 From: Helmut Raiger To: u-boot@lists.denx.de Date: Thu, 20 Oct 2011 08:28:43 +0200 Message-Id: <1319092123-7836-1-git-send-email-helmut.raiger@hale.at> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1319042932-25508-1-git-send-email-helmut.raiger@hale.at> References: <1319042932-25508-1-git-send-email-helmut.raiger@hale.at> MIME-Version: 1.0 X-HALE-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: p9K6TFSL024258 X-HALE-MailScanner: Found to be clean X-HALE-MailScanner-From: helmut.raiger@hale.at MailScanner-NULL-Check: 1319696959.35255@MKsKQCxox3OdU5cDTE/GwA Subject: [U-Boot] [PATCH V2] misc: pmic: fix regression in pmic_fsl.c (SPI) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This fixes write access to PMIC registers, the bug was introduced partly in commit 64aac65099 and in commit c9fe76dd91. It was tested on an i.mx31 with a mc13783. Signed-off-by: Helmut Raiger --- V2: threw in the wrong readback line in V1 drivers/misc/pmic_fsl.c | 5 +---- drivers/misc/pmic_spi.c | 1 - 2 files changed, 1 insertions(+), 5 deletions(-) diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c index b6e809a..0ff75ed 100644 --- a/drivers/misc/pmic_fsl.c +++ b/drivers/misc/pmic_fsl.c @@ -29,10 +29,7 @@ #if defined(CONFIG_PMIC_SPI) 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); + return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF); } #endif diff --git a/drivers/misc/pmic_spi.c b/drivers/misc/pmic_spi.c index ff35377..e772884 100644 --- a/drivers/misc/pmic_spi.c +++ b/drivers/misc/pmic_spi.c @@ -76,7 +76,6 @@ static u32 pmic_reg(struct pmic *p, u32 reg, u32 *val, u32 write) } if (write) { - pmic_tx = p->hw.spi.prepare_tx(0, NULL, write); pmic_tx &= ~(1 << 31); tmp = cpu_to_be32(pmic_tx); if (spi_xfer(slave, pmic_spi_bitlen, &tmp, &pmic_rx,