public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 1/4] mmc: API for accessing host supported maximum segment count and size
@ 2017-12-19 12:06 Xinming Hu
  2017-12-19 12:06 ` [PATCH v6 2/4] ath6kl: change to use mmc api " Xinming Hu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xinming Hu @ 2017-12-19 12:06 UTC (permalink / raw)
  To: Linux MMC
  Cc: Ulf Hansson, Kalle Valo, Arend van Spriel, Franky Lin,
	Hante Meuleman, Chi-Hsien Lin, Wright Feng, Zhiyuan Yang,
	Tim Song, Cathy Luo, James Cao, Ganapathi Bhat, Xu Wang, Bob Tan,
	Xinming Hu, Amitkumar Karwar

sdio device drivers need be able to get the host supported max_segs
and max_seg_size, so that they know the buffer size to allocate while
utilizing the scatter/gather DMA buffer list.

This patch provides API for this purpose.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
v2: v2 was submitted with minor improvement like replacing BUG_ON() with WARN_ON()
v3: Addressed below review comments from Ulf Hansson
    a) In v3, patch has been split into two separate patches.
    b) Patch 1/2 introduces an API to fetch max_seg_size and max_segs
    c) Replaced WARN_ON() with proper error code when sg_ptr->length is invalid
    d) Instead of duplicating the code in mmc_io_rw_extended(), extra bool parameter
       has been added to this function and used it in new APIs for SG.
v4: Removed WARN_ON() calls in newly added APIs. It's gets called in probe handler.
    Caller already takes care of it(Shawn Lin).
v5: Rebased on latest code base.
v6: Split driver caller to separate patch.
---
 drivers/mmc/core/sdio_io.c    | 21 +++++++++++++++++++++
 include/linux/mmc/sdio_func.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index d40744b..4806521 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -725,3 +725,24 @@ int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(sdio_set_host_pm_flags);
+
+/**
+ *	sdio_get_host_max_seg_size - get host maximum segment size
+ *	@func: SDIO function attached to host
+ */
+unsigned int sdio_get_host_max_seg_size(struct sdio_func *func)
+{
+	return func->card->host->max_seg_size;
+}
+EXPORT_SYMBOL_GPL(sdio_get_host_max_seg_size);
+
+/**
+ *	sdio_get_host_max_seg_count - get host maximum segment count
+ *	@func: SDIO function attached to host
+ */
+unsigned short sdio_get_host_max_seg_count(struct sdio_func *func)
+{
+	return func->card->host->max_segs;
+}
+EXPORT_SYMBOL_GPL(sdio_get_host_max_seg_count);
+
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 97ca105..72d4de4 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -159,4 +159,7 @@ extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
 extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
 extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
 
+unsigned short sdio_get_host_max_seg_count(struct sdio_func *func);
+unsigned int sdio_get_host_max_seg_size(struct sdio_func *func);
+
 #endif /* LINUX_MMC_SDIO_FUNC_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-20 15:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-19 12:06 [PATCH v6 1/4] mmc: API for accessing host supported maximum segment count and size Xinming Hu
2017-12-19 12:06 ` [PATCH v6 2/4] ath6kl: change to use mmc api " Xinming Hu
2017-12-20 15:40   ` Kalle Valo
2017-12-19 12:06 ` [PATCH v6 3/4] brcmfmac: " Xinming Hu
2017-12-19 12:06 ` [PATCH v6 4/4] mmc: sdio support external scatter gather list Xinming Hu
2017-12-19 12:39   ` Ulf Hansson
2017-12-20 12:59     ` [EXT] " Xinming Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox