From patchwork Thu Jul 5 19:53:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 169246 X-Patchwork-Delegate: hs@denx.de 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 240A52C0080 for ; Fri, 6 Jul 2012 05:55:11 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C998528170; Thu, 5 Jul 2012 21:54:53 +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 JLBB5YSoiJf1; Thu, 5 Jul 2012 21:54:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF91428115; Thu, 5 Jul 2012 21:54:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 88D7E280F9 for ; Thu, 5 Jul 2012 21:54:12 +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 MIPcHj+JwwTr for ; Thu, 5 Jul 2012 21:54:12 +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 mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by theia.denx.de (Postfix) with ESMTPS id 6CAAC28101 for ; Thu, 5 Jul 2012 21:54:04 +0200 (CEST) Received: by yenq13 with SMTP id q13so7651087yen.3 for ; Thu, 05 Jul 2012 12:54:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=hYwp50OzDKPEIJ1dx+3uEe5lnZMPfNnEGJT1io1dEiY=; b=kTdYujB2dLWtpy+C6SO+TvQr2R8vi75IpsDuNthpqYmA2xlBDTiNQhbeuHFAPBd6xH Qrugkq6LiqOH87dxFuBa+rGXtLvVyORlz0LqqqPGeWHs6ODpnq4o5v+QQoSGLo+1teMW en006Nc3YsO/ByzMhuoRmHNcBt0nvr18dqpfhs2nHxSp2E0mi+4uQ+9N+/MvOdkmfa2H nM4ZpRBP1tEl+1tfSohCergquXh0jBnZd838ewWVVaWsoTjKz8Hz3s8HOgxWW1k5vp4M 7g2req5LT9g4cQ0ZcP22PovqRH1EWcP4UAP5tNnwc8+q9Zc/oZQJttvbcqPVQw8aMhK4 WCrw== Received: by 10.66.72.225 with SMTP id g1mr39945142pav.3.1341518043261; Thu, 05 Jul 2012 12:54:03 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id ot4sm20304887pbb.65.2012.07.05.12.54.00 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 12:54:02 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1Sms7p-0006pb-Q0; Thu, 05 Jul 2012 12:54:05 -0700 From: Troy Kisky To: u-boot@lists.denx.de, Heiko Schocher , sbabic@denx.de Date: Thu, 5 Jul 2012 12:53:45 -0700 Message-Id: <1341518043-26191-7-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341518043-26191-1-git-send-email-troy.kisky@boundarydevices.com> References: <1341518043-26191-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQlibLswWRqE8K9hV0d3fEWzbDpOkHiMVrrstZaxanCbJOeMDT8EPk7Awtd7Di4REsJNDFUW Cc: r49496@freescale.com Subject: [U-Boot] [PATCH V2 07/25] mxc_i2c.c: code i2c_probe as a 0 length i2c_write 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 Signed-off-by: Troy Kisky Acked-by: Marek Vasut Acked-by: Stefano Babic --- v2: add acks change comment --- --- drivers/i2c/mxc_i2c.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 55a688a..626e13e 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -302,23 +302,6 @@ exit: } /* - * Try if a chip add given address responds (probe the chip) - */ -int i2c_probe(uchar chip) -{ - struct mxc_i2c_regs *i2c_regs = (struct mxc_i2c_regs *)I2C_BASE; - int ret; - - ret = i2c_imx_start(); - if (ret) - return ret; - - ret = tx_byte(i2c_regs, chip << 1); - i2c_imx_stop(); - return ret; -} - -/* * Read data from I2C device */ int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len) @@ -406,3 +389,11 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) return ret; } + +/* + * Test if a chip at a given address responds (probe the chip) + */ +int i2c_probe(uchar chip) +{ + return i2c_write(chip, 0, 0, NULL, 0); +}