* MMC block addressing mode. @ 2017-04-13 19:49 Steven J. Hill 2017-04-20 14:18 ` Ulf Hansson 0 siblings, 1 reply; 7+ messages in thread From: Steven J. Hill @ 2017-04-13 19:49 UTC (permalink / raw) To: Ulf Hansson, linux-mmc, linux-kernel, David Daney, Jan Glauber Uffe, The Cavium hardware requires knowledge of the card addressing mode. We need to either restore mmc_card_blockaddr(), or create another way to generate the same information. You previously suggested use of the 'blksz' value, however, it has the same value regardless of the card capacity. What would you suggest? Cheers. Steve ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 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 0 siblings, 1 reply; 7+ messages in thread From: Ulf Hansson @ 2017-04-20 14:18 UTC (permalink / raw) To: Steven J. Hill; +Cc: linux-mmc, linux-kernel, David Daney, Jan Glauber On 13 April 2017 at 21:49, Steven J. Hill <Steven.Hill@cavium.com> wrote: > Uffe, > > The Cavium hardware requires knowledge of the card addressing mode. > We need to either restore mmc_card_blockaddr(), or create another > way to generate the same information. You previously suggested use > of the 'blksz' value, however, it has the same value regardless of > the card capacity. What would you suggest? Cheers. Right. Can you explain what the Cavium hardware need it for? Kind regards Uffe ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 2017-04-20 14:18 ` Ulf Hansson @ 2017-04-20 16:17 ` Steven J. Hill 2017-04-20 17:12 ` David Daney 0 siblings, 1 reply; 7+ messages in thread From: Steven J. Hill @ 2017-04-20 16:17 UTC (permalink / raw) To: Ulf Hansson; +Cc: linux-mmc, linux-kernel, David Daney, Jan Glauber On 04/20/2017 09:18 AM, Ulf Hansson wrote: >> >> The Cavium hardware requires knowledge of the card addressing mode. >> We need to either restore mmc_card_blockaddr(), or create another >> way to generate the same information. You previously suggested use >> of the 'blksz' value, however, it has the same value regardless of >> the card capacity. What would you suggest? Cheers. > > Right. Can you explain what the Cavium hardware need it for? > Uffe, In Cavium's MMC controller, the DMA engine requires software to specify the addressing mode of the card. For DMA write operations, the CARD_ADDR field in the MIO_EMM_DMA register is programmed with a byte address if the media card <= 2GB. If the card is > 2GB, the address is interpreted as a 512 byte sector address. The SECTOR bit tells the controller how to interpret the address in CARD_ADDR. If set to 1, use 512 byte sector addressing, otherwise it is set to 0 and byte addressing is used. Steve ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 2017-04-20 16:17 ` Steven J. Hill @ 2017-04-20 17:12 ` David Daney 2017-04-20 21:24 ` Steven J. Hill 0 siblings, 1 reply; 7+ messages in thread From: David Daney @ 2017-04-20 17:12 UTC (permalink / raw) To: Steven J. Hill, Ulf Hansson, Jan Glauber Cc: linux-mmc, linux-kernel, David Daney On 04/20/2017 09:17 AM, Steven J. Hill wrote: > On 04/20/2017 09:18 AM, Ulf Hansson wrote: >>> >>> The Cavium hardware requires knowledge of the card addressing mode. >>> We need to either restore mmc_card_blockaddr(), or create another >>> way to generate the same information. You previously suggested use >>> of the 'blksz' value, however, it has the same value regardless of >>> the card capacity. What would you suggest? Cheers. >> >> Right. Can you explain what the Cavium hardware need it for? >> > Uffe, > > In Cavium's MMC controller, the DMA engine requires software to > specify the addressing mode of the card. For DMA write operations, > the CARD_ADDR field in the MIO_EMM_DMA register is programmed with > a byte address if the media card <= 2GB. If the card is > 2GB, the > address is interpreted as a 512 byte sector address. The SECTOR bit > tells the controller how to interpret the address in CARD_ADDR. If > set to 1, use 512 byte sector addressing, otherwise it is set to 0 > and byte addressing is used. > ... In other words: The Cavium MMC controller doesn't directly send the commands supplied by the MMC core to the target device. The driver analyzes the intent of the commands, and then programs the MMC bus interface unit to synthesize an equivalent, but perhaps different, set of commands to the target device. As part of this synthesis, hardware needs to be told if sector or byte addressing is used by the target device. 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 2017-04-20 17:12 ` David Daney @ 2017-04-20 21:24 ` Steven J. Hill 2017-04-20 21:28 ` Steven J. Hill 0 siblings, 1 reply; 7+ messages in thread From: Steven J. Hill @ 2017-04-20 21:24 UTC (permalink / raw) To: David Daney, Ulf Hansson, Jan Glauber; +Cc: linux-mmc, linux-kernel 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. mmc0: host does not support reading read-only switch, assuming write-enable mmc0: new high speed SD card at address d15e mmcblk0: mmc0:d15e SD02G 1.88 GiB mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout blk_update_request: I/O error, dev mmcblk0, sector 0 Buffer I/O error on dev mmcblk0, logical block 0, async page read mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x400900 mmcblk0: command error, retrying timeout mmcblk0: timed out sending r/w cmd command, card status 0x40090 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 2017-04-20 21:24 ` Steven J. Hill @ 2017-04-20 21:28 ` Steven J. Hill 2017-04-21 8:23 ` Ulf Hansson 0 siblings, 1 reply; 7+ messages in thread From: Steven J. Hill @ 2017-04-20 21:28 UTC (permalink / raw) To: David Daney, Ulf Hansson, Jan Glauber; +Cc: linux-mmc, linux-kernel 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: MMC block addressing mode. 2017-04-20 21:28 ` Steven J. Hill @ 2017-04-21 8:23 ` Ulf Hansson 0 siblings, 0 replies; 7+ messages in thread From: Ulf Hansson @ 2017-04-21 8:23 UTC (permalink / raw) To: Steven J. Hill; +Cc: David Daney, Jan Glauber, linux-mmc, linux-kernel 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-04-21 8:24 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).