From owner-svn-src-head@freebsd.org Thu May 31 15:41:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7620DEF9ABE; Thu, 31 May 2018 15:41:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DC226D663; Thu, 31 May 2018 15:41:01 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA7191C1BB; Thu, 31 May 2018 15:41:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4VFf0QI056697; Thu, 31 May 2018 15:41:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4VFf0x3056696; Thu, 31 May 2018 15:41:00 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805311541.w4VFf0x3056696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 31 May 2018 15:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334435 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 334435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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: Thu, 31 May 2018 15:41:01 -0000 Author: manu Date: Thu May 31 15:41:00 2018 New Revision: 334435 URL: https://svnweb.freebsd.org/changeset/base/334435 Log: aw_mmc: Use the DEVMETHOD vccq for the IO line voltage MMC controller should use this and not set the voltage during update_ios. Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:39:39 2018 (r334434) +++ head/sys/arm/allwinner/aw_mmc.c Thu May 31 15:41:00 2018 (r334435) @@ -119,8 +119,6 @@ struct aw_mmc_softc { uint32_t aw_intr; uint32_t aw_intr_wait; void * aw_intrhand; - int32_t aw_vdd; - int32_t aw_vccq; regulator_t aw_reg_vmmc; regulator_t aw_reg_vqmmc; unsigned int aw_clock; @@ -941,15 +939,18 @@ aw_mmc_update_clock(struct aw_mmc_softc *sc, uint32_t return (0); } -static void -aw_mmc_set_vccq(struct aw_mmc_softc *sc, int32_t vccq) +static int +aw_mmc_switch_vccq(device_t bus, device_t child) { - int uvolt; + struct aw_mmc_softc *sc; + int uvolt, err; + sc = device_get_softc(bus); + if (sc->aw_reg_vqmmc == NULL) - return; + return EOPNOTSUPP; - switch (vccq) { + switch (sc->aw_host.ios.vccq) { case vccq_180: uvolt = 1800000; break; @@ -957,15 +958,19 @@ aw_mmc_set_vccq(struct aw_mmc_softc *sc, int32_t vccq) uvolt = 3300000; break; default: - return; + return EINVAL; } - if (regulator_set_voltage(sc->aw_reg_vqmmc, - uvolt, uvolt) != 0) + err = regulator_set_voltage(sc->aw_reg_vqmmc, uvolt, uvolt); + if (err != 0) { device_printf(sc->aw_dev, "Cannot set vqmmc to %d<->%d\n", uvolt, uvolt); + return (err); + } + + return (0); } static int @@ -1020,11 +1025,6 @@ aw_mmc_update_ios(device_t bus, device_t child) break; }; - if (ios->vccq != sc->aw_vccq) { - aw_mmc_set_vccq(sc, ios->vccq); - sc->aw_vccq = ios->vccq; - } - /* Enable ddr mode if needed */ reg = AW_MMC_READ_4(sc, AW_MMC_GCTL); if (ios->timing == bus_timing_uhs_ddr50 || @@ -1141,6 +1141,7 @@ static device_method_t aw_mmc_methods[] = { DEVMETHOD(mmcbr_update_ios, aw_mmc_update_ios), DEVMETHOD(mmcbr_request, aw_mmc_request), DEVMETHOD(mmcbr_get_ro, aw_mmc_get_ro), + DEVMETHOD(mmcbr_switch_vccq, aw_mmc_switch_vccq), DEVMETHOD(mmcbr_acquire_host, aw_mmc_acquire_host), DEVMETHOD(mmcbr_release_host, aw_mmc_release_host),