Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1839936imm; Fri, 6 Jul 2018 07:26:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdkqVB1Arza3IxUOwPGrIW8rlNpd0iWTmRl/iYXA4C9ZvjkkXs+xNbLG6ilxzi4RToFehT6 X-Received: by 2002:a17:902:3124:: with SMTP id w33-v6mr10439423plb.235.1530887190627; Fri, 06 Jul 2018 07:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530887190; cv=none; d=google.com; s=arc-20160816; b=T5ZtVAeEgkhsA5Y/QqSMc62bNoyTQ/+9K430SlAGciWts1N3KytD927h/9PjJQhuvX 91ptR5JkAkIiZ+cMH9t894W88b25v5cNHtk9xo4gQfNlMq+FwoRbya6Dl5cJSow+LplT 8OdfRW/kg0l8Owp8wlbwstcfVOwL5bwJW8TVi0uGB4k6wPWhS1UtNOp8DYfJDrc1mZIz PwS4OMt6OYjVVZdH6IE1g2z3G6qLvQsXJceezL2zSGxbcVK/H1ZwT9wNzzbOwfQmKkJ5 VaJsrC8K2mS0AL0JMUIIZBdRukeZlqP1W8iZnlUelDMKBp/mUbjY89EJSKCA2S+UQei/ Z3rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=VBrKBEYysaQ/cSyNTAkpK0U76C4lvDUjBFL0pgHPR2Y=; b=xw/TUL6VX11lt+RmbcKmVFXbmbSPufLOIRXhuGSgn4UV8X7Ph2PlsQGklK7QQW+/1M TDe4Ej+vcVg6jvtlpd22m4KndJaRmpsY85xA9o9uB+WHKn3hSA89PHAXmBJsgpwLl+BN 4SRZLsg04sKOHs7U2RZTSiEOB/61+a/1i3vt23ZgURgX/Kxn/NcDTJQZLlCdDc5GCN2F 91ux9Ple49CtdrZU71bpcPTk2wxygpPpM0CxjKYXdQwo4/hA7rXTxOHpHbSmjbV8WjoD FCujrTzHsq1pRv/TA1ZiDBLRdivWanxWtgXXoZek2l4uvPAXfH1B1RverPmbUYozwuqo QDrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=hbnFem7D; 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g67-v6si8652058plb.73.2018.07.06.07.26.15; Fri, 06 Jul 2018 07:26:30 -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=@nxp.com header.s=selector1 header.b=hbnFem7D; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932706AbeGFOZW (ORCPT + 99 others); Fri, 6 Jul 2018 10:25:22 -0400 Received: from mail-eopbgr70054.outbound.protection.outlook.com ([40.107.7.54]:26624 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753705AbeGFOZU (ORCPT ); Fri, 6 Jul 2018 10:25:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VBrKBEYysaQ/cSyNTAkpK0U76C4lvDUjBFL0pgHPR2Y=; b=hbnFem7DMo3i9G/oM65Iny6qmcsUnpnbLX1ojg6845+NCtTT1bh7nTDjIchuDYjeZhhJR4+Dk+kbvcKAqBi7qGQpxgJG8WdlbOSfY4IUazD9o8tPVKDYSq8+FRe+pys1CZMMbmrsndUCzKW8fHob9UFMxUCmVO3hUh+O49NzfG8= Received: from HE1PR04MB3289.eurprd04.prod.outlook.com (10.170.255.157) by HE1PR04MB3113.eurprd04.prod.outlook.com (10.171.196.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Fri, 6 Jul 2018 14:25:16 +0000 Received: from HE1PR04MB3289.eurprd04.prod.outlook.com ([fe80::882f:418e:1cfa:786e]) by HE1PR04MB3289.eurprd04.prod.outlook.com ([fe80::882f:418e:1cfa:786e%4]) with mapi id 15.20.0930.016; Fri, 6 Jul 2018 14:25:16 +0000 From: Shenwei Wang To: "thierry.reding@gmail.com" CC: "linux-pwm@vger.kernel.org" , dl-linux-imx , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2 1/4] pwm: fsl-ftm: Added a dedicated IP interface clock Thread-Topic: [PATCH v2 1/4] pwm: fsl-ftm: Added a dedicated IP interface clock Thread-Index: AQHT/14eon3OMNqy9UmcYn13+b0vSKRyvsXggA+styA= Date: Fri, 6 Jul 2018 14:25:16 +0000 Message-ID: References: <20180608192237.11063-1-shenwei.wang@nxp.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shenwei.wang@nxp.com; x-originating-ip: [64.157.242.222] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HE1PR04MB3113;7:8XP/GQkBNyv8borCHnQFSUzt8T0hS5rh4zUAx/fDfSpR/VXKKFK79O29y92tFaBBzwWEaHBNpIx6k/yDoCnE6mThZuSGmXvDGWkJDJ3H6zCcMp+FitjD9Xq00G44uzNZ0gS4eQujHuer6i7nxkSJBSvfUsfpd9O1y9H+25tVhXq/dCbUXU9Mpu89cTwxLa3Wo+q2Xnxt9xoV4Ww/CEvRmC9qZgk1PAowyc6tWOdUDooeJ4KWhJ32UG+jhEnQiJte x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 06701d5f-8ffc-4ed9-aed5-08d5e34c4b95 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:HE1PR04MB3113; x-ms-traffictypediagnostic: HE1PR04MB3113: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(85827821059158); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:HE1PR04MB3113;BCL:0;PCL:0;RULEID:;SRVR:HE1PR04MB3113; x-forefront-prvs: 0725D9E8D0 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(346002)(136003)(39860400002)(376002)(13464003)(199004)(189003)(39060400002)(14454004)(74316002)(9686003)(33656002)(478600001)(6436002)(54906003)(5660300001)(97736004)(6116002)(76176011)(229853002)(8936002)(66066001)(99286004)(25786009)(7696005)(5640700003)(55016002)(5250100002)(68736007)(44832011)(446003)(6246003)(26005)(4326008)(81166006)(81156014)(8676002)(486006)(2351001)(106356001)(7736002)(1361003)(53936002)(86362001)(575784001)(53546011)(2501003)(2900100001)(3846002)(14444005)(105586002)(305945005)(6506007)(6916009)(476003)(316002)(186003)(2906002)(11346002)(102836004)(256004);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB3113;H:HE1PR04MB3289.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3b0qlr+MjwJK6YOM9NpEGmrVW0dBsiiR62WR8DJZbQnA0VQAVQjExiZpotnZtGBMlTT/ClMMu7+6qEg76ImzYfdnOyCokmD+OmKewvMX2N/7Dk7XSCQP4c/LwgnZGBEfKxXlZ6mdRGBd8hZxQTdajqXZ841a7MoXeCXZPWf5Sa9R+w4GYLHsdmXvI9akOovEox3WvQ2HPRmDyhM6l7rRV36HetLsd6Oj076kzXrXs1UVLoeQHy1PuDEUUR/9L875KDgMn7XBm9lTNzzKokUbjKHBiOW/3dbVXKt+ztMizz+kOTMHKylNrZDZ3slOSxYcp1at9o+GFOGYpFVyLEdHzhdDJJ0kaMD9BkJw+Vg1TTM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06701d5f-8ffc-4ed9-aed5-08d5e34c4b95 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2018 14:25:16.5822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2nd ping. Regards, Shenwei -----Original Message----- From: Shenwei Wang=20 Sent: Tuesday, June 26, 2018 10:03 AM To: thierry.reding@gmail.com Cc: linux-pwm@vger.kernel.org; dl-linux-imx ; linux-kern= el@vger.kernel.org Subject: RE: [PATCH v2 1/4] pwm: fsl-ftm: Added a dedicated IP interface cl= ock Ping. Shenwei -----Original Message----- From: Shenwei Wang=20 Sent: Friday, June 8, 2018 2:23 PM To: thierry.reding@gmail.com Cc: linux-pwm@vger.kernel.org; dl-linux-imx ; linux-kern= el@vger.kernel.org; Shenwei Wang Subject: [PATCH v2 1/4] pwm: fsl-ftm: Added a dedicated IP interface clock The current driver assumes that the ftm_sys clock works as one of the clock= sources for the IP block as well as the IP interface clock. This assumptio= n does not apply any more on the latest i.MX8x SoC family. On i.MX8x SoCs, = a dedicated IP interface clock is introduced and it must be enabled before = accessing any FTM registers. Moreover, the clock can not be used as the sou= rce clock for the FTM IP block. This patch introduces the ipg_clk as the de= dicated IP interface clock and by default it is the same as the ftm_sys clo= ck if not specified. Signed-off-by: Shenwei Wang --- drivers/pwm/pwm-fsl-ftm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c index 55= 7b4ea..df0a1c0 100644 --- a/drivers/pwm/pwm-fsl-ftm.c +++ b/drivers/pwm/pwm-fsl-ftm.c @@ -87,6 +87,7 @@ struct fsl_pwm_chip { =20 int period_ns; =20 + struct clk *ipg_clk; struct clk *clk[FSL_PWM_CLK_MAX]; }; =20 @@ -99,14 +100,14 @@ static int fsl_pwm_request(struct pwm_chip *chip, stru= ct pwm_device *pwm) { struct fsl_pwm_chip *fpc =3D to_fsl_chip(chip); =20 - return clk_prepare_enable(fpc->clk[FSL_PWM_CLK_SYS]); + return clk_prepare_enable(fpc->ipg_clk); } =20 static void fsl_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { struct fsl_pwm_chip *fpc =3D to_fsl_chip(chip); =20 - clk_disable_unprepare(fpc->clk[FSL_PWM_CLK_SYS]); + clk_disable_unprepare(fpc->ipg_clk); } =20 static int fsl_pwm_calculate_default_ps(struct fsl_pwm_chip *fpc, @@ -363,= 7 +364,7 @@ static int fsl_pwm_init(struct fsl_pwm_chip *fpc) { int ret; =20 - ret =3D clk_prepare_enable(fpc->clk[FSL_PWM_CLK_SYS]); + ret =3D clk_prepare_enable(fpc->ipg_clk); if (ret) return ret; =20 @@ -371,7 +372,7 @@ static int fsl_pwm_init(struct fsl_pwm_chip *fpc) regmap_write(fpc->regmap, FTM_OUTINIT, 0x00); regmap_write(fpc->regmap, FTM_OUTMASK, 0xFF); =20 - clk_disable_unprepare(fpc->clk[FSL_PWM_CLK_SYS]); + clk_disable_unprepare(fpc->ipg_clk); =20 return 0; } @@ -441,6 +442,15 @@ static int fsl_pwm_probe(struct platform_device *pdev) if (IS_ERR(fpc->clk[FSL_PWM_CLK_CNTEN])) return PTR_ERR(fpc->clk[FSL_PWM_CLK_CNTEN]); =20 + /* ipg_clk is the interface clock for the IP. + * If not provided, use the ftm_sys clock as + * the default + */ + fpc->ipg_clk =3D devm_clk_get(&pdev->dev, "ipg"); + if (IS_ERR(fpc->ipg_clk)) + fpc->ipg_clk =3D fpc->clk[FSL_PWM_CLK_SYS]; + + fpc->chip.ops =3D &fsl_pwm_ops; fpc->chip.of_xlate =3D of_pwm_xlate_with_flags; fpc->chip.of_pwm_n_cells =3D 3; @@ -480,7 +490,7 @@ static int fsl_pwm_suspend(struct device *dev) if (!test_bit(PWMF_REQUESTED, &pwm->flags)) continue; =20 - clk_disable_unprepare(fpc->clk[FSL_PWM_CLK_SYS]); + clk_disable_unprepare(fpc->ipg_clk); =20 if (!pwm_is_enabled(pwm)) continue; @@ -503,7 +513,7 @@ static int fsl_pwm_resume(struct device *dev) if (!test_bit(PWMF_REQUESTED, &pwm->flags)) continue; =20 - clk_prepare_enable(fpc->clk[FSL_PWM_CLK_SYS]); + clk_prepare_enable(fpc->ipg_clk); =20 if (!pwm_is_enabled(pwm)) continue; -- 2.9.2