From patchwork Tue May 30 07:53:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 768428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wm0-x23a.google.com (mail-wm0-x23a.google.com [IPv6:2a00:1450:400c:c09::23a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wcQpl0xyHz9s0Z for ; Tue, 30 May 2017 17:53:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="TCycrQfa"; dkim-atps=neutral Received: by mail-wm0-x23a.google.com with SMTP id g15sf5272683wmc.0 for ; Tue, 30 May 2017 00:53:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1496130827; cv=pass; d=google.com; s=arc-20160816; b=cEzcIUe2gEeprgCwbxEB4AD6o28yTchw5VxZzEC030WgPZCGR86+5dAw+p+DvsT1eM 3ZSxJS0J2PHjzLqTWd6TbsF2ua1YVPfKraj4gEyWuJ8GZaMWBwCbwPJRlBGmSwX1eSOi A8/wfN8BgxncRic6O0225Ay7EB3whug4UDQeu/WbS7uiEwGTwQlETXLHKL34B4feSN3D 4VqotG669pYg7Vclis7zhDNLjjegarjUP6l00TJCfjKbGdItSxJDxARuDu2i3fuTtk88 jJPu2rtEyQpr/y59WlFscwpPmyjJFZYvuC1POjRWk3YDo/lNlZxikmyFwmYf9Lmipd3w ScnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:message-id:date:subject:cc :to:from:arc-authentication-results:arc-message-signature :mime-version:sender:dkim-signature:arc-authentication-results; bh=AZuENSG0QPb40EDCOByuURYIQh6zOpsCT1p2kW5o0jI=; b=eMus40gYiZUkgUfKHdd5OJNs+MpZ4p5qg4whjPJDONr/l7GXfbn3Gmmlah1HQyI7Zg 3x3kYNjJLwjZhDawUDFcyGB3rsXA+MYV2zXmlfRy+LbEYg491IoH2FUQoMsSnEZCPnYW ymKID32qPifF795Mpxr8SgW9F85xMaWEfiMLmWL+WhT1vEcm9Goz27mQEdc+jh4iyrSD kR0GJBBhQybsbYfFmD6xSYSAZyleWM87GplJ7FlpMZnrs3JJzBzYABWm4J55ET/vcSoM etT18JPjz1+UwnO79bUe5YMCtnLW3f0HcPapcOZrNR744HThksNY/wYiOzbUhdkz7XP6 VQtg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of linus.walleij@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=AZuENSG0QPb40EDCOByuURYIQh6zOpsCT1p2kW5o0jI=; b=TCycrQfaKOEjbX4XQ1kcohvKTp2V8DQ8MVkBqrazVuaU/QqHU8QWb9rEtnauDy9tZU Rm6NDV1ed4FgSF0Xs7yHTAv+W/mIE6xr2P6hAITeJuPg9hmkWFqDm/R0PW7RtNcFbUKF uIOheZwLKc4Je0MCk+WDH51Eg/6uLTX59Te9FWb1FipWJrP/zGmzqaoNINT9uceH3Akz WM4ND0on9YOLDmwDh7CqGet8GFquEmrQEoH2lng84iI8URG34LxpJ+xCqt0Cu9vq+3up 2umbJR1Dv5qRbAOsHz5PSIkH/Hi8c0FMJYzoiRDe6/0AJFE+lt1NGEUvKHx5sCkbVTdc 34EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=AZuENSG0QPb40EDCOByuURYIQh6zOpsCT1p2kW5o0jI=; b=B7hvJzWaNZ1BJQf88kpxwiwFtFguAa+8LPYsoUoiZ780kOYkGvomV0z16cLJSJigzr E5ix7doH29EUiF77Bu7Ld7xMy1KmX2vvHVP6mylYrV1cLH+x2AkYvwWF3wgSfn3BwdZG vmIr1nZ17Vp5Gdj4469ihg82m+DySPbjLe5DBPi75T1fPHiQabVaeX5Z5/jxHvlImX2d ZQyjbfcFcdvLJiw8jy3zScEQhd3DSr4nqjKMX4q5e5ppJpSaZkPP0bXIvGKDTgwf61Wa rb4wi5M1FlRNqvMgx5S+I4KDjOD5khrr9wtj4QK/ei8zJ1kbiibruSjJbv7lCRnQgJRj QdVw== Sender: rtc-linux@googlegroups.com X-Gm-Message-State: AODbwcBFgdFlX3MRUkTeq2JYJ70jERkwXEGVP8JIkpbaKBsFuPHsRgmn WPLAdz4bS6C6KQ== X-Received: by 10.28.167.6 with SMTP id q6mr470wme.11.1496130827574; Tue, 30 May 2017 00:53:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.28.168.137 with SMTP id r131ls78951wme.12.gmail; Tue, 30 May 2017 00:53:46 -0700 (PDT) X-Received: by 10.28.40.5 with SMTP id o5mr31918wmo.21.1496130826705; Tue, 30 May 2017 00:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496130826; cv=none; d=google.com; s=arc-20160816; b=0T7jbMryuo4z79duScxmzbs4Evi9I3Ox1/K2S3Lgg8OluikwjAdX+2M6Jg230AFhkh NYB5gs3mSXSjEq7SYbRKqtgw7Ca8fUkT7wU3L9Zg6yRo4dHIwNyxZtutSJI+utbGXIPT ediIhyOto1WzZrtaOlsZ2igfky7OnmCvOrhhO5dWXflndJJaInONQ8yrAbbPKRdDyXov YjcUeuk3avNaIGUYuQVe7PJjGbQW27ThYtVxXIVojvy80RJKgqn+xxyL71nYmL5rRcfg bEBzBBd/3AAqqMiuOOAegHrl6G4YY6FKigas+USuIq1L/LXtwId1kiNgfDRTwb6ltlzk jNcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=jt60xuuhBE8YpuPV0k42LP6U/+MZ5nCpjXUsDUmo3aM=; b=kpOMnu+Ngf6ntn6y8mgdOC4zPKWmxC8YshbtW+8Dtgk4gPQkr3PWw15xpgZjQLwaxz takHC8UefHIL9itLDbT5g2epMzKOGgdlVg7rCXIUMTfO3294c3O88/xpKJ3uzkY7SF8e EUlPfrUgaJIUdM+TUg3B5qy/3peEJysOhFIb29n0yejVxhP/4s/nMC4C1pDkJzf5cDuf 9Tr3YUhDfoVuq8HeiysxmIpxnPO4QnQ06Ws0PjuasOppRUNqZEqM2cCJGwRcvpSO9TLX 76BTjhU8XcfIGNx4lLyVOvOSPxzs7Y0EF9EreyXXAdMI9K5vkUekwhqMd197C91Wkbxu 6OZw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of linus.walleij@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com. [2a00:1450:4010:c07::229]) by gmr-mx.google.com with ESMTPS id g11si523717wme.2.2017.05.30.00.53.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 00:53:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linus.walleij@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) client-ip=2a00:1450:4010:c07::229; Received: by mail-lf0-x229.google.com with SMTP id a5so44433342lfh.2 for ; Tue, 30 May 2017 00:53:46 -0700 (PDT) X-Received: by 10.46.72.25 with SMTP id v25mr5566989lja.38.1496130826367; Tue, 30 May 2017 00:53:46 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-9d7e71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.126.157]) by smtp.gmail.com with ESMTPSA id x24sm2445285ljd.5.2017.05.30.00.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2017 00:53:45 -0700 (PDT) From: Linus Walleij To: Alessandro Zummo , Alexandre Belloni Cc: rtc-linux@googlegroups.com, Linus Walleij Subject: [rtc-linux] [PATCH 1/3 v2] rtc: gemini: Add optional clock handling Date: Tue, 30 May 2017 09:53:30 +0200 Message-Id: <20170530075332.3740-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of linus.walleij@linaro.org designates 2a00:1450:4010:c07::229 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: rtc-linux@googlegroups.com X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , This makes the Gemini optionally take two clock references to the PCLK and EXTCLK. As we are adding a clock framework to the Gemini platform we need to make sure that we get the right references. Acked-by: Hans Ulli Kroll Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Use devm_clk_get() so we do not leave dangling clocks behind. - Add Hans' ACK. --- drivers/rtc/rtc-gemini.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c index 5279390bb42d..cf766e01832a 100644 --- a/drivers/rtc/rtc-gemini.c +++ b/drivers/rtc/rtc-gemini.c @@ -26,6 +26,7 @@ #include #include #include +#include #define DRV_NAME "rtc-gemini" @@ -38,6 +39,8 @@ struct gemini_rtc { struct rtc_device *rtc_dev; void __iomem *rtc_base; int rtc_irq; + struct clk *pclk; + struct clk *extclk; }; enum gemini_rtc_offsets { @@ -127,6 +130,27 @@ static int gemini_rtc_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, rtc); + rtc->pclk = devm_clk_get(dev, "PCLK"); + if (IS_ERR(rtc->pclk)) { + dev_err(dev, "could not get PCLK\n"); + } else { + ret = clk_prepare_enable(rtc->pclk); + if (ret) { + dev_err(dev, "failed to enable PCLK\n"); + return ret; + } + } + rtc->extclk = devm_clk_get(dev, "EXTCLK"); + if (IS_ERR(rtc->extclk)) { + dev_err(dev, "could not get EXTCLK\n"); + } else { + ret = clk_prepare_enable(rtc->extclk); + if (ret) { + dev_err(dev, "failed to enable EXTCLK\n"); + return ret; + } + } + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) return -ENODEV; @@ -156,6 +180,10 @@ static int gemini_rtc_remove(struct platform_device *pdev) { struct gemini_rtc *rtc = platform_get_drvdata(pdev); + if (!IS_ERR(rtc->extclk)) + clk_disable_unprepare(rtc->extclk); + if (!IS_ERR(rtc->pclk)) + clk_disable_unprepare(rtc->pclk); rtc_device_unregister(rtc->rtc_dev); return 0;