Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp258176pxm; Wed, 2 Mar 2022 14:47:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxoIrygoNkrnIESBOOCMba1gtYIaQwBIcrihgoHevs97bhSG1TZZ7K9A5lex0QBRxx3tLW X-Received: by 2002:a65:6746:0:b0:377:16e2:33a2 with SMTP id c6-20020a656746000000b0037716e233a2mr23933059pgu.47.1646261234586; Wed, 02 Mar 2022 14:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646261234; cv=none; d=google.com; s=arc-20160816; b=OuN9LbhYzNJpx0dG+pH6392K5/Pw3mG3yPfjgVXdDVRQJQnCP6pDw2Imr/Mbidt12p I8doXcFk0G36yEFfWstyzHHDqHy29zctC9GtvjbWqKe6MshGFANLO5T1YKOmfP7TsnUI TkG3JazU7c+zS0lISJsjXswvDK7+O9FDG0KhmtTap5GOCL53GZbayJ2u2aGyoklWr0xx 2tPV/nAxw4ljqvFBVF6/VyqxLItwggUTtWD2f48xPg1tm3XhOeoq/khr7gMkXNbNpfak gaDopASxA2SO/bzYGltSuiZb252wpBg0l1ETKE95TXMxRF/rcoXP41jISYpkxZgl+R4S YZFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9tjY3EnNamNFx1y3oddYNE+8HtUaH9EZY+luGZxUhsM=; b=sgoa7iRsuk73oHJMvPin/CR/BD1F5NF0wwL5n86o+slrl0lh9T0mOaxNJf+VfUQtaF pnRoS5sSrUPulWsXWjYWh7DnpwjnWjyICPOROUjMYx4tRRq8Qjy9y5K/8ctB4C6T+rQ2 2sq8vBxrQQtUmnrVPeTczdRibd8tyj/HFtz2n/OVh+BB3cosNOktNhb5pq+/lTCecocf GWLOcz4mBOPSk2JWPBdr6wmk2Z4Gp4+wRzU3oaWbIbDi8vEvZjUmOzxFhbYiq1wtghHR U1eaCJzDLEVSmKTb9/LqPMpqy4JAF7mo0u2B6SpKTs55lsJvxKD3WIklGLIK8nNY5YLj r04w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mnACc6XQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b8-20020a056a00114800b004f3faea4748si403772pfm.33.2022.03.02.14.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:47:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mnACc6XQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C2EEF392C; Wed, 2 Mar 2022 14:39:12 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240782AbiCBKYJ (ORCPT + 99 others); Wed, 2 Mar 2022 05:24:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231748AbiCBKYI (ORCPT ); Wed, 2 Mar 2022 05:24:08 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21918AC91C for ; Wed, 2 Mar 2022 02:23:22 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id l12so1530750ljh.12 for ; Wed, 02 Mar 2022 02:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9tjY3EnNamNFx1y3oddYNE+8HtUaH9EZY+luGZxUhsM=; b=mnACc6XQaE5xdOpPVbWeU0j4lqYfqsAhH0pnsiQ4s+1ZtVjntpL/OwJLMrmI7Sytrc 3tRtsEdE5mIug5N/dLj9wICfoEUbgNXaTnVTJzTbN/TkNBEuoYsBjmpPXQhSJ/Zw98oK eakd9g9hwgta4vGWdNpsV6UQ/1ds7PYgJFpX8Ixx4BsbfdOrslso9neJdZOh8o+Zx0OP hqtdM8INXeh0EMeBV7tNYMtDgmHyl8xBrjCR2OJqPBJaeUv9a76kEZQ5oae3z5q9mD8M oPrJbl/dzH5LDyF/lhbY1pMfpYZ6RT1A7fixM7PSNAHPA76l8HsURnbmHIjlGSJGN6Tt K8tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9tjY3EnNamNFx1y3oddYNE+8HtUaH9EZY+luGZxUhsM=; b=Yrka9d+Hr0WfUePV/lmSWgvfyamEXglTKuBAuJ2zas7p4Pu3M1biHHw0Y/7Iqq94B1 quM3AgS1XoZBH8CUur6uP3uwPIUL7wkuL/Jaud5Bkh18692+2Xj4hd5C+5IOBQypO6tK A/OTN0K/VRqkLLpJIIdmcbvPcF1ejxV+kXektm8bFrFE+Zn0Pad5tfOYwtWOyc5OcUty sc6DmEBh3T45RGdqI3BrP4eFWtWfKQLsOzbBN2797IsRscZgUlUr54DLLVg3GvjGNcw7 aS4z0njSx4uP4hWAxd9/Kz5wi7Z95i2s8rZ2GJSeZCNYRxGy/wFTcsdmU6cLGe7h+B3c PWtw== X-Gm-Message-State: AOAM5332O4DiHoSX/wFCulaYldLE8L+MBymHO4RtF6s/XKsRmt1UbXIZ eqDaDTe7g+9WI5NiXsk4DDn9u+tNDvZCvwL1jrOYZQ== X-Received: by 2002:a05:651c:201b:b0:246:34b5:155e with SMTP id s27-20020a05651c201b00b0024634b5155emr18803688ljo.273.1646216600403; Wed, 02 Mar 2022 02:23:20 -0800 (PST) MIME-Version: 1.0 References: <20220228223642.1136229-1-pgwipeout@gmail.com> <54b24f3d-3762-abbd-5ac4-dc5728f2fe4e@arm.com> In-Reply-To: From: Ulf Hansson Date: Wed, 2 Mar 2022 11:22:44 +0100 Message-ID: Subject: Re: [PATCH] mmc: host: dw-mmc-rockchip: avoid logspam when cd-broken To: Peter Geis Cc: Robin Murphy , Jaehoon Chung , Heiko Stuebner , linux-mmc@vger.kernel.org, arm-mail-list , "open list:ARM/Rockchip SoC..." , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 1 Mar 2022 at 15:49, Peter Geis wrote: > > On Tue, Mar 1, 2022 at 7:46 AM Peter Geis wrote: > > > > On Tue, Mar 1, 2022 at 7:38 AM Robin Murphy wrote: > > > > > > On 2022-03-01 11:49, Peter Geis wrote: > > > > On Tue, Mar 1, 2022 at 6:23 AM Robin Murphy wrote: > > > >> > > > >> On 2022-02-28 22:36, Peter Geis wrote: > > > >>> The dw_mmc-rockchip driver drops a large amound of logspam constantly > > > >>> when the cd-broken flag is enabled. > > > >>> Set the warning to be debug ratelimited in this case. > > > >> > > > >> Isn't this just papering over some fundamental problem with the clock? > > > >> If it's failing to set the expected rate for communicating with a card, > > > >> then presumably that's an issue for correct operation in general? The > > > >> fact that polling for a card makes a lot more of that communication > > > >> happen seems unrelated :/ > > > > > > > > Good Morning, > > > > > > > > This only happens when a card is not inserted, so communication cannot happen. > > > > > > Well, I suppose there's a philosophical question in there about whether > > > shouting into the void counts as "communication", but AFAIR what the > > > polling function does is power up the controller, send a command, and > > > see if it gets a response. > > > > > > If the clock can't be set to the proper rate for low-speed discovery, > > > some or all cards may not be detected properly. Conversely if it is > > > already at a slow enough rate for discovery but can't be set higher once > > > a proper communication mode has been established, data transfer > > > performance will be terrible. Either way, it is not OK in general for > > > clk_set_rate() to fail, hence the warning. You have a clock driver problem. > > > > Alright, I'll look into this. > > It seems only extremely low clock speeds fail and I know rockchip > > chips have a hard time with extremely low clock rates. > > I'll trace out where the failure is happening. > > Okay, I hope you can provide me a direction to go from here, because > it looks like it's doing exactly what it should do in this situation. > mmc core is requesting a rate (200k/100k). > clk core tries to find a parent to provide a clock that low and fails, > because the lowest possible parent is 750k. > clk_sdmmc(x) is listed as no-div, so it can't go any lower. > > It seems to me that this error is sane, because other results of > einval you want to catch. > But einval in this case is fine, because > The thing that strikes me weird is currently clk_core thinks the > lowest possible freq here is 0, when in actuality it should be 750k, > am I correct here? > The mmc controller has an internal divider, so if my line of thinking > is correct here we should be more flexible here and request a rate > that's acceptable rather than just failing if it doesn't work. > But that's based on my limited understanding of how mmc core is > requesting this and what it expects in return. The important point from the eMMC/SD/SDIO spec point of view, is that the initialization of the cards starts at a maximum of 400KHz for the bus interface clock. In many cases, that requires a combination of the provided source clock for the mmc controller to be decreased with some kind of an internal divider managed by the controller itself. Moreover, the mmc host driver shall set mmc->f_min in its corresponding struct mmc_host during ->probe(), to inform the core about its lowest possible rate that can be set - and this must not be higher than 400KHz. Hope that clarifies how things should work. [...] Kind regards Uffe