Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp235542rdb; Tue, 19 Dec 2023 15:16:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcHQ1c41xnr4W4HBJns5PhiYUBKD/oT7Z7VQ6jtv2fTKLHJXwM+ZftRCuTQRTobc3UxkkC X-Received: by 2002:a05:622a:45:b0:423:9fa7:85c8 with SMTP id y5-20020a05622a004500b004239fa785c8mr28243027qtw.3.1703027789332; Tue, 19 Dec 2023 15:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703027789; cv=none; d=google.com; s=arc-20160816; b=iuh7Bfh0yUJQc36R9oC8G4/9tmqi6pAwuGZSB7lez/NuPzGWd9QMVfCYtKivMvOlw3 7dNuy4ae0qIeRybl+b0rthGV5plriW8X85RU1jWuhBChqwuLUgNpr/Qj817vXCrYDAS/ AbXqrShgToJC/aQc8SggCs+a2DxBDPh3fwzBEprbOxjfffYR1Q2gVW89J/6uxgS5+D+J sf/bqVvApcCXK4LMCBMvK5fBejemhqTPVu+Cv+tzvCkdtGndP0Dqhx4kKptbUJIfdR3x HHokNQMo/Z0/8za0FPMtGueIPye75TsKnaHSWI/xNqu2QZto5sc17yr23npMEwfCnEce WTFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=Xtz2Ph11xhOBOn6l7WvQazXRIx1/OoXshEVe51WQZLA=; fh=YCsaY02WkrtJOVKoEI6YmkWXnBSLHtwAxB6+Y3BsRZ4=; b=UlctlLPy2U2A5b2XNLedO1+mpxbwr6PCaZJhc/QtgQWpcys9NCf3/yXSv1HxPmMBTW yNH927qv4y20nfiA4j0WbJbM/DyOqoebKgy2FOeWrG0QjqT4K4h11bPprU+n84Wzv+ME r52lyhwwhH+LTk78o5c4kINNljGLiUu/CyncUG8t930SKzEHcA+3NKKwSPMhd85kfbC9 MP9pGO7fIXq04v/lsQSobZ992NIwnWaWx+VBMI4zwg376Uio14TjO0EdcBh5kgVoX/sN Y9PQAjP5JEOAsS2wFASHU6jmfY17ZXhuM7akhLNaBRFiNgUzfAvBPm/I4bX0te2KiWMq ae5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FQWTkX72; spf=pass (google.com: domain of linux-kernel+bounces-6086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6086-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eq20-20020a05622a5e1400b0042374e9cc36si29915058qtb.370.2023.12.19.15.16.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 15:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FQWTkX72; spf=pass (google.com: domain of linux-kernel+bounces-6086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6086-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1808C1C243D8 for ; Tue, 19 Dec 2023 23:16:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 073A83EA7F; Tue, 19 Dec 2023 23:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FQWTkX72" X-Original-To: linux-kernel@vger.kernel.org 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 2EC6D3D0BD; Tue, 19 Dec 2023 23:16:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 889BCC433C8; Tue, 19 Dec 2023 23:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703027774; bh=4LTuUnlzAhnPPUW3BQv1N8PC27cgGsXXiht0pyrfmx4=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=FQWTkX72neD17DeH1TSu+fwsCICJIw/fB5ZNuNXjA/PdlrFj7AKxnWkyJbi9cvHvk IvF1LgZxgum4+Zdvfa0csutiDmgDByySRyOp11gyW8g0b9Gtt9o2wj7hUoeMDJWBhS IhYXqgyWfBPB0mKIPn8kGxGLmKGchotRltUOhKSPnzCOdEMgbO8LNy5dm96q9PKxpR LMZKAPdKktlwkmkM6BQ24Iaj2xrOM8r1jb6EzQk52A6jZLGLeYYxqcsctaC9v86NiL GEmzxf4878qQMA2R9/xuja/rh/L/vNzvHPkv4q4Bn+GO0rajaGw5v/GTno7WasuBMo N/m4y6xl8n8Bg== Message-ID: <897fe92cfe40a086832e0c85ef5358bc.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231218-mbly-clk-v1-4-44ce54108f06@bootlin.com> References: <20231218-mbly-clk-v1-0-44ce54108f06@bootlin.com> <20231218-mbly-clk-v1-4-44ce54108f06@bootlin.com> Subject: Re: [PATCH 4/5] clk: eyeq5: add OSPI table-based divider clock From: Stephen Boyd Cc: Vladimir Kondratiev , linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o?= Lebrun To: Conor Dooley , Gregory CLEMENT , Krzysztof Kozlowski , Michael Turquette , Rob Herring , Thomas Bogendoerfer , =?utf-8?q?Th=C3=A9o?= Lebrun Date: Tue, 19 Dec 2023 15:16:12 -0800 User-Agent: alot/0.10 Quoting Th=C3=A9o Lebrun (2023-12-18 09:14:19) > The driver supports PLLs on the platform. Add the single divider clock > of the platform. >=20 > Helpers from include/linux/clk-provider.h could have been used if it was > not for the use of regmap to access the register. >=20 > Signed-off-by: Th=C3=A9o Lebrun > --- This patch should be squashed with the previous one. > diff --git a/drivers/clk/clk-eyeq5.c b/drivers/clk/clk-eyeq5.c > index 74bcb8cec5c1..3382f4d870d7 100644 > --- a/drivers/clk/clk-eyeq5.c > +++ b/drivers/clk/clk-eyeq5.c > @@ -77,6 +78,8 @@ static const struct eq5c_pll { [...] > + > +static int eq5c_ospi_div_set_rate(struct clk_hw *hw, > + unsigned long rate, unsigned long paren= t_rate) > +{ > + struct eq5c_ospi_div *div =3D clk_hw_to_ospi_priv(hw); > + unsigned int val; > + int value, ret; > + > + value =3D divider_get_val(rate, parent_rate, eq5c_ospi_div_table, > + OLB_OSPI_DIV_MASK_WIDTH, 0); > + if (value < 0) > + return value; > + > + ret =3D regmap_read(div->olb, OLB_OSPI_REG, &val); > + if (ret) { > + pr_err("%s: regmap_read failed: %d\n", __func__, ret); > + return -ret; Why negative ret? > + } > + > + val &=3D ~OLB_OSPI_DIV_MASK; > + val |=3D FIELD_PREP(OLB_OSPI_DIV_MASK, value); > + > + ret =3D regmap_write(div->olb, OLB_OSPI_REG, val); > + if (ret) { > + pr_err("%s: regmap_write failed: %d\n", __func__, ret); > + return -ret; Why negative ret? > + } > + > + return 0; > +} > + > +const struct clk_ops eq5c_ospi_div_ops =3D { static? > + .recalc_rate =3D eq5c_ospi_div_recalc_rate, > + .round_rate =3D eq5c_ospi_div_round_rate, > + .determine_rate =3D eq5c_ospi_div_determine_rate, > + .set_rate =3D eq5c_ospi_div_set_rate, > +}; > + > +static struct clk_hw *eq5c_init_ospi_div(const struct clk_hw *parent, > + struct regmap *olb) > +{ > + struct eq5c_ospi_div *div; > + int ret; > + > + div =3D kzalloc(sizeof(*div), GFP_KERNEL); > + if (!div) > + return ERR_PTR(-ENOENT); > + > + div->olb =3D olb; > + div->hw.init =3D CLK_HW_INIT_HW(EQ5C_OSPI_DIV_CLK_NAME, parent, > + &eq5c_ospi_div_ops, 0); > + > + ret =3D clk_hw_register(NULL, &div->hw); > + if (ret) { > + pr_err("failed registering div_ospi: %d\n", ret); > + kfree(div); > + return ERR_PTR(-ENOENT); return ERR_PTR(ret) > + } > + > + return &div->hw; > +} > + > static void eq5c_init(struct device_node *np) > { > struct device_node *parent_np =3D of_get_parent(np);