From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 715B51E32D5 for ; Fri, 2 May 2025 22:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746224644; cv=none; b=K3aaeARbq4yKJoZwvtxgpSKRwhkbXU55C97xHHb+iBPsfHRuc/gxTwIr2+gf6MSqNFM6xNOyYplXp4Gd/IY4RWQD+v2b/a0qaODiVqMRJ9xNfn0cGUwyiZ1oQhRsa3TQ5l4LHWJ1PgIg3+fpZEYBD84HwgkQqRb7mRzSXkF97XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746224644; c=relaxed/simple; bh=9oGtb8LG/zJ9IV5aGAUTJtLHWlo3X+qYmkiwfn7P33Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=exQ5kuO42etXT1WeDvJEIiAErX6OnDTu0n7xN+a6kV6/5n0jkPUHFXdEgcDtKW5rnecrgJsFuqox6+EYPb/0RxUlsnOLfWjSU/4XGwrwuZfYVrPcv4rdQ1wmWLeZXtiwKDvw/RZbavLIAR2+qGM9+iSGMc8NqmL0btWEu83yXvc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=E5ypLJeY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="E5ypLJeY" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 542KB5I5014494 for ; Fri, 2 May 2025 22:24:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= afxPROt7hH4766j71KaFflbvebcQVU71m/JE3EEC4iQ=; b=E5ypLJeY0KPHUK3l wNzEQM0UMh4H6y4Qfno8fU0TNHA1kq3hSa4LRRsoBgTNouorGCngKo2n2hM9IdD/ 6TXGi7udHG64q63vMAi5g5uaiWF1OX+imOervaN1SKgtWpQmZax4rJ+HJcy/jQhp Z8n9KmABCoPucq/uPSNiXemIqKxF8F5dl+Lh7IHCZ6rFzyUeXBrvMSMrdpqV7nxd ij/Rq5bAGeunYEO8ZOuv9beA0Zi+c8HJCpsM3TuR4qlbSkOf261qlAC7mXGSAAEK gx36j65LARWuovp7Wbh1XEfEP1+2cWf0zFakXnZtQzFNXNhAZ6BU8hbpMOh61wJT xDZTng== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 46b6u41f2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 02 May 2025 22:24:01 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-476783cbdb8so7384191cf.1 for ; Fri, 02 May 2025 15:24:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746224640; x=1746829440; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=afxPROt7hH4766j71KaFflbvebcQVU71m/JE3EEC4iQ=; b=o1e1oQ889RFJyj5sqZ/LCpnaxboCtwsRWG7iZ+uXg1GIU4CsoXe+yds4SzkIo3RSNc IYoEXuY5MucfZCdq43AgUR83w1+i9/h5SE04OfPL5f0RZvFziOXFzzPWwD2uNvONqLmG 0tNGyv90PfzxeSzfmYpaIksr+caAW8zmxG+O3ejE58bMHUqXiVLk+dF0ki4Qv9AkgkaW FFjIt79XcT7BQq3/mHrgEcKi8JfKcz3WTAGPVa34eMsMYwwFLECMOpIGDJyqBuJmZ3oD BbE2vMEaOL4cGNE9mZSq3/8TcZ413/LoXLWbR9lB8Ne7iIl5BG63/ca/3SxiA+jR6/yL tukw== X-Forwarded-Encrypted: i=1; AJvYcCV4dfa320VUYcD1ReC12r7wFKQos0HDenYQuVuqg9QgsYlgWrBEwpKCvtqugXjpQVx8e53nzoCLDRVjsEQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt3Qth+c5bSceZrdQns3HwcVcIyW9xMbLpc3lRM1GJH+yiYR0S CL4FtmCTasu8WJYCNYBEJXLbVi9UgHBfrr7/HvXaiQY7mSMgbiboD+jEHFbp9vnf8j6ETRFsrCe YvrQ9DUbvsMZ3Qf4C0EX49N3mTL7geM0KHFXpjLjqA7uESUVXaqb/snGzN91UhEA= X-Gm-Gg: ASbGncsQFW8xJhlAbAqN9eD7Zbg8ReS2FCQ9Xp40pabQ//wRO+LiKUGOFKHtkPb2++7 iuOrbMq6oBfiq4cTejIvOlaay0dWVytV8E9ioziw1CkVdzvx2vjhUNy7pBbTgOfxhqOihWHqYG/ cepqY70mmlJWTvDTMDpEiY8pjLBcfHZyifrsSJx25oGI/M9rUbRcWJVU/FDk5424KKvFZZeKX/k NNhJHxywc9JTF0rlbDKFXaL1t5IOWP8JFRt2uu6xGDtUOCV105JXe9eJBsD3rR3Vbvy6DseNj6U 0UyrGUMFAAoXG4MrP/FaGG6WBh8QcIKjQ5MMxPMohwZW9Lm1cSw+tbBHvZyDu1dlkVw= X-Received: by 2002:ac8:5810:0:b0:471:f437:2973 with SMTP id d75a77b69052e-48c32ebe60amr25411771cf.14.1746224640354; Fri, 02 May 2025 15:24:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXPCWKDkOFuSWQ3PbjHn9q2h9mjOhaANWaWDVj+vNMTlyz3oHQMt9ul4xUB3d6PJd+9q7Mzg== X-Received: by 2002:ac8:5810:0:b0:471:f437:2973 with SMTP id d75a77b69052e-48c32ebe60amr25411631cf.14.1746224639955; Fri, 02 May 2025 15:23:59 -0700 (PDT) Received: from [192.168.65.170] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad1891a3c53sm108782766b.56.2025.05.02.15.23.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 May 2025 15:23:59 -0700 (PDT) Message-ID: <8a763c70-adcf-4a14-bb68-72ddc61fa045@oss.qualcomm.com> Date: Sat, 3 May 2025 00:23:56 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 4/4] watchdog: qcom: add support to read the restart reason from IMEM To: Kathiravan Thirumoorthy , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Wim Van Sebroeck , Guenter Roeck , bod.linux@nxsw.ie, Srinivas Kandagatla Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org References: <20250502-wdt_reset_reason-v3-0-b2dc7ace38ca@oss.qualcomm.com> <20250502-wdt_reset_reason-v3-4-b2dc7ace38ca@oss.qualcomm.com> <2036ef2f-c7ef-4f42-858d-8d95c430c21a@oss.qualcomm.com> <68d280db-f7df-48c8-821d-f7d408c302ad@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <68d280db-f7df-48c8-821d-f7d408c302ad@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=Bv6dwZX5 c=1 sm=1 tr=0 ts=68154601 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=dt9VzEwgFbYA:10 a=n-kv2Co_dslhl88RD3IA:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-GUID: pArDJ2hYeJlVbiEqpHztQXDYhC_58sF6 X-Proofpoint-ORIG-GUID: pArDJ2hYeJlVbiEqpHztQXDYhC_58sF6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNTAyMDE4MyBTYWx0ZWRfX1sp8RK8mHqTF VmHNFo/ffBs6EchGzWkg9vV7dZI8fFJuvThL7kKOmDO8nx0X21AtWUEYnIqwl1lhkzfp21Y3/xQ mJoqWCavc82xyDHI9e87WEGvuYz7f0TQtxYOG3Vd9DhPqquyYavxvLHAbqRHkwWr60fvGEGhpSG ZROAG5QjVH6miVa/cAIPWP9A+slVt5Zo4Utx1N6nO1hTb3Cf+V/Gs4U6b4iXZ6+Nr+OOUpY/HPg EgJVWavS0qtZMZsqjifSGHnxCxsL3fDbrSiK9kkF/MNIh4J8gTIpiIKdcT1A7BodAtbCUtvZ9WJ jGFkkAkXUmzIjAtwvAPmQJ+XVRkCE3uMIGYQf/EmzAUk49mASh3ebvJKFIafZLjUNwt8KsUC6cy HNgqoWcPzFV+01MAjFgQon8/sJBi5YgeMr2KY7XiYYxLdzaKC4MM+N7mWowXjCLMmrxkvLuc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-05-02_05,2025-04-30_01,2025-02-21_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2504070000 definitions=main-2505020183 On 5/2/25 6:28 PM, Kathiravan Thirumoorthy wrote: > > On 5/2/2025 7:33 PM, Konrad Dybcio wrote: >>> +static int qcom_wdt_get_restart_reason(struct qcom_wdt *wdt, >>> + const struct qcom_wdt_match_data *data) >>> +{ >>> + struct regmap *imem; >>> + unsigned int val; >>> + int ret; >>> + >>> + imem = syscon_regmap_lookup_by_compatible(data->imem_compatible); >> Try syscon_regmap_lookup_by_phandle_args() and pass a phandle, see e.g. >> drivers/phy/qualcomm/phy-qcom-qmp-pcie.c & phy@1bfc000 in x1e80100.dtsi >> >> That way all platform specifics will live in the DT, requiring no >> hardcode-y driver changes on similar platforms > > > Thanks. I thought about this API but it didn't strike that I can use the args to fetch and match the value. > > I need a suggestion here. There is a plan to extend this feature to other IPQ targets and also support WDIOF_POWERUNDER and WDIOF_OVERHEAT cause as well. For IPQ5424, all 3 cause will support and for other IPQ platforms, we are exploring how to integrate WDIOF_OVERHEAT. In any case, can I define the DT entry like below > > imem,phandle = <&imem 0x7b0 >; > > and store these in values args[1], args[2] and args[3] respectively and use it for manipulation? If any of the platform doesn't support all 3, I can update the bindings and define the number of args as required. Let's call the property qcom,restart-reason and only pass the register value Because we may have any number of crazy combinations of various restart reasons, we can go two paths: 1. promise really really really hard we won't be too crazy with the number of possible values and put them in the driver 2. go all out on DT properties (such as `bootstatus-overheat`, `bootstatus-fanfault` etc. I'd much prefer to go with 1 really.. If we used nvmem, we could have a map of cell names to restart reasons, but we've already established IMEM is volatile and we shouldn't mess up the convention just because that subsystem has nicer APIs.. Unless we rename the subsystem to `fuses`, `magic-values` or something.. +Srini? :P Konrad