From nobody Fri Sep 24 16:19:41 2021 X-Original-To: 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 EEA1617C7948 for ; Fri, 24 Sep 2021 16:19:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGHL96XCMz3K9K; Fri, 24 Sep 2021 16:19:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from [192.168.0.88] (unknown [195.64.148.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 0A0D8726; Fri, 24 Sep 2021 16:19:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) From: Andriy Gapon Subject: Re: rk_gpio: high latency switching between input / output To: Emmanuel Vadot Cc: arm@FreeBSD.org, Emmanuel Vadot References: <4472ded5-1815-e7c0-0238-efd6935062e0@FreeBSD.org> <20210923091821.dd92732fa44d30f94a9415b1@bidouilliste.com> Message-ID: <5b3a2e6b-dd1f-59a5-d372-6e9ebe12200d@FreeBSD.org> Date: Fri, 24 Sep 2021 19:19:41 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 In-Reply-To: <20210923091821.dd92732fa44d30f94a9415b1@bidouilliste.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 23/09/2021 10:18, Emmanuel Vadot wrote: > > I've made some tests on my rock64 board. > The program I used [1] is, I think, the worst possible scenario that > can happen as it : > - Set the pin to output > - Toggle the pin > - Set the pin to input > - Read the pin > - Set the pin to output > > With it I get a ~30khz signal produced on the pin. > > I did some change to rk_gpio [2], those changes are : > > - Cache the pin info (gpio or not) and flags (pullup/pulldown) > - Remove useless reads for the pin direction and value when we're > setting or toggling the pin (so output mode only). > > With this and the same program I manage to have a ~50khz signal output > on the pin. > I'm not sure I can get higher result for now. > > All test where done on main (c96da199458) with GENERIC kernel. > Obviously you will have better result for kernel operation but I > choose to do userland to have the worst case possible. > > Let me know if this helps you in your case, otherwise I'll hookup some > 1wire temp sensors and try to make them work while the scope is still > plugged on the board. > > 1: https://people.freebsd.org/~manu/rk_gpio/gpio_test.c > 2: https://people.freebsd.org/~manu/rk_gpio/0001-arm64-rockchip-rk_gpio-Improve-mode-switching.patch > Thank you very much! 1-wire works reliably for me with your patch. Hope to see it committed soon. -- Andriy Gapon