Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp371552rwi; Tue, 18 Oct 2022 19:27:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gW67Bt7JOmTrDVAy0IrJtqwpNQc+JWUfTUVd7lghVN2cttCXOZBKBj4SSLQPHXAVovSl1 X-Received: by 2002:a17:90b:3141:b0:20d:49d6:30b with SMTP id ip1-20020a17090b314100b0020d49d6030bmr40722335pjb.223.1666146449643; Tue, 18 Oct 2022 19:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666146449; cv=none; d=google.com; s=arc-20160816; b=sAlsVMvrYuqBNM+bowS+EzYGhnJVLtHWKH+nlVkRqLJZTWx24a0AHdVi8sPjyHjRUh H5QPAAUjy623x27PEA4DJR8sRyzCss9UEVz/nrFe3nw2jYYouw/ZXwVpPsGeNwXNsJFm jAjCXPGA7Q0Dd0WpeRUEbzFBMNEO2QeFtb0R69NG8jQUNcQog2TQagFkU4YS2NICzQyv mc2MYMOiea+DVykI5duHoIvUUzMOwp8pVzOOjaeZedLIFtGWEuw3DpCOjCVlBztHGJb/ cXER9v4jNh2zpmHMMQ1j+aBf0bHTazTRhx6sSuMqu4nRfiX7UcpFJQvw1/n4xlER6UPi NUzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mmCTinY52KbZt+uBCZCpAheaWizV9m369exbq9S3d4w=; b=ueVhEcLjmgx3vKSnUjJNOarqkDIMxKEOkEC5WKW88g/lJaOzhAWHMmah7LV8oSRhPb TyS7tVRSUz4dGVQUN81wBgYHzL0Nl7xCazIEkJFKFLBQOoFlCDM9RdsN/+FzKR5Lukfo f+W37fbt0XHullM+3So86WuJrcn4SkTa2opU1DQ2TtEaRHWb3V6luQ6WqgSV/X3r6yUu +TKMKt6T8L9ptnEpBcuvtHKvY05LgBoViTy4PGA38JiRo5vSDjOo/5VW9S7qk06uFMnC 6FkefXqHa/EDJuBSxlqbJcIywKVjgjNAaxxL8jsW8XfXo3HWYdKJdf+4Ih4hetq9iL2A uJ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gdhqay8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a634d4b000000b004386d70cf15si15598270pgl.206.2022.10.18.19.27.18; Tue, 18 Oct 2022 19:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gdhqay8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiJSCJs (ORCPT + 99 others); Tue, 18 Oct 2022 22:09:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiJSCJp (ORCPT ); Tue, 18 Oct 2022 22:09:45 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1492711C39; Tue, 18 Oct 2022 19:09:44 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id f37so25739342lfv.8; Tue, 18 Oct 2022 19:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mmCTinY52KbZt+uBCZCpAheaWizV9m369exbq9S3d4w=; b=gdhqay8/dHKxwC9B0+Gq2upmNvuQpQSoFmlmmE6+AFnD+6LDujmGDOaSiIfwlW/e9f jZXa9ll//JxZiv1dCr3f4mBDKd1tvYyYKTptL+zw/bWIK+Lj7OKD7XmA+2IRb2Kztnjp 9kMSFj8E/6XjCisAG0CBckFcHdh8+F8NzIA/hzrtQm4454pigZoUWuNnj0mp+PE+am2I 9/gb67w4ubBF6oEEcXlduBuKwRjawHKPjgC+uIUYoSVbCSLhdxhPuSWr6dQf+lJ+5BTA E+mPIec7tXOhtvZgF7VSMWYu/ZWHIUqn49515hgyUqL3laRu7YLLAzRl5rgrYXNNdyw4 OJDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mmCTinY52KbZt+uBCZCpAheaWizV9m369exbq9S3d4w=; b=XrdwkJKoiyy+33wYvqj7l4JeQBdLqVBLPYbd7uMu14dxy/smFvU3fuG4kKjf9RRyQU GDNpBxIx4Bfa4EBJWjTg+YiOnNyNZMY74yfL0dNQAqB1Qlmt3oLjarrxVKebKclwjYcu XK1K7LOnrURI9+4ljf5vK0V/Re7ZIdRj0IX/YTJlRQr1OVr5NvqHAxyN6zcPGe7XNDIC XglVkFzxvxlZY8S8SgM29rAZ7SznGFxD8vQEfdEH38JEj49sUOfJBUi86B9jotAsKhQI dVibDkY7VikaQPuAiiKBG2TE468QUsW/O3S0n/peaEVdsx9XPkf5mSRbqhvzi7v/QOLk hNXg== X-Gm-Message-State: ACrzQf3Q7k7YSzBNYpBVx/3Fy9xLosYJXAPyP+SPmeGfnddsyP97/hSq rsL8JF2ay/itZ4lPUU1lsuRKsDCrSqaNjfGMRCM= X-Received: by 2002:a05:6512:1586:b0:498:fa29:35ec with SMTP id bp6-20020a056512158600b00498fa2935ecmr2084247lfb.641.1666145382080; Tue, 18 Oct 2022 19:09:42 -0700 (PDT) MIME-Version: 1.0 References: <039075b210d78d2f4fdeb66b6826b8d2c2836088.1665931914.git.tonyhuang.sunplus@gmail.com> In-Reply-To: From: =?UTF-8?B?6buD5oe35Y6a?= Date: Wed, 19 Oct 2022 10:10:48 +0800 Message-ID: Subject: Re: [PATCH v10 2/2] mmc: Add mmc driver for Sunplus SP7021 To: Arnd Bergmann Cc: Ulf Hansson , Rob Herring , krzk+dt@kernel.org, "linux-mmc @ vger . kernel . org" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, wells.lu@sunplus.com, Tony Huang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Arnd, Ulf: Arnd Bergmann =E6=96=BC 2022=E5=B9=B410=E6=9C=8817=E6=97=A5= =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=883:25=E5=AF=AB=E9=81=93=EF=BC=9A > > On Sun, Oct 16, 2022, at 5:48 PM, Tony Huang wrote: > > This is a patch for mmc driver for Sunplus SP7021 SOC. > > Supports eMMC 4.41 DDR 104MB/s speed mode. > > > > Signed-off-by: Tony Huang > > Looks ok to me me overall. > > Acked-by: Arnd Bergmann > > Just one more thing I noticed: > > > +#define SPMMC_TIMEOUT 500000 > ... > > +static inline int spmmc_wait_finish(struct spmmc_host *host) > > +{ > > + u32 state; > > + > > + return readl_poll_timeout_atomic(host->base + SPMMC_SD_STATE_REG, > > state, > > + (state & SPMMC_SDSTATE_FINISH), 1= , SPMMC_TIMEOUT); > > +} > > + > > +static inline int spmmc_wait_sdstatus(struct spmmc_host *host, > > unsigned int status_bit) > > +{ > > + u32 status; > > + > > + return readl_poll_timeout_atomic(host->base + SPMMC_SD_STATUS_REG= , > > status, > > + (status & status_bit), 1, SPMMC_T= IMEOUT); > > +} > > 500ms seems like an awfully long time for a busy-wait, I wonder if this > could be improved in some way. Is this always called from atomic context? > > If not, any callers from non-atomic context could use > readl_poll_timeout() instead, or maybe there could be a shorter > timeout in atomic context, with a fallback to a non-atomic > workqueue if that times out, so only the MMC access will stall but > not the entire system. OK, I would use real_poll_timeout() instead. Because I see "BUG: scheduling while atomic" issue before. I have solved this problem. > > The same problem does appear to be in dw_mmc.c and mtk-sd.c but not > in sdhci*.c, so I don't know if this is avoidable. > > Arnd