From owner-svn-src-head@FreeBSD.ORG Tue Aug 28 14:19:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2133E106566C; Tue, 28 Aug 2012 14:19:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BF4E8FC0A; Tue, 28 Aug 2012 14:19:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7SEJAOD080322; Tue, 28 Aug 2012 14:19:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SEJAc6080320; Tue, 28 Aug 2012 14:19:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208281419.q7SEJAc6080320@svn.freebsd.org> From: Warner Losh Date: Tue, 28 Aug 2012 14:19:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239780 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 14:19:11 -0000 Author: imp Date: Tue Aug 28 14:19:10 2012 New Revision: 239780 URL: http://svn.freebsd.org/changeset/base/239780 Log: Clip the upper end to 31MHz for slow clock speeds. On faster machines, we wind up with a 66MHz clock, which is too fast. Modified: head/sys/arm/at91/at91_mci.c Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Tue Aug 28 13:35:37 2012 (r239779) +++ head/sys/arm/at91/at91_mci.c Tue Aug 28 14:19:10 2012 (r239780) @@ -557,10 +557,10 @@ at91_mci_update_ios(device_t brdev, devi * Calculate our closest available clock speed that doesn't exceed the * requested speed. * - * If the master clock is greater than 50MHz and the requested bus - * speed is 25mhz and the use_30mhz flag is on, set clkdiv to zero to - * get a master_clock / 2 (25-30MHz) MMC/SD clock rather than settle for - * the next lower click (12-15MHz). See comments near the top of the + * If the master clock is 50MHz-62MHz and the requested bus speed is + * 25mhz and the use_30mhz flag is on, set clkdiv to zero to get a + * master_clock / 2 (25-31MHz) MMC/SD clock rather than settle for the + * next lower click (12.5-15.5MHz). See comments near the top of the * file for more info. * * Whatever we come up with, store it back into ios->clock so that the @@ -572,7 +572,8 @@ at91_mci_update_ios(device_t brdev, devi } else { WR4(sc, MCI_CR, MCI_CR_MCIEN|MCI_CR_PWSEN); if (sc->use_30mhz && ios->clock == 25000000 && - at91_master_clock > 50000000) + at91_master_clock > 50000000 && + at91_master_clock < 62000000) clkdiv = 0; else if ((at91_master_clock % (ios->clock * 2)) == 0) clkdiv = ((at91_master_clock / ios->clock) / 2) - 1;