Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3849389rwd; Sat, 3 Jun 2023 13:21:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7VFqUZ0YFU2vKvO9KueTN6ioljJXqLxokYM/UvmQbABgvHZyzpLXkxO3YbteSTf8i8mMmA X-Received: by 2002:a92:db51:0:b0:330:f7b3:ead with SMTP id w17-20020a92db51000000b00330f7b30eadmr13794460ilq.12.1685823694880; Sat, 03 Jun 2023 13:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685823694; cv=none; d=google.com; s=arc-20160816; b=IW4Sc0iH2D/wA7cDfvADyq+fr1OAAfyPPLtKfuXYHDdD08PGAFcng+U3Sj+tRqe7pO mHLvyofIgbvYAX+b41vVKoYaznWwEyBZYztg9UIndjGks4x78I90/T9kQrbz+sDT3RQ4 u+VAlRcuS9FNPdLcE1Q/gsMtxliLXZNuK/yUwXqTSPthGoVAZQ+C0WpDWaG8T5DF4r9b LOSlt3VA0M1SwviXPbSUjSNUp3rPUho2ylQMrwYlZMja4LmcfTDC4o8lCHEAo4IKq23k fthBuPqjm1UG2Ck3eKYncOlU5zullN81VMLMJ48yXWjtVzwIeghw8r9wOyq1VYP2oQ+J PHJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=wFt6SFE3KP4wLn8+UfGgLHBKS6yDCqq/iEJN85NRq5I=; b=o4tbZWBrSBZJXu+pYG7D3JXNUKM9LyN1NtiQMZZ8ijtatMMuXQsPSCbMmzy8IZkeL7 /y+ph1snZ0sIJOIHSM85MMw3cx9QgkzaqNPmyU9eZwdWV99WN+oS4tauB5PEkEkcSsAv fkcAjxE9LvD8kS9iBttnoB9iAqPUeIPJ8SIGwqACc+yGIqy1gCakeSrBF+l7Sa27FW6x GVBmOCIwXJ/Fa+T8YbQexLpQyFP17dOu+GVKod9AfKOmA5EU24jzqO8aK1SuIi0UxXe8 soa3TE82JjT6a1waXuWO3Rf8R32Z1D9URdwEut8/twQOB2ONppJgpipgtiiwsNQ4Vs4I cPFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv128-20020a632e86000000b0050fb1a00d3dsi3142852pgb.46.2023.06.03.13.21.21; Sat, 03 Jun 2023 13:21:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbjFCUIm (ORCPT + 99 others); Sat, 3 Jun 2023 16:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230521AbjFCUID (ORCPT ); Sat, 3 Jun 2023 16:08:03 -0400 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2582E4C for ; Sat, 3 Jun 2023 13:07:34 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 2144f3fc-024a-11ee-a9de-005056bdf889; Sat, 03 Jun 2023 23:06:30 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Sat, 3 Jun 2023 23:06:30 +0300 To: Nikita Shubin Cc: Alexander Sverdlin , Arnd Bergmann , Linus Walleij , Daniel Lezcano , Thomas Gleixner , Michael Peters , Kris Bahnsen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 09/43] clocksource: ep93xx: Add driver for Cirrus Logic EP93xx Message-ID: References: <20230424123522.18302-1-nikita.shubin@maquefel.me> <20230601053546.9574-10-nikita.shubin@maquefel.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230601053546.9574-10-nikita.shubin@maquefel.me> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thu, Jun 01, 2023 at 08:34:00AM +0300, Nikita Shubin kirjoitti: > This us a rewrite of EP93xx timer driver in > arch/arm/mach-ep93xx/timer-ep93xx.c trying to do everything > the device tree way: > > - Make every IO-access relative to a base address and dynamic > so we can do a dynamic ioremap and get going. > - Find register range and interrupt from the device tree. ... > +config EP93XX_TIMER > + bool "Cirrus Logic ep93xx timer driver" if COMPILE_TEST This is strange. What do you gain with this "if COMPILE_TEST"? > + depends on ARCH_EP93XX > + depends on GENERIC_CLOCKEVENTS > + depends on HAS_IOMEM > + select CLKSRC_MMIO > + select TIMER_OF ... > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include Can you keep that ordered? Missing bits.h. + Blank line. > +#include ... > +/* This read-only register contains the low word of the time stamp debug timer > + * ( Timer4). When this register is read, the high byte of the Timer4 counter is > + * saved in the Timer4ValueHigh register. > + */ /* * Wrong multi-line comment style. * Use this example, for example. */ ... > +static struct ep93xx_tcu *ep93xx_tcu; Global?! Can it be derived from struct clocksource? ... > +static u64 ep93xx_clocksource_read(struct clocksource *c) > +{ > + struct ep93xx_tcu *tcu = ep93xx_tcu; > + u64 ret; > + > + ret = readl(tcu->base + EP93XX_TIMER4_VALUE_LOW); > + ret |= ((u64) (readl(tcu->base + EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32); GENMASK() Why you are not using non-atomic 64-bit io accessors? Becomes as simple as return lo_hi_readq() & GENMASK(); > + return (u64) ret; Redundant casting. > +} ... > + irq = irq_of_parse_and_map(np, 0); > + if (irq <= 0) { > + pr_err("ERROR: invalid interrupt number\n"); > + ret = -EINVAL; Shadowed error in case of negative returned code. Why? > + goto out_free; > + } ... > + clockevents_config_and_register(&ep93xx_clockevent, > + EP93XX_TIMER123_RATE, > + 1, > + 0xffffffffU); UINT_MAX? GENMASK() ? ... > + Redundant blank line. > +TIMER_OF_DECLARE(ep93xx_timer, "cirrus,ep9301-timer", ep93xx_timer_of_init); -- With Best Regards, Andy Shevchenko