Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp414029ima; Wed, 6 Feb 2019 02:09:22 -0800 (PST) X-Google-Smtp-Source: AHgI3IZosBShzzmA3eRQjmLu5XayQqNcEOh2TP+2fUiDp59Bg7Luuqo69OkEij+LquykEkrMaadL X-Received: by 2002:a17:902:c85:: with SMTP id 5mr9989111plt.339.1549447762314; Wed, 06 Feb 2019 02:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549447762; cv=none; d=google.com; s=arc-20160816; b=gqgeb6/alE0OAke2XdGPPByxhOwH8SX7NoFH8eZInKJB7F9gZL3CQenS3mwNTzi8DL QUvE8lUp/g+QPwzGLvWMtbO5IuNgZMsaZ64rYkO+N6WPOj4MuHwpJjpZYg7hbgpeRCmG z30J3OrtRm2McqQbBtpyPP6UopQ/wQs8CpTDNTrnnQg/I6S3gss1hhhYCd4IC0tsMCR6 lUrpS84LdaNuYUgKXIiKRGy/Tbvrq+2kJx3S3M0nxXJAG2+fkY3jepNAVTbedqqm49ZF 4bJJRLvDk3aH1xnPbRXfvR0tWNB661rZHiArL6EeGKavHCqryXRkLBJqMdFfCcJDj9Oq /2ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WUAaIahB5GSAMeN5NKm4YGLXcO35K8+Iv6RVyJ+x8O0=; b=gaKrmbWw76Oz69EvLzXLZ+oXlG+Q4gVoi6ECjExG4zD0MAf5cfOloujdDC5NSDsdBg lgo3rB1qHQc7IwP3SBnDjK45pnbns7Q05pogGxRUofr4gsK3PXtF7e8JvWVVlu8oYSqx xIWh0h0KLJymBzSbc1xxRuEgMvA9/3p0Jhs2FclU6GT8sWY7v2ZiRyHH9qBdBryO52Qn 1W4iUmmdpBOFChKBY+p6X1qZnJ2363t5o5bDNJSMNkYe11r63E2pH9wxC1UObvxD3Tsu y5cLBt3YxmzqVo3OmGLprm12r5s9xjTbfeTpFAu6E0yR9arcH2UdV4qgpdfw+YXYBYMp ZzwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@plaes.org header.s=mail header.b=eXqHcEoe; 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 y11si5417232plk.162.2019.02.06.02.09.07; Wed, 06 Feb 2019 02:09:22 -0800 (PST) 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; dkim=fail header.i=@plaes.org header.s=mail header.b=eXqHcEoe; 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 S1728985AbfBFKDO (ORCPT + 99 others); Wed, 6 Feb 2019 05:03:14 -0500 Received: from plaes.org ([188.166.43.21]:51748 "EHLO plaes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfBFKDO (ORCPT ); Wed, 6 Feb 2019 05:03:14 -0500 Received: from plaes.org (localhost [127.0.0.1]) by plaes.org (Postfix) with ESMTPSA id 06D7140354; Wed, 6 Feb 2019 10:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=plaes.org; s=mail; t=1549447391; bh=8/Z5G5XftRwjdoYiNOxsQ/6m69rVL16G4o3Y/S7FXm0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eXqHcEoeXo54Xi9KStGy0yeEDlj6G2dXvNqbnvgoUCtZonDcmgdYralLCt5QWL3Dy 4hCvLSLUJ2WMz6RwCi1phA11984YzXDB6mP4yHJQzAVN8M1Vnv6yvznal4WLvsNa7u XJh3N4uRzT23fnI8K5ZLVrYy4FV6wYFbqJmgQze3NnUnoYvCCDdkylupHSeb8GDPSG qntmwlRtAdtkI/xTjk02VCarzmn8z0w2wW4HQe6hkxKMlht9ddMhMijP5geEOkLoGO XZ1HZvPzfHMUYFMFQzVJiKVYTLgtgWNdX0+emZHGM97d24dMQp30KyvDVBWRE7KQu+ enOCt739q7UuQ== Date: Wed, 6 Feb 2019 10:03:09 +0000 From: Priit Laes To: Maxime Ripard Cc: Chen-Yu Tsai , Michael Turquette , Stephen Boyd , linux-arm-kernel , linux-clk , linux-kernel , Jernej Skrabec Subject: Re: [RFC PATCH] clk: sunxi-ng: sun4i: Use CLK_SET_RATE_PARENT for mmc2 clock Message-ID: <20190206100309.dhkm2l73qzkwgjzg@plaes.org> References: <20190202155209.31617-1-plaes@plaes.org> <20190205094529.t7je4ozzu2b4ornc@flea> <20190206092000.f46nsn4fw2n4crub@flea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206092000.f46nsn4fw2n4crub@flea> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 10:20:00AM +0100, Maxime Ripard wrote: > On Tue, Feb 05, 2019 at 09:44:02PM +0800, Chen-Yu Tsai wrote: > > On Tue, Feb 5, 2019 at 5:45 PM Maxime Ripard wrote: > > > > > > On Sat, Feb 02, 2019 at 05:52:09PM +0200, Priit Laes wrote: > > > > Recent patch of improving MP clock rate calculations by taking > > > > into account whether adjusting parent rate is allowed, have > > > > unfortunately broken eMMC support on A20 Olinuxino-Lime2-eMMC > > > > boards which fail with following error: > > > > > > > > [snip] > > > > EXT4-fs (mmcblk1p4): INFO: recovery required on readonly filesystem > > > > EXT4-fs (mmcblk1p4): write access will be enabled during recovery > > > > sunxi-mmc 1c11000.mmc: data error, sending stop command > > > > sunxi-mmc 1c11000.mmc: send stop command failed > > > > [/snip] > > > > > > > > Previously, mmc2 clock was requesting 520MHz and settling at 512MHz > > > > clock rate with following parents: > > > > You mean 52 and 51.2 MHz. > > > > > > [snip] > > > > pll-ddr-base 2 2 0 768000000 0 0 50000 > > > > pll-ddr-other 1 1 0 768000000 0 0 50000 > > > > mmc2 0 0 0 51200000 0 0 50000 > > > > [/snip] > > > > > > > > Now, after the improvements, requested and settled rate are both > > > > 520MHz, but as mmc2 clock cannot adjust parent rate, the situation > > > > ends up like this: > > > > [snip] > > > > pll-periph-base 3 3 0 1200000000 0 0 50000 > > > > pll-periph 6 6 0 600000000 0 0 50000 > > > > mmc2 3 3 0 50000000 0 0 50000 > > > > [/snip] > > > > > > > > With this patch (allowing mmc2 to set parent rate), we end up with > > > > working tree with both mmc0 (sd-card) and mmc2 (eMMC) working: > > > > [snip] > > > > pll-periph-base 3 3 0 312000000 0 0 50000 > > > > mbus 1 1 0 78000000 0 0 50000 > > > > pll-periph-sata 1 1 0 26000000 0 0 50000 > > > > sata 1 1 0 26000000 0 0 50000 > > > > pll-periph 5 5 0 156000000 0 0 50000 > > > > mmc2 0 0 0 52000000 0 0 50000 > > > > mmc0 0 0 0 39000000 0 0 50000 > > > > [/snip] > > > > > > > > Fixes: 3f790433c3cb ("clk: sunxi-ng: Adjust MP clock parent rate when allowed") > > > > Signed-off-by: Priit Laes > > > > > > Applied, thanks! > > > Maxime > > > > I'm concerned for other users of the PLL-PERIPH clock. AFAIK > > all of them, except the HRTIMER, expect the clock rate to stay > > the same and not change underneath them. And SATA expects it to > > be at 600 MHz, as the datasheet says. And while it may not directly > > apply to the LIME2, eMMC on newer SoCs / boards run at the slightly > > reduced rate of 50 MHz just fine. > > > > In the commit in question, clocks without CLK_SET_RATE_PARENT > > should be using the old code (now in the if conditional block), > > i.e. the behavior should not have changed. > > > > I don't think this actually "fixes" whatever bug was introduced, > > but only papers over the issue, and possible introduces further > > issues for other users. > > You're right, I've overlooked that it was pll-periph being > affected. I've dropped it for now. Any ideas what could be done. I currently have no time to debug it, but it affects existing systems. > > Maxime > > -- > Maxime Ripard, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com