From 3c4dfce5ca33440183f172e2d7e72545cf2e29dc Mon Sep 17 00:00:00 2001 From: mav Date: Wed, 29 Oct 2008 20:01:26 +0000 Subject: 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@ --- sys/dev/mmc/mmc.c | 3 +++ sys/dev/mmc/mmcbrvar.h | 2 ++ sys/dev/mmc/mmcsd.c | 9 +-------- sys/dev/mmc/mmcvar.h | 2 ++ 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sys/dev/mmc') 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 */ -- cgit v1.1