From patchwork Wed Sep 9 20:09:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1361015 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=kOzgLGVx; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmtSP3GH0z9sTK for ; Thu, 10 Sep 2020 06:11:01 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 10615822FF; Wed, 9 Sep 2020 22:10:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kOzgLGVx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3699822D2; Wed, 9 Sep 2020 22:09:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 370988158B for ; Wed, 9 Sep 2020 22:09:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qk1-x742.google.com with SMTP id w186so3754507qkd.1 for ; Wed, 09 Sep 2020 13:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GdDDeQuHIwps9ZrFnwDjof7F6xk3pLbiKjZ8GijAJWc=; b=kOzgLGVxlOcCH8L98BxvNTFhCLo8VTKazjRcSqw49sVC7kbkVgnXMJqPk1ib3CT4Kw AK+bCNhWacsMIf+YqtXRHrToqVBzVK6oeNKO3/LP3/NyvaS2sdQPbjXpEF50OFygTpYN NHOLftgxAcDIvoaBbo5p17dmJ9F7AjGInyxZI+gTjb/Ii9ltvQiHMUecR1er2j/toOZZ UnJK+QtxNdOACLb6xQAjgd60p97AKNsF8CcOZDljVZvUiREbpcBu6AXivzaRDY8w3ay0 4UA8XLSiGnqzE34PgngJ8BheGcU6z86aY0gvukHlo3z9ObhCT2kSrJUh3ioWYH5L7i+7 j13Q== 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=GdDDeQuHIwps9ZrFnwDjof7F6xk3pLbiKjZ8GijAJWc=; b=GPbrtDgARHho9B5aiMSpKFu6IQNMG83htKwhYm4ODQ1TxQceMUqmCtlGffcC6xeSgs s7yHY4uT9uXjK/ZF4joZqh2yyAYIyXa20OUeUFFB7elLDT7C4zNnGtomTyQ8fvzIGps2 3nzZExnFf1M41n2gF66h2FofFi8OmaFxZt6Tmkl5dNT/u8DkXu2BogPJff9dp7I9DJBX uUu64z7l0o280HUJclOYaHPn2drhuk+qLtaYcMULoNDw/m6S+YOEQpNA5rqVk5Knlf3X QB1zA9agooolYrr0s11T41HBD2AOc1juPwaXFe0xY3w6ULEIFp4ar55BglZBWaH9eN7n gnwQ== X-Gm-Message-State: AOAM532iNBrd5SBOEVzP087E8mZp0a1Qj5urQxwRVt+AaCO4Drw1iu7Z LJPgsOHjM77Kv+Ldtqs0f6WMmnznElOgq1iQ X-Google-Smtp-Source: ABdhPJzCPfIy9WISVVWRWgM+mbmQ+iHIueuaItyE91MiXb2sIsoAWt3rPkzm24ewLoEx29XhPUPecw== X-Received: by 2002:a05:620a:4d0:: with SMTP id 16mr4696639qks.200.1599682191947; Wed, 09 Sep 2020 13:09:51 -0700 (PDT) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id s30sm4342831qth.65.2020.09.09.13.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 13:09:51 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de Cc: Anup Patel , Pragnesh Patel , Bin Meng , Rick Chen , Sean Anderson Subject: [PATCH v4 6/8] riscv: clk: Add CLINT clock to kendryte clock driver Date: Wed, 9 Sep 2020 16:09:28 -0400 Message-Id: <20200909200930.232174-7-seanga2@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200909200930.232174-1-seanga2@gmail.com> References: <20200909200930.232174-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Another "virtual" clock (in the sense that it isn't configurable). This could possibly be done as a clock in the device tree, but I think this is a bit cleaner. Signed-off-by: Sean Anderson --- checkpatch still complains about this one, but I don't see any reason to break it up even further. It doesn't make sense to me to split the header file change from everything else. (no changes since v2) Changes in v2: - Split Kendryte binding changes into their own commit drivers/clk/kendryte/clk.c | 4 ++++ include/dt-bindings/clock/k210-sysctl.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/clk/kendryte/clk.c b/drivers/clk/kendryte/clk.c index 981b3b7699..bb196961af 100644 --- a/drivers/clk/kendryte/clk.c +++ b/drivers/clk/kendryte/clk.c @@ -646,6 +646,10 @@ static int k210_clk_probe(struct udevice *dev) REGISTER_GATE(K210_CLK_RTC, "rtc", in0); #undef REGISTER_GATE + /* The MTIME register in CLINT runs at one 50th the CPU clock speed */ + clk_dm(K210_CLK_CLINT, + clk_register_fixed_factor(NULL, "clint", "cpu", 0, 1, 50)); + return 0; } diff --git a/include/dt-bindings/clock/k210-sysctl.h b/include/dt-bindings/clock/k210-sysctl.h index 0e3ed3fb9f..fe852bbd92 100644 --- a/include/dt-bindings/clock/k210-sysctl.h +++ b/include/dt-bindings/clock/k210-sysctl.h @@ -55,5 +55,6 @@ #define K210_CLK_OTP 43 #define K210_CLK_RTC 44 #define K210_CLK_ACLK 45 +#define K210_CLK_CLINT 46 #endif /* CLOCK_K210_SYSCTL_H */