diff options
author | mav <mav@FreeBSD.org> | 2008-10-29 20:01:26 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-10-29 20:01:26 +0000 |
commit | 3c4dfce5ca33440183f172e2d7e72545cf2e29dc (patch) | |
tree | 10739783292b47e8ea27ad741ab455c62044c192 | |
parent | e3f7e53f3401dc6b1dd7a15341d0193749f1299c (diff) | |
download | FreeBSD-src-3c4dfce5ca33440183f172e2d7e72545cf2e29dc.zip FreeBSD-src-3c4dfce5ca33440183f172e2d7e72545cf2e29dc.tar.gz |
Allow card reader bridge driver to report maximum supported transfer size.
sdhci supports up to 65535 blocks transfers, at91_mci - one block.
Enable multiblock operations disabled before to follow at91_mci driver
limitations.
Reviewed by: imp@
-rw-r--r-- | sys/arm/at91/at91_mci.c | 4 | ||||
-rw-r--r-- | sys/dev/mmc/mmc.c | 3 | ||||
-rw-r--r-- | sys/dev/mmc/mmcbrvar.h | 2 | ||||
-rw-r--r-- | sys/dev/mmc/mmcsd.c | 9 | ||||
-rw-r--r-- | sys/dev/mmc/mmcvar.h | 2 | ||||
-rw-r--r-- | sys/dev/sdhci/sdhci.c | 4 |
6 files changed, 16 insertions, 8 deletions
diff --git a/sys/arm/at91/at91_mci.c b/sys/arm/at91/at91_mci.c index 0b3aae3..85945ad 100644 --- a/sys/arm/at91/at91_mci.c +++ b/sys/arm/at91/at91_mci.c @@ -642,6 +642,9 @@ at91_mci_read_ivar(device_t bus, device_t child, int which, u_char *result) case MMCBR_IVAR_VDD: *(int *)result = sc->host.ios.vdd; break; + case MMCBR_IVAR_MAX_DATA: + *(int *)result = 1; + break; } return (0); } @@ -682,6 +685,7 @@ at91_mci_write_ivar(device_t bus, device_t child, int which, uintptr_t value) case MMCBR_IVAR_HOST_OCR: case MMCBR_IVAR_F_MIN: case MMCBR_IVAR_F_MAX: + case MMCBR_IVAR_MAX_DATA: return (EINVAL); } return (0); diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index c6bce35..bea8c3b 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -1343,6 +1343,9 @@ mmc_read_ivar(device_t bus, device_t child, int which, u_char *result) case MMC_IVAR_ERASE_SECTOR: *(int *)result = ivar->erase_sector; break; + case MMC_IVAR_MAX_DATA: + *(int *)result = mmcbr_get_max_data(bus); + break; } return (0); } diff --git a/sys/dev/mmc/mmcbrvar.h b/sys/dev/mmc/mmcbrvar.h index 7778139..1effa14 100644 --- a/sys/dev/mmc/mmcbrvar.h +++ b/sys/dev/mmc/mmcbrvar.h @@ -72,6 +72,7 @@ enum mmcbr_device_ivars { MMCBR_IVAR_VDD, MMCBR_IVAR_CAPS, MMCBR_IVAR_TIMING, + MMCBR_IVAR_MAX_DATA, // MMCBR_IVAR_, }; @@ -94,6 +95,7 @@ MMCBR_ACCESSOR(power_mode, POWER_MODE, int) MMCBR_ACCESSOR(vdd, VDD, int) MMCBR_ACCESSOR(caps, CAPS, int) MMCBR_ACCESSOR(timing, TIMING, int) +MMCBR_ACCESSOR(max_data, MAX_DATA, int) static int __inline mmcbr_update_ios(device_t dev) diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 5e6440b..428d215 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -81,8 +81,6 @@ struct mmcsd_softc { int running; }; -#define MULTI_BLOCK_BROKEN - /* bus entry points */ static int mmcsd_probe(device_t dev); static int mmcsd_attach(device_t dev); @@ -235,12 +233,7 @@ mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp) while (block < end) { char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; - int numblocks; -#ifdef MULTI_BLOCK - numblocks = end - block; -#else - numblocks = 1; -#endif + int numblocks = min(end - block, mmc_get_max_data(dev)); memset(&req, 0, sizeof(req)); memset(&cmd, 0, sizeof(cmd)); memset(&stop, 0, sizeof(stop)); diff --git a/sys/dev/mmc/mmcvar.h b/sys/dev/mmc/mmcvar.h index 5a0e437..9126439 100644 --- a/sys/dev/mmc/mmcvar.h +++ b/sys/dev/mmc/mmcvar.h @@ -68,6 +68,7 @@ enum mmc_device_ivars { MMC_IVAR_CARD_TYPE, MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, + MMC_IVAR_MAX_DATA, // MMC_IVAR_, }; @@ -87,5 +88,6 @@ MMC_ACCESSOR(high_cap, HIGH_CAP, int) MMC_ACCESSOR(card_type, CARD_TYPE, int) MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) +MMC_ACCESSOR(max_data, MAX_DATA, int) #endif /* DEV_MMC_MMCVAR_H */ diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index e7dd9c5..dcc33b0 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -1440,6 +1440,9 @@ sdhci_read_ivar(device_t bus, device_t child, int which, u_char *result) case MMCBR_IVAR_TIMING: *(int *)result = slot->host.ios.timing; break; + case MMCBR_IVAR_MAX_DATA: + *(int *)result = 65535; + break; } return (0); } @@ -1494,6 +1497,7 @@ sdhci_write_ivar(device_t bus, device_t child, int which, uintptr_t value) case MMCBR_IVAR_HOST_OCR: case MMCBR_IVAR_F_MIN: case MMCBR_IVAR_F_MAX: + case MMCBR_IVAR_MAX_DATA: return (EINVAL); } return (0); |