git: 7d8700bc291b - main - sdhci: extend bus_dma_tag boundary to 64-bit space

Marcin Wojtas mw at FreeBSD.org
Wed Jun 2 08:05:05 UTC 2021


The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d8700bc291b4b3be1a592cae539f9e682592d9d

commit 7d8700bc291b4b3be1a592cae539f9e682592d9d
Author:     Marcin Wojtas <mw at FreeBSD.org>
AuthorDate: 2021-04-28 08:55:40 +0000
Commit:     Marcin Wojtas <mw at FreeBSD.org>
CommitDate: 2021-06-02 07:55:19 +0000

    sdhci: extend bus_dma_tag boundary to 64-bit space
    
    This patch adds support for the SDHCI_CAN_DO_64BIT
    capability, so that to allow 64-bit DMA operation
    for the controllers which support this feature.
    
    Reviewed by: manu
    Obtained from: Semihalf
    Sponsored by: Marvell
    Differential Revision: https://reviews.freebsd.org/D30560
    MFC after: 2 weeks
---
 sys/dev/sdhci/sdhci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index 0441320d4b35..68a3cf9ab4d3 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -132,7 +132,7 @@ static int sdhci_cam_update_ios(struct sdhci_slot *slot);
 #endif
 
 /* helper routines */
-static int sdhci_dma_alloc(struct sdhci_slot *slot);
+static int sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps);
 static void sdhci_dma_free(struct sdhci_slot *slot);
 static void sdhci_dumpregs(struct sdhci_slot *slot);
 static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs,
@@ -717,7 +717,7 @@ sdhci_card_poll(void *arg)
 }
 
 static int
-sdhci_dma_alloc(struct sdhci_slot *slot)
+sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps)
 {
 	int err;
 
@@ -750,7 +750,8 @@ sdhci_dma_alloc(struct sdhci_slot *slot)
 	 * be aligned to the SDMA boundary.
 	 */
 	err = bus_dma_tag_create(bus_get_dma_tag(slot->bus), slot->sdma_bbufsz,
-	    0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    0, (caps & SDHCI_CAN_DO_64BIT) ? BUS_SPACE_MAXADDR :
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    slot->sdma_bbufsz, 1, slot->sdma_bbufsz, BUS_DMA_ALLOCNOW,
 	    NULL, NULL, &slot->dmatag);
 	if (err != 0) {
@@ -1032,7 +1033,7 @@ no_tuning:
 		slot->opt &= ~SDHCI_HAVE_DMA;
 
 	if (slot->opt & SDHCI_HAVE_DMA) {
-		err = sdhci_dma_alloc(slot);
+		err = sdhci_dma_alloc(slot, caps);
 		if (err != 0) {
 			if (slot->opt & SDHCI_TUNING_SUPPORTED) {
 				free(slot->tune_req, M_DEVBUF);


More information about the dev-commits-src-all mailing list