Received: by 10.192.165.148 with SMTP id m20csp569162imm; Wed, 25 Apr 2018 04:25:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/U9hHCXLckdqdQS28vLSLfQNWFv6AIf2MGSARi56QqB4Mwng2GLDjVdVExbsFiu0m72enh X-Received: by 10.101.87.138 with SMTP id b10mr23432695pgr.241.1524655555299; Wed, 25 Apr 2018 04:25:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524655555; cv=none; d=google.com; s=arc-20160816; b=kDklHHv/MGZRayBGS3h3c4VQcczt7stczueGo/08sTS+CnP8GPCYTzdauzhXgNeJpm OIQYy5gE7trOplfVcMxAVOYsFlpI86i8sSiQqXzd0uwOter/QjaQ3AbJ9tlyKbnBrmH5 g8QGCvOaca8aif2q+Zvwjb0/nxcUPmm/w5cZKJXNY3Jb249gZ/FQ26dOAZfM3T0R8ETz /BdwJ8aqqP4r/VvM/F4QqgCOYlslTT4aUY7OBhP6qNvYlel9vBqsQuF9YTyyeSes3k+R 7TtTB9Ub4bSAE/G/ruYSKA/w1dm6yYzoLC2IzyOETZEoO64IMUNewjHjxuk7SYBg36lG vziQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0jSepBs1ytdym1JVrNo8DDcc3gciIBBEp+V1o+6C0uI=; b=ICoeH2WEf5EqsU+W4G8mXeyoyh5s8RaZlywpleg6831XJpDUrxKAjFYuQELJGEm+S5 2wRnQ212VyaF4GzLT7XIAHFq6Wf5emEW2JrMld4KUc7ZlRG4YwdN8DklMh7AilPhptt/ Js4A+e8tepCm57EOUmSyFIigZLwn8wyfJST2a7U8DlIOayBNzIHEeC1C17eG9BiWocL9 O0zLLwnp4A+4R5WpNZdC317oJdaq/snMVuBRo3Rk3Kki//bAP/nmMXDTgtUx5G4qjNJB f1RI91dWYfE972CCbzSGfRskIAq0wnW4p+HzJPYWhHOKhfU2pJ9ub3aB7472xgV5ja8N D8qQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w20-v6si16563542plp.7.2018.04.25.04.25.40; Wed, 25 Apr 2018 04:25:55 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753745AbeDYLYf (ORCPT + 99 others); Wed, 25 Apr 2018 07:24:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51734 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752118AbeDYKi7 (ORCPT ); Wed, 25 Apr 2018 06:38:59 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 84BC736; Wed, 25 Apr 2018 10:38:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerome Brunet , Martin Blumenstingl , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 051/183] net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock Date: Wed, 25 Apr 2018 12:34:31 +0200 Message-Id: <20180425103244.609727329@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Blumenstingl [ Upstream commit fb7d38a70e1d8ffd54f7a7464dcc4889d7e490ad ] On Meson8b the only valid input clock is MPLL2. The bootloader configures that to run at 500002394Hz which cannot be divided evenly down to 125MHz using the m250_div clock. Currently the common clock framework chooses a m250_div of 2 - with the internal fixed "divide by 10" this results in a RGMII TX clock of 125001197Hz (120Hz above the requested 125MHz). Letting the common clock framework propagate the rate changes up to the parent of m250_mux allows us to get the best possible clock rate. With this patch the common clock framework calculates a rate of very-close-to-250MHz (249999701Hz to be exact) for the MPLL2 clock (which is the mux input). Dividing that by 2 (which is an internal, fixed divider for the RGMII TX clock) gives us an RGMII TX clock of 124999850Hz (which is only 150Hz off the requested 125MHz, compared to 1197Hz based on the MPLL2 rate set by u-boot and the Amlogic GPL kernel sources). SoCs from the Meson GX series are not affected by this change because the input clock is FCLK_DIV2 whose rate cannot be changed (which is fine since it's running at 1GHz, so it's already a multiple of 250MHz and 125MHz). Fixes: 566e8251625304 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC") Suggested-by: Jerome Brunet Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet Tested-by: Jerome Brunet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -116,7 +116,7 @@ static int meson8b_init_clk(struct meson snprintf(clk_name, sizeof(clk_name), "%s#m250_sel", dev_name(dev)); init.name = clk_name; init.ops = &clk_mux_ops; - init.flags = 0; + init.flags = CLK_SET_RATE_PARENT; init.parent_names = mux_parent_names; init.num_parents = MUX_CLK_NUM_PARENTS;