From patchwork Mon Feb 12 14:58:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10213161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B78160467 for ; Mon, 12 Feb 2018 15:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5A928BEB for ; Mon, 12 Feb 2018 15:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F7FD28CCB; Mon, 12 Feb 2018 15:00:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C57028CB7 for ; Mon, 12 Feb 2018 15:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h9+FSVH+mi3ZeqS4hEJIT5/W5jgME0soKFuIa0pbbiY=; b=Nns7R694G2pIjwXKv/DeLMoHsF ZxySshQ2dNf6l4PEyYRYJd+A51bJyR6yM9Z6O1qLmISMIOoqkzb3uxMF0sM8SYWn0mNy+BobdhMMd e3XZvl+6iLkbl0psBlaG4e52uOzUG/BkRw+gOQ4jud+O2FVUmbr0UGz5JJOWTdEEpgt/wKVHKeMVS bZiQy47bZTQde2eanOqom48Vr5tjHcD9UQNyqvw6WInY0LrVqWOnPkgZAE2FCuRM50Bc07YR46aDw VmBt+kvxEg4cNQ7d/AuKFV47RCx/oA+rXaVG2Yu4Pthby5kHvDje5EM7r4nChlYRPCMzbHlX18woB JJJ8tGmA==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elFaC-00022p-3i for patchwork-linux-amlogic@patchwork.kernel.org; Mon, 12 Feb 2018 14:59:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=h9+FSVH+mi3ZeqS4hEJIT5/W5jgME0soKFuIa0pbbiY=; b=H8ieIDRYNWu0NkfzEahUQ33TmX e1oLAblDN1Zsd1ADmyeMBjPQpBB4Y5IJzFekizX2AMBAXaJncwcGePop7G6TM7inkhOVP3ornfTMJ S/YuBWZpUJHLD56ECJxoyoSQOT9nFH7LR4xOEkS5Ijz+yOtp9y/KTyQWokdYUDzw5X4MU173tR5Ur a6CIrSaCKzUkOsaT24KsEp5XsW3yX5mtpNUk5PKubx8F1lR6TumSZ5Ad8V9wF8POlOvRmwzBvwQSx tIAl2pmomKHTDgmPykq3mIe3tUkTJH0vVfPFPxj/RMG9sBthfUzz9aKAHDL1/2aOtUF8+VYPxWMxQ 1FwgTAww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1elFa6-00024e-7F; Mon, 12 Feb 2018 14:59:46 +0000 Received: from mail-wr0-f193.google.com ([209.85.128.193]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elFZc-0000zq-Oq for linux-amlogic@lists.infradead.org; Mon, 12 Feb 2018 14:59:18 +0000 Received: by mail-wr0-f193.google.com with SMTP id y3so15499708wrh.3 for ; Mon, 12 Feb 2018 06:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8mTNZTA+NOKvjqgo0IM05ynpCrM/csA/WX64EgsU+Hc=; b=g0OtkZdn2cRkeqDhVtcW3k43dAh/WnDLBD7gqpUWde9TPjAjnElAQc2ATSdH/YEcw+ SYpL8FgHaf0KLG/J84o4zTv2F8UARX/dkQzyCF4ZdDsPswCVBEI6Vq3detNElqKeApYN 7eW9yAuHWX/OUTgzGlprE7jJ0oa0D3X50PoXBa80Km+wjALIlA4zWEHvpHjr8a1yfV6C xQcCrksCeKAXUYrw5SQyCUt1lavR2hherkTAhG8tPumr2ykE9YBUA/HqlJRRrq2DEg6V ls/XT40VSpe6sgji3xvrh2vuA6ntHAxIm6Aan2qFAsD6oQHwV4BNEpr9t3JiefXAxbIv AgjQ== 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; bh=8mTNZTA+NOKvjqgo0IM05ynpCrM/csA/WX64EgsU+Hc=; b=FsbwOl61EV2Ou+GT9TEU1k8pRSfDB/sKj8ypLt5l77vjkQB4zYGqOsbpXSj9SEgvNp BAU+PZ00hruAH2b5eofvO6gS4+/d3iiq5UOGXrIHiuoDbU4Dmhtn7J8KVX33I17pnaUy t90VPgwCgn+b7e2NV68ybOVfud3WWB8IgG6VQNEUGt5SlUQZvKlndfSOl3Cex1YtZt2u v89gyKzyW2u8yL9lK3yvZxrcM7Ap+azB4yS7p4IVoU2A5iz48tqm96I+3HrzWN3fpHtt oK8zxJRbiAgOpBgaOUCglmv5M0l92x5TmDfTssNTBTXS99IqqZQibm30Fr9IdwioPIwa UZrQ== X-Gm-Message-State: APf1xPDaEJ6qdaFRL0LfT1vU+ynv4GNAwMF/geRm2at7+oyoVjg2DJyD tVh2GJM8sQ6m86Jgw/c9F+dtlQ== X-Google-Smtp-Source: AH8x226obt8A0sNbfURjLFWB9RkbpLi07YGwHzEgRxPytrHA1xh+SjYDDsKrlc1VdR3q0sfnuOOc5A== X-Received: by 10.223.161.77 with SMTP id r13mr7522356wrr.230.1518447543647; Mon, 12 Feb 2018 06:59:03 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id p21sm4633218wmc.28.2018.02.12.06.59.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 06:59:03 -0800 (PST) From: Jerome Brunet To: Neil Armstrong , Kevin Hilman Subject: [PATCH v2 12/19] clk: meson: add regmap helpers for parm Date: Mon, 12 Feb 2018 15:58:39 +0100 Message-Id: <20180212145846.19380-13-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180212145846.19380-1-jbrunet@baylibre.com> References: <20180212145846.19380-1-jbrunet@baylibre.com> X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, Carlo Caione , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Meson clock drivers are using struct parm to describe each field of the clock provider. Providing helpers to access these fields with regmap helps to keep drivers readable Signed-off-by: Jerome Brunet --- drivers/clk/meson/clkc.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h index aa2dfa0ff89f..8edc25297422 100644 --- a/drivers/clk/meson/clkc.h +++ b/drivers/clk/meson/clkc.h @@ -38,6 +38,22 @@ struct parm { u8 width; }; +static inline unsigned int meson_parm_read(struct regmap *map, struct parm *p) +{ + unsigned int val; + + regmap_read(map, p->reg_off, &val); + return PARM_GET(p->width, p->shift, val); +} + +static inline void meson_parm_write(struct regmap *map, struct parm *p, + unsigned int val) +{ + regmap_update_bits(map, p->reg_off, SETPMASK(p->width, p->shift), + val << p->shift); +} + + struct pll_rate_table { unsigned long rate; u16 m;