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@
This commit is contained in:
Alexander Motin 2008-10-29 20:01:26 +00:00
parent 0df76605cf
commit 3a4a255741
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184452
6 changed files with 16 additions and 8 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -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)

View file

@ -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));

View file

@ -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 */

View file

@ -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);