Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2260711pxu; Mon, 7 Dec 2020 01:36:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXeLL7C3gukDsS3avWuDCe4gEgGJFMUZVkuZA+QAgEMyv0fm/9E4ObGB0gHVqvvX0tyS1r X-Received: by 2002:aa7:dac5:: with SMTP id x5mr19445662eds.198.1607333777513; Mon, 07 Dec 2020 01:36:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607333777; cv=none; d=google.com; s=arc-20160816; b=thidUOIPYGy4yi7zWTpBVrAwgpT1GYKMdmbswbsJRNCPZoDOWCgthz6aFTmS0QJZ20 mPpI0vhJJCX3or7/JJhSMwfce67+hEZLBRMLVCy+FQGHBpq+J6LX3XMBWNff2wd1nO0I uH5neZQr978mvUFGR+GUaD+/ww7McJAivM3+jPmbpPCOtJprhPeEXvaHm6YBTu5qZ7zE GSW7PtxOkSnIfVlfPZW7/Zc3tcrlg0VTqpmA5C6Q4HeC+p2RKUvrAVtKZl7Bd5FD4bdQ Qx8yDTreupytH5zW4z7zXBx4quc6HlOmif9+YMZoTcRjdan7VOzq0G2iGUxosX/TCnON 0hSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:date:message-id:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=GLuU4c9odSxFrnOuGet4+6CjpgyrMIWPZsUZq/PreGk=; b=xDtN+sHtaXwoPKl0F872j78968vkfWBKwAbtspS8NTxP9xzKVIDJaeykccxMvk2fNN OCp4tfODgOd0t7C7ZtvIMoON325lZ0vPw70avpf1/EaLBvnsFsUak0fCPLXbGGQDUP/L VE2I4/Oty7/k8YmS1QH7tCkf/7jchBEISzPn7htIOa0pKUE3mSlZ2cmLR/MZ6VtrDq1r g1S0GBGU1aH0lQx/rM0NMIfLu8h06yassyGTBv2xW+8zIZqsiLKqMbVGOEswzsEO0zib Q2le8mGHNhEjRA+lNyYDrRl3GVKm4p0IYClasP/CPUI4Rs/VA1/EKO4otBA7SQ6W69NP O0yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=i0Yc5QA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si5882457ejc.594.2020.12.07.01.35.55; Mon, 07 Dec 2020 01:36:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=i0Yc5QA9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726151AbgLGJcg (ORCPT + 99 others); Mon, 7 Dec 2020 04:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbgLGJcf (ORCPT ); Mon, 7 Dec 2020 04:32:35 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26D4C0613D0 for ; Mon, 7 Dec 2020 01:31:49 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id w206so9148298wma.0 for ; Mon, 07 Dec 2020 01:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=GLuU4c9odSxFrnOuGet4+6CjpgyrMIWPZsUZq/PreGk=; b=i0Yc5QA90bEFBhwG6hH1g28TISmrUpKKqy2tRuXZIKguMBG/kBKv49AJWqGmNlgWXK uUk2WVKjmEgACcqYUvwAdPy7RY+jUaZeSbx5AeFS0JMNUwURxkbW+Kfi+olqbWTFqZnO D2uPXUc2baCQ2KMw//MjQL/+BZ6osDZlgQzE03l/aCcTikXeX9BWQp786HvpJ3N9Vgww S+ImKyqgUny8XZiooKdMpc9pk6opwrdQux/WAQiHKa3ZsvUjBz0bhHJxAkRgzQXZDORw 4d8LduMwaP8LaT2vgNQGVSGIn7spsXDHE5r5YwmXJRhq1wCLQjTOjbKgabX3l7wXkeVi ahkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=GLuU4c9odSxFrnOuGet4+6CjpgyrMIWPZsUZq/PreGk=; b=A5Ugz8fPN96PhNzkUe1/d299KlT1zCuJ7z9sb6M1pT8XsqLFcctbEUsyKOPQmT7c/P 87+CaTgngNh+xxwL7WGHXqIGICLQBBeLbAaxyT1OkEwr02qcXgEV1rckaBmkiTs9eIVu XmVcyjWHBBjmngIEFKwWP3HNl6eB1969PflCSNezlVNelwed+rpHMF5acRsxpXMPubfK kmOsItGHBNtlz2CkPTnEEFtu/t4N717PRHRG05dj6kyVExWqw73EDD5fRWtIo9iliKp5 XJXS3EXvjuDMxF4tYYDJmrc+BAwvIc/CYi7uhHjhW/bJYUMakKD8NhSqDeQg0ZUhVp+0 IsYg== X-Gm-Message-State: AOAM533HG/kxxD0EnaqkwjeczNzC/a4DGgMcWodHkJIhx7toSQaMXqh8 Zr5EHYAZxxmmH2Pc+igJmqe2Dw== X-Received: by 2002:a1c:9949:: with SMTP id b70mr17600666wme.85.1607333508343; Mon, 07 Dec 2020 01:31:48 -0800 (PST) Received: from localhost (82-65-169-74.subs.proxad.net. [82.65.169.74]) by smtp.gmail.com with ESMTPSA id k64sm12889681wmb.11.2020.12.07.01.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 01:31:47 -0800 (PST) References: <20201205213207.519341-1-martin.blumenstingl@googlemail.com> User-agent: mu4e 1.4.10; emacs 27.1 From: Jerome Brunet To: Martin Blumenstingl , davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] net: stmmac: dwmac-meson8b: fix mask definition of the m250_sel mux In-reply-to: <20201205213207.519341-1-martin.blumenstingl@googlemail.com> Message-ID: <1jo8j62c8t.fsf@starbuckisacylon.baylibre.com> Date: Mon, 07 Dec 2020 10:31:46 +0100 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 05 Dec 2020 at 22:32, Martin Blumenstingl wrote: > The m250_sel mux clock uses bit 4 in the PRG_ETH0 register. Fix this by > shifting the PRG_ETH0_CLK_M250_SEL_MASK accordingly as the "mask" in > struct clk_mux expects the mask relative to the "shift" field in the > same struct. > > While here, get rid of the PRG_ETH0_CLK_M250_SEL_SHIFT macro and use > __ffs() to determine it from the existing PRG_ETH0_CLK_M250_SEL_MASK > macro. > > Fixes: 566e8251625304 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC") > Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > index dc0b8b6d180d..459ae715b33d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c > @@ -30,7 +30,6 @@ > #define PRG_ETH0_EXT_RMII_MODE 4 > > /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */ > -#define PRG_ETH0_CLK_M250_SEL_SHIFT 4 > #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4) > > /* TX clock delay in ns = "8ns / 4 * tx_dly_val" (where 8ns are exactly one > @@ -155,8 +154,9 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) > return -ENOMEM; > > clk_configs->m250_mux.reg = dwmac->regs + PRG_ETH0; > - clk_configs->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT; > - clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK; > + clk_configs->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK); > + clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK >> > + clk_configs->m250_mux.shift; > clk = meson8b_dwmac_register_clk(dwmac, "m250_sel", mux_parents, > ARRAY_SIZE(mux_parents), &clk_mux_ops, > &clk_configs->m250_mux.hw);