Received: by 10.213.65.68 with SMTP id h4csp1310763imn; Mon, 19 Mar 2018 00:01:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELsGEGT13ZHMMbdw/IKjHwIkPLLBwWxJtWaz/mRYWrIsbX3OYG3NUkBZ5uDO6ltJTrMSXiV2 X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr7706861plm.160.1521442906202; Mon, 19 Mar 2018 00:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521442906; cv=none; d=google.com; s=arc-20160816; b=lUX90lUHgIpYlRhuzX7a+46Lcki/CSNKAIitNCPLuAAGkWAVOnRUB53F1wWPPQ1Ezj dXdVJkip4nKZ8JrXesV0ZfsoRLOo6aXBbKkQJG7nmDDvv8pYfz4tMHJEuHQ0ZDJ/JbT9 eAVLr5s+vAn3nBy7Rw7q87ttqB963tmGHOEwviC02QnX8vEKMOxO5vrjAIc/QYhwZplO zOvfwdnwGolnuQqFdxUO/rGuJwlN/jmwGgHoCRNBAw/WuPuBXmdywDfYdiJeAhFZWyYw E1rbsz+5BgYG+TQ4pmclIhD5cnsGAT3iEIabNO/WRu+Dzec+nnRAXIok1TPHCezWjiZH RKAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=l70OfMiX1tB7Uu8mvZaZZO5kuXYe7m1j7ejcRQKbXXQ=; b=leWEIIisUgcaGHMR8FfLxmidlBTy0xa+p1qkfuakpgZTXLGtuaEKqdYY6mvgktQu83 TT5NFil4cWrooQBHNif++ihM+0ZsTMHBW71CKIXewD4Ryn0a71Grur1ZkeoLRpLaBrku ZmlRKH9+LFAH+rK6merb7g/qAG7Bs9q3QN/sGoor9BqauEt0ps70RhE4byxy0srJotrf AsJ9vmZavhpIwYt9ao2t/k+JTjJMvSikXMqV9u1RIcpbrxV3EBcexI9L0zQu52AIpiuZ icOxudw7G7jEmC6i5FBRJKgsS+0Wlhpsf74a/GuiXf/y0hgtcBcS0TxrMzp467DVlc0G CJyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si12025976plb.316.2018.03.19.00.01.32; Mon, 19 Mar 2018 00:01:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755252AbeCSHAX (ORCPT + 99 others); Mon, 19 Mar 2018 03:00:23 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:38552 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbeCSHAW (ORCPT ); Mon, 19 Mar 2018 03:00:22 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.02656576|-1;CH=blue;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07423;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=10;RT=10;SR=0;TI=SMTPD_---.BMa7W3w_1521442792; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:223.93.147.148) by smtp.aliyun-inc.com(10.147.42.198); Mon, 19 Mar 2018 14:59:52 +0800 Date: Mon, 19 Mar 2018 14:59:52 +0800 From: Guo Ren To: Daniel Lezcano Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, jason@lakedaemon.net, arnd@arndb.de, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org Subject: Re: [PATCH 18/19] clocksource: add timer-nationalchip.c Message-ID: <20180319065951.GA21923@guoren> References: <04f5a0702fc14e934e6f5a456cad8682d0b15aa2.1521399976.git.ren_guo@c-sky.com> <17200f94-9684-2600-a36e-a42a2d53ed70@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17200f94-9684-2600-a36e-a42a2d53ed70@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Sun, Mar 18, 2018 at 11:07:12PM +0100, Daniel Lezcano wrote: > > This patch is a new driver. Please add the hardware details of this > timer and optionally a link to the documentation. No need to write a > book, just a quick summary of it. > OK > > +#include > > +#include > > +#include > > sched ? param ? > I'll cleanup the headers. > > +#include > > +#include > > +#include > > profile ? > I'll cleanup the headers. > > +#include > > +#include > > +#include > > rtc ? sizes ? > I'll cleanup the headers. > > +#include > > +#include > > +#include > > +#include > > +#include > > Is the delay API defined for this architecture ? I don't see it used below. > I'll cleanup the headers. > > +#define NC_VA_COUNTER_3_CONFIG (void *)(timer_reg + 0xa0) > > +#define NC_VA_COUNTER_3_PRE (void *)(timer_reg + 0xa4) > > +#define NC_VA_COUNTER_3_INI (void *)(timer_reg + 0xa8) > > + > > +static unsigned int timer_reg; > > + > > +static inline void timer_reset(void) > > +{ > > + __raw_writel(0x1, NC_VA_COUNTER_1_CONTROL); > > + __raw_writel(0x0, NC_VA_COUNTER_1_CONTROL); > > + __raw_writel(0x3, NC_VA_COUNTER_1_CONFIG); > > + __raw_writel(26, NC_VA_COUNTER_1_PRE); > > Why are you using the __raw_writel instead of writel ? > > No values, explicit macros please. > OK > > +} > > + > > +static irqreturn_t timer_interrupt(int irq, void *dev_id) > > timer_interrupt is a too generic name, at least nc_timer_interrupt would > be more accurate. > OK > > +static u64 notrace nc_sched_clock_read(void) > > +{ > > + return (u64) __raw_readl(NC_VA_COUNTER_2_VALUE); > > +} > > + > > +static void nc_csd_enable(void) > > Can you choose a more explicit name than 'csd'? > OK, change to nc_clocksource_dev_enable > > + /* setup irq */ > > + if (request_irq(irq, timer_interrupt, IRQF_TIMER, np->name, &nc_ced)) > > + panic("%s timer_interrupt error.\n", __func__); > > Replace the "clock-frequency" property to a clock phandle and use the > timer-of API. > > That will result on something like that: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/timer-sprd.c#n124 > > No panic in init function. > OK > > + /* register */ > > + clockevents_config_and_register(&nc_ced, freq, 1, ULONG_MAX); > > + > > + nc_csd_enable(); > > + clocksource_mmio_init(NC_VA_COUNTER_2_VALUE, "nationalchip-clksource", freq, 200, 32, clocksource_mmio_readl_up); > > s/nationalchip-clksource/nationalchip/ > > line wrap > OK > > + sched_clock_register(nc_sched_clock_read, 32, freq); > > + > > + return 0; > > +} > > +CLOCKSOURCE_OF_DECLARE(nc_timer, "nationalchip,timer-v1", nc_timer_init); > > s/CLOCKSOURCE_OF_DECLARE/TIMER_OF_DECLARE/ > OK Best Regards Guo Ren