Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5058156ima; Tue, 5 Feb 2019 05:49:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYAGsG8sOgLNmyy1mxkipTCw5SOFxU58DFcfemf0U5R9niEbcPsepgLELilAc/o3aDeuSly X-Received: by 2002:a17:902:5a5:: with SMTP id f34mr5226692plf.161.1549374599648; Tue, 05 Feb 2019 05:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549374599; cv=none; d=google.com; s=arc-20160816; b=Aj73P7H7Nwi2Dpxm1SkmBXeAMsc7qL85SYPOu5HWuSbI5RoF6wYCiL6nUw+eNA1sQm V+q1UOKSzHFrgQ2BqB95AJOdWi9Jv9Im9knthqMeZCTkJ5NLsUvwZjL88ALlIuz77b7Y pZGftraUNvnQJMfmbjlEcEZH1sVWY0L1wPKSIeBKxlyqRz5jLRz+RUUovAZnRyV9jUL/ zCkvEx/MivovdO6nDrH3752sYBOMNUh0rC/DRmQDukviaV6JjwNU7r08SNAClEGkX3j9 T4GTYXMATAD4NceeSg4z2S/TTNbzWrT7vd3WERbALMI+T+n27sDNSy/JFHgIACsxsJVL UEdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=UzQZRFs25qWZAsAYEW0SYoGEoO/nV18H65SPSBaC+Lg=; b=Swy79i3JYYUg8BXnxEn+GUte7CkyDBPV/cMAhikmcIyIPNygcGbrCWNl6lO+BTDSJH Fg0uo1WZ8sQ6hWHoT7IEl5Z5ZQ/sUOp/m6Vu33H80fcwu2L62A9j4Pmf/msht/BrMzy8 ASBtE/FMC/KryPZTlMid/SfYIHsNp79paiYivueV2rS44/Ru7uo2QTOGkxro+W1Psskz TpNhVKXh/LaTHX01L9juWiuDsxUmrW4415rstiIRneWbaEMVnzp9GQas1DWofQx578MO f4QsvpCplljtWqdZOgYOQfTTiQLNebz9aczpIPbDXLqxainCzsSSei+tN/LXvRw4W0xO JQTw== 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 e6si3135180pgp.504.2019.02.05.05.49.43; Tue, 05 Feb 2019 05:49:59 -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; 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 S1729510AbfBENoU (ORCPT + 99 others); Tue, 5 Feb 2019 08:44:20 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40549 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbfBENoT (ORCPT ); Tue, 5 Feb 2019 08:44:19 -0500 Received: by mail-ed1-f65.google.com with SMTP id g22so2864641edr.7; Tue, 05 Feb 2019 05:44:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UzQZRFs25qWZAsAYEW0SYoGEoO/nV18H65SPSBaC+Lg=; b=q2cUU42wTjBBeS52mlIKNdJR3Mm2RGo82LtvqgV14Ne2YeocLbnA6zDuxs1efqTN5u XorcPodWmWETLqqZmBlnBsKLMag39BHJIznSKfQXFDYTirX//P/Olq3RY5d1G3Gw+5HK onZjScV78O75fNZyHUTEUj/ibo60YuMSkHcMLo1hen+t5i9m/8cgczjHACiI20nnGAAf zR+Dx0WtQZRr1K0qU+jeOaINiL67hNZg5M9DZLIGz3bwDD+9J+mPd2PN8NpGR96HOxAM c/O4eNdrSNX2DKdJXqHD3rNadVN3gy91Ng3HPJKHrqNE7ZluupgDXztHvKTesUnijMHC BKDg== X-Gm-Message-State: AHQUAuaqOqi0kjL9LKEDDs7e3h+R6dNsxvoICVBslgfy01Zz7PgE8p3L m+dbQQATc5jKCTfu7nPaKwSAjiattWA= X-Received: by 2002:a50:9665:: with SMTP id y92mr3918195eda.282.1549374257270; Tue, 05 Feb 2019 05:44:17 -0800 (PST) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com. [209.85.221.50]) by smtp.gmail.com with ESMTPSA id x47sm5195179eda.91.2019.02.05.05.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 05:44:16 -0800 (PST) Received: by mail-wr1-f50.google.com with SMTP id p4so3657838wrt.7; Tue, 05 Feb 2019 05:44:16 -0800 (PST) X-Received: by 2002:adf:891a:: with SMTP id s26mr3732163wrs.44.1549374256271; Tue, 05 Feb 2019 05:44:16 -0800 (PST) MIME-Version: 1.0 References: <20190202155209.31617-1-plaes@plaes.org> <20190205094529.t7je4ozzu2b4ornc@flea> In-Reply-To: <20190205094529.t7je4ozzu2b4ornc@flea> From: Chen-Yu Tsai Date: Tue, 5 Feb 2019 21:44:02 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] clk: sunxi-ng: sun4i: Use CLK_SET_RATE_PARENT for mmc2 clock To: Maxime Ripard Cc: Priit Laes , Michael Turquette , Stephen Boyd , linux-arm-kernel , linux-clk , linux-kernel , Jernej Skrabec 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 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. Regards ChenYu