From owner-freebsd-arm@freebsd.org Fri Oct 18 11:31:40 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 38C5614D79E for ; Fri, 18 Oct 2019 11:31:40 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46vkQ26dXTz4SGW for ; Fri, 18 Oct 2019 11:31:38 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 8c33fa5c; Fri, 18 Oct 2019 13:31:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=Y7eFLM2gKvKNIMX2NKsiAhyzpV8=; b=MISkdY6aGd6LFTypjxm7ivBFBdsd VAXv5314SqmGLb1waRCmMN8RTCQLTkX6abhdYNMK0SUUKlIosEIuhy56OS4MQJZV l5TCFrQ4Yw+yO2iORbJXoSIb6F7onLNBb0ydafabY/WX+CzoMQ9V8cK2Ax9gZB7x 2TfaYuHFko5lx9E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=VaDtb1qJrI63DIEc+0qBuPurWA2pYJ7bsi710fuwz8KuLnZNJ4LvePFb ph+GjDMzsOFVql6ufgDIAF+mn1JMLS/iJIAVlphJHGDuE24uE/Idk7x4gUHuIulX CWBCWnqfFq8brWye8AVUIRjYwi5NTkGiIhty/+ULZiK8PFfw5Yw= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 4f0b8616 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Fri, 18 Oct 2019 13:31:31 +0200 (CEST) Date: Fri, 18 Oct 2019 13:31:31 +0200 From: Emmanuel Vadot To: Gary Otten Cc: freebsd-arm@freebsd.org Subject: Re: GPIO on Olimex A64 board. Bank E not working. Message-Id: <20191018133131.3063a80860e4906e0fd67f2c@bidouilliste.com> In-Reply-To: References: <20191015131842.370e113b9f494ead760b9b6f@bidouilliste.com> <20191015175901.1d0173f27798f15c25c037de@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46vkQ26dXTz4SGW X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=MISkdY6a; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.93 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.44)[-0.441,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[bidouilliste.com]; NEURAL_HAM_LONG(-0.97)[-0.973,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.65), ipnet: 212.83.160.0/19(2.44), asn: 12876(0.11), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; 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: Fri, 18 Oct 2019 11:31:40 -0000 On Tue, 15 Oct 2019 13:26:46 -0400 Gary Otten wrote: > Ok, I placed hw.regulator.disable_unused=0 in /boot/loader.conf. Here is > the results, also still no output on the E bank. > > root@:/dev # sysctl hw.regulator > hw.regulator.dc1sw.uvolt: 0 > hw.regulator.dc1sw.always_on: 0 > hw.regulator.dc1sw.boot_on: 0 > hw.regulator.dc1sw.enable_cnt: 0 > hw.regulator.dc1sw.enable_delay: 0 > hw.regulator.dc1sw.ramp_delay: 0 > hw.regulator.dc1sw.max_uamp: 0 > hw.regulator.dc1sw.min_uamp: 0 > hw.regulator.dc1sw.max_uvolt: 0 > hw.regulator.dc1sw.min_uvolt: 0 > hw.regulator.ldo-io1.always_on: 0 > hw.regulator.ldo-io1.boot_on: 0 > hw.regulator.ldo-io1.enable_cnt: 0 > hw.regulator.ldo-io1.enable_delay: 0 > hw.regulator.ldo-io1.ramp_delay: 0 > hw.regulator.ldo-io1.max_uamp: 0 > hw.regulator.ldo-io1.min_uamp: 0 > hw.regulator.ldo-io1.max_uvolt: 3300000 > hw.regulator.ldo-io1.min_uvolt: 700000 > hw.regulator.ldo-io0.always_on: 0 > hw.regulator.ldo-io0.boot_on: 0 > hw.regulator.ldo-io0.enable_cnt: 0 > hw.regulator.ldo-io0.enable_delay: 0 > hw.regulator.ldo-io0.ramp_delay: 0 > hw.regulator.ldo-io0.max_uamp: 0 > hw.regulator.ldo-io0.min_uamp: 0 > hw.regulator.ldo-io0.max_uvolt: 3300000 > hw.regulator.ldo-io0.min_uvolt: 700000 > hw.regulator.vdd-cpus.uvolt: 1100000 > hw.regulator.vdd-cpus.always_on: 1 > hw.regulator.vdd-cpus.boot_on: 0 > hw.regulator.vdd-cpus.enable_cnt: 0 > hw.regulator.vdd-cpus.enable_delay: 0 > hw.regulator.vdd-cpus.ramp_delay: 0 > hw.regulator.vdd-cpus.max_uamp: 0 > hw.regulator.vdd-cpus.min_uamp: 0 > hw.regulator.vdd-cpus.max_uvolt: 1100000 > hw.regulator.vdd-cpus.min_uvolt: 1100000 > hw.regulator.vcc-1v2-hsic.uvolt: 1200000 > hw.regulator.vcc-1v2-hsic.always_on: 0 > hw.regulator.vcc-1v2-hsic.boot_on: 0 > hw.regulator.vcc-1v2-hsic.enable_cnt: 0 > hw.regulator.vcc-1v2-hsic.enable_delay: 0 > hw.regulator.vcc-1v2-hsic.ramp_delay: 0 > hw.regulator.vcc-1v2-hsic.max_uamp: 0 > hw.regulator.vcc-1v2-hsic.min_uamp: 0 > hw.regulator.vcc-1v2-hsic.max_uvolt: 1200000 > hw.regulator.vcc-1v2-hsic.min_uvolt: 1200000 > hw.regulator.eldo3.always_on: 0 > hw.regulator.eldo3.boot_on: 0 > hw.regulator.eldo3.enable_cnt: 0 > hw.regulator.eldo3.enable_delay: 0 > hw.regulator.eldo3.ramp_delay: 0 > hw.regulator.eldo3.max_uamp: 0 > hw.regulator.eldo3.min_uamp: 0 > hw.regulator.eldo3.max_uvolt: 1900000 > hw.regulator.eldo3.min_uvolt: 700000 > hw.regulator.vcc-dvdd-csi.uvolt: 1800000 > hw.regulator.vcc-dvdd-csi.always_on: 0 > hw.regulator.vcc-dvdd-csi.boot_on: 0 > hw.regulator.vcc-dvdd-csi.enable_cnt: 0 > hw.regulator.vcc-dvdd-csi.enable_delay: 0 > hw.regulator.vcc-dvdd-csi.ramp_delay: 0 > hw.regulator.vcc-dvdd-csi.max_uamp: 0 > hw.regulator.vcc-dvdd-csi.min_uamp: 0 > hw.regulator.vcc-dvdd-csi.max_uvolt: 1800000 > hw.regulator.vcc-dvdd-csi.min_uvolt: 1800000 > hw.regulator.cpvdd.uvolt: 1800000 > hw.regulator.cpvdd.always_on: 0 > hw.regulator.cpvdd.boot_on: 0 > hw.regulator.cpvdd.enable_cnt: 0 > hw.regulator.cpvdd.enable_delay: 0 > hw.regulator.cpvdd.ramp_delay: 0 > hw.regulator.cpvdd.max_uamp: 0 > hw.regulator.cpvdd.min_uamp: 0 > hw.regulator.cpvdd.max_uvolt: 1800000 > hw.regulator.cpvdd.min_uvolt: 1800000 > hw.regulator.vcc-pll-avcc.uvolt: 3000000 > hw.regulator.vcc-pll-avcc.always_on: 1 > hw.regulator.vcc-pll-avcc.boot_on: 0 > hw.regulator.vcc-pll-avcc.enable_cnt: 0 > hw.regulator.vcc-pll-avcc.enable_delay: 0 > hw.regulator.vcc-pll-avcc.ramp_delay: 0 > hw.regulator.vcc-pll-avcc.max_uamp: 0 > hw.regulator.vcc-pll-avcc.min_uamp: 0 > hw.regulator.vcc-pll-avcc.max_uvolt: 3000000 > hw.regulator.vcc-pll-avcc.min_uvolt: 3000000 > hw.regulator.vcc-pl.uvolt: 3300000 > hw.regulator.vcc-pl.always_on: 1 > hw.regulator.vcc-pl.boot_on: 0 > hw.regulator.vcc-pl.enable_cnt: 0 > hw.regulator.vcc-pl.enable_delay: 0 > hw.regulator.vcc-pl.ramp_delay: 0 > hw.regulator.vcc-pl.max_uamp: 0 > hw.regulator.vcc-pl.min_uamp: 0 > hw.regulator.vcc-pl.max_uvolt: 3300000 > hw.regulator.vcc-pl.min_uvolt: 3300000 > hw.regulator.vcc-pe.uvolt: 2800000 > hw.regulator.vcc-pe.always_on: 1 > hw.regulator.vcc-pe.boot_on: 0 > hw.regulator.vcc-pe.enable_cnt: 0 > hw.regulator.vcc-pe.enable_delay: 0 > hw.regulator.vcc-pe.ramp_delay: 0 > hw.regulator.vcc-pe.max_uamp: 0 > hw.regulator.vcc-pe.min_uamp: 0 > hw.regulator.vcc-pe.max_uvolt: 2800000 > hw.regulator.vcc-pe.min_uvolt: 2800000 I've just realized that boot_on isn't 1 so u-boot will not enabled the regulator and we won't too. I guess that Linux (or armbian) hack on this. We are not supposed to enable a regulator if boot-on is set, only the bootloader is supposed to do that. And the always-on property is only there so we don't disable it if no device "claimed" it. The proper patch would be to set the boot-on property in the dts used by u-boot. Easiest way to test that is to : $ cd freebsd-ports/sysutils/u-boot-a64-olinuxino/ $ make patch ... $ edit work/u-boot-2019.07/arch/arm/dts/sun50i-a64-olinuxino.dts and add 'regulator-boot-on;' under the '®_aldo1' node. $ make $ dd the new u-boot > hw.regulator.vcc-wifi-io.uvolt: 3300000 > hw.regulator.vcc-wifi-io.always_on: 0 > hw.regulator.vcc-wifi-io.boot_on: 0 > hw.regulator.vcc-wifi-io.enable_cnt: 0 > hw.regulator.vcc-wifi-io.enable_delay: 0 > hw.regulator.vcc-wifi-io.ramp_delay: 0 > hw.regulator.vcc-wifi-io.max_uamp: 0 > hw.regulator.vcc-wifi-io.min_uamp: 0 > hw.regulator.vcc-wifi-io.max_uvolt: 3300000 > hw.regulator.vcc-wifi-io.min_uvolt: 3300000 > hw.regulator.vcc-avdd-csi.uvolt: 2800000 > hw.regulator.vcc-avdd-csi.always_on: 0 > hw.regulator.vcc-avdd-csi.boot_on: 0 > hw.regulator.vcc-avdd-csi.enable_cnt: 0 > hw.regulator.vcc-avdd-csi.enable_delay: 0 > hw.regulator.vcc-avdd-csi.ramp_delay: 0 > hw.regulator.vcc-avdd-csi.max_uamp: 0 > hw.regulator.vcc-avdd-csi.min_uamp: 0 > hw.regulator.vcc-avdd-csi.max_uvolt: 2800000 > hw.regulator.vcc-avdd-csi.min_uvolt: 2800000 > hw.regulator.vcc-mipi.uvolt: 3300000 > hw.regulator.vcc-mipi.always_on: 0 > hw.regulator.vcc-mipi.boot_on: 0 > hw.regulator.vcc-mipi.enable_cnt: 0 > hw.regulator.vcc-mipi.enable_delay: 0 > hw.regulator.vcc-mipi.ramp_delay: 0 > hw.regulator.vcc-mipi.max_uamp: 0 > hw.regulator.vcc-mipi.min_uamp: 0 > hw.regulator.vcc-mipi.max_uvolt: 3300000 > hw.regulator.vcc-mipi.min_uvolt: 3300000 > hw.regulator.vcc-hdmi.uvolt: 3300000 > hw.regulator.vcc-hdmi.always_on: 0 > hw.regulator.vcc-hdmi.boot_on: 0 > hw.regulator.vcc-hdmi.enable_cnt: 0 > hw.regulator.vcc-hdmi.enable_delay: 0 > hw.regulator.vcc-hdmi.ramp_delay: 0 > hw.regulator.vcc-hdmi.max_uamp: 0 > hw.regulator.vcc-hdmi.min_uamp: 0 > hw.regulator.vcc-hdmi.max_uvolt: 3300000 > hw.regulator.vcc-hdmi.min_uvolt: 3300000 > hw.regulator.vdd-sys.uvolt: 1100000 > hw.regulator.vdd-sys.always_on: 1 > hw.regulator.vdd-sys.boot_on: 0 > hw.regulator.vdd-sys.enable_cnt: 0 > hw.regulator.vdd-sys.enable_delay: 0 > hw.regulator.vdd-sys.ramp_delay: 0 > hw.regulator.vdd-sys.max_uamp: 0 > hw.regulator.vdd-sys.min_uamp: 0 > hw.regulator.vdd-sys.max_uvolt: 1100000 > hw.regulator.vdd-sys.min_uvolt: 1100000 > hw.regulator.vcc-ddr3.uvolt: 1360000 > hw.regulator.vcc-ddr3.always_on: 1 > hw.regulator.vcc-ddr3.boot_on: 0 > hw.regulator.vcc-ddr3.enable_cnt: 0 > hw.regulator.vcc-ddr3.enable_delay: 0 > hw.regulator.vcc-ddr3.ramp_delay: 0 > hw.regulator.vcc-ddr3.max_uamp: 0 > hw.regulator.vcc-ddr3.min_uamp: 0 > hw.regulator.vcc-ddr3.max_uvolt: 1360000 > hw.regulator.vcc-ddr3.min_uvolt: 1360000 > hw.regulator.dcdc4.uvolt: 1100000 > hw.regulator.dcdc4.always_on: 0 > hw.regulator.dcdc4.boot_on: 0 > hw.regulator.dcdc4.enable_cnt: 0 > hw.regulator.dcdc4.enable_delay: 0 > hw.regulator.dcdc4.ramp_delay: 0 > hw.regulator.dcdc4.max_uamp: 0 > hw.regulator.dcdc4.min_uamp: 0 > hw.regulator.dcdc4.max_uvolt: 1300000 > hw.regulator.dcdc4.min_uvolt: 500000 > hw.regulator.dcdc3.uvolt: 1100000 > hw.regulator.dcdc3.always_on: 0 > hw.regulator.dcdc3.boot_on: 0 > hw.regulator.dcdc3.enable_cnt: 0 > hw.regulator.dcdc3.enable_delay: 0 > hw.regulator.dcdc3.ramp_delay: 0 > hw.regulator.dcdc3.max_uamp: 0 > hw.regulator.dcdc3.min_uamp: 0 > hw.regulator.dcdc3.max_uvolt: 1300000 > hw.regulator.dcdc3.min_uvolt: 500000 > hw.regulator.vdd-cpux.uvolt: 1100000 > hw.regulator.vdd-cpux.always_on: 1 > hw.regulator.vdd-cpux.boot_on: 0 > hw.regulator.vdd-cpux.enable_cnt: 0 > hw.regulator.vdd-cpux.enable_delay: 0 > hw.regulator.vdd-cpux.ramp_delay: 0 > hw.regulator.vdd-cpux.max_uamp: 0 > hw.regulator.vdd-cpux.min_uamp: 0 > hw.regulator.vdd-cpux.max_uvolt: 1300000 > hw.regulator.vdd-cpux.min_uvolt: 1040000 > hw.regulator.vcc-3v3.uvolt: 3300000 > hw.regulator.vcc-3v3.always_on: 1 > hw.regulator.vcc-3v3.boot_on: 0 > hw.regulator.vcc-3v3.enable_cnt: 2 > hw.regulator.vcc-3v3.enable_delay: 0 > hw.regulator.vcc-3v3.ramp_delay: 0 > hw.regulator.vcc-3v3.max_uamp: 0 > hw.regulator.vcc-3v3.min_uamp: 0 > hw.regulator.vcc-3v3.max_uvolt: 3300000 > hw.regulator.vcc-3v3.min_uvolt: 3300000 > hw.regulator.usb1-vbus.uvolt: 5000000 > hw.regulator.usb1-vbus.always_on: 0 > hw.regulator.usb1-vbus.boot_on: 1 > hw.regulator.usb1-vbus.enable_cnt: 1 > hw.regulator.usb1-vbus.enable_delay: 0 > hw.regulator.usb1-vbus.ramp_delay: 0 > hw.regulator.usb1-vbus.max_uamp: 0 > hw.regulator.usb1-vbus.min_uamp: 0 > hw.regulator.usb1-vbus.max_uvolt: 5000000 > hw.regulator.usb1-vbus.min_uvolt: 5000000 > > On Tue, Oct 15, 2019 at 11:59 AM Emmanuel Vadot > wrote: > > > On Tue, 15 Oct 2019 11:46:14 -0400 > > Gary Otten wrote: > > > > > Thanks for your response. > > > > > > Freebsd Version 12.0-STABLE > > > > > > root@:/dev # sysctl hw.regulator.vcc-pe > > > hw.regulator.vcc-pe.uvolt: 2800000 > > > hw.regulator.vcc-pe.always_on: 1 > > > hw.regulator.vcc-pe.boot_on: 0 > > > hw.regulator.vcc-pe.enable_cnt: 0 > > > > That's the problem. > > Can you try with hw.regulator.disable_unused=0 in /boot/loader.conf ? > > Something is wrong somewhere as we should enable this regulator as the > > always-on prop is set. I'll try to have a look this week. > > > > > hw.regulator.vcc-pe.enable_delay: 0 > > > hw.regulator.vcc-pe.ramp_delay: 0 > > > hw.regulator.vcc-pe.max_uamp: 0 > > > hw.regulator.vcc-pe.min_uamp: 0 > > > hw.regulator.vcc-pe.max_uvolt: 2800000 > > > hw.regulator.vcc-pe.min_uvolt: 2800000 > > > > > > Yes I am testing the pins with a multimeter, I am not seeing any voltage > > > swings at all on Port E. On the external connector I see 5V on pin 1, > > 3.3 > > > on pin 3 and the correct voltage( software setting) on the other pins, > > > except bank E. > > > > > > PB0-PB4 voltage corresponds to software setting. > > > PC4,PC7 voltage corresponds to software setting. > > > PE0-PE17 no voltage swings, doesn't work. > > > PL7-PL12 voltage corresponds to software setting. > > > > > > I don't know if it will help, but if I make output on a pin low, still > > > when I switch the that pin from In to out, , I see a small voltage swing > > > in the milli volt range, but when I switch the PE pins from in to out, I > > > don't see that small swing. Its as if they is no software connection to > > > the PE pins. > > > > > > On Tue, Oct 15, 2019 at 7:18 AM Emmanuel Vadot > > > wrote: > > > > > > > > > > > Hi Gary, > > > > > > > > On Mon, 14 Oct 2019 14:46:12 -0400 > > > > Gary Otten wrote: > > > > > > > > > I have successfully booted the FreeBSD on the Olimex board which has > > the > > > > > Allwinner A64. I have been experimenting with the gpios, again with > > > > > success. However the 40 pin connector on the Olimex board exposes > > GPIO > > > > pins > > > > > PB0 - PB4 which function normally (voltage corresponds to software > > > > setting > > > > > for that pin) and then PE0-PE17 which don't. I have played with > > most > > > > > of the PE0- PE17 pins with various settings, again nothing works, no > > > > signs > > > > > of activity. I have successfully lit the LED (PE17) with the armbian > > > > > (linux) distribution for this board so I know it should work. > > > > > > > > > > Example > > > > > gpioctl -f /dev/gpioc0 -c PB0 OUT > > > > > gpioctl -f /dev/gpioc0 PB0 1 > > > > > > > > > > The pin PB0 then goes high (1) as expected. > > > > > > > > > > gpioctl -f /dev/gpioc0 -c PE17 OUT > > > > > gpioctl -f /dev/gpioc0 PE17 1 > > > > > > > > > > No activity on PE17 > > > > > > > > > > > > > > > I have dug into the the driver code a bit and the files containing > > the > > > > > settings for this board/processor, but I have had no luck figuring it > > > > out. > > > > > I have studied the Allwinner a64 manual but I haven't had luck > > figuring > > > > > out any other settings that might work. I think I am missing a > > simple > > > > > setting but can't figure it out, does anyone know how to get pins > > PE0 to > > > > > PE17 to work? Thanks. > > > > > > > > What version of FreeBSD are you booting on this board ? > > > > PE is a bit special on the Olinuxino as it's also used for MIPI-CSI > > > > and it's drived at 2.8V by default. It's using the regulator ALDO1 from > > > > the AXP PMIC and you should be able to confirm that it's enabled by > > > > doing sysctl hw.regulator.vcc-pe > > > > Check for the .enable sysctl > > > > It should be on as there is the always-on property in the DTS. > > > > By default I think that the gpio pins are configured for 20mA so I > > > > don't know if it would be enough for this led. If you have a multimeter > > > > it would be good to confirm if you have any voltage on the ext > > > > connector (you can use any PE pins, from what I see from the schematics > > > > they are all safe to play with). > > > > > > > > -- > > > > Emmanuel Vadot > > > > > > > > > > -- > > Emmanuel Vadot > > -- Emmanuel Vadot