Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp348166rdb; Thu, 25 Jan 2024 18:24:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjik3/gvmge6k+/BIwLAYesmQ2HM/Nbhwy9ZEXSN0M7LzcaGKDupCnjYK0ZG7wIn8PSwMq X-Received: by 2002:aa7:da54:0:b0:55c:92f4:4754 with SMTP id w20-20020aa7da54000000b0055c92f44754mr259806eds.8.1706235880217; Thu, 25 Jan 2024 18:24:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706235880; cv=pass; d=google.com; s=arc-20160816; b=KCnSikEGT/dMrLLGnZ/WRJd1O0v1je4OX4CmsJtU/mI95P/js0xmS/09I8c7dDKMMo McigPIPKZ3aOBg7xLj3OG+dfJqbIVDFUKlzUtBd8DRjcGmrNK8RNzJ9b6dPP1U5wHCPc PQirVc2/0iv0H0O66q89MSaFzXz6BmHq3bW4NkPIXf9Z5fD0D5kVvWjnSqVxfe0iYT+t yJ2/5P727VgjjiYYNVe/bhxNowtUQVUmJoHhGbF5p8mmFMsH5MmZXoP1G9ZcT/DfK7I6 7v/IZXh+NfPj8AuGzN3cLKQlQGp/lxSlYPSbLAM/oNPtxusqgpf+G07cmeQH7khnuA1B CWvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=BcanplUuigeG7+SyQESZ+PLtXFKVvk0gBTooHhSHHRc=; fh=l8UsyrYXNWixN/C6Ywac2THSG3ERGV8tkQc3O2nVDxg=; b=y0wMfbKhBTdecONAcdAzn96usyFYfhyA8e9WdibwiKrkFET6gTyxPsujSBttn3LBXp f+9hrv2wrYijErVN+C8A7ZAXvcPHNrqNJDDtq/9uuDFo890EAJtAqgy3R92FFAZivXfk m56n4bNmQ9PTUVFXzaWABRzE4PUZJnZBrJoOEkygE7qUxMO4ZXI4Quhm3b6ghyhgpPi1 uvrbk7ptBCIeXx6KjN1+VsCHOsBk/oU2L0Swgu/W4i6QsvTFgTQr2mt/zmNQgJugBLGD nXqriFnlJdHCmKvj3BnN3DatOvEn/ivRehVh+G6tyB19cy9lhp8+m//ChaHQGEk+i0ze Cvbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=N29fNl8B; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-39539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j4-20020aa7de84000000b00559e8d332fdsi134327edv.467.2024.01.25.18.24.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 18:24:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=N29fNl8B; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-39539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9511C1F25157 for ; Fri, 26 Jan 2024 02:24:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 447A68F44; Fri, 26 Jan 2024 02:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="N29fNl8B" Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DC888831 for ; Fri, 26 Jan 2024 02:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706235869; cv=none; b=AlZD7CtAyq7dSJ1nh9im2dXWWAWhHqSLLzCylbpeMJJC8Ryv1GoMkrWcuu/OzyIbUQ65QZVL5+qTuwELgpf0jy+M5KKMbv5rVXcuWvjeJXGd5Wqzg/fwpTe1frqJNkn31yWoRL5YO9LrMA6l2Go4HkhG5yQjyzLDWyuWVpOKVgo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706235869; c=relaxed/simple; bh=U+sljIPjwTGEa/e8pcd5Zj0VJm9xVGm61FMKNNTG6JQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WbjcA/lbbwjkQVYtXs1vEZsUqD7AjhQdqRvVKFS2drKCzTzewirfEvoZWMgMjNyQJC1WUCFFlRCF6gI7OfvzsgJPpsYA+cwq4Eu36ihQ2wy8Z9rW4RY3Xs27X85mj7IXzXX/nEOWyASv9qgLVRgoGs2/hmhVQ7KA8EvjTo9iuhU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=N29fNl8B; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-42a7765511bso58731cf.1 for ; Thu, 25 Jan 2024 18:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706235866; x=1706840666; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BcanplUuigeG7+SyQESZ+PLtXFKVvk0gBTooHhSHHRc=; b=N29fNl8BZqCUddj3zBlELxpAoJFEg03dbCfE3dvDVtnH6uA8f+/u+rqcFG9GUorT4k DgE+2m3+NlK2dspPX/nKvtxMxi/JEbOLnL+J1RYMHdBZppoyRes3Y3OD05lin9+IQQhZ KWTaclHrIUEjDYCqC8CbTwZWhmUyPSTTTD3xJxxeBPTgmDIRtdFEpbxeq1kDLi6GtPYi OT9W4HugRWExZipyz+JE5Qfy5JjgPXCgZgWjjpaA6gRa4+su02Aph9zDP5QzEW/m8Ulv hvvGKRV71aAqECSBU6n0UEMl/HMXxjoQmrGXrJfMlUV70utelXZnJGjZRIu+rIkjatTX ZZzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706235866; x=1706840666; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BcanplUuigeG7+SyQESZ+PLtXFKVvk0gBTooHhSHHRc=; b=DfnHlPZl5OzeYU7fCgfZtbIjCh7ynADslBEOl3/HKsR5s8P8MAyVqcmix8yb0altQa g/uxAL4kx9eLy1tq7VjNn+hlI2yewoqICsUWgvmmTnnn9aiM5EKbBIqcuomFte8XBTyc /tL498w3iBHnMqBDxd+cDrRA8eURcYPHxbVkzZu6hqSvOFMHnYsc5BV0iNJb25p2L+Cz Tvff6P26I33A4SPM1cR5YKGvPyx1iuUMYtd8UbiIDWs4NHC+VO3/W8iWY6V0ysHv+9db wrFIHxIbfGECymzKqgHr7QYOgV+4dBCi6hVyBSp9wq3A4C47ew6kqP2uaCEb0Ap33maV Fcpw== X-Gm-Message-State: AOJu0YzbX7m8sqnp5KFOHpPKYOgSjnWCbj6XW0dbf61qVPznme9kwk1M SG3lWmbBsKpqGI4K1JAXAHXEN94CQls0wa+GAPZJOtk92Kmkgkh+asKSia/KLHeamMMsSHyxo1D r535IVz8tYCGMMXjfUYooqef9dinxF1h+/sR3 X-Received: by 2002:a05:622a:1c0d:b0:42a:1b6f:ec97 with SMTP id bq13-20020a05622a1c0d00b0042a1b6fec97mr128440qtb.26.1706235866248; Thu, 25 Jan 2024 18:24:26 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240122225710.1952066-1-peter.griffin@linaro.org> <20240122225710.1952066-4-peter.griffin@linaro.org> <6c72a521-1048-42eb-ac74-d8f718a90723@linaro.org> <04411aaf-6f2c-4f43-83b4-aa0741ccd25f@linaro.org> <20240125114606.GA1327902@google.com> In-Reply-To: <20240125114606.GA1327902@google.com> From: Saravana Kannan Date: Thu, 25 Jan 2024 18:23:47 -0800 Message-ID: Subject: Re: [PATCH 3/9] watchdog: s3c2410_wdt: update to use new exynos_pmu_*() apis To: Lee Jones Cc: Krzysztof Kozlowski , Peter Griffin , arnd@arndb.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux@roeck-us.net, wim@linux-watchdog.org, conor+dt@kernel.org, alim.akhtar@samsung.com, jaewon02.kim@samsung.com, chanho61.park@samsung.com, semen.protsenko@linaro.org, kernel-team@android.com, tudor.ambarus@linaro.org, andre.draszik@linaro.org, willmcvicker@google.com, linux-fsd@tesla.com, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 25, 2024 at 3:46=E2=80=AFAM Lee Jones wrote: > > On Thu, 25 Jan 2024, Krzysztof Kozlowski wrote: > > > On 24/01/2024 22:27, Saravana Kannan wrote: > > > On Tue, Jan 23, 2024 at 10:27=E2=80=AFPM Krzysztof Kozlowski > > > wrote: > > >> > > >> On 24/01/2024 04:37, Saravana Kannan wrote: > > >>> On Tue, Jan 23, 2024 at 10:12=E2=80=AFAM Krzysztof Kozlowski > > >>> wrote: > > >>>> > > >>>> On 23/01/2024 18:30, Peter Griffin wrote: > > >>>>>>> dev_warn(wdt->dev, "Couldn't get RST_STAT registe= r\n"); > > >>>>>>> else if (rst_stat & BIT(wdt->drv_data->rst_stat_bit)) > > >>>>>>> @@ -698,14 +699,6 @@ static int s3c2410wdt_probe(struct platfor= m_device *pdev) > > >>>>>>> if (ret) > > >>>>>>> return ret; > > >>>>>>> > > >>>>>>> - if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { > > >>>>>>> - wdt->pmureg =3D syscon_regmap_lookup_by_phandle(d= ev->of_node, > > >>>>>>> - "samsung,syscon-p= handle"); > > >>>>>>> - if (IS_ERR(wdt->pmureg)) > > >>>>>>> - return dev_err_probe(dev, PTR_ERR(wdt->pm= ureg), > > >>>>>>> - "syscon regmap looku= p failed.\n"); > > >>>>>> > > >>>>>> > > >>>>>> Continuing topic from the binding: I don't see how you handle pr= obe > > >>>>>> deferral, suspend ordering. > > >>>>> > > >>>>> The current implementation is simply relying on exynos-pmu being > > >>>>> postcore_initcall level. > > >>>>> > > >>>>> I was just looking around for any existing Linux APIs that could = be a > > >>>>> more robust solution. It looks like > > >>>>> > > >>>>> of_parse_phandle() > > >>>>> and > > >>>>> of_find_device_by_node(); > > >>>>> > > >>>>> Are often used to solve this type of probe deferral issue between > > >>>>> devices. Is that what you would recommend using? Or is there some= thing > > >>>>> even better? > > >>>> > > >>>> I think you should keep the phandle and then set device link based= on > > >>>> of_find_device_by_node(). This would actually improve the code, be= cause > > >>>> syscon_regmap_lookup_by_phandle() does not create device links. > > >>> > > >>> I kinda agree with this. Just because we no longer use a syscon API= to > > >>> find the PMU register address doesn't mean the WDT doesn't depend o= n > > >>> the PMU. > > >>> > > >>> However, I think we should move to a generic "syscon" property. The= n I > > >>> can add support for "syscon" property to fw_devlink and then things > > >>> will just work in terms of probe ordering, suspend/resume and also > > >>> showing the dependency in DT even if you don't use the syscon APIs. > > >>> > > >>> Side note 1: > > >>> > > >>> I think we really should officially document a generic syscon DT > > >>> property similar to how we have a generic "clocks" or "dmas" proper= ty. > > >>> Then we can have a syscon_get_regmap() that's like so: > > >>> > > >>> struct regmap *syscon_get_regmap(struct device *dev) > > >>> { > > >>> return syscon_regmap_lookup_by_phandle(dev->of_node, "sysco= n"); > > >>> } > > >>> > > >>> Instead of every device defining its own bespoke DT property to do = the > > >>> exact same thing. I did a quick "back of the envelope" grep on this > > >>> and I get about 143 unique properties just to get the syscon regmap= . > > >>> $ git grep -A1 syscon_regmap_lookup_by_phandle | grep '"' | sed -e > > >>> 's/^[^"]*//' -e 's/"[^"]*$/"/' | sort | uniq | wc -l > > >>> 143 > > >> > > >> Sorry, generic "syscon" property won't fly with DT maintainers, beca= use > > >> there is no such thing as syscon in any of hardware. > > > > > > Then why do we allow a "syscon" compatible string and nodes? If the > > > > To bind Linux drivers. > > > > > "syscon" property isn't clear enough, we can make it something like > > > gpios and have it be -syscon or have syscon-names property > > > if you want to give it a name. > > > > This could work. > > I'm not opposed to this idea. The issue you'll have is keeping the > kernel backwards compatible with older DTBs, thus this solution may only > be possible for newly created bindings. More than happy to be proven > wrong here though. You are right about backwards compatibility. Technically, we might be able to fix up the DT at runtime (by keeping a list of those 143 property names) to maintain backward compatibility, but I'm not suggesting that. We can leave the existing ones as is, but we can at least use the new property going forward to make dependencies easier to track and handle -Saravana > > > >>> How are we making sure that it's the exynos-pmu driver that ends up > > >>> probing the PMU and not the generic syscon driver? Both of these ar= e > > >>> platform drivers. And the exynos PMU device lists both the exynos > > >>> compatible string and the syscon property. Is it purely a link orde= r > > >>> coincidence? > > >> > > >> initcall ordering > > > > > > Both these drivers usr postcore_initcall(). So it's purely because > > > soc/ is listed earlier in drivers/Makefile than mfd/. And as soon as > > > > Oh... great :/. > > Agree. > > Even using initcalls for ordering is fragile. Relying on the > lexicographical order of a directory / filename structure is akin to > rolling a dice. It would be far nicer if you are able to find a more > robust method of ensuring load order e.g. dynamically poking at > hardware and / or utilising -EPROBE_DEFER. Let me dig in to see if all the existing examples of listing syscon in compatible AND have a different driver that needs to probe it always list syscon as a secondary compatible string. In that case, we might be able to make the syscon driver only match with the device it it's the first entry in the compatible string. -Saravana