MMC: S3C24XX: Refuse incorrectly aligned transfers
authorBen Dooks <ben-linux@fluff.org>
Mon, 30 Jun 2008 21:40:39 +0000 (22:40 +0100)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 15 Jul 2008 12:14:48 +0000 (14:14 +0200)
The hardware does not support any multi-block transfers
with an block-size that is not 32bit aligned. Also the driver
itself does not support single block non-32bit transfers
either.

Ensure that the s3cmci_setup_data() returns the appropriate
error if we encounter this.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/host/s3cmci.c

index 2b483953697584341e6e04b6fa8978052ec7b66b..6a1e4994b72465ee32314e10b8c3a1eae7927d51 100644 (file)
@@ -807,6 +807,17 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data)
                return 0;
        }
 
+       if ((data->blksz & 3) != 0) {
+               /* We cannot deal with unaligned blocks with more than
+                * one block being transfered. */
+
+               if (data->blocks > 1)
+                       return -EINVAL;
+
+               /* No support yet for non-word block transfers. */
+               return -EINVAL;
+       }
+
        while (readl(host->base + S3C2410_SDIDSTA) &
               (S3C2410_SDIDSTA_TXDATAON | S3C2410_SDIDSTA_RXDATAON)) {