From patchwork Fri Nov 30 11:53:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 152534 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3562955ljp; Fri, 30 Nov 2018 03:54:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/V1cljflC45Ml5kTnNEMb3cSZXPmT5s8XAjVGlESDnnlcy8bIGKqX+USBBaM4BdHZ6qDq03 X-Received: by 2002:a17:902:8d8e:: with SMTP id v14mr5353388plo.133.1543578840952; Fri, 30 Nov 2018 03:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543578840; cv=none; d=google.com; s=arc-20160816; b=WO8jWe3/Ze0pLckFdq9L/YdYMKqr9C4Xixo26nuiWFgHy0Z4ieRUqU1WOFS8X8ORm8 LV9mnwR2Trr5EnmtXPUxsSdPSMokiaELUiQtP2b8ZrntL/14qzPJk7KLusElyzngPNc5 +JT6b8CjToMhRkBxFTmOoqATcagkGOVDN1+7Mpn8CXJxqFRQG0VSg1tNDxAqZSZn46tG IRaK/m14odAWpa2Rgy2xmgd6Og2opHL6wRrXcdpxjxXwgSjGakwd0qXaoH4aei7TJ3wu gK/T85tEgME9p8lprCC5kb6J1hvDyMMU2gtqyrasUzJnSHXaW1a2EGT0CFfovWKPCAav TFvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zehP8SR5e83ZAa8EuIqw69rvUStjAg1EoGYsdwg63ew=; b=RocsCox9cSNlgvxxG5rrQDvwDtRc8fnpst+bTq3iC+G9A3Wi398pcXDdOhNvE/LIAm mfXFolKJ7C6gplGDPCa4j8HvrbtN2GtZQz+ZQnWLDZ0TuoGqoQalK/A6P5IP8U8cKAxn xyNmsdgE9GIpUkKDFCOT3MnWVFOZS383/PmeW0fGE2ev7HRxGN+OiuECsGTbo8HJ1xQJ kX+D00Sl2URrNCYJsOJfy8LKR4mn6anCifGM7hMERhUZme6CJe3u6QAiTHRxHysx9a4U RNvs5UrmfQskMi/kgwaxEmhVKCqapWquURhBPIkKakcRnUfPY2LJMh8PSafs9419Dc5W gYNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fVIJri1Z; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si4991893plo.165.2018.11.30.03.54.00; Fri, 30 Nov 2018 03:54:00 -0800 (PST) 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=@linaro.org header.s=google header.b=fVIJri1Z; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727185AbeK3XDA (ORCPT + 32 others); Fri, 30 Nov 2018 18:03:00 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:34220 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727063AbeK3XCo (ORCPT ); Fri, 30 Nov 2018 18:02:44 -0500 Received: by mail-ed1-f66.google.com with SMTP id b3so4631240ede.1 for ; Fri, 30 Nov 2018 03:53:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zehP8SR5e83ZAa8EuIqw69rvUStjAg1EoGYsdwg63ew=; b=fVIJri1ZQrnQWoKV11mNCwZPt2ZEXq0CPQFBNAkqfA249EPI8p2cD5fadANgSGGD4t SBJYp5PpWskvhantQSiDnf4i1ehumeZAeZjE5FeN5TDgzSebyOCd2+t8HpgKNZDPXeya id9FZZZ2YEQ9QeGTOooL7fzvMTBVRgEopj7Ek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zehP8SR5e83ZAa8EuIqw69rvUStjAg1EoGYsdwg63ew=; b=sIQARGjK4thdtqBNNpsgbsUeHZBgCyAdxkwKHoqE5QLio3NiO6P0S827rq50okl0rB nEw8gOFKEGmsSkIt6OunJoEKTZNqPquuGfuexzmP62sFizDodwiT/9njO52ulo3WVciD Jcyyw5HUEVAawrj/1+/8e1ohEyErqROARvKHQDzIFBx6qIkt9N86j14AJbYcQXN/ZW0V hSKbWRkoeSgG6oJfquCFKLms/SNK7JJw4VGWXi4b9H4rIq9ptLEiV8xiRWUMgNZNYmb3 ytfMdG/9hr2/889DLloQWxrsCHLFELGJCSOyZdh8VYxaxpsYJKAixjg2Dn7CdOYRXTTD Ojgw== X-Gm-Message-State: AA+aEWb9CTjpg4NQ/dSdXN83VezYY251REsNVUjrE9YWUNxpxcQ0l9Fs oe041wuyzZna9O0xIkO69vkByg== X-Received: by 2002:a50:8b26:: with SMTP id l35mr4822677edl.146.1543578821670; Fri, 30 Nov 2018 03:53:41 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id t10-v6sm767932ejg.41.2018.11.30.03.53.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Nov 2018 03:53:41 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Jerome Brunet , Srinivas Kandagatla Subject: [PATCH 4/6] nvmem: meson-efuse: add peripheral clock Date: Fri, 30 Nov 2018 11:53:23 +0000 Message-Id: <20181130115325.16539-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181130115325.16539-1-srinivas.kandagatla@linaro.org> References: <20181130115325.16539-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerome Brunet Get and enable the peripheral clock required by the efuse device. The driver has been handle to work without it so far because the clock was left enabled by default but it won't be the case soon. Signed-off-by: Jerome Brunet Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/meson-efuse.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.19.2 diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 40b9df1d030d..99372768446b 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -14,6 +14,7 @@ * more details. */ +#include #include #include #include @@ -46,7 +47,31 @@ static int meson_efuse_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct nvmem_device *nvmem; struct nvmem_config *econfig; + struct clk *clk; unsigned int size; + int ret; + + clk = devm_clk_get(dev, NULL); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get efuse gate"); + return ret; + } + + ret = clk_prepare_enable(clk); + if (ret) { + dev_err(dev, "failed to enable gate"); + return ret; + } + + ret = devm_add_action_or_reset(dev, + (void(*)(void *))clk_disable_unprepare, + clk); + if (ret) { + dev_err(dev, "failed to add disable callback"); + return ret; + } if (meson_sm_call(SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) { dev_err(dev, "failed to get max user");