Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5195149rdb; Wed, 13 Dec 2023 01:27:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBa0G7nNjlw0NlfMs2J3O0TlSdGXoNP5tQdR1SNAdy+pmtXRWRqidDg2dVX8m4Kq6aCvoy X-Received: by 2002:a17:903:189:b0:1d2:ffba:2d47 with SMTP id z9-20020a170903018900b001d2ffba2d47mr3776523plg.77.1702459660947; Wed, 13 Dec 2023 01:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702459660; cv=none; d=google.com; s=arc-20160816; b=cKh9Y3+u1t9GxLBBBfSPM+EXJUW3zjklsXqtQ3KTAOgb7eBr8K2GR/5X7v87TkdXUm v+sp+D+UqzV9C/Y8OPHCFtIqaeeZ/xRRPssXCG6M7lv4kjhGuQZp9JDbWC89xsMhAT4e 5Qx0oxCAUkIiQPIIDF8SCQAGq4ZIBtohW02G62UZeLqueRyMXRZVsMTr6qmuz4/LWy8Q 42P8NhomXG+bYd0Bl40sBq7ILxj+D3ApDv4b6VEW1djruHj5nBzbhHqUyF0thiHvwvcN mZNnifDJWjZ4/XGRpMeK27nY07H2Q3ZzBS7Pl4vehtkn+hU6NNc20ljumuTJi06O4Zax oGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=/x9VMlXrbFDL8zRThQq4/p7v3uQNv3jr/wP/CLyLk98=; fh=h+iFQmneiJwa3uSV8K76uU++cgcU+ZYw6IRLiwrohhM=; b=uXAcTiIOgK+P2B4qbNSTHD84Z8nhX5Pz9IHglOH3BHEfixdb1egO5m9yMfFpUr3Gop TbAT+LNbtJgaUktR2C74SY0ROcF1t4cv56jDh+pbSoVKmC4jmmNKRAFK0tbjj9UvjpPs FjH8jlczmA0mRRWHZzyFq6m9/OJiGr6psygZ+xvaE0vq2o3Lap0ZHwDQd2IhBth5rU3J IFNsI+JTPOIzXxJfNMmzBbICoXiKuDxtjeXd3HTOQ9gK5dGCn5q6rkZEYYQibgPEyBt1 8P+cSBrHcSzdOT3CUa5gE2WCTk7+dpaa+Du+X2/PvEzSquyomDkHRO1WpdGjT82cEPTV a4+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t8-20020a1709028c8800b001d08be55d01si9068570plo.101.2023.12.13.01.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 01:27:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0639880BC51C; Wed, 13 Dec 2023 01:27:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbjLMJ12 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 13 Dec 2023 04:27:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjLMJ11 (ORCPT ); Wed, 13 Dec 2023 04:27:27 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33B29D0; Wed, 13 Dec 2023 01:27:31 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id CE8A924E2A1; Wed, 13 Dec 2023 17:27:29 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 13 Dec 2023 17:27:29 +0800 Received: from [192.168.120.47] (171.223.208.138) by EXMBX068.cuchost.com (172.16.6.68) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 13 Dec 2023 17:27:28 +0800 Message-ID: <62bb91ad-5d4b-4ec6-80c8-6c3edf5d25cd@starfivetech.com> Date: Wed, 13 Dec 2023 17:27:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 2/4] pwm: opencores: Add PWM driver support Content-Language: en-US To: Rob Herring CC: , , , , "Emil Renner Berthing" , Thierry Reding , Philipp Zabel , Krzysztof Kozlowski , Conor Dooley , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Hal Feng , Paul Walmsley , "Palmer Dabbelt" , Albert Ou References: <20231208094209.1910934-1-william.qiu@starfivetech.com> <20231208094209.1910934-3-william.qiu@starfivetech.com> From: William Qiu In-Reply-To: Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 01:27:40 -0800 (PST) On 2023/12/12 1:41, Rob Herring wrote: > On Fri, Dec 8, 2023 at 3:42 AM William Qiu wrote: >> >> Add driver for OpenCores PWM Controller. And add compatibility code >> which based on StarFive SoC. >> >> Co-developed-by: Hal Feng >> Signed-off-by: Hal Feng >> Signed-off-by: William Qiu >> --- >> MAINTAINERS | 7 ++ >> drivers/pwm/Kconfig | 12 ++ >> drivers/pwm/Makefile | 1 + >> drivers/pwm/pwm-ocores.c | 229 +++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 249 insertions(+) >> create mode 100644 drivers/pwm/pwm-ocores.c >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index 788be9ab5b73..7a11a22da09e 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -16204,6 +16204,13 @@ F: Documentation/i2c/busses/i2c-ocores.rst >> F: drivers/i2c/busses/i2c-ocores.c >> F: include/linux/platform_data/i2c-ocores.h >> >> +OPENCORES PWM DRIVER >> +M: William Qiu >> +M: Hal Feng >> +S: Supported >> +F: Documentation/devicetree/bindings/pwm/opencores,pwm.yaml >> +F: drivers/pwm/pwm-ocores.c >> + >> OPENRISC ARCHITECTURE >> M: Jonas Bonn >> M: Stefan Kristiansson >> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig >> index 4b956d661755..d87e1bb350ba 100644 >> --- a/drivers/pwm/Kconfig >> +++ b/drivers/pwm/Kconfig >> @@ -444,6 +444,18 @@ config PWM_NTXEC >> controller found in certain e-book readers designed by the original >> design manufacturer Netronix. >> >> +config PWM_OCORES >> + tristate "OpenCores PWM support" >> + depends on HAS_IOMEM && OF >> + depends on COMMON_CLK && RESET_CONTROLLER >> + depends on ARCH_STARFIVE || COMPILE_TEST >> + help >> + If you say yes to this option, support will be included for the >> + OpenCores PWM. For details see https://opencores.org/projects/ptc. >> + >> + To compile this driver as a module, choose M here: the module >> + will be called pwm-ocores. >> + >> config PWM_OMAP_DMTIMER >> tristate "OMAP Dual-Mode Timer PWM support" >> depends on OF >> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile >> index c5ec9e168ee7..517c4f643058 100644 >> --- a/drivers/pwm/Makefile >> +++ b/drivers/pwm/Makefile >> @@ -40,6 +40,7 @@ obj-$(CONFIG_PWM_MICROCHIP_CORE) += pwm-microchip-core.o >> obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o >> obj-$(CONFIG_PWM_MXS) += pwm-mxs.o >> obj-$(CONFIG_PWM_NTXEC) += pwm-ntxec.o >> +obj-$(CONFIG_PWM_OCORES) += pwm-ocores.o >> obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o >> obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o >> obj-$(CONFIG_PWM_PXA) += pwm-pxa.o >> diff --git a/drivers/pwm/pwm-ocores.c b/drivers/pwm/pwm-ocores.c >> new file mode 100644 >> index 000000000000..996ca3805901 >> --- /dev/null >> +++ b/drivers/pwm/pwm-ocores.c >> @@ -0,0 +1,229 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * OpenCores PWM Driver >> + * >> + * https://opencores.org/projects/ptc >> + * >> + * Copyright (C) 2018-2023 StarFive Technology Co., Ltd. >> + * >> + * Limitations: >> + * - The hardware only do inverted polarity. >> + * - The hardware minimum period / duty_cycle is (1 / pwm_apb clock frequency) ns. >> + * - The hardware maximum period / duty_cycle is (U32_MAX / pwm_apb clock frequency) ns. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include > > You probably don't need this header and the implicit includes it makes > are dropped now in linux-next. Please check what you actually need and > make them explicit. > > Rob Will drop. Thank you for spending time on this patchset. Best Regards William