Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1380917rdb; Wed, 24 Jan 2024 13:28:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGH+vs6qE7CLCTxHeIpk4keLtKAXF2qqg69Zfcom2l0r/QfWFC1su3pGpeKvENuuBfHIbro X-Received: by 2002:a17:902:e5c3:b0:1d7:4d4f:db21 with SMTP id u3-20020a170902e5c300b001d74d4fdb21mr2130plf.112.1706131693481; Wed, 24 Jan 2024 13:28:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706131693; cv=pass; d=google.com; s=arc-20160816; b=im3q2dwDjaebU7qJpJ5kaHcxrqQHnx/o3g1Z90Y06jkfi2FsxxoVVOQVGoKGup1wOc ToRZL0kQoI/vcwUVzP5cLdgcH/w85IGdDkNKSQ/E1+6nmZpIA9M8dowyH4hJGV83z0kG +xcmZN4aflZX/WsVuZI4K8WvvThSFjfescERx/FCxO6uDVD9BV1HTwqXySGZ/fv7drC2 OZ4XUeb6bUWXMJ8ZKeLIcVGU7EtmFRk0L3xNXj13q31v2NWhUIVQvMaS5dLfg6962cbY cy3aDvydTV4qJ++ZH79XVwXzPoLDQoejlEMJjQNDtlHKo7RLbdRME0AFSoem1QjTAGnv IK7Q== 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=b5SzYBWThLP29YqBiKV1/oGuFwlfjpxBatfd0d5rA2w=; fh=yAFuMriCp/2kpAeJrE6X2wwAD6y24cczlgOPHYwkn04=; b=XEgJMHbwIR1jd+rX+9mP6oq8ucDKiKQx6oFHINnYxrR6naKaRrTGBoeU7JtBq45E0O 0HPAv4UatVmH+e/e3xIskzCLg8/6o+RuBVW/kTklJYZFMexs7fS+0VLcNSZ7U29PeZDw 8snzd1QRCmhMIfrws41k5hC9yOn2SaMq4+IJZ433rO4kaA4mYaYie6MJAL9f/kJRl4hr ggh2xUgrrHFhTqf+Dr2m/Sp9ReGPLUyz4CFhWmkgmrwxdnatGcjvHN3Z5tRdCiU3khhy QMaFizD/U7U3UbdzVUwvo6vOUNgV3LTNz/t+/Fctmcag2s8m+6jei1ngpWanoznMYhdp atrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=U76+FhmA; 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-37692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s20-20020a170902b19400b001d72da064b6si8375540plr.519.2024.01.24.13.28.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 13:28:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=U76+FhmA; 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-37692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37692-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B660287764 for ; Wed, 24 Jan 2024 21:27:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA8711353F4; Wed, 24 Jan 2024 21:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U76+FhmA" Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 D3B73811E4 for ; Wed, 24 Jan 2024 21:27:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706131661; cv=none; b=BkkJE1zptPMshNoDGyYN01vPHd+8ACym7nAB+j+GttB1mlqd34bvNAOBvlRxUdyO8QGmuHDG2yeqglbWSIWs78FDbXy1Ko9NVRt1UitGrHZ1m2bwPoDw+anZORjdHAc23YlMADVWutRJPjXdf5cF+vVe9ROvYN2ZXsIN8+C4G5Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706131661; c=relaxed/simple; bh=LWNwA7ukVrj+d7v6MIv5EzJo8y49TqMJStEePkkmQ/0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GZw8MOlu6gUbr6EAbza/ooOD4U3ag7JzSt/eafEBKDgS25VzaO/pEfe7+8kbOP99ZW97bNAtY+LxdCm7dU6Kn9LkAgi2douRRcbvQ8z6tb/BwXHO0Os2TRIZEAODwz77u5CsEzehzk+9gxynRDa8xySfJp6sTiyBJ9Lu8S/sP48= 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=U76+FhmA; arc=none smtp.client-ip=209.85.160.169 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-f169.google.com with SMTP id d75a77b69052e-428405a0205so9991cf.1 for ; Wed, 24 Jan 2024 13:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706131658; x=1706736458; 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=b5SzYBWThLP29YqBiKV1/oGuFwlfjpxBatfd0d5rA2w=; b=U76+FhmAASPMcI/XGIlJnnHiDExFE9LQD9Jv5/uUE9L0CSvuU3S9+jhWgTPvfnD9wu xCDOplcZxQ6KhXbQexJ3JvTpZBugujfaflg/K6aga2gEFG8oLoInRcCG5sz/C2c7NsdW x4k9k2Ajfi3GCWUMVsylWyc2ooUySsCciXJmku2fms5AVl52NKotRQAAtc1JXspfJVCC Wkjt5siDjbagraCGAEBNMuvWEbnqoLGTQ3SLGUCGeI72fydKQeXuf7MTL+Xi2LVtLjSp AMKIWJGxNgzjykv1M38pKeclZv7NnSvn6Pm2tsSKwbARnFppAy2hbHDtUArYkS0VYfHg IwRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706131658; x=1706736458; 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=b5SzYBWThLP29YqBiKV1/oGuFwlfjpxBatfd0d5rA2w=; b=hB7MO6YwHdm5OwQLaPbbBrcHv5SfVfe/2dOTP/emV46Qdw29IGCsPslJ9ySfLocVNQ eIuzcqG/kTAUjhOLEHxW/OYvbBcbN6UsAsGllHBsoSgmEs8s7ibCMN/3VMj8Qm7AJYCe lbQCi1/1kTdCm42L/IN34+DyU6Jyj9qTx1lwBxIVTShvIaA+4h/C1PUycXPstzC56h/2 id0LTagfqTXa9f7m3G5wTQF6igAi/87kQhUofFQtiILA3ffeNzon6NdF0fpx/TMYwc2X VXmTDve+B+T24egpuO+zqa+6zYH6BOnpQN2rXsix8U+PcZ+GsGfH2EghOU9foEQfoGIO VVpg== X-Gm-Message-State: AOJu0YzzK7Y625exleWz7SaxBqshPqI4v/by5+l9Gr8wFFRkgaF54vyp LdRI+581Nh8/70rDBGVL0ixzXLjaFOJF5IwkXnyoWl/cNuW5klg1dabcBrBMVx6L7nxxXziWv81 2zZqwuqpZot3CKhQJer6KLdq0YcQ1Z27givr9 X-Received: by 2002:a05:622a:229e:b0:42a:5fe1:e8d1 with SMTP id ay30-20020a05622a229e00b0042a5fe1e8d1mr67647qtb.4.1706131657624; Wed, 24 Jan 2024 13:27:37 -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> In-Reply-To: From: Saravana Kannan Date: Wed, 24 Jan 2024 13:27:01 -0800 Message-ID: Subject: Re: [PATCH 3/9] watchdog: s3c2410_wdt: update to use new exynos_pmu_*() apis To: Krzysztof Kozlowski Cc: 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 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 register\n"= ); > >>>>> else if (rst_stat & BIT(wdt->drv_data->rst_stat_bit)) > >>>>> @@ -698,14 +699,6 @@ static int s3c2410wdt_probe(struct platform_de= vice *pdev) > >>>>> if (ret) > >>>>> return ret; > >>>>> > >>>>> - if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { > >>>>> - wdt->pmureg =3D syscon_regmap_lookup_by_phandle(dev->= of_node, > >>>>> - "samsung,syscon-phand= le"); > >>>>> - if (IS_ERR(wdt->pmureg)) > >>>>> - return dev_err_probe(dev, PTR_ERR(wdt->pmureg= ), > >>>>> - "syscon regmap lookup fa= iled.\n"); > >>>> > >>>> > >>>> Continuing topic from the binding: I don't see how you handle probe > >>>> 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 somethin= g > >>> 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, becaus= e > >> 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 on > > the PMU. > > > > However, I think we should move to a generic "syscon" property. Then 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" property. > > 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, "syscon"); > > } > > > > 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, because > there is no such thing as syscon in any of hardware. Then why do we allow a "syscon" compatible string and nodes? If the "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. 143 bespoke properties all to say "here are some registers I need to twiddle that's outside my regmap" doesn't seem great. > > > > Side note 2: > > > > 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 are > > platform drivers. And the exynos PMU device lists both the exynos > > compatible string and the syscon property. Is it purely a link order > > 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 drivers are made into modules this is going to break. This is terrible. If you want to have a modular system, this is going to throw in a wrench. -Saravana