From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EF26C4332F for ; Mon, 30 Oct 2023 07:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232127AbjJ3Hjd (ORCPT ); Mon, 30 Oct 2023 03:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjJ3Hjc (ORCPT ); Mon, 30 Oct 2023 03:39:32 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A50B7 for ; Mon, 30 Oct 2023 00:39:28 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9c5b313b3ffso614019366b.0 for ; Mon, 30 Oct 2023 00:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698651567; x=1699256367; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=un1B+HdCY4rb6l+yNfK1fdIrKdS9fURStbp/Gin4628=; b=YL2zWM4SBRfjz3WDVAlK3i7bukpWyy3ZEoNjHVJ9YmlQTcmbFy8e+JyBxByeeL8Oc0 9uWqvtODjE+W4++cgVXuyyHX7+pC9aeWKaGMtZMxSU8XKvTNW3OKdHaYIQ0yXbxLjsqg B1Fv1XdR2RhYblU/vZriE1JqNR/yNST59hvFcZDn5ELne8yI76wUbCYf133+KCppuXQ9 il3Ornc1Bxg6N1Fe8GQk5PO7g69ojqsZhUQhIc4KVATSOSoZboT4jRh02jFa5gnnOD0O oLrL/Oc4LdaFSXMGXsEMmMuhwqxvTyp8e/XrLLWwSe8EWsz92Doh+hoNcsAiujvorvEd ngIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698651567; x=1699256367; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=un1B+HdCY4rb6l+yNfK1fdIrKdS9fURStbp/Gin4628=; b=TEyuapbuTCgtCCfEofxZXBCYo3A83tOAwS74JHoEf7y6mPhuDBm9EM5RQzYhDPh5SB GU0bY3ZO7SO7jOH2IrH0LlC0MakqxyD0y322jvu7FSCpOSFbztBcmjdTuvdg2MDeQZVe n03rO8zlm9R1SDMJPi3EGkacU01S4NlvM2eYEq1Cqf68U+fUjSCW3exccko5b3OqvK1e cXqXsSqq+tzFeAm79dfr9fXM+ybWm2uswi87StxvNeBCfSPxmwvFN5euL8AxH8ciFxsl 0RxizrGKz636lhd++exKvWizgl/fKRZ/qmIFVqAN7o5ruV8p7PbYQGTOIwao7Kj+dwB4 bTfQ== X-Gm-Message-State: AOJu0YxCJK0L/w1nq+wPgs2CfHvcu+mA2HRbhoOma9lB4zCwYnYwhxh6 ZqiTMfsjlMC2AH1RlFzpiTy4SA== X-Google-Smtp-Source: AGHT+IF8Ef++OJHXVJllrD3R72IaUiIgCv3FiU91UCPPrjv6o6Nke2xQzDc/J+zev/lhkV/+SQoJDw== X-Received: by 2002:a17:907:2910:b0:9be:51ce:e91b with SMTP id eq16-20020a170907291000b009be51cee91bmr5536966ejc.68.1698651567082; Mon, 30 Oct 2023 00:39:27 -0700 (PDT) Received: from [192.168.1.20] ([178.197.218.126]) by smtp.gmail.com with ESMTPSA id x22-20020a170906149600b009b2b47cd757sm5490088ejc.9.2023.10.30.00.39.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Oct 2023 00:39:26 -0700 (PDT) Message-ID: Date: Mon, 30 Oct 2023 08:39:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V4][2/4] mmc: Add Synopsys DesignWare mmc cmdq host driver Content-Language: en-US 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, conor+dt@kernel.org, asutoshd@codeaurora.org, p.zabel@pengutronix.de Cc: 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 References: <20231030062749.2840-1-jyanchou@realtek.com> <20231030062749.2840-3-jyanchou@realtek.com> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23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oVmYDFZkbLlqs2XpWaVCo2jv8+iHxZZ9FL7F6AHFzqEFdqGnJQqmEApiRqH6b4jRBOgJ+cY qc+rJggwMQcJL9F+oDm3wX47nr6jIsEB5ZftdybIzpMZ5V9v45lUwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20231030062749.2840-3-jyanchou@realtek.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org On 30/10/2023 07:27, 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 > > —-- > v3 -> v4: > - Modify dma mode selection and dma addressing bit to statisfy > linux coding style. > I asked to fix several coding style issues so it will look a bit as matching Linux coding style. I don't see improvements. Please read carefully, more than once, the Linux coding style. Then document in changelog what you fixed. If you document nothing, means you ignored the feedback. Fix every warning from checkpatch --strict. Then document in changelog what you fixed. If you document nothing, means you ignored the feedback. > + > + if (!host->bus_hz) { > + dev_err(host->dev, > + "Platform data must supply bus speed\n"); > + ret = -ENODEV; > + goto err_clk_ciu; > + } > + > + if (!IS_ERR(host->pdata->rstc)) { > + reset_control_assert(host->pdata->rstc); > + usleep_range(10, 50); > + reset_control_deassert(host->pdata->rstc); > + } > + > + timer_setup(&host->timer, dw_mci_cqe_cto_timer, 0); > + > + spin_lock_init(&host->lock); > + spin_lock_init(&host->irq_lock); > + init_rwsem(&host->cr_rw_sem); > + tasklet_init(&host->tasklet, dw_mci_cqe_tasklet_func, (unsigned long)host); > + > + /*pio mode's parameters should be initialized here*/ Nothing improved. > + > + /*Initialize the eMMC IP related attribute*/ > + dw_mci_cqe_setup(host); > + > + dw_mci_cqe_init_dma(host); > + > + /* This flag will be set 1 when doing tuning, Nothing improved. > + * we add this flag because > + * some vendors might use other cmd instead of 21 > + * to tune phase under high speed interface. > + * we use this flag to recognize if the system is under tuning stage. > + */ > + host->tuning = 0; > + > + /*Timing_setting is to avoid sending command Nothing improved. > + *before setting phase in hs200, hs400 > + */ > + host->current_speed = 0; > + > + /*Do the rest of init for specific*/ > + if (drv_data && drv_data->init) { > + ret = drv_data->init(host); > + if (ret) { > + dev_err(host->dev, > + "implementation specific init failed\n"); > + goto err_dmaunmap; > + } > + } > + > + ret = dw_mci_cqe_init_slot(host); > + if (ret) { > + dev_err(host->dev, "slot 0 init failed\n"); > + goto err_dmaunmap; > + } > + > + ret = devm_request_irq(host->dev, host->irq, dw_mci_cqe_interrupt, > + host->irq_flags, "dw-mci-cqe", host); > + if (ret) > + goto err_dmaunmap; > + > + /*After the slot initialization, Nothing improved. > + *now we have mmc data and can initialize cmdq if user enabled > + */ > + dw_mci_cqhci_init(host); > + > + return 0; > + > +err_dmaunmap: > + if (!IS_ERR(host->pdata->rstc)) > + reset_control_assert(host->pdata->rstc); > +err_clk_ciu: > + clk_disable_unprepare(host->ciu_clk); > + > +err_clk_biu: > + clk_disable_unprepare(host->biu_clk); > + > + return ret; > +} > +EXPORT_SYMBOL(dw_mci_cqe_probe); > + > +void dw_mci_cqe_remove(struct dw_mci *host) > +{ > + dev_dbg(host->dev, "remove slot\n"); Nothing improved. > + if (host->slot) > + dw_mci_cqe_cleanup_slot(host->slot); > + > + if (!IS_ERR(host->pdata->rstc)) > + reset_control_assert(host->pdata->rstc); > + > + clk_disable_unprepare(host->ciu_clk); > + clk_disable_unprepare(host->biu_clk); > +} > +EXPORT_SYMBOL(dw_mci_cqe_remove); > + > +#ifdef CONFIG_PM > +int dw_mci_cqe_runtime_suspend(struct device *dev) > +{ > + struct dw_mci *host = dev_get_drvdata(dev); > + int ret = 0; > + > + if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) { > + if (host->slot) { > + dev_info(host->dev, "cqe suspend\n"); Nothing improved. > + ret = cqhci_suspend(host->slot->mmc); > + if (ret) { > + dev_err(host->dev, "cqe suspend failed\n"); Nothing improved. > + return ret; > + } > + } > + } > + > + clk_disable_unprepare(host->ciu_clk); > + > + return ret; > +} > +EXPORT_SYMBOL(dw_mci_cqe_runtime_suspend); > + > +int dw_mci_cqe_runtime_resume(struct device *dev) > +{ > + struct dw_mci *host = dev_get_drvdata(dev); > + const struct dw_mci_drv_data *drv_data = host->drv_data; > + int ret = 0; > + > + clk_prepare_enable(host->ciu_clk); > + > + dw_mci_cqe_setup(host); > + if (drv_data && drv_data->init) { > + ret = drv_data->init(host); > + if (ret) > + dev_err(host->dev, "implementation specific init failed\n"); > + } > + > + init_completion(host->int_waiting); > + > + if (host->pdata && (host->pdata->caps2 & MMC_CAP2_CQE)) { > + if (host->slot) { > + dev_info(host->dev, "cqe resume\n"); > + ret = cqhci_resume(host->slot->mmc); > + if (ret) > + dev_err(host->dev, "cqe resume failed\n"); Nothing improved. > + } > + } > + > + dw_mci_cqe_setup_bus(host->slot, true); > + > + return ret; > +} > +EXPORT_SYMBOL(dw_mci_cqe_runtime_resume); > +#endif /* CONFIG_PM */ > + > +static int __init dw_mci_cqe_init(void) > +{ > + pr_info("Synopsys Designware Multimedia Card Interface Driver\n"); Nothing improved. > + return 0; > +} > + > +static void __exit dw_mci_cqe_exit(void) > +{ > +} > + > +module_init(dw_mci_cqe_init); > +module_exit(dw_mci_cqe_exit); This part of code is just useless. Best regards, Krzysztof