From owner-freebsd-mips@FreeBSD.ORG Wed Apr 3 15:14:26 2013 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6E5032D6 for ; Wed, 3 Apr 2013 15:14:26 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-bk0-x233.google.com (mail-bk0-x233.google.com [IPv6:2a00:1450:4008:c01::233]) by mx1.freebsd.org (Postfix) with ESMTP id 05E9884E for ; Wed, 3 Apr 2013 15:14:25 +0000 (UTC) Received: by mail-bk0-f51.google.com with SMTP id y8so893964bkt.24 for ; Wed, 03 Apr 2013 08:14:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=es2TncNIhDRnkd6+WlrpIGNijyNEnnrQsdPXZR7tTXE=; b=jYfAfpnxTGYQTE+sKfBIL/4r+IlyfbGsm9CdcQs5BJaVjodGwqUcgfRo031E9fCeEQ SF9TMr343vEb+7QdI8mOKLN9v2MCw3x7n0ysK33vCINhWnkDjqPVStbXsfYViYU+0XKt Z2iya6gFFDzaQGh2QfWs3XIyXfdp15YSJgxVffVUjFyr0tUroyxXUL+axhVuy+E/dWvo M9F75RQ4+pzJTda6PCxl2SPANoZQdJKvrttpPJF6TqrMGtM2rKxHD30T3nsxzeizqIMy BrYpHfIrmv3F+8MpZu9rX3nHBywIfnUKnowR4p1KDeYjmnbHaDLyLJdWP6tKQMH8BODP j0nQ== MIME-Version: 1.0 X-Received: by 10.205.114.11 with SMTP id ey11mr1550871bkc.104.1365002065001; Wed, 03 Apr 2013 08:14:25 -0700 (PDT) Sender: pkelsey@gmail.com Received: by 10.204.128.213 with HTTP; Wed, 3 Apr 2013 08:14:24 -0700 (PDT) In-Reply-To: References: Date: Wed, 3 Apr 2013 11:14:24 -0400 X-Google-Sender-Auth: gRGIYrK3H_EXgKv5yum-9Z9RIAI Message-ID: Subject: Re: [PATCH] MMC/SD SPI-mode driver From: Patrick Kelsey To: Dmytro 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: Wed, 03 Apr 2013 15:14:26 -0000 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