From patchwork Tue Sep 1 10:32:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1354887 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=eZKcf2Vx; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bgk1T5b0kz9sR4 for ; Tue, 1 Sep 2020 20:33:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3951822C0; Tue, 1 Sep 2020 12:32:24 +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="eZKcf2Vx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A57638228C; Tue, 1 Sep 2020 12:32:21 +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 0A141806C5 for ; Tue, 1 Sep 2020 12:32:19 +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 w186so430971qkd.1 for ; Tue, 01 Sep 2020 03:32:18 -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=eZKcf2VxX3JZHkojNmmsm2WaiV02mAar5Vs7Ay/y350qCDOUqgTs5ILNWnjUp8Stjn 9NX/7fsfmO9JO9uxzA7lvFjZoVO8c0Nc9O5WaU6oG5Az4eelAyqv53mOGBZBWbicVHPN l9vLqdpQE+1+Hp41DcSQ952EP4GL4L3XTy3KZVCStynB2G79OfRkLLLcxYxzCbeLtn+F F2koJLiNgS8KBxy3G8bqnAXi6fRPA1rkJtnOsUSXjhR/hUW2U/ziFGpLhDEvMFU9ERAH +Y01nLFvZJkSTnZoMSIWGctTs9FIebDVdqm/xuPfAdGW25oD29GJXu0fGE6erC6qPNZb +BbQ== 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=QuGgLXbhrHMAWVTk9iGwG1rFONBukhc5qw5j6lH0CWgF5jFovY+VtPXE7RV16lRnDx +CcW5UgJNpEPIDKdzOjvpKERwtm+FR7noe4NRBpIsznXZ7iIQWlYQzzylLs4iQaym83X rkOmCGmw8pWrPT2S/vis3oLrRPST6ZP/eFsDU6j/LLMlR31PfeLLbwic4eORatlLAuBW rlz6Lf7XXOeRhRaOFy/ZdL/AyEDWIoCVJOl7d+07x3/lXPa4m8rVYN3bYugNfpD5AWlH O/Uk7Oa87ueVEE4zCt4x8cnyauL1ZVDhIofWmAeu1mOC4NgnQI0yl5awKW5JzFwgMhVF DGEw== X-Gm-Message-State: AOAM532M33OwXc4NbhI2EKFV8vLtb5IjZw1THxOIq4c//dZAvmriykFv nO3ExVKa1Zhcqaz8gos3Mrc/gejDv9imcQ== X-Google-Smtp-Source: ABdhPJyLSPxKlkCz+k++kxvY3IffH4vq2qURfNpHCapnTrdqc2TfAII53OcNZkUB+Np4fuZYKfFhEQ== X-Received: by 2002:a37:a1cb:: with SMTP id k194mr574299qke.354.1598956337805; Tue, 01 Sep 2020 03:32:17 -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 q190sm1080348qkf.20.2020.09.01.03.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 03:32:17 -0700 (PDT) From: Sean Anderson To: u-boot@lists.denx.de Cc: Rick Chen , Bin Meng , Pragnesh Patel , Sean Anderson Subject: [PATCH v3 5/7] riscv: clk: Add CLINT clock to kendryte clock driver Date: Tue, 1 Sep 2020 06:32:06 -0400 Message-Id: <20200901103208.440316-6-seanga2@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901103208.440316-1-seanga2@gmail.com> References: <20200901103208.440316-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 */