From owner-svn-src-all@FreeBSD.ORG Wed Jan 21 17:39:11 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AF321065670; Wed, 21 Jan 2009 17:39: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 787D08FC08; Wed, 21 Jan 2009 17:39:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0LHdBDG085218; Wed, 21 Jan 2009 17:39:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0LHdBpi085217; Wed, 21 Jan 2009 17:39:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200901211739.n0LHdBpi085217@svn.freebsd.org> From: Warner Losh Date: Wed, 21 Jan 2009 17:39:11 +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: r187548 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2009 17:39:13 -0000 Author: imp Date: Wed Jan 21 17:39:11 2009 New Revision: 187548 URL: http://svn.freebsd.org/changeset/base/187548 Log: o The f_max is really at91_master_clock / 2, not 30MHz, so compute it as such. o Only set 4-bit caps on those boards that have 4-bit caps (this means that because we don't set wire4 yet, this forces us to always use 1-bit bus). o Don't test wire4 when setting up the bus width, since bad things will happen if we do. # This likely won't fix the busted at91 sd card support, but these are # needful changes for correctness. Modified: head/sys/arm/at91/at91_mci.c Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Wed Jan 21 17:36:06 2009 (r187547) +++ head/sys/arm/at91/at91_mci.c Wed Jan 21 17:39:11 2009 (r187548) @@ -199,9 +199,12 @@ at91_mci_attach(device_t dev) goto out; } sc->host.f_min = 375000; - sc->host.f_max = 30000000; + sc->host.f_max = at91_master_clock / 2; /* Typically 30MHz */ sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; - sc->host.caps = MMC_CAP_4_BIT_DATA; + if (sc->wire4) + sc->host.caps = MMC_CAP_4_BIT_DATA; + else + sc->host.caps = 0; child = device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); err = bus_generic_attach(dev); @@ -294,7 +297,7 @@ at91_mci_update_ios(device_t brdev, devi else clkdiv = (at91_master_clock / ios->clock) / 2; } - if (ios->bus_width == bus_width_4 && sc->wire4) + if (ios->bus_width == bus_width_4) WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) | MCI_SDCR_SDCBUS); else WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) & ~MCI_SDCR_SDCBUS);