Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp820995lqp; Thu, 21 Mar 2024 17:34:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKZbX9DWvpQz3GI84Lu0f8nMqe9Tb8Exnoyl2GtICYcsY7S40voxc9CpIUF2UDk/xWy+guDH5ZH4r1VpYznups6VHrsv0WwIjyxgvojg== X-Google-Smtp-Source: AGHT+IFxRRIXQCGvnw5/qEcFBtWcEYdaoizAzWfnUQmCdSSpSJHtvHBmNRCaamoL0QEzrKlNrJWb X-Received: by 2002:a5d:598a:0:b0:341:8412:a6e5 with SMTP id n10-20020a5d598a000000b003418412a6e5mr515661wri.24.1711067662004; Thu, 21 Mar 2024 17:34:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711067661; cv=pass; d=google.com; s=arc-20160816; b=ByR7Ae/Q1Ss+LH8N7RGJyGgw7uZjU6Mh1cMMfaxkI6jXeDr+N/tU+isGGwYEXERZ8i Sr0U55hbgFNaRMbdzTJbHo/F29FnHEN/aBKC4ikAW6UsN9atHWPMVrWxAtCdjQGGvFi7 Gii/j+Ypf9UdBuzk8IoOOlwGwE7cTDRfewzIacy2ES97R7yQM/XSAU+rCiC2Ngl7yiTu OKifIZ6OxwCanhNqOKlo3YdeJxGYgZHj47ONqKtLbPhLCF8CILDjQC0d/ti506woeDqF E8+OcuNWcGh6ltnclHmnbXztzFzpTujxiyQCJ+cbjYsllppkqvDcBT7d0Jp7dv/5tUGu i7uw== 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=XCbpip4M7uwtMrb77G8BGzkM1U1l6ahy+g1ATNDFQ34=; fh=4VSRY2YZZNsxdeerOE+XFxbfuL/Gs6xY5GpsZIwMQng=; b=V9BXDHWseVhdPR+AX+SbNvNn7ivByE2Kfqyowqlp5fqMVtTOqqrmJ0XrfpKQuoFDA0 S7Iq+gemTeVTw7o5ZVGaGKZnKHfjycChPrOS5Ks7tnAUZMTNmgYOJw/gTDWg25i5SSzu rncXE+A7WadebB6LtkFDSvO/JU0BI5gYrvzH88Iul8nQx8gMsnuTHjmKgUkOFVHsNv9s Kufu9ruNqQ4NxL8p7e3H4a8q/3Tc90fUwdgx6cffxciYB7s3TBIWqPN3o77bPJVNkZc7 enDv5N/XdZz4gSEU9AURKSDtMY9Gnk5JnhkR2Cy898OS8uUwpypx/WPV9sybRl5qNPdl +1Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=insSwIgc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-110825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r17-20020a05640251d100b0056763d0295dsi380281edd.333.2024.03.21.17.34.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 17:34:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=insSwIgc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-110825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110825-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B52FB1F22FED for ; Fri, 22 Mar 2024 00:34:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5AAD10E3; Fri, 22 Mar 2024 00:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="insSwIgc" 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 E8274376; Fri, 22 Mar 2024 00:34:12 +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=1711067653; cv=none; b=HuCR724bT9dwPF5Qs9TexwHwbUIz3lGLGEE8lRBzEsDtbrGBfJwWhYo89QU+8tPDSbFnccP7TPL43qHwUsLjgiC8QBGdu9NMtZajRN4ZtGBy2BepcrIMGAbzxON5+VONsye0UCKpCDESv/ybxNYSDYFjaWbhg0kUQjvmjSncZ74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711067653; c=relaxed/simple; bh=g9qE9ZrvmfY+JWl+GB2nOwlauim2SCg0XAFY9dp141o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=foAlPsVxqlqFMnrieovn8gCapIe70QTps/d0LScRVb9f90BbBDbFvFFy3MDFgcpPyxkfCc8/CavtCapU7pgEnx7bU+SY26TGUa7htkSBdT3kxjBn5wDmQRlZ0/4odQ/N9X+ksg7OLVi1kr9lMZr/1VLTBWjvQQ5t/MfdU6Knt/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=insSwIgc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C52AC433C7; Fri, 22 Mar 2024 00:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711067652; bh=g9qE9ZrvmfY+JWl+GB2nOwlauim2SCg0XAFY9dp141o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=insSwIgc5eVFdeUDQ31YJ8tkkKRoUG9RiYQBMa0DbILuoAhtJYpRA6sA/ROkKbvJc MJ05Rh30x5+efK4EPiGCWItDc9Oxmwi/38pfkpyOkFoEmqLzznQFnh7HrFtBf3lOSr lmEorMp/Kk6yVOQ1/MRgTy1rQwuH0aieW5Qvbhl5SbMmpbEROOPoQcfINqmhrX6xDn EvQy96DxrIv9uirqpprhCAmqlSTOIFq+tHJALBrFCvQF9ZQqSVFXB/IlDqJ7LEG8u6 J2Py5un9z313MiCgPi8OWCn/kUmNa4sw5geF+6c8r8uTRbG627KvrAglAONHoaH5mX xUl0xQWKvYGcg== Date: Fri, 22 Mar 2024 01:34:08 +0100 From: Andi Shyti To: Piyush Malgujar Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, sgarapati@marvell.com, cchavva@marvell.com, jannadurai@marvell.com Subject: Re: [PATCH v4 4/4] i2c: thunderx: Adding ioclk support Message-ID: References: <20240223125725.1709624-1-pmalgujar@marvell.com> <20240223125725.1709624-5-pmalgujar@marvell.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: <20240223125725.1709624-5-pmalgujar@marvell.com> Hi Piyush, On Fri, Feb 23, 2024 at 04:57:25AM -0800, Piyush Malgujar wrote: > Read the ioclk property as reference clock if sclk not > present in acpi table to make it SOC agnostic. > In case, it's not populated from dts/acpi table, use 800MHz > as default clock. Why change from 700MHz to 800MHz? > Signed-off-by: Piyush Malgujar > --- > drivers/i2c/busses/i2c-thunderx-pcidrv.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c > index 31f11b77ab663626967c86086a03213876bf4a07..15cf794a776533d1b0dbb08597fc0d9acf791b44 100644 > --- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c > +++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c > @@ -27,7 +27,7 @@ > > #define PCI_DEVICE_ID_THUNDER_TWSI 0xa012 > > -#define SYS_FREQ_DEFAULT 700000000 > +#define SYS_FREQ_DEFAULT 800000000 > #define OTX2_REF_FREQ_DEFAULT 100000000 > > #define TWSI_INT_ENA_W1C 0x1028 > @@ -100,7 +100,8 @@ static void thunder_i2c_clock_enable(struct device *dev, struct octeon_i2c *i2c) > i2c->sys_freq = clk_get_rate(i2c->clk); > } else { > /* ACPI */ > - device_property_read_u32(dev, "sclk", &i2c->sys_freq); > + if (device_property_read_u32(dev, "sclk", &i2c->sys_freq)) > + device_property_read_u32(dev, "ioclk", &i2c->sys_freq); > } > > skip: > @@ -182,7 +183,6 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, > if (!i2c->twsi_base) > return -EINVAL; > > - thunder_i2c_clock_enable(dev, i2c); This change and the related goto's are not described in the commit message. How are they related to this patch? Andi > ret = device_property_read_u32(dev, "clock-frequency", &i2c->twsi_freq); > if (ret) > i2c->twsi_freq = I2C_MAX_STANDARD_MODE_FREQ; > @@ -196,12 +196,12 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, > > ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); > if (ret < 0) > - goto error; > + return ret; > > ret = devm_request_irq(dev, pci_irq_vector(pdev, 0), octeon_i2c_isr, 0, > DRV_NAME, i2c); > if (ret) > - goto error; > + return ret; > > ret = octeon_i2c_init_lowlevel(i2c); > if (ret) > @@ -213,6 +213,9 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, > */ > if (octeon_i2c_is_otx2(pdev) && IS_LS_FREQ(i2c->twsi_freq)) > i2c->sys_freq = OTX2_REF_FREQ_DEFAULT; > + else > + thunder_i2c_clock_enable(dev, i2c); > + > octeon_i2c_set_clock(i2c); > > i2c->adap = thunderx_i2c_ops; > @@ -240,6 +243,8 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, > > error: > thunder_i2c_clock_disable(dev, i2c->clk); > + if (!IS_LS_FREQ(i2c->twsi_freq)) > + thunder_i2c_clock_disable(dev, i2c->clk); > return ret; > } > > -- > 2.43.0 >