Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp619094pxh; Tue, 9 Nov 2021 16:17:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmei80sZEIv8eP6JpCTediYWC9xUzezYROKwZpsnogYDTOAb2W1aTuIAfRCEGF5vc+gU+u X-Received: by 2002:a6b:f905:: with SMTP id j5mr8085785iog.27.1636503427462; Tue, 09 Nov 2021 16:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636503427; cv=none; d=google.com; s=arc-20160816; b=xviuJNDDHFFNPhdZ17qnleVvfDZK7Xiyqf+G56rIOLEhJBIM93L10OcTf1QmZB184f hs8vt2Y4vEUL3lrZdrVciArukUelQ7hZpWGD7+yCL7IvVsbBI7lyKCdgv2czfzIUVgNY 18wwSUQm3CMeTvbO1JmYN4RcUYzm01aDtG54DCruT1o8hQV34RKRRZNhfbJddh0pgrI8 1N22WcJy8jY+31Qw6+L1QC0wWueQH2Xi18kQ7JJWkZ3hQU35aikMx3rvqn/Kl/+iY3Qx pTjk+I1FwkwyleQipWe/L59jabO2zH+XaBBqgXadxlEuA4EZF2H73i/xrhWQii+DS8E4 AXqA== 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=XQ9MmBgG6DxG+MYA4zF7fuyzEizobKE/7ttDVS9RbSI=; b=kdHB5VQyrCWU7mR7gLVwYjNstsPzAcUxw/NfziBCommmXBzPkLHcJTksOZNggvryyB F5Hsj0lL9Fq7DmDJ1eVCnW2Yxmxy/PMrrTeSTLwOz+Ke23N6/L+VS5tIk11305KtJ79U Ab0lxbq/Uag2KHZXf8rKgkvq3cQq5z42GTYlgC5rmTAHgyjOXRiN7ywduXMeo+XO/bDl Pbfos/YnKnHpa69CIPgoK26FJreu25InPcfkMbofZ4+0yOsJN7SO4KXUeufBDmlHbAbt 7YSOfmj1rrmMsMJ38ePnORwdb6+NT0oltK1f262K89+9cyTLw0HeU7PHyr74FJAONsSK DjWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YotoFmkv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si29102244ion.80.2021.11.09.16.16.54; Tue, 09 Nov 2021 16:17:07 -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=@linaro.org header.s=google header.b=YotoFmkv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244111AbhKIUE1 (ORCPT + 97 others); Tue, 9 Nov 2021 15:04:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242871AbhKIUEZ (ORCPT ); Tue, 9 Nov 2021 15:04:25 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C8FC061766 for ; Tue, 9 Nov 2021 12:01:39 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id s24so662657lji.12 for ; Tue, 09 Nov 2021 12:01:39 -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=XQ9MmBgG6DxG+MYA4zF7fuyzEizobKE/7ttDVS9RbSI=; b=YotoFmkvLVN9hGvdjKO6754H+mRouO/8wPYkVGz9XafEoXduK9gT1fq15dDJM37lPu ksQ7tEYcTBWb3hDUjRo6c7n8zDMhyZNx9WEO/GXY7n3cJ7GeYd0lsOyqHGLAJfK0O8gt qa523oeFiITkccbKIThlj8UwPySSeDlslIiJUdZHm8Y0eyf9QkVpNlZYDsgd+4q6aOYZ FKCeAlCesK8dM5sgKG/3nli04AqYjXBRke4/TKJdBqlL/zVxJ2p84XbX2F6d5//xmOmB 6en+Q7WPyRnvQ03koE+7ANI7Tjq23go5CQu0fDTSlDBIvxmwZIzjoXwIiQNtdTp6Yb0p 3wjg== 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=XQ9MmBgG6DxG+MYA4zF7fuyzEizobKE/7ttDVS9RbSI=; b=E8qy4V/Xwf5ywtIvbqANkCiCu+uyYS/3oodkKLUY7Q8akjlA8ishg4u6xqFuRLyd9Z 0LCtFR17E0i88gFWW3U9OtYp7vZlEWILTKeAZMQugeshhmP6e04XZr2CAfJcemNjKOux pd2ntBLGBoD1VQtxijYenVsSnZhymHFvrpSGN2iMduiQbzcF8rg2WS37ncBpbenLuQHB PTvlu9X4AaGpNMX3/vPtnA7MzfzSfmXPVKdUGAPT+fPF6QJ73XXcw6poMl9tT3J/O7GD lk+KGL65xa0z629ddOpOWtrlSaEf6IbK7pc/AXAiaR33Yd67tgFkBBz2BexBMjqKRmT0 lrEg== X-Gm-Message-State: AOAM531kNu4SqXE7LInXyVilkeFamtBo9MauBuvYDcM6BSxrilJiVnli N9/fnByVdPpW0XtFw9udzfr4ZqkYgfRQlKUzxxyqdg== X-Received: by 2002:a2e:80c3:: with SMTP id r3mr10580377ljg.4.1636488097447; Tue, 09 Nov 2021 12:01:37 -0800 (PST) MIME-Version: 1.0 References: <3ca9a3099d86d631235b6c03ae260bc581cc8d60.1636103151.git.hns@goldelico.com> In-Reply-To: From: Ulf Hansson Date: Tue, 9 Nov 2021 21:01:01 +0100 Message-ID: Subject: Re: [RFC v4 5/6] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc To: "H. Nikolaus Schaller" Cc: =?UTF-8?B?SsOpcsO0bWUgUG91aWxsZXI=?= , Avri Altman , Shawn Lin , Linus Walleij , Tony Lindgren , Bean Huo , =?UTF-8?Q?Gra=C5=BEvydas_Ignotas?= , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Nov 2021 at 11:58, H. Nikolaus Schaller wrote: > > Hi Ulf, > > > Am 08.11.2021 um 16:33 schrieb Ulf Hansson : > > > > On Fri, 5 Nov 2021 at 10:06, H. Nikolaus Schaller wrote: > >> > >> + card->quirks |= MMC_QUIRK_NONSTD_SDIO; > >> + card->cccr.wide_bus = 1; > >> + card->cis.vendor = 0x104c; > >> + card->cis.device = 0x9066; > >> + card->cis.blksize = 512; > >> + card->cis.max_dtr = 24000000; > >> + card->ocr = 0x80; > > > > In the past, we discussed a bit around why card->ocr needs to be set here. > > > > The reason could very well be that the DTS file is specifying the > > vmmc-supply with 1.8V fixed regulator, which seems wrong to me. > > I have checked with the schematics but the wlan_en regulator-fixed is just a GPIO > controlling some pin of the wifi chip. > > I guess it enables some regulator or power switch inside the wifi module which > has unknown voltage. > > We can interpret this as two sequential power-switches. The first one controlled > by the gpio-register bit and switches gpio power to the gpio pad of the SoC. The second > one switches the battery voltage to the internal circuits of the wifi module. > > The GPIO itself is on 1.8V VIO level which seems to be the reason for the min/max. > > Now it is a little arbitrary what the DTS describes: the gpio voltage or the unknown > internal voltage of the second switch. > > So from hardware perspective the min/max values are irrelevant. I completely agree with you! That's also why I earlier suggested moving to use an mmc-pwrseq node (Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml), that would allow a better description of the HW. Nevertheless, the important point is that the mmc core gets a valid host->ocr_avail to work with during card initialization. And in this case, it's probably good enough to model this via changing the regulator-min|max-microvolt to get a proper value from the "regulator". > > > > > I would be very interested to know if we would change > > "regulator-min|max-microvolt" of the regulator in the DTS, into > > somewhere in between 2700000-3600000 (2.7-3.6V) > > Ok, if the mmc driver does something with these values it may have indeed an influence. > > > - and see if that > > allows us to drop the assignment of "card->ocr = 0x80;" above. Would > > you mind doing some tests for this? > > Well, with min/max=3.3V and no ocr I get: > > [ 2.765136] omap_hsmmc 480ad000.mmc: card claims to support voltages below defined range > [ 2.776367] omap_hsmmc 480ad000.mmc: found wl1251 > [ 2.782287] mmc2: new SDIO card at address 0001 That's really great information! During the first initialization attempt, things are working fine and the SDIO card gets properly detected. > [ 10.874237] omap_hsmmc 480ad000.mmc: could not set regulator OCR (-22) > [ 10.945373] wl1251_sdio: probe of mmc2:0001:1 failed with error -16 It looks like the card is being re-initialized when it's time to probe with the SDIO func driver. This makes sense, assuming it's been powered off via runtime PM (the "cap-power-off-card" DT property should be set in the DTS for this card's slot). I looked a bit closer to understand the problem above and then I realized why the card->ocr is being set from omap_hsmmc ->init_card() callback. It's most likely because the mmc core in mmc_sdio_init_card() doesn't save the card->ocr when MMC_QUIRK_NONSTD_SDIO is set. Instead it becomes the responsibility for the ->init_card() callback to do it, which seems wrong to me. Note that the card->ocr is being used when re-initializing the SDIO card. I have just sent a patch [1], would you mind trying it, in combination with not assigning card->ocr in $subject patch? > > Adding back card->ocr = 0x80 (and keeping 3.3V for min/max) shows exactly the same. > > Only min/max 1.8V + OCR works: > > [ 2.824188] mmc2: new SDIO card at address 0001 > [ 2.806518] omap_hsmmc 480ad000.mmc: card claims to support voltages below defined range > [ 2.815979] omap_hsmmc 480ad000.mmc: found wl1251 > [ 10.981018] omap_hsmmc 480ad000.mmc: found wl1251 > [ 11.018280] wl1251: using dedicated interrupt line > [ 11.321136] wl1251: loaded > [ 11.378601] wl1251: initialized > [ 14.521759] omap_hsmmc 480ad000.mmc: found wl1251 > [ 38.680725] omap_hsmmc 480ad000.mmc: found wl1251 > [ 39.646942] wl1251: 151 tx blocks at 0x3b788, 35 rx blocks at 0x3a780 > [ 39.654785] wl1251: firmware booted (Rev 4.0.4.3.7) > > Therefore I also tried the 4th combination: min/max 1.8V and no ocr quirk and it fails again. > > Finally I tried setting min to 2.7V and max to 3.6V. This ends up in > > [ 0.402648] reg-fixed-voltage fixed-regulator-wg7210_en: Fixed regulator specified with variable voltages > > So it seems that we need both: min/max = 1.8V and OCR. A little unexpected since I had expected > that min/max is completely irrelevant. > > > If that works, we should add some comments about it above, I think. > > So at the moment no change for [PATCH v1] which I can now send out. > > BR and thanks, > Nikolaus > Thanks a lot for doing these tests! If I am right, it looks like we should be able to skip assigning card->ocr for this quirk, but let's see. Kind regards Uffe [1] https://patchwork.kernel.org/project/linux-mmc/patch/20211109192547.28679-1-ulf.hansson@linaro.org/