From patchwork Wed Apr 21 10:31:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 425285 Delivered-To: patches@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp203481jao; Wed, 21 Apr 2021 03:32:09 -0700 (PDT) X-Received: by 2002:a05:6512:3e09:: with SMTP id i9mr5009574lfv.243.1619001129679; Wed, 21 Apr 2021 03:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619001129; cv=none; d=google.com; s=arc-20160816; b=mJEUt+sU4ANMlzk5jTExvtx1a/G13hKzQ6iXS4p8SzRxyxnT584AeoXQMpif6XMuIK fOUPEYOpr8/t7XUaLv/J/Xv4lOeEVnUKQ6SRpP+vIxAFrg5eHcZR+B3rbBerFcjk9c2u cOCgQoufGNsq63G23Qtm3OOUfidcX//0sJDcp7MGPZBB7Hr6/vXuXfwVetxXqc0CK2MJ 9VOrLhzp9C4HlRkjysytvLo22IEuvF78hGzObV/jaoJj9wLYtys2UlpxH3wT9MhisMUX uehtcW1L2P4OyfohdewrdR2dqrDIUHaJcqE3yv0PKzm9xRyZfq6J36NSTMz9pyEwuC85 6kng== 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=3W0ReYXRDLZ9Zk92wTxQ+mDg4oUgh0CQC6EcZq5vXt8=; b=iMMALNdECdoPYDClB7DYKSIyBwtZNpO/UJx9T5hySTY0538XLKPLtW/3x8BOZjI0Yv xnaC51ttqq9WkJKeHrPKZrGoyZSb38+oXZ2r05Nbds1s+mtuN4k6lsYPDOK0F1VYs1C6 /ERhBvH0S2ebes80Bhzkd6RT5poYHY250NCWQw67wVwRQ+rPt2jpuoIdDktQ67vvOPCL C1KPoKAJ7Sb1qJvc8dKsa2665ZqeDe1m7JrM2dZ5/LPlnIWC94MhuwY83Pv1BZKmp5sP dQR9uK/9PjkefoxbrOOJM08ZSXNIhuSq9kIfkSIEi3bTCxxnmBHf3jOMJnqOsAcVwPbo zu+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GhiCkljr; 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 x23sor392567lfu.30.2021.04.21.03.32.09 for (Google Transport Security); Wed, 21 Apr 2021 03:32:09 -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=GhiCkljr; 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=3W0ReYXRDLZ9Zk92wTxQ+mDg4oUgh0CQC6EcZq5vXt8=; b=GhiCkljrdNvqz8QU4hX9Tvnr6q+NsiDe277dOmS8cRYIm9XTToYEn/exylT2vI4HH8 Za7AV2XxPytEAmwzvjr7ZyDSom3b6sxdkds7uiS30xeBbmF1+g47zPMDbeJPFLk0y5xf HkeETLlOTg140sM+6GzQKfTBjuGTyF1Xd9uJ2S4TXKyG+Z3be5Xb9nh4Kt7GQT6C7G/0 0d+EK4IMoctJ6f/fN0aJTtoDrl875CeUsHv2qzKnzFR+GOHM8tB/bACK+l/9V9qAsCtZ gxH9W93t96yVTYi1kW4sHrgCdUmdF76PtXEB8V3OxBrkvcKwOwGSuZS1dp7IhwOFx48J fEAA== 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=3W0ReYXRDLZ9Zk92wTxQ+mDg4oUgh0CQC6EcZq5vXt8=; b=ExeMcx9abHrKhbwXXIUist53ydQCQhtPzzT3B5bqxpfuA4W/KzBAzeVoHyEpj3D/K3 7YpEWJbCz5qemb9DjZuk4jFxmwx7QoNkYX1eSwRe2nidFQ2WS7s7zgGib25ichrHTfU9 dXVRILSS78+snQd8Ni9KjQ5iTB5nIHEG27cRsbbH3KBh9JDIFvXreLdSTyMKS10cGNIz yZ3SWFd3c5dF2X+zVjppV7YFkPrigfOgUOPAgvi7tqv3ynwq/TfrHdCu6EJ7CqDN5KUt sI5WxNNJo3mMEmorq4PtKmRfx6IHtDecRVHdty8Pa38SUkiEJ4BkWNCBP51sHkHXm3cP mOiQ== X-Gm-Message-State: AOAM532s/jQzr8gHwbuZh4NkFP1FEiggz8N+dolDxRv9MBoJciaWTbDM SEizrmMUlZXMnTGIFCn3HEPiyDRV X-Google-Smtp-Source: ABdhPJxFQ8YxIK3vd8BtH0GSoGH0VjymzL2Lks/uZpkaUbebB0LOmNrGQQvoVoVZIOUEfTpknokAOw== X-Received: by 2002:a05:6512:b8f:: with SMTP id b15mr20669206lfv.633.1619001129306; Wed, 21 Apr 2021 03:32:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-234.NA.cust.bahnhof.se. [155.4.129.234]) by smtp.gmail.com with ESMTPSA id u13sm170603lfg.139.2021.04.21.03.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 03:32:08 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Shawn Lin , Avri Altman , Masami Hiramatsu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mmc: core: Prepare mmc_send_cxd_data() to be used for CMD48 for SD cards Date: Wed, 21 Apr 2021 12:31:52 +0200 Message-Id: <20210421103154.169410-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210421103154.169410-1-ulf.hansson@linaro.org> References: <20210421103154.169410-1-ulf.hansson@linaro.org> MIME-Version: 1.0 The CMD48 is used to read the SD function extension registers, which is an ADTC type of command with an R1 response. It's very similar to the commands that are currently being managed via mmc_send_cxd_data(). Therefore, let's adapt mmc_send_cxd_data() so it can manage CMD48 as well. While at it, let's also rename the function to mmc_send_adtc_data() as it better describes its purpose. 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 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index aa6a85783723..148fdc528382 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -245,9 +245,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 = {}; @@ -258,7 +257,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 @@ -304,7 +303,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; @@ -352,7 +351,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 5782fdf4e8e9..55b8ad1d004c 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -25,6 +25,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);