Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp688846rdb; Sun, 3 Sep 2023 06:18:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDj5MOzihzhsgcUxPzrSDs62cw8aAPdW51XBHQjIIpmWFDrNqUieQ7HT/1DirTxIqNXwOC X-Received: by 2002:a05:6a20:2587:b0:133:7ad8:712b with SMTP id k7-20020a056a20258700b001337ad8712bmr7626995pzd.52.1693747135913; Sun, 03 Sep 2023 06:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693747135; cv=none; d=google.com; s=arc-20160816; b=0Mewg76WtAW9BvhKURVudt2B/o4KR2C3oGOBYVliLGI3sYkkicXF5Raqnd9vj12DpI 8rz7tAgyU/+85b3ADoyEGoDZMBga4MiGlw3+PG6tbnhZHkJ1Iq6v2dPIvXh7pZ2leH+/ 14iqPnNflhJL5r9IqwFspDZ86BEQDz4plXMl7qkPV8Hlhn6LrP1sZ7Yn5xFebuxcVuP5 s/+MK9UWj05BmswxNOzdLShAiQEhc84xHJo6MKOVPl/jKt1oMs1lTTzB3BIC3Q8J3kJX B3hn5Yh3166bfjC9t0+rdZf4zKELcU1KCvr88RERiCpJ2o/gIuasJduyHDKy2rSiECAk DsSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XFiE3nNs8vtkpuIQJXYbI+u/mvORot2UVXb6EROSohg=; fh=lil9YTQsR7gFNUFk6nyuM+YLP0wE4pnexb+JF19kuaY=; b=sHxaw88UqWYWg2Nm7T86TFnZ/ASiFRZ9qv4GNy7yCIBmMM6RXy5lailw/wOHBy1nt/ UXIB/uz2GYi3vK6g6FyTI5tiD/1h59o+VmXcBE+n1C6YvY22D76yhSBJqqKBoImZu4M3 uV1lISDm6NBABFfLPtkcXYCGs9mSpu69S7s4s9MINfX9wCBacW2oP4ju0KjCoMLRUzOA 46KP7lzgetA9oqryzohZUfB6SZ75psTRivcZjgDTK1B5XFKS0RpiXJx4CLJedwDinsKf ddHb6B1D3Z0HqSjwAOEy/rwL7N7kEwqb9UVpy+yZS+3c7OmuHNPQSj7vcT4ZtSEdwkM8 NQvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jkv+aUej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a63-20020a639042000000b00565bf7ce0a1si6121009pge.706.2023.09.03.06.18.41; Sun, 03 Sep 2023 06:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jkv+aUej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237137AbjICMe6 (ORCPT + 99 others); Sun, 3 Sep 2023 08:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbjICMe5 (ORCPT ); Sun, 3 Sep 2023 08:34:57 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88023126; Sun, 3 Sep 2023 05:34:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E13CACE0AAD; Sun, 3 Sep 2023 12:34:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AFFC433C8; Sun, 3 Sep 2023 12:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693744491; bh=UMR3ZO3Oyzaw2vPMohgPUvv7KmBJIsfQZe44eRmjYiM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jkv+aUejPpshdhukh1Q8Ar4VxhgnCN6FlK6b+LPmI0dK34acRB9u/VNUIvFFKHNii hivdJtFJRW8mF3/pmy0MzyRZxOIf7nMX0DLEcfEZNHgwBKOE0MunBziXDWbZec0fVh j5KfsGlYJjP9SHQfLvRwxUxlpWZE5mw+XZv0e884vuR6sklMfe/Rg/0RL9j8zlPd0N Ym99VkR8g0QegVp1PjU8TjzUhw5bN/KRGNST3vcfZHKKwvFTALU1Agfd7WBdLI3pxC YnKZ4TIEj72DWyboE/7uEHFc6hpRDfHHHYqu+5HfCEnwUzwilYs2O6/nvmu0NCF8ea XV3ao+pp6H8Lg== Date: Sun, 3 Sep 2023 14:34:46 +0200 From: Andi Shyti To: Aryan Srivastava Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c:octeon:Add block-mode r/w Message-ID: <20230903123446.vjgpplnogejbzneb@zenone.zhora.eu> References: <20230725223335.mzgdgr7qgeyc6hj7@intel.intel> <20230816230708.2724780-2-aryan.srivastava@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230816230708.2724780-2-aryan.srivastava@alliedtelesis.co.nz> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Aryan, [...] > I have re-ran the patch through checkpatch --strict and changed the > comments Thanks! [...] > +static void octeon_i2c_block_disable(struct octeon_i2c *i2c) > +{ > + if (!i2c->block_enabled || !TWSI_BLOCK_CTL(i2c)) > + return; > + > + i2c->block_enabled = false; > + octeon_i2c_writeq_flush(TWSI_MODE_STRETCH, i2c->twsi_base + TWSI_MODE(i2c)); > +} can you leave a blank line here? > /** > * octeon_i2c_hlc_wait - wait for an HLC operation to complete > * @i2c: The struct octeon_i2c > @@ -268,6 +286,7 @@ static int octeon_i2c_start(struct octeon_i2c *i2c) > u8 stat; > > octeon_i2c_hlc_disable(i2c); > + octeon_i2c_block_disable(i2c); > > octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB | TWSI_CTL_STA); > ret = octeon_i2c_wait(i2c); > @@ -594,6 +613,128 @@ static int octeon_i2c_hlc_comp_write(struct octeon_i2c *i2c, struct i2c_msg *msg > return ret; > } > > +/* high-level-controller composite block write+read, m[0]len<=2, m[1]len<=1024 */ can you please improve the comment? > +static int octeon_i2c_hlc_block_comp_read(struct octeon_i2c *i2c, struct i2c_msg *msgs) > +{ > + int i, j, len, ret = 0; > + u64 cmd, rd; > + > + octeon_i2c_hlc_enable(i2c); > + octeon_i2c_block_enable(i2c); > + > + len = msgs[1].len - 1; why -1? > + /* Prepare core command */ > + cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR; cmd needs to be initialized to '0'. > + /* SIZE */ > + octeon_i2c_writeq_flush((u64)(len), i2c->twsi_base + TWSI_BLOCK_CTL(i2c)); > + /* ADDR */ > + cmd |= (u64)(msgs[0].addr & 0x7full) << SW_TWSI_ADDR_SHIFT; can you please write some more meaningful comments? [...] > + /* Wait for transaction to complete */ > + ret = octeon_i2c_hlc_wait(i2c); > + if (ret) > + goto err; just return err, no point having a goto label here. [...] > +err: > + return ret; > +} > + > +/* high-level-controller composite block write+write, m[0]len<=2, m[1]len<=1024 */ > +static int octeon_i2c_hlc_block_comp_write(struct octeon_i2c *i2c, struct i2c_msg *msgs) more or less same comments apply here as _comp_read() [...] > @@ -720,6 +869,7 @@ int octeon_i2c_init_lowlevel(struct octeon_i2c *i2c) > /* toggle twice to force both teardowns */ > octeon_i2c_hlc_enable(i2c); > octeon_i2c_hlc_disable(i2c); > + this change does not belong here > return 0; > } > [...] > #define TWSI_INT_SDA BIT_ULL(10) > #define TWSI_INT_SCL BIT_ULL(11) > > +#define TWSI_MODE_STRETCH BIT_ULL(1) > +#define TWSI_MODE_BLOCK_MODE BIT_ULL(2) > + > +#define TWSI_BLOCK_STS_RESET_PTR BIT_ULL(0) > +#define TWSI_BLOCK_STS_BUSY BIT_ULL(1) The alignment here is a bit off. Andi > #define I2C_OCTEON_EVENT_WAIT 80 /* microseconds */