From owner-freebsd-arm@freebsd.org Sun May 17 06:39:02 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D64B62C84D9 for ; Sun, 17 May 2020 06:39:02 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gold.funkthat.com [IPv6:2001:470:800b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49PstY6N5vz41nk for ; Sun, 17 May 2020 06:39:01 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id 04H6crpi069703 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Sat, 16 May 2020 23:38:53 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id 04H6crA4069702 for freebsd-arm@FreeBSD.org; Sat, 16 May 2020 23:38:53 -0700 (PDT) (envelope-from jmg) Date: Sat, 16 May 2020 23:38:53 -0700 From: John-Mark Gurney To: freebsd-arm@FreeBSD.org Subject: Re: need help w/ Cora-Z7, XC7Z007S Zynq board Message-ID: <20200517063853.GI4213@funkthat.com> Mail-Followup-To: freebsd-arm@FreeBSD.org References: <20200516221344.GH4213@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200516221344.GH4213@funkthat.com> X-Operating-System: FreeBSD 11.3-STABLE amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Sat, 16 May 2020 23:38:53 -0700 (PDT) X-Rspamd-Queue-Id: 49PstY6N5vz41nk X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of jmg@gold.funkthat.com has no SPF policy when checking 2001:470:800b::2) smtp.mailfrom=jmg@gold.funkthat.com X-Spamd-Result: default: False [1.20 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[funkthat.com]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[jmg@funkthat.com,jmg@gold.funkthat.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jmg@funkthat.com,jmg@gold.funkthat.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 May 2020 06:39:02 -0000 John-Mark Gurney wrote this message on Sat, May 16, 2020 at 15:13 -0700: > Hello, > > Recently got the Cora-Z7 board, and want to get FreeBSD working on it. > > With a bit of help from manu, I managed to get FreeBSD booting on it, > but running into issues w/ the clocks. > > The issue is that I need to set the clock-frequency for the > global-clock, otherwise I don't have an event timer and the kernel > panics. I configured it in the dts: > https://www.funkthat.com/~jmg/FreeBSD/cora-z7/zynq-coraz7.dts > > But the issue is that time passes approximately 6.25x faster than > it should. This was measured via pinging a remote host on the > board, and via another machine, observing that it was about 6.23x > difference, and noticing that 50MHz/8MHz is 6.25x. The 50 MHz > speed was selected because the Cora-Z7 user guide says that the PS_CLK > block is provided a 50 MHz clock, and the dts provided by Digilent > uses 50 MHz as well: > https://github.com/Digilent/u-boot-digilent/blob/master/arch/arm/dts/zynq-coraz7.dts#L41 After a bit of digging, I think I have found the solution. It looks like slcr is suppose to be set to the frequency of the ps clk, which is 50 MHz, and then the global_timer is suppose to be set to half the CPU clock frequency, which on this board is, I believe, 650 MHz, so using the following in the dts made things work: &slcr { clock-frequency = <50000000>; }; &global_timer { clock-frequency = <325000000>; }; ping times look good sane (after I realized that wifi has a tad slower), and I've been running ntpd for over 20 minutes, and it hasn't bombed out yet, and the offset/jitter look good. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."