From patchwork Mon Jul 22 09:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Mergnat X-Patchwork-Id: 11052085 X-Patchwork-Delegate: neil.armstrong@linaro.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC581912 for ; Mon, 22 Jul 2019 09:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4D1728481 for ; Mon, 22 Jul 2019 09:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95B5228500; Mon, 22 Jul 2019 09:56:55 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 366F128481 for ; Mon, 22 Jul 2019 09:56:55 +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=Bi/F11BkJ7R72zcFUROwIWvNC5/FpPMmH2EpWNsHf50=; b=g6wxds9tWDASlnl59lJpvcqy5A 7ZFqEPwsFfGrPvz0hvhvU7sJcASsEnRxTnI9b70bZqf57YdaMrUN8Av2eNXoNW3ffzwxbnN0Y8zrs Pp7L5pajopRDGyINu1/uNt1BftTMzaRI2wZ+rocSy5t3EFtNL/eKpQf7YinAIUoKDt/Et6LouzAnK y+CKYEqhyHGoVPxjGnVWlFqulm3CE85uY+HL0/QJPXxeVt5ddCaPlhnEGq//ULCGTmliVw3z1LQJe An4t6nsMZpX8FG2tePram3pDj9yaNLZluiRoYsJYDhl5O2nGN00ah3hgwS/AXXZYIjatSyceaELjv 7m+lA36Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpV3u-0002L7-08; Mon, 22 Jul 2019 09:56:54 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpV1f-00088T-Gl for linux-amlogic@lists.infradead.org; Mon, 22 Jul 2019 09:54:49 +0000 Received: by mail-wr1-x443.google.com with SMTP id n4so38780519wrs.3 for ; Mon, 22 Jul 2019 02:54:35 -0700 (PDT) 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=FzybNdR15Qijg3J4fYjrwfuwdELElwLJSXj8hs/YBLw=; b=1yhteVtcPtFx4Ow5mRS1dEYidbu/9IxM9sPWNJNT45dOEo7E8OXzf6gEVZ9WGA/MTn I6w+jBuWDmggTJxDLUZlYKS8Y2muvq7EDEKDwEfO+CMDLCbuV6nKIOQBVICUfHRX7Lcj xBKAhXLscNeyht23Rn1AkeBZlgfokWedeKrfQICGs0WYR/wEEup+xhNjyD3dULRQ1aT+ rMg9Z6IkCygJZK2Vf6/Jx8lsKQH/6drWnK4otqUQr7DjG6srtxP3MhLrxDXi0H4tAHno oSo6NRsyq7/rsUJLATSY+F9m+FXBVJmbUUrG3DYGA3hJh9sWT4Yn8VZG1KtSlzh8kBqd v4cQ== 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=FzybNdR15Qijg3J4fYjrwfuwdELElwLJSXj8hs/YBLw=; b=P0ejf7v2tYXFgfmqAQwyBuGdwVTattk4SEmHrLWTrKy8yg/5b4QCZiECiYk9znhJNv bVUSCCDY7G6i265o5ErPXyv1EP+9QASVUpbxuK05KZHm2sMEZXcEwnEvHqSVDeCst6fQ n9mq/zYlQ0wLIxjGW8BOaWm58xMfnXaQbW/gIgn08GjAJa+ip6ATCQ4XfoSx/Jkgm8CR nOi5Qu4tUQq3iXLk9zNywWvbTnCqMPrkzC5UOkqKHnn4nG1RqCeBy/1MKsT8AsFMt43C 0eABbrSaWAxQKigJh+j2CUWByLXUDlx7/bOWgs5UcZR9qSF8MqMmC7TKI+iCeuUjYE/6 BNZQ== X-Gm-Message-State: APjAAAWxmd0nBrbhl7v4/TKQn0LDqu5/B/MkL6TZlTHIMURhFOCkeho7 IncvvPxlG+rg41l6fp80yFKXDQ== X-Google-Smtp-Source: APXvYqxz7bBeXcmL7PjwbF/jjbnawlFtyOHeGm6cHqounIFe8r151Sq4YxwMsZm5483RpcF7MmPOGg== X-Received: by 2002:adf:f1d1:: with SMTP id z17mr895976wro.190.1563789274244; Mon, 22 Jul 2019 02:54:34 -0700 (PDT) Received: from pop-os.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 91sm83158469wrp.3.2019.07.22.02.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 02:54:33 -0700 (PDT) From: Alexandre Mergnat To: jbrunet@baylibre.com Subject: [PATCH 6/8] clk: meson: clk-regmap: migrate to new parent description method Date: Mon, 22 Jul 2019 11:54:23 +0200 Message-Id: <20190722095425.14193-7-amergnat@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190722095425.14193-1-amergnat@baylibre.com> References: <20190722095425.14193-1-amergnat@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_025435_883704_7B2D61B8 X-CRM114-Status: GOOD ( 12.66 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: narmstrong@baylibre.com, sboyd@kernel.org, khilman@baylibre.com, Alexandre Mergnat , linux-kernel@vger.kernel.org, baylibre-upstreaming@groups.io, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 This clock controller use the string comparison method to describe parent relation between the clocks, which is not optimized. Migrate to the new way by using .parent_hws where possible (ie. when all clocks are local to the controller) and use .parent_data otherwise. Signed-off-by: Alexandre Mergnat --- drivers/clk/meson/axg.c | 3 +++ drivers/clk/meson/clk-regmap.h | 12 ++++++------ drivers/clk/meson/g12a.c | 6 ++++++ drivers/clk/meson/gxbb.c | 3 +++ drivers/clk/meson/meson8b.c | 3 +++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 7a3d795cc614..13fc0006f63d 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -1096,6 +1096,9 @@ static struct clk_regmap axg_gen_clk = { }, }; +#define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &axg_clk81.hw) + /* Everything Else (EE) domain gates */ static MESON_GATE(axg_ddr, HHI_GCLK_MPEG0, 0); static MESON_GATE(axg_audio_locker, HHI_GCLK_MPEG0, 2); diff --git a/drivers/clk/meson/clk-regmap.h b/drivers/clk/meson/clk-regmap.h index 1dd0abe3ba91..c4a39604cffd 100644 --- a/drivers/clk/meson/clk-regmap.h +++ b/drivers/clk/meson/clk-regmap.h @@ -111,7 +111,7 @@ clk_get_regmap_mux_data(struct clk_regmap *clk) extern const struct clk_ops clk_regmap_mux_ops; extern const struct clk_ops clk_regmap_mux_ro_ops; -#define __MESON_GATE(_name, _reg, _bit, _ops) \ +#define __MESON_PCLK(_name, _reg, _bit, _ops, _pname) \ struct clk_regmap _name = { \ .data = &(struct clk_regmap_gate_data){ \ .offset = (_reg), \ @@ -120,15 +120,15 @@ struct clk_regmap _name = { \ .hw.init = &(struct clk_init_data) { \ .name = #_name, \ .ops = _ops, \ - .parent_names = (const char *[]){ "clk81" }, \ + .parent_hws = (const struct clk_hw *[]) { _pname }, \ .num_parents = 1, \ .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), \ }, \ } -#define MESON_GATE(_name, _reg, _bit) \ - __MESON_GATE(_name, _reg, _bit, &clk_regmap_gate_ops) +#define MESON_PCLK(_name, _reg, _bit, _pname) \ + __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ops, _pname) -#define MESON_GATE_RO(_name, _reg, _bit) \ - __MESON_GATE(_name, _reg, _bit, &clk_regmap_gate_ro_ops) +#define MESON_PCLK_RO(_name, _reg, _bit, _pname) \ + __MESON_PCLK(_name, _reg, _bit, &clk_regmap_gate_ro_ops, _pname) #endif /* __CLK_REGMAP_H */ diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index 5cad8cee142b..891140eaeefb 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -3318,6 +3318,12 @@ static struct clk_regmap g12a_ts = { }, }; +#define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &g12a_clk81.hw) + +#define MESON_GATE_RO(_name, _reg, _bit) \ + MESON_PCLK_RO(_name, _reg, _bit, &g12a_clk81.hw) + /* Everything Else (EE) domain gates */ static MESON_GATE(g12a_ddr, HHI_GCLK_MPEG0, 0); static MESON_GATE(g12a_dos, HHI_GCLK_MPEG0, 1); diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 65ba08c210d2..45b4c0e62d7a 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -2576,6 +2576,9 @@ static struct clk_regmap gxbb_gen_clk = { }, }; +#define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &gxbb_clk81.hw) + /* Everything Else (EE) domain gates */ static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0); static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 8d0e362d750d..3414e573b8a1 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -2550,6 +2550,9 @@ static struct clk_regmap meson8b_cts_i958 = { }, }; +#define MESON_GATE(_name, _reg, _bit) \ + MESON_PCLK(_name, _reg, _bit, &meson8b_clk81.hw) + /* Everything Else (EE) domain gates */ static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);