Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp634668pxv; Thu, 24 Jun 2021 16:20:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqqfHmzgMCrWyGE+QDVOQYUp+uMOVPA0oNd3yStuvWAkTjN/iNoUiuLUmZHAALN6h88Kk1 X-Received: by 2002:aa7:d918:: with SMTP id a24mr10934633edr.235.1624576857466; Thu, 24 Jun 2021 16:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624576857; cv=none; d=google.com; s=arc-20160816; b=pzfpuoJjqepNljAXlqcy/TqOz3PsXbh78oxuMwRp1+yT14sNeJ9FeImsdHw8UcC1Lt Cr++skXx0Z9hG4N4Jdy32ONxJs838mumJu+Z83GO5lyNdZXiwhGFGEsu2c79Mfg3MJ8E AA4P5ptZcMGN/3Yoi621dhWTu40BZRnUu6+cWqSEhLInzcA75xKfoBX+Gj8JKX7rs5/N zkvFi80MuJVJfyvVZ8RZVUHeF7xBi0PriiVx5IpJ+Aw7TXlZ7SS6nZPj0dlcf8QB6xkG EpfeVcBiHH8OjOA0cxaWH4GtVXbcdjnRRpaPjiJwiE6Gi800HEjA4fAVE5wPq72GtFO7 lD4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BVdHxGZqj8DMPWxofgWa1I04A+xffaUTJE88j4FN/wI=; b=cewz2YwU/nO6FXm5tZHRpY9gpob5oxhKaO2qePIvUOo+ts04VFP1oLz/FiAXbkkvLe r8FwGipZyehR6QrCuTYLmvrq+6E6KRDnPr/FW5wX0JF4FLPowBLYhIvBR7CrViCEa8qv /Uy1AwfCEFwhHnDlV6mrpBA1zRsMXWNZlEOp4BHIkrT0WsirqvDBXheKo9lhOGh5UAyX COnaaV3HTtCKKcisYaVVdKR2OUE9mHJO5AhFgZwZt4fGvqPy9ZZODjuNVc4Rrd4ftnAC Xapxc55N3RaoKfrTDvu/z7M+jbnDa3ST8RiVb1psa7QFUU+ciPzsp5skAPwzrVtvI9Kd hvzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XGO3Cc09; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be28si4061677edb.317.2021.06.24.16.20.34; Thu, 24 Jun 2021 16:20:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XGO3Cc09; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbhFXXVT (ORCPT + 99 others); Thu, 24 Jun 2021 19:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhFXXVQ (ORCPT ); Thu, 24 Jun 2021 19:21:16 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96BCC061756 for ; Thu, 24 Jun 2021 16:18:55 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id a11so13087781lfg.11 for ; Thu, 24 Jun 2021 16:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BVdHxGZqj8DMPWxofgWa1I04A+xffaUTJE88j4FN/wI=; b=XGO3Cc09FjQEhHh0lHOesLy9TqBpH2/g6YJUnMWTvs09c1TglgCcAgc+QKJG/laf+C 83tQycrusn3X7g2GO+zqiaDhM6/XyU4m1k+XQQ4reEY7hotEcRkbVl7dKc9x2gMBnfdj NY3SuFe9EmM0/PS3un+IhY5QzR9Cs36jck65OMo9Mfn3wjpu8TayCex4TXCqUSgyGTu5 hK+hPeY5KAFGc8qAYjoXEpbUxmYw9LvLTO+YJik7wa2oQUosQwzc+SGsIP33FQfqnMiV JJvG3vG11+C0CMAwtOkRgQ0XJ1O122HecuiVI1DbtdfWiE1SENFL+UO8bDUQEL9iuPVE /qZw== 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:cc:content-transfer-encoding; bh=BVdHxGZqj8DMPWxofgWa1I04A+xffaUTJE88j4FN/wI=; b=Emwpy1CnQtBhUFOz4QOx2i6XLx2Gc1UBBhEoGWN7c4DZ6/J5R/D/K30acLa/VWP6rO qLGXgfhreD+MQZYAuHH0XfmHZP1OqdLka6gfr4EZcumJ6nTUoY4xjCanIVZvHtiNALNb GnEt1CpEOL1DkLCF1ZsDM2JayIMFn1LU4BKGBVLXryZvc6heLDjsBQUGIpkbagwxdhiB KH4LfutPTPsbANtWf0BVCXXTWLwro+p/zFh/bVpsH5IB9KwopxvhvWdb/aTbjs1CelO3 Yvtmdpb/rS0oP956A9TGJlGhHT9NZU1lN2GbkgaCRhKwoBUgkU3x9GBX8VQ7yR3kSIR8 qqrA== X-Gm-Message-State: AOAM532ujtSFXNWkGsQioFiLBIJWdFE5Wx9Z4vrUr4J7rZPAmmlAZXiL UPKjfN4f8vcfss7d3xkjWBbwI2tQTLCRjtqaj7wXqQ== X-Received: by 2002:a05:6512:3f08:: with SMTP id y8mr5509140lfa.649.1624576734131; Thu, 24 Jun 2021 16:18:54 -0700 (PDT) MIME-Version: 1.0 References: <8207a53c-4de9-d0e5-295a-c165e7237e36@lucaceresoli.net> <20210622110627.aqzxxtf2j3uxfeyl@pali> <20210622115604.GA25503@lpieralisi> <20210622121649.ouiaecdvwutgdyy5@pali> <18a104a9-2cb8-7535-a5b2-f5f049adff47@lucaceresoli.net> <4d4c0d4d-41b4-4756-5189-bffa15f88406@ti.com> <20210622205220.ypu22tuxhpdn2jwz@pali> <2873969e-ac56-a41f-0cc9-38e387542aa1@lucaceresoli.net> <20210622211901.ikulpy32d6qlr4yw@pali> <588741e4-b085-8ae2-3311-27037c040a57@lucaceresoli.net> <20210622222328.3lfgkrhsdy6izedv@pali> In-Reply-To: <20210622222328.3lfgkrhsdy6izedv@pali> From: Linus Walleij Date: Fri, 25 Jun 2021 01:18:43 +0200 Message-ID: Subject: Re: [PATCH v2] PCI: dra7xx: Fix reset behaviour To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: Luca Ceresoli , Kishon Vijay Abraham I , Lorenzo Pieralisi , linux-pci , Linux-OMAP , Linux ARM , linux-kernel , Rob Herring , Bjorn Helgaas Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 12:23 AM Pali Roh=C3=A1r wrote: > Lorenzo asked a good question how GPIO drives PERST#. And maybe it would > be a good idea to unify all pci controller drivers to use same GPIO > value for asserting PERST# pin. If it is possible. As we can see it is a > big mess. > > Personally I would like to a see two helper functions like > > void pcie_assert_perst(struct gpio_desc *gpio); > void pcie_deassert_perst(struct gpio_desc *gpio); > > which pci controller driver will use and we will not more handle active > high / low state or polarity inversion and meditate if gpio set to zero > means assert or de-assert. GPIO descriptors (as are used in this driver) are supposed to hide and encapsulate polarity inversion so: gpiod_set_value(gpiod, 1) =3D=3D assert the line gpiod_set_value(gpiod, 0) =3D=3D de-assert the line Whether the line is asserted by physically driving the line low or high should not be a concern, that is handled in the machine description, we support OF, ACPI and even board files to define this. I would use gpiod_set_value() directly as above and maybe add some comments explaining what is going on and that the resulting polarity inversion is handled inside gpiolib. Because of common misunderstandings we have pondered to just search/replace the last argument of gpiod_set_value() from an (int value) to a (bool asserted) to make things clear. I just never get around to do that. Yours, Linus Walleij