From owner-svn-src-all@freebsd.org Thu May 19 04:11:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD082B41107; Thu, 19 May 2016 04:11:01 +0000 (UTC) (envelope-from adrian@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 mx1.freebsd.org (Postfix) with ESMTPS id 65B0419A9; Thu, 19 May 2016 04:11:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4J4B08d062238; Thu, 19 May 2016 04:11:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4J4B08u062237; Thu, 19 May 2016 04:11:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605190411.u4J4B08u062237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 19 May 2016 04:11:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300184 - head/sys/dev/siba X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Thu, 19 May 2016 04:11:01 -0000 Author: adrian Date: Thu May 19 04:11:00 2016 New Revision: 300184 URL: https://svnweb.freebsd.org/changeset/base/300184 Log: [siba] implement PMU behaviour for chips with a separate PMU module. * PMU controls the clock setup * Correctly set idle low power handling * Use a hard-coded powerup delay for some of the newer hardware (including the BCM4322, which I've tested with.) Tested: * BCM4322, 2G + 5G STA mode Obtained from: Linux b43 (PMU behaviour) Modified: head/sys/dev/siba/siba_core.c Modified: head/sys/dev/siba/siba_core.c ============================================================================== --- head/sys/dev/siba/siba_core.c Thu May 19 04:03:41 2016 (r300183) +++ head/sys/dev/siba/siba_core.c Thu May 19 04:11:00 2016 (r300184) @@ -774,6 +774,13 @@ siba_cc_clock(struct siba_cc *scc, enum if (sd == NULL) return; siba = sd->sd_bus; + + /* + * PMU controls clockmode; separate function is needed + */ + if (scc->scc_caps & SIBA_CC_CAPS_PMU) + return; + /* * chipcommon < r6 (no dynamic clock control) * chipcommon >= r10 (unknown) @@ -930,6 +937,7 @@ siba_cc_pmu_init(struct siba_cc *scc) DPRINTF(siba, SIBA_DEBUG_PMU, "PMU(r%u) found (caps %#x)\n", scc->scc_pmu.rev, pmucap); +#if 0 if (scc->scc_pmu.rev >= 1) { if (siba->siba_chiprev < 2 && siba->siba_chipid == 0x4325) SIBA_CC_MASK32(scc, SIBA_CC_PMUCTL, @@ -938,6 +946,12 @@ siba_cc_pmu_init(struct siba_cc *scc) SIBA_CC_SET32(scc, SIBA_CC_PMUCTL, SIBA_CC_PMUCTL_NOILP); } +#endif + if (scc->scc_pmu.rev == 1) { + SIBA_CC_MASK32(scc, SIBA_CC_PMUCTL, ~SIBA_CC_PMUCTL_NOILP); + } else { + SIBA_CC_SET32(scc, SIBA_CC_PMUCTL, SIBA_CC_PMUCTL_NOILP); + } /* initialize PLL & PMU resources */ switch (siba->siba_chipid) { @@ -1070,8 +1084,22 @@ siba_cc_powerup_delay(struct siba_cc *sc struct siba_softc *siba = scc->scc_dev->sd_bus; int min; - if (siba->siba_type != SIBA_TYPE_PCI || - !(scc->scc_caps & SIBA_CC_CAPS_PWCTL)) + if (siba->siba_type != SIBA_TYPE_PCI) + return; + + if (scc->scc_caps & SIBA_CC_CAPS_PMU) { + if ((siba->siba_chipid == 0x4312) || + (siba->siba_chipid == 0x4322) || + (siba->siba_chipid == 0x4328)) { + scc->scc_powerup_delay = 7000; + } else { + /* 0x4325 is marked as TODO */ + scc->scc_powerup_delay = 15000; + } + return; + } + + if (!(scc->scc_caps & SIBA_CC_CAPS_PWCTL)) return; min = siba_cc_clockfreq(scc, 0);