From patchwork Tue Apr 2 00:04:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 232849 X-Patchwork-Delegate: promsoft@gmail.com 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 54BC82C010F for ; Tue, 2 Apr 2013 11:36:58 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E7F5D4A129; Tue, 2 Apr 2013 02:36:55 +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 yA941oV9Go2k; Tue, 2 Apr 2013 02:36:55 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 25C0C4A10F; Tue, 2 Apr 2013 02:36:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 31D2B4A048 for ; Tue, 2 Apr 2013 02:36:52 +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 WTeuG33jsPpx for ; Tue, 2 Apr 2013 02:36:51 +0200 (CEST) X-Greylist: delayed 1837 seconds by postgrey-1.27 at theia; Tue, 02 Apr 2013 02:36:49 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 mail-we0-f201.google.com (mail-we0-f201.google.com [74.125.82.201]) by theia.denx.de (Postfix) with ESMTPS id 7FCD64A03B for ; Tue, 2 Apr 2013 02:36:49 +0200 (CEST) Received: by mail-we0-f201.google.com with SMTP id d46so202942wer.2 for ; Mon, 01 Apr 2013 17:36:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=OFYPCUeFtLsmg/0AA4/XTQmyC9Mv2Gk8N7Vl+49nQ2w=; b=gLb8lY6f3WnyJCe3+gF5git+Txdh39Vss0Y2gwkEeYa6ODM/LHf8sKPAlsGDkOKads oXtqfNWTq9UR5mSsLlTVAh0wy3+3h+ZCF20+RWLrPw7hwtzL9fv750i5D3a7UOxLRLib 9vKxZRIbK7UBgSTb9QLTNPRcPBQtiQV/N1kv23skBeqLXSSJAwNG5IF4m1PDzH3NIozS KmuiC7Ib9DLQ5n9Ssi6WNnEacatld/fVMsOd3PhujUBlXjHNEqdwIF62+EgaJw5yiQOr Ft2PBjfgvPdi0HADrshUEFl7ZCcHpolZsa1yDz0+ybNjsWwAjZDcXkgiQou5xrKlrgsg aawg== X-Received: by 10.15.33.2 with SMTP id b2mr17662875eev.7.1364861172356; Mon, 01 Apr 2013 17:06:12 -0700 (PDT) Received: from corp2gmr1-2.eem.corp.google.com (corp2gmr1-2.eem.corp.google.com [172.25.138.117]) by gmr-mx.google.com with ESMTPS id 6si4072831eej.0.2013.04.01.17.06.12 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 01 Apr 2013 17:06:12 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-2.eem.corp.google.com (Postfix) with ESMTP id 186ED1E41D7; Mon, 1 Apr 2013 17:06:12 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 6416D160874; Mon, 1 Apr 2013 17:06:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 1 Apr 2013 17:04:14 -0700 Message-Id: <1364861055-21670-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1364861055-21670-1-git-send-email-sjg@chromium.org> References: <1364861055-21670-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkW6TKSahKYPOY6TWMoUOXVTK8eYo69ZDmexp13csUA+LwhY3Byrx7sBBDR5/VtE2RHD8wx5M1uoR2nn2VhW6ZdWJvA9wfXapQNDeXoRoqe+l3A1u/FRcywAQESTs4rkhGNi3HgOEIHpKfy0ohSMixhxxhPWO5ddrApSph1wMd4FKeX3olGxBtZSGpC0fG3OL9WDpt/ Cc: u-boot-review@google.com, Aaron Durbin , Rajeshwari Shinde , Tom Rini Subject: [U-Boot] [PATCH 3/4] power: Explicitly select pmic device's bus X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Aaron Durbin The current pmic i2c code assumes the current i2c bus is the same as the pmic device's bus. There is nothing ensuring that to be true. Therefore, select the proper bus before performing a transaction. Signed-off-by: Aaron Durbin Signed-off-by: Simon Glass Reviewed-by: Simon Glass --- drivers/power/power_i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/power_i2c.c b/drivers/power/power_i2c.c index 3e5a784..ec9701e 100644 --- a/drivers/power/power_i2c.c +++ b/drivers/power/power_i2c.c @@ -39,6 +39,8 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val) if (check_reg(p, reg)) return -1; + I2C_SET_BUS(p->bus); + switch (pmic_i2c_tx_num) { case 3: if (p->sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) { @@ -82,6 +84,8 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val) if (check_reg(p, reg)) return -1; + I2C_SET_BUS(p->bus); + if (i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num)) return -1;