From patchwork Wed Jan 31 18:09:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10194347 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 029AD60380 for ; Wed, 31 Jan 2018 18:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3EC928771 for ; Wed, 31 Jan 2018 18:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5CD8287A8; Wed, 31 Jan 2018 18:10:51 +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 bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6784428771 for ; Wed, 31 Jan 2018 18:10:51 +0000 (UTC) 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=MWFgtFmXWO4+GtYPwP+6Kq8lL5VJDxtccDwguLCO/s4=; b=GYkw1Fw6rxMFeLGyEZ7jOaedgp I/nBJViFO8ygnVDw3KTHZGzgXySuUNZ+ZiF5Uv6+mDMD/VDYDkKYzMnOi/Pn23oMJGI9RXQl5CaLB oPDCb0KYjmdu5bZm2yLCO1tnh3GCCP48CtMEiBKFybqZyoSIIK5Ag2jFaFp0Z3/WIGR2EW/ogIEDC RxIczmni87tAeX45IGWYJKv1g9pA800xqdnM6VeDFL5geGBVicn6SYHCevDDLy20bIiDOo0FUgJVI Cmy6/laR1KUsiiMnnmva7njAB++yyBw9Fkbdhl1u3wLaznuLHxgQQorNVla1qVOzreruiL4nisKpA U+8QspwA==; 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 1egwqF-0002B1-6G; Wed, 31 Jan 2018 18:10:39 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egwpo-0000UF-2Y for linux-amlogic@lists.infradead.org; Wed, 31 Jan 2018 18:10:23 +0000 Received: by mail-wr0-x243.google.com with SMTP id v15so16029599wrb.8 for ; Wed, 31 Jan 2018 10:10:03 -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=e+vf1qhS0h4+YgMv+5SHIduirc8O1rMhoPmfHS7bgBg=; b=aK2JLlxX1iq6Vp94zmW/CPbtpZT+Oj5lyi1UXF3J/5u0iWtaAVKhMDT9kF6UKH/vGv wpgzHqP7fJbYU6aY6D1/076Molvch0l5UlTWA1tLUzZBvVDDojOsnkLckyV2MRWuahIu +FCZjeW6NyeX3Xg7TEYNrGwVu1G8tM0T8xzpimiPLBlWTQ5YF8ROTcK+2r4B8NGnJtl3 FHyADtsjaI1GBx87buRH4QgwECK+OtP7VYoat9Cx+5Hc+Fhdw3Q/3apNdIiDxdsmcogS jbNlfbrbdyotFiR/NESthcSMCxrhZaMVIo3z1sPntVHkzA/gO5ZmfFP2zPB8xaFr+YN9 zy/g== 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=e+vf1qhS0h4+YgMv+5SHIduirc8O1rMhoPmfHS7bgBg=; b=X/phPlBl0eviNYns13GjBpY/hTpbKTeiRtjGbUEiDv6nwHYhbaNhGK9HG0TaJITdG+ ibqH3VeoJzvg5xirZWL1apMCNiLhn7yTr3mNo2Dqh/ggeHtycw2hH370eniGIO7i4KwO 19AQ0uEvodFRhmdACcXcXY4W9//aKgaV/HXXKvP3VTJxsqaev8hLl4ttVoFmviGmzH2S EJqVJkd1lMLDP6XdDYfaTbc+plgDlCX109QVxvB3EhJHXoT5mgzlKNnUGKc5R0w69Yuz cMkH1OEMhns3xU/224GpxJ+2LC3mF4KX+XnYBLse6qEoc4NS9Gs6sgVv7ApR9w1wBD90 sAmQ== X-Gm-Message-State: AKwxytfTuX83mpm3ixIx+fjJdaf2qhkkX6Kc6jNyBo1VB0bUhLIo8Jzt yMeoZG0Cq8XX+dB5xqHFwnamhw== X-Google-Smtp-Source: AH8x227zCMysIgfFx36U8hKBObrjrSwDHdBHtRrG/jENEGfXMKW7Gl0d+uYX+HlsZ6klZpD0pkmYaw== X-Received: by 10.223.148.162 with SMTP id 31mr9565993wrr.109.1517422202265; Wed, 31 Jan 2018 10:10:02 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id f8sm341977wmc.3.2018.01.31.10.10.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jan 2018 10:10:01 -0800 (PST) From: Jerome Brunet To: Neil Armstrong , Kevin Hilman Subject: [PATCH 12/19] clk: meson: add regmap helpers for parm Date: Wed, 31 Jan 2018 19:09:38 +0100 Message-Id: <20180131180945.18025-13-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180131180945.18025-1-jbrunet@baylibre.com> References: <20180131180945.18025-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 field with regmap helps 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;