Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2013 11:14:24 -0400
From:      Patrick Kelsey <kelsey@ieee.org>
To:        Dmytro <dioptimizer@gmail.com>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: [PATCH] MMC/SD SPI-mode driver
Message-ID:  <CAD44qMWpz-sjNKwRH6K=xicFXYutfk7R%2BN%2B%2Bo7cbgTg7rcQbkA@mail.gmail.com>
In-Reply-To: <CAK1zEjs=hC%2BpAYBgGq4t7%2BA_JPLaH6rhvEjD%2B1RNk1Ziu8E-4g@mail.gmail.com>
References:  <CAK1zEjs=hC%2BpAYBgGq4t7%2BA_JPLaH6rhvEjD%2B1RNk1Ziu8E-4g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 3, 2013 at 10:14 AM, Dmytro <dioptimizer@gmail.com> wrote:
> Hi Patrick.
 Hi Dmytro

> What is the average speed (in kb) read/write via SPI in a SD memory card?

It depends on the card, it depends on the system the card is installed
in, and it depends on the IO pattern.  I developed the driver on a
RouterBoard RB450G, and on that hardware the SPI bus speed tops out in
the neighborhood of 7 - 8 MHz, whereas many cards should be able to
handle SPI up to 25MHz, and possibly 50 MHz.  At the rather limited
SPI bus speed of the RB450G, and under the most favorable access
pattern (sequential 64k I/O using multi-block commands), the
min/avg/max performance for the set of 31 cards I tested with was
682/694/698 KiB/s for read and 294/620/683 KiB/s for write.  Assuming
bus speed is the only limitation, extrapolating that to a 50 MHz SPI
bus would improve those numbers about 6x.

> How much load the CPU during the procedure read/write?

On the RB450G, the SPI bus is bit-banged and polled, so CPU use is
high when reading and writing.  On other hardware with a more capable
SPI controller, I would expect CPU usage could be lower.

> Your patch affects the the above points in the direction of improvement?

The patch gives FreeBSD the ability to communicate with SD cards in
SPI mode, which it does not otherwise have.  This is useful for
systems in which the SD card slot is only connected to an SPI bus.  If
you want the best performance when accessing an SD card, you want
hardware that runs a full SD-bus to the card, not an SPI one.

-Patrick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMWpz-sjNKwRH6K=xicFXYutfk7R%2BN%2B%2Bo7cbgTg7rcQbkA>