Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp14107pxb; Tue, 26 Oct 2021 20:02:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw44GAoZfzMhN282OYlgDTk4GWTaSPSw7N6jLDWV720Y34ohMhpVcDhMh7ZIYofkRKB1bR2 X-Received: by 2002:a17:902:c60b:b0:13f:59f9:db90 with SMTP id r11-20020a170902c60b00b0013f59f9db90mr25254613plr.37.1635303738000; Tue, 26 Oct 2021 20:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635303737; cv=none; d=google.com; s=arc-20160816; b=hHv/m5l0dN1hky46PwdLmazcTu4hHRMpcBd+GP5KyGhHIm35yGBjNw8lM9P1aqeq8o tLlW6ZXs9EZ93POwdeZNqLyNQk8eiwv5A+QnU/2P0nGbeb/r7lt72glc2xHgHIMZ6xSW f1UHENZHKo+lgqybAdayyhVSkRmUIDRFC7RcHDWzNTc68lCDo6EDS1eG7tYl3ACHUGej ORM+MgTS6GtrqeqiNtloiJ4EYivdZ9VEBFK9tveVAySJ5dltbr2fh1a2JU4PQLKzr4/r HDyjz+lPzoKCo0tHnSuFvjRa+ZMoc55L0ZmnrA73hxSL42lBPS9cWhAO+OpZzxvXtTSo us6w== 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=adv3DrwpkGGcBynbCZO162xm2hRyNhR/LtXPfxRRi2c=; b=o/2V71J/hR/fK/AF9BUNQF3i36r0fdT7wBTmnLjey6DPH9v/sx8tMLFrRRr2JdN85Z DAXm5gdvXe4mLe+Xipk95HCEOcYBcoc0jOnyDy1qW1RVG2RRzCksoi7cKGiy0D7fM/yS PPUfrsfYn+gOklS3USmO7Ty7b47AB9dUeGtyhfSJBQW8wq0UbCG+vtPQsQOBhRvR80aS TeCID1ndCDNWDmykUKvf7XkIPYS1Y3ywMguDJEfDw0EKgWc3ZWs6vbrZlEkfHUi/5CbJ V3ulYKiOSBuG4T8E7LOwivyEhsKX4ihLiUiB5zHT7a6+0oMfLGmpUsFMV4pn4HvWtQ7B BCvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q72mLxkF; 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 y5si8163276pgk.632.2021.10.26.20.01.48; Tue, 26 Oct 2021 20:02:17 -0700 (PDT) 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=Q72mLxkF; 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 S236010AbhJZRP5 (ORCPT + 99 others); Tue, 26 Oct 2021 13:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbhJZRPz (ORCPT ); Tue, 26 Oct 2021 13:15:55 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C4E9C061767 for ; Tue, 26 Oct 2021 10:13:31 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id j2so320868lfg.3 for ; Tue, 26 Oct 2021 10:13:30 -0700 (PDT) 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=adv3DrwpkGGcBynbCZO162xm2hRyNhR/LtXPfxRRi2c=; b=Q72mLxkFvHZe5KYX3sirINKTZoIt5iabZr6TrRHELzPlCcQUBWdWQGpGEkM9WJMppX /olRSlp5+JyE5jje1Fui+MEFgSIsxEnOskfI0h+vrRb5jqJWZQRdbF8ztZXRH//RPm73 mN4AvNDXDfCy5dluaC6v+U0iIOId6urJj3c/QKH8L2FnFSolspILU6xmfQxL9HjDdzRh z32YTqHEDbvvJzn4X2+bNxPQ7nt44PYqAzu8RQ8ZTktQAqA2+EEOZk16c/3aDvAaVJqM CUjT7TNiMcNLqybffNhejLLm573rKF0IyqJGVOwDdCrltHFoqslHGdwoElpbzaBMnzxj G4zQ== 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=adv3DrwpkGGcBynbCZO162xm2hRyNhR/LtXPfxRRi2c=; b=2GWhslGdE+DPa1p2C1/CSvAQlKkAhjPgw4Z64uPgymT2rUJ1kdpRPBH4KfvRTSwCJO 2Shzh+meeALjYWoYtj6E3xuP0NTmANaYD2LgIZrb7t57hY1nnhKiiL/WlfXk7PI/eoD6 fPiFPZIsGfW0s9icBAPiFqgWL41dKKCH/bFUc/ZWSw8xMKbAe6PuqbqQbLTDGFkKM7XG GDcwEvRva3v4jGlApTRH7vZwzFch4ko9nrmsFI04mzODpz0ToWZ5IFV5pSb2uSk3yl4t GWwV4gfcc21a9bBSh3bu+zyq/FC3SS5bQqzvjXw5WZjD9ky7IWrEr1uztQmRYWUn2j+f GgvA== X-Gm-Message-State: AOAM532rpW5zOiZCK7vBXG7j2bpXG153JYhPDpkhiUTVDu6PRAQ+M8Fg nPLynBV0EV0/hfCmhZh+qz/dJR+EJYpObKi+6w/T7Q== X-Received: by 2002:ac2:44c3:: with SMTP id d3mr20699654lfm.184.1635268409288; Tue, 26 Oct 2021 10:13:29 -0700 (PDT) MIME-Version: 1.0 References: <8ecc5c79c1dd0627d570ede31e18c860786cacca.1633519499.git.hns@goldelico.com> In-Reply-To: <8ecc5c79c1dd0627d570ede31e18c860786cacca.1633519499.git.hns@goldelico.com> From: Ulf Hansson Date: Tue, 26 Oct 2021 19:12:52 +0200 Message-ID: Subject: Re: [RFC] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc To: "H. Nikolaus Schaller" , Jerome Pouiller Cc: Avri Altman , Shawn Lin , Linus Walleij , Bean Huo , 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 + Jerome On Wed, 6 Oct 2021 at 13:25, H. Nikolaus Schaller wrote: > > The TiWi 5 WiFi module needs special setup of the sdio > interface before it can be probed. > > So far, this is done in omap_hsmmc_init_card() in omap_hsmmc.c > which makes it useable only if connected to omap devices > which use the omap_hsmmc. The OpenPandora is the most promient > example. > > There are plans to switch to a newer sdhci-omap driver and > retire omap_hsmmc. Hence this quirk must be reworked or moved > somewhere else. Ideally to some location that is not dependent > on the specific SoC mmc host driver. > > Analysis has shown that omap_hsmmc_init_card() is called > through the host->ops->init_card hook which itself > is called in three generic locations: > > mmc_init_card() > mmc_sd_init_card() > mmc_sdio_init_card() > > All these functions share a call to mmc_select_card() shortly > after running the init hook and therefore I assume that > a good place transplanting the special wl1251 handling is > mmc_select_card() - unless we want to copy and maintain the > code to three different places. > > After this quirk has been moved there, we can remove > omap_hsmmc_init_card() in omap_hsmmc.c in a separate patch. > Indeed the plan is to remove omap_hsmmc.c completely. > > A future development path to generalize could be to make > the code not depend on compatible = "ti,wl1251" but check > for optional device tree properties (non-std-sdio, bus width, > vendor, device, blksize, max_dtr, ocr) which can be defined > for any child device of the mmd/sd port needing such special > setup. I wouldn't go that path, simply because it may look like we encourage vendors to deviate from the SDIO spec. :-) At least for now, matching on the compatible string and applying card quirks makes perfect sense to me. > > Related-to: commit f6498b922e57 ("mmc: host: omap_hsmmc: add code for special init of wl1251 to get rid of pandora_wl1251_init_card") > Related-to: commit 2398c41d6432 ("omap: pdata-quirks: remove openpandora quirks for mmc3 and wl1251") > Related-to: commit f9d50fef4b64 ("ARM: OMAP2+: omap3-pandora: add wifi support") > Tested-by: H. Nikolaus Schaller # on OpenPandora > Signed-off-by: H. Nikolaus Schaller As a matter of fact, the similar problem that you are looking to address (applying card quirks based on DT compatibility strings), is partly being taken care of in another series [1], being discussed right now. I think the solution for the ti,wl1251 should be based upon that too. Please have a look and see if you can play with that!? Kind regards Uffe [1] [RFC PATCH 0/2] mmc: allow to rely on the DT to apply quirks https://lore.kernel.org/lkml/20211014143031.1313783-1-Jerome.Pouiller@silabs.com/ > --- > drivers/mmc/core/mmc_ops.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c > index 0c54858e89c0..6f9b96be9fe6 100644 > --- a/drivers/mmc/core/mmc_ops.c > +++ b/drivers/mmc/core/mmc_ops.c > @@ -7,6 +7,7 @@ > > #include > #include > +#include > #include > #include > > @@ -107,6 +108,35 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) > > int mmc_select_card(struct mmc_card *card) > { > + if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) { > + struct device_node *np = card->host->parent->of_node; > + > + /* > + * REVISIT: should be made more general > + * e.g. by expanding the DT bindings of child nodes to > + * optionally provide this information: > + * Documentation/devicetree/bindings/mmc/mmc-card.txt > + */ > + > + np = of_get_compatible_child(np, "ti,wl1251"); > + if (np) { > + /* > + * We have TI wl1251 attached to this mmc. Pass this > + * information to the SDIO core because it can't be > + * probed by normal methods. > + */ > + > + dev_info(card->host->parent, "found wl1251\n"); > + 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; > + of_node_put(np); > + } > + } > > return _mmc_select_card(card->host, card); > } > -- > 2.33.0 >