Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1715823lqp; Mon, 15 Apr 2024 15:11:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfmv8M3Dcb+UM72c97uCgdhm68QFcTxECtTrTxHqFowgHCYgGvu5DzZfRa3d8+egZ9QYlITMwKnJWl1iP94Qd88YHsy2mEjaPuNiRYtw== X-Google-Smtp-Source: AGHT+IFJLq3CE0X1NiTCpQlk3Vsoa5vg0WCk8DSQA+45qjzs9qHQ1may9GGvnKApqA/WMZ5mXbAf X-Received: by 2002:a05:6358:228c:b0:186:1c42:7240 with SMTP id t12-20020a056358228c00b001861c427240mr11187162rwb.12.1713219077594; Mon, 15 Apr 2024 15:11:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713219077; cv=pass; d=google.com; s=arc-20160816; b=oo6XuxMt+0Lm3HdTtfjh1k/7w5UtCMUwVRHkk7SDx0kvjyXZE/e2EaAY8BlMrk1s/6 vKvEvVhLqMNhAMT+y/8hEu0cAQrg0qwUDZdWmjRE3Fd29c8Qj7MeYJeemhhIxt3nLm31 JC0BEpNyXUJP2kyaNyryVKT04q5hjj5GwcEVjeFuQDZ58tauAPVDkkL8WOZ9ccj4wdFp xzY8QUfBop4WXskxUaGHsqAJVj8ehogVtuh/pdSZC7BpLUYD0uyZl/s5OTnX0Kngzuve ZHigTf8zKDZP09d/8izSXX7yp/k0S3ti2XYqNnNgqd9pgyMm9VVR7+/lgoT1c3hAleWJ TQDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=F7V4Jps+gbfuktlkvH5isUxC8UU7EULuAJj5Eq6UXEA=; fh=PldbcUGQh0mM/zw+lh6z+/Yg5wq6FFmatV4+8wMucbM=; b=YVOSTLRBflooJNNkoTYWXkTTVM0BIhSJnKNmjhlaOQBqr0VfW5GHvxx8t7JvNzHpuT xXjueBDuL6aeBYKOdb0plTZL9k5bmO2lb6n1wooIL5Wuz1UnX/Pvz2ObTXmjFjisMWiL C3fEY4MP7JV68kChfgx3mPwuPFyo13vnw3nNDPsrlBPNM26fW2GnmRku3E8Dduq6S50T KRvhZmwmX7odi+NIGNxoz6imaYJo9uOqxKhmLrQWh5texdlZHyZvN5U+joqwb8fnEFTt uWPDuoLhJTAeUQGuDexEJ9nJGYbmRZ+xa+b2BCeiUk3QSoPnYXxtsbx2/Oj9l7jRM50X 75iw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UXefIzaQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l13-20020a6542cd000000b005dc48468987si8224106pgp.754.2024.04.15.15.11.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 15:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UXefIzaQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4580B284E0D for ; Mon, 15 Apr 2024 22:11:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BD14157E62; Mon, 15 Apr 2024 22:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UXefIzaQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B92725601; Mon, 15 Apr 2024 22:11:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713219068; cv=none; b=fEyMlJfYtNxt4KL8F1DDoOr7LFkpo1eXcIPC+2wd59Xr7HI/831NuP/u5FpKb46zVn6POQwgcN7W/q0/wjyRfJegqxhAGbnzA2zJqCO3Gj+kMkmKje+urUhrsnJWPP15dn5teczjtGim7o4k5nHrvvnqH37Ef3L8hkg5B7NM+go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713219068; c=relaxed/simple; bh=yAUhUPGP6pRFUgJ6hrCL5leLqTgSSXyLqybDbhMmenw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pdu4iw85a6a1W81PXCxoRhqxcYUzGlb66wf5qltDNB95mYNoa+eHcuFQ0xggeezoRM1RHsTXbKJD31TQEIdNjwzqFgI6K/2tTJ4nbeLAf3lV01bkLpdq7bMJS+ZsWRt0iW2+7JbLhI58lr9wr7T8jKPOi1PSbPKUEPjBEblL53Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UXefIzaQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8311C113CC; Mon, 15 Apr 2024 22:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713219067; bh=yAUhUPGP6pRFUgJ6hrCL5leLqTgSSXyLqybDbhMmenw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UXefIzaQSP3GV6t/Bw7PBgqAbtRin9sQLZR50mi6lrZhBJfqPVblrDvLIlbVyIo3H qwEEHCUHrR4fWLpcO1meS8DQu8DBkrg4DvBUUrmYhJraswx0CvTscXOWtRsoiJU9GX dWkw1TOkunZ3b7bJaqAtu2MB/mbgsuWttdjzB+EgB+EWjkPhBr4z9/Sy8maHB0UQ7u c8zpxXH+DD+6xAtwbNVyDwmYKYr30cx98cI5aXY7oUA99tSy9t7hxiBuiT3tRxkMUR sxbteIj+Mu5squUUP1n5rk+LEVJ1E5DPCFNPspntr09m5hUVF3rP9NnfSLyAsWvoRJ c/yx2OPtd89Cw== Date: Tue, 16 Apr 2024 00:11:03 +0200 From: Andi Shyti To: Eddie James Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, lakshmiy@us.ibmcom Subject: Re: [PATCH v2 25/31] i2c: fsi: Calculate clock divider from local bus frequency Message-ID: References: <20240226165321.91976-1-eajames@linux.ibm.com> <20240226165321.91976-26-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240226165321.91976-26-eajames@linux.ibm.com> Hi Eddie, > @@ -689,6 +692,20 @@ static int fsi_i2c_probe(struct device *dev) > mutex_init(&i2c->lock); > i2c->fsi = to_fsi_dev(dev); > INIT_LIST_HEAD(&i2c->ports); > + i2c->clock_div = I2C_DEFAULT_CLK_DIV; > + > + lbus = fsi_device_local_bus_frequency(i2c->fsi); > + if (lbus) { > + u32 clock = I2C_DEFAULT_CLK_RATE; I don't see the need for initialization. > + > + if (!device_property_read_u32(dev, "clock-frequency", &clock)) { > + if (!clock) > + clock = I2C_DEFAULT_CLK_RATE; > + } no need for brackets. > + > + // i2c clock rate = local bus clock / (4 * (i2c clock div + 1)) You forgot to remove this. Andi > + i2c->clock_div = (((lbus + (clock - 1)) / clock) / 4) - 1; > + } > > rc = fsi_i2c_dev_init(i2c); > if (rc) > -- > 2.39.3 >