From patchwork Fri Jun 22 04:12:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 166481 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 B76BAB6EF1 for ; Fri, 22 Jun 2012 14:14:07 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49EF528088; Fri, 22 Jun 2012 06:13:37 +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 GcFdfzbtieXX; Fri, 22 Jun 2012 06:13:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AAFD1280C9; Fri, 22 Jun 2012 06:12:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C9322808F for ; Fri, 22 Jun 2012 06:12:33 +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 snWMBDKkzk4F for ; Fri, 22 Jun 2012 06:12:33 +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-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 130A028095 for ; Fri, 22 Jun 2012 06:12:28 +0200 (CEST) Received: by dacx6 with SMTP id x6so1729075dac.3 for ; Thu, 21 Jun 2012 21:12:26 -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=mEy2o4TdQuuAlHDoeOY3Vrzsc3nGZ+qF3qXr1l7mDcg=; b=F8K6OKM5kcroFmtQ9SMWDJqzYitHSQeZos3kXqCVy271nWKTwhFWBnfx6AzeNmuyJQ S7MR24HuhfiH8sBOCaMwkzlp0XydvczfmVlrXbZZ1/cuPD3dIFdRO8LTS6QXlF15YjaF juDvA0wrqfApGNs5bz5OVKiFUS88/vfcxZg2TOXpwXhoc1LyvkX4gXg6YW+U7zPDT5dZ a0ffx7+xjgdpowzRKqNM8/wSlpKyBkxhCiK92eL1QV8H9/7gWwufy3PCczojhLL62aE9 ga3SJt0Kqf8zkWgiSUlI98G4oPTl/xj0ZGwBAGUhZ4pix1X+vYKNj6OUNmoCA/m570sx RjVQ== Received: by 10.68.237.106 with SMTP id vb10mr5089544pbc.148.1340338346539; Thu, 21 Jun 2012 21:12:26 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id ny10sm37678506pbb.38.2012.06.21.21.12.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jun 2012 21:12:24 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1ShvEL-00032b-Ei; Thu, 21 Jun 2012 21:12:21 -0700 From: Troy Kisky To: hs@denx.de, sbabic@denx.de Date: Thu, 21 Jun 2012 21:12:01 -0700 Message-Id: <1340338339-11626-6-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340338339-11626-1-git-send-email-troy.kisky@boundarydevices.com> References: <1340338339-11626-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQl0nLe1haSUk0mOWHKonIVFlGFSx4tpG3zAwUTLR0AEzKUIcCx1hdL0rdfB2p4fmZjddabf Cc: u-boot@lists.denx.de, r49496@freescale.com, jason.hui@linaro.org Subject: [U-Boot] [PATCH 06/24] 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 --- drivers/i2c/mxc_i2c.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 626960d..4f12b9e 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -302,27 +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); - if (ret) - return ret; - - i2c_imx_stop(); - - return ret; -} - -/* * Read data from I2C device */ int i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len) @@ -404,3 +383,11 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len) return ret; } + +/* + * Try if a chip add given address responds (probe the chip) + */ +int i2c_probe(uchar chip) +{ + return i2c_write(chip, 0, 0, NULL, 0); +}