From owner-p4-projects@FreeBSD.ORG Wed Sep 27 04:46:50 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D255616A558; Wed, 27 Sep 2006 04:46:49 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AECAD16A4EC for ; Wed, 27 Sep 2006 04:46:49 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C6FC43D53 for ; Wed, 27 Sep 2006 04:46:49 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k8R4knpC027695 for ; Wed, 27 Sep 2006 04:46:49 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8R4kn97027692 for perforce@freebsd.org; Wed, 27 Sep 2006 04:46:49 GMT (envelope-from imp@freebsd.org) Date: Wed, 27 Sep 2006 04:46:49 GMT Message-Id: <200609270446.k8R4kn97027692@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 106758 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Sep 2006 04:46:50 -0000 http://perforce.freebsd.org/chv.cgi?CH=106758 Change 106758 by imp@imp_lighthouse on 2006/09/27 04:46:40 Implement update_ios. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/at91_mci.c#6 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/at91_mci.c#6 (text+ko) ==== @@ -67,6 +67,7 @@ bus_dma_tag_t dmatag; bus_dmamap_t map; struct mmc_host host; + int wire4; }; static inline uint32_t @@ -247,7 +248,40 @@ static int at91_update_ios(device_t brdev, device_t reqdev) { - return (EIO); // XXX + uint32_t at91_master_clock = AT91C_MASTER_CLOCK; + struct at91_mci_softc *sc; + struct mmc_host *host; + struct mmc_ios *ios; + uint32_t clkdiv; + + sc = device_get_softc(brdev); + host = &sc->host; + ios = &host->ios; + // bus mode? + if (ios->clock == 0) { + WR4(sc, MCI_CR, MCI_CR_MCIDIS); + clkdiv = 0; + } else { + WR4(sc, MCI_CR, MCI_CR_MCIDIS); + if ((at91_master_clock % (ios->clock * 2)) == 0) + clkdiv = ((at91_master_clock / ios->clock) / 2) - 1; + else + clkdiv = (at91_master_clock / ios->clock) / 2; + } + if (ios->bus_width == bus_width_4 && sc->wire4) + WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) | MCI_SDCR_SDCBUS); + else + WR4(sc, MCI_SDCR, RD4(sc, MCI_SDCR) & ~MCI_SDCR_SDCBUS); + WR4(sc, MCI_MR, (RD4(sc, MCI_MR) & ~MCI_MR_CLKDIV) | clkdiv); +#if 0 + if (sc->vcc_pin) { + if (sc->power_mode == MMC_POWER_OFF) + gpio_set(sc->vcc_pin, 0); + else + gpio_set(sc->vcc_pin, 1); + } +#endif + return (0); } static int