From patchwork Tue Nov 10 19:53:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 542591 X-Patchwork-Delegate: trini@ti.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 1E3FC141430 for ; Wed, 11 Nov 2015 06:57:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 264104B863; Tue, 10 Nov 2015 20:55:39 +0100 (CET) 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 TqzbUrVWY7Ve; Tue, 10 Nov 2015 20:55:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F0FA64B896; Tue, 10 Nov 2015 20:54:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 82BCA4B862 for ; Tue, 10 Nov 2015 20:54:07 +0100 (CET) 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 8fZ5yZ9hCOuZ for ; Tue, 10 Nov 2015 20:54:07 +0100 (CET) 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-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 77B7A4B865 for ; Tue, 10 Nov 2015 20:54:01 +0100 (CET) Received: from mail.nefkom.net (unknown [192.168.8.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3nwKdH2n0zz3hj83; Tue, 10 Nov 2015 20:53:55 +0100 (CET) X-Auth-Info: aRYjy45VYw3DrFJD6KHhrCzkimiMR5WViAEYeqIzn/w= Received: from chi.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3nwKdH0mH2zvdWS; Tue, 10 Nov 2015 20:53:55 +0100 (CET) From: Marek Vasut To: u-boot@lists.denx.de Date: Tue, 10 Nov 2015 20:53:32 +0100 Message-Id: <1447185213-5799-16-git-send-email-marex@denx.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447185213-5799-1-git-send-email-marex@denx.de> References: <1447185213-5799-1-git-send-email-marex@denx.de> Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH 16/17] eeprom: Add support for selecting i2c bus X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add additional parameter into the eeprom command to select the I2C bus on which the eeprom resides. Signed-off-by: Marek Vasut Cc: Simon Glass Cc: Tom Rini Cc: Heiko Schocher Reviewed-by: Heiko Schocher --- common/cmd_eeprom.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 9247036..13c946e 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -207,14 +207,21 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char * const *args = &argv[2]; int rcode; ulong dev_addr, addr, off, cnt; + int bus_addr; switch (argc) { #ifdef CONFIG_SYS_DEF_EEPROM_ADDR case 5: + bus_addr = -1; dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR; break; #endif case 6: + bus_addr = -1; + dev_addr = simple_strtoul(*args++, NULL, 16); + break; + case 7: + bus_addr = simple_strtoul(*args++, NULL, 16); dev_addr = simple_strtoul(*args++, NULL, 16); break; default: @@ -225,7 +232,7 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) off = simple_strtoul(*args++, NULL, 16); cnt = simple_strtoul(*args++, NULL, 16); - eeprom_init(-1); + eeprom_init(bus_addr); if (strcmp (argv[1], "read") == 0) { printf(fmt, dev_addr, argv[1], addr, off, cnt); @@ -247,9 +254,9 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } U_BOOT_CMD( - eeprom, 6, 1, do_eeprom, + eeprom, 7, 1, do_eeprom, "EEPROM sub-system", - "read devaddr addr off cnt\n" - "eeprom write devaddr addr off cnt\n" + "read addr off cnt\n" + "eeprom write addr off cnt\n" " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'" )