From patchwork Fri Nov 17 11:31:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Shih X-Patchwork-Id: 166127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp460543vqn; Fri, 17 Nov 2023 03:34:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4DbFJIU+Hs0ozkQp2kpeiwmMXd2ccFXq2UKah3UmolY+qEgBLF4H5MOTKdXdoud1VUyUU X-Received: by 2002:a05:6a20:734d:b0:185:a90d:363d with SMTP id v13-20020a056a20734d00b00185a90d363dmr16170946pzc.2.1700220857123; Fri, 17 Nov 2023 03:34:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700220857; cv=none; d=google.com; s=arc-20160816; b=yUQm+vAui+D/+QJ6p3zoIqMRL9g2lJmL+8XTN+dblEFqOtBOV9dD1SDPzDWaUGxba8 P4Nmjl02nyO93DryIJ5BOD4DND13VOoBFtDlfOraw9yNEj/A2oSAUGI9LqMb6aLTcrZP Pd0CI276Wh1/V5kqkmzDFIqW5sHkVXa/6W2tr3rSiohiulgNorUOkJG/z1bb33fR69EP vci4xD9LV0cTuubfu+v04VReCVi2RDCMXXA3w21WpHtXO9Cix5CqsHRQAi4ZBpnvYKFp Dgiu4+72VboQiIngmC3hESPcbc0sLgxE57BK6x1L5aAd8xw7nHIo5iL2Qjge0T1ygAxT OxPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=elnfGKAy/7+HbOAzxPXIpLPWv33SV0UOKZl7RY/LQJw=; fh=SGG3QbPbnQBJxlAxW/KlnI/lv7wpvLbL3mCFFkGt7Ks=; b=UYgLLqMibolm8A5CJS81r2KpzQp0OvjDp6AEPM69JKIq/sAqghg1aNupVKT7tikVrL BrtIIL23cz6GpB5a0yUbSA68W48OALqdMOwzHVId5WgyHpbQtr73gVTA6yGDpxTUOM4N gxkNK5lBwfJVZS0if67gmIQusSjNGbiBsnFnBO6RVnVW6FQDmQqWt/TVg7us+57SUTI2 WR7bYrzuxgNFLIMVM7g4HwFS29ZFGVI6qWAFe6SfKB2tOtC2tyJK5UbHBpT5Muo+/CDA FpPNrEKMQDbW1XFNQV6upd4fe7vUIDVFatbtdHCkWFNea8YL6SmQNuBYeFOoFInkdwhq Bgxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZgZetg5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g23-20020a63fa57000000b005bdd8af5a15si1636180pgk.668.2023.11.17.03.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 03:34:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZgZetg5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6D4C882E4836; Fri, 17 Nov 2023 03:34:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346030AbjKQLca (ORCPT + 30 others); Fri, 17 Nov 2023 06:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346037AbjKQLcX (ORCPT ); Fri, 17 Nov 2023 06:32:23 -0500 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF511985; Fri, 17 Nov 2023 03:32:16 -0800 (PST) Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6ce37683cf6so1033178a34.3; Fri, 17 Nov 2023 03:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700220735; x=1700825535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=elnfGKAy/7+HbOAzxPXIpLPWv33SV0UOKZl7RY/LQJw=; b=ZgZetg5eEJr2YkXWvmgpUWlrxC1uzpO6YdKcz4toZCXz6CmanZpmQ1ea0L81ulqXvV 9hv3ee4p8eew8anQlZNbI8T7y4GqbYzRQku2sy3T3ga/slW8jC6fRkHXKNiSN+HeCKgb ZikpK4bAN71q84GhZjTqMKZBIHEZCUgW2Mkosri/DKpBRdmbpoD7I6K6z6ZJUeLLPk3E si1bujXQJhp7t9U/EXzqvB5Xp+gAoZbkPNnjFy2luyZ93NLcZ7EDL5YeE6DHVTqDPYOl 0N8Uctus9L8OE3B/h8BMovsejEdRqMfxgzjtgGa9O11ZaYkt6LArjNfeptnu+MKuzip/ Sdtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700220735; x=1700825535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=elnfGKAy/7+HbOAzxPXIpLPWv33SV0UOKZl7RY/LQJw=; b=ZPfHbWG1hko+81MTJbonD4GvaVBNQ7Eu5KwGGeoKsIzLwNCpxdEMzxnn9VONjGYuwU kfZIsRxOBjmGc3RlfUwYVfbn5ph3K/TyESTyFFji9iA7KQS95+aCRz2gf/sNO62Xg7PW 0X2/2UoSvH3w0YhC0z1cpEVWrvzptPY8BytDvVies7MA68Qo9D8XzFrcS0xLMEryXOiK nbP7HCycnQB4nYtRdzfDlV+mB9KYN71B66hO9nYlTrxlkF89McHTuZddN08xspfuDxEm e6kd1DMGK74egQPHP61AOUkR66XbUjbTEzPR3EbKS0YkbNAlUQgc8ys6mwHP3ehjFutO kMxg== X-Gm-Message-State: AOJu0YyVmaNQmiUTQ5cGK7w7A8fXwbUrAqBkEe+zLbP6gPYRSq4pcARa P7kDVtXNy/VA43FGsRMRwKo= X-Received: by 2002:a9d:75cc:0:b0:6d6:4c28:5579 with SMTP id c12-20020a9d75cc000000b006d64c285579mr12780034otl.8.1700220735214; Fri, 17 Nov 2023 03:32:15 -0800 (PST) Received: from localhost.localdomain (2001-b400-e286-d458-bc89-d4cd-bd42-ffb5.emome-ip6.hinet.net. [2001:b400:e286:d458:bc89:d4cd:bd42:ffb5]) by smtp.gmail.com with ESMTPSA id u2-20020a631402000000b005b4b70738e5sm1229224pgl.8.2023.11.17.03.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 03:32:15 -0800 (PST) From: Victor Shih To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, benchuanggli@gmail.com, HL.Liu@genesyslogic.com.tw, Greg.tu@genesyslogic.com.tw, takahiro.akashi@linaro.org, dlunev@chromium.org, Victor Shih , Victor Shih Subject: [PATCH V13 06/21] mmc: core: Add New function to re-factoring the code Date: Fri, 17 Nov 2023 19:31:34 +0800 Message-Id: <20231117113149.9069-7-victorshihgli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231117113149.9069-1-victorshihgli@gmail.com> References: <20231117113149.9069-1-victorshihgli@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 03:34:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782810785266051728 X-GMAIL-MSGID: 1782810785266051728 From: Victor Shih Add __mmc_go_idle function to re-factoring mmc_go_idle function. Signed-off-by: Ulf Hansson Signed-off-by: Victor Shih --- drivers/mmc/core/mmc_ops.c | 24 ++++++++++++++++-------- drivers/mmc/core/mmc_ops.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 3b3adbddf664..5c8e62e8f331 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -144,10 +144,24 @@ int mmc_set_dsr(struct mmc_host *host) return mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); } +int __mmc_go_idle(struct mmc_host *host) +{ + struct mmc_command cmd = {}; + int err; + + cmd.opcode = MMC_GO_IDLE_STATE; + cmd.arg = 0; + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_NONE | MMC_CMD_BC; + + err = mmc_wait_for_cmd(host, &cmd, 0); + mmc_delay(1); + + return err; +} + int mmc_go_idle(struct mmc_host *host) { int err; - struct mmc_command cmd = {}; /* * Non-SPI hosts need to prevent chipselect going active during @@ -163,13 +177,7 @@ int mmc_go_idle(struct mmc_host *host) mmc_delay(1); } - cmd.opcode = MMC_GO_IDLE_STATE; - cmd.arg = 0; - cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_NONE | MMC_CMD_BC; - - err = mmc_wait_for_cmd(host, &cmd, 0); - - mmc_delay(1); + err = __mmc_go_idle(host); if (!mmc_host_is_spi(host)) { mmc_set_chip_select(host, MMC_CS_DONTCARE); diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index 92d4194c7893..3eaefe989c80 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -25,6 +25,7 @@ struct mmc_command; int mmc_select_card(struct mmc_card *card); int mmc_deselect_cards(struct mmc_host *host); int mmc_set_dsr(struct mmc_host *host); +int __mmc_go_idle(struct mmc_host *host); int mmc_go_idle(struct mmc_host *host); int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr); int mmc_set_relative_addr(struct mmc_card *card);