From patchwork Fri Mar 10 07:55:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13168833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FA8AC6FD19 for ; Fri, 10 Mar 2023 07:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229981AbjCJHzy (ORCPT ); Fri, 10 Mar 2023 02:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjCJHzx (ORCPT ); Fri, 10 Mar 2023 02:55:53 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A366E191A; Thu, 9 Mar 2023 23:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434946; x=1709970946; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qYQPl7nGfAFl2mMjX45qVs8yCecf4A47M9vFzemDep8=; b=b7tvaGZ+3sPqnwnKpMsAg5N/+iC4FrzUV/HTgVqXVHLFWOipQ3UHWoni 5oOKY3DOTYfaIy7BLkbvfrXbcqMZGBnRp5RZrBJ15WbJtt+/v+6K4l3GW qUALQ7LcxP3kJWoGe92IyhDaBczJ32GHyl06urtrUZW6meJo/RhaWc4Y+ tOQP/rEhULYpSlnASatHpHnUPH3r5QE09pyu+ZMiqYW9DKaRemjVMz30t 8GkVoMdEI3z0XGnr+wRupOW3rXzY2bRT654M7EzK+FQDJ+YMzdtaGjj30 +cbaCeHXNag3CV5rdeaAEvY7ElHJbI1mFMl+73/WwNRMDSK+zRstW9waZ g==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597121" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:55:43 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:55:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434944; x=1709970944; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qYQPl7nGfAFl2mMjX45qVs8yCecf4A47M9vFzemDep8=; b=ZjIM0xyJD/iIobliNT0P1AixALUtPbN8roF1KjoEWcRMXB9SbOE1Gce/ BTiYbKVXLL87W0YGDVHgKJJfYNaoX4MO+DwrSamR/qWpr9bwp2r2WYDOf LFtqQLQATPRx1JkSFWdb8IMJbNxMNUHRcFS099HG+J73261CPU3egBxge VZAdlg4SKCUOBatKQdMTZ87CmBn4g800RQwuUFm6ZSzGZoI/hUjfVOvwv NjT4g6gcpDYI0V6lWYtTzoKSUFc5UCR7eDqMH10poVLrGvDJGLEnKXMV1 dEAw1AVE2YjqzARuK1193r1u8M2rY5F09f//LraNkuTMhz6SCrdAWNenP w==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597120" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:55:43 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 6A5A4280056; Fri, 10 Mar 2023 08:55:43 +0100 (CET) From: Alexander Stein To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Marek Vasut Cc: Alexander Stein , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 1/4] clk: rs9: Check for vendor/device ID Date: Fri, 10 Mar 2023 08:55:32 +0100 Message-Id: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This is in preparation to support additional devices which have different IDs as well as a slightly different register layout. Signed-off-by: Alexander Stein Reviewed-by: Marek Vasut --- Changes in v3: * Added Marek's R-b drivers/clk/clk-renesas-pcie.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c index f91f30560820..3873c52ad3b0 100644 --- a/drivers/clk/clk-renesas-pcie.c +++ b/drivers/clk/clk-renesas-pcie.c @@ -45,6 +45,13 @@ #define RS9_REG_DID 0x6 #define RS9_REG_BCP 0x7 +#define RS9_REG_VID_IDT 0x01 + +#define RS9_REG_DID_TYPE_FGV (0x0 << RS9_REG_DID_TYPE_SHIFT) +#define RS9_REG_DID_TYPE_DBV (0x1 << RS9_REG_DID_TYPE_SHIFT) +#define RS9_REG_DID_TYPE_DMV (0x2 << RS9_REG_DID_TYPE_SHIFT) +#define RS9_REG_DID_TYPE_SHIFT 0x6 + /* Supported Renesas 9-series models. */ enum rs9_model { RENESAS_9FGV0241, @@ -54,6 +61,7 @@ enum rs9_model { struct rs9_chip_info { const enum rs9_model model; unsigned int num_clks; + u8 did; }; struct rs9_driver_data { @@ -269,6 +277,7 @@ static int rs9_probe(struct i2c_client *client) { unsigned char name[5] = "DIF0"; struct rs9_driver_data *rs9; + unsigned int vid, did; struct clk_hw *hw; int i, ret; @@ -305,6 +314,20 @@ static int rs9_probe(struct i2c_client *client) if (ret < 0) return ret; + ret = regmap_read(rs9->regmap, RS9_REG_VID, &vid); + if (ret < 0) + return ret; + + ret = regmap_read(rs9->regmap, RS9_REG_DID, &did); + if (ret < 0) + return ret; + + if (vid != RS9_REG_VID_IDT || did != rs9->chip_info->did) + return dev_err_probe(&client->dev, -ENODEV, + "Incorrect VID/DID: %#02x, %#02x. Expected %#02x, %#02x\n", + vid, did, RS9_REG_VID_IDT, + rs9->chip_info->did); + /* Register clock */ for (i = 0; i < rs9->chip_info->num_clks; i++) { snprintf(name, 5, "DIF%d", i); @@ -348,6 +371,7 @@ static int __maybe_unused rs9_resume(struct device *dev) static const struct rs9_chip_info renesas_9fgv0241_info = { .model = RENESAS_9FGV0241, .num_clks = 2, + .did = RS9_REG_DID_TYPE_FGV | 0x02, }; static const struct i2c_device_id rs9_id[] = { From patchwork Fri Mar 10 07:55:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13168834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94963C6FD1C for ; Fri, 10 Mar 2023 07:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjCJHzz (ORCPT ); Fri, 10 Mar 2023 02:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjCJHzy (ORCPT ); Fri, 10 Mar 2023 02:55:54 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D147DDF15; Thu, 9 Mar 2023 23:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434954; x=1709970954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sk2ehzY5SqSGQmIsWqiG2UQo6TQemqH+4nJ10PBQLLg=; b=RbuYuPoGevGdmBDWSCz09819SW1EluaWWnpSrETGNKjl+iPb2MbnB1JM 7N/SRMj1DCpWv4flgAHCduowKV6J2TmT9+FNuzCCPsZF1Z9PD1Rb1aBfp SgAmMWW/iBS5BmEV/m/ulfWTmb/cvLgZ5ZZmnZmp/z5sGHxwTWrbXX8jM lrWUODlKxPzHHloA+P66SZEbg0tKH2ba5evQ5McpUiNy8+mP3qVDo4OoY M62q1FPPdUoHQAboZ/vw3ZheAyRxEFWlsebIzuN+wp7DTzsN9bUg5Dmrq Pq/h9HkkIVHrQn+WPrK9jZ9PEoQjVqTBiQ3TfOT6xOnKeP43SkUhp4dR5 A==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597124" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:55:44 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:55:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434944; x=1709970944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sk2ehzY5SqSGQmIsWqiG2UQo6TQemqH+4nJ10PBQLLg=; b=npedJpPzWELeShKmf9yn3Vk3Rc51F6SnKiREkYjCc8PJEGRucFGbtUyQ HDHa28w3iohwb+YHGzdv+YRrgMG3flzhorquhukQZgTYxlv6v0C9Mwxi0 6wOZfDfLcazg0fnOdt6Oe5kTzjUF+QUz0OCDwuwlb8MG7da7ZOYzNTMui zPGtxvEukmavqXR4x87qT6f7UVcBRF0iTxlWTVPuaHcYPiGLXvGSpgd18 4RZoRWcfvk2cJubTpbPrlWkMs4+5iHg8ZeGQTm/PUC/GCNjGB6Ma/0gFv yh8TZHCQtRUTVOsE5nPTwiB408DaJJo6Z1y07bi0V11ku+dAsfhPcqqhF g==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597122" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 98A77280072; Fri, 10 Mar 2023 08:55:43 +0100 (CET) From: Alexander Stein To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Marek Vasut Cc: Alexander Stein , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 2/4] dt-bindings: clk: rs9: Add 9FGV0441 Date: Fri, 10 Mar 2023 08:55:33 +0100 Message-Id: <20230310075535.3476580-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> References: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This is a 4-channel variant of 9FGV series. Signed-off-by: Alexander Stein Acked-by: Krzysztof Kozlowski Reviewed-by: Marek Vasut --- Changes in v3: * Added Marek's R-b .../devicetree/bindings/clock/renesas,9series.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/renesas,9series.yaml b/Documentation/devicetree/bindings/clock/renesas,9series.yaml index 6b6cec3fba52..3afdebdb52ad 100644 --- a/Documentation/devicetree/bindings/clock/renesas,9series.yaml +++ b/Documentation/devicetree/bindings/clock/renesas,9series.yaml @@ -16,6 +16,11 @@ description: | - 9FGV0241: 0 -- DIF0 1 -- DIF1 + - 9FGV0441: + 0 -- DIF0 + 1 -- DIF1 + 2 -- DIF2 + 3 -- DIF3 maintainers: - Marek Vasut @@ -24,6 +29,7 @@ properties: compatible: enum: - renesas,9fgv0241 + - renesas,9fgv0441 reg: description: I2C device address From patchwork Fri Mar 10 07:55:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13168835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01A64C64EC4 for ; Fri, 10 Mar 2023 07:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjCJHz5 (ORCPT ); Fri, 10 Mar 2023 02:55:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbjCJHz4 (ORCPT ); Fri, 10 Mar 2023 02:55:56 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94EC1DD597; Thu, 9 Mar 2023 23:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434955; x=1709970955; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bo3atwmlhwGhcSeKSjFNoq2khdipfGDBT2znWilnFDg=; b=hWUyKITNyFtd9Qhqh0yFKtOdcXTSmxOQpFWEBsv9DANnlW5NS5NS2rnL qcrxiyPpWdJ7YriviQkZ9a6WBtVjcbPg1vJTfNNGd4iTAiojYjdMbdfrf yWOVTITJDnt6pubsiZbaEyf3CgET4DsqBMrMomKC6xcOaDNUrffl64Q+V YT2knYMClibzO9fmCJJ/SSJYu2fu0qLneH0hOhqSfVSDKw99jl2JCnhJH tH41pnyy5Pic3B14bH4/VmROZpwnRIvngk2qi6SD4qNhQ7w63fTHqKe86 v7XWMASSDzKO/Ntk1/YihtcU3B+KcwJfXQZ6zSR5aoG3dAmljvZLvGv5H w==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597126" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:55:44 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:55:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434944; x=1709970944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bo3atwmlhwGhcSeKSjFNoq2khdipfGDBT2znWilnFDg=; b=dM5gCAKq9tovsJ+ZI4MY0HfEuVX7MR4afbQMnQiA95gV19lTggokmDrK UykMzKMoUxqDuWC5ckR8GRGRwMaMCTCiSq9x3/7Z1BNk7q2Uq2yDPjskF eeBxY8Euv0SQ3rvfSB1Dq5WfsobQySsKY0FCFty/60LEB27YNw4Izdn3D b4+isgHJQbT1+p1nKkuJP9OsC69ZBYFr97iUSysC7yEMZeJILPVtpZ4nW zb+ucoZiN1cmiSdxX1ewYCUo8nm96AopPdz1H7knHPbGdVjT5V2I0jYEA 8b+wmcbT/cd+OmaAMB5fVveLzVUYmFDla5XsCEIBFUcArFQdrWhqrw6V7 w==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597125" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id D9FC1280056; Fri, 10 Mar 2023 08:55:43 +0100 (CET) From: Alexander Stein To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Marek Vasut Cc: Alexander Stein , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 3/4] clk: rs9: Support device specific dif bit calculation Date: Fri, 10 Mar 2023 08:55:34 +0100 Message-Id: <20230310075535.3476580-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> References: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The calculation DIFx is BIT(n) +1 is only true for 9FGV0241. With additional devices this is getting more complicated. Support a base bit for the DIF calculation, currently only devices with consecutive bits are supported, e.g. the 6-channel device needs additional logic. Signed-off-by: Alexander Stein Reviewed-by: Marek Vasut --- Changes in v3: * Added Marek's R-b drivers/clk/clk-renesas-pcie.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c index 3873c52ad3b0..0036bd18c559 100644 --- a/drivers/clk/clk-renesas-pcie.c +++ b/drivers/clk/clk-renesas-pcie.c @@ -18,7 +18,6 @@ #include #define RS9_REG_OE 0x0 -#define RS9_REG_OE_DIF_OE(n) BIT((n) + 1) #define RS9_REG_SS 0x1 #define RS9_REG_SS_AMP_0V6 0x0 #define RS9_REG_SS_AMP_0V7 0x1 @@ -31,9 +30,6 @@ #define RS9_REG_SS_SSC_MASK (3 << 3) #define RS9_REG_SS_SSC_LOCK BIT(5) #define RS9_REG_SR 0x2 -#define RS9_REG_SR_2V0_DIF(n) 0 -#define RS9_REG_SR_3V0_DIF(n) BIT((n) + 1) -#define RS9_REG_SR_DIF_MASK(n) BIT((n) + 1) #define RS9_REG_REF 0x3 #define RS9_REG_REF_OE BIT(4) #define RS9_REG_REF_OD BIT(5) @@ -159,17 +155,27 @@ static const struct regmap_config rs9_regmap_config = { .reg_read = rs9_regmap_i2c_read, }; +static u8 rs9_calc_dif(const struct rs9_driver_data *rs9, int idx) +{ + enum rs9_model model = rs9->chip_info->model; + + if (model == RENESAS_9FGV0241) + return BIT(idx) + 1; + + return 0; +} + static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx) { struct i2c_client *client = rs9->client; + u8 dif = rs9_calc_dif(rs9, idx); unsigned char name[5] = "DIF0"; struct device_node *np; int ret; u32 sr; /* Set defaults */ - rs9->clk_dif_sr &= ~RS9_REG_SR_DIF_MASK(idx); - rs9->clk_dif_sr |= RS9_REG_SR_3V0_DIF(idx); + rs9->clk_dif_sr |= dif; snprintf(name, 5, "DIF%d", idx); np = of_get_child_by_name(client->dev.of_node, name); @@ -181,11 +187,9 @@ static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx) of_node_put(np); if (!ret) { if (sr == 2000000) { /* 2V/ns */ - rs9->clk_dif_sr &= ~RS9_REG_SR_DIF_MASK(idx); - rs9->clk_dif_sr |= RS9_REG_SR_2V0_DIF(idx); + rs9->clk_dif_sr &= ~dif; } else if (sr == 3000000) { /* 3V/ns (default) */ - rs9->clk_dif_sr &= ~RS9_REG_SR_DIF_MASK(idx); - rs9->clk_dif_sr |= RS9_REG_SR_3V0_DIF(idx); + rs9->clk_dif_sr |= dif; } else ret = dev_err_probe(&client->dev, -EINVAL, "Invalid renesas,slew-rate value\n"); @@ -256,11 +260,13 @@ static void rs9_update_config(struct rs9_driver_data *rs9) } for (i = 0; i < rs9->chip_info->num_clks; i++) { - if (rs9->clk_dif_sr & RS9_REG_SR_3V0_DIF(i)) + u8 dif = rs9_calc_dif(rs9, i); + + if (rs9->clk_dif_sr & dif) continue; - regmap_update_bits(rs9->regmap, RS9_REG_SR, RS9_REG_SR_3V0_DIF(i), - rs9->clk_dif_sr & RS9_REG_SR_3V0_DIF(i)); + regmap_update_bits(rs9->regmap, RS9_REG_SR, dif, + rs9->clk_dif_sr & dif); } } From patchwork Fri Mar 10 07:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13168836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA8B6C76186 for ; Fri, 10 Mar 2023 07:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbjCJHz6 (ORCPT ); Fri, 10 Mar 2023 02:55:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjCJHz5 (ORCPT ); Fri, 10 Mar 2023 02:55:57 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F80E0624; Thu, 9 Mar 2023 23:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434956; x=1709970956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x6fWEKzRp4EyH7sl18efFBbE9f9nwdcsdY/tosLvcNQ=; b=VgOc33o2t4wPfgufSDMMxKjVk35gurlH59aTMufiHZXgBxvmSrenPhSL wQhjr6Y0KNVOMRxSUIdNn+t7HlpsnzswKVpDhGb+aPLz8G9AdKc+oRPKM SGMshzE72QdZxGd/KryaSPc6Csboj2/OXDbRKFfDqecGAb4Zhf029ymqr mlcDV1aUrfGeRyfvg+3La1joVmsX+HCb8OqelRu+2M9QdOTwlyzSTCOo0 IwiMLf30fIpmittwl0Gn+t9suIb40ppUkHgAc0MqQCREZI4+KI933ctrf o8I1iTZK32lQEPIKTbnW3zN0jL2A85shAlXt4Eh618h284YuqmF53LIRV g==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597128" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 10 Mar 2023 08:55:44 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 10 Mar 2023 08:55:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1678434944; x=1709970944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x6fWEKzRp4EyH7sl18efFBbE9f9nwdcsdY/tosLvcNQ=; b=h3av136E+ombsMsAEuE5/KMoV++uuVftswP9tZCtPCPIVqxh53qKvCXX BF9gdWkb7Fu8oTjcaWa3nWUc808+P+IRKjNKdENKgDDr0bnaDqQMZeCMK 7XBvqAbw2h9ubXkHDvw+sfTBN2vzORNvgzv9kWAAtSyuM0ocYgmFvyMC/ uQ+flr729KnfrDxXjmei1fZKokd0nGp0gyZEGBz7wPdWO1YH4szb3yKVY NPH52jnzKbQRSCO/jFwSJekKrg4i9xGs4COzWyMT6G1TyabtconaqRNGh BSOhWBU5gUCVnEM1bPi8WxsrZp0tuvYDGKsiKwyQwZDGz2u8InmNg+y20 w==; X-IronPort-AV: E=Sophos;i="5.98,249,1673910000"; d="scan'208";a="29597127" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 10 Mar 2023 08:55:44 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 15273280072; Fri, 10 Mar 2023 08:55:44 +0100 (CET) From: Alexander Stein To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Marek Vasut Cc: Alexander Stein , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 4/4] clk: rs9: Add support for 9FGV0441 Date: Fri, 10 Mar 2023 08:55:35 +0100 Message-Id: <20230310075535.3476580-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> References: <20230310075535.3476580-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This model is similar to 9FGV0241, but the DIFx bits start at bit 0. Signed-off-by: Alexander Stein Reviewed-by: Marek Vasut --- Changes in v3: * Rebased to current next branch * Added Marek's R-b drivers/clk/clk-renesas-pcie.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c index 0036bd18c559..6799fb0fa2d3 100644 --- a/drivers/clk/clk-renesas-pcie.c +++ b/drivers/clk/clk-renesas-pcie.c @@ -6,6 +6,7 @@ * - 9FGV/9DBV/9DMV/9FGL/9DML/9QXL/9SQ * Currently supported: * - 9FGV0241 + * - 9FGV0441 * * Copyright (C) 2022 Marek Vasut */ @@ -51,6 +52,7 @@ /* Supported Renesas 9-series models. */ enum rs9_model { RENESAS_9FGV0241, + RENESAS_9FGV0441, }; /* Structure to describe features of a particular 9-series model */ @@ -64,7 +66,7 @@ struct rs9_driver_data { struct i2c_client *client; struct regmap *regmap; const struct rs9_chip_info *chip_info; - struct clk_hw *clk_dif[2]; + struct clk_hw *clk_dif[4]; u8 pll_amplitude; u8 pll_ssc; u8 clk_dif_sr; @@ -161,6 +163,8 @@ static u8 rs9_calc_dif(const struct rs9_driver_data *rs9, int idx) if (model == RENESAS_9FGV0241) return BIT(idx) + 1; + else if (model == RENESAS_9FGV0441) + return BIT(idx); return 0; } @@ -380,14 +384,22 @@ static const struct rs9_chip_info renesas_9fgv0241_info = { .did = RS9_REG_DID_TYPE_FGV | 0x02, }; +static const struct rs9_chip_info renesas_9fgv0441_info = { + .model = RENESAS_9FGV0441, + .num_clks = 4, + .did = RS9_REG_DID_TYPE_FGV | 0x04, +}; + static const struct i2c_device_id rs9_id[] = { { "9fgv0241", .driver_data = RENESAS_9FGV0241 }, + { "9fgv0441", .driver_data = RENESAS_9FGV0441 }, { } }; MODULE_DEVICE_TABLE(i2c, rs9_id); static const struct of_device_id clk_rs9_of_match[] = { { .compatible = "renesas,9fgv0241", .data = &renesas_9fgv0241_info }, + { .compatible = "renesas,9fgv0441", .data = &renesas_9fgv0441_info }, { } }; MODULE_DEVICE_TABLE(of, clk_rs9_of_match);