Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2849289lqp; Mon, 25 Mar 2024 10:57:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWbkvLqzT8tdX2K8Mgpb52lqGffCyUJFE7LWLfcuqxRVNJ9vwkaoKHIEAEhzLmtHr5e1W47qpLwGgVwSxBBMaqYkRFol0ahyVWFiOoI4A== X-Google-Smtp-Source: AGHT+IG/xCQg3jWUO44td4rSO4WK+lrBYnCEk4hBSsq1QkF4MSKC7Uf4pgNDqojsxXMBKrqXHUq2 X-Received: by 2002:a05:6a00:4fc9:b0:6e6:f1f0:c55d with SMTP id le9-20020a056a004fc900b006e6f1f0c55dmr9499448pfb.4.1711389465145; Mon, 25 Mar 2024 10:57:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711389465; cv=pass; d=google.com; s=arc-20160816; b=RlM7GpznAZ+MbjBJI2LZ2GRlDk7NJWBlsMMJxpKioDrvyeeK2J5oy5VsSCBDyURAx0 yQ1WMpo9WuB1RA81vgYvZ6qBFPj7qt2rbPlIEraBnXSiRu2Vq59j4FBtUAew3B/vo/us mByR55jifhLBsGp555FFqRZzgb8YAxdpX75QTtdJg/A/aALaoD9TO0+c+FajXWLlAFCS y4Fj7mVRXp+Tba8cM9DNbQnsGNt1amBYjZgby+maDhvoWASOQYLwST1vYiWlaJcZYcmS XpGxgbFgkMD9eUNvTDlOfV7HzFqH5qKcXnH70RlQC6TPvNQZtyoCFVyIRbKOT8WfY+Rq yhaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8VgjFyENrjz4sk+58EG91HGD3LT4yC3pdjgvzNEOBy4=; fh=m+lkMSgpAsPrsBPjNkIveMqClHfEKCUqtpjmyG590AA=; b=THebtXc85dqX7tl5Jay3HGVxCpstHB40Cje9aFbSrc6dJ2CjduhV0QPebIsV/4X68f mtOuIwega7dQQVDFsbnPlpq5aQPfeRQuHSDfndUG5iK02Gez+80XlhW2TO/VLST9VfHV iRlsq62pmyIGPtc6ulAYpbde/xC3Izajgoa7UXQUJKQiK9NCzbYgjOEjH7RodPXTv+GK iPyOJRhPkWyz9vdx/LvN1KsemO+m6NqVfmGkroCGkguaOuPG8oiEuKXPkahUJXL/+8JT 4NfjOqsqhJWoH/Ti4McTN/9Hm4AJxjZkicxKAqftKFV5Y4AEHrMPN7LlPLd6GsRWSyb6 l3Bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ibllFgBo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117534-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r15-20020aa7988f000000b006e5799cefc4si5518252pfl.314.2024.03.25.10.57.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ibllFgBo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117534-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2647B29C3C3 for ; Mon, 25 Mar 2024 17:49:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70E3C4C600; Mon, 25 Mar 2024 17:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ibllFgBo" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D44D3DBBC for ; Mon, 25 Mar 2024 17:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386221; cv=none; b=hOguBi/QSenRf+oP1lFsj4QWWErslRwSBzJVIT9Jfzyzpbk6FiGPMoSj5pFLDelTeCOG2PmOZ5ATnzge9NMHIv6uLRTwyIgWGkNRStEwcI3Q1rogXIni95bMBqOF6x7wu4YTH1ofoZjhc02yiiG2sxM1aFPyd98a2kQ2r3Jk0bw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711386221; c=relaxed/simple; bh=z/jh+93zuvKqVIQ98MxaG5F4d3axg0Y13zwiWvCIOg8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HL/xLY/4HXQeodmW8H3Bng+vM3wcmZIbIyVnhnaPfxSBPkZ7kxyG02OX5OGc0jYhOWnN4lXneBpcdUqTRL3T9fkT49azC2mGZx99odYahj7aYX4oSgU7utJIPJBuAWQ6WqERGhJIjHwzd5XWWkbXqm5XZkyWbNhnjL6hM2fhh+4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ibllFgBo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9590AC433F1; Mon, 25 Mar 2024 17:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711386221; bh=z/jh+93zuvKqVIQ98MxaG5F4d3axg0Y13zwiWvCIOg8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ibllFgBos5TkeQY0PYTM1ISTnrSacPHTnQzJ956kmpo5PD14ze3eBNhs4ozn9Rx5D rvzt+0JS0lzQyPPLsL0k/BpjypqND0jxIEr2P/fDBujybNLLGZ4H9yrstHvLwm3tfE oJaHw47t+yvIzTlg3EPJZ2Q0j2Q8Bx9Hudgm8mcRHIkT3kKn1vWP4zdIRHvnyl9PV7 OMwt7BEl44CdyBkmfs7apSOHJ8WDgNIHPq+QoezOzmO1XsXaAC8LGPkCcLJvSgdK+8 FxFJI+7f2GhK/KW+M+gQAw0Kr9j4a+mfHH0sB/S7A39SoCnypVlaeoAwL6dJ/YDVwd t7TZay50Xoxog== Date: Tue, 26 Mar 2024 00:50:14 +0800 From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Daniel Lezcano , Thomas Gleixner Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] clocksource/drivers/timer-clint: Add T-Head C9xx clint support Message-ID: References: <20240325164021.3229-1-jszhang@kernel.org> <20240325164021.3229-6-jszhang@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240325164021.3229-6-jszhang@kernel.org> On Tue, Mar 26, 2024 at 12:40:21AM +0800, Jisheng Zhang wrote: > The mtimecmp in T-Head C9xx clint only supports 32bit read/write, > implement such support. > > Signed-off-by: Jisheng Zhang > --- > drivers/clocksource/timer-clint.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer-clint.c > index 4537c77e623c..71188732e8a3 100644 > --- a/drivers/clocksource/timer-clint.c > +++ b/drivers/clocksource/timer-clint.c > @@ -34,6 +34,7 @@ static unsigned int clint_ipi_irq; > static u64 __iomem *clint_timer_cmp; > static unsigned long clint_timer_freq; > static unsigned int clint_timer_irq; > +static bool is_c900_clint; > > #ifdef CONFIG_SMP > static void clint_send_ipi(unsigned int cpu) > @@ -88,6 +89,19 @@ static int clint_clock_next_event(unsigned long delta, > return 0; > } > > +static int c900_clint_clock_next_event(unsigned long delta, > + struct clock_event_device *ce) > +{ > + void __iomem *r = clint_timer_cmp + > + cpuid_to_hartid_map(smp_processor_id()); > + u64 val = clint_get_cycles64() + delta; > + > + csr_set(CSR_IE, IE_TIE); > + writel_relaxed(val, r); > + writel_relaxed(val >> 32, r + 4); > + return 0; > +} > + > static DEFINE_PER_CPU(struct clock_event_device, clint_clock_event) = { > .name = "clint_clockevent", > .features = CLOCK_EVT_FEAT_ONESHOT, > @@ -99,6 +113,9 @@ static int clint_timer_starting_cpu(unsigned int cpu) > { > struct clock_event_device *ce = per_cpu_ptr(&clint_clock_event, cpu); > > + if (is_c900_clint) > + ce->set_next_event = c900_clint_clock_next_event; > + > ce->cpumask = cpumask_of(cpu); > clockevents_config_and_register(ce, clint_timer_freq, 100, ULONG_MAX); > > @@ -233,5 +250,12 @@ static int __init clint_timer_init_dt(struct device_node *np) > return rc; > } > > +static int __init c900_clint_timer_init_dt(struct device_node *np) > +{ > + is_c900_clint = true; > + return clint_timer_init_dt(np); > +} > + > TIMER_OF_DECLARE(clint_timer, "riscv,clint0", clint_timer_init_dt); > TIMER_OF_DECLARE(clint_timer1, "sifive,clint0", clint_timer_init_dt); > +TIMER_OF_DECLARE(clint_timer2, "thead,c900-clint", clint_timer_init_dt); oops, this should be "c900_clint_timer_init_dt", will update in v2. > -- > 2.43.0 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv