[PATCH 10/13] mci: align data for commands

Juergen Beisert jbe at pengutronix.de
Fri Oct 22 09:41:49 EDT 2010


Sascha Hauer wrote:
> Some mci controllers cannot transfer data with their DMA engines
> if the data is not sufficiently aligned. Normally this is a driver
> problem, but hey, we have no problem aligning the data and keep
> the burden from the drivers.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> Cc: Juergen Beisert <jbe at pengutronix.de>

Acked-by: Juergen Beisert <jbe at pengutronix.de>

> ---
>  drivers/mci/mci-core.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 34c4f8c..6f31cca 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -347,7 +347,7 @@ static int mci_switch(struct device_d *mci_dev,
> unsigned set, unsigned index, static int mmc_change_freq(struct device_d
> *mci_dev)
>  {
>  	struct mci *mci = GET_MCI_DATA(mci_dev);
> -	char ext_csd[512];
> +	char *ext_csd = sector_buf;
>  	char cardtype;
>  	int err;
>
> @@ -439,8 +439,8 @@ static int sd_change_freq(struct device_d *mci_dev)
>  	struct mci *mci = GET_MCI_DATA(mci_dev);
>  	struct mci_cmd cmd;
>  	struct mci_data data;
> -	uint32_t switch_status[16];
> -	uint scr[2];
> +	uint32_t *switch_status = sector_buf;
> +	uint32_t *scr = sector_buf;
>  	int timeout;
>  	int err;
>
> @@ -461,7 +461,7 @@ static int sd_change_freq(struct device_d *mci_dev)
>
>  retry_scr:
>  	pr_debug("Trying to read the SCR (try %d of %d)\n", 4 - timeout, 3);
> -	data.dest = (char *)&scr;
> +	data.dest = (char *)scr;
>  	data.blocksize = 8;
>  	data.blocks = 1;
>  	data.flags = MMC_DATA_READ;
> @@ -502,7 +502,7 @@ retry_scr:
>  	timeout = 4;
>  	while (timeout--) {
>  		err = sd_switch(mci_dev, SD_SWITCH_CHECK, 0, 1,
> -				(uint8_t*)&switch_status);
> +				(uint8_t*)switch_status);
>  		if (err) {
>  			pr_debug("Checking SD transfer switch frequency feature failed: %d\n",
> err); return err;
> @@ -520,7 +520,7 @@ retry_scr:
>  	if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
>  		return 0;
>
> -	err = sd_switch(mci_dev, SD_SWITCH_SWITCH, 0, 1,
> (uint8_t*)&switch_status); +	err = sd_switch(mci_dev, SD_SWITCH_SWITCH, 0,
> 1, (uint8_t*)switch_status); if (err) {
>  		pr_debug("Switching SD transfer frequency failed: %d\n", err);
>  		return err;



-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |



More information about the barebox mailing list