From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 C413B1F4C87 for ; Wed, 13 Aug 2025 20:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755116440; cv=none; b=C+hlK1RNRKzFmQ/o1tIqkn2qjl0gU0O3t1MNTpXDQIuCyATRcOYUWVbNgJBBEijKIUr1xplQxdmsxPZ2vaJICmR4LgYadj1E6zeJfmIPns4HMuGORZg0aYznZnDwA9kTrhSVMD+aYPv74hvaUDQrxFaoneePswVkfNEGGSH0MJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755116440; c=relaxed/simple; bh=rR+D3tBr5Y7TWuY2UOSpzkXUuslrs0FnyhVARRKHYQU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=quhwLKqv3uqpu+VvH0qG4foeeKkzoL/mx7L4g0hH4jApky5BaIZKa41dxe5nkuE9fHzsB53JKxaexHG+rzOJ+dfbO478oF8LzbkTU1z8sVTQAL0gLNTWYoEw6JFCKVhgWSgZZ023ix6h27dlOJShueUnq7+p2+Odlk1xa6OIKh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=pPr8ULQQ; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pPr8ULQQ" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-45a1ac7c066so1773475e9.1 for ; Wed, 13 Aug 2025 13:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755116437; x=1755721237; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=F/1t3EFEgXHUBAHB72RnZ06wSpjDj+54/Frk/ThDsww=; b=pPr8ULQQFQFl7vanrN6bHhHRWjrHy2Kga2slWZ+ikhD8zspOIiKIgD/6M8YEl29Tek yjBNHJU7GqDsfpPU7gE/mKP5oZM3IZNkjm2w6M/APudhBp4qp61Fy6tLiddDdltFrL0Z s2Z5z45BK0p2c3JYdv+CwwtAO8T3DO+VLVynnjUGI0trR0NvZvHDxymyfBrqjkS1nRhq S3AeOMSca7UsNMV532vvEWOYzZX7XWbLPBuynyPC18J4VHFWV84G2P4G1Y/q4xm4pmp+ GKJSPFT9l9CsLwERm8+vsp6DVQmxVLU4RHy5eNTtJxBo1zNP3BmJJB1uhW1hm4gN6fAG GVdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755116437; x=1755721237; h=content-transfer-encoding:in-reply-to:content-language:from :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=F/1t3EFEgXHUBAHB72RnZ06wSpjDj+54/Frk/ThDsww=; b=Y3GnqkmXJ5BkF5WIXttO4A/FsYhXlOFhtG0QO7KQmjOn9p468uDI42FYIvRe+Sh6bd cHOayJsIiCoP6Xh4YcJiTIeTMVcsLN2PUANBC9eddJy8fAmq5Rf4C61HSYbEtX0w0dBa Sv1S2ULL8aKPwFZguaHfy9JaVqgXjnK+bjsrurGF7KOOPx0fSG+NJKSGJLQ6tKuxymcX jTHMC0LrDwrWRXiDBtBk4kDsdPzj+jLdHrXtOYpQR++i6WgxxdLR5UoW0Z9vL/Khm8l0 v3rwnmsVraR97AEMYHc/AAXGqd9lIB14yzcNomAoPzo0NSwcj6ZSZhAji9VxuOkXR/M0 YKlw== X-Forwarded-Encrypted: i=1; AJvYcCUcRCNrOqpylTTHBqfFtMfjiGevOYZxLtTxm5CDRFu1knLsNoEH6QHJ4M7H3My2g8mGdEIQJyG7xiBgrWU=@vger.kernel.org X-Gm-Message-State: AOJu0YwUY41s6tbFYB/LGvkfOXlv62cCiFcPhBJJ4H2l1Ezomj7210qa 8hLLBQil572b5CGa1NbPa6ABOWUHBkV5Pm6rjn1OhiTl9NWpOQ4iMf+NgT1iqD/xwDM= X-Gm-Gg: ASbGncvUmOUaTnvGiODZu2KPex2qmbnrz4VYXrw0C8Q71fGdzPKvNvoTADOloqqrZ1k oyCrkeIbazLdMUZFIp4uvD51CMLpIV6/PZSwLUpXVazL82Mc+EeIIy7+eDOrqEkoIGy2dgqkugU Dvx4mLiYBZ2F8n+iDW62Jij36h3FmD25jQE2yxiKopA4wusjgLUM23hQ5A0WPfcQJk2U6CQbFzE 2ZRmAGXDmgqb/bEDvoorCuFHXSgd1Nou1tZCClc0RL59orqRRJum6HvJvS4n51WtINhYK2f0ijd km7T0E/9dHEUjF3iWe6MnUtCFiVY5XRC4kZxIn6q4/TTNf40Oc6UevhYib+8cVMleIxWT+wx7W2 wiTmhdaG7wcuKilhJ6J0048vJZNglvrjTE5TNaznitrjmRy5NS8SXGpnHkCNR0oU= X-Google-Smtp-Source: AGHT+IElNKXelLAOHt8GQdvDS1nqHvpRfu2/IblCpP/yU0lQ3cWvxbEeQ3xIecHM4pnAO9YWIbdQzQ== X-Received: by 2002:a05:600c:8283:b0:459:d9d5:7f2b with SMTP id 5b1f17b1804b1-45a1b7bf687mr343085e9.16.1755116436947; Wed, 13 Aug 2025 13:20:36 -0700 (PDT) Received: from [192.168.0.35] (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b915deec6bsm4945531f8f.7.2025.08.13.13.20.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Aug 2025 13:20:36 -0700 (PDT) Message-ID: Date: Wed, 13 Aug 2025 21:20:35 +0100 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 v2] media: iris: vpu3x: Add MNoC low power handshake during hardware power-off To: Dikshita Agarwal , Vikash Garodia , Abhinav Kumar , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong References: <20250813-sm8650-power-sequence-fix-v2-1-9ed0fc2c45cb@quicinc.com> From: Bryan O'Donoghue Content-Language: en-US In-Reply-To: <20250813-sm8650-power-sequence-fix-v2-1-9ed0fc2c45cb@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 13/08/2025 08:53, Dikshita Agarwal wrote: > + /* set MNoC to low power */ > + writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); > + > + do { > + value = readl(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS); > + > + handshake_done = value & NOC_LPI_STATUS_DONE; > + handshake_busy = value & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); > + > + if (handshake_done || !handshake_busy) > + break; > + > + writel(0, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); > + > + udelay(15); > + > + writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); > + } while (++count < 1000); So if this loop executes 999 times but succeeds on the 1000th try, your test would fail because your final write never gets evaluated in a subsequent loop. Wouldn't this be more logical like this do { /* issue command */ writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); /* wait for command to take effect */ udelay(15); /* read back status */ value = readl(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS); handshake_done = value & NOC_LPI_STATUS_DONE; handshake_busy = value & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); if (handshake_done || !handshake_busy) break; /* power down? the mnoc */ writel(0, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); /* Let that command take effect ? */ udelay(15); } while (++count < 1000); That way you exit the loop with the mnoc state in a known state, instead of as your loop currently is perhaps having succeeded but incorrectly signalling failure. Also why 1000 ? Thats 1000 x 1.5 microseconds - 1.5 milliseconds potentially in your submitted patch now nearly 3 milliseconds assuming the power-down command similarly requires a grace period. Please at least fix the loop so that the last power-on command should it succeed at the termination of your loop can be captured. > + if (!handshake_done && handshake_busy) > + dev_err(core->dev, "LPI handshake timeout\n"); --- bod