From nobody Sat May 15 21:43:45 2021 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3017884C07B for ; Sat, 15 May 2021 21:43:54 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjJn500Lfz4RqR for ; Sat, 15 May 2021 21:43:52 +0000 (UTC) (envelope-from marklmi@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1621115031; bh=XgUrmSOU3Ro0XAUUjQJffC/ZdyhoNMwKhrX2bqIsxYA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=GG827yLIIMd8efLY/PsYemXQvCA6uxe6aIlcAUbu3rCNgUJ5qb7/Vi1FRpLqPyUlUGIfC7kMyvekzE26twSCOS5xE+L7OWHUUhk7xm0LN/wjk9fxBMMn3/pnTAgr3FDuvLQvxdKmw9fS/Oixnn0olijPitfdtQLhXl9cpl+/oQuees/BB7Yig87+a4n9Qgx3Tp5joEq5ILu+a6eTs8Qh8W9tMGPVUrRn434melo2WtUdXfsKy5JjVWuvp3NuLW2LYf58mnGSdkKYOq6DrVxjc7YuoPp9s9gKDO1uTjIXonEdVtAxywc0fx0NS0MhgwVdfFEjbQLFnxWPAIE7kDu82w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1621115031; bh=OednplwvYXf/v92mZMyjYDiIPPzW5V4+ni0wtnfdCVk=; h=X-Sonic-MF:Subject:From:Date:To:From:Subject; b=bUqOcJIzXBGfYh4tVaL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k1VNDQQVB6iRTrQC.L8laRlRK_MgoebDaMzdn2JcVNys.9ELpIsqTm_ymo4TG3WaIXE4LWzfIH imYhwxZBaieyV1NGgO4oY97hMHvk9hP.6Wk1pk1rbjN0t9QZ0DCb3RiDjZMS5CrJbTReZQzbOAHC 21VqxVZxxjGTy6Dt8AptQV81cgWoaHC.o_Fg0gYe5qEUspPJ4rQcoxqaPCxIzaNa.Qz.p3kE0lQ5 xuZXjEa7dV1NQz8tufwKcdic8.I_ikTJueFpSBFd1B3yXUzgTgNSCH7QwX.mCljMhKEH2rHy0maX J7BBnKJaPZpFbOcf5MZMsIHErnoboYaQC5nHH.7gLeUTaeEDfcUUT_3PNz3AoIVzRRdTqvDaLzNR qJdEk0sdSx34dkzOKAC5XSfYeglq_I7bXApEpoqnAnf4NVRUIKCih4xjYoHX_9758HfjNafsaVbN lGFa1_FEG8aD8fabZM5g.aBVhirfVtIAKQzLEzPPcooGrtRc5BAWr0qzEgZjDJmapLL8MYD2yUu. pm_eh33hao3G89DLvKnW2c6vWWI6BaAgQsFbPRvigNf71NPmrblYPXrA86isJWe23YGWImGN9j.9 z3NdrDgYVa7vyjOFm9Tx_kioyFuhhP_loueIJrNGCE3TMi3lkH8RTmKUmPfTALjt8wl9OgYRzrNg PywS4j7fdSx0YmKVFZrZYNfRWoPIQZNlMoNLfNDpHZ9hAZKIPrV1cKQLdY2FLRKBWzzXdtLLLn5. vS1tgZdt8LtlKLf149AOrIYLgn9s5LsvCdr16fngs6Anpnhcz8MmgRXk- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Sat, 15 May 2021 21:43:51 +0000 Received: by kubenode541.mail-prod1.omega.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 6a1d8729e2995f664597da232fdf6ef2; Sat, 15 May 2021 21:43:46 +0000 (UTC) Content-Type: text/plain; charset=us-ascii List-Id: Porting FreeBSD to ARM processors List-Archive: http://lists.freebsd.org/arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: GPIO pullups not working -- SOLVED (or at least understood) [brcm,bcm2711-gpio in compat_data correct?] In-Reply-To: Date: Sat, 15 May 2021 14:43:45 -0700 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Elwood Downey X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Rspamd-Queue-Id: 4FjJn500Lfz4RqR X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=GG827yLI; dmarc=pass (policy=reject) header.from=yahoo.com; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.147 as permitted sender) smtp.mailfrom=marklmi@yahoo.com X-Spamd-Result: default: False [-1.51 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.65.147:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; SUBJECT_HAS_QUESTION(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(0.99)[0.988]; SPAMHAUS_ZRD(0.00)[98.137.65.147:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.147:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.147:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-arm] Reply-To: marklmi@yahoo.com From: Mark Millard via freebsd-arm X-Original-From: Mark Millard On 2021-May-5, at 21:04, Elwood Downey = wrote: > A little followup to my own post.... >=20 > I have done some bare metal programming on the broadcom devices in the = past > so I thought I'd try to find the relevant freebsd driver. The closest = one I > could find in /usr/src is for the bcm2835. >=20 > This chip was used on the Pi3. The Pi4 uses the bcm2711 which, in = their > infinite wisdom, uses a different register set and protocol for = controlling > the gpio pullups. Code for the 2835 executing on a 2711 is harmless = but > does nothing, in agreement with my observations. Does this mean that main's 2551d928501f 2021-02-17 commit of: diff --git a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c = b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c index 61513df9c008..70b69eb154e8 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c @@ -157,6 +157,7 @@ enum bcm_gpio_pud { static struct ofw_compat_data compat_data[] =3D { {"broadcom,bcm2835-gpio", 1}, {"brcm,bcm2835-gpio", 1}, + {"brcm,bcm2711-gpio", 1}, {NULL, 0} }; was inappropriate? > Then I found bcm2835_gpio.c which I must say is beautifully written. = I'm > tempted to tweak a few lines in bcm_gpio_set_pud() but I'd have to = figure > out how to rebuild the kernel which I will leave for another day. >=20 > Not a big deal, until the 2711 is supported I'll just use an external > pullup. >=20 > All the best, >=20 > On Tue, May 4, 2021 at 11:24 AM Elwood Downey = > wrote: >=20 >> Hello all; >>=20 >> Using RELEASE-13 on Raspberry Pi 4 I can not seem to engage GPIO = input >> pullups. Doing so should cause an input not connected to anything to = read >> high but it always reads low. Connecting the pin to 3.3V does read hi = so I >> know the pin is working correctly as an input, just that the pullup = is not >> connecting. >>=20 >> I configure the pin as follows: >>=20 >> freebsdpi# gpioctl -c 21 PU IN >> freebsdpi# gpioctl -l | grep 21 >> pin 21: 0 pin 21 >> freebsdpi# sysctl dev.gpio.0.pin.21.function >> dev.gpio.0.pin.21.function: input >>=20 >> # test with pin disconnected >> freebsdpi# gpioctl 21 >> 0 >>=20 >> Now connecting to 3.3V: >> freebsdpi# gpioctl 21 >> 1 >>=20 >> Installing a microSD with Raspbian Buster in the same Pi, I can = repeat the >> above using their tools and the pullup works as expected, so I know = the >> hardware is fine. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)