From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9BA0C433F5 for ; Fri, 22 Apr 2022 16:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jtFdCwXFFQ1XQJdYarrjll2fTTx8gZZ11hXkqqEs2Q8=; b=36BhYH/bDtdSKBY0iS68zD26qi KM8PHOxTlcu7Mq6Exn9U0og/PSHin/xmG0I2HSPOAT0c6qonUcnRmNaD4NVuObEFJx0t7BNiOqwoN TchzIPe2Hxml8sQn0B+QT25KU5he4A5GJdyr6z/oFiDq8Ahp79BpvK1H/0rBWXM5ptoLTE5xcEU7M olgUmovrxYAd6oj8nwdMTIs0G3QGWokHiY76FLcDygZyu21zKc8XwN+sLqwXOQIXJrR7Mh4nhud79 1sBjoKMtcbB+gDz+GjpPRS4L+dxjq9OnHaNwSXQ1choLBgEXlZcZkw5UqHsvQAgeBOPY8kaxrNpJp Q0yyXJXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhwD2-001SoD-KC; Fri, 22 Apr 2022 16:32:41 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhwB0-001RsD-QF for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 16:30:36 +0000 Received: by mail-ej1-x62e.google.com with SMTP id y10so17379730ejw.8 for ; Fri, 22 Apr 2022 09:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SvZ3E0xQYsARXcJ6QvBK1IaaEvvaTTI66H6n3DvzotU=; b=XPdBkkRntroFDRCc2rRB5jJOcvlE0/YL7BfF0y1vAsz+OrwL8vCStO919jFQaG/Cjg DrQ1+NlZuFdBph5v3nXyvntfHIum9mE8KnHjhOPK6Uac+290n9sRPHsoIDNPtmkH6kI5 qQduRVLroUX439nTOu2kn8y/Qm4bPJKaJwRxjmHGBCBE1tffreN/Z9oKfHYvVRG0UDL6 /BboDGnGHZWopCr8x+aefLbMfDS9M4autIDSP07QxLOXeRN5u5H8t+Femwv7nyUS6cLG LPUwBSwHjigSNSUxEmNl3+JR8I5i7pJtarKSKvv1zZlv5u6N2qMQV9yBFsb8cmbo9g1m vxDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SvZ3E0xQYsARXcJ6QvBK1IaaEvvaTTI66H6n3DvzotU=; b=OLIs3ID5RLMqBCQrFb7FJ/KOYU+LD/sVEob9/0YfWxid6eH5TWPYtZf2HKmnbLHmTW Pz984MfU3q1WuNoDIvN9tHYaWVoy+FV9KqC4mTcUYQZr7lLBhcNbyuL2Et/3oyj7z8Fu iXZIjyRSxbUi+14DuH6sIH/h0kypxEYEO3xuIDtPe+OGDKa4mHwwuN+051f5K6Ws+WVG Kdxc4eADan0zUvzR6FlyM8jmoB7wys1Z6L+kWnlgNM4fg08LN/i8oIyhZVvEttqqU+Fy zda3brZCH7sPhdXbot7+RkPcjl3Tfz8AiYvNseEf6DfX3ucM3MVUTZIS2W0oGcCaJThh j3Hg== X-Gm-Message-State: AOAM531IfmsQTDH9dqp1nHGH31B6HPT42S8zvDBsfAaPjAQT4VszGFRX OworgbCcmeRX2jSJpHPqbi4= X-Google-Smtp-Source: ABdhPJzgH412AyrAQMJHm1BCKsJJZBFY8vVy8bP1bgq2M0x6FmDqh3WogmU8YLiGIZY0QDYODtsi0A== X-Received: by 2002:a17:906:d7a2:b0:6e8:9a34:c954 with SMTP id pk2-20020a170906d7a200b006e89a34c954mr4759284ejb.697.1650645030694; Fri, 22 Apr 2022 09:30:30 -0700 (PDT) Received: from orome ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id i1-20020a1709064ec100b006e89dfff2d6sm900087ejv.141.2022.04.22.09.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 09:30:29 -0700 (PDT) Date: Fri, 22 Apr 2022 18:30:27 +0200 From: Thierry Reding To: Sean Anderson Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , Mubin Usman Sayyed , linux-arm-kernel@lists.infradead.org, Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , michal.simek@xilinx.com, Alvaro Gamez Subject: Re: [PATCH v14 2/2] pwm: Add support for Xilinx AXI Timer Message-ID: References: <20220303223544.2810594-1-sean.anderson@seco.com> <20220303223544.2810594-2-sean.anderson@seco.com> MIME-Version: 1.0 In-Reply-To: <20220303223544.2810594-2-sean.anderson@seco.com> User-Agent: Mutt/2.2.1 (c8109e14) (2022-02-19) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_093034_931769_F70AF73D X-CRM114-Status: GOOD ( 43.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============3806604899223340688==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3806604899223340688== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="26AvKSQgWTUB84pd" Content-Disposition: inline --26AvKSQgWTUB84pd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 03, 2022 at 05:35:43PM -0500, Sean Anderson wrote: > This adds PWM support for Xilinx LogiCORE IP AXI soft timers commonly > found on Xilinx FPGAs. At the moment clock control is very basic: we > just enable the clock during probe and pin the frequency. In the future, > someone could add support for disabling the clock when not in use. >=20 > Some common code has been specially demarcated. While currently only > used by the PWM driver, it is anticipated that it may be split off in > the future to be used by the timer driver as well. >=20 > This driver was written with reference to Xilinx DS764 for v1.03.a [1]. >=20 > [1] https://www.xilinx.com/support/documentation/ip_documentation/axi_tim= er/v1_03_a/axi_timer_ds764.pdf >=20 > Signed-off-by: Sean Anderson > Acked-by: Michal Simek > --- >=20 > Changes in v14: > - 1GHz -> 1 GHz > - Clarify that we will give a very wrong estimate for rate >=3D 1 GHz > - Remove duplicate blank line > - Remove forward declaration of xilinx_timer_common_init (which no > longer exists). >=20 > Changes in v13: > - Clamp period/duty_cycle by assuming rate is at most U32_MAX > - Expand comment in xilinx_timer_get_period > - Note that the 100% duty cycle calculations may be wrong for very high > clock rates >=20 > Changes in v12: > - Add a comment to the timer driver about #pwm-cells > - Combine/expand comments on rounding in xilinx_pwm_apply >=20 > Changes in v11: > - Add comment about why we test for #pwm-cells > - Clarify comment on generate out signal > - Rename pwm variables to xilinx_pwm > - Round like Uwe wants... > - s/xilinx_timer/xilinx_pwm/ for non-common functions >=20 > Changes in v10: > - Fix compilation error in timer driver >=20 > Changes in v9: > - Refactor "if { return } else if { }" to "if { return } if { }" > - Remove drivers/clocksource/timer-xilinx-common.c from MAINTAINERS > - Remove xilinx_timer_common_init and integrate it into xilinx_timer_probe >=20 > Changes in v8: > - Drop new timer driver; it has been deferred for future series >=20 > Changes in v7: > - Add dependency on OF_ADDRESS > - Fix period_cycles calculation > - Fix typo in limitations >=20 > Changes in v6: > - Capitalize error messages > - Don't disable regmap locking to allow inspection of registers via > debugfs > - Prevent overflow when calculating period_cycles > - Remove enabled variable from xilinx_pwm_apply > - Swap order of period_cycle range comparisons >=20 > Changes in v5: > - Allow non-zero #pwm-cells > - Correctly set duty_cycle in get_state when TLR0=3DTLR1 > - Elaborate on limitation section > - Perform some additional checks/rounding in apply_state > - Remove xlnx,axi-timer-2.0 compatible string > - Rework duty-cycle and period calculations with feedback from Uwe > - Switch to regmap to abstract endianness issues > - Use more verbose error messages >=20 > Changes in v4: > - Don't use volatile in read/write replacements. Some arches have it and > some don't. > - Put common timer properties into their own struct to better reuse > code. > - Remove references to properties which are not good enough for Linux. >=20 > Changes in v3: > - Add clockevent and clocksource support > - Remove old microblaze driver > - Rewrite probe to only use a device_node, since timers may need to be > initialized before we have proper devices. This does bloat the code a b= it > since we can no longer rely on helpers such as dev_err_probe. We also > cannot rely on device resources being free'd on failure, so we must free > them manually. > - We now access registers through xilinx_timer_(read|write). This allows = us > to deal with endianness issues, as originally seen in the microblaze > driver. CAVEAT EMPTOR: I have not tested this on big-endian! >=20 > Changes in v2: > - Add comment describing device > - Add comment explaining why we depend on !MICROBLAZE > - Add dependencies on COMMON_CLK and HAS_IOMEM > - Cast dividends to u64 to avoid overflow > - Check for over- and underflow when calculating TLR > - Check range of xlnx,count-width > - Don't compile this module by default for arm64 > - Don't set pwmchip.base to -1 > - Ensure the clock is always running when the pwm is registered > - Remove debugfs file :l > - Rename TCSR_(SET|CLEAR) to TCSR_RUN_(SET|CLEAR) > - Report errors with dev_error_probe > - Set xilinx_pwm_ops.owner > - Use NSEC_TO_SEC instead of defining our own > - Use TCSR_RUN_MASK to check if the PWM is enabled, as suggested by Uwe >=20 > MAINTAINERS | 6 + > arch/microblaze/kernel/timer.c | 4 + > drivers/pwm/Kconfig | 14 ++ > drivers/pwm/Makefile | 1 + > drivers/pwm/pwm-xilinx.c | 321 +++++++++++++++++++++++++++++ > include/clocksource/timer-xilinx.h | 73 +++++++ > 6 files changed, 419 insertions(+) > create mode 100644 drivers/pwm/pwm-xilinx.c > create mode 100644 include/clocksource/timer-xilinx.h Applied with Uwe's s/>=3D 1 GHz/> 1 GHz/ ask applied. I've also changed the MODULE_LICENSE string to just "GPL" since that's what checkpatch requested. Thanks, Thierry --26AvKSQgWTUB84pd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmJi2CMACgkQ3SOs138+ s6FcWw/7BFABcwflK3OYAHsCvZ5fuwI0Og/yTW3KV5l0XpWPoYE2B8DwjlonaJr2 9XAqP+0NuEe5S8H8YgEHZiZdBZmXZJFi6voekQZSpnSlE/Hv7JztjsifwhABeDd7 ZIZ0YOsvWpayOJO5G5ajz48QScSjrH+K6Mm0AYy2JtjGhF0p5K6KWVzAGKQCOqTj 4wsXmYYi8DIL6z5t+2av8R5ZP2XJFJu5LJJx6qaJ+zTx1j9jBDzukNWXEx+iAO1C hxFCb18BAAHfV4eo/F8CoHtZYraNj5adz3FbZr1hJVmAbXH5yWjJR+kR/04rQa4L FfYmPG94G+fGs1O6N0DNw430k9uanZePIyui7aEr2/HabP5XsMp8SGDJFLz5YbYF 3kT3xZguG1KNmUNvHm7I+rpUUsGAFbp6kwgoSwtSyfPsP7Ao5agDeiH2TCXbFmrL z2YZilVBrjFMVz2Z747vba637BqZC+EEL8kZlE+jgvIGHWcgrzUYNY7wTe3Onwt4 qejNw54PYMSoreR3cmD8wD8BjWTAdTJhzeytZUAgOeNt6jYZBlT6w8v+usR16Nos 32CHMqTETkUojTmVPiXxRzg8j6UdCwRqVHeJ3BDnCbGMtID/TfPEdZ+OtlRcSaIV fDv56cF03p6TCjfkBNeBIByBN89XAeNvgxGScwJUnwSOafZYm5I= =wh3X -----END PGP SIGNATURE----- --26AvKSQgWTUB84pd-- --===============3806604899223340688== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3806604899223340688==--