Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3014757rdh; Mon, 27 Nov 2023 04:52:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFc+kLgBPJWnV/KpIKPjHfQ8usdro3KBKKtGoq13j2/k+JKhsGuisSUTwlqquiRpyPI1WMO X-Received: by 2002:a05:6a20:729c:b0:18c:7b7:8630 with SMTP id o28-20020a056a20729c00b0018c07b78630mr9470947pzk.13.1701089524761; Mon, 27 Nov 2023 04:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701089524; cv=none; d=google.com; s=arc-20160816; b=UvTND7d5ICtSI7XI3Zk29P6jRwSRZQ/cCEjlzTWQUKZtU1KYWz+/iTbUdlEXY3imcR 7Q7MGhbCLioshVtnQrSFFJsoOiEd1W1XJx58xCmFpT11PXqe9yuDTPhgVIEhNbqyE/CZ F9K05ejJK4WLbr8L3KnLFtm1Lni86ha8AMl8XCqOpQCL2h3Z0lmkpQgUPu6fW41Btrmy 1KnVjOaYxRxVA0zd0nxmrfZ3yTAxj0bgtv70OSlSLqPaRd8Ob59eT4eFuK+spVT22LN5 QgePgB4n5O4nr1/sDsghddI5Qf8+0z+0ArVaMCH74VAeCliAHlYmz314X9vUEo/sKA1y m/7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=th2Bd20kTi/gjFrbpIS/eLMBCT5q8wRktdxs/sbSNS8=; fh=YcLVLQLPLhk2r3K1f6bwxLQoAi3j2h3P3aB9Skb982Q=; b=j1gG9KuzLzNE9TMXrTw49chyU5eq1UK6DR4OBKGIRiK4ghwugOyo1ljrHSly8Ls5QA hVkAiyP2PDiUJ9Qn+eeoDPmyiasYdtxKMWMtUezkIQJrBh27Ivdq6ewMtyHRPDG1EJJx y7yZcHjCLfpjfeCREnUYFLFFPhnziy8h77V6e0FkHba7oxVPfuOiHYZ63ieJ79pGKwt1 KbNPEDeUxoH+SLfWBbBFYICN+lUD0AJ9VqbEDacMlIUz4Fz+KRiioP+N4fyCPHNAf5Kp Jp5GbhQutPdtF9gE9PJ510byG9hMyKcr+PyAJp6yVKztdTGTgtYbtPRAzQLs+6Wwh4g6 +M6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x1-20020a63fe41000000b00563d9ff5157si10214410pgj.547.2023.11.27.04.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 04:52:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 60315807BEF5; Mon, 27 Nov 2023 04:52:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233419AbjK0Mvq convert rfc822-to-8bit (ORCPT + 99 others); Mon, 27 Nov 2023 07:51:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233387AbjK0Mvp (ORCPT ); Mon, 27 Nov 2023 07:51:45 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF232137 for ; Mon, 27 Nov 2023 04:51:51 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r7b5A-0003Jf-Mc; Mon, 27 Nov 2023 13:51:24 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7b55-00Bwme-Ia; Mon, 27 Nov 2023 13:51:19 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1r7b55-000C2j-1c; Mon, 27 Nov 2023 13:51:19 +0100 Message-ID: <23011695aafca595c3c8722fda2a8e194c5318df.camel@pengutronix.de> Subject: Re: [PATCH v7][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver From: Philipp Zabel To: Jyan Chou , ulf.hansson@linaro.org, adrian.hunter@intel.com, jh80.chung@samsung.com, riteshh@codeaurora.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: conor+dt@kernel.org, asutoshd@codeaurora.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, briannorris@chromium.org, doug@schmorgal.com, tonyhuang.sunplus@gmail.com, abel.vesa@linaro.org, william.qiu@starfivetech.com Date: Mon, 27 Nov 2023 13:51:19 +0100 In-Reply-To: <20231121091101.5540-3-jyanchou@realtek.com> References: <20231121091101.5540-1-jyanchou@realtek.com> <20231121091101.5540-3-jyanchou@realtek.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 04:52:02 -0800 (PST) Hi, On Di, 2023-11-21 at 17:10 +0800, Jyan Chou wrote: > We implemented cmdq feature on Synopsys DesignWare mmc driver. > The difference between dw_mmc.c and dw_mmc_cqe.c were distinct > register definitions, mmc user flow and the addition of cmdq. > > New version of User Guide had modify mmc driver's usage flow, > we may need to renew code to precisely follow user guide. > > More over, We added a wait status function to satisfy synopsys > user guide's description, since this flow might be specific in > synopsys host driver only. > > Signed-off-by: Jyan Chou > > —-- [...] > diff --git a/drivers/mmc/host/dw_mmc_cqe.c b/drivers/mmc/host/dw_mmc_cqe.c > new file mode 100644 > index 000000000000..eb00d6a474b2 > --- /dev/null > +++ b/drivers/mmc/host/dw_mmc_cqe.c > @@ -0,0 +1,1467 @@ [...] > +#ifdef CONFIG_OF > +static struct dw_mci_board *dw_mci_cqe_parse_dt(struct dw_mci *host) > +{ > + struct dw_mci_board *pdata; > + struct device *dev = host->dev; > + const struct dw_mci_drv_data *drv_data = host->drv_data; > + int ret; > + > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > + if (!pdata) > + return ERR_PTR(-ENOMEM); > + > + pdata->rstc = devm_reset_control_get_optional_exclusive(dev, NULL); > + if (IS_ERR(pdata->rstc)) { > + if (PTR_ERR(pdata->rstc) == -EPROBE_DEFER) > + return ERR_PTR(-EPROBE_DEFER); This should return ERR_CAST(pdata->rstc); instead. There is no reason to hide device tree parsing errors here, and I'd argue pdata should not be returned with rstc set to an error value. devm_reset_control_get_optional_exclusive() returns NULL if there are no errors and no reset is specified in the device tree. Then you can just use dev_err_probe() at the call site in dw_mci_cqe_probe(). [...] > +int dw_mci_cqe_probe(struct dw_mci *host) > +{ [...] > + if (!IS_ERR(host->pdata->rstc)) { > + reset_control_assert(host->pdata->rstc); > + usleep_range(10, 50); > + reset_control_deassert(host->pdata->rstc); > + } This should be changed to if (host->pdata->rstc) { reset_control_assert(host->pdata->rstc); usleep_range(10, 50); reset_control_deassert(host->pdata->rstc); } [...] > + return 0; > + > +err_dmaunmap: > + if (!IS_ERR(host->pdata->rstc)) > + reset_control_assert(host->pdata->rstc); This should be just reset_control_assert(host->pdata->rstc); as reset_control_assert() is a no-op if host->pdata->rstc == NULL. [...] > +void dw_mci_cqe_remove(struct dw_mci *host) > +{ [...] > + if (!IS_ERR(host->pdata->rstc)) > + reset_control_assert(host->pdata->rstc); reset_control_assert(host->pdata->rstc); regards Philipp