[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f3a632e0-338f-4704-a33c-472a5197d8d5@oss.qualcomm.com>
Date: Fri, 11 Apr 2025 11:04:30 +0530
From: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
To: Krzysztof Kozlowski <krzk@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley
<conor+dt@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-watchdog@...r.kernel.org
Subject: Re: [PATCH RFC 5/6] watchdog: qcom-wdt: add support to read the
restart reason from IMEM
On 4/9/2025 12:33 PM, Krzysztof Kozlowski wrote:
>> +static int qcom_wdt_get_restart_reason(struct qcom_wdt *wdt)
>> +{
>> + struct device_node *np;
>> + struct resource imem;
>> + void __iomem *base;
>> + int ret;
>> +
>> + np = of_find_compatible_node(NULL, NULL, "qcom,restart-reason-info");
>> + if (!np)
> That's not how you express dependencies between devices.
As I mentioned in the bindings patch, I leveraged this from the
qcom_pil_info.c[1]. I shall use the syscon_regmap_lookup_by_compatible()
function.
>
>> + return -ENOENT;
>> +
>> + ret = of_address_to_resource(np, 0, &imem);
>> + of_node_put(np);
>> + if (ret < 0) {
>> + dev_err(wdt->wdd.parent, "can't translate OF node address\n");
>> + return ret;
>> + }
>> +
>> + base = ioremap(imem.start, resource_size(&imem));
>> + if (!base) {
>> + dev_err(wdt->wdd.parent, "failed to map restart reason info region\n");
>> + return -ENOMEM;
>> + }
>> +
>> + memcpy_fromio(&ret, base, sizeof(ret));
>> + iounmap(base);
> All this is wrong usage of syscon API, missing devlinks, messing up with
> other device's address space.
I shall use regmap_read() instead of memcpy_fromio().
Powered by blists - more mailing lists