All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Steven J. Hill" <Steven.Hill@cavium.com>
Cc: David Daney <ddaney@caviumnetworks.com>,
	Jan Glauber <jan.glauber@caviumnetworks.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: MMC block addressing mode.
Date: Fri, 21 Apr 2017 10:23:45 +0200	[thread overview]
Message-ID: <CAPDyKFpiS8mk6q3MYZ-=b9gkan5x+rRUaa+6FUWcxog5wqemjA@mail.gmail.com> (raw)
In-Reply-To: <fdc1864b-9d5a-25ad-5d15-dc094f1c0886@cavium.com>

On 20 April 2017 at 23:28, Steven J. Hill <Steven.Hill@cavium.com> wrote:
> On 04/20/2017 04:24 PM, Steven J. Hill wrote:
>> On 04/20/2017 12:12 PM, David Daney wrote:
>>>
>>> Steven and Jan:  Can we get around this requirement by:
>>>
>>> - Always set MIO_EMM_DMA[MULTI] = 1;  This way by SECTOR mode may be unimportant.
>>>
>>> - Always set MIO_EMM_DMA[SECTOR] = SUITABLE_CONSTANT.
>>>
>> No, this does not work. The 1.88GB card plugged into my 78xx
>> board gives the output below. We cannot just blindly set the
>> MULTI bit for all cards. These results are identical for all
>> four combinations of SECTOR and MULTI values hardcoded.
>>
> ...for 3 of the 4 combinations. Obviously the correct one works.

I get it, thanks for the clarifications!

I have cooked a patch below, providing you with the API I think you
need. If it works, please fold in the patch in the series when you
post you updated Cavium driver(s).

Kind regards
Uffe

From: Ulf Hansson <ulf.hansson@linaro.org>
Date: Fri, 21 Apr 2017 08:31:15 +0200
Subject: [PATCH] mmc: core: Export API to allow hosts to get the card address
 mode

Some hosts controllers, like Cavium, needs to know whether the card
operates in byte- or block-address mode. Therefore export a new API,
mmc_card_is_blockaddr(), which provides this information.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c  | 6 ++++++
 include/linux/mmc/card.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 0bb3979..f053ef5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2558,6 +2558,12 @@ unsigned int mmc_calc_max_discard(struct mmc_card *card)
 }
 EXPORT_SYMBOL(mmc_calc_max_discard);

+bool mmc_card_is_blockaddr(struct mmc_card *card)
+{
+       return card ? mmc_card_blockaddr(card) : false;
+}
+EXPORT_SYMBOL(mmc_card_is_blockaddr);
+
 int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
 {
        struct mmc_command cmd = {};
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 85b5f2b..aad015e 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -315,6 +315,8 @@ static inline bool mmc_large_sector(struct mmc_card *card)
        return card->ext_csd.data_sector_size == 4096;
 }

+bool mmc_card_is_blockaddr(struct mmc_card *card);
+
 #define mmc_card_mmc(c)                ((c)->type == MMC_TYPE_MMC)
 #define mmc_card_sd(c)         ((c)->type == MMC_TYPE_SD)
 #define mmc_card_sdio(c)       ((c)->type == MMC_TYPE_SDIO)
-- 
2.7.4

      reply	other threads:[~2017-04-21  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13 19:49 MMC block addressing mode Steven J. Hill
2017-04-20 14:18 ` Ulf Hansson
2017-04-20 16:17   ` Steven J. Hill
2017-04-20 17:12     ` David Daney
2017-04-20 21:24       ` Steven J. Hill
2017-04-20 21:28         ` Steven J. Hill
2017-04-21  8:23           ` Ulf Hansson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPDyKFpiS8mk6q3MYZ-=b9gkan5x+rRUaa+6FUWcxog5wqemjA@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=Steven.Hill@cavium.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=jan.glauber@caviumnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.