From patchwork Tue Mar 1 08:16:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1599133 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=G94yltgL; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7DRj0nmkz9sGH for ; Tue, 1 Mar 2022 21:45:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3AE8983D28; Tue, 1 Mar 2022 09:17:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="G94yltgL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D91883D0B; Tue, 1 Mar 2022 09:17:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 05E2083D1C for ; Tue, 1 Mar 2022 09:16:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x532.google.com with SMTP id h15so20909089edv.7 for ; Tue, 01 Mar 2022 00:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ZEkimNAVe8nsnSBOrTpPHy1UpnK1OCqrshKbSmAkoM=; b=G94yltgLFNr1BSb/D7FXixaBdL4GqE+J/tZPbrI8tTvh455hhGV1BxcgkDfDmRDiXw FJMJIBkNJM7eU06lDVQAxmez32Ap58Wua9NF6pbPfhw4jZhPyagO257TBL7BKY1vJsAp Sj0APVDb6fdWNvGr6RXKEmAP5D9dvHttj3bbpHhgIaqtCAJpj4uYJ6nKwSIi1LoPcPmh koGIC+ACDFjsEKEOChjyt9ni4BBZIfLBhRr0xsqMLjLUXcAXndDFxNdGLsNNNqRgMeWE fujsk9pX09gmlzIY2pJlCbxXevFHrDKQJdVMQzA4hfa5Gm1l94jRUXQkd5FmrH9irNf9 RvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8ZEkimNAVe8nsnSBOrTpPHy1UpnK1OCqrshKbSmAkoM=; b=7g1zWyLx/TKZdBjT6N0gR/QPSirtkk/vl5ghR/0cGHQR3PlERNleGvHTTE1L9iTopo wtzZ+lhHMyF1AO6e0fMcNsjJilPRKq7q3rd6njX2uhnyT0NteoIela4ZFKxTjZTermmu FqJseOoP/YmfSTVF6f7Hnou9OPMYG8lv55hBZHY2TLUiryDq4sCNLQ003GdZvlnwg25Z rT1amry3niHHoRgfst+esnHbWdYCGFNgcsGgu+2q/ithjxcY/dy5CfykwL7Z3H5oDszQ 5GLYNyPdsxn8bsC5i0Fu70N/IOeh5ioerqfbrJ5QJQnfY9g1IQUI3r0Ip2V7mVp4ewEX kaXQ== X-Gm-Message-State: AOAM532xSYuGOXuJHwirCoFH8K33YEdHwMUtQgdYUwjW1E7fuAHwOvPN fGzUxCv//ttfJRdiXIAux5yKennQTArRnA== X-Google-Smtp-Source: ABdhPJxDCi/8mrkkG+9NyX4WEhH0vI2ZvKPpLXcHyN16V6Gr00zmJvRHcKLsRVqa42TWR4prQbB7bg== X-Received: by 2002:aa7:db47:0:b0:413:7649:c2bb with SMTP id n7-20020aa7db47000000b004137649c2bbmr18597010edt.123.1646122615833; Tue, 01 Mar 2022 00:16:55 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id j7-20020a1709062a0700b006bc28a6b8f1sm5060106eje.222.2022.03.01.00.16.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Mar 2022 00:16:55 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Sai Pavan Boddu , Ashok Reddy Soma , Heiko Schocher , Michal Simek Subject: [PATCH 1/3] i2c: i2c-cdns: Start read transaction after write to transfer_size reg Date: Tue, 1 Mar 2022 09:16:50 +0100 Message-Id: <487c8026791bfd60719403a2df2c54bb0ae99232.1646122610.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Sai Pavan Boddu Avoid a race condition where read transaction is started keeping expected bytes as 0. Which sometimes would result in sending STOP signal as no data is expected. Observed on QEMU platform. Signed-off-by: Sai Pavan Boddu Reviewed-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- drivers/i2c/i2c-cdns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index a650dd69b89f..5736afb45191 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -375,7 +375,6 @@ static int cdns_i2c_read_data(struct i2c_cdns_bus *i2c_bus, u32 addr, u8 *data, curr_recv_count = recv_count; } } else if (recv_count && !hold_quirk && !curr_recv_count) { - writel(addr, ®s->address); if (recv_count > CDNS_I2C_TRANSFER_SIZE) { writel(CDNS_I2C_TRANSFER_SIZE, ®s->transfer_size); @@ -384,6 +383,7 @@ static int cdns_i2c_read_data(struct i2c_cdns_bus *i2c_bus, u32 addr, u8 *data, writel(recv_count, ®s->transfer_size); curr_recv_count = recv_count; } + writel(addr, ®s->address); } } From patchwork Tue Mar 1 08:16:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1599130 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=PjU3llBV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7DRf4jltz9sGH for ; Tue, 1 Mar 2022 21:45:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 65A2E83D17; Tue, 1 Mar 2022 09:17:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="PjU3llBV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA7C583D23; Tue, 1 Mar 2022 09:17:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E13B183D28 for ; Tue, 1 Mar 2022 09:16:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x631.google.com with SMTP id p14so29774307ejf.11 for ; Tue, 01 Mar 2022 00:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qPCmJszNPJRJsVlYgtwafGq/cztHfSNqxX9ffbnOOPs=; b=PjU3llBV+bA+4bMGx7J5pQkrwK/hmOnbffN8BU5pprxHMyuQDcsfUDQoh7XUmPZUJ+ 42fMnxAU1VcIoAERXk911w/Zcm9R4bu5TaB3fVSqc/wwe/1rEDTX6z7zycth1kCxjf3w PP7nK8UGk5LCk6EQX2/1Y+8Ls8TRZ0iUgCwP+mQJl467HNG+3eZ6CV/aFMWboFW7MKWX fvcsPjss9xmB84GtyiwV/gDDobOMtzc8DlUeoF4BnXMTTzvAJwO7HDclzQkVvVk71hFQ ewOPHhZtbF47AxX/WkeRGeQOq5yegFVy2J3IXwwKVml8ueg9mzY0O0wknVPuoT1W6Ldu 2hQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qPCmJszNPJRJsVlYgtwafGq/cztHfSNqxX9ffbnOOPs=; b=TIrUlfFHgCLjlYSzzsaHW7IdEQTia2FAknq2oRkX8u5adABbwPbkFCJ7Gp7spcB/UX hgoPfp73XEEbcuhy3+cQugQ604UmQvZVpBJo5mmEEZFyIvhlCUNMde6rAsLOJYrwBxJR li3JUXK1yp3uFTpg5gCTPW1mxysF1vbeWYGIPFZjC4LbxZ5Cm4nIYdTiQOtWOZ/5vBCm +NsCy19FEXxy0Y9yUOe9A7XhfLNppuJwaD+iCdUF7rprthHhJR8kS9IEO2psxhRs77xm DhXtrvjMKZKLiGsrbdZYn8pjCHSIPxFM1YNop4sw05Or83TQyGU/EtwGx4Sgq8NgRXNA pgsw== X-Gm-Message-State: AOAM530/25E5wYBLo+M8/+iWS6E4S6O49O+A7bWRnqs/KgG0l8wMJehr wlHog64yFIiX/2SlqI4DZZur07TICfVB1w== X-Google-Smtp-Source: ABdhPJyBYXjyPrT2KNnZiRZ5N15ju56aRB2CrOkrpqnqpLjn7/jYiaf3N3LN89byWdlgW4TP7/0Kdw== X-Received: by 2002:a17:907:2087:b0:6cf:e170:171 with SMTP id pv7-20020a170907208700b006cfe1700171mr18401435ejb.163.1646122617289; Tue, 01 Mar 2022 00:16:57 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id bm5-20020a170906c04500b006ce6f8892a5sm5107828ejb.7.2022.03.01.00.16.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Mar 2022 00:16:56 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Sai Pavan Boddu , Ashok Reddy Soma , Heiko Schocher Subject: [PATCH 2/3] i2c: i2c-cdns: Fix write transaction state Date: Tue, 1 Mar 2022 09:16:51 +0100 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Sai Pavan Boddu Start write transfer after loading data to FIFO. Signed-off-by: Sai Pavan Boddu Reviewed-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- drivers/i2c/i2c-cdns.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index 5736afb45191..07d53be11f12 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -251,6 +251,7 @@ static int cdns_i2c_write_data(struct i2c_cdns_bus *i2c_bus, u32 addr, u8 *data, u8 *cur_data = data; struct cdns_i2c_regs *regs = i2c_bus->regs; u32 ret; + bool start = 1; /* Set the controller in Master transmit mode and clear FIFO */ setbits_le32(®s->control, CDNS_I2C_CONTROL_CLR_FIFO); @@ -269,6 +270,11 @@ static int cdns_i2c_write_data(struct i2c_cdns_bus *i2c_bus, u32 addr, u8 *data, while (len-- && !is_arbitration_lost(regs)) { writel(*(cur_data++), ®s->data); + /* Trigger write only after loading data */ + if (start) { + writel(addr, ®s->address); + start = 0; + } if (len && readl(®s->transfer_size) == CDNS_I2C_FIFO_DEPTH) { ret = cdns_i2c_wait(regs, CDNS_I2C_INTERRUPT_COMP | CDNS_I2C_INTERRUPT_ARBLOST); From patchwork Tue Mar 1 08:16:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1599131 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=pPccrxML; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7DRg1gvXz9sGl for ; Tue, 1 Mar 2022 21:45:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7399183D26; Tue, 1 Mar 2022 09:17:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="pPccrxML"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 861D283D23; Tue, 1 Mar 2022 09:17:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7B83283D10 for ; Tue, 1 Mar 2022 09:16:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x52b.google.com with SMTP id h15so20909261edv.7 for ; Tue, 01 Mar 2022 00:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UVDyKdsqanN4oxI8hX9LlI/ZPpNJCEmNwSMCIEtZd+s=; b=pPccrxMLuHCjZJkbaiTBB/ptpBOM7SXhTQdQrYKIEwRcvrkmWPrNqlxKlDho6XBhyl Y2yWP0KRA5khtF/doW15lHHu6lagPXGpAcaonzLbCmR/N27/3+AA064FIekvNnS/APNY +k1qVti7+WByKsLsCPmp6OjXXCH3T6sWIXOeDaDQ17AHv7vLCe8BN9x/vde0g6prApvJ uJuR7wb0/vJrPDmp2dFV/61ihpBH82928Iv2B6hivKhrzyQz6sKik6ea5SM99ckBWNEV pP5E1LXsZlJS2Bcd0l5zpG2FZQRgcFFPNtxuBRwxmEZPSBtDzUr3+rW1PXRwIuNpi0Fy v6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UVDyKdsqanN4oxI8hX9LlI/ZPpNJCEmNwSMCIEtZd+s=; b=B0fXiSb4ETOOwOFx0FolaOSTiDIAd0rouk1s8qq2L+pZFldXGpfF8RLxY6glB5Wy1P prwKXZRL+GaOZvPRMelH0AfUOQt5Fiq+HhTH5gpVB+lNn0UmfG9UHeLobau+Jgd1bhb1 GeV6hVqzbMh08HLQIGhSiIXGScCId/c7BUahhTab69MR9w+R+IwE9jN0kcUkutom2YaV Eube21NC5PmcT6vLdkPuplr8cdncXD1u2KIWiFIyFhd/bafpYTdpJw/vz0gC55T2oQkX WMvy94UIYmT1LjSp1qOYEPdlDrxshoYTd10bQRQWQHKvzVHPpn8wuHF8UOLQRKEgJq6e qDXA== X-Gm-Message-State: AOAM530dHrDf41qtmAWZnenFJBDEzLzvPpQirPeJyh8tuAMY1PdQfPIc 2huV7mDWeAWjSbKfve5rr+X9hOxLDSFf5g== X-Google-Smtp-Source: ABdhPJwD0sHS/okcWMaRRsu5/qf4whzQAFGvXsxILAvNRYhgxRS4STWNm6iCw/b0wdfhIn2PfgneAg== X-Received: by 2002:a50:8d1e:0:b0:413:492b:2c86 with SMTP id s30-20020a508d1e000000b00413492b2c86mr23202731eds.140.1646122618737; Tue, 01 Mar 2022 00:16:58 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id n24-20020a509358000000b00410bedd9eb4sm7099652eda.88.2022.03.01.00.16.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Mar 2022 00:16:58 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Sai Pavan Boddu , Ashok Reddy Soma , Heiko Schocher Subject: [PATCH 3/3] i2c: i2c-cdns: Prevent early termination of write Date: Tue, 1 Mar 2022 09:16:52 +0100 Message-Id: <2407b39d305999cb42438c5423aebc3b514acabb.1646122610.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Sai Pavan Boddu During sequential loading of data, hold the bus to prevent controller from sending stop signal in case no data is available in fifo. Signed-off-by: Sai Pavan Boddu Reviewed-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- drivers/i2c/i2c-cdns.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index 07d53be11f12..0da9f6f35a9f 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -257,16 +257,18 @@ static int cdns_i2c_write_data(struct i2c_cdns_bus *i2c_bus, u32 addr, u8 *data, setbits_le32(®s->control, CDNS_I2C_CONTROL_CLR_FIFO); clrbits_le32(®s->control, CDNS_I2C_CONTROL_RW); - /* Check message size against FIFO depth, and set hold bus bit - * if it is greater than FIFO depth + /* + * For sequential data load hold the bus. */ - if (len > CDNS_I2C_FIFO_DEPTH) + if (len > 1) setbits_le32(®s->control, CDNS_I2C_CONTROL_HOLD); /* Clear the interrupts in status register */ writel(CDNS_I2C_INTERRUPTS_MASK, ®s->interrupt_status); - writel(addr, ®s->address); + /* In case of Probe (i.e no data), start the transfer */ + if (!len) + writel(addr, ®s->address); while (len-- && !is_arbitration_lost(regs)) { writel(*(cur_data++), ®s->data);