From owner-freebsd-arm@freebsd.org Thu May 6 04:04:24 2021 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 6EC356318C9 for ; Thu, 6 May 2021 04:04:24 +0000 (UTC) (envelope-from elwood.downey@gmail.com) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FbKhl53BNz3PRR for ; Thu, 6 May 2021 04:04:23 +0000 (UTC) (envelope-from elwood.downey@gmail.com) Received: by mail-pl1-x62c.google.com with SMTP id s20so2696792plr.13 for ; Wed, 05 May 2021 21:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ef/nOLwO5aAzeqc6uXl+dIwOr5AZfaQhLBlUMb5l4uc=; b=r3DioLWWyF9UH1/HRvQ5ux7LDZs0+sVIYf58rb9vVJjYFNnAXjR049lLBCMU/0FIo+ Z5YMXk43yuBbNbuAYCZUgfm/b7/gF8aizv5Mi/xVSWQHZFtfhRlVnhnw1YJ5v+0oM3kU U+CJnrLS+j2epoDyLLhdUs/IHbK53gz1OTJLeIEGTEzNsCH0SDLfUjFFyN1PoptA+OW6 CbKDX5yyFLybKtEcEtYuN4dcOJ2OU22209U83YQpFgLxglJH8EUoSHtDe+X9r8aybCEV 39NXIRvFhatAlDnL+JHKsv8QLeBGitJFge/lBbwBfSJmQKfwa+S2NVJtM33TIcitnFoM cpOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ef/nOLwO5aAzeqc6uXl+dIwOr5AZfaQhLBlUMb5l4uc=; b=CH5XQeQjCkd3PB1UU6e7cKiFgoOS871pmGEdYlyokMrG3EWi/5gSj+t9O2GypTUTaj iOi2GQpfQaQyMAceAshsHUFwK86ENuO9CG0sJcip2mP355hjvfn2KD14H7c22NsAnKtA pUjlldXD/oSGSgmihOWWJbasoWPfK9KXYJBGHWCCbw4oxSdvEK7fmgQuA/FoYeBT+pVG hqDO2Ynh8P7OvtReEDRMKfIUKye/w69mEFMf4AFMQsstzXO88a40QTeDzGAlT9JUraGk M1LFe5nAIfrr4sgkHw/7lUmvufZvYXJMds4untC6CkrkcaUKmIakbBUkTQclObcpXkg6 7EsQ== X-Gm-Message-State: AOAM530YBet7OQRlXJ//oARQhI/tYrjVqCNvYOZ/qoCNMHgLZLuBj7qm e0vjqKxDWyMMXFrQGPKIJxzWWhhz8vtnhZk6Z805HmpvKvI= X-Google-Smtp-Source: ABdhPJwQJFu3e6M+06lD4fiP90+tpENfdtSxVOWbbus/I2OZJ4rB5pR7dxvGKc3aqqwml4yKyBtN11J4Hg+s4Htosq0= X-Received: by 2002:a17:902:9b8b:b029:ee:bb74:7d46 with SMTP id y11-20020a1709029b8bb02900eebb747d46mr2491965plp.65.1620273861633; Wed, 05 May 2021 21:04:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Elwood Downey Date: Wed, 5 May 2021 21:04:10 -0700 Message-ID: Subject: Re: GPIO pullups not working -- SOLVED (or at least understood) To: freebsd-arm@freebsd.org X-Rspamd-Queue-Id: 4FbKhl53BNz3PRR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=r3DioLWW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of elwooddowney@gmail.com designates 2607:f8b0:4864:20::62c as permitted sender) smtp.mailfrom=elwooddowney@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::62c:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::62c:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62c:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-arm] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Porting FreeBSD to ARM processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 04:04:24 -0000 A little followup to my own post.... 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. 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. 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. Not a big deal, until the 2711 is supported I'll just use an external pullup. All the best, On Tue, May 4, 2021 at 11:24 AM Elwood Downey wrote: > Hello all; > > 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. > > I configure the pin as follows: > > 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 > > # test with pin disconnected > freebsdpi# gpioctl 21 > 0 > > Now connecting to 3.3V: > freebsdpi# gpioctl 21 > 1 > > 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. > > Any help appreciated, advTHANKSance > > Elwood Downey > Tucson AZ >