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);