Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp245134pxx; Wed, 28 Oct 2020 03:59:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZNCce87oP2BPmY0Pygxe2YBZ3i1KSY7uY/nI4PfdyjNy62lwFtNRaPFve4gZrbbLRUF0H X-Received: by 2002:a17:906:95c5:: with SMTP id n5mr7196377ejy.111.1603882755109; Wed, 28 Oct 2020 03:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603882755; cv=none; d=google.com; s=arc-20160816; b=AZKhEoLpF8swEW8i8ZOKdO6Sb5Mvv7UdBK+Ii6fMImVH9WjUyVWLOy2J/X1LuxubGU m5kcOTNeJy/YlGqYsdHRk1Vt1hya0ZdPxofvTlPXWGeUEvRb3LHEZnmv83jYTix9h3F1 DDHg2FIFRcMWR59ruPJiIwtev9S9Nl34eXU0WJOhuH4T1DYbllv8lY+7f9dKfiO26yzO T8RYAne8dyreOu9rETtY6EiuShcxDJW6Qq6suwF1eQ6RLSqeyBPvQgaTl7oThnoGcZgc Q73l2Xv3qLrODz8MNOI0UWtbSInh+2UGWFq4BFCJgok9SBuffScpIk39QP5E0sxI86w8 FZdA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M4wv/TnUv0EKBHX63+7AeJ0z+c+N248wv69wFZvwXYQ=; b=qziO+R83iq3wPlX1NLyuFm0S5WpGAqSFVydZXrsrU1HijarsLoM7rHQ7gPkuMTbYw1 6Pqb9asnzLDQUvLmcS1RJiOYVtVA/R89BlZXgrtU3TrQlNtCbnUymiyeIqdALJUyYAS0 i2DVsfCG0uEU2SjSI4FOK6iZWh8noVz95VR6EBuBkkBnYvT+Ns9nWUwk9vSKuartVVp5 CgOgKpT+ogO+dU4msx3XqMjCAvwrIo5RzPS5qHi6mM7LipoFFtQfsI8/dG8TaI8Vxam9 nJYoQqtdvzJYyKWVPXIvQaqKfUhzHX3tNbWWxvRBrFY3ilL8rXThHBs/MxBp+v/OdEUA +hDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TCQArO8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk22si2709939edb.258.2020.10.28.03.58.53; Wed, 28 Oct 2020 03:59:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TCQArO8o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1783070AbgJ0O5u (ORCPT + 99 others); Tue, 27 Oct 2020 10:57:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:45212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763865AbgJ0OpP (ORCPT ); Tue, 27 Oct 2020 10:45:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C969120773; Tue, 27 Oct 2020 14:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809915; bh=Iu1YP6eCiWUIKbD7nThDJFmPelMCRWTadzoB+GonbXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCQArO8oWWxrY074jHKa1YmnYOcdUmafzfyCFMWWphXW14RkEBbcXX5DmaJfor9kN yMWrBEC1x9RObCAsqeFiOOyLyLMkpsU7uJV2U3zA3thLUTWk1huw8QmSa5RDfZoqYw Nlf4jfd0HuWPsdyBKORf9Dim5oJAtOUdDvljQNT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Steven Price , Alyssa Rosenzweig , Sasha Levin Subject: [PATCH 5.4 365/408] drm/panfrost: add amlogic reset quirk callback Date: Tue, 27 Oct 2020 14:55:03 +0100 Message-Id: <20201027135511.967718762@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neil Armstrong [ Upstream commit 110003002291525bb209f47e6dbf121a63249a97 ] The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time. Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented we do not know what does these values, but they permit having a fully functional GPU running with Panfrost. Signed-off-by: Neil Armstrong [Steven: Fix typo in commit log] Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20200916150147.25753-3-narmstrong@baylibre.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index 1431db13ec788..0d39a201c7591 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -75,6 +75,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) return 0; } +void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev) +{ + /* + * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs + * these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order + * to operate correctly. + */ + gpu_write(pfdev, GPU_PWR_KEY, GPU_PWR_KEY_UNLOCK); + gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16)); +} + static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev) { u32 quirks = 0; diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.h b/drivers/gpu/drm/panfrost/panfrost_gpu.h index 4112412087b27..468c51e7e46db 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.h +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.h @@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev); void panfrost_gpu_power_on(struct panfrost_device *pfdev); void panfrost_gpu_power_off(struct panfrost_device *pfdev); +void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev); + #endif diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h index ea38ac60581c6..eddaa62ad8b0e 100644 --- a/drivers/gpu/drm/panfrost/panfrost_regs.h +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h @@ -51,6 +51,10 @@ #define GPU_STATUS 0x34 #define GPU_STATUS_PRFCNT_ACTIVE BIT(2) #define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x50 /* (WO) Power manager key register */ +#define GPU_PWR_KEY_UNLOCK 0x2968A819 +#define GPU_PWR_OVERRIDE0 0x54 /* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x58 /* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C #define GPU_FAULT_ADDRESS_LO 0x40 #define GPU_FAULT_ADDRESS_HI 0x44 -- 2.25.1