Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1016369rdb; Fri, 16 Feb 2024 02:46:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNSELXXMMj7o/PplA4t1OGf1WUVWLJnPjOoh1Np1tplCvO7EEA89Mnv1s3dGwwjyU+D8wsC34KjDRJJFp+xhnpiH8cIDSEtLVkSbbTYw== X-Google-Smtp-Source: AGHT+IHEAPTYBPnScWRztT5ubwRWOQwGUvPcjvbJDj/4zNc3dEVzUTBq1GHLkVww6ics/7ALtPMO X-Received: by 2002:a05:6a20:d38f:b0:1a0:78b3:af33 with SMTP id iq15-20020a056a20d38f00b001a078b3af33mr5415539pzb.37.1708080417929; Fri, 16 Feb 2024 02:46:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708080417; cv=pass; d=google.com; s=arc-20160816; b=HOqkPAp2vxeikafQclj8D8p1dPZq0YBS+fNl75i9JObjX8EK89StCLmxXwmodQmE6N i1K0Y71+IQf0rpKYnlTW56T0mX3ZxOZRHVwP6rNomhKG3nZO4C7L42+E1zlMH0m5qtWI awIyvqnipevCMUMauhIIe4pEcy0YDlXiguWut5u4cLmcPQCsXqK4KIRBdJhZV0Z2yB/4 Lz+Dter63rGQHOJeyMd+KFFj4kkQOZWT6lTNGcIXy4I2a67zriatokXWabB17esaRgYB 70NoXQ0bx0awn9946+KFoky86LyKZAoh1rOuh2RAu4BNKkYFZHwYb6nDnU3WeiLkduAa Rntw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=pOFZYp9L0rsUmowBF6zr/rLZrw3lql63KQCsfDEtWYw=; fh=HLERM1kEZknrehz4EK6RwcO/vlvAHotx6+ps4eLckgg=; b=HuHti5aZNwT6y396gtg6OQhtgY4WzdMY4T8rJOyPddwod8Q1xiIKsahnBk6z2rr8e1 dhK4WfvzJSujBNSS9CQ9f9CsTKwwW79aZz3xyRM9LYcovwfyl9RXLoRUWHv2VboRmKf9 6RwPnzPykYNLWbOtls1IxYlXHev/eZfyY0ZosL9f4uRyLh2HD1qt2fJZXLEGMm9o7dcy UQ/GAgF2W2juLnAQLzTJ0AiF1Q1AXgrUdzzVejiC+9rSxo4ob/6h6KFP1EDHD+HbNCNE in9Gy8SWHzMWqBaIWyWZ7vh5ue2HwjoP2ICZ5Rf2oZYFmZnKFT+sIsHRSDxKGQHixf0k BlwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XYQcs0ay; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-68465-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68465-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p5-20020a170902ebc500b001d72f9a9fe2si2783900plg.556.2024.02.16.02.46.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 02:46:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68465-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=XYQcs0ay; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-68465-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68465-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9BCC5284E3A for ; Fri, 16 Feb 2024 10:46:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AF09535BF; Fri, 16 Feb 2024 10:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="XYQcs0ay" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2E574EB46; Fri, 16 Feb 2024 10:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708080408; cv=none; b=qqzfmydUhTugs5u79gnxJzz4LFVz7aGkH5sqHhVJW7oHGLV+xZtPHZ4gzr61H330Hj+Nx6WkwH72TZLIkZ4ESWsgCjZMwia85XfT8NSdhOu4iv7pk94FNXnJMpl20n4OBz5qapUs2UZCMO3+fUopLWsRso3d7DKpc7ltUaWnbOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708080408; c=relaxed/simple; bh=zO/aYULRDd5g66VH3wDZFlrX3sUYi1N5HOHVoHCRZV4=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=h8QYr2I2RQXXiBnfA0OqiMVKhnz37+QjX87vDxktpowNB1+j/k/SHMGXTw5iscL1dPDT3A9wGgSllMNJeb6jJxF2YsaNueBdoyzvSDBN/1413ulvOHSyxVB0xtZ0GQeDfQGIRTCjVt1iobSUQTpZ61BI3f7cwOaf37LtRKXYJ+s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=XYQcs0ay; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id DBFFB40010; Fri, 16 Feb 2024 10:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708080398; 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=pOFZYp9L0rsUmowBF6zr/rLZrw3lql63KQCsfDEtWYw=; b=XYQcs0ayxwkHosheDGS+xMf4VR7v/mXreOiEjH5x5j54nNfito6uMSJ3ZQsQ1GFcOHosrk sk56mZqniap2andZ4ef8ZJW6MczWT3QdoADxEcPswfadR0K2fhCmXm2jewctoz3F8q7ofP +5FM0XeU/uuT84AM+aS3UG5xif8zvLwyVtZ/Rfud6akypxVtvTNHU7zw1N/ENVeBozcljT YElJRis/88Ap6dTbQi8/jp+cw1YwaIMUSmbE5DVKzh/EZOV6o6//X6SE2tMK3iATbi5yej lKHE6RtCfgvCRny0FxT2A9QbxLRhalrdHpYliiK/TZC5dIpuYvJFgdgd4l0/bw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 16 Feb 2024 11:46:36 +0100 Message-Id: Subject: Re: [PATCH 19/23] gpio: nomadik: grab optional reset control and deassert it at probe Cc: , , , , , "Gregory CLEMENT" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Philipp Zabel" , "Linus Walleij" , "Bartosz Golaszewski" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" From: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: aerc 0.15.2 References: <20240214-mbly-gpio-v1-0-f88c0ccf372b@bootlin.com> <20240214-mbly-gpio-v1-19-f88c0ccf372b@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Thu Feb 15, 2024 at 11:19 AM CET, Philipp Zabel wrote: > On Mi, 2024-02-14 at 17:24 +0100, Th=C3=A9o Lebrun wrote: > > Fetch a reference to the optional shared reset control and deassert it > > if it exists. > >=20 > > Optional because not all platforms that use this driver have a reset > > attached to the reset block. Shared because some platforms that use the > > reset (at least Mobileye EyeQ5) share the reset across banks. > >=20 > > Do not keep a reference to the reset control as it is not needed > > afterwards; the driver does not handle suspend, does not use runtime PM > > and does not register a remove callback. > > I suppose you don't care that the reset is only ever deasserted once > and never asserted again on this hardware, but for shared reset > controls the expectation is that deassert/assert calls are balanced: > > https://docs.kernel.org/driver-api/reset.html?highlight=3Dbalanced#assert= ion-and-deassertion > > So maybe this warrants a comment in the code. Or do you mean to > suppress unbind via suppress_bind_attrs to explain away any missing > cleanup? Those resets are shared only across GPIO banks which have no reason to be unbind-able. I'll add a comment and disable unbind. > > The operation is done in nmk_gpio_populate_chip(). This function is > > called by either gpio-nomadik or pinctrl-nomadik, whoever comes first. > > This is here for historic reasons and could probably be removed now; it > > seems gpio-ranges enforces the ordering to be pinctrl-first. It is not > > the topic of the present patch however. > >=20 > > Signed-off-by: Th=C3=A9o Lebrun > > --- > > drivers/gpio/gpio-nomadik.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > >=20 > > diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c > > index 21bb6d6363fc..b623c093b54d 100644 > > --- a/drivers/gpio/gpio-nomadik.c > > +++ b/drivers/gpio/gpio-nomadik.c > > @@ -513,12 +513,14 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(stru= ct device_node *np, > > { > > struct nmk_gpio_chip *nmk_chip; > > struct platform_device *gpio_pdev; > > + struct reset_control *reset; > > struct gpio_chip *chip; > > struct resource *res; > > struct clk *clk; > > void __iomem *base; > > uintptr_t flags; > > u32 id, ngpio; > > + int ret; > > =20 > > gpio_pdev =3D of_find_device_by_node(np); > > if (!gpio_pdev) { > > @@ -576,6 +578,19 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struc= t device_node *np, > > clk_prepare(clk); > > nmk_chip->clk =3D clk; > > =20 > > + reset =3D devm_reset_control_get_optional_shared(&gpio_pdev->dev, NUL= L); > > + if (IS_ERR(reset)) { > > + dev_err(&pdev->dev, "failed getting reset control: %ld\n", > > + PTR_ERR(reset)); > > + return ERR_CAST(reset); > > Consider using dev_err_probe() here. Makes sense, will do so for next revision. Thanks for the review Philipp, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com