From patchwork Tue Oct 25 16:54:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 13019561 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8A07C04A95 for ; Tue, 25 Oct 2022 16:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pXuXncz7Sdv+9YYM/NWWG04aHmeBweZkX4eggVaVshE=; b=WjaizvXcU8S2Ia ynHEywW2yzwnCk6MdFkaq2Um99BBhxJm6E3uj+oCRwv06HzD3sVWS/pp1REwWsAPIk+YSB6WcfXlE eRO/nz93rPo77PvIihAPn8Yr4yGRgF+MGNHLpe04+PnnSFHATEQwta10OvurF1FKAAMlijAgOeAfQ JPO+nwY91j9YwH5T6VzVp1dVovnV5p2Ok+BLAJ/79So3n8PgT2x1WVXY04DbS+PgaWdgEHvvA72J/ 4Tfz0sah2ioOE3vhUse7fyw1vSgdApQsBSRrI8Ag+U/JJuhm8S5xjJ+Nx6dSc6+o4t/B71hYJVV4E 0WLr9+0EtZtd34g4ZR7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onNCT-006M5Q-PM; Tue, 25 Oct 2022 16:54:49 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onNCH-006Lyl-Ul for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 16:54:39 +0000 Received: by mail-wr1-x42d.google.com with SMTP id g12so9354690wrs.10 for ; Tue, 25 Oct 2022 09:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9XVDf5CNGXohyTDwQXIUTQefWV+zveKEvdiJ0iEMiCo=; b=nWWvtDEnIFtSZIk2LCzs577LelT3TwOr923486IySggt0BodjQKLBytOshOzTgOkYW ShmNzTVUSj8yF8YpAsjkfXnqZw9wZ5Uxu9cFvPR9mPLSpXrh+BkPuGjsXfVTCZW1lhnx 0nTXG8MyhhmQg8vNm8SyUcRZLE8mXL8mUBGwSQHSBzwib4mvgtW7KuJzCIXJrps8u9xz lEykKyUDhLTep6wRxxb1huTpc2j03/jY6taCCgvFu/pOHj1NuUf4lp0rjTTClFpPNGUX f7e54GNHC3jhmlr7DPiVXmhJPTzx5nKyRS2lKAXqqXmREcNaaQYCs2/OmzZLNBHc8nHX 604Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9XVDf5CNGXohyTDwQXIUTQefWV+zveKEvdiJ0iEMiCo=; b=fpjgmoMr8HK3NmbrktCpCVXr4a3ulEv+YuHSNBLkiuDlXZ/1Si4/4wvSTpNAwVqJph qfumG9SgeijlPoMYPyIwmbtQkDz07sqmpfZR/yVbQ2UXPZQiGJRQmEzTCUbXX37XSy8e 24yAEJqS5EeONotBsKikWmPzr9iMqoHT5wxSml1Dp9kV5dSdZPUPmCsydfeYBhx9qyVY kFUlqiNHtCZbQJDrazq2GuhiOQ9WD/P58yn+eKL5lB4lAgVgtktnfqXxp6o626ah5kMc YKBrGw+mJIoFSeWMcOb7MAyZ4lQMYzhxRf13PHkoxjTGWLxZmWA6ZkHWcVpNgerjS+Lf jX5Q== X-Gm-Message-State: ACrzQf0ZzvH/0elwhItLmyY6bkzwGOfrV+458wpZa5jHUGcEA4fPw6// KQZKTxgcDMi+OBdhKqOnvWU= X-Google-Smtp-Source: AMsMyM4URGw014tILeGzQZ66S57zVWE5z6thpheFKt2ksgimTOOtljhHjSVf/MlhT/s/B/o2zDdIQA== X-Received: by 2002:a5d:6dcd:0:b0:235:f087:fec2 with SMTP id d13-20020a5d6dcd000000b00235f087fec2mr18867780wrz.444.1666716874910; Tue, 25 Oct 2022 09:54:34 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id a20-20020a05600c349400b003a6a3595edasm3023989wmq.27.2022.10.25.09.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 09:54:34 -0700 (PDT) From: Jernej Skrabec To: maxime@cerno.tech, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: wens@csie.org, samuel@sholland.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH v2 1/5] iommu/sun50i: Fix reset release Date: Tue, 25 Oct 2022 18:54:11 +0200 Message-Id: <20221025165415.307591-2-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221025165415.307591-1-jernej.skrabec@gmail.com> References: <20221025165415.307591-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_095438_008744_29415C03 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reset signal is asserted by writing 0 to the corresponding locations of masters we want to reset. So in order to deassert all reset signals, we should write 1's to all locations. Current code writes 1's to locations of masters which were just reset which is good. However, at the same time it also writes 0's to other locations and thus asserts reset signals of remaining masters. Fix code by writing all 1's when we want to deassert all reset signals. This bug was discovered when working with Cedrus (video decoder). When it faulted, display went blank due to reset signal assertion. Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Jernej Skrabec --- drivers/iommu/sun50i-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index cd9b74ee24de..270204a6ec4a 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -27,6 +27,7 @@ #include #define IOMMU_RESET_REG 0x010 +#define IOMMU_RESET_RELEASE_ALL 0xffffffff #define IOMMU_ENABLE_REG 0x020 #define IOMMU_ENABLE_ENABLE BIT(0) @@ -893,7 +894,7 @@ static irqreturn_t sun50i_iommu_irq(int irq, void *dev_id) iommu_write(iommu, IOMMU_INT_CLR_REG, status); iommu_write(iommu, IOMMU_RESET_REG, ~status); - iommu_write(iommu, IOMMU_RESET_REG, status); + iommu_write(iommu, IOMMU_RESET_REG, IOMMU_RESET_RELEASE_ALL); spin_unlock(&iommu->iommu_lock);