From patchwork Tue May 3 15:56:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 9005551 Return-Path: X-Original-To: patchwork-linux-clk@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0F109BF29F for ; Tue, 3 May 2016 15:57:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36DB0202B8 for ; Tue, 3 May 2016 15:57:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58D462021F for ; Tue, 3 May 2016 15:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933483AbcECP5N (ORCPT ); Tue, 3 May 2016 11:57:13 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:35069 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933891AbcECP5J (ORCPT ); Tue, 3 May 2016 11:57:09 -0400 Received: by mail-oi0-f66.google.com with SMTP id w198so3556129oiw.2; Tue, 03 May 2016 08:57:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fnWRYKodZk5sbB6CZ+BZ9YnxB7L/FFK92O4bLkSu9bY=; b=IVVPnpBKFsnl7r+0Gml7wngzqjpMlthM342/1j0trt4HFaWJuhdyLaP6Kq/f9YS1xH rHXDW8EmTknzNs7Oj/Ll0wzZ7s0BW+S7C36gRJHM5WDp/3UCt5HNnvNyTFR5pY6ZxiWZ U5UTtuE8Unrp2uPUkMgC0SErOdVRvF4Ju/dg5E7/EiltjvOesc+KOYZgBQgO60mTVml5 11mDdIIX1x5nD5zfNUWy2MXGbyx7MeeWwtTp0CG41ou+Gu8glu9nXYiDNr3XEjpvlRaZ 1YjixhHSRXOIKC+jnikUDckCtP+XKCyvYHzMAMlPw0N0k7KLzNl6JYDPsv4ur4D612BM jOgg== X-Gm-Message-State: AOPr4FWM3khZdTEhD0qAA313LPU1O1uLquzYs0IZdRdiwso6XEBKztb6I8HRF26USLM2Gg== X-Received: by 10.157.45.136 with SMTP id g8mr1774917otb.133.1462291028129; Tue, 03 May 2016 08:57:08 -0700 (PDT) Received: from beast-server.fios-router.home ([173.64.219.161]) by smtp.gmail.com with ESMTPSA id 131sm1245815oia.9.2016.05.03.08.57.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 May 2016 08:57:07 -0700 (PDT) From: Franklin S Cooper Jr To: thierry.reding@gmail.com, robh+dt@kernel.org, tony@atomide.com, linux@arm.linux.org.uk, paul@pwsan.com, t-kristo@ti.com, mturquette@baylibre.com, sboyd@codeaurora.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, vigneshr@ti.com, nsekhar@ti.com Cc: Franklin S Cooper Jr Subject: [PATCH v8 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings Date: Tue, 3 May 2016 10:56:52 -0500 Message-Id: <1462291015-1919-7-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1462291015-1919-1-git-send-email-fcooper@ti.com> References: <1462291015-1919-1-git-send-email-fcooper@ti.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When using the old eCAP and ePWM bindings for AM335x and AM437x the clock can be retrieved from the PWMSS parent. Newer bindings will insure that this clock is provided via device tree. Therefore, update this driver to support the newer and older bindings. In the case of the older binding being used give a warning. Signed-off-by: Franklin S Cooper Jr --- drivers/pwm/pwm-tiecap.c | 7 +++++++ drivers/pwm/pwm-tiehrpwm.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index 616af76..a0833c8 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c @@ -195,6 +195,7 @@ static const struct pwm_ops ecap_pwm_ops = { }; static const struct of_device_id ecap_of_match[] = { + { .compatible = "ti,am3352-ecap" }, { .compatible = "ti,am33xx-ecap" }, {}, }; @@ -213,6 +214,12 @@ static int ecap_pwm_probe(struct platform_device *pdev) return -ENOMEM; clk = devm_clk_get(&pdev->dev, "fck"); + + if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) { + dev_warn(&pdev->dev, "Binding is obsolete.\n"); + clk = devm_clk_get(pdev->dev.parent, "fck"); + } + if (IS_ERR(clk)) { dev_err(&pdev->dev, "failed to get clock\n"); return PTR_ERR(clk); diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 6a41e66..cee29a2 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c @@ -426,6 +426,7 @@ static const struct pwm_ops ehrpwm_pwm_ops = { }; static const struct of_device_id ehrpwm_of_match[] = { + { .compatible = "ti,am3352-ehrpwm" }, { .compatible = "ti,am33xx-ehrpwm" }, {}, }; @@ -444,6 +445,12 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev) return -ENOMEM; clk = devm_clk_get(&pdev->dev, "fck"); + + if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) { + dev_warn(&pdev->dev, "Binding is obsolete.\n"); + clk = devm_clk_get(pdev->dev.parent, "fck"); + } + if (IS_ERR(clk)) { dev_err(&pdev->dev, "failed to get clock\n"); return PTR_ERR(clk);