Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6519287rdb; Fri, 15 Dec 2023 00:17:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUWZxlI+QZhIhgGRyIXZE0sZg/AJGBy6cMCn5E2ky7kw7xIY/ah+bnC3eZTG03aqL+U8YC X-Received: by 2002:a05:6359:4c1c:b0:170:bd6c:b7cf with SMTP id kj28-20020a0563594c1c00b00170bd6cb7cfmr13386542rwc.46.1702628273617; Fri, 15 Dec 2023 00:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702628273; cv=none; d=google.com; s=arc-20160816; b=bVbMmmJunKYJnbggAeAgfwxiJr6Y+3R1NpQ60Bm++7l7UJj8SwHpsiG39VLBtxP9vB uLTbhM0e6s5kXjuGHbFLBjiDBmbVLxuCnVyFFeHn5hQREDe4FOo5865fj6g4ul+hTUOH ay0JkCIL0xZj+c8PWGnBca5ZcYwxtIHtBS3TR04a+fpmENQHj6Z5edqx+yEMWs4vzjWS wZ7/NO+vamTNhGkBjIOAPb2YYMUui1f5FcpDap9B0YD885eWi7JEtmbRU23dzD+oWf4c MGMzrYzfFDmyKgPDUm9pFolHoOCZq/frLgaRikHx1caaBG/052LoDFY68VIoBpXeXDsM XR6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=fGdrFmIEQf13sPxTLT6HnGWnqmAuT+eQd7GpgmqUVC0=; fh=h+iFQmneiJwa3uSV8K76uU++cgcU+ZYw6IRLiwrohhM=; b=OiOGJPFKWH6w8DqIG8gvHvjZ3xrV1xwJcCYJp65F3hvcHcZLv1x0hc3JDInVtXdFyS 6BvlIoP6Js3GEFrZxCF+E6xCNyxL3WD5O7NJp5JMfiGD7QeT9KYzB1iBKApyh0ROADzF uuJBwNYBwlI4Rqi8OJKyYLK8enIfiMECoDc2QbkdR1my4/kKJp55aAnUEe1y0zUmqqyJ zyE0FB8bn+nUwiXMX+hjXgK5+lcLvy+C+vwY4HLCfMg4XbyoS9c1cXeLCZ0xn/YnXAd0 CAvzRz2Z0YtNXYbqeFondBd7/GXD90az8haVHLvT2b0bZOhP6s/fj16dNMjtglFYQlck Atjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-602-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-602-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b2-20020a655cc2000000b005c21722b7d6si12423536pgt.863.2023.12.15.00.17.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 00:17:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-602-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-602-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-602-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3F003284082 for ; Fri, 15 Dec 2023 08:17:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D9EA12E51; Fri, 15 Dec 2023 08:17:45 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7E8C111B1; Fri, 15 Dec 2023 08:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 569D17FE2; Fri, 15 Dec 2023 16:17:29 +0800 (CST) Received: from EXMBX068.cuchost.com (172.16.6.68) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Dec 2023 16:17: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; Fri, 15 Dec 2023 16:17:28 +0800 Message-ID: <1c26fe9b-20f9-4b03-b263-ca030d20a5ce@starfivetech.com> Date: Fri, 15 Dec 2023 16:17:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 2/4] pwm: opencores: Add PWM driver support Content-Language: en-US From: William Qiu 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> <62bb91ad-5d4b-4ec6-80c8-6c3edf5d25cd@starfivetech.com> In-Reply-To: <62bb91ad-5d4b-4ec6-80c8-6c3edf5d25cd@starfivetech.com> Content-Type: text/plain; charset="UTF-8" X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX068.cuchost.com (172.16.6.68) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: quoted-printable On 2023/12/13 17:27, William Qiu wrote: >=20 >=20 > On 2023/12/12 1:41, Rob Herring wrote: >> On Fri, Dec 8, 2023 at 3:42=E2=80=AFAM 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.r= st >>> 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/projec= ts/ptc. >>> + >>> + To compile this driver as a module, choose M here: the modu= le >>> + 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) +=3D pwm-micr= ochip-core.o >>> obj-$(CONFIG_PWM_MTK_DISP) +=3D pwm-mtk-disp.o >>> obj-$(CONFIG_PWM_MXS) +=3D pwm-mxs.o >>> obj-$(CONFIG_PWM_NTXEC) +=3D pwm-ntxec.o >>> +obj-$(CONFIG_PWM_OCORES) +=3D pwm-ocores.o >>> obj-$(CONFIG_PWM_OMAP_DMTIMER) +=3D pwm-omap-dmtimer.o >>> obj-$(CONFIG_PWM_PCA9685) +=3D pwm-pca9685.o >>> obj-$(CONFIG_PWM_PXA) +=3D 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 >>=20 >> 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. >>=20 >> Rob > Will drop. >=20 > Thank you for spending time on this patchset. >=20 > Best Regards > William Hi Rob, After checking, I need to use of_match_device() in of_device.h, so this interface will be moved to which header in linux-next? Thanks, William