From patchwork Wed Jun 15 07:08:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12881874 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 23B74C433EF for ; Wed, 15 Jun 2022 07:09:44 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T67ggrO/oCoAcJnI6HpaTyqCMNd/nVFj3Pu1Zk7kYSI=; b=1+4xQExt8wbkVa eUNfAxyoGqGBjDdx6/NeKLc+xllAWPlgmyqHjYy+G+oLnuOufx7EaHOJQjt9tZFC2dy45otWo/uJA f1i0Uns639iCZIAv0G+ALVc6W50RY6rsHXhCoTbR4/pG534/iTyjI86v+hOZUksflcsYlCkJQknBg 8NTXSJCEDooNPO1RK+JQP6L5LHH1ooWILJ9hHqQL+1FhAZrCJrEKUK2Bf05AM9qzduuOtFT8s34FF EJKVanaPAp/xHBBXRemfZ2R1n/pVC0aILWevRaKWmjfTHA6A8Dpcsv2oaZjfIBsN+XQ0mg5wpH+3e fcTGU+g52bITgfjFVB7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8u-00CzKk-OP; Wed, 15 Jun 2022 07:08:44 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8j-00CzIB-9A for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:08:35 +0000 Received: by mail-wr1-x435.google.com with SMTP id s1so14029605wra.9 for ; Wed, 15 Jun 2022 00:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2KF9TQbXAQaO0+lCyq0Pm6oIczmP+NGAwWhS+H2ag0I=; b=nxWF6vfTvRMvqC2OXTc3S/F+H+7Bp4aNqsHfCWFGbhvnC89Nsh4G1mSULS0/5MQzhg Y4gYcTjH23l/4iioN81St/KfV2pKDfU2dChXQa8ne8Ju02ic0Bm0pb9DyM6QoGlSwugH C016lNxcQmDW+Uq1yBA+1QBVY9R1cLptRhLP3RaRu7ioPf/Wvl7fbsRDz4Ah4XRajARo ogU5SI4Fh1D/SrNhvlKAlgJJqDYVMIIZYxU4+UjQ0OI542E624niyk/e0b6svEnHLKc5 EnpBTsa6H381WNxwnRuHe8oc8nLYsm2eBCKd27ZyXg5pmZKgCjZPOFQZYpTeCG5yTL5O 3HLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2KF9TQbXAQaO0+lCyq0Pm6oIczmP+NGAwWhS+H2ag0I=; b=W+xYtkqWrHGTbIk0Fr3gX29Dol0YqYpZGuVp8b1B4HgfwcvABbY78cSppC84pnD6eX eWO3AC1X/Xl/y/yizC+YT3JRMsPN6scKzosPDxL7NrTQ2KkR0CVke+UG/QGGwMfKw5lb SmKyoPL/5f8Ob4Emu3PAKcnNL/cbkdeivl2aadnN7HtS6Ksoo76jz2e+CjO6tzmJDx0/ VEFkT9Zdyn9yT18pubAo3mMO4YZOfAv22tHkJbCqUiDvsVZuhqAsuCg3bsA7CtrZSYCw CfaeH3oMj5QgbrvGFSB14lK/sWRSTR45r+RooRbnXX6TQRctWLhNSrW/hTPT+epA7vl8 HpAw== X-Gm-Message-State: AJIora+KbaFgKzIAv9eGFZKMZvL3nnO3fBURw1xO0WrA5F2sjaHXAeBd /Y2DghkRaiA2aNfSe9AozMY= X-Google-Smtp-Source: AGRyM1tmEsuVgCBD/+wsO6NoYwOMQq6OCjFfmW6ttsay5izsZH2En83dJmD0ZLslZ5fHuRWzOobvwg== X-Received: by 2002:a05:6000:1445:b0:219:f383:40bc with SMTP id v5-20020a056000144500b00219f38340bcmr8447579wrx.53.1655276911312; Wed, 15 Jun 2022 00:08:31 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id i8-20020adffc08000000b0020c5253d8d0sm13562708wrr.28.2022.06.15.00.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 00:08:31 -0700 (PDT) From: Romain Perier To: Thierry Reding , Lee Jones , Daniel Palmer , Romain Perier , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] dt-bindings: pwm: Add Mstar MSC313e PWM devicetree bindings documentation Date: Wed, 15 Jun 2022 09:08:09 +0200 Message-Id: <20220615070813.7720-2-romain.perier@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615070813.7720-1-romain.perier@gmail.com> References: <20220615070813.7720-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_000833_365623_FD232B8A X-CRM114-Status: GOOD ( 14.45 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds the documentation for the devicetree bindings of the Mstar MSC313e RTC driver, it includes MSC313e SoCs and SSD20xd. Signed-off-by: Romain Perier --- .../bindings/pwm/mstar,msc313e-pwm.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/mstar,msc313e-pwm.yaml diff --git a/Documentation/devicetree/bindings/pwm/mstar,msc313e-pwm.yaml b/Documentation/devicetree/bindings/pwm/mstar,msc313e-pwm.yaml new file mode 100644 index 000000000000..82f2357db085 --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/mstar,msc313e-pwm.yaml @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/mstar,msc313e-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mstar MSC313e PWM controller + +allOf: + - $ref: "pwm.yaml#" + +maintainers: + - Daniel Palmer + - Romain Perier + +properties: + compatible: + oneOf: + - items: + - enum: + - mstar,msc313e-pwm + - mstar,ssd20xd-pwm + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + "#pwm-cells": + const: 2 + +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + pwm: pwm@3400 { + compatible = "mstar,msc313e-pwm"; + reg = <0x3400 0x400>; + #pwm-cells = <2>; + clocks = <&xtal_div2>; + }; From patchwork Wed Jun 15 07:08:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12881875 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 7305EC433EF for ; Wed, 15 Jun 2022 07:09:58 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cTVZhfjZuRD8a8ro5x7/vU9r7aFhYVL//fiFH+oQ8HM=; b=it05FiMAjKjAZG fjDrTAnQRQrLxk3Z9p021K8mH2l3VXsTYScu55hvSG9LjTcDpQXzomSinAopuaKhDkEpRdLSK9dI7 w1qiNKqlsAQTaJpKHFEVlFp6cDygn8ugCQZi1u4HRI4WHhFH/cz4vxFJ/3EZFkC+a76Ulp55XKNve OJezOuN+0Flv+aGGp2aHJgQImbMINvAhTDoMqBsFWYknXf68Y8b3nLo+Bb0XTqmf4pzgRNmeN7Neo ERTilGMP47wIMI2jS69QQP8NtBwc5kqUkRVWIoUrETivtAFv1BU2SfhlnufkLR+CL0Ti5IGKG403J 1AIHELyNk3urrYYnx+Vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N93-00CzNV-Uh; Wed, 15 Jun 2022 07:08:54 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8k-00CzIW-Nw for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:08:36 +0000 Received: by mail-wr1-x429.google.com with SMTP id v14so14055595wra.5 for ; Wed, 15 Jun 2022 00:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e1JEyMw9//6WaRTsGHLxDJ16bO40ZkIq+CAqfAPgOBs=; b=LcmSyFxRL1x5dkrrPS9mqDn4YSZOSAuYFfX+t/Bvsbzqx0rSGdnPI/UaAOwHHU8hj1 aN2D0pili4usxNogYd8qWsAJp15z6uHTsDaVt0e5rkZxm65VrKKD7FC9CdrFWMqbet0V QxwZZXBH+l3BslD+clW5X0f+OyP6rM+syhFsxS7JWLSAOfElJ8oRSFnzeEzRiFe7V4GN r/NonVO7rNapzHRgnuvHZTx6GHLc941p2NDp2l29aFYS7B56zTa2KTBH4h/MgXhzINap a9o9b+BiG266NGMSunIVj3Eiek9NR+HJo5vvZ/8GLonuoyNOiLdjVvO8EbAkoiSZWlDg nbZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e1JEyMw9//6WaRTsGHLxDJ16bO40ZkIq+CAqfAPgOBs=; b=YR/SgoT2hAiJZD80EoOk9cooftWIMZlHxtfOY0Q22aZSvwxAYdP1ohYas1EjumTAHB s8Xsk8w2zqLv//bm8exzuEif1+Sw4qZT4PBNN8pyxSbEMlrMSLY1RYidRgOiGIRLzuH7 vc6mUbPVBVAuKQqd7CNRYezVaFU16HsQ84rt4mu1Ux85qhbCpGB4DPajyMYX3vXD9YVz MyxbG2/vGVHPUIBpffpl6Algvu7983vuYgyiz5KYlI5C2QGspAXYiT6EsWxeXLz716Yu sDXRpdt3SjyWkogm8Gd/4MF0tk1/3CJ8qPTbG8SUTraYTmojnVeISOsMjjdYJNeExb0p CQwg== X-Gm-Message-State: AJIora+z4AN/adJZPDALUaJ61wHtQcOEMQDnPc4NG3lLjhfowXGKqIQB Iervx4dlGCSIApeRL/jWHkp/55Ra/2Q= X-Google-Smtp-Source: AGRyM1u95w+pcsKEaV4PwxZT/Ixx+GSWE/3S6tT9Z1mAUZqmGQMCxfU51wCfe7Mq6Lnrqnb64uB1Pg== X-Received: by 2002:a05:6000:2c8:b0:218:4982:7f90 with SMTP id o8-20020a05600002c800b0021849827f90mr8470230wry.64.1655276912275; Wed, 15 Jun 2022 00:08:32 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id u18-20020a5d4352000000b002102af52a2csm16343132wrr.9.2022.06.15.00.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 00:08:31 -0700 (PDT) From: Romain Perier To: Thierry Reding , Lee Jones , Daniel Palmer , Romain Perier , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] pwm: Add support for the MSTAR MSC313 PWM Date: Wed, 15 Jun 2022 09:08:10 +0200 Message-Id: <20220615070813.7720-3-romain.perier@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615070813.7720-1-romain.perier@gmail.com> References: <20220615070813.7720-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_000834_850138_A8C557CC X-CRM114-Status: GOOD ( 28.26 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Daniel Palmer This adds support for the PWM block on the Mstar MSC313e SoCs and newer. Signed-off-by: Daniel Palmer Co-developed-by: Romain Perier Signed-off-by: Romain Perier --- MAINTAINERS | 1 + drivers/pwm/Kconfig | 10 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-msc313e.c | 242 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 254 insertions(+) create mode 100644 drivers/pwm/pwm-msc313e.c diff --git a/MAINTAINERS b/MAINTAINERS index 2316278d9db9..45d001643b93 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2389,6 +2389,7 @@ F: arch/arm/mach-mstar/ F: drivers/clk/mstar/ F: drivers/clocksource/timer-msc313e.c F: drivers/gpio/gpio-msc313.c +F: drivers/pwm/pwm-msc313e.c F: drivers/rtc/rtc-msc313.c F: drivers/watchdog/msc313e_wdt.c F: include/dt-bindings/clock/mstar-* diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 904de8d61828..802573122b25 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -651,6 +651,16 @@ config PWM_VT8500 To compile this driver as a module, choose M here: the module will be called pwm-vt8500. +config PWM_MSC313E + tristate "MStar MSC313e PWM support" + depends on ARCH_MSTARV7 || COMPILE_TEST + help + Generic PWM framework driver for MSTAR MSC313e. + + To compile this driver as a module, choose M here: the module + will be called pwm-msc313e. + + config PWM_XILINX tristate "Xilinx AXI Timer PWM support" depends on OF_ADDRESS diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 5c08bdb817b4..e24a48c78335 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -61,4 +61,5 @@ obj-$(CONFIG_PWM_TWL) += pwm-twl.o obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o obj-$(CONFIG_PWM_VISCONTI) += pwm-visconti.o obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o +obj-$(CONFIG_PWM_MSC313E) += pwm-msc313e.o obj-$(CONFIG_PWM_XILINX) += pwm-xilinx.o diff --git a/drivers/pwm/pwm-msc313e.c b/drivers/pwm/pwm-msc313e.c new file mode 100644 index 000000000000..f20419c6b9be --- /dev/null +++ b/drivers/pwm/pwm-msc313e.c @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Daniel Palmer + * Copyright (C) 2022 Romain Perier + */ + +#include +#include +#include +#include + +#define DRIVER_NAME "msc313e-pwm" + +#define CHANNEL_OFFSET 0x80 +#define REG_DUTY 0x8 +#define REG_PERIOD 0x10 +#define REG_DIV 0x18 +#define REG_CTRL 0x1c +#define REG_SWRST 0x1fc + +struct msc313e_pwm_channel { + struct regmap_field *clkdiv; + struct regmap_field *polarity; + struct regmap_field *dutyl; + struct regmap_field *dutyh; + struct regmap_field *periodl; + struct regmap_field *periodh; + struct regmap_field *swrst; +}; + +struct msc313e_pwm { + struct regmap *regmap; + struct pwm_chip pwmchip; + struct clk *clk; + struct msc313e_pwm_channel channels[]; +}; + +struct msc313e_pwm_info { + unsigned int channels; +}; + +#define to_msc313e_pwm(ptr) container_of(ptr, struct msc313e_pwm, pwmchip) + +static const struct regmap_config msc313e_pwm_regmap_config = { + .reg_bits = 16, + .val_bits = 16, + .reg_stride = 4, +}; + +static const struct msc313e_pwm_info msc313e_data = { + .channels = 8, +}; + +static const struct msc313e_pwm_info ssd20xd_data = { + .channels = 4, +}; + +static void msc313e_pwm_writecounter(struct regmap_field *low, struct regmap_field *high, u32 value) +{ + regmap_field_write(low, value); + regmap_field_write(high, value >> 16); +} + +static int msc313e_pwm_config(struct pwm_chip *chip, struct pwm_device *device, + int duty_ns, int period_ns) +{ + struct msc313e_pwm *pwm = to_msc313e_pwm(chip); + struct msc313e_pwm_channel *channel = &pwm->channels[device->hwpwm]; + unsigned long long nspertick = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC, clk_get_rate(pwm->clk)); + unsigned long long div = 1; + + /* fit the period into the period register by prescaling the clk */ + while (DIV_ROUND_CLOSEST_ULL(period_ns, (nspertick = DIV_ROUND_CLOSEST_ULL(nspertick, div))) + > 0x3ffff){ + div++; + if (div > (0xffff + 1)) { + dev_err(chip->dev, "Can't fit period into period register\n"); + return -EINVAL; + } + } + + regmap_field_write(channel->clkdiv, div - 1); + msc313e_pwm_writecounter(channel->dutyl, channel->dutyh, + DIV_ROUND_CLOSEST_ULL(duty_ns, nspertick)); + msc313e_pwm_writecounter(channel->periodl, channel->periodh, + DIV_ROUND_CLOSEST_ULL(period_ns, nspertick)); + + return 0; +}; + +static int msc313e_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *device, + enum pwm_polarity polarity) +{ + struct msc313e_pwm *pwm = to_msc313e_pwm(chip); + struct msc313e_pwm_channel *channel = &pwm->channels[device->hwpwm]; + unsigned int pol = 0; + + if (polarity == PWM_POLARITY_INVERSED) + pol = 1; + regmap_field_update_bits(channel->polarity, 1, pol); + + return 0; +} + +static int msc313e_pwm_enable(struct pwm_chip *chip, struct pwm_device *device) +{ + struct msc313e_pwm *pwm = to_msc313e_pwm(chip); + struct msc313e_pwm_channel *channel = &pwm->channels[device->hwpwm]; + int ret; + + ret = clk_prepare_enable(pwm->clk); + if (ret) + return ret; + + regmap_field_write(channel->swrst, 0); + + return 0; +} + +static void msc313e_pwm_disable(struct pwm_chip *chip, struct pwm_device *device) +{ + struct msc313e_pwm *pwm = to_msc313e_pwm(chip); + struct msc313e_pwm_channel *channel = &pwm->channels[device->hwpwm]; + + regmap_field_write(channel->swrst, 1); + clk_disable(pwm->clk); +} + +static int msc313e_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + if (state->enabled) { + msc313e_pwm_enable(chip, pwm); + msc313e_pwm_set_polarity(chip, pwm, state->polarity); + msc313e_pwm_config(chip, pwm, state->duty_cycle, state->period); + } else { + msc313e_pwm_disable(chip, pwm); + } + return 0; +} + +static void msc313e_get_state(struct pwm_chip *chip, struct pwm_device *device, + struct pwm_state *state) +{ + struct msc313e_pwm *pwm = to_msc313e_pwm(chip); + struct msc313e_pwm_channel *channel = &pwm->channels[device->hwpwm]; + unsigned int pol = 0; + + regmap_field_read(channel->polarity, &pol); + state->polarity = pol; +} + +static const struct pwm_ops msc313e_pwm_ops = { + .config = msc313e_pwm_config, + .set_polarity = msc313e_pwm_set_polarity, + .enable = msc313e_pwm_enable, + .disable = msc313e_pwm_disable, + .apply = msc313e_apply, + .get_state = msc313e_get_state, + .owner = THIS_MODULE +}; + +static int msc313e_pwm_probe(struct platform_device *pdev) +{ + const struct msc313e_pwm_info *match_data; + struct device *dev = &pdev->dev; + struct msc313e_pwm *pwm; + __iomem void *base; + int i; + + match_data = of_device_get_match_data(dev); + if (!match_data) + return -EINVAL; + + base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + pwm = devm_kzalloc(dev, struct_size(pwm, channels, match_data->channels), GFP_KERNEL); + if (!pwm) + return -ENOMEM; + + pwm->clk = devm_clk_get(dev, NULL); + if (IS_ERR(pwm->clk)) + return dev_err_probe(dev, PTR_ERR(pwm->clk), "Cannot get clk\n"); + + pwm->regmap = devm_regmap_init_mmio(dev, base, &msc313e_pwm_regmap_config); + if (IS_ERR(pwm->regmap)) + return dev_err_probe(dev, PTR_ERR(pwm->regmap), "Cannot get regmap\n"); + + for (i = 0; i < match_data->channels; i++) { + unsigned int offset = CHANNEL_OFFSET * i; + struct reg_field div_clkdiv_field = REG_FIELD(offset + REG_DIV, 0, 7); + struct reg_field ctrl_polarity_field = REG_FIELD(offset + REG_CTRL, 4, 4); + struct reg_field dutyl_field = REG_FIELD(offset + REG_DUTY, 0, 15); + struct reg_field dutyh_field = REG_FIELD(offset + REG_DUTY + 4, 0, 2); + struct reg_field periodl_field = REG_FIELD(offset + REG_PERIOD, 0, 15); + struct reg_field periodh_field = REG_FIELD(offset + REG_PERIOD + 4, 0, 2); + struct reg_field swrst_field = REG_FIELD(REG_SWRST, i, i); + + pwm->channels[i].clkdiv = devm_regmap_field_alloc(dev, pwm->regmap, + div_clkdiv_field); + pwm->channels[i].polarity = devm_regmap_field_alloc(dev, pwm->regmap, + ctrl_polarity_field); + pwm->channels[i].dutyl = devm_regmap_field_alloc(dev, pwm->regmap, dutyl_field); + pwm->channels[i].dutyh = devm_regmap_field_alloc(dev, pwm->regmap, dutyh_field); + pwm->channels[i].periodl = devm_regmap_field_alloc(dev, pwm->regmap, periodl_field); + pwm->channels[i].periodh = devm_regmap_field_alloc(dev, pwm->regmap, periodh_field); + pwm->channels[i].swrst = devm_regmap_field_alloc(dev, pwm->regmap, swrst_field); + } + + pwm->pwmchip.dev = dev; + pwm->pwmchip.ops = &msc313e_pwm_ops; + pwm->pwmchip.base = -1; + pwm->pwmchip.npwm = match_data->channels; + pwm->pwmchip.of_xlate = of_pwm_xlate_with_flags; + pwm->pwmchip.of_pwm_n_cells = 3; + + platform_set_drvdata(pdev, pwm); + + return devm_pwmchip_add(dev, &pwm->pwmchip); +} + +static const struct of_device_id msc313e_pwm_dt_ids[] = { + { .compatible = "mstar,msc313e-pwm", .data = &msc313e_data }, + { .compatible = "mstar,ssd20xd-pwm", .data = &ssd20xd_data }, + {}, +}; +MODULE_DEVICE_TABLE(of, msc313e_pwm_dt_ids); + +static struct platform_driver msc313e_pwm_driver = { + .probe = msc313e_pwm_probe, + .driver = { + .name = DRIVER_NAME, + .of_match_table = msc313e_pwm_dt_ids, + }, +}; +module_platform_driver(msc313e_pwm_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Mstar MSC313e PWM driver"); +MODULE_AUTHOR("Daniel Palmer "); From patchwork Wed Jun 15 07:08:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12881876 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 E3D4EC433EF for ; Wed, 15 Jun 2022 07:10:03 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/cZJ2kkXYX8kM5TieC4ET+7gz+TKY/nKF6+SrAdqWfA=; b=3RLmcSUxSgcb+t 6A38C+UopDlxXQNwYbzeOONqb3+UJlFdoYzDUVNFBWDc06c6TKxKlquTAnHQqkAVHd14hbv/kp7+v bWHjPloLHL5gmaJAJRVCcRX+FEosMA663dCCKuHFP7vUlZiLLwelOZglkc1K/LTUJgPm3LE8qZeyu WKXJ2ZGAIrtmWf0ynhSjzOLImLbplt2EFHz5m1eSnv4U7HYR9gCwDSgyVzWGenqxAJBhJ6VvMofy7 5THBRKnucdICOUr5FQ2VRGR7RzxdTtrh/YbRxcnMZZJD6iJdJFiimSNKdEyHvAaTlOgVO/sjHDooS jbontgFLiIjVDmZLKbZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N9E-00CzPx-5H; Wed, 15 Jun 2022 07:09:04 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8s-00CzJ0-UW for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:08:44 +0000 Received: by mail-wr1-x434.google.com with SMTP id k19so14027275wrd.8 for ; Wed, 15 Jun 2022 00:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LwR7/AOTal+NwY86Mp0FPWEx+VIIdg+npTDhkz4uRZA=; b=gL8bFY2m4va0wZeJRgUWqT7kUBrgClgBRzeWX6YYme41Px5+XLUsZs9BZHzhA+j5uJ QpBDiZsW+/xE0hj0VZ2mae9c9SV/iffmUp+YaRKTjsQ5uxNFtRv8KVw07hkNc5hb2YHR Tt5zploYnrKt3aBmE4ykfGtpuKVbQj/z2Y3dmPwPKCl6BCsNBJE2maanXiYn9AIVrrFl vBKDO78TRIcjTOYXLwIcPD7t27vpH8gPK88BJ++c5uX0ES11ecP8lurhG+W7JxuinaLY R9rVz7bGM5P3rQb8mEoOkIBv4CTekqz9YbPYHu3acTS35H86hDApTQS2WCuz6Ineo8So 35jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LwR7/AOTal+NwY86Mp0FPWEx+VIIdg+npTDhkz4uRZA=; b=8OPSeiZ1Wj0SiRlgFyKt9AF51UU2vp35Ttl13ICgfrUdEnsU092bKgI2qDLFfYGwYd 6eAoLK1ieuToECDKRIC+xj2vxQCrfBCsFeDjCHxT/5QIf5r2o8W8cJi12zhWN2yxY660 V/gsq5NpXs6dN5uptNeucS+Khjg3z8rltvfgakXAw100iCRAVzSZiEm/Cqica1+XDnZ9 ZwXjqDrYp0uKYu7UbSS05PSYOY8W7naJGELCoIT+aN9WfSjak6M7tSZgVYj3BFtaer1f pKho46tYZuDbrnb73r3chKHscjqfJTGKJzFWzNfG/OYF9fR7FqXLkp5Dj/LrJoyP7sLC bsHg== X-Gm-Message-State: AJIora+d82QCEViSexif6nBfRm4oLKIqXtnFWaBkm1DS0mZmZztYOkig naFpqMyVIHBlILb3x/momWg= X-Google-Smtp-Source: AGRyM1ssv4YeT78/571fz1QIuy4yDwJUyp3ElYxO5BCNbb/YE3woCIMzzu8jcbMtQbq4IB8m1ejJpA== X-Received: by 2002:a5d:6d8a:0:b0:219:b7fc:f29d with SMTP id l10-20020a5d6d8a000000b00219b7fcf29dmr7969502wrs.665.1655276913323; Wed, 15 Jun 2022 00:08:33 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id d9-20020adffd89000000b002102d4ed579sm13472386wrr.39.2022.06.15.00.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 00:08:32 -0700 (PDT) From: Romain Perier To: Thierry Reding , Lee Jones , Daniel Palmer , Romain Perier , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] ARM: dts: mstar: Add pwm device node to infinity Date: Wed, 15 Jun 2022 09:08:11 +0200 Message-Id: <20220615070813.7720-4-romain.perier@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615070813.7720-1-romain.perier@gmail.com> References: <20220615070813.7720-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_000843_027787_C663EC3C X-CRM114-Status: GOOD ( 12.78 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds the definition of the pwm device node. The PWM being able to work with the oscillator at 12Mhz for now, it shares the same xtal than other devices (rtc or watchdog for instance). Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-infinity.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity.dtsi b/arch/arm/boot/dts/mstar-infinity.dtsi index 441a917b88ba..752f4c26b31c 100644 --- a/arch/arm/boot/dts/mstar-infinity.dtsi +++ b/arch/arm/boot/dts/mstar-infinity.dtsi @@ -38,6 +38,16 @@ opp-800000000 { }; }; +&soc { + pm_pwm: pwm@1f001da0 { + compatible = "mstar,msc313-pwm"; + reg = <0x1f001da0 0xc>; + #pwm-cells = <2>; + clocks = <&xtal_div2>; + status = "disabled"; + }; +}; + &cpu0 { operating-points-v2 = <&cpu0_opp_table>; }; From patchwork Wed Jun 15 07:08:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12881878 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 7E1BBCCA47B for ; Wed, 15 Jun 2022 07:10:27 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qj7JE+OK6VbE8sZJrHbAAm9ZhxATVJfZMqXBIeKqEKI=; b=XvSUvFcXtjjZ0X 0l6B2PHxoKDhjweiof3NKNXOZ1d0r+oNgcRsEFSb94oKDUh6HoGudI5QEotYcDOm9aBULr/dgf5dy vYU7fhN/55midPihw/DbQdoGBF2A+sbCibAurt57dPwmhTjIi4tSgszz9TqyJnBnNCRXeMMDeM/W2 52L4P8mJplTQ1VblxFLvfQHok1KqkBS3hVRGq2mUYat3y0edBWUcEMseSOwH/cr5fH6bE8NZesxyk kzIaltNTRRIaytegNGhT6R0LOzns4Ny3+Qa6c5P3yQMnry4wMkL/hYPoroqDkUUf3s3/h4jxPlL3J dMfaaZfUJuKxSQOkXvYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N9Z-00CzYk-I4; Wed, 15 Jun 2022 07:09:25 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8x-00CzJF-Rp for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:08:49 +0000 Received: by mail-wm1-x333.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso579626wms.3 for ; Wed, 15 Jun 2022 00:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cg9l8Dw5kbbaSW9iT/X0V7LIeInZuZuCPQHiyAl6l3A=; b=HSMAYc+f0kXflnPy03sKUdNFiTOuQZ3iMe+rh62nN4LXiC5pFvFZkSxmi7+eXnkHZZ 13FhRm49eumOmOzDZ0vi4jZNma5HJZEMeR1VPXqgNF24XkIWyzsLtYcrg2tgSAC56nng gYGbLWNqfhVJnIaZjqy7RRnUDw9V8BlR6LYF2hEZF851bJbi2O7gO/JOI7TgAnQG0lzj u7TGYOqa0C3DHVmfV9Fln7dswaHmqahG5AKzWlkIhaMXmWofXp9KWk9odTXLBXfcwNSP TnIz0CSDc841W3GpniUIrkM3Rb5HhkH3SK3Ljyhz3aH4vduqqisogxMF+bg+Ms+l4ZFp 2tPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cg9l8Dw5kbbaSW9iT/X0V7LIeInZuZuCPQHiyAl6l3A=; b=HGjbYfUkpN6yoSAPj8rt6wTj98oYbciSWguBhbcWzpO1zW/6gaUHKJHleYY8BfJKpN ve9inMyeeGH0C3R8mpiT+WS8kFusJZxNs5ICOa8/Srx7/66W4Ue4UoIYp4B0AHt21Jzp hlGQ6/k3iIUCuGakvvCf/y2UUc3ijZoxsa/SJY0p5Hig6CP/JECtTvksZ8zPU7SJinm2 KZfXK4uBdsqYEoyRj8sqJWPZHugHbrtNRCtgXDBShIZJyHi/XBQp5HRrQn82EL/QnOet z540WmnUCnz0tNhOLlYdmzum7gS9qXDG+2KZisXbXpv4FNbQYnxbVGJ7/SvmbP1ac0Ks Ax+g== X-Gm-Message-State: AOAM533RBxzOXhucP3689uk00tKce7Z31mBr8oFUmHDw/VMkH3FtYhWX VjR567bUL3l26jE6NCsWTds= X-Google-Smtp-Source: ABdhPJz8/duArN33thJ3UidKgsyl5Z3GS7szdDEqz4eiDcM555QgOBVw1pc9kTlG6+JTXnZMKPrvTA== X-Received: by 2002:a05:600c:240c:b0:39c:5b4b:f3c7 with SMTP id 12-20020a05600c240c00b0039c5b4bf3c7mr8244118wmp.127.1655276914191; Wed, 15 Jun 2022 00:08:34 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id l9-20020a5d4809000000b00219e8d28fb1sm13814277wrq.57.2022.06.15.00.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 00:08:33 -0700 (PDT) From: Romain Perier To: Thierry Reding , Lee Jones , Daniel Palmer , Romain Perier , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] ARM: dts: mstar: Add pwm device node to infinity3 Date: Wed, 15 Jun 2022 09:08:12 +0200 Message-Id: <20220615070813.7720-5-romain.perier@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615070813.7720-1-romain.perier@gmail.com> References: <20220615070813.7720-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_000847_977785_EA3902BD X-CRM114-Status: GOOD ( 12.76 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds the definition of the pwm device node. The PWM being able to work with the oscillator at 12Mhz for now, it shares the same xtal than other devices (rtc or watchdog for instance). Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-infinity3.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity3.dtsi b/arch/arm/boot/dts/mstar-infinity3.dtsi index a56cf29e5d82..aa26f25392d0 100644 --- a/arch/arm/boot/dts/mstar-infinity3.dtsi +++ b/arch/arm/boot/dts/mstar-infinity3.dtsi @@ -67,3 +67,13 @@ opp-1512000000 { &imi { reg = <0xa0000000 0x20000>; }; + +&riu { + pwm: pwm@3400 { + compatible = "mstar,msc313e-pwm"; + reg = <0x3400 0x400>; + #pwm-cells = <2>; + clocks = <&xtal_div2>; + status = "disabled"; + }; +}; From patchwork Wed Jun 15 07:08:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12881877 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 A916AC43334 for ; Wed, 15 Jun 2022 07:10:15 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nju0XHjI4MI9QQdAlZ1ODcJ/fh3IUvUSKt9NnjvQhwI=; b=cVc3H0UMrOh/Su tVqU1ZoO0xcwaiYYJM1Zo//zXovciSH2BGQJ+7opt0AeNa5j256OTXsvxX+1XuaqiBEXmFuGau3Bj YVnudSexRE3Ygj+zj/T6AX07eQltPiJUZJj4E/qIe8q/Xfb38RJFoK5w0t53mBV2xABMjAIjkBQ8T 5MRZkmHDk/6bA/NOQz/iMTj8r9WbzVCXiWFdzQ1XXElbNx0b7ve6pFjBIJqO8T6S7jMNsuPT/Sqsd WN8cCvinDycv+7RVML4UPup/JRhtMPbzDNGLsQDxIBPXnxJdIRlo7uF9GxmAeyju0Lzxp98pjeJwh PJBglj3NfTgHVOVimAqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N9O-00CzTn-6T; Wed, 15 Jun 2022 07:09:14 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1N8w-00CzJe-MW for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:08:47 +0000 Received: by mail-wm1-x32b.google.com with SMTP id n185so5783744wmn.4 for ; Wed, 15 Jun 2022 00:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XhHHfhBS4JEZS5T4Cqsky8UODYiFkR3zFwNbdfWOgRM=; b=B3CYB6Nl2KGF+oCOFeUR6gZzBF3a3b32bAom3UR9EAoLMEnX+yxruYjwcNyBnMBYkl Dk9BQ01Wzx7JQFlgvVgUTMRUSac8nLBg3mCEVa9T7qiJijaj7dlNeik5AC5x9NSD2ggd KWYDvbjRazPZ3QxQnCG0Ep6zIUM7F8LSdT5qo3J/B8bdJvx07PY3wZlwtePuDNpIXHry AVqwQKpUvEv7KscMM8dojQH/4hQoa0FJx4gF9vfm/LMOS+v1EpZwLwPRkZ6u2WyQFRvG /lDDxNO88QNANusB4C1VCw6pGFEV0gCvpHwAzbxygUE7zrSsmKWlbfSoYR2Ipo0/Wydf czww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XhHHfhBS4JEZS5T4Cqsky8UODYiFkR3zFwNbdfWOgRM=; b=qKB02wVUr5ZUwslceZW8mt2kN/HYvUM37e2YhBwf31jd6+fRb2PsHZXBrcJpA0HCtU OHtZWBPSHFiN5FFGMZX1AEbKqMaH8Cs7+UbniwWCm+0793wbiO98KyAQkDxjoTW1NrZz Il7GvWMvRIOGFfPzGZdk9EVp0jmS9CNEVbgOqPicmEvUx74cjCisLc4QCrsJrJxLiIRs 5+YZ4TVbNf7SW1ZGHrSfgiA5ABMY/ISCDvoc9u2298s9KgaB4MI3F7CBZFR7YC+5XYRT r0YBAQe5z81oH2YTTsgJCwLBkEc4cOJpuHNA/y9UvBWG87y5GnrRWwHNWQ6xsOuiT4bO w+tw== X-Gm-Message-State: AOAM533+SlrI5LUY/G0WvTQrNv36iGabsU0aAPFPiy/mv9OZoppn0Np7 YEm3qjiOR+M9GD9C8sm+f46V8qF6rrg= X-Google-Smtp-Source: ABdhPJx4NWtb3vWFFFfgrtFkg5c3A3KxJh3ThnO9v7JUj7JFhsIT9FFGr1tDDi/+cINTfg5V5a/R7Q== X-Received: by 2002:a7b:ce87:0:b0:39c:5509:660c with SMTP id q7-20020a7bce87000000b0039c5509660cmr8103989wmj.163.1655276915130; Wed, 15 Jun 2022 00:08:35 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id n10-20020a056000170a00b00219fb3a275csm12058044wrc.16.2022.06.15.00.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 00:08:34 -0700 (PDT) From: Romain Perier To: Thierry Reding , Lee Jones , Daniel Palmer , Romain Perier , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] ARM: dts: mstar: Add pwm device node to infinity2m Date: Wed, 15 Jun 2022 09:08:13 +0200 Message-Id: <20220615070813.7720-6-romain.perier@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615070813.7720-1-romain.perier@gmail.com> References: <20220615070813.7720-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_000846_781458_FE368C00 X-CRM114-Status: GOOD ( 12.03 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds definition of the pwm device node, infinity2m has its own hardware variant, so use the one for ssd20xd. Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-infinity2m.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi index 1b485efd7156..70561e512483 100644 --- a/arch/arm/boot/dts/mstar-infinity2m.dtsi +++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi @@ -32,6 +32,14 @@ cpu1: cpu@1 { }; &riu { + pwm: pwm@3400 { + compatible = "mstar,ssd20xd-pwm"; + reg = <0x3400 0x400>; + #pwm-cells = <2>; + clocks = <&xtal_div2>; + status = "disabled"; + }; + smpctrl: smpctrl@204000 { reg = <0x204000 0x200>; status = "disabled";