Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp344921pxb; Tue, 9 Feb 2021 01:40:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWOqHeNGmUwMPRPh+/2UPUKExfFYDDflM4MJbMfnRkeQM2Yv5/nL4bVHYBTmpwg/TSW3VV X-Received: by 2002:a17:906:4712:: with SMTP id y18mr21645592ejq.529.1612863612551; Tue, 09 Feb 2021 01:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612863612; cv=none; d=google.com; s=arc-20160816; b=qK7kZyxNcEVY6XFiMzFijMCMk2LTx96LsowtJzPb1tcW/ZcdDP5g1trRIYhj2jlG6Y 5o/JrvTHEtD2NKtYUvg6JASpCRVFfn4ZwQrX6U4KSJy9tC1wc6XQKsk+vi6ltVMrTIQ8 KK/ytfqIiTnpGefNzRGJRLcEQpEzkuR7bteWO6U/ONo5a1cDn+xvE3bUAkgA2iGpXev2 us+8rz7w4ZgLiLHp4Bj1Lk4YCyGSKw8Lz8MugMf71A09AcKW2jDPyHnKgmSi+gwF2S2w mxFIXA3xVD99D16bw6wE7B4bQJFCtIeZ04W3I3+NF3C1eAHbKM1vRGdFpythWRF+ZzNV 8Apg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=W66OqelSmAEZw3y82aKk9YmHNIU7YjCY/sLU6awVEFs=; b=i2LZeaPa116BVuzt0aZUenA1AiRoN/Sv/kvj8MtWSbOxmnd6xpNgjep5W4xRg00mrC VWLJdyKYkX+IHYidCx54sHbVyB7DoV+RkuOrhaoAEacUa09WYBAgj+QyCQ6OrZCtfu2d AJOf2a7wkrFjQQU/53/KOtzVFWVltM8aviS6X8DxQIcyHrwXO7LsIEmExQsMBVtZdxV6 s07Sk1xZOSYT768bmXb4+ltbaP37ihyZ91W3q0ztiOp1t20Pew4iVhy2E1e0wvWcnths QjOCNiSesSPHBZ8usIO8MQpIzR5K7RMQG4FI+YK7x40N5YE43Z3poP9EGhzTrUEhZ1Ld rJHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs7si4050466ejc.128.2021.02.09.01.39.48; Tue, 09 Feb 2021 01:40:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbhBIJhn (ORCPT + 99 others); Tue, 9 Feb 2021 04:37:43 -0500 Received: from mail.loongson.cn ([114.242.206.163]:34836 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230204AbhBIJd3 (ORCPT ); Tue, 9 Feb 2021 04:33:29 -0500 Received: from localhost.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxSdSoViJgw40IAA--.11028S5; Tue, 09 Feb 2021 17:32:33 +0800 (CST) From: Qing Zhang To: Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , Marc Zyngier , Huacai Chen Cc: devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang , Xingxing Su Subject: [PATCH 3/6] MIPS: Loongson64: Add support for the 2K1000 to get cpu_clock_freq Date: Tue, 9 Feb 2021 17:32:21 +0800 Message-Id: <20210209093224.7085-4-zhangqing@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210209093224.7085-1-zhangqing@loongson.cn> References: <20210209093224.7085-1-zhangqing@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9AxSdSoViJgw40IAA--.11028S5 X-Coremail-Antispam: 1UD129KBjvdXoW7Xr1UGr13CF1kJryrtw1kKrg_yoWDJFc_Ka 4Iy3y8GryfJ3WIkFW7Xr45Xry293y8CF4xuFnIyr1Sqa4vv3sIga1kJw17GF43Cw4FkrWr WFZ5Ar48Cr47GjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUby8FF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWwA2048vs2IY02 0Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84 ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r106r15McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY04 v7MxkIecxEwVAFwVW8uwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC2 0s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI 0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv2 0xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2js IE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZF pf9x0JUfpnQUUUUU= X-CM-SenderInfo: x2kd0wptlqwqxorr0wxvrqhubq/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get the fixed-clock from the CPU0 node of the device tree. Signed-off-by: Jiaxun Yang Signed-off-by: Qing Zhang Signed-off-by: Xingxing Su --- arch/mips/loongson64/time.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/mips/loongson64/time.c b/arch/mips/loongson64/time.c index 91e842b58365..45698b18f4ae 100644 --- a/arch/mips/loongson64/time.c +++ b/arch/mips/loongson64/time.c @@ -11,9 +11,23 @@ #include #include +#include +#include void __init plat_time_init(void) { + struct clk *clk = NULL; + struct device_node *np; + + of_clk_init(NULL); + + np = of_get_cpu_node(0, NULL); + clk = of_clk_get(np, 0); + if (clk) { + cpu_clock_freq = clk_get_rate(clk); + clk_put(clk); + } + /* setup mips r4k timer */ mips_hpt_frequency = cpu_clock_freq / 2; -- 2.20.1