From patchwork Tue Oct 31 16:19:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Riegel X-Patchwork-Id: 10034909 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24F76602B9 for ; Tue, 31 Oct 2017 16:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1570128BF7 for ; Tue, 31 Oct 2017 16:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A32C28BFD; Tue, 31 Oct 2017 16:19:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D6E028BC7 for ; Tue, 31 Oct 2017 16:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751516AbdJaQTM (ORCPT ); Tue, 31 Oct 2017 12:19:12 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:37456 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbdJaQTK (ORCPT ); Tue, 31 Oct 2017 12:19:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C6B249C1A40; Tue, 31 Oct 2017 12:19:09 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id oqaUeKab76-u; Tue, 31 Oct 2017 12:19:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 15CC69C2B42; Tue, 31 Oct 2017 12:19:09 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6WvS1OOHnZ-g; Tue, 31 Oct 2017 12:19:08 -0400 (EDT) Received: from workotop.localdomain (unknown [192.252.129.34]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id CF67A9C1A40; Tue, 31 Oct 2017 12:19:08 -0400 (EDT) Date: Tue, 31 Oct 2017 12:19:08 -0400 From: Damien Riegel To: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: Wolfram Sang , Sricharan R , Andy Gross , David Brown , Bjorn Andersson Subject: i2c: qup: missing stop bit and messages Message-ID: <20171031161908.acfwka6zk277glyv@workotop.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170714 (1.8.3) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, While testing a gas gauge, we encountered intermittent i2c issues with the APQ8016. Sometimes, the i2c controller seems to send incomplete messages, or doesn't send some messages. To read values from the gas gauge, this group of two messages is sent: - one write message of 1 byte, with the gas gauge register to be read - one read message of 2 bytes, for the reply from the device Once in a while, there is an odd sequence: - First, the very last tick of the clock of the read message is shorter, and the stop bit is missing. - The following group of messages is incomplete, only the write message is sent. So on the scope, we observe the following timeline: ... [ok] [ok] [ok] [missing stop bit] [only write message] Here are captures of what we see. These are three consecutive queries of the gas gauge: - successful query: https://postimg.org/gallery/215zrvd9o/ - missing stop bit: https://postimg.org/gallery/26xn101d8/ - incomplete group: https://postimg.org/image/2cvghepi0b/ (a start is indicated by a green marker, a stop by a red one) As we use i2c3, for which dts bindings are not yet upstreamed, below are the additions in our device tree. It's slightly incomplete, but note that blsp_i2c3 is enabled and blsp_spi3 disabled. Maybe there is an issue with that particular i2c core? Regards, Damien --- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi index 899f2b28a9c9..a303a4c8cad4 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi @@ -294,6 +294,30 @@ }; }; + i2c3_default: i2c3_default { + pinmux { + function = "blsp_i2c3"; + pins = "gpio10", "gpio11"; + }; + pinconf { + pins = "gpio10", "gpio11"; + drive-strength = <16>; + bias-disable = <0>; + }; + }; + + i2c3_sleep: i2c3_sleep { + pinmux { + function = "gpio"; + pins = "gpio10", "gpio11"; + }; + pinconf { + pins = "gpio10", "gpio11"; + drive-strength = <2>; + bias-disable = <0>; + }; + }; + i2c4_default: i2c4_default { pinmux { function = "blsp_i2c4"; diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index f6091aafc984..a08e2b4894fd 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -618,6 +618,21 @@ status = "disabled"; }; + blsp_i2c3: i2c@78b7000 { + compatible = "qcom,i2c-qup-v2.2.1"; + reg = <0x78b7000 0x1000>; + interrupts = ; + clocks = <&gcc GCC_BLSP1_AHB_CLK>, + <&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>; + clock-names = "iface", "core"; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&i2c3_default>; + pinctrl-1 = <&i2c3_sleep>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + blsp_i2c4: i2c@78b8000 { compatible = "qcom,i2c-qup-v2.2.1"; reg = <0x78b8000 0x1000>; diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc-centaur.dts b/arch/arm64/boot/dts/qcom/apq8016-sbc-centaur.dts index c96aebcb046c..10928bf31189 100644 --- a/arch/arm64/boot/dts/qcom/apq8016-sbc-centaur.dts +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc-centaur.dts @@ -29,6 +29,13 @@ /* use i2c3 instead of spi3, for gas gauge */ &blsp_i2c3 { status = "okay"; + + bq27510@55 { + compatible = "ti,bq27510g2"; + reg = <0x55>; + pinctrl-names = "default"; + pinctrl-0 = <&fuelgauge_default>; + }; }; &blsp_i2c4 { @@ -155,6 +162,18 @@ }; }; + fuelgauge_default: fuelgauge_default { + pinmux { + function = "gpio"; + pins = "gpio9"; + }; + pinconf { + pins = "gpio9"; + input-enable; + bias-pull-up; + }; + }; + /* overwrite this node to use gpio 13 instead of 110 */ keypad_default: keypad_default { pinmux {