diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2007-06-02 01:48:38 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2007-06-02 01:48:38 +0000 |
commit | 838355924f1f6369b4bf68f468dbb5be8b615c7e (patch) | |
tree | 29f73ebcf7bf66ac2fdcaa4ccb41cd9c7e494b7a /sys/dev/sdmmc | |
parent | 24b46a2543b6f860fc22ca3db118ff9234f0c662 (diff) |
split up large CMD53 reads and writes
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r-- | sys/dev/sdmmc/sdmmc_io.c | 24 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmc_ioreg.h | 3 |
2 files changed, 25 insertions, 2 deletions
diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c index ce39c98ce78..07d0cea898f 100644 --- a/sys/dev/sdmmc/sdmmc_io.c +++ b/sys/dev/sdmmc/sdmmc_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_io.c,v 1.8 2007/05/31 10:09:01 uwe Exp $ */ +/* $OpenBSD: sdmmc_io.c,v 1.9 2007/06/02 01:48:37 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -470,6 +470,17 @@ int sdmmc_io_read_multi_1(struct sdmmc_function *sf, int reg, u_char *data, int datalen) { + int error; + + while (datalen > SD_ARG_CMD53_LENGTH_MAX) { + error = sdmmc_io_rw_extended(sf->sc, sf, reg, data, + SD_ARG_CMD53_LENGTH_MAX, SD_ARG_CMD53_READ); + if (error) + return error; + data += SD_ARG_CMD53_LENGTH_MAX; + datalen -= SD_ARG_CMD53_LENGTH_MAX; + } + return sdmmc_io_rw_extended(sf->sc, sf, reg, data, datalen, SD_ARG_CMD53_READ); } @@ -478,6 +489,17 @@ int sdmmc_io_write_multi_1(struct sdmmc_function *sf, int reg, u_char *data, int datalen) { + int error; + + while (datalen > SD_ARG_CMD53_LENGTH_MAX) { + error = sdmmc_io_rw_extended(sf->sc, sf, reg, data, + SD_ARG_CMD53_LENGTH_MAX, SD_ARG_CMD53_WRITE); + if (error) + return error; + data += SD_ARG_CMD53_LENGTH_MAX; + datalen -= SD_ARG_CMD53_LENGTH_MAX; + } + return sdmmc_io_rw_extended(sf->sc, sf, reg, data, datalen, SD_ARG_CMD53_WRITE); } diff --git a/sys/dev/sdmmc/sdmmc_ioreg.h b/sys/dev/sdmmc/sdmmc_ioreg.h index 689d0596c6e..dad5bea00a5 100644 --- a/sys/dev/sdmmc/sdmmc_ioreg.h +++ b/sys/dev/sdmmc/sdmmc_ioreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_ioreg.h,v 1.3 2007/05/31 10:09:01 uwe Exp $ */ +/* $OpenBSD: sdmmc_ioreg.h,v 1.4 2007/06/02 01:48:37 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -47,6 +47,7 @@ #define SD_ARG_CMD53_REG_MASK 0x1ffff #define SD_ARG_CMD53_LENGTH_SHIFT 0 #define SD_ARG_CMD53_LENGTH_MASK 0x1ff +#define SD_ARG_CMD53_LENGTH_MAX 64 /* XXX should be 511? */ /* 48-bit response decoding (32 bits w/o CRC) */ #define MMC_R4(resp) ((resp)[0]) |