Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2945014ybb; Sun, 22 Mar 2020 11:25:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vswTGEGlZ/kLq9GbOsAoesR7z12ywV3o78/je5hmje2AH0sokKk5PWLS80yJpjjvREPKVDs X-Received: by 2002:a54:4387:: with SMTP id u7mr14793967oiv.139.1584901532120; Sun, 22 Mar 2020 11:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584901532; cv=none; d=google.com; s=arc-20160816; b=fxBHwQC818jP7COr9RDPtmZmN9Woa6qZunDqM6qvxVoAyBmvlF8KpEk7Tn36oeHzhn EJj90YiAARtswoBL553msEenFX+bqtWOacGyCgb64I1DwP1QcA4YTKcEW+lcC3EZr3TP GyTAZ/cvIRm5yw6wA70EfJACllm7xvGaIGphTj5WRlItwIG9CmCVWBFHH5dXsX/KwTY2 mF1UatH8/B0bYZ/y+EtOymtFsRi9Ueg7EC9AVG5RLU7Vhc+ZsOijeBsJrrEcMpLX4/NY m71689YjqjVMYkGEOSw+C0VtN7B8elyFHG9HCWZqjLY7Vjhw5lh7JSNiILgjcyACEbrE oJig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=mJxJlTV4kRRQdamwDKjoIvHLdlpESFc+S0X+geSNFqE=; b=PjuqMvZhaXC5ryNFyabt7vpmCBIcmVxdWTkIvau0fDiqttNGmTu8JTv4ofFu4wqEPu OB5S4mWzseScB/I001k2MTmOppREUeTb6B9ImmfGnDYlWYcTisZXLuq56yThYuMylRVc gzYzc4LhrhhsZQ1P1NqTbC92oweyZLbePQMZan1PRGtsdy/IkGis9rNDiAsw+/IJK+88 kg4Umy+67BrUqG324X0dlrjnp9ZiPPNd8HPMdCeX0v5LCMj+dKhvRZjSn/bBJGrGg3jL HuWgagDjsfiROSEJVGSLYkX4XX/uADcAPgZxX2uKjvL0Kz290TzoOeeHOL68V7SIQCny x25w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BJaiKVHO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e193si6631224oib.276.2020.03.22.11.25.20; Sun, 22 Mar 2020 11:25:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BJaiKVHO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726583AbgCVSXh (ORCPT + 99 others); Sun, 22 Mar 2020 14:23:37 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41959 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgCVSXg (ORCPT ); Sun, 22 Mar 2020 14:23:36 -0400 Received: by mail-wr1-f65.google.com with SMTP id h9so13996851wrc.8 for ; Sun, 22 Mar 2020 11:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=mJxJlTV4kRRQdamwDKjoIvHLdlpESFc+S0X+geSNFqE=; b=BJaiKVHOu3AzckjfTNAW7nWLG7qzRP4YevQaBhi1qM6EFEruYms/H447/JaITaOGmy 1NjCsotimSOEddJqoP6QIXKRGQS/GVnQkV/q5uejX4Q1Eg5S7Xe2QCGoMp48pR5WNb06 un+BC6TI3OSW80qWsCZGdBwj6SRhdLm9D702g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mJxJlTV4kRRQdamwDKjoIvHLdlpESFc+S0X+geSNFqE=; b=UExRc33peoyMiPvj68ZcwG0D/ITrI0XUltMRQe72tfDGhD+A/tYGOIA+XVXJwu2Dud /RsxuRA82qBZkmAP6238ijDSY6DQQB3dKHkk8kVZH2uI5zMZ2KYSeHEOEA3TqzzvKcCP YxS2l5GQ0V7tBLDu7Jcxd9ab7rHim4u29ix1egPNWizHbHyAg+bwndPwWm+1LHdRqAo/ cvVbv7U9wAe+AoVCK+n2tTxLae/Ilf7LHKt9d1HsY8Rm8MD6Q/fxDxO84uvKacjoni5n 5a6kcfOidbXyrR4PLrJZ8eo9jEGW/xUlqKCspBPMdLILEXCLuPQpqEKgyKAASz0ocAAC /BmQ== X-Gm-Message-State: ANhLgQ1/iZMmz5z7rU4MZLvgVZHf7hdQKsMC0VjKWkydK/b3/ooOFmZs LDnQHlUQGyW7WDITTLg4M18C4A== X-Received: by 2002:adf:b1c1:: with SMTP id r1mr23574240wra.337.1584901414969; Sun, 22 Mar 2020 11:23:34 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id z6sm18498640wrp.95.2020.03.22.11.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2020 11:23:34 -0700 (PDT) From: Rayagonda Kokatanur To: Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Wolfram Sang , Lori Hikichi , Shreesha Rajashekar , Nishka Dasgupta , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Rayagonda Kokatanur Subject: [PATCH v1 1/1] i2c: iproc: add support for SMBUS quick cmd Date: Sun, 22 Mar 2020 23:53:22 +0530 Message-Id: <20200322182322.32743-1-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for SMBUS quick command. SMBUS quick command passes single bit of information to the slave (target) device. Can be used to turn slave device on or off. By default i2c_detect tool uses the smbus quick cmd to try and detect devices. Without this support it will not detect some slaves. Signed-off-by: Rayagonda Kokatanur --- drivers/i2c/busses/i2c-bcm-iproc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 30efb7913b2e..6a461e06e6dd 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -79,6 +79,7 @@ #define M_CMD_STATUS_RX_FIFO_FULL 0x6 #define M_CMD_PROTOCOL_SHIFT 9 #define M_CMD_PROTOCOL_MASK 0xf +#define M_CMD_PROTOCOL_QUICK 0x0 #define M_CMD_PROTOCOL_BLK_WR 0x7 #define M_CMD_PROTOCOL_BLK_RD 0x8 #define M_CMD_PROTOCOL_PROCESS 0xa @@ -765,7 +766,11 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c, * number of bytes to read */ val = BIT(M_CMD_START_BUSY_SHIFT); - if (msg->flags & I2C_M_RD) { + + if (msg->len == 0) { + /* SMBUS QUICK Command (Read/Write) */ + val |= (M_CMD_PROTOCOL_QUICK << M_CMD_PROTOCOL_SHIFT); + } else if (msg->flags & I2C_M_RD) { u32 protocol; iproc_i2c->rx_bytes = 0; @@ -827,8 +832,7 @@ static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) { u32 val; - /* We do not support the SMBUS Quick command */ - val = I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); + val = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; if (adap->algo->reg_slave) val |= I2C_FUNC_SLAVE; -- 2.17.1