Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp326946lqa; Sat, 27 Apr 2024 04:16:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX66v0uuox6fc8OC2DWpQ8XsQ2T+lU43rvcHJLi10a2apjkt1H9HpXB/BZm4FhOaKY68vZyIVvKyhvh8iNhS4NNDyt6UENuW931RFwvTA== X-Google-Smtp-Source: AGHT+IFkZVcAnpk2Fa/EheC7Un67gGY3L5r3sJ3Zu/iYuWa8yZpgFGgHvWgmZvfJhqkJECdvjrEi X-Received: by 2002:a05:6512:3ba8:b0:51a:f2eb:b4c9 with SMTP id g40-20020a0565123ba800b0051af2ebb4c9mr4337404lfv.1.1714216610196; Sat, 27 Apr 2024 04:16:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714216610; cv=pass; d=google.com; s=arc-20160816; b=XoB6B6SUsBLv2FHFOSUhOpSV22rdlZtvLLBZs1nohui5TMWaDw3ej2UM9t1uF1CZxf P6P0o92+afM2tkoLE1jUs3U653BhdTmYPmX21pCQOkklhwzDCfeDup943ON897TjDdY2 hK4X6SQy+NY5C33B57tkue3wzT1hVROQagKEcHph7/pHDEJUt3kouFBlh85joL5v/12C JbO3EX0svVp5cNC8RzrMLEcJ7gFCnUChiq8qbo3shrDW5wbnl5b4jyUOd1AX4MFK8SHY YbvqQfYaN3EyeozNKqUks8jYDdbNv4U1OXeM37Ulrd3SSXIKxA0KGwZrS0cxETxU4mIy CqeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:date:from :dkim-signature; bh=cWZ79BmqrOM43+BCD+VAgtUw9w+BzvSsy0l3aYOkwOM=; fh=YuZx88h2Ij9RMHwnJdIuKBmDCLw65lEpSFeKHlW6MGI=; b=qtCX3hgnBAlCqhAjKd1Fp6L9eft2vj5VEwJq5sEvpZhHAwJLD3XRiT0j10lE7UHPpJ aXg4pAqH889x210bHLVAqJpJytCqzqyxB5b7dy9gMTRB1J88wshpKTlwCB/eGmC9XRxO Fl2zstT11eMpDOMk4xNGDP439YIxBgelwvlBbl7Iv6P2HBAitvz9PnmGd5DK4qNbqv5C eIzVD9kWL1HNg48JnG7rMsbquS5/fg4+e0xiXuzEQ6DBKc0K1q7Sw0N3MFBvlmJWsqAT xJY0lK3FOHSorxbbQ7Y8Oyato8GWPcuPNeofUWDLtIPtOcvnXmD2Vsmvpbr4MaihYC4Y BdTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=XzVtDjXg; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-161015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q3-20020a170906388300b00a51b8502695si11892418ejd.1033.2024.04.27.04.16.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 04:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=XzVtDjXg; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-161015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C4571F2218C for ; Sat, 27 Apr 2024 11:16:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F6094AEEC; Sat, 27 Apr 2024 11:16:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="XzVtDjXg" Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E3CA48CC7 for ; Sat, 27 Apr 2024 11:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714216599; cv=none; b=raGraO425fKWCe7V1P73wJLXEImUsbqhujXfDk0XY9A+clp2oPECJFZmi7aPyR5R6HF/IrdiJk4j7RdfsfzvSEjgSx/fsaZ1yE0QfdVe6Ug/ttUI0754+GPoTulaJYUUV7rGj0flZIjGm/88XpVaL1WzPTspoT/VrTaNn1CJGTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714216599; c=relaxed/simple; bh=6+JyWGlWuL3neFwfndVAm41mP9TCdZhO4TKU+cop+kc=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oUnXwrMRCb8+egPWdqToPN09Pae5oHvd9meNxspcCaoKusLfIx7zYZSMk9IhkCegPwY/8Q/c9W11/+JoYr0fHyAZwAoqxFurU8ECOskK+vMtJ2mhpCMDm7pBPkHXtgCo28FrfPFt7rZHJBn3k9GFXJNi7xrYCVOp1/IypyWOB5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=XzVtDjXg; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-56e56ee8d5cso3842308a12.2 for ; Sat, 27 Apr 2024 04:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1714216595; x=1714821395; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :date:from:from:to:cc:subject:date:message-id:reply-to; bh=cWZ79BmqrOM43+BCD+VAgtUw9w+BzvSsy0l3aYOkwOM=; b=XzVtDjXgC+dnW9W3hYw2fbdXVOfEpk18lgRg/dQrGiFHIm8In/fHOTGEirxUAweF/4 7tnm+bYHjXAnW7kpB9Fgr1ZKXj3r+6wD7iy6ewaNWNQL/gvr8HC032fJ1QY1F/I3IAFM hCJ7GWFhwn7qC8AGp7yJNEstypGzK0m1WugC/tKJksisAfBo9vAaR8nK/kG121DejWha yN6a/SgXV4nUgBnq8YwtfypD/0K8bYRa0bMhkjqDzow21QhOf2gnyUKe9y3v+G+zCv/K J05cErm/NcWlkCplR2vFSwjKaSeKJ5T1CNQRdzPXEBk0Hq8NZQ2hPX9q3Hgu5hYw3xol Ofeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714216595; x=1714821395; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cWZ79BmqrOM43+BCD+VAgtUw9w+BzvSsy0l3aYOkwOM=; b=C7OFKTfCkUeZR9aM+ZSmGxbg6m5JkEktzWXVyM290fa4A1cPoEhhGIcRNzbt/AQK87 Ix13mo3LZn1TJtZzjxF8KSa0Oto75fLmOCLAs4cDrTVQvtJofT/oopKXMKH8yLowDCmr DNte2+DQDthqKEfLiJ2Y8NAvn920EUCG735lTQDgf82gAozyWT92EWfLmJxOL7AgOMZp bjmteRZDIW7qPCMZcCuBEKIsz8nMgb6GPoK5DpX77vM8XDt3X8neIXACKWJ5OEXWLlTd gASiMn/jXwKartsPm2VFCNnslzfb0F1yYLsTH0WC0yfeoh3+qXNMAkozdUaEJdUDcuIZ EeAw== X-Forwarded-Encrypted: i=1; AJvYcCVG861cfVxj7dWIQJKjAIgSwobHHTTrdh1Q6DJ6jyea8HJGbRPBHCNA234XU3P8CDCRzxBFxHmgqOsyhBvj13ixEqgytgTP1ebk/Rbn X-Gm-Message-State: AOJu0Yzy1GVraDlbZZ2wax0Lxa+avC7lx2bNF98mvCW9C7u7cMakceef npQ08GpfWIAZoFt0H1zhJE0aG8fh93aKWeXEXVoSZTQYRQEB/kLfeTNiS2JYcjk= X-Received: by 2002:a50:9e87:0:b0:570:1ea6:e9d8 with SMTP id a7-20020a509e87000000b005701ea6e9d8mr3714303edf.9.1714216595365; Sat, 27 Apr 2024 04:16:35 -0700 (PDT) Received: from localhost (host-87-1-234-99.retail.telecomitalia.it. [87.1.234.99]) by smtp.gmail.com with ESMTPSA id cf8-20020a0564020b8800b0056c24df7a78sm11060511edb.5.2024.04.27.04.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 04:16:35 -0700 (PDT) From: Andrea della Porta X-Google-Original-From: Andrea della Porta Date: Sat, 27 Apr 2024 13:16:36 +0200 To: Christophe JAILLET Cc: Andrea della Porta , adrian.hunter@intel.com, alcooperx@gmail.com, bcm-kernel-feedback-list@broadcom.com, conor+dt@kernel.org, devicetree@vger.kernel.org, florian.fainelli@broadcom.com, jonathan@raspberrypi.com, kamal.dasu@broadcom.com, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, phil@raspberrypi.com, robh@kernel.org, ulf.hansson@linaro.org Subject: Re: [PATCH 6/6] mmc: sdhci-brcmstb: Add BCM2712 SD Express support Message-ID: Mail-Followup-To: Christophe JAILLET , Andrea della Porta , adrian.hunter@intel.com, alcooperx@gmail.com, bcm-kernel-feedback-list@broadcom.com, conor+dt@kernel.org, devicetree@vger.kernel.org, florian.fainelli@broadcom.com, jonathan@raspberrypi.com, kamal.dasu@broadcom.com, krzysztof.kozlowski+dt@linaro.org, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, phil@raspberrypi.com, robh@kernel.org, ulf.hansson@linaro.org References: <57f240af-7e99-4bc1-a2c5-415441aa5f0b@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <57f240af-7e99-4bc1-a2c5-415441aa5f0b@wanadoo.fr> On 09:34 Sun 14 Apr , Christophe JAILLET wrote: > Le 14/04/2024 ? 00:14, Andrea della Porta a ?crit?: > > Broadcom BCM2712 SDHCI controller is SD Express capable. Add support > > for sde capability where the implementation is based on downstream driver, > > diverging from it in the way that init_sd_express callback is invoked: > > in downstream the sdhci_ops structure has been augmented with a new > > function ptr 'init_sd_express' that just propagate the call to the > > driver specific callback so that the callstack from a structure > > standpoint is mmc_host_ops -> sdhci_ops. The drawback here is in the > > added level of indirection (the newly added init_sd_express is > > redundant) and the sdhci_ops structure declaration has to be changed. > > To overcome this the presented approach consist in patching the mmc_host_ops > > init_sd_express callback to point directly to the custom function defined in > > this driver (see struct brcmstb_match_priv). > > > > Signed-off-by: Andrea della Porta > > --- > > drivers/mmc/host/Kconfig | 1 + > > drivers/mmc/host/sdhci-brcmstb.c | 147 ++++++++++++++++++++++++++++++- > > 2 files changed, 147 insertions(+), 1 deletion(-) > > ... > > > + if (brcmstb_priv->sde_pcie) { > > + struct of_changeset changeset; > > + static struct property okay_property = { > > + .name = "status", > > + .value = "okay", > > + .length = 5, > > + }; > > + > > + /* Enable the pcie controller */ > > + of_changeset_init(&changeset); > > + ret = of_changeset_update_property(&changeset, > > + brcmstb_priv->sde_pcie, > > + &okay_property); > > + if (ret) { > > + dev_err(dev, "%s: failed to update property - %d\n", __func__, > > + ret); > > + return -ENODEV; > > + } > > + ret = of_changeset_apply(&changeset); > > + } > > + > > + dev_dbg(dev, "%s -> %d\n", __func__, ret); > > Is this really useful? Not really. Removed. > > > + return ret; > > +} > > + > > ... > > > @@ -468,6 +581,24 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) > > if (res) > > goto err; > > + priv->sde_1v8 = devm_regulator_get_optional(&pdev->dev, "sde-1v8"); > > + if (IS_ERR(priv->sde_1v8)) > > + priv->flags &= ~BRCMSTB_PRIV_FLAGS_HAS_SD_EXPRESS; > > + > > + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 2); > > + if (iomem) { > > + priv->sde_ioaddr = devm_ioremap_resource(&pdev->dev, iomem); > > + if (IS_ERR(priv->sde_ioaddr)) > > + priv->sde_ioaddr = NULL; > > + } > > + > > + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 3); > > + if (iomem) { > > + priv->sde_ioaddr2 = devm_ioremap_resource(&pdev->dev, iomem); > > + if (IS_ERR(priv->sde_ioaddr2)) > > + priv->sde_ioaddr = NULL; > > sde_ioaddr2 ? > > > + } > > + > > priv->pinctrl = devm_pinctrl_get(&pdev->dev); > > if (IS_ERR(priv->pinctrl)) { > > no_pinctrl = true; > > @@ -478,8 +609,16 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) > > no_pinctrl = true; > > } > > - if (no_pinctrl ) > > + priv->pins_sdex = pinctrl_lookup_state(priv->pinctrl, "sd-express"); > > + if (IS_ERR(priv->pins_sdex)) { > > + dev_dbg(&pdev->dev, "No pinctrl sd-express state\n"); > > + no_pinctrl = true; > > Indentation looks too large. Ack. > > > + } > > + > > + if (no_pinctrl || !priv->sde_ioaddr || !priv->sde_ioaddr2) { > > priv->pinctrl = NULL; > > + priv->flags &= ~BRCMSTB_PRIV_FLAGS_HAS_SD_EXPRESS; > > + } > > /* > > * Automatic clock gating does not work for SD cards that may > > ... > In general I'll drop SD express patch for now, it will be re-introduced in a future patch. Best regards, Andrea