From patchwork Wed Jul 26 13:26:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 706686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD65C001DC for ; Wed, 26 Jul 2023 13:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234079AbjGZN02 (ORCPT ); Wed, 26 Jul 2023 09:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233585AbjGZN01 (ORCPT ); Wed, 26 Jul 2023 09:26:27 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDCBE2 for ; Wed, 26 Jul 2023 06:26:26 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fba8f2197bso10765985e87.3 for ; Wed, 26 Jul 2023 06:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690377985; x=1690982785; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XwjQCpCfOEJj4nimKSDJjPHZcz9ikZvmWQ7qOX3431M=; b=zT/i9uuRDt+yId4R1ojSpNSvcir6tRZadDAbV6Wny2zZu0Lyv3Wv+qbzRW5a8XiB4A ZvF2LIdzy8OE0XVEGVU0tDXtZjZQnJKlV+XxK/97TN3oTlKMkPy51JDAQxE8M8HhQfFL jRUDCgvwqMi+Cpd+6Ka9T7e9YiRY0rNwwFJphX4b8amOR6SUFJ8lCLiNzPEvVHtKSGP4 S+QwI73+2ZhZcQmEEYq1HzjiE8SCNEzQJRXDUyZdolOFo6Ai4jtgX7tTpwxTgIMkf09X sNBzxZdAgeutTn55bW9KECHSF6Sf9qzfIt2g65GJbCi5vNZrZcOvqhof8MDPwdS7CvOF UVOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690377985; x=1690982785; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XwjQCpCfOEJj4nimKSDJjPHZcz9ikZvmWQ7qOX3431M=; b=XSg5Ca1YWD3a+xXL0nENoaPFx7tBJ6baO4RwcXt9fD76V+O3fMC+cb/hdSWjWmLCJA VIwK5t/XNjne1wp1Qs3qvb/OS21rCKqq8qoIP7ydwylTz5Fp8Y6QCXOI60beMt7ZMsDt Fllp/PMTlB74Quabfd5r02DEJ5YgelGBkYemu/PmtZJ6jwcS5g2CtbJkRXP6kAVlnYCV aiHXxZC/N2WGV/Bo6DXRD9mGxNpz8lFIaIJR4g5sD2fqt+P/SSVOhTsFWFv3FAl98COb 0etW5I/RwHoWXeldN1Hu0IeI5RS4G7r0TJ2hIop8iYvGzbi0MWbD+K1v9s1m98hdiPAH rWqw== X-Gm-Message-State: ABy/qLbhcp4Wruf2bJErOVm4WM3p2lBZU1xyV3jCsR3vJMF3gJAqi1Bb r/muhdGj1/QV0RrtmTNx/jXrRQ== X-Google-Smtp-Source: APBJJlH/LmuLVACTSaYxROWypIaDANfYQnUj51ToYkVa4kNLyMfiM+WXzqvCURYfxtTMOueXEG0YTQ== X-Received: by 2002:ac2:47e9:0:b0:4fd:d08c:fa3e with SMTP id b9-20020ac247e9000000b004fdd08cfa3emr1296999lfp.42.1690377984838; Wed, 26 Jul 2023 06:26:24 -0700 (PDT) Received: from [192.168.1.101] (abyl59.neoplus.adsl.tpnet.pl. [83.9.31.59]) by smtp.gmail.com with ESMTPSA id q20-20020ac24a74000000b004fe08e7dfbdsm742265lfp.44.2023.07.26.06.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 06:26:23 -0700 (PDT) From: Konrad Dybcio Date: Wed, 26 Jul 2023 15:26:19 +0200 Subject: [PATCH 1/2] clk: qcom: reset: Increase max reset delay MIME-Version: 1.0 Message-Id: <20230726-topic-qcom_reset-v1-1-92de6d3e4c7c@linaro.org> References: <20230726-topic-qcom_reset-v1-0-92de6d3e4c7c@linaro.org> In-Reply-To: <20230726-topic-qcom_reset-v1-0-92de6d3e4c7c@linaro.org> To: Bjorn Andersson , Andy Gross , Michael Turquette , Stephen Boyd , Mike Turquette Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1690377980; l=566; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=3BR/u3fZ23sS3+cIHldabWhPszlrqMwlNCmlfPyu0J8=; b=Mn8YoTIjy0jBDF1F4mmrxLegHBGFymzW0x8yviOJWut/dGKoR7DuQtPkKRGA5V7MYFxpTQACp 2hzWsnFMoijAgoHUDZIvSRJ3l04idJiHatC6NuG1IqwsnnSRDCz5Ux9 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org u8 limits us to 255 microseconds of delay. Promote the delay variable to u16 to hold bigger values. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/reset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h index 9a47c838d9b1..fe0561bf53d4 100644 --- a/drivers/clk/qcom/reset.h +++ b/drivers/clk/qcom/reset.h @@ -11,7 +11,7 @@ struct qcom_reset_map { unsigned int reg; u8 bit; - u8 udelay; + u16 udelay; u32 bitmask; }; From patchwork Wed Jul 26 13:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 707143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D99EC41513 for ; Wed, 26 Jul 2023 13:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232108AbjGZN0c (ORCPT ); Wed, 26 Jul 2023 09:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbjGZN03 (ORCPT ); Wed, 26 Jul 2023 09:26:29 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6D2F7 for ; Wed, 26 Jul 2023 06:26:28 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fe0e34f498so1586323e87.2 for ; Wed, 26 Jul 2023 06:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690377986; x=1690982786; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FlYno703h9Rc07Q4o0xGriJ575A5cS8B+AAXSkAUxQ0=; b=u0gVsT2JW2shLoA3VJTEMT68XNaOEiMPGz0lsmF3Xn1zRArnR5Iellu+Yu3PdmWRTm IxwO+ywuyR5QWy8G2v2Li0dUNsH1z6Fp7kwBP301kLjlSMfbsS610P1c5shjPX/stse1 H1jf1MtER0NCWBFDg/fvxEq7Zzog5hpcTiwmuumR9pQEasSOJiGycTr0EuoU+ItXEkGJ +u+UY1uvuiAfzT41lNBJOW9IOCppqP6jLNGi/8shD+3JEvCA5WVVka8eparOOgSdAsws LsQPDchnI9IoJeYnjSX5wcu59UdrT1VfbWj9Ogpqo4AmDcdGumetwFywhaIw7cOXvcvo Bsqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690377986; x=1690982786; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FlYno703h9Rc07Q4o0xGriJ575A5cS8B+AAXSkAUxQ0=; b=WUAuQzGpfiNP5ztgL7RTiu6zUQTOPcygBC2FevPuS2hNGRtXgQ4xi/VTrcbtDEMSgn nYRa2Oxzv5L3LhfDKRVJi5ViQCoehjOSgQmUn98lLknRECk7VANId5L5PgfWBxDjb2QQ 4qA8aJd8BK5Yg+0FqdOceM8tEBR+PEBkgRQ8jFvL+Nbjntpd+sOhzf3GGK5dSvXC5+B8 6tF0dT5N04M61YSifhzdCbJp5ZFmjXAy5Ilmddyjx6K+e4OpqMU6WbIWap9Ew8nw1Opy 575UXlKVRebFO6As1dajcRNBZXozjJmDZ/k3PE1eO9MHNWRYxwJYuwaRV99iIpP0f5FK CLsA== X-Gm-Message-State: ABy/qLalkXZW1Poxlcpqp/0lvcpJ4Lt7VGWtu8k3HfEbJikZLnYM2VI1 /FvDx4ogqQhz1DvMxoE6INdwkQ== X-Google-Smtp-Source: APBJJlEa3UFWx5zArcinnI3/s7D0J7bfh/Ec4Ah/Tj9utH2dc5qQZS4SXEcZAZDog8vIU+UeWBAtZQ== X-Received: by 2002:ac2:5f81:0:b0:4f8:49a8:a0e2 with SMTP id r1-20020ac25f81000000b004f849a8a0e2mr1380217lfe.16.1690377986567; Wed, 26 Jul 2023 06:26:26 -0700 (PDT) Received: from [192.168.1.101] (abyl59.neoplus.adsl.tpnet.pl. [83.9.31.59]) by smtp.gmail.com with ESMTPSA id q20-20020ac24a74000000b004fe08e7dfbdsm742265lfp.44.2023.07.26.06.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 06:26:25 -0700 (PDT) From: Konrad Dybcio Date: Wed, 26 Jul 2023 15:26:20 +0200 Subject: [PATCH 2/2] clk: qcom: reset: Use the correct type of sleep/delay based on length MIME-Version: 1.0 Message-Id: <20230726-topic-qcom_reset-v1-2-92de6d3e4c7c@linaro.org> References: <20230726-topic-qcom_reset-v1-0-92de6d3e4c7c@linaro.org> In-Reply-To: <20230726-topic-qcom_reset-v1-0-92de6d3e4c7c@linaro.org> To: Bjorn Andersson , Andy Gross , Michael Turquette , Stephen Boyd , Mike Turquette Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1690377980; l=1045; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=3sxskWG1FiMzGN6odih/2AzgyX1UlY1CqV7tLRwSv/4=; b=saOq9jwbZrvjAwZ97NcbMwHI/ViisOkxLpymdQaHubISBRKSsBjABT2TlxD70zhxtbW37nY7H 7yxUvSV7wOhAYT6i2QpsmQex8EMcwjNG+8KGbr+FDpAO4oYeqoTm2os X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Based on the length of the delay (see: [1]), use the correct sleep/delay functions. [1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support") Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/reset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c index 0e914ec7aeae..928995c3f369 100644 --- a/drivers/clk/qcom/reset.c +++ b/drivers/clk/qcom/reset.c @@ -14,9 +14,15 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id) { struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev); + u16 delay_us = rst->reset_map[id].udelay ?: 1; rcdev->ops->assert(rcdev, id); - udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */ + + if (delay_us < 10) + udelay(delay_us); + else + usleep_range(delay_us, delay_us + 5); + rcdev->ops->deassert(rcdev, id); return 0; }