Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp3306047rdb; Thu, 7 Sep 2023 10:29:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4JPPF3ZdDg87xVg97EqW4PeF66md+6//BfqvHnGADAoTaDE0tsDdayThiJCDEKxdD+WdC X-Received: by 2002:ac2:52a1:0:b0:501:b1c0:5d5 with SMTP id r1-20020ac252a1000000b00501b1c005d5mr69352lfm.3.1694107780974; Thu, 07 Sep 2023 10:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694107780; cv=none; d=google.com; s=arc-20160816; b=u5w9c/NhYx6L5Nglan+eQREyn572TpYOlgPoshY3ulXPmnHe6joOjzd0zV+XUkyK1g L0ndN9P5G4w598hVMMklbn+Gtmnrs/Wp52YK28kqyyX2Yq0PqNSQbpd94RfMEd+ByYnm MKIKxcnrXG4AxVwllONoLkr+XmTkEoaFGmSlwg/qehUllc+VURQ1qo8E1p/n+LaxKjET 4+Ytq5+PxMODJ0D8ETrWxYFKiiV8JAgxZ15qa2WeYS5dRkvpppTJa6/yBWpew43gwOfz iDRdMS04LrPXrOnWcRzdyFT1qlksNqv5h0SdNmIkQmLqii41NAOb44ygynB2AtuK3t8t XlvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SokCF/DvWWAifxGjzkU+U9jQ6gV/TIVPJhJEjnAym6E=; fh=T8Qoi+jo2u6JXAAuwOAp22FjQfQ9ISAPb2T+ybmaMiQ=; b=Mi4bMLFZeVOTV8qQCmv9/mv12WLnay7IDt3Fgw5sYC2hNftORSeujsEhwRIT11Mjpe ITK6gXQAZyBN/QEx8O0awxUkBFaqQyzmGwG8J8SGPhb10ydrqFIwmlldb5+L2O/gMLcw VtujrkgBN3RcKqGVVvWio/VDxihK6mFayXxhqumqRPCkpRm8mgGlWZ/ew9YVLKhFXUIR M9OLczblSxb/rFtSxFP39jC7SB+4Bhe5qn9TRNe5IBMIqaJ6KyxKgl73mvwWNfpMKrl0 J0w4DV8U/zZ7QwuSzdyFCcx/mEjW8w/xeF2JEOUSsEk5PqZy2I0VYgQVMQPqZHFPcdYm zhLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020aa7c448000000b005222c07f612si32400edr.496.2023.09.07.10.29.14; Thu, 07 Sep 2023 10:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbjIGQIv (ORCPT + 99 others); Thu, 7 Sep 2023 12:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239108AbjIGQIB (ORCPT ); Thu, 7 Sep 2023 12:08:01 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6C515211C; Thu, 7 Sep 2023 09:01:04 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 4B3F58050; Thu, 7 Sep 2023 05:54:52 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dhruva Gole , Greg Kroah-Hartman , Keerthy , Kevin Hilman , Nishanth Menon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart wake-up Date: Thu, 7 Sep 2023 08:54:41 +0300 Message-ID: <20230907055441.19476-1-tony@atomide.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The uarts should be tagged with SYSC_QUIRK_SWSUP_SIDLE instead of SYSC_QUIRK_SWSUP_SIDLE_ACT. The difference is that SYSC_QUIRK_SWSUP_SIDLE is used to force idle target modules rather than block idle during usage. The SYSC_QUIRK_SWSUP_SIDLE_ACT should disable autoidle and wake-up when a target module is active, and configure autoidle and wake-up when a target module is inactive. We are missing configuring the target module on sysc_disable_module(), and missing toggling of the wake-up bit. Let's fix the issue to allow uart wake-up to work. Fixes: fb685f1c190e ("bus: ti-sysc: Handle swsup idle mode quirks") Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -1097,6 +1097,11 @@ static int sysc_enable_module(struct device *dev) if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_SIDLE_ACT)) { best_mode = SYSC_IDLE_NO; + + /* Clear WAKEUP */ + if (regbits->enwkup_shift >= 0 && + ddata->cfg.sysc_val & BIT(regbits->enwkup_shift)) + reg &= ~BIT(regbits->enwkup_shift); } else { best_mode = fls(ddata->cfg.sidlemodes) - 1; if (best_mode > SYSC_IDLE_MASK) { @@ -1224,6 +1229,13 @@ static int sysc_disable_module(struct device *dev) } } + if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) { + /* Set WAKEUP */ + if (regbits->enwkup_shift >= 0 && + ddata->cfg.sysc_val & BIT(regbits->enwkup_shift)) + reg |= BIT(regbits->enwkup_shift); + } + reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift); reg |= best_mode << regbits->sidle_shift; if (regbits->autoidle_shift >= 0 && @@ -1518,16 +1530,16 @@ struct sysc_revision_quirk { static const struct sysc_revision_quirk sysc_revision_quirks[] = { /* These drivers need to be fixed to not use pm_runtime_irq_safe() */ SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff, - SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, - SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), /* Uarts on omap4 and later */ SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff, - SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff, - SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47424e03, 0xffffffff, - SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE), + SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE), /* Quirks that need to be set based on the module address */ SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff, -- 2.41.0