aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Wojtas <mw@FreeBSD.org>2021-04-28 08:55:40 +0000
committerMarcin Wojtas <mw@FreeBSD.org>2021-06-02 07:55:19 +0000
commit7d8700bc291b4b3be1a592cae539f9e682592d9d (patch)
tree2d02ca1c5125c0c7194f4ac3f85201e71ca45de3
parent9cf66a0458f4913d34cb3c5f6b653c78f70de8a8 (diff)
downloadsrc-7d8700bc291b4b3be1a592cae539f9e682592d9d.tar.gz
src-7d8700bc291b4b3be1a592cae539f9e682592d9d.zip
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
-rw-r--r--sys/dev/sdhci/sdhci.c9
1 files 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);