From owner-freebsd-arm@freebsd.org Tue Aug 6 15:44:56 2019 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 30CB4C4403 for ; Tue, 6 Aug 2019 15:44:56 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 462zTz23crz48Qf for ; Tue, 6 Aug 2019 15:44:54 +0000 (UTC) (envelope-from freebsd-arm@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Tue, 06 Aug 2019 17:44:53 +0200 id 00F406C1.5D49A075.00006639 Date: Tue, 6 Aug 2019 17:44:49 +0200 From: Milan Obuch To: freebsd-arm@freebsd.org Subject: Re: Attempt to use uart0 on Zybo Z7 Message-ID: <20190806174449.24493f85@zeta.dino.sk> In-Reply-To: <20190806172337.31f87439@zeta.dino.sk> References: <20190803091019.2d067756@zeta.dino.sk> <20190806161415.4be2a991@zeta.dino.sk> <20190806172337.31f87439@zeta.dino.sk> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i386-portbld-freebsd11.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 462zTz23crz48Qf X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-arm@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-arm@dino.sk X-Spamd-Result: default: False [-6.28 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998,0]; RCVD_IN_DNSWL_NONE(0.00)[72.65.245.84.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.99)[ip: (-8.39), ipnet: 84.245.64.0/18(-4.20), asn: 16160(-2.40), country: SK(0.06)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:16160, ipnet:84.245.64.0/18, country:SK]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2019 15:44:56 -0000 On Tue, 6 Aug 2019 17:23:37 +0200 Milan Obuch wrote: > On Tue, 6 Aug 2019 16:14:15 +0200 > Milan Obuch wrote: > > > On Sat, 3 Aug 2019 09:10:19 +0200 > > Milan Obuch wrote: > > > > > Hi, > > > > > > Zynq SoC has several peripherals available on its PS/ARM side of > > > thing. Currently supported list contains UART, USB, ethernet, SDIO > > > and GPIO. No driver yet for SPI, I2C and CAN. > > > > > > Available GPIO pins are on JF6 (MIO pmod connector), I tested them > > > as inputs and they are working as expected. > > > > After some testing I found a way to enable uart0. Currently only > devices initialized by u-boot could be used, I think, and uart0 had no > clocks initialized. Now my hardware loopback works, I am going to > connect TTL-RS232 level converter and/or USB/UART convertor to check > from other box. > > Summary: > > zy7_slcr_unlock(sc); > WR4(sc, ZY7_SLCR_MIO_PIN(14), 0x16E1); > WR4(sc, ZY7_SLCR_MIO_PIN(15), 0x16E0); > > j = RD4(sc, ZY7_SLCR_APER_CLK_CTRL); > WR4(sc, ZY7_SLCR_APER_CLK_CTRL, j | > ZY7_SLCR_APER_CLK_CTRL_UART0_CPU_1XCLKACT); > > j = RD4(sc, ZY7_SLCR_UART_CLK_CTRL); > WR4(sc, ZY7_SLCR_UART_CLK_CTRL, j | 1); > > This makes necessary MIO routing change, enables APB and refererence > clocks for uart0. I put this at end of zy7_slcr_attach() function as > mentioned in original mail. > Testing with TTL-RS232 level converter: it works almost perfect, just bit rate is doubled. On Zybo I use cu -l /dev/cuau0 -s 9600 and on the other box cu -l /dev/cuaU3 -s 19200 and then I see all I type over the wire, on the other end, correctly. Milan