From patchwork Thu Jul 23 15:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681221 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 461DF138C for ; Thu, 23 Jul 2020 15:28:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E6B22067D for ; Thu, 23 Jul 2020 15:28:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="k/wt3QzI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ithbTwaA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E6B22067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jLXoJYLeObTQu9WGJzREr6O5X5H9Q+oH5qgmPbasCnU=; b=k/wt3QzI4Kb0sB/sCWlwZODBZ n3pokmgju4tpGCpYGim0QRfit1oqyae3m0xFPrzJgrGQLe7xAoAFtMhsrZ7p97zHTXeLfU73chUFc e3Gzty5DYl5kdp7Vz8VDDKrmyvRj6vtgyu3ouC25b6GCHuH/aesmnkUI1Yh6x6IoUiL1wmaOmiZCq KiwHUPPfbR0uYxihhlCvMiIP8YDTn/GeB2ja2X4uLTfwRP1wxTU5lp+AJ5Tsh1IYp0xGxowvKijiy 92kCivhFHj1D0bVmvQh49xVtD+px/g1nuP3+yu6a95o3x2e6oZLvEa/E8gRZgdtpPBnfnxC370l7K N0/Boedmg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7Z-0007SP-43; Thu, 23 Jul 2020 15:26:57 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7V-0007RJ-LB for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:26:54 +0000 Received: by mail-wr1-x442.google.com with SMTP id r4so2607982wrx.9 for ; Thu, 23 Jul 2020 08:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zeGJhn4QDCv7nHVcfBN1kEkOyeVk60ndJ+Wwf4G4XD8=; b=ithbTwaAxz5gEQyqNKS5Bgr8alt7QgnzfxZxjJOD22GNv7bw/z7+Mv9FziFhf2osFN M7l4Ta1TEBAqu5jbhVnArS15n2TW9DfPcJG4y5J/4Gx5ghIPSpbqVFIx0r+T4OJd4DLy AhKe6M5iim0KX1Ogub076YX1Y1RBT3a1rc4rNrX8dQ8rm6nZgDnUmxCx6On/Y/dSPdfc ZP12IT21nm+RRXaXPglA/+vvVtGAsnAJCLg5LXgTKNtsnadDiuWfWw9ge81/zORa+knG h+CrlR0F363lJ2GWrNQ+b82imr5aRHehlunZtZK8ywPVRKwR86/YDHmlQzkiVBLw11MG vEEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zeGJhn4QDCv7nHVcfBN1kEkOyeVk60ndJ+Wwf4G4XD8=; b=TCDEdVCHznD65bABgkdhvlMz/dhnR3ncuDZR1KH3Ii9shhP4v8nFHrLmGrj89Uq+0H xUNTN5sQqZlzN8XwqsJwRGNnlH36j+IM/+Tjdf7biUVGkaITwpEBnkwctJZz9pFCx7R+ mGAVvcKqDzUx0vUkC9nhuLS4Cwjw896CbVFfxGCz3kZwmaAtMu8fqnKlZkXgvV0ANczD 7bAd3v8+SNINLKAEq9h8ZwRu2amgeBejHKpceyXq+l0idMKKWFeuHCbD0I2FsUt4GPuj eBdYyAmh3iFfVha20yd0ASg1Cj3jRAXmlNMlhylV4x1Y91zuwkqHJbq1Pn8ai2I3ssfz c8ig== X-Gm-Message-State: AOAM533PpCoiDoxAhzOSMwwkS0Oa03n4OJRsRyvDKOKxVrx9t2DBdTtr PQvWTMGRAuY0GwQ3P+1nSMniNg== X-Google-Smtp-Source: ABdhPJwQ7LHnyhS68zfPqiGMd5i53UtPOC/V7VxMNv2t0Y9efpOkBGLpTCqQlKTJsnUnFf321+vVaQ== X-Received: by 2002:adf:d084:: with SMTP id y4mr4383828wrh.161.1595518012378; Thu, 23 Jul 2020 08:26:52 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:26:51 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 01/16] dt-bindings: atmel-tcb: convert bindings to json-schema Date: Thu, 23 Jul 2020 17:26:21 +0200 Message-Id: <20200723152639.639771-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112653_737185_79F5AF8D X-CRM114-Status: GOOD ( 17.79 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Alexandre Belloni , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , Ludovic Desroches , Rob Herring , Lee Jones , "moderated list:ARM/Microchip AT91 SoC support" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni Convert Atmel Timer Counter Blocks bindings to DT schema format using json-schema. Also move it out of mfd as it is not and has never been related to mfd. Signed-off-by: Alexandre Belloni Reviewed-by: Rob Herring Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-2-alexandre.belloni@bootlin.com Acked-by: Lee Jones --- .../devicetree/bindings/mfd/atmel-tcb.txt | 56 -------- .../soc/microchip/atmel,at91rm9200-tcb.yaml | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-tcb.txt create mode 100644 Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml diff --git a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt b/Documentation/devicetree/bindings/mfd/atmel-tcb.txt deleted file mode 100644 index c4a83e364cb6..000000000000 --- a/Documentation/devicetree/bindings/mfd/atmel-tcb.txt +++ /dev/null @@ -1,56 +0,0 @@ -* Device tree bindings for Atmel Timer Counter Blocks -- compatible: Should be "atmel,-tcb", "simple-mfd", "syscon". - can be "at91rm9200" or "at91sam9x5" -- reg: Should contain registers location and length -- #address-cells: has to be 1 -- #size-cells: has to be 0 -- interrupts: Should contain all interrupts for the TC block - Note that you can specify several interrupt cells if the TC - block has one interrupt per channel. -- clock-names: tuple listing input clock names. - Required elements: "t0_clk", "slow_clk" - Optional elements: "t1_clk", "t2_clk" -- clocks: phandles to input clocks. - -The TCB can expose multiple subdevices: - * a timer - - compatible: Should be "atmel,tcb-timer" - - reg: Should contain the TCB channels to be used. If the - counter width is 16 bits (at91rm9200-tcb), two consecutive - channels are needed. Else, only one channel will be used. - -Examples: - -One interrupt per TC block: - tcb0: timer@fff7c000 { - compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xfff7c000 0x100>; - interrupts = <18 4>; - clocks = <&tcb0_clk>, <&clk32k>; - clock-names = "t0_clk", "slow_clk"; - - timer@0 { - compatible = "atmel,tcb-timer"; - reg = <0>, <1>; - }; - - timer@2 { - compatible = "atmel,tcb-timer"; - reg = <2>; - }; - }; - -One interrupt per TC channel in a TC block: - tcb1: timer@fffdc000 { - compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xfffdc000 0x100>; - interrupts = <26 4>, <27 4>, <28 4>; - clocks = <&tcb1_clk>, <&clk32k>; - clock-names = "t0_clk", "slow_clk"; - }; - - diff --git a/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml b/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml new file mode 100644 index 000000000000..9d680e0b9109 --- /dev/null +++ b/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml @@ -0,0 +1,131 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/soc/microchip/atmel,at91rm9200-tcb.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Atmel Timer Counter Block + +maintainers: + - Alexandre Belloni + +description: | + The Atmel (now Microchip) SoCs have timers named Timer Counter Block. Each + timer has three channels with two counters each. + +properties: + compatible: + items: + - enum: + - atmel,at91rm9200-tcb + - atmel,at91sam9x5-tcb + - const: simple-mfd + - const: syscon + + reg: + maxItems: 1 + + interrupts: + description: + List of interrupts. One interrupt per TCB channel if available or one + interrupt for the TC block + minItems: 1 + maxItems: 3 + + clock-names: + description: + List of clock names. Always includes t0_clk and slow clk. Also includes + t1_clk and t2_clk if a clock per channel is available. + oneOf: + - items: + - const: t0_clk + - const: slow_clk + - items: + - const: t0_clk + - const: t1_clk + - const: t2_clk + - const: slow_clk + minItems: 2 + maxItems: 4 + + clocks: + minItems: 2 + maxItems: 4 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + +patternProperties: + "^timer@[0-2]$": + description: The timer block channels that are used as timers. + type: object + properties: + compatible: + const: atmel,tcb-timer + reg: + description: + List of channels to use for this particular timer. + minItems: 1 + maxItems: 3 + + required: + - compatible + - reg + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + /* One interrupt per TC block: */ + tcb0: timer@fff7c000 { + compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xfff7c000 0x100>; + interrupts = <18 4>; + clocks = <&tcb0_clk>, <&clk32k>; + clock-names = "t0_clk", "slow_clk"; + + timer@0 { + compatible = "atmel,tcb-timer"; + reg = <0>, <1>; + }; + + timer@2 { + compatible = "atmel,tcb-timer"; + reg = <2>; + }; + }; + + /* One interrupt per TC channel in a TC block: */ + tcb1: timer@fffdc000 { + compatible = "atmel,at91rm9200-tcb", "simple-mfd", "syscon"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xfffdc000 0x100>; + interrupts = <26 4>, <27 4>, <28 4>; + clocks = <&tcb1_clk>, <&clk32k>; + clock-names = "t0_clk", "slow_clk"; + + timer@0 { + compatible = "atmel,tcb-timer"; + reg = <0>; + }; + + timer@1 { + compatible = "atmel,tcb-timer"; + reg = <1>; + }; + }; From patchwork Thu Jul 23 15:26:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 304FE138C for ; Thu, 23 Jul 2020 15:29:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0743C2067D for ; Thu, 23 Jul 2020 15:29:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YgZ/kLoM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZibBjkqe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0743C2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aJuSfsJGfP2fu/umsPE3/2LU7fQAlxI3GfJx3oYHL7c=; b=YgZ/kLoMyVQVU1ZjXhixlbwZh 0x4CdaOEyAgQiSJnYZOUuZNvJV8idYqbyPURxXbaQ0cPxQbpB3MhISqAec567kknaBoBPDs7Sj8jD C1ZYytc1QqRrvUUsmsUn0lJgIB+te+HoCqpLWZkTQNnoUrdtviDotqzfLLc7Oo8EleglJJZL3O1MW 4KtXvjQlowmQrdpQZM1+O6MtALUqEXQm0AhOkoEuRrOqYHi5KRAMqn27AKBrAbvmmIeNXnkElzEtc F8FqTDpBBSRV43y3moAu9qqkVpfvCKiYuHH1UQIgEc8JASyY4kLsWsMQXK8ibp1kBY391V3nv8its MNXIDtPjA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd83-0007eo-Jo; Thu, 23 Jul 2020 15:27:27 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7Y-0007SR-Vj for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:26:58 +0000 Received: by mail-wr1-x442.google.com with SMTP id a15so5556397wrh.10 for ; Thu, 23 Jul 2020 08:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/f3+aWQD6jv0BacPrlT71wq4KzB+QZIhzZYF2sQn5E=; b=ZibBjkqePpOt6wdwejuWLwFNSiWg1V3RghiCXkrwZ2zbCXKNFcgMngbifiPD7ZtIaV CFUA1mvy/F3qhrX9YIPJSSK7Q8Fo7PxR7DTTvYzuxwE5/norGhp3rzrM3aKgsreCQxpS gKcQCwfO7PqBQOJ+9jYGEOZzc8BbHwaX8G89pODVWQCyEX5sLYkDzrgtxzOiKQ29i/gQ SIGKnrd/qVDvMLdd8i4EmC2OX//b5pZBDRK5adLOz/qQBYM2Cndq6lSgFo+lJB4ATZf5 R3UnYH8RMDu4xBC++zoGIK5FvqM07FPesWZRz/y0saCEQPXrBPpDcKcCemI+MZEn06lQ QVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/f3+aWQD6jv0BacPrlT71wq4KzB+QZIhzZYF2sQn5E=; b=Y9jvdL/wGA+4Uh4yseE8RP8abEkUKTR9ZWj7ak2Xjl/zj3Cv3XoFIPB7cN059+SYvg 54qA3oUtilZmXXyAOZLfQ9FUlfLpxD6GFN33aBPXVb0vZpFzh0+XKDQ6kI1XNszoMRz1 akQcAI/v8wc46Y6rHHVTzjbGMgLTNLTNqQXrGaXtRGih7BwMhiCSN4KZxmBgwvrQksYD wWyuFXPI5f1INReQswOLSkWFfw4+n4qKsmh/Yh/3o9U2RVipO/xugyonOBn6v18iBlNd K6xQMVFaFZ9gix60T1RvezYFxR6uZtGzYePV8JJLP6lCG9RU7OM6vydzJz+XQDMOHgdJ uM4A== X-Gm-Message-State: AOAM5336r8icEuELBkAjlhHoQDaiUPXWAP8s97eI857PUSJY+ou1BZcU jLcPnJW8Hla+xHj0zLk9rdMpmojbAYh1cg== X-Google-Smtp-Source: ABdhPJyn+xE4PapUaCreq7vHX+H11qIZL6P1+k5pEK9vPxvIc+2dE+6m1P5/FmInnfl2ePCjghmB9Q== X-Received: by 2002:a5d:4e92:: with SMTP id e18mr4588679wru.107.1595518015861; Thu, 23 Jul 2020 08:26:55 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:26:55 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 02/16] dt-bindings: microchip: atmel, at91rm9200-tcb: add sama5d2 compatible Date: Thu, 23 Jul 2020 17:26:22 +0200 Message-Id: <20200723152639.639771-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112657_250312_F90A111D X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Alexandre Belloni , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , Ludovic Desroches , Rob Herring , "moderated list:ARM/Microchip AT91 SoC support" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni The sama5d2 TC block TIMER_CLOCK1 is different from the at91sam9x5 one. Instead of being MCK / 2, it is the TCB GCLK. Reviewed-by: Rob Herring Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-3-alexandre.belloni@bootlin.com --- .../soc/microchip/atmel,at91rm9200-tcb.yaml | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml b/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml index 9d680e0b9109..d226fd7d5258 100644 --- a/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml +++ b/Documentation/devicetree/bindings/soc/microchip/atmel,at91rm9200-tcb.yaml @@ -19,6 +19,7 @@ properties: - enum: - atmel,at91rm9200-tcb - atmel,at91sam9x5-tcb + - atmel,sama5d2-tcb - const: simple-mfd - const: syscon @@ -36,15 +37,6 @@ properties: description: List of clock names. Always includes t0_clk and slow clk. Also includes t1_clk and t2_clk if a clock per channel is available. - oneOf: - - items: - - const: t0_clk - - const: slow_clk - - items: - - const: t0_clk - - const: t1_clk - - const: t2_clk - - const: slow_clk minItems: 2 maxItems: 4 @@ -75,6 +67,38 @@ patternProperties: - compatible - reg +allOf: + - if: + properties: + compatible: + contains: + const: atmel,sama5d2-tcb + then: + properties: + clocks: + minItems: 3 + maxItems: 3 + clock-names: + items: + - const: t0_clk + - const: gclk + - const: slow_clk + else: + properties: + clocks: + minItems: 2 + maxItems: 4 + clock-names: + oneOf: + - items: + - const: t0_clk + - const: slow_clk + - items: + - const: t0_clk + - const: t1_clk + - const: t2_clk + - const: slow_clk + required: - compatible - reg From patchwork Thu Jul 23 15:26:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681225 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39007138C for ; Thu, 23 Jul 2020 15:30:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0642C2067D for ; Thu, 23 Jul 2020 15:30:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UBsFna9s"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dQ0bNcNH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0642C2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DacAOJK9pIPL7x/fHoUsKTB8wRFf+xbvp3jc7LuC74w=; b=UBsFna9sBKGjARpgw4BD1RQj2 BURI4ay2hrM54jeCwOb5G/Q2kgwwjMuL6P7q1QzangOsiQQ3QUCUnyH+Zkii0MQoC5qgtn1pA+d0x ZWVpUY9Z5RIQZhjMJfqr690snTLPTQ8fgHeFQ6HhCf95Yz9gwGVKwyg7UYFBfM9ch6qotfHsZM+HX +G3DAhiLPIOBYy5V/QPoNdPdY/UkyFssBcbOrHIL29YSK1Ie/VA5GZoe/KsLlidY3erfjjk0ewUNd U1qfEojkhsPhuW+/2/DfGCqgzj6QUkCmhpZPeeAfUlRI2n40ALat1+GfQEpD4MPOUZqAVuaYzsTZm z44lZcDww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd8V-0007po-0W; Thu, 23 Jul 2020 15:27:55 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7a-0007TT-Dq for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:26:59 +0000 Received: by mail-wr1-x441.google.com with SMTP id f2so5561094wrp.7 for ; Thu, 23 Jul 2020 08:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R3Az9OepR2BdTDAPEdWN7LwMsA5P61TmIGuTZB4zgG8=; b=dQ0bNcNHpnx9qpWEBFvn7k8BSJ2+ODBoKIGwRh8WJxScokmdsmED6rZDIst+EPX73+ IDDU64ZC9K0ihBDdbvtkjDopIVWL++lUhyeRvE1y1WGtDBZY71hjXDm84zKIj44QDyS/ QixwlMZJ4P0+GvPv9cGPqCLIpGUob9YCuBrBuyZk2xKm8jYOQNElQCkudTwJyeftVOgj BcybaEjwi9sQTAZvYtaepJP8A4953wsmbvhodkgh3DC0UE7JAwH2//Gr97lxGDF5F1iC g9Sq+FbIp/Hya2TDm9DioJ5j5tu20mfUOJJQ2xr7x5BtGOyT0g1MpcJbIkuWuX4raguH oOnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R3Az9OepR2BdTDAPEdWN7LwMsA5P61TmIGuTZB4zgG8=; b=iyi6Jpten3pEkE9MtKoucLpaI0RRmAOzNBzTQsNnKBe6yDrNYLEtJOzEH9RR+5VR9M Co61OsD8QofN1wa27j0d8SLPTNkjhub3mCAnClxKuR6DRbJsqfcvNjO4DorlHYnHuDPb i53z3LWh50rZpcFWJsT2HZiiTY5vx0oP1fvUKKEHZ4c+b2Bk96gDKINurf71zfEiwESp F7Ru1Rt77bvbMq8xTh00feHi1LmmhH1RO0tqPtsrir97nps2mxC1ZIIbWyibghfudpKH UYGPHMRlGQwI4wrp3ffCljH9WK3XFwRQe1+6PpRg/jHph03oPUgYXScaDtLo3jWkwUNA a9QA== X-Gm-Message-State: AOAM532ApneLHrpbEi5jB+9M2m1+QJGK76nZG5EIX3sEdzP3bhsssEY+ +mHMfevs9kMP5gdGMbGKojXRlw== X-Google-Smtp-Source: ABdhPJx6Y0KCgNUV6vyevzLdntNlIy25yfdHe+xPNK9dHmUZ0jPqL/DqTZacB9I3mfa7338G1RCmeQ== X-Received: by 2002:adf:c108:: with SMTP id r8mr3999574wre.41.1595518017097; Thu, 23 Jul 2020 08:26:57 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:26:56 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 03/16] ARM: dts: at91: sama5d2: add TCB GCLK Date: Thu, 23 Jul 2020 17:26:23 +0200 Message-Id: <20200723152639.639771-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112658_547502_2C8092DA X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Alexandre Belloni , open list , Ludovic Desroches , Rob Herring , "moderated list:ARM/Microchip AT91 SoC support" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni The sama5d2 tcbs take an extra input clock, their gclk. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-4-alexandre.belloni@bootlin.com --- arch/arm/boot/dts/sama5d2.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index ab550d69db91..996143e966d8 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -499,23 +499,23 @@ macb0: ethernet@f8008000 { }; tcb0: timer@f800c000 { - compatible = "atmel,at91sam9x5-tcb", "simple-mfd", "syscon"; + compatible = "atmel,sama5d2-tcb", "simple-mfd", "syscon"; #address-cells = <1>; #size-cells = <0>; reg = <0xf800c000 0x100>; interrupts = <35 IRQ_TYPE_LEVEL_HIGH 0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&clk32k>; - clock-names = "t0_clk", "slow_clk"; + clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_GCK 35>, <&clk32k>; + clock-names = "t0_clk", "gclk", "slow_clk"; }; tcb1: timer@f8010000 { - compatible = "atmel,at91sam9x5-tcb", "simple-mfd", "syscon"; + compatible = "atmel,sama5d2-tcb", "simple-mfd", "syscon"; #address-cells = <1>; #size-cells = <0>; reg = <0xf8010000 0x100>; interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 36>, <&clk32k>; - clock-names = "t0_clk", "slow_clk"; + clocks = <&pmc PMC_TYPE_PERIPHERAL 36>, <&pmc PMC_TYPE_GCK 36>, <&clk32k>; + clock-names = "t0_clk", "gclk", "slow_clk"; }; hsmc: hsmc@f8014000 { From patchwork Thu Jul 23 15:26:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681227 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01BB7138A for ; Thu, 23 Jul 2020 15:30:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC0AB2067D for ; Thu, 23 Jul 2020 15:30:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZyokmVqv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fUdXAo34" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC0AB2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UCnqKIVQMxpD8l5F2fqP0jJkYFj7mkYX6mDFxVStBfE=; b=ZyokmVqvQef4O8HouVig4rTq6 vGvKmiXwOicyrJyL8Z3ADoU8DCziLWfU/PK7XgMaeV2PNEBKH6870At53FRO64fgxAo/L22PXAuRT 2Qsh8uryl3Ksa29Fs4CFVYQl9qJg/xi0XJBXLkzB+UxPJ6txf2/gPyhfT7OoZ7CbBitvqSW7tZWhw OVQJsKilPCDOVQcZebormkW6K6TPlk9Fj6b0dHNfS7WuWddx3pD1za1yv40VNVZ4Vv3FlBkHt7VDu X0v00n3FUyIR8lJB3nUxEBC0Yyyua2KMnEgiYgG1EN35AiNeSvNdMl3eXQMqZk+NBS8Yt0XuYEDTl 18CVyUecQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd8t-00081S-J7; Thu, 23 Jul 2020 15:28:19 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7b-0007U7-Nw for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:01 +0000 Received: by mail-wm1-x344.google.com with SMTP id a6so6724107wmm.0 for ; Thu, 23 Jul 2020 08:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kcr8FiQcF4dcjc+1sT9fDo6gYVNY2HcPFMXM5v83NF4=; b=fUdXAo34sJI9Nocd1bdBlfYHHPYfMTox6oVwVJiBjL6FoYVn6+p/mCZ3LyKIodqTf9 uCaOe21npf+1dWHx/wNkJiAR+cyXU0R1hhdpC4r7Lviv+GaibqIav+EGNBIgnmT/ETpy 7DmAfGB84zaOoErEI9zavQTrGl4FKkac4oV+qdofgXuVNcMKtrOWPyL+ZTbkNgmT71sb 9zgb4HRiGFbBnqjr8q8bB86ZQce37gtpT5u6Zp9y/j1mYGukdhnujbHZBTABvjTJ97tp 9NPFY9DZ5SQtx6EPlDNfH+Lw8ZZ4jMPROnUccZ5uJxuvJ4CE44EhEj5DQNpTseI1J7JR ZpCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kcr8FiQcF4dcjc+1sT9fDo6gYVNY2HcPFMXM5v83NF4=; b=Mx7uD9JDOaYV4Um3ZeOhQnHB4WonhaZoSftgVZPLCj4d6DY5rc+lB8UZ3zqHbxNlCS jum9yY7XWqRW3PS32GqSk5b1EgpLpRONN1Irrp9CGvyKd4/T4mXLqX69wxdGqQvnm5Fj i5+qAhXo6K13qXxjhHmrbLUKrMOQAG9V/FQ3bpfTIeinnRWXbqpB3Fn9wD2FyxAnIIm6 mNnuuoox5rSAgC+pw4L1feRkQ+4cwI0soBEBHQAT75wOOnE6z3+FPCOcRaSGinarRjNx GDSmQMIZAEIZDUgzbAd4el0EkxqryJn8CobvhlkuJsyR8osZZjs004mAzpcSQo/BjZBS pX+w== X-Gm-Message-State: AOAM533Rvxwwq4ogxQwQhapnQcay+v0PTik4qn5yuOsYCOdxt/tE0tMb VM/Pvy64w2odMzQQfpt3uS+SpQ== X-Google-Smtp-Source: ABdhPJwDhCN3AoJJvUyS+OvPDjrPC0R/KjZhd8zi2hvwwI6iTAJHUgFySZUsPoM6/EqmPNx/Y/jfig== X-Received: by 2002:a7b:c054:: with SMTP id u20mr4538366wmc.2.1595518018374; Thu, 23 Jul 2020 08:26:58 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:26:57 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 04/16] ARM: at91: add atmel tcb capabilities Date: Thu, 23 Jul 2020 17:26:24 +0200 Message-Id: <20200723152639.639771-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112659_882877_9404892D X-CRM114-Status: UNSURE ( 9.86 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kamel Bouhara , Alexandre Belloni , open list , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kamel Bouhara Some atmel socs have extra tcb capabilities that allow using a generic clock source or enabling a quadrature decoder. Signed-off-by: Kamel Bouhara Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-5-alexandre.belloni@bootlin.com --- include/soc/at91/atmel_tcb.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/soc/at91/atmel_tcb.h b/include/soc/at91/atmel_tcb.h index c3c7200ce151..1d7071dc0bca 100644 --- a/include/soc/at91/atmel_tcb.h +++ b/include/soc/at91/atmel_tcb.h @@ -36,9 +36,14 @@ struct clk; /** * struct atmel_tcb_config - SoC data for a Timer/Counter Block * @counter_width: size in bits of a timer counter register + * @has_gclk: boolean indicating if a timer counter has a generic clock + * @has_qdec: boolean indicating if a timer counter has a quadrature + * decoder. */ struct atmel_tcb_config { size_t counter_width; + bool has_gclk; + bool has_qdec; }; /** From patchwork Thu Jul 23 15:26:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF218138C for ; Thu, 23 Jul 2020 15:30:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7BCE2067D for ; Thu, 23 Jul 2020 15:30:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3ZdbvSC1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qLNp4nQH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7BCE2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hdJoyjsnuL95mnsgiHWBQEk5MSRaEdJ1ExowvIgP9g4=; b=3ZdbvSC19J7JgVOfS9c98O830 V0KK6qb6mTE68kv2M6SNWxaU2TuUmLNFGKHaJfbjEzqEQROi0eSOKuRafTuNWUytonF9kiGtVWsid WjpqNGa9Pp5VM4ucyjVIgxOCRvtIBjfAu6EucZxYjfWMjPMz90m9gyDTgy2KwrGV2ZaKWfdntRUsX v0kxS2LqTX6dXvLhjVbccN5Qh9Ot+P7n7UysdK0de4fsvY9HqvxlsWRETxpXmz5lPzLz0eGlqd+tH lYjcrcDWdYCSb1qBiYBQgW0VEX/JjstLg2M3APdkz88RSxg+zVlJUvCHgwLSymkrXWOhhJs7ORzfp HH/2hIMyw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9D-00088L-Gl; Thu, 23 Jul 2020 15:28:39 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7c-0007Us-Qh for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:02 +0000 Received: by mail-wm1-x344.google.com with SMTP id j18so5327724wmi.3 for ; Thu, 23 Jul 2020 08:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gEfaBqT/0CoLB9mlKqYWw9OwFPm9et7GWv9HdjL+20Q=; b=qLNp4nQHmBcL9wwPcTVh1KdyojCC+Ng1h0PSBagRtQe/13DibONXpQ/OK1hYytNNyB oIN9Ptyndv/Mdo9ftVGZGb8jmZv9mBo2JX2mhV/GoJR0eJPnlepcmPCQrMS03klCj/Ls idzzWjFAhcItNP0G7hHezWVLTTLW7KvYCyQtdYFHjfPjitCHAQmeGMcVSldgCYpOTDJT C24PkFeoRuHRkm65GPydAWLnOnCU0v5MJKZssXF58zH/bkoRrGpMAEaYVjYBt2TmmOu9 QSfDL52VJVbM/N6YhjSl24VOEWL2ETfHOyHe0/Gn3himhdQox/4Q0OkYhWHIYcnUZlmx vs+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gEfaBqT/0CoLB9mlKqYWw9OwFPm9et7GWv9HdjL+20Q=; b=emwRbgJ5TrrtfKc+Y1aXfJR9D7mlWwU+dJVhUP8vs6Z53zi6+F/KJUt1K0PyRGptBk jvveB20f4X5ldlxY0w6sH2Abr1kLe5XKDsiJA/9VgwkG43CUwLV+VqYr8Y9avUfvVbp1 JilK0FmLxffhA2ht3izO2OwN2wu47DS7ugAnXfeW595FI4XCNIxdsGct2K8AJHIdwf8Z IbP8Ux6Mn7CUFfS1KBE2tlmb5FnNyHNa2zl1LJiPUh72RvbxsLc5mJZcJjHOZXxqY6wq hCTrZTlKnben5AFAV8I5R3Qv9Zf0Pp1M1nzJAbzWO+g05rq4yvDquSJ4f0+fwygjW995 u/Bw== X-Gm-Message-State: AOAM533Gkdt7Lj9TKqCQWOdphJU3wMz816brTGELNbqRLAy08DWO/Gee +DtiG4TkB7mP+GvSYRXK7Eh/qQ== X-Google-Smtp-Source: ABdhPJzKZTThxX/bozgKe2UbCkR0civZnFkJIRvbd/AnyAaR20RyQH92o7sYad6XySCakbUDgu3WMg== X-Received: by 2002:a7b:c3da:: with SMTP id t26mr2125925wmj.13.1595518019623; Thu, 23 Jul 2020 08:26:59 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:26:58 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 05/16] clocksource/drivers/timer-atmel-tcb: Rework 32khz clock selection Date: Thu, 23 Jul 2020 17:26:25 +0200 Message-Id: <20200723152639.639771-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112701_118142_293DDE9D X-CRM114-Status: GOOD ( 13.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni On all the supported SoCs, the slow clock is always ATMEL_TC_TIMER_CLOCK5, avoid looking it up and pass it directly to setup_clkevents. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-6-alexandre.belloni@bootlin.com --- drivers/clocksource/timer-atmel-tcb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index 7427b07495a8..b255a4a1a36b 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -346,7 +346,7 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR); } -static const u8 atmel_tcb_divisors[5] = { 2, 8, 32, 128, 0, }; +static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 }; static const struct of_device_id atmel_tcb_of_match[] = { { .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, }, @@ -362,7 +362,6 @@ static int __init tcb_clksrc_init(struct device_node *node) u64 (*tc_sched_clock)(void); u32 rate, divided_rate = 0; int best_divisor_idx = -1; - int clk32k_divisor_idx = -1; int bits; int i; int ret; @@ -416,12 +415,6 @@ static int __init tcb_clksrc_init(struct device_node *node) unsigned divisor = atmel_tcb_divisors[i]; unsigned tmp; - /* remember 32 KiHz clock for later */ - if (!divisor) { - clk32k_divisor_idx = i; - continue; - } - tmp = rate / divisor; pr_debug("TC: %u / %-3u [%d] --> %u\n", rate, divisor, i, tmp); if (best_divisor_idx > 0) { @@ -467,7 +460,7 @@ static int __init tcb_clksrc_init(struct device_node *node) goto err_disable_t1; /* channel 2: periodic and oneshot timer support */ - ret = setup_clkevents(&tc, clk32k_divisor_idx); + ret = setup_clkevents(&tc, ATMEL_TC_TIMER_CLOCK5); if (ret) goto err_unregister_clksrc; From patchwork Thu Jul 23 15:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1141213A4 for ; Thu, 23 Jul 2020 15:30:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8C44206E3 for ; Thu, 23 Jul 2020 15:30:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KBKq1Viw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aEUGtAZI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8C44206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=c+i7uEYRAiY6XFsJlgFpKc+xtT+HThtIhPXITC8A6fk=; b=KBKq1ViwM/SnbwdRo+bZzGMFw SZ2/tubIfcf5ddf/N26cPg74/Pux7BzvNSIQsO03pnSjSg0Ve/qyA23ZFtJsf0E460a2HafDKkdAl HlqgJwSsbA/lHcLl35cib8nz0G6ChVHcfOXeWWxKGo7DYrbrthJUPEyvyH8LL2YSkdh+xHiTKeBcB zQL21y2d9+ddH+YmXCXh3baKmGB5FMBlEH/jO1F8f2U2Lm+1/jBMwiDa2oYI/G2DsV61ox2oaTyPM M4fAEyzH/GyDvZ4RCTu/cgGWfsAk/edt+EP35uJO/JTSMx/Dculz7JCCDte0+CJLGP7Ozx2YVgkOU AAMf76nUA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9H-0008Am-Oa; Thu, 23 Jul 2020 15:28:43 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7d-0007VS-Tx for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:04 +0000 Received: by mail-wm1-x341.google.com with SMTP id p14so4965493wmg.1 for ; Thu, 23 Jul 2020 08:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3NpN6vwpNGFrmKHXZA+xE9YNl04TWY4QjIajSNvVcqI=; b=aEUGtAZIDshRVd/hX89wGAPq91RQ9Vmz+YYHCiHcETrwy/C9kpFks+YYrXAir08n4t X3eEg9kZlVw092N2gK4pezjLzdchra1jmWsGjaAMrywEmF0Ar2WbfjoUm5MN0bI0c0pD GeW8aYmxtYppycdoE4VB0rtAa04zFi35bpxTWbh7nVYc62x/MAr6MUmcuzMM7A6ZSswl LgGN29YP6NDBf4P6G+y81UzA8r7GgJKWWj7jimo0aA+0eHeVG6cpVWFz8rhBblZTVZ7n D3Jjev8QWmSyeoudsXisjVcQ4sN4KyX/yCf+BglJgeUO5KR1lx3rGCx/SdcagPalkEol ucFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3NpN6vwpNGFrmKHXZA+xE9YNl04TWY4QjIajSNvVcqI=; b=LK5YI3OgshJmhTIJbfJHlsOKUPN+360G9zF3Uzi+qB2vOV796P9Xh2HKzQv5mOA53B yeDjlCwalAVdgjxi5Vp0Pl0PP8VKrcVlR8CoW58LgNFQIim3tXbkh0wuyyD2ZRg74iDD TcEDGHDF0oi1mE9ZgmpN8CQKigdIRQz+Eq7BnRvqNG/vJ2xgps3lbmqnbbTCeUDpO9Nh alB7V2pSmSVHF+QnA7Ro8WyLdA6DilKUWbFceW2Y8fk0j4ILTwrUILWLAseoRBsB5MxX OMBawzJaZj2XbeLpx9Hnmdj0tcJWC2RyjB8c0wh91VEzK1owstzTQA2vD9FCzmKnJoQE QMTg== X-Gm-Message-State: AOAM530z/hjdEN/AxWE7MdSIY/i3eoCsiVv5CavtnplM3Jf2jYdUK40w y4GiVBETO6qVJ1ANfPbJkSTc/g== X-Google-Smtp-Source: ABdhPJykbgZiz9e8tZr4TtwFzSuPsYlppku/LsYQx6m//wEDLxa446XX63F4bocUiIVM9Xwgj0P2Yg== X-Received: by 2002:a1c:ab84:: with SMTP id u126mr4467525wme.43.1595518020709; Thu, 23 Jul 2020 08:27:00 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:27:00 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 06/16] clocksource/drivers/timer-atmel-tcb: Fill tcb_config Date: Thu, 23 Jul 2020 17:26:26 +0200 Message-Id: <20200723152639.639771-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112702_182888_257C0174 X-CRM114-Status: GOOD ( 13.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni Use the tcb_config and struct atmel_tcb_config to get the timer counter width. This is necessary because atmel_tcb_config will be extended later on. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-7-alexandre.belloni@bootlin.com --- drivers/clocksource/timer-atmel-tcb.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index b255a4a1a36b..423af2f9835f 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -348,9 +348,17 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 }; +static struct atmel_tcb_config tcb_rm9200_config = { + .counter_width = 16, +}; + +static struct atmel_tcb_config tcb_sam9x5_config = { + .counter_width = 32, +}; + static const struct of_device_id atmel_tcb_of_match[] = { - { .compatible = "atmel,at91rm9200-tcb", .data = (void *)16, }, - { .compatible = "atmel,at91sam9x5-tcb", .data = (void *)32, }, + { .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, }, + { .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, }, { /* sentinel */ } }; @@ -398,7 +406,11 @@ static int __init tcb_clksrc_init(struct device_node *node) } match = of_match_node(atmel_tcb_of_match, node->parent); - bits = (uintptr_t)match->data; + if (!match) + return -ENODEV; + + tc.tcb_config = match->data; + bits = tc.tcb_config->counter_width; for (i = 0; i < ARRAY_SIZE(tc.irq); i++) writel(ATMEL_TC_ALL_IRQ, tc.regs + ATMEL_TC_REG(i, IDR)); From patchwork Thu Jul 23 15:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B518138C for ; Thu, 23 Jul 2020 15:31:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFCDA20714 for ; Thu, 23 Jul 2020 15:31:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D+6AJj5L"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xemi9yha" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFCDA20714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jsx/4hafXRrIyKp0q9Pje0s48asduVcOdsWw6xY7um8=; b=D+6AJj5Lub91GCjgLmA/eKoJQ IxO6fEHIHJMABi2kBor9aS1KQf4gH6IW+9bCyoHa6FjirhqO6i57gt+418VqZdhXOPQRAiB1rhstd +sxACOHsTbE+ycdSB1LbU1yTL32zM2UK2L3LQdhtkJEW9OkhwQcypyNghlFTp9Q1dWJZG+Cn24/jr jno7ogrgarWojNjTOVur9JL4DF5iDZ5dCxOKdqjO6VgZCKPu/dkvM3vkyFL2Q9Q+NZ3aKoeF//SA+ ap7KGo3RxOArWjbZ3Jet+fiEO2DCdrSkusssAiSRRqdNru34eAw8m8nyd1GRI3rqrbFW5OXTFknjm VJ2RKVGAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9R-0008G1-8Z; Thu, 23 Jul 2020 15:28:53 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7f-0007Wc-6s for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:07 +0000 Received: by mail-wr1-x443.google.com with SMTP id y3so5572743wrl.4 for ; Thu, 23 Jul 2020 08:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7i5aCeoYGYSqIOTMXORInZCKzVcS5GG+dOuM60dxhZQ=; b=xemi9yha2Bu2YaifaLGhS8NaMOJSI8JL+5c7Tcnb09hBqkStXsci5/GPJLpG0iu/rq vhiineqjdk6tfQmkwgtPHA0WArw10U7D8AGp58CIUb+m2MXoUY+gUEVnn3bafuhEQP3l IpanFQgH+FMkgiffo24b68yeQQKTUzxB8ccdv1HNWicUZcoodOPBioYI2f8V3Qx1ZKuY bWDiGf/TB9deRhjwtEJHRezYi0cwy+x12EMYIrWCampfcUdrbInVC60mC7gktETGWOU9 chHLQOOeHWybHBzB1PLQ4weCJBK05dcopHYtGeqK8yw42dlBvbxPR1N2DAyescEylFdZ +U8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7i5aCeoYGYSqIOTMXORInZCKzVcS5GG+dOuM60dxhZQ=; b=OX2TfL0JLx4oKXIGJeT134iEWjo0Mz3GrXexjmDU9tEP07xoYlvF9QBNQn50UVrnKd yJWnYgIx9LTZAghMBbiHGzU2t5ZdbearWsy7vsRBzyfoc3qR0bA9RC/GWRSnSBVMBU6/ 9V1Vx2cI5sF92XfBjScUO3YzDv6yN96qtIyptzoaCbD8w2D/LlBDodWVtgOo8uSeXRW0 Z3hSEUXEbhu65j0a19/luhvfvXx2sygUWLnM1mxEBdPPOzQaJoFwmPMEL+alfMfSQhvn hOJ44h8vvCXpNin5ZJ2PHnrbF29RAVVUws985R53pa7VUuiwxC9AIoENvQjOKKpvsmHB bWNw== X-Gm-Message-State: AOAM5324fEu2UDKP5ei+8yrfjR/nyAWuhBcjfl+/BN45yjBgsFKCTMe6 vibmz5kZzERHkPznwyUO4c0z+w== X-Google-Smtp-Source: ABdhPJw7BQRyrbXR6RkFmX7taaPIvp1bgn/wVN3bL3Kqz8/9jzo2eGS5IZfe6ngpBkTCqn86tu6c7w== X-Received: by 2002:a5d:5273:: with SMTP id l19mr4446980wrc.257.1595518021896; Thu, 23 Jul 2020 08:27:01 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.27.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:27:01 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 07/16] clocksource/drivers/timer-atmel-tcb: Stop using the 32kHz for clockevents Date: Thu, 23 Jul 2020 17:26:27 +0200 Message-Id: <20200723152639.639771-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112703_388337_D9FDDC57 X-CRM114-Status: GOOD ( 22.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni Stop using the slow clock as the clock source for 32 bit counters because even at 10MHz, they are able to handle delays up to two minutes. This provides a way better resolution. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-8-alexandre.belloni@bootlin.com --- drivers/clocksource/timer-atmel-tcb.c | 63 ++++++++++++++------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index 423af2f9835f..7a6474acc774 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -27,9 +27,10 @@ * - Some chips support 32 bit counter. A single channel is used for * this 32 bit free-running counter. the second channel is not used. * - * - The third channel may be used to provide a 16-bit clockevent - * source, used in either periodic or oneshot mode. This runs - * at 32 KiHZ, and can handle delays of up to two seconds. + * - The third channel may be used to provide a clockevent source, used in + * either periodic or oneshot mode. For 16-bit counter its runs at 32 KiHZ, + * and can handle delays of up to two seconds. For 32-bit counters, it runs at + * the same rate as the clocksource * * REVISIT behavior during system suspend states... we should disable * all clocks and save the power. Easily done for clockevent devices, @@ -47,6 +48,8 @@ static struct } tcb_cache[3]; static u32 bmr_cache; +static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 }; + static u64 tc_get_cycles(struct clocksource *cs) { unsigned long flags; @@ -143,6 +146,7 @@ static unsigned long notrace tc_delay_timer_read32(void) struct tc_clkevt_device { struct clock_event_device clkevt; struct clk *clk; + u32 rate; void __iomem *regs; }; @@ -151,13 +155,6 @@ static struct tc_clkevt_device *to_tc_clkevt(struct clock_event_device *clkevt) return container_of(clkevt, struct tc_clkevt_device, clkevt); } -/* For now, we always use the 32K clock ... this optimizes for NO_HZ, - * because using one of the divided clocks would usually mean the - * tick rate can never be less than several dozen Hz (vs 0.5 Hz). - * - * A divided clock could be good for high resolution timers, since - * 30.5 usec resolution can seem "low". - */ static u32 timer_clock; static int tc_shutdown(struct clock_event_device *d) @@ -183,7 +180,7 @@ static int tc_set_oneshot(struct clock_event_device *d) clk_enable(tcd->clk); - /* slow clock, count up to RC, then irq and stop */ + /* count up to RC, then irq and stop */ writel(timer_clock | ATMEL_TC_CPCSTOP | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP_AUTO, regs + ATMEL_TC_REG(2, CMR)); writel(ATMEL_TC_CPCS, regs + ATMEL_TC_REG(2, IER)); @@ -205,10 +202,10 @@ static int tc_set_periodic(struct clock_event_device *d) */ clk_enable(tcd->clk); - /* slow clock, count up to RC, then irq and restart */ + /* count up to RC, then irq and restart */ writel(timer_clock | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP_AUTO, regs + ATMEL_TC_REG(2, CMR)); - writel((32768 + HZ / 2) / HZ, tcaddr + ATMEL_TC_REG(2, RC)); + writel((tcd->rate + HZ / 2) / HZ, tcaddr + ATMEL_TC_REG(2, RC)); /* Enable clock and interrupts on RC compare */ writel(ATMEL_TC_CPCS, regs + ATMEL_TC_REG(2, IER)); @@ -256,47 +253,55 @@ static irqreturn_t ch2_irq(int irq, void *handle) return IRQ_NONE; } -static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) +static int __init setup_clkevents(struct atmel_tc *tc, int divisor_idx) { int ret; struct clk *t2_clk = tc->clk[2]; int irq = tc->irq[2]; - - ret = clk_prepare_enable(tc->slow_clk); - if (ret) - return ret; + int bits = tc->tcb_config->counter_width; /* try to enable t2 clk to avoid future errors in mode change */ ret = clk_prepare_enable(t2_clk); - if (ret) { - clk_disable_unprepare(tc->slow_clk); + if (ret) return ret; - } - - clk_disable(t2_clk); clkevt.regs = tc->regs; clkevt.clk = t2_clk; - timer_clock = clk32k_divisor_idx; + if (bits == 32) { + timer_clock = divisor_idx; + clkevt.rate = clk_get_rate(t2_clk) / atmel_tcb_divisors[divisor_idx]; + } else { + ret = clk_prepare_enable(tc->slow_clk); + if (ret) { + clk_disable_unprepare(t2_clk); + return ret; + } + + clkevt.rate = clk_get_rate(tc->slow_clk); + timer_clock = ATMEL_TC_TIMER_CLOCK5; + } + + clk_disable(t2_clk); clkevt.clkevt.cpumask = cpumask_of(0); ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt); if (ret) { clk_unprepare(t2_clk); - clk_disable_unprepare(tc->slow_clk); + if (bits != 32) + clk_disable_unprepare(tc->slow_clk); return ret; } - clockevents_config_and_register(&clkevt.clkevt, 32768, 1, 0xffff); + clockevents_config_and_register(&clkevt.clkevt, clkevt.rate, 1, BIT(bits) - 1); return ret; } #else /* !CONFIG_GENERIC_CLOCKEVENTS */ -static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) +static int __init setup_clkevents(struct atmel_tc *tc, int divisor_idx) { /* NOTHING */ return 0; @@ -346,8 +351,6 @@ static void __init tcb_setup_single_chan(struct atmel_tc *tc, int mck_divisor_id writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR); } -static const u8 atmel_tcb_divisors[] = { 2, 8, 32, 128 }; - static struct atmel_tcb_config tcb_rm9200_config = { .counter_width = 16, }; @@ -472,7 +475,7 @@ static int __init tcb_clksrc_init(struct device_node *node) goto err_disable_t1; /* channel 2: periodic and oneshot timer support */ - ret = setup_clkevents(&tc, ATMEL_TC_TIMER_CLOCK5); + ret = setup_clkevents(&tc, best_divisor_idx); if (ret) goto err_unregister_clksrc; From patchwork Thu Jul 23 15:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681235 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6655413A4 for ; Thu, 23 Jul 2020 15:30:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3EFEE20714 for ; Thu, 23 Jul 2020 15:30:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JpDaiUID"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MqR5dmPJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EFEE20714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Og7RZ8wNKu4Li/m+pqVTR/MV1GL+noTrGnPhT7SFiPQ=; b=JpDaiUIDQ2miQI4gZiqmMsv2R cSCejhPF/YAk334dQ556zmUW89yz+j6ofBfNi2OOp50CeFn8nt24l9NdlIm5wt8N36gnAjlzgThvY rrWYz9oMjDv6dMH6EgZrflnG/LGnpDoKjJx/Km/TKtq7jm8z+AOxpYz+8gBqqBNcMvegSBTe0QB4r 1CFj1p94z/OiFPD9zOPuAnvVN4asavBjvExc2n3xFiJ83q8ZgrEoBwgO74cfvyHWHddbNN35TZS0G bXJBc1dUdKKmW7tJOQlwVPAbzaTFw5KnrT9svMHC2WGp/31J56TwR89V5atKp59jfqYelrAyWEanZ FsGoG7UzA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9M-0008DT-R7; Thu, 23 Jul 2020 15:28:48 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7g-0007XJ-8S for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:06 +0000 Received: by mail-wr1-x442.google.com with SMTP id f7so5589917wrw.1 for ; Thu, 23 Jul 2020 08:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e0JbtEzkpaP5eGicuhoxIx9QkzOY7wkk6qcai0tP1vY=; b=MqR5dmPJKZt5Lk2FpnBD7WSKUc64KVMlhC8TpRuuc1fCQVK+ljTQjWIpP4o/fpD4xf g2QN937wYa9dtz2D23TXK5UXLLgxEcUIhiiF9D8+R2QonAWwNa1YErbAM9LbX4uoVBd5 bknzhLQfmWzQ+zM3iTrrBEQzlbZQjVa9f2Hhh3zN1r2PoGLM2qnRPlzGhkEJbZDnJukr CT4b6VRCt5Xjp1KwcFnxxLRDZqnGOaw2Bew9S9KMK8vrpe5gpDfpFq4EFIRal4MK6VDs cM2lmE5zK9LVDyWZJQRqQg/M+MoXpLnkdqy110RE/WpQXgfxIv2z8hV4l/D+OG8625Wm BbMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e0JbtEzkpaP5eGicuhoxIx9QkzOY7wkk6qcai0tP1vY=; b=k0HL2LA+lo0/zTM2QvKXK3MhWbxQuLgpDOm+QpcuKMVJQwZM3sGymyT/JCTi8cF9QB dh+mZkViEY1u6h+yUzx0czdWYfTPf4e/maSS5ZCPmxPtlsjK4+zGApOJSDamuQLbx8Fh jdXhC4l3VyM/Q6QxSLJEvmFWgjVlK3chnL+r7k5gSVI18DYaZCa9bW+Yl0XYTOcMvrBo rnE7WjvP6XwehXoEu8vgj5CytfsmsHF9enHRfrJNfGW2PF5oMUGzHCrxDOSff3A6qm7u 9Vye6yER5+DaQdiJ9se4eVKw1+TKmReMpxl8h+4f95OtXNRii/Iz+1vU6cfGfBRMAha1 0MCA== X-Gm-Message-State: AOAM530kqGGOhebzc3itT/mDeMt1gXFFt9EDNlqMxKA35GC/ZFhKntBc BjVAY/Q7AGX1o3A1+6/Nr1T8LA== X-Google-Smtp-Source: ABdhPJyqC+WdoaOrO38I8UGAoEbMymegflGpb1WsDygxY9WWLT9NW89KSD0qTRB+yk+7qRMD5LCbZw== X-Received: by 2002:a5d:5609:: with SMTP id l9mr4373612wrv.86.1595518023106; Thu, 23 Jul 2020 08:27:03 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:27:02 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 08/16] clocksource/drivers/timer-atmel-tcb: Allow selecting first divider Date: Thu, 23 Jul 2020 17:26:28 +0200 Message-Id: <20200723152639.639771-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112704_369084_002078D5 X-CRM114-Status: GOOD ( 11.35 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni The divider selection algorithm never allowed to get index 0. It was also continuing to look for dividers, trying to find the slow clock selection. This is not necessary anymore. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-9-alexandre.belloni@bootlin.com --- drivers/clocksource/timer-atmel-tcb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index 7a6474acc774..7fea134650fc 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -432,10 +432,8 @@ static int __init tcb_clksrc_init(struct device_node *node) tmp = rate / divisor; pr_debug("TC: %u / %-3u [%d] --> %u\n", rate, divisor, i, tmp); - if (best_divisor_idx > 0) { - if (tmp < 5 * 1000 * 1000) - continue; - } + if ((best_divisor_idx >= 0) && (tmp < 5 * 1000 * 1000)) + break; divided_rate = tmp; best_divisor_idx = i; } From patchwork Thu Jul 23 15:26:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11681233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CB73138A for ; Thu, 23 Jul 2020 15:30:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E77B220714 for ; Thu, 23 Jul 2020 15:30:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3RoZCmEX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OOg1f43G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E77B220714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Mr7iwRpfT4Di/dJF+cjIQfEt+J7SWk1MhG/7gyyUuo=; b=3RoZCmEXW6QlI/LAtDBubUobY IewKr4DTUmEFB0SAAFdfbSYyq5av+8ncqtDOCGRe34pVBMJwSbd0tp8LGurpcEJoOEgw+SkklGW4V lKvE3mTAN4ps96Gyd+qspGcJP5gCzHGTeIS2OARfa/3SrcrT7OuKtm9rHt5XVCZ9FI6Y+m6LGSNeM zza2AWSiEoE6nJanfL5pE6caaPimbfDI617f1v1pgP/UfVXKw/0PY7A2PbbNmLfQmNg+3t/m6AptS RnUhHI0Z0/fMzPwCVbJSzglDIlD4YNXIDVUJFlLKPLuLQh6aMYDy3pHFA3pC19mgRVtZMV/3nMwJh blg7LSAfg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd9U-0008Hw-R4; Thu, 23 Jul 2020 15:28:56 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyd7h-0007Y4-Cb for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 15:27:09 +0000 Received: by mail-wm1-x341.google.com with SMTP id c80so5345753wme.0 for ; Thu, 23 Jul 2020 08:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gT16S+wE9QP+Lpme4e1jgxInlD0M0uUa46Dg/gZiw4M=; b=OOg1f43G0/Boq4zjOO1Z381OJt14MPElkJJ6ldbqBbuoTC9fhJZGA3yDnmM95/n/7O pDdAajclwTkT1pQIg42a9a1qY5XBCIdofu2d0gGgNEfWv1Wdivb/YuXCY21uinty3DiC P1+yAP36cUUz+fQFtnR/jhbxIHAKWbNAHKXK/YsxVQgCHPNtIzD/gidu6IIKbmvi6j+i YCRGBtrS9vVSkrxhOpvzpN5THXNqYDZpMjeydx9SVHGlyuk/KNMMjhZ9GWu8F4LwfuMH yZrM6chFuRBiJJg3ceGRVvI8fVaOWDx2UsZw7Bq8yomd+bJHtgz3vKwAZcQ65d9ZAGgO dbwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gT16S+wE9QP+Lpme4e1jgxInlD0M0uUa46Dg/gZiw4M=; b=RfMrXxsqahI+9Mwa3w5BPnkwKNtGIhsqYw2d4atot6YOwhMwAVfChcjraZV+P9FoML CCwKbEk79d/iFVv5KUOjdxHJaGj86Mqt9qESFQZpxb5OpY5dyKRzroWwqi6mjwUJmDGX 5ROIcy04NrpJMXb+9YKeLZKTs2PhOvTy5kReQgXCUOJxiY5wd3Ar8P8TFjRPJzY+Qvtj 91QuJOdDZxlwXUHqCT9D6Ujn7ukvSkrfWqO0A3PnpBMic7Xdy64VBhBvuM0ZYGmeCmw+ kzc9+vnGqa+AVv+8Y3iLzEYeneD90prPnSOG69ryR+qya26saIoq8bFAtUyjuS4Aq30m qKyQ== X-Gm-Message-State: AOAM53015/O+wbaf5dBDI6c33DZm3pXb0OvGTQHsWmk6zVWzM3UEa9+f EfovAXP94oTp8I118ELbFU4LOA== X-Google-Smtp-Source: ABdhPJwY+1bzVpcKIe9+Fd1bx4mT//TJdWy4E/CueiOaDYHUQBR9iRc4PNZhj2N3QFJvjfFN+ZJvTA== X-Received: by 2002:a1c:28a:: with SMTP id 132mr4521810wmc.109.1595518024251; Thu, 23 Jul 2020 08:27:04 -0700 (PDT) Received: from mai.imgcgcw.net ([2a01:e34:ed2f:f020:dca7:8d30:33fa:daac]) by smtp.gmail.com with ESMTPSA id g145sm5963491wmg.23.2020.07.23.08.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 08:27:03 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Subject: [PATCH 09/16] clocksource/drivers/timer-atmel-tcb: Add sama5d2 support Date: Thu, 23 Jul 2020 17:26:29 +0200 Message-Id: <20200723152639.639771-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200723152639.639771-1-daniel.lezcano@linaro.org> References: <1b1122f4-bce9-f349-e602-ed8e14cbb501@linaro.org> <20200723152639.639771-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200723_112705_494319_E367C45C X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Ludovic Desroches , "moderated list:ARM/Microchip AT91 SoC support" , "open list:CLOCKSOURCE, CLOCKEVENT DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Alexandre Belloni The first divisor for the sama5d2 is actually the gclk selector. Because the currently remaining divisors are fitting the use case, currently ensure it is skipped. Signed-off-by: Alexandre Belloni Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200710230813.1005150-10-alexandre.belloni@bootlin.com --- drivers/clocksource/timer-atmel-tcb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index 7fea134650fc..787dbebbb432 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c @@ -359,9 +359,15 @@ static struct atmel_tcb_config tcb_sam9x5_config = { .counter_width = 32, }; +static struct atmel_tcb_config tcb_sama5d2_config = { + .counter_width = 32, + .has_gclk = 1, +}; + static const struct of_device_id atmel_tcb_of_match[] = { { .compatible = "atmel,at91rm9200-tcb", .data = &tcb_rm9200_config, }, { .compatible = "atmel,at91sam9x5-tcb", .data = &tcb_sam9x5_config, }, + { .compatible = "atmel,sama5d2-tcb", .data = &tcb_sama5d2_config, }, { /* sentinel */ } }; @@ -426,7 +432,10 @@ static int __init tcb_clksrc_init(struct device_node *node) /* How fast will we be counting? Pick something over 5 MHz. */ rate = (u32) clk_get_rate(t0_clk); - for (i = 0; i < ARRAY_SIZE(atmel_tcb_divisors); i++) { + i = 0; + if (tc.tcb_config->has_gclk) + i = 1; + for (; i < ARRAY_SIZE(atmel_tcb_divisors); i++) { unsigned divisor = atmel_tcb_divisors[i]; unsigned tmp;