From patchwork Tue May 4 16:12:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 430883 Delivered-To: patches@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3936479jao; Tue, 4 May 2021 09:12:45 -0700 (PDT) X-Received: by 2002:a2e:b558:: with SMTP id a24mr17506355ljn.404.1620144765366; Tue, 04 May 2021 09:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620144765; cv=none; d=google.com; s=arc-20160816; b=yzMBzvKA3Z2iWPC1yvDeRPkJSDKdKeZ672DJ9UlAjnlXPrTpnKuatAavZ0/KGgIvJj oaDt3Ie0iWkYWnpIYUJQhkCAvMhiZ6fcE05ZgOR6xe4DvZuVGSZ5Uyh05quMZpmRj1AM l6qhLhemfUK+bvQXxV+bxnslfX8YJU+SL3swnW1554sl3Y7ICEnM5Dqae2cAD6SUgCth iKF15I9NS7b4TojVWnqdxIYZshZqDaGw/bKeQMTBJMV35Czcp9co1hVF51/SwlSqCjE2 qCjnfCvkUg7M8YfCkLdq0izgh8e1OGxmNc18iwX26dHwx3Lls9ZZk0Ij+7H1WCxS8Ozx UVIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TbWXoJHQ0uWHFVcBWf57QwZSLHYhmQWZi0APC0CkQ08=; b=C294CSWa28RVvUkq2VIdVFv0Nvs0yglhvcdb+hCV9hWBfT9PwV6VwjzzFsYAk9oo4J mEjFG/AW5WnOvQEUPb5TSyfbcpWSEJRblnCtMzYv/EJTsVRS5Nq/JktTyo0KmQCx4LOl p50dEqfREdQQfzn1JWf/+92L/l8MrSdZLe05avEzNtqT2cErU0wu4mab6OpTT8ACAZXD vpO/dh59nO4ElIUgjp4YrNc/tc+k/UqhRsqGRmGXMyPDDzL+6eodohAZLOnJcjq+PRss n4QWlOVO4SkxqJkhwC2K3o4sjdWYDEuxLOVkkkU80T0nlaOttXgjjRd65LqvbxYeWECR BYQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gExKlqDo; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id i21sor1918969lfo.67.2021.05.04.09.12.45 for (Google Transport Security); Tue, 04 May 2021 09:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gExKlqDo; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TbWXoJHQ0uWHFVcBWf57QwZSLHYhmQWZi0APC0CkQ08=; b=gExKlqDoKgJalaIZaU8BM2x89Hb4Dohp9KedfOXruDPXVcWDkbMIubEXRTev60u9Th HcZRM3d7e8VDENDbx9lfI6MezGAisJxM1un5F/Yi1e2NR23HxAFVr0MsR2xpmDyh/tL8 AEeIZn3rjHu66iBNPk3Dxe0fZ1LYs5keoyuEWGyNZAnb2ica6U0UeMr3NXzO35CiwVxi tsEszOaRd4F+OAR65+/pPl8pDiWdMZHW3pk+2xZOqB9Vp0l/GgNuBNWLE499L+A9Q+LJ Ku+PuQzagL5cp1qjHyUWmkt8mhIVkYt/L+FCAgIga1xTunlbn3N3Z9DAQwIJpighfA8X 567A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TbWXoJHQ0uWHFVcBWf57QwZSLHYhmQWZi0APC0CkQ08=; b=RAhrCX2qLTry2XixSE7RYTQV2vRKQhVq0z+tStkp/uDSwscoSRgdLe1Ezo20PItsCU mQooUUY1+zjNVb4BOvy/2SIXTux+I8i7sN+Jw/sx+/b561N4ZnwGwx8JA9h5LenRZCrc QJ0ECun0IaB9IPqJ9sT5dFNbFBL8bSi4OXoU+0qXMDrH5Izsnjqyj8RemO69JPo5Nd0Q caLkOP/aMGVIHEVgxjhoHwTvdtafCxbE93Aqswq/HaOZe+50Cds8/7Gk4vrGFey14yWg vtjBwVja1m5ehHxA028UZGGMezvnsXO0d2xUaraKfdH5oWhykmNvbjkYXxS6t3EBp4lB pPFQ== X-Gm-Message-State: AOAM530eJHQJU6s3liutIHbBmqwpTsbYJnLtWWyd2vc8RluoPdq+GJYp jztmFPFoFAp30VfQTrTpvvSf3pon X-Google-Smtp-Source: ABdhPJyvMw01Rzrp2T1AFFthQkcduusLKNZ1Zsiz/LYkrImYWZ59EDKdnOxO8rE7EoDsNLHKgHvDrA== X-Received: by 2002:a19:ac4a:: with SMTP id r10mr17287804lfc.112.1620144765023; Tue, 04 May 2021 09:12:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-180-197.NA.cust.bahnhof.se. [98.128.180.197]) by smtp.gmail.com with ESMTPSA id s20sm164193ljs.116.2021.05.04.09.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 09:12:44 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij , Wolfram Sang , Shawn Lin , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/11] mmc: core: Prepare mmc_send_cxd_data() to be re-used for additional cmds Date: Tue, 4 May 2021 18:12:17 +0200 Message-Id: <20210504161222.101536-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504161222.101536-1-ulf.hansson@linaro.org> References: <20210504161222.101536-1-ulf.hansson@linaro.org> MIME-Version: 1.0 The function mmc_send_cxd_data() sends a data read command of ADTC type and prepares to receive an R1 response. To make it even more re-usable, let's extend it with another in-parameter for the command argument. While at it, let's also rename the function to mmc_send_adtc_data() as it better describes its purpose. Note that, this change doesn't add any new users of the function. Instead that is done from subsequent changes. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc_ops.c | 11 +++++------ drivers/mmc/core/mmc_ops.h | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) -- 2.25.1 Reviewed-by: Linus Walleij Reviewed-by: Shawn Lin diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 653627fe02a3..b1da8f1950ee 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -252,9 +252,8 @@ mmc_send_cxd_native(struct mmc_host *host, u32 arg, u32 *cxd, int opcode) * NOTE: void *buf, caller for the buf is required to use DMA-capable * buffer or on-stack buffer (with some overhead in callee). */ -static int -mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, - u32 opcode, void *buf, unsigned len) +int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode, + u32 args, void *buf, unsigned len) { struct mmc_request mrq = {}; struct mmc_command cmd = {}; @@ -265,7 +264,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host, mrq.data = &data; cmd.opcode = opcode; - cmd.arg = 0; + cmd.arg = args; /* NOTE HACK: the MMC_RSP_SPI_R1 is always correct here, but we * rely on callers to never use this with "native" calls for reading @@ -311,7 +310,7 @@ static int mmc_spi_send_cxd(struct mmc_host *host, u32 *cxd, u32 opcode) if (!cxd_tmp) return -ENOMEM; - ret = mmc_send_cxd_data(NULL, host, opcode, cxd_tmp, 16); + ret = mmc_send_adtc_data(NULL, host, opcode, 0, cxd_tmp, 16); if (ret) goto err; @@ -359,7 +358,7 @@ int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) if (!ext_csd) return -ENOMEM; - err = mmc_send_cxd_data(card, card->host, MMC_SEND_EXT_CSD, ext_csd, + err = mmc_send_adtc_data(card, card->host, MMC_SEND_EXT_CSD, 0, ext_csd, 512); if (err) kfree(ext_csd); diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index aca66c128804..2b1d730e56bf 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -26,6 +26,8 @@ int mmc_set_dsr(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); +int mmc_send_adtc_data(struct mmc_card *card, struct mmc_host *host, u32 opcode, + u32 args, void *buf, unsigned len); int mmc_send_csd(struct mmc_card *card, u32 *csd); int __mmc_send_status(struct mmc_card *card, u32 *status, unsigned int retries); int mmc_send_status(struct mmc_card *card, u32 *status);