From owner-freebsd-mips@FreeBSD.ORG Fri Apr 5 03:11:50 2013 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0362374F for ; Fri, 5 Apr 2013 03:11:50 +0000 (UTC) (envelope-from dioptimizer@gmail.com) Received: from mail-ia0-x236.google.com (mail-ia0-x236.google.com [IPv6:2607:f8b0:4001:c02::236]) by mx1.freebsd.org (Postfix) with ESMTP id CFD5CD73 for ; Fri, 5 Apr 2013 03:11:49 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id u8so2827610iag.13 for ; Thu, 04 Apr 2013 20:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=3wboDHXsmIMzGnOLUkzZ3SHSNiBLNhkIZ3co4aYDMGU=; b=yilZi1iMWCzNWNe3y7b2nzFxyGdVrBYVIRxEntbpcYsGClcCicdcqnPXTIcj8ynRvX 9RXMgNs5PhvABA0jAf0rzV1JPchZ5bs3sqT1shFOI02yP1JurRRCOGvSUmvzZjUt0AoO 4DpLZnEs+n+EY138B6wFTzSNkyBIOuQCrzR4wUE7UlLhUbuquf0zh/MRtmODViV/rVmQ wVh1SXbUXMjNQBsLk2L97aD6zd0YjP5OcIYzTRUTAJRpxesIuRmWymhLSK5U+iLkxiQu 8Ro6avec20PZNqDSd4CQIYNX34BSLoMCCzDYKGHoDJzo7e07Kk3Xvy4tHM1v1hI38Jq0 p8Rg== MIME-Version: 1.0 X-Received: by 10.50.13.39 with SMTP id e7mr453514igc.97.1365131509524; Thu, 04 Apr 2013 20:11:49 -0700 (PDT) Received: by 10.64.76.134 with HTTP; Thu, 4 Apr 2013 20:11:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Apr 2013 06:11:49 +0300 Message-ID: Subject: Re: [PATCH] MMC/SD SPI-mode driver From: Dmytro To: Patrick Kelsey Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-mips@freebsd.org X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2013 03:11:50 -0000 Thank you Patrick for the detailed answers. Given the platform processors Atheros, it is safe to say that all line ath79 (AR71XX/AR724X/AR913X SoCs) - SPI generic and has not changed even in the new generations of this CPUs. Working in OpenWRT, I can say that reading speed/CPU load is about the same as yours - slow. But I did not quite understand how to implemented the function of fast reading for NOR flash memory in driver (m25p80.c). Reading speed of NOR flash-memory about 3 MB/Without a full load CPU. I understand that it is sent to a specific command/register for a fast read is also SPI uses the buffer of NOR chip . However, at what level SPI controller is programmed for increasing speed - is not clear. http://dioptimizer.narod.ru/files/spi-ath79.c - Regards, Dmytro 2013/4/3, Patrick Kelsey : > On Wed, Apr 3, 2013 at 10:14 AM, Dmytro 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 >