[PATCH 1/2] mci: implement multi block write

Belisko Marek marek.belisko at gmail.com
Fri Nov 11 06:47:04 EST 2011


On Fri, Nov 11, 2011 at 12:38 PM, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> This speeds up writes to MMC/SD cards significantly.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  drivers/mci/mci-core.c |   30 ++++++++++++++++++++++++++----
>  1 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 09f7e29..58f7f6d 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -107,12 +107,20 @@ static void *sector_buf;
>  * @return Transaction status (0 on success)
>  */
>  #ifdef CONFIG_MCI_WRITE
> -static int mci_block_write(struct device_d *mci_dev, const void *src, unsigned blocknum)
> +static int mci_block_write(struct device_d *mci_dev, const void *src, unsigned blocknum,
> +       int blocks)
>  {
>        struct mci *mci = GET_MCI_DATA(mci_dev);
>        struct mci_cmd cmd;
>        struct mci_data data;
>        const void *buf;
> +       unsigned mmccmd;
> +       int ret;
> +
> +       if (blocks > 1)
> +               mmccmd = MMC_CMD_WRITE_MULTIPLE_BLOCK;
> +       else
> +               mmccmd = MMC_CMD_WRITE_SINGLE_BLOCK;
>
>        if ((unsigned long)src & 0x3) {
>                memcpy(sector_buf, src, 512);
> @@ -122,16 +130,30 @@ static int mci_block_write(struct device_d *mci_dev, const void *src, unsigned b
>        }
>
>        mci_setup_cmd(&cmd,
> -               MMC_CMD_WRITE_SINGLE_BLOCK,
> +               mmccmd,
>                mci->high_capacity != 0 ? blocknum : blocknum * mci->write_bl_len,
>                MMC_RSP_R1);
>
>        data.src = buf;
> -       data.blocks = 1;
> +       data.blocks = blocks;
>        data.blocksize = mci->write_bl_len;
>        data.flags = MMC_DATA_WRITE;
>
> -       return mci_send_cmd(mci_dev, &cmd, &data);
> +       ret = mci_send_cmd(mci_dev, &cmd, &data);
> +       if (ret)
> +               return ret;
> +
> +
Necessary 2 new lines here?
> +       if (blocks > 1) {
> +               mci_setup_cmd(&cmd,
> +                       MMC_CMD_STOP_TRANSMISSION,
> +                       0, MMC_RSP_R1b);
> +                       ret = mci_send_cmd(mci_dev, &cmd, NULL);
> +                       if (ret)
> +                               return ret;
> +        }
> +
> +       return ret;
>  }
>  #endif
>
> --
> 1.7.7.1
>
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>

regards,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com



More information about the barebox mailing list