All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weijie Gao <weijie.gao@mediatek.com>
To: <u-boot@lists.denx.de>
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	Daniel Schwierzeck <daniel.schwierzeck@gmail.com>,
	Weijie Gao <weijie.gao@mediatek.com>
Subject: [PATCH v4 01/25] mips: add asm/mipsmtregs.h for MIPS multi-threading
Date: Tue, 10 May 2022 20:18:10 +0800	[thread overview]
Message-ID: <fad955ef2b751fe5824afaef1dbcbccd7aa38cc7.1652183768.git.weijie.gao@mediatek.com> (raw)
In-Reply-To: <cover.1652183768.git.weijie.gao@mediatek.com>

To be compatible with old u-boot used by lots of MT7621 devices, the u-boot
needs to boot-up MT7621's all cores, and all VPES of each core.

This patch adds asm/mipsmtregs.h from linux kernel which is need for
boot-up VPEs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
v4 changes: new
---
 arch/mips/include/asm/mipsmtregs.h | 142 +++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)
 create mode 100644 arch/mips/include/asm/mipsmtregs.h

diff --git a/arch/mips/include/asm/mipsmtregs.h b/arch/mips/include/asm/mipsmtregs.h
new file mode 100644
index 0000000000..ba82e2bd97
--- /dev/null
+++ b/arch/mips/include/asm/mipsmtregs.h
@@ -0,0 +1,142 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * MT regs definitions, follows on from mipsregs.h
+ * Copyright (C) 2004 - 2005 MIPS Technologies, Inc.  All rights reserved.
+ * Elizabeth Clarke et. al.
+ *
+ */
+#ifndef _ASM_MIPSMTREGS_H
+#define _ASM_MIPSMTREGS_H
+
+#include <asm/mipsregs.h>
+
+/*
+ * Macros for use in assembly language code
+ */
+
+#define CP0_MVPCONTROL		$0, 1
+#define CP0_MVPCONF0		$0, 2
+#define CP0_MVPCONF1		$0, 3
+#define CP0_VPECONTROL		$1, 1
+#define CP0_VPECONF0		$1, 2
+#define CP0_VPECONF1		$1, 3
+#define CP0_YQMASK		$1, 4
+#define CP0_VPESCHEDULE		$1, 5
+#define CP0_VPESCHEFBK		$1, 6
+#define CP0_TCSTATUS		$2, 1
+#define CP0_TCBIND		$2, 2
+#define CP0_TCRESTART		$2, 3
+#define CP0_TCHALT		$2, 4
+#define CP0_TCCONTEXT		$2, 5
+#define CP0_TCSCHEDULE		$2, 6
+#define CP0_TCSCHEFBK		$2, 7
+#define CP0_SRSCONF0		$6, 1
+#define CP0_SRSCONF1		$6, 2
+#define CP0_SRSCONF2		$6, 3
+#define CP0_SRSCONF3		$6, 4
+#define CP0_SRSCONF4		$6, 5
+
+/* MVPControl fields */
+#define MVPCONTROL_EVP		(_ULCAST_(1))
+
+#define MVPCONTROL_VPC_SHIFT	1
+#define MVPCONTROL_VPC		(_ULCAST_(1) << MVPCONTROL_VPC_SHIFT)
+
+#define MVPCONTROL_STLB_SHIFT	2
+#define MVPCONTROL_STLB		(_ULCAST_(1) << MVPCONTROL_STLB_SHIFT)
+
+/* MVPConf0 fields */
+#define MVPCONF0_PTC_SHIFT	0
+#define MVPCONF0_PTC		(_ULCAST_(0xff))
+#define MVPCONF0_PVPE_SHIFT	10
+#define MVPCONF0_PVPE		(_ULCAST_(0xf) << MVPCONF0_PVPE_SHIFT)
+#define MVPCONF0_TCA_SHIFT	15
+#define MVPCONF0_TCA		(_ULCAST_(1) << MVPCONF0_TCA_SHIFT)
+#define MVPCONF0_PTLBE_SHIFT	16
+#define MVPCONF0_PTLBE		(_ULCAST_(0x3ff) << MVPCONF0_PTLBE_SHIFT)
+#define MVPCONF0_TLBS_SHIFT	29
+#define MVPCONF0_TLBS		(_ULCAST_(1) << MVPCONF0_TLBS_SHIFT)
+#define MVPCONF0_M_SHIFT	31
+#define MVPCONF0_M		(_ULCAST_(0x1) << MVPCONF0_M_SHIFT)
+
+/* config3 fields */
+#define CONFIG3_MT_SHIFT	2
+#define CONFIG3_MT		(_ULCAST_(1) << CONFIG3_MT_SHIFT)
+
+/* VPEControl fields (per VPE) */
+#define VPECONTROL_TARGTC	(_ULCAST_(0xff))
+
+#define VPECONTROL_TE_SHIFT	15
+#define VPECONTROL_TE		(_ULCAST_(1) << VPECONTROL_TE_SHIFT)
+#define VPECONTROL_EXCPT_SHIFT	16
+#define VPECONTROL_EXCPT	(_ULCAST_(0x7) << VPECONTROL_EXCPT_SHIFT)
+
+/* Thread Exception Codes for EXCPT field */
+#define THREX_TU		0
+#define THREX_TO		1
+#define THREX_IYQ		2
+#define THREX_GSX		3
+#define THREX_YSCH		4
+#define THREX_GSSCH		5
+
+#define VPECONTROL_GSI_SHIFT	20
+#define VPECONTROL_GSI		(_ULCAST_(1) << VPECONTROL_GSI_SHIFT)
+#define VPECONTROL_YSI_SHIFT	21
+#define VPECONTROL_YSI		(_ULCAST_(1) << VPECONTROL_YSI_SHIFT)
+
+/* VPEConf0 fields (per VPE) */
+#define VPECONF0_VPA_SHIFT	0
+#define VPECONF0_VPA		(_ULCAST_(1) << VPECONF0_VPA_SHIFT)
+#define VPECONF0_MVP_SHIFT	1
+#define VPECONF0_MVP		(_ULCAST_(1) << VPECONF0_MVP_SHIFT)
+#define VPECONF0_XTC_SHIFT	21
+#define VPECONF0_XTC		(_ULCAST_(0xff) << VPECONF0_XTC_SHIFT)
+
+/* VPEConf1 fields (per VPE) */
+#define VPECONF1_NCP1_SHIFT	0
+#define VPECONF1_NCP1		(_ULCAST_(0xff) << VPECONF1_NCP1_SHIFT)
+#define VPECONF1_NCP2_SHIFT	10
+#define VPECONF1_NCP2		(_ULCAST_(0xff) << VPECONF1_NCP2_SHIFT)
+#define VPECONF1_NCX_SHIFT	20
+#define VPECONF1_NCX		(_ULCAST_(0xff) << VPECONF1_NCX_SHIFT)
+
+/* TCStatus fields (per TC) */
+#define TCSTATUS_TASID		(_ULCAST_(0xff))
+#define TCSTATUS_IXMT_SHIFT	10
+#define TCSTATUS_IXMT		(_ULCAST_(1) << TCSTATUS_IXMT_SHIFT)
+#define TCSTATUS_TKSU_SHIFT	11
+#define TCSTATUS_TKSU		(_ULCAST_(3) << TCSTATUS_TKSU_SHIFT)
+#define TCSTATUS_A_SHIFT	13
+#define TCSTATUS_A		(_ULCAST_(1) << TCSTATUS_A_SHIFT)
+#define TCSTATUS_DA_SHIFT	15
+#define TCSTATUS_DA		(_ULCAST_(1) << TCSTATUS_DA_SHIFT)
+#define TCSTATUS_DT_SHIFT	20
+#define TCSTATUS_DT		(_ULCAST_(1) << TCSTATUS_DT_SHIFT)
+#define TCSTATUS_TDS_SHIFT	21
+#define TCSTATUS_TDS		(_ULCAST_(1) << TCSTATUS_TDS_SHIFT)
+#define TCSTATUS_TSST_SHIFT	22
+#define TCSTATUS_TSST		(_ULCAST_(1) << TCSTATUS_TSST_SHIFT)
+#define TCSTATUS_RNST_SHIFT	23
+#define TCSTATUS_RNST		(_ULCAST_(3) << TCSTATUS_RNST_SHIFT)
+/* Codes for RNST */
+#define TC_RUNNING		0
+#define TC_WAITING		1
+#define TC_YIELDING		2
+#define TC_GATED		3
+
+#define TCSTATUS_TMX_SHIFT	27
+#define TCSTATUS_TMX		(_ULCAST_(1) << TCSTATUS_TMX_SHIFT)
+/* TCStatus TCU bits can use same definitions/offsets as CU bits in Status */
+
+/* TCBind */
+#define TCBIND_CURVPE_SHIFT	0
+#define TCBIND_CURVPE		(_ULCAST_(0xf))
+
+#define TCBIND_CURTC_SHIFT	21
+
+#define TCBIND_CURTC		(_ULCAST_(0xff) << TCBIND_CURTC_SHIFT)
+
+/* TCHalt */
+#define TCHALT_H		(_ULCAST_(1))
+
+#endif
-- 
2.17.1


  reply	other threads:[~2022-05-10 12:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 12:18 [PATCH v4 00/25] Add support for MediaTek MT7621 SoC Weijie Gao
2022-05-10 12:18 ` Weijie Gao [this message]
2022-05-10 12:18 ` [PATCH v4 02/25] mips: add more definitions for asm/cm.h Weijie Gao
2022-05-10 12:18 ` [PATCH v4 03/25] mips: add __image_copy_len for SPL linker script Weijie Gao
2022-05-10 12:18 ` [PATCH v4 04/25] mips: add support for noncached_alloc() Weijie Gao
2022-05-10 12:18 ` [PATCH v4 05/25] mips: mtmips: add support for MediaTek MT7621 SoC Weijie Gao
2022-05-11 16:36   ` Sean Anderson
2022-05-12  3:00     ` Weijie Gao
2022-05-10 12:18 ` [PATCH v4 06/25] mips: mtmips: add two reference boards for mt7621 Weijie Gao
2022-05-10 13:26   ` Stefan Roese
2022-05-10 12:18 ` [PATCH v4 07/25] doc: mediatek: add documentation for mt7621 reference boards Weijie Gao
2022-05-10 12:18 ` [PATCH v4 08/25] clk: mtmips: add clock driver for MediaTek MT7621 SoC Weijie Gao
2022-05-11 16:29   ` Sean Anderson
2022-05-12  2:38     ` Weijie Gao
2022-05-10 12:18 ` [PATCH v4 09/25] reset: mtmips: add reset controller support " Weijie Gao
2022-05-10 12:18 ` [PATCH v4 10/25] pinctrl: mtmips: add " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 11/25] usb: xhci-mtk: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 12/25] phy: mtk-tphy: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 13/25] spi: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 14/25] gpio: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 15/25] watchdog: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 16/25] mmc: mediatek: " Weijie Gao
2022-05-10 12:19 ` [PATCH v4 17/25] net: mediatek: remap iobase address Weijie Gao
2022-05-16  0:24   ` Ramon Fried
2022-05-10 12:19 ` [PATCH v4 18/25] net: mediatek: use regmap api to modify ethsys registers Weijie Gao
2022-05-16  0:25   ` Ramon Fried
2022-05-10 12:19 ` [PATCH v4 19/25] net: mediatek: add support for MediaTek MT7621 SoC Weijie Gao
2022-05-16  0:25   ` Ramon Fried
2022-05-10 12:19 ` [PATCH v4 20/25] nand: raw: " Weijie Gao
2022-05-10 12:20 ` [PATCH v4 21/25] spl: allow using nand base without standard nand driver Weijie Gao
2022-05-10 12:20 ` [PATCH v4 22/25] spl: spl_legacy: fix the use of SPL_COPY_PAYLOAD_ONLY Weijie Gao
2022-05-10 12:20 ` [PATCH v4 23/25] spl: nand: support loading legacy image with payload compressed Weijie Gao
2022-05-10 12:20 ` [PATCH v4 24/25] tools: mtk_image: add support for MT7621 NAND images Weijie Gao
2022-05-10 12:20 ` [PATCH v4 25/25] MAINTAINERS: update maintainer for MediaTek MIPS platform Weijie Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fad955ef2b751fe5824afaef1dbcbccd7aa38cc7.1652183768.git.weijie.gao@mediatek.com \
    --to=weijie.gao@mediatek.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=daniel.schwierzeck@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.