Received: by 10.213.65.68 with SMTP id h4csp611399imn; Wed, 28 Mar 2018 09:27:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx498IFIddm41ezBkt+XiUIEv3Zoj6dD4fO2dEuYRbhkr/q3ocmjWx8xCCtFtpgHFnmomSEr6 X-Received: by 10.99.47.4 with SMTP id v4mr3105701pgv.42.1522254439871; Wed, 28 Mar 2018 09:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522254439; cv=none; d=google.com; s=arc-20160816; b=Ad5XfTzvsnKmu5NowacDqBBsO/P2t5aLlGponjEthfkDP0yEIqnXp4ue7Jy8XVSPWo 8kSJOfMeQQeyQ/W6frk6UywN15H4yYFlUhcCl+eom7K2cyEpbuAE5cBUhScarUYBjudL G4sLQlN2VcHliVjDPFCSV/wAp0PFuQEzlwz8oegs3wfulSQdHh3eqPFqUkTyvnNXYRuy oNcDYFOEP5MImkf9D0TDzgVTfj0A8jQzFDK7pQgwDV6gHK5v4Dkoob43UYv/DieLk+GK bisCl6XPy/xAsbnePvyuncKYcIKIfXyyxKHYN/386Ws8t1ZcSKVX9ZEteNXHiy/WSxZb EvWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=BXKDMJG3JeCpej2WnLf9wqzx5IMUXIkH5dpeKYi6VvU=; b=PMFKtb2fiaH0AYXk/ARDb4FddIn/dLr/zKlXhboRwfG/pFwxfgHyrrEkTZCF24RaDI Eqz/JYwmbo7dYo76SG+I9c24vr4dgSjkLwGFsqL3y1ntRsmrtU+ecXG6c+Nq6huBla5c pATek1wWHCa/pz8kSNQlSNhvH0NZIN2fUUVZI3VCK95XkjCBErZv5xHOhp204QtS5M9n UQ3IuxxWkm/eoU0SbUWC8YLtdvUd0JWOWLrNOOyaGNs0NJ4QSbBbeWqgow51E49xCYtT 04gxb2J9vrxUodQP4PpLWAzLDePWWO+Rc7UycbBifyfxa699CrZMbPw9ydVsMAuL1Oyb CL3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A20CcuIN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj1-v6si3822824plb.663.2018.03.28.09.27.05; Wed, 28 Mar 2018 09:27:19 -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; dkim=pass header.i=@linaro.org header.s=google header.b=A20CcuIN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbeC1QZz (ORCPT + 99 others); Wed, 28 Mar 2018 12:25:55 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36519 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbeC1QZv (ORCPT ); Wed, 28 Mar 2018 12:25:51 -0400 Received: by mail-wm0-f68.google.com with SMTP id x82so6467880wmg.1 for ; Wed, 28 Mar 2018 09:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BXKDMJG3JeCpej2WnLf9wqzx5IMUXIkH5dpeKYi6VvU=; b=A20CcuINqjOypQe/pFrKhZYvabm2UxnSDgnRiva6XUEAR+ZyZ+mQaVtMD+yO5lG6t9 4+3E9VugFKPMnQ8b6u8MwEZl5BJqhersmE6zIS8ALIo6fGZXq1WdRj9teM6Mq8VdWIUd E8ncp85Nntir3428iWSF9UdoN1Cz9VnhcTYpk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BXKDMJG3JeCpej2WnLf9wqzx5IMUXIkH5dpeKYi6VvU=; b=VhAg76z7lxqbtQeYqR1242Q3ek8DCsemJJuJBXjJisRtiuSVNL4IW1Hj21lJGJjAzi tLvqxW5VJZDgPepw/NJpIWMWjhCeijb07xkqoELD0nMG+btOVaSKDNIbf3GJFkaVihg9 gwkQvFVS7SpmpgVV9M+EDNX89Tp2sArdEYqxvgIoRgDZOwZwIpXpttCeX1ymrl2E0Nkp ErLWdTBmQRe3QnpDUpdh/FEe14zM58JrpvI7Vk14IzFcakYLJg+6i9Ko4JgYmN07liub TGy3053MNCpAXWlcTa7mDF3VtqgzvhaB3clTblkHslnOfjN3DA734drSwlRDBjvdQ2NC /cIQ== X-Gm-Message-State: AElRT7Huwyka/nLlnoUopvFo7M6h+x0L1oz/vS6CxxkuqPhl8rN50hZ9 7PUCi4hC/Mlp+WVWs5J+5dmcuQ== X-Received: by 10.28.134.203 with SMTP id i194mr3525664wmd.114.1522254349714; Wed, 28 Mar 2018 09:25:49 -0700 (PDT) Received: from ?IPv6:2001:41d0:fe90:b800:b0a9:da92:8c72:d9e2? ([2001:41d0:fe90:b800:b0a9:da92:8c72:d9e2]) by smtp.googlemail.com with ESMTPSA id e27sm7813448wre.86.2018.03.28.09.25.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 09:25:48 -0700 (PDT) Subject: Re: [PATCH v4 7/8] clocksource: Add a new timer-ingenic driver To: Paul Cercueil Cc: Thomas Gleixner , Jason Cooper , Marc Zyngier , Lee Jones , Ralf Baechle , Rob Herring , Jonathan Corbet , Mark Rutland , James Hogan , Maarten ter Huurne , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-doc@vger.kernel.org References: <20180110224838.16711-2-paul@crapouillou.net> <20180317232901.14129-1-paul@crapouillou.net> <20180317232901.14129-8-paul@crapouillou.net> <06976e4ae275c4cc0bddacc5e0c0c9a9@crapouillou.net> From: Daniel Lezcano Message-ID: Date: Wed, 28 Mar 2018 18:25:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <06976e4ae275c4cc0bddacc5e0c0c9a9@crapouillou.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/03/2018 17:15, Paul Cercueil wrote: > Le 2018-03-24 07:26, Daniel Lezcano a écrit : >> On 18/03/2018 00:29, Paul Cercueil wrote: >>> This driver will use the TCU (Timer Counter Unit) present on the Ingenic >>> JZ47xx SoCs to provide the kernel with a clocksource and timers. >> >> Please provide a more detailed description about the timer. > > There's a doc file for that :) Usually, when there is a new driver I ask for a description in the changelog for reference. >> Where is the clocksource ? > > Right, there is no clocksource, just timers. > >> I don't see the point of using channel idx and pwm checking here. >> >> There is one clockevent, why create multiple channels ? Can't you stick >> to the usual init routine for a timer. > > So the idea is that we use all the TCU channels that won't be used for PWM > as timers. Hence the PWM checking. Why is this bad? It is not bad but arguable. By checking the channels used by the pwm in the code, you introduce an adherence between two subsystems even if it is just related to the DT parsing part. As it is not needed to have more than one timer in the time framework (at least with the same characteristics), the pwm channels check is pointless. We can assume the author of the DT file is smart enough to prevent conflicts and define a pwm and a timer properly instead of adding more code complexity. In addition, simplifying the code will allow you to use the timer-of code and reduce very significantly the init function. >>> Signed-off-by: Paul Cercueil >>> --- >>>  drivers/clocksource/Kconfig         |   8 ++ >>>  drivers/clocksource/Makefile        |   1 + >>>  drivers/clocksource/timer-ingenic.c | 278 >>> ++++++++++++++++++++++++++++++++++++ >>>  3 files changed, 287 insertions(+) >>>  create mode 100644 drivers/clocksource/timer-ingenic.c >>> >>>  v2: Use SPDX identifier for the license >>>  v3: - Move documentation to its own patch >>>      - Search the devicetree for PWM clients, and use all the TCU >>>        channels that won't be used for PWM >>>  v4: - Add documentation about why we search for PWM clients >>>      - Verify that the PWM clients are for the TCU PWM driver >>> >>> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig >>> index d2e5382821a4..481422145fb4 100644 >>> --- a/drivers/clocksource/Kconfig >>> +++ b/drivers/clocksource/Kconfig >>> @@ -592,4 +592,12 @@ config CLKSRC_ST_LPC >>>        Enable this option to use the Low Power controller timer >>>        as clocksource. >>> >>> +config INGENIC_TIMER >>> +    bool "Clocksource/timer using the TCU in Ingenic JZ SoCs" >>> +    depends on MACH_INGENIC || COMPILE_TEST >> >> bool "Clocksource/timer using the TCU in Ingenic JZ SoCs" if COMPILE_TEST >> >> Remove the depends MACH_INGENIC. > > This driver is not useful on anything else than Ingenic SoCs, why should I > remove MACH_INGENIC then? For COMPILE_TEST on x86. >>> +    select CLKSRC_OF >>> +    default y >> >> No default, Kconfig platform selects the timer. > > Alright. [ ... ] -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog