From nobody Sun Aug 21 07:39:52 2022 X-Original-To: dev-commits-src-main@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 4M9S7q3tYkz4Z69T; Sun, 21 Aug 2022 07:40:07 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M9S7n677Rz3fLw; Sun, 21 Aug 2022 07:40:05 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1661067598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qak4SFdEBzyu7Svm+gYr4Nx2bc6MGuY7yyVpWzEfHM0=; b=athqYonNmCbEdWAg5Jempw1ljOjP1m9MCZlZYVMyIDzUM83UZ5/n8CXzulZ8eogh/cfP+Z L0CgxDTht1zoy6SKb2CWdYr8ZRqEmsSNpOu746L/9LjEb333E2XemNSs7BDCHcUlLX9w2M OcScHG3rQs46ReHfeCPFjb15W1s069Y= Received: from skull.home.blih.net (aif79-h01-176-172-114-162.dsl.sta.abo.bbox.fr [176.172.114.162]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 5d0cfaf8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 21 Aug 2022 07:39:57 +0000 (UTC) Date: Sun, 21 Aug 2022 09:39:52 +0200 From: Emmanuel Vadot To: Peter Jeremy Cc: Ganbold Tsagaankhuu , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 901df07a4768 - main - Code refactoring for existing rk_gpio driver. It supports gpio type checking. Depending on gpio type some register addresses are different. Message-Id: <20220821093952.08d2a29ea9c2c47aae1e0ea5@bidouilliste.com> In-Reply-To: References: <202208191322.27JDMv0b007432@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4M9S7n677Rz3fLw X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=athqYonN; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; R_SPF_ALLOW(-0.20)[+ip4:212.83.155.74/32]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org,dev-commits-src-all@freebsd.org]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[manu]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sun, 21 Aug 2022 14:05:05 +1000 Peter Jeremy wrote: > On 2022-Aug-19 13:22:57 +0000, Ganbold Tsagaankhuu = wrote: > >The branch main has been updated by ganbold: > > > >URL: https://cgit.FreeBSD.org/src/commit/?id=3D901df07a47684dca7b06f60d8= 38a56456d751a23 > > > >commit 901df07a47684dca7b06f60d838a56456d751a23 > >Author: S=F8ren Schmidt > >AuthorDate: 2022-08-19 13:22:01 +0000 > >Commit: Ganbold Tsagaankhuu > >CommitDate: 2022-08-19 13:22:01 +0000 > > > > Code refactoring for existing rk_gpio driver. > > It supports gpio type checking. Depending on gpio type some > > register addresses are different. > > =20 > > Reviewed by: manu > > Differential Revision: https://reviews.freebsd.org/D36262 >=20 > My Rock64 is now hanging on boot as follows: > rk_pinctrl0: on ofwbus0 > gpio0: mem 0xff210000-0xff2100ff irq 53 o= n rk_pinctrl0 > gpio0: Unknown gpio version 48000000 > <> >=20 > >@@ -170,6 +221,43 @@ rk_gpio_attach(device_t dev) > > rk_gpio_detach(dev); > > return (ENXIO); > > } > >+ RK_GPIO_LOCK(sc); > >+ sc->version =3D rk_gpio_read_4(sc, RK_GPIO_VERSION); > >+ RK_GPIO_UNLOCK(sc); >=20 > This call to rk_gpio_read_4() looks wrong: > a) rk_gpio_read_4() tests sc->version which this call is setting. > b) The second argument to rk_gpio_read_4() is a "enum gpio_regs", not > an actual offset - RK_GPIO_VERSION (=3D0x78) is way outside the > sc->regs array. > c) sc->regs is also uninitialised at this point. Yes indeed, sorry to not have spotted that during review. > Maybe this should call RK_GPIO_READ() instead, but neither my RK3328 > TRM (revision 1.2 from July 2017) nor my RK3399 TRM (revision 1.4 from > April 2017) document a GPIO register at offset 0x78 - both only go to > 0x60. (If you have a later TRM for either chip, I would be interested > in a copy). We should match the version based on the compat string of the parent. In a perfect world the RK356x gpio controller shouldn't have the same compatible as the other ones as the register map isn't the same but ... --=20 Emmanuel Vadot