mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Belisko Marek <marek.belisko@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] mci: implement multi block write
Date: Fri, 11 Nov 2011 12:47:04 +0100	[thread overview]
Message-ID: <CAAfyv359sAv-NPH8fdSGNSQG0np5JEDYxzvf1ivNQ4hWZ0YPsw@mail.gmail.com> (raw)
In-Reply-To: <1321011494-4274-2-git-send-email-s.hauer@pengutronix.de>

On Fri, Nov 11, 2011 at 12:38 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> This speeds up writes to MMC/SD cards significantly.
>
> Signed-off-by: Sascha Hauer <s.hauer@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@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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-11-11 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11 11:38 [PATCH] mci multiblock write Sascha Hauer
2011-11-11 11:38 ` [PATCH 1/2] mci: implement multi block write Sascha Hauer
2011-11-11 11:47   ` Belisko Marek [this message]
2011-11-11 11:59     ` Sascha Hauer
2011-11-11 11:38 ` [PATCH 2/2] mci: remove unnecessary loops Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAfyv359sAv-NPH8fdSGNSQG0np5JEDYxzvf1ivNQ4hWZ0YPsw@mail.gmail.com \
    --to=marek.belisko@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox