Add support for MediaTek MT7621 SoC - v6
Subsystems (15)
PATCH v6 1/25 mips: add asm/mipsmtregs.h for MIPS multi-threading
In reply to Weijie GaoTo 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.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- arch/mips/include/asm/mipsmtregs.h | 142 +++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 arch/mips/include/asm/mipsmtregs.h
arch/mips/include/asm/mipsmtregs.h new file +142 -0
@@ -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
Signature · 1 line
2.17.1
v6 cover Add support for MediaTek MT7621 SoC - v6
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-core dual-threaded MIPS 1004Kc processor running at a normal frequency of 880MHz. This chip can be found in many wireless routers.
This series add all basic drivers which are useful in u-boot, like usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is described in doc/board/mediatek/mt7621.rst
Thanks,
Weijie
v6 changes:
- Use FIELD_GET/FIELD_PREP for register fields instead of shift opertations
- Rename fixed clock node name in mt7621.dtsi
- Panic if dram binary blob is wrong in spl
- Remove redundant nop's if noreorder is not used
- Use execution_hazard_barrier() in tpl
v5 changes:
- Adjust mt7621.dtsi, clkctrl node moved to sysc, pinctrl default states moved to board dts files
- Modify clk driver due to its node changed in mt7621.dtsi
- Minor fixes
v4 changes:
- Add full support for booting from flash
v3 changes:
- Rewrite clk driver to follow definitions from upstream kernel
- Implement noncached_alloc() for MIPS platform
- Update register remap for mtk-eth driver needed by mt7621
v2 changes:
- Add a kconfig for max supported ram size
- Remove network configs from default config file
- Add config file for mt7621-rfb boards
Weijie Gao (25):
mips: add asm/mipsmtregs.h for MIPS multi-threading
mips: add more definitions for asm/cm.h
mips: add __image_copy_len for SPL linker script
mips: add support for noncached_alloc()
mips: mtmips: add support for MediaTek MT7621 SoC
mips: mtmips: add two reference boards for mt7621
doc: mediatek: add documentation for mt7621 reference boards
clk: mtmips: add clock driver for MediaTek MT7621 SoC
reset: mtmips: add reset controller support for MediaTek MT7621 SoC
pinctrl: mtmips: add support for MediaTek MT7621 SoC
usb: xhci-mtk: add support for MediaTek MT7621 SoC
phy: mtk-tphy: add support for MediaTek MT7621 SoC
spi: add support for MediaTek MT7621 SoC
gpio: add support for MediaTek MT7621 SoC
watchdog: add support for MediaTek MT7621 SoC
mmc: mediatek: add support for MediaTek MT7621 SoC
net: mediatek: remap iobase address
net: mediatek: use regmap api to modify ethsys registers
net: mediatek: add support for MediaTek MT7621 SoC
nand: raw: add support for MediaTek MT7621 SoC
spl: allow using nand base without standard nand driver
spl: spl_legacy: fix the use of SPL_COPY_PAYLOAD_ONLY
spl: nand: support loading legacy image with payload compressed
tools: mtk_image: add support for MT7621 NAND images
MAINTAINERS: update maintainer for MediaTek MIPS platform
MAINTAINERS | 8 + arch/mips/cpu/u-boot-spl.lds | 3 + arch/mips/dts/Makefile | 2 + arch/mips/dts/mediatek,mt7621-nand-rfb.dts | 67 + arch/mips/dts/mediatek,mt7621-rfb.dts | 82 ++ arch/mips/dts/mt7621-u-boot.dtsi | 111 ++ arch/mips/dts/mt7621.dtsi | 349 +++++ arch/mips/include/asm/cm.h | 67 + arch/mips/include/asm/mipsmtregs.h | 142 ++ arch/mips/include/asm/system.h | 20 + arch/mips/lib/cache.c | 43 + arch/mips/mach-mtmips/Kconfig | 49 +- arch/mips/mach-mtmips/Makefile | 4 + arch/mips/mach-mtmips/cpu.c | 2 +- arch/mips/mach-mtmips/mt7621/Kconfig | 115 ++ arch/mips/mach-mtmips/mt7621/Makefile | 14 + arch/mips/mach-mtmips/mt7621/init.c | 246 ++++ arch/mips/mach-mtmips/mt7621/mt7621.h | 229 ++++ arch/mips/mach-mtmips/mt7621/serial.c | 23 + arch/mips/mach-mtmips/mt7621/spl/Makefile | 9 + arch/mips/mach-mtmips/mt7621/spl/cps.c | 153 +++ arch/mips/mach-mtmips/mt7621/spl/dram.c | 153 +++ arch/mips/mach-mtmips/mt7621/spl/dram.h | 39 + arch/mips/mach-mtmips/mt7621/spl/launch.c | 100 ++ arch/mips/mach-mtmips/mt7621/spl/launch.h | 52 + arch/mips/mach-mtmips/mt7621/spl/launch_ll.S | 339 +++++ arch/mips/mach-mtmips/mt7621/spl/serial.c | 24 + arch/mips/mach-mtmips/mt7621/spl/spl.c | 95 ++ arch/mips/mach-mtmips/mt7621/spl/start.S | 226 ++++ arch/mips/mach-mtmips/mt7621/sram_init.S | 22 + arch/mips/mach-mtmips/mt7621/tpl/Makefile | 4 + arch/mips/mach-mtmips/mt7621/tpl/start.S | 161 +++ arch/mips/mach-mtmips/mt7621/tpl/tpl.c | 144 ++ board/mediatek/mt7621/MAINTAINERS | 8 + board/mediatek/mt7621/Makefile | 3 + board/mediatek/mt7621/board.c | 6 + common/spl/Kconfig | 2 +- common/spl/spl_legacy.c | 21 +- common/spl/spl_nand.c | 27 + configs/mt7621_nand_rfb_defconfig | 83 ++ configs/mt7621_rfb_defconfig | 82 ++ doc/board/mediatek/mt7621.rst | 48 + drivers/clk/mtmips/Makefile | 1 + drivers/clk/mtmips/clk-mt7621.c | 288 ++++ drivers/gpio/Kconfig | 2 +- drivers/mmc/mtk-sd.c | 13 + drivers/mtd/nand/raw/Kconfig | 17 +- drivers/mtd/nand/raw/Makefile | 2 + drivers/mtd/nand/raw/mt7621_nand.c | 1205 +++++++++++++++++ drivers/mtd/nand/raw/mt7621_nand.h | 29 + drivers/mtd/nand/raw/mt7621_nand_spl.c | 237 ++++ drivers/net/mtk_eth.c | 45 +- drivers/phy/Kconfig | 2 +- drivers/pinctrl/mtmips/Kconfig | 9 + drivers/pinctrl/mtmips/Makefile | 1 + drivers/pinctrl/mtmips/pinctrl-mt7621.c | 306 +++++ .../pinctrl/mtmips/pinctrl-mtmips-common.c | 4 +- .../pinctrl/mtmips/pinctrl-mtmips-common.h | 12 + drivers/spi/Kconfig | 2 +- drivers/usb/host/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- include/configs/mt7621.h | 67 + include/dt-bindings/clock/mt7621-clk.h | 46 + include/dt-bindings/reset/mt7621-reset.h | 38 + tools/mtk_image.c | 182 +++ tools/mtk_image.h | 24 + 66 files changed, 5877 insertions(+), 36 deletions(-) create mode 100644 arch/mips/dts/mediatek,mt7621-nand-rfb.dts create mode 100644 arch/mips/dts/mediatek,mt7621-rfb.dts create mode 100644 arch/mips/dts/mt7621-u-boot.dtsi create mode 100644 arch/mips/dts/mt7621.dtsi create mode 100644 arch/mips/include/asm/mipsmtregs.h create mode 100644 arch/mips/mach-mtmips/mt7621/Kconfig create mode 100644 arch/mips/mach-mtmips/mt7621/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/init.c create mode 100644 arch/mips/mach-mtmips/mt7621/mt7621.h create mode 100644 arch/mips/mach-mtmips/mt7621/serial.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/spl/cps.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/dram.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/dram.h create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch.h create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch_ll.S create mode 100644 arch/mips/mach-mtmips/mt7621/spl/serial.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/spl.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/start.S create mode 100644 arch/mips/mach-mtmips/mt7621/sram_init.S create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/start.S create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/tpl.c create mode 100644 board/mediatek/mt7621/MAINTAINERS create mode 100644 board/mediatek/mt7621/Makefile create mode 100644 board/mediatek/mt7621/board.c create mode 100644 configs/mt7621_nand_rfb_defconfig create mode 100644 configs/mt7621_rfb_defconfig create mode 100644 doc/board/mediatek/mt7621.rst create mode 100644 drivers/clk/mtmips/clk-mt7621.c create mode 100644 drivers/mtd/nand/raw/mt7621_nand.c create mode 100644 drivers/mtd/nand/raw/mt7621_nand.h create mode 100644 drivers/mtd/nand/raw/mt7621_nand_spl.c create mode 100644 drivers/pinctrl/mtmips/pinctrl-mt7621.c create mode 100644 include/configs/mt7621.h create mode 100644 include/dt-bindings/clock/mt7621-clk.h create mode 100644 include/dt-bindings/reset/mt7621-reset.h
Signature · 1 line
2.17.1
PATCH v6 4/25 mips: add support for noncached_alloc()
This patch adds support for noncached_alloc() which was only supported by ARM platform.
Unlike the ARM platform, MMU is not used in u-boot for MIPS. Instead, KSEG is provided to access uncached memory. So most code of this patch is copied from cache.c of ARM platform, with only two differences:
1. MMU is untouched in noncached_set_region()
2. Address returned by noncached_alloc() is converted using KSEG1ADDR()
---
v6 changes: none
v5 changes: change KSEG1ADDR to CKSEG1ADDR
v4 changes: new
--- arch/mips/include/asm/system.h | 20 ++++++++++++++++ arch/mips/lib/cache.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+)
arch/mips/include/asm/system.h +20 -0
@@ -282,4 +282,24 @@ static inline void instruction_hazard_barrier(void) : "=&r"(tmp)); } +#ifdef CONFIG_SYS_NONCACHED_MEMORY +/* 1MB granularity */ +#define MMU_SECTION_SHIFT 20 +#define MMU_SECTION_SIZE (1 << MMU_SECTION_SHIFT) + +/** +* noncached_init() - Initialize non-cached memory region +* +* Initialize non-cached memory area. This memory region will be typically +* located right below the malloc() area and be accessed from KSEG1. +* +* It is called during the generic post-relocation init sequence. +* +* Return: 0 if OK +*/ +int noncached_init (void ); + +phys_addr_t noncached_alloc (size_t size,size_t align); +#endif /* CONFIG_SYS_NONCACHED_MEMORY */ +#endif /* _ASM_SYSTEM_H */
arch/mips/lib/cache.c +43 -0
52 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 2/25 mips: add more definitions for asm/cm.h
In reply to Weijie GaoThis patch add more definitions needed for MT7621 initialization. MT7621 needs to initialize GIC/CPC and other related parts.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- arch/mips/include/asm/cm.h | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
arch/mips/include/asm/cm.h +67 -0
@@ -8,9 +8,23 @@#define __MIPS_ASM_CM_H__/* Global Control Register (GCR) offsets */ +#define GCR_CONFIG 0x0000#define GCR_BASE 0x0008#define GCR_BASE_UPPER 0x000c +#define GCR_CONTROL 0x0010 +#define GCR_ACCESS 0x0020#define GCR_REV 0x0030 +#define GCR_GIC_BASE 0x0080 +#define GCR_CPC_BASE 0x0088 +#define GCR_REG0_BASE 0x0090 +#define GCR_REG0_MASK 0x0098 +#define GCR_REG1_BASE 0x00a0 +#define GCR_REG1_MASK 0x00a8 +#define GCR_REG2_BASE 0x00b0 +#define GCR_REG2_MASK 0x00b8 +#define GCR_REG3_BASE 0x00c0 +#define GCR_REG3_MASK 0x00c8 +#define GCR_CPC_STATUS 0x00f0#define GCR_L2_CONFIG 0x0130#define GCR_L2_TAG_ADDR 0x0600#define GCR_L2_TAG_ADDR_UPPER 0x0604
@@ -19,10 +33,59 @@#define GCR_L2_DATA 0x0610#define GCR_L2_DATA_UPPER 0x0614#define GCR_Cx_COHERENCE 0x2008 +#define GCR_Cx_OTHER 0x2018 +#define GCR_Cx_ID 0x2028 +#define GCR_CO_COHERENCE 0x4008 + +/* GCR_CONFIG fields */ +#define GCR_CONFIG_NUM_CLUSTERS_SHIFT 23 +#define GCR_CONFIG_NUM_CLUSTERS (0x7f << 23) +#define GCR_CONFIG_NUMIOCU_SHIFT 8 +#define GCR_CONFIG_NUMIOCU (0xff << 8) +#define GCR_CONFIG_PCORES_SHIFT 0 +#define GCR_CONFIG_PCORES (0xff << 0) + +/* GCR_BASE fields */ +#define GCR_BASE_SHIFT 15 +#define CCA_DEFAULT_OVR_SHIFT 5 +#define CCA_DEFAULT_OVR_MASK (0x7 << 5) +#define CCA_DEFAULT_OVREN (0x1 << 4) +#define CM_DEFAULT_TARGET_SHIFT 0 +#define CM_DEFAULT_TARGET_MASK (0x3 << 0) + +/* GCR_CONTROL fields */ +#define GCR_CONTROL_SYNCCTL (0x1 << 16)/* GCR_REV CM versions */ #define GCR_REV_CM3 0x0800 +/* GCR_GIC_BASE fields */ +#define GCR_GIC_BASE_ADDRMASK_SHIFT 7 +#define GCR_GIC_BASE_ADDRMASK (0x1ffffff << 7) +#define GCR_GIC_EN (0x1 << 0) + +/* GCR_CPC_BASE fields */ +#define GCR_CPC_BASE_ADDRMASK_SHIFT 15 +#define GCR_CPC_BASE_ADDRMASK (0x1ffff << 15) +#define GCR_CPC_EN (0x1 << 0) + +/* GCR_REGn_MASK fields */ +#define GCR_REGn_MASK_ADDRMASK_SHIFT 16 +#define GCR_REGn_MASK_ADDRMASK (0xffff << 16) +#define GCR_REGn_MASK_CCAOVR_SHIFT 5 +#define GCR_REGn_MASK_CCAOVR (0x7 << 5) +#define GCR_REGn_MASK_CCAOVREN (1 << 4) +#define GCR_REGn_MASK_DROPL2 (1 << 2) +#define GCR_REGn_MASK_CMTGT_SHIFT 0 +#define GCR_REGn_MASK_CMTGT (0x3 << 0) +#define GCR_REGn_MASK_CMTGT_DISABLED 0x0 +#define GCR_REGn_MASK_CMTGT_MEM 0x1 +#define GCR_REGn_MASK_CMTGT_IOCU0 0x2 +#define GCR_REGn_MASK_CMTGT_IOCU1 0x3 + +/* GCR_CPC_STATUS fields */ +#define GCR_CPC_EX (0x1 << 0) +/* GCR_L2_CONFIG fields */ #define GCR_L2_CONFIG_ASSOC_SHIFT 0#define GCR_L2_CONFIG_ASSOC_BITS 8
@@ -36,6 +99,10 @@#define GCR_Cx_COHERENCE_DOM_EN (0xff << 0)#define GCR_Cx_COHERENCE_EN (0x1 << 0) +/* GCR_Cx_OTHER fields */ +#define GCR_Cx_OTHER_CORENUM_SHIFT 16 +#define GCR_Cx_OTHER_CORENUM (0xffff << 16) +#ifndef __ASSEMBLY__#include <asm/io.h>
Signature · 1 line
2.17.1
PATCH v6 3/25 mips: add __image_copy_len for SPL linker script
In reply to Weijie GaoThis patch adds __image_copy_len needed by TPL of MT7621 SoC. The __image_copy_len represents the binary blob size of both SPL/TPL binaries. To achieve this, __text_start/end are added for calculation.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- arch/mips/cpu/u-boot-spl.lds | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/cpu/u-boot-spl.lds +3 -0
@@ -13,7 +13,9 @@ SECTIONS . = ALIGN(4); .text : { + __text_start = .; *(.text*) + __text_end = .; } > .spl_mem . = ALIGN(4);
@@ -36,6 +38,7 @@ SECTIONS . = ALIGN(4); __image_copy_end = .; + __image_copy_len = __image_copy_end - __text_start; _image_binary_end = .;
Signature · 1 line
2.17.1
PATCH v6 7/25 doc: mediatek: add documentation for mt7621 reference boards
In reply to Weijie GaoThe MT7621 requires external binary blob being executed during u-boot's boot-up flow. It's necessary to provide a guide here for users to correctly build the u-boot.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- doc/board/mediatek/mt7621.rst | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 doc/board/mediatek/mt7621.rst
doc/board/mediatek/mt7621.rst new file +48 -0
@@ -0,0 +1,48 @@ +.. SPDX-License-Identifier: GPL-2.0 + +mt7621_rfb/mt7621_nand_rfb +========================== + +U-Boot for the MediaTek MT7621 boards + +Quick Start +----------- + +- Get the DDR initialization binary blob +- Configure CPU and DDR parameters +- Build U-Boot + +Get the DDR initialization binary blob +-------------------- + +Download one from: + - https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/master/mt7621_stage_sram.bin + - https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/master/mt7621_stage_sram_noprint.bin + +mt7621_stage_sram_noprint.bin has removed all output logs. To use this one, +download and rename it to mt7621_stage_sram.bin + +Put the binary blob to the u-boot build directory. + +Configure CPU and DDR parameters +-------------------------------- + +menuconfig > MIPS architecture > MediaTek MIPS platforms > CPU & DDR configuration + +Select the correct DDR timing parameters for your board. The size shown here +must match the DDR size of you board. + +The frequency of CPU and DDR can also be adjusted. + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=mipsel-linux- + $ make O=build mt7621_rfb_defconfig # or mt7621_nand_rfb_defconfig + $ cp mt7621_stage_sram.bin ./build/mt7621_stage_sram.bin + $ # or cp mt7621_stage_sram_noprint.bin ./build/mt7621_stage_sram.bin + $ make O=build + +Burn the u-boot-mt7621.bin to the SPI-NOR or NAND flash.
Signature · 1 line
2.17.1
PATCH v6 8/25 clk: mtmips: add clock driver for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds a clock driver for MediaTek MT7621 SoC.
This driver provides clock gate control as well as getting clock frequency for CPU/SYS/XTAL and some peripherals.
---
v6 changes: use FIELD_GET for register fields instead of shift opertations v5 changes:
Remove the use of common.h
Use GENMASK and BITS for register fields
Add request() to check clk id
Adjust probe() due to clkctrl node becomes a subnode of sysc Use regmap api to read memc registers
v4 changes: none
v3 changes: update clock definitions to match upstream kernel v2 changes: none
--- drivers/clk/mtmips/Makefile | 1 + drivers/clk/mtmips/clk-mt7621.c | 288 +++++++++++++++++++++++++ include/dt-bindings/clock/mt7621-clk.h | 46 ++++ 3 files changed, 335 insertions(+) create mode 100644 drivers/clk/mtmips/clk-mt7621.c create mode 100644 include/dt-bindings/clock/mt7621-clk.h
drivers/clk/mtmips/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_SOC_MT7620) += clk-mt7620.o +obj-$(CONFIG_SOC_MT7621) += clk-mt7621.o obj-$(CONFIG_SOC_MT7628) += clk-mt7628.o
drivers/clk/mtmips/clk-mt7621.c new file +288 -0
288 lines not on this page · raw message
include/dt-bindings/clock/mt7621-clk.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 5/25 mips: mtmips: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds support for MediaTek MT7621 SoC.
All files are dedicated for u-boot.
The default build target is u-boot-mt7621.bin.
The specification of this chip:
https://www.mediatek.com/products/homenetworking/mt7621
---
v6 changes:
Use FIELD_GET/FIELD_PREP for register fields instead of shift operations Rename fixed clock node name in mt7621.dtsi
Panic if dram binary blob is wrong in spl
Remove redundant nop's if noreorder is not used
Use execution_hazard_barrier() in tpl
v5 changes:
Fix dram binary blob loading procedure
Adjust mt7621.dtsi, clkctrl moved under sysc, pinctrl default states removed
v4 changes:
Add full support for booting from flash (SPL/TPL support)
Boot all cores/VPEs
Use binman to generate final binary
Use binman to embed external binary blob
v3 changes:
Update clock name for mt7621.dtsi due to clk driver changed
v2 changes:
Add a kconfig for max supported ram size
Remove network configs from default config file
--- arch/mips/dts/mt7621-u-boot.dtsi | 111 ++++++ arch/mips/dts/mt7621.dtsi | 349 +++++++++++++++++++ arch/mips/mach-mtmips/Kconfig | 49 ++- arch/mips/mach-mtmips/Makefile | 4 + arch/mips/mach-mtmips/cpu.c | 2 +- arch/mips/mach-mtmips/mt7621/Kconfig | 95 +++++ arch/mips/mach-mtmips/mt7621/Makefile | 14 + arch/mips/mach-mtmips/mt7621/init.c | 246 +++++++++++++ arch/mips/mach-mtmips/mt7621/mt7621.h | 229 ++++++++++++ arch/mips/mach-mtmips/mt7621/serial.c | 23 ++ arch/mips/mach-mtmips/mt7621/spl/Makefile | 9 + arch/mips/mach-mtmips/mt7621/spl/cps.c | 153 ++++++++ arch/mips/mach-mtmips/mt7621/spl/dram.c | 153 ++++++++ arch/mips/mach-mtmips/mt7621/spl/dram.h | 39 +++ arch/mips/mach-mtmips/mt7621/spl/launch.c | 100 ++++++ arch/mips/mach-mtmips/mt7621/spl/launch.h | 52 +++ arch/mips/mach-mtmips/mt7621/spl/launch_ll.S | 339 ++++++++++++++++++ arch/mips/mach-mtmips/mt7621/spl/serial.c | 24 ++ arch/mips/mach-mtmips/mt7621/spl/spl.c | 95 +++++ arch/mips/mach-mtmips/mt7621/spl/start.S | 226 ++++++++++++ arch/mips/mach-mtmips/mt7621/sram_init.S | 22 ++ arch/mips/mach-mtmips/mt7621/tpl/Makefile | 4 + arch/mips/mach-mtmips/mt7621/tpl/start.S | 161 +++++++++ arch/mips/mach-mtmips/mt7621/tpl/tpl.c | 144 ++++++++ include/configs/mt7621.h | 67 ++++ 25 files changed, 2704 insertions(+), 6 deletions(-) create mode 100644 arch/mips/dts/mt7621-u-boot.dtsi create mode 100644 arch/mips/dts/mt7621.dtsi create mode 100644 arch/mips/mach-mtmips/mt7621/Kconfig create mode 100644 arch/mips/mach-mtmips/mt7621/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/init.c create mode 100644 arch/mips/mach-mtmips/mt7621/mt7621.h create mode 100644 arch/mips/mach-mtmips/mt7621/serial.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/spl/cps.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/dram.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/dram.h create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch.h create mode 100644 arch/mips/mach-mtmips/mt7621/spl/launch_ll.S create mode 100644 arch/mips/mach-mtmips/mt7621/spl/serial.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/spl.c create mode 100644 arch/mips/mach-mtmips/mt7621/spl/start.S create mode 100644 arch/mips/mach-mtmips/mt7621/sram_init.S create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/Makefile create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/start.S create mode 100644 arch/mips/mach-mtmips/mt7621/tpl/tpl.c create mode 100644 include/configs/mt7621.h
arch/mips/dts/mt7621-u-boot.dtsi new file +111 -0
@@ -0,0 +1,111 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 MediaTek Inc. All rights reserved. + * + * Author: Weijie Gao <[email protected]> + */ + +#include <linux/stringify.h> + +/ { + binman: binman { + multiple-images; + }; +}; + +&sysc { + u-boot,dm-pre-reloc; +}; + +&reboot { + u-boot,dm-pre-reloc; +}; + +&clkctrl { + u-boot,dm-pre-reloc; +}; + +&rstctrl { + u-boot,dm-pre-reloc; +}; + +&pinctrl { + u-boot,dm-pre-reloc; +}; + +&uart0 { + u-boot,dm-pre-reloc; +}; + +&uart1 { + u-boot,dm-pre-reloc; +}; + +&uart2 { + u-boot,dm-pre-reloc; +}; + +&binman { + u-boot-spl-ddr { + align = <4>; + align-size = <4>; + filename = "u-boot-spl-ddr.bin"; + pad-byte = <0xff>; + + u-boot-spl { + align-end = <4>; + filename = "u-boot-spl.bin"; + }; + + stage_bin { + filename = "mt7621_stage_sram.bin"; + type = "blob-ext"; + }; + }; + + spl-img { + filename = "u-boot-spl-ddr.img"; + + mkimage { +#ifdef CONFIG_MT7621_BOOT_FROM_NAND + args = "-T", "mtk_image", "-n", "mt7621=1", + "-a", __stringify(CONFIG_SPL_TEXT_BASE), + "-e", __stringify(CONFIG_SPL_TEXT_BASE); +#else + args = "-A", "mips", "-T", "standalone", "-O", "u-boot", + "-C", "none", "-n", "MT7621 U-Boot SPL", + "-a", __stringify(CONFIG_SPL_TEXT_BASE), + "-e", __stringify(CONFIG_SPL_TEXT_BASE); +#endif + + blob { + filename = "u-boot-spl-ddr.bin"; + }; + }; + }; + + mt7621-uboot { + filename = "u-boot-mt7621.bin"; + pad-byte = <0xff>; + +#ifndef CONFIG_MT7621_BOOT_FROM_NAND + u-boot-tpl { + align-end = <4>; + filename = "u-boot-tpl.bin"; + }; +#endif + + spl { +#ifdef CONFIG_MT7621_BOOT_FROM_NAND + align-end = <0x1000>; +#endif + filename = "u-boot-spl-ddr.img"; + type = "blob"; + }; + + u-boot { + filename = "u-boot-lzma.img"; + type = "blob"; + }; + }; +};
arch/mips/dts/mt7621.dtsi new file +349 -0
349 lines not on this page · raw message
arch/mips/mach-mtmips/Kconfig +44 -5
87 lines not on this page · raw message
arch/mips/mach-mtmips/Makefile +4 -0
@@ -1,9 +1,13 @@ # SPDX-License-Identifier: GPL-2.0+ obj-y += cpu.o + +ifneq ($(CONFIG_SOC_MT7621),y) obj-y += ddr_init.o obj-y += ddr_cal.o obj-$(CONFIG_SPL_BUILD) += spl.o +endif obj-$(CONFIG_SOC_MT7620) += mt7620/ +obj-$(CONFIG_SOC_MT7621) += mt7621/ obj-$(CONFIG_SOC_MT7628) += mt7628/
arch/mips/mach-mtmips/cpu.c +1 -1
@@ -16,7 +16,7 @@ DECLARE_GLOBAL_DATA_PTR;int dram_init (void ) { - gd->ram_size =get_ram_size ((void *)KSEG1 ,SZ_256M ); + gd->ram_size =get_ram_size ((void *)KSEG1 ,CONFIG_MAX_MEM_SIZE <<20 );return 0 ; }
arch/mips/mach-mtmips/mt7621/Kconfig new file +95 -0
95 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += init.o +obj-y += serial.o + +ifeq ($(CONFIG_SPL_BUILD),y) +ifeq ($(CONFIG_TPL_BUILD),y) +obj-y += tpl/ +else +obj-y += spl/ +endif + +obj-y += sram_init.o +endif
arch/mips/mach-mtmips/mt7621/init.c new file +246 -0
246 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/mt7621.h new file +229 -0
229 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/serial.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/ + +#include <asm/io.h> +#include <asm/addrspace.h> +#include "mt7621.h" + +void board_debug_uart_init (void ) +{ +void __iomem *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE ); + +#if CONFIG_DEBUG_UART_BASE ==0xbe000c00 /* KSEG1ADDR(UART1_BASE) */ +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART1_MODE ); +#elif CONFIG_DEBUG_UART_BASE ==0xbe000d00 /* KSEG1ADDR(UART2_BASE) */ +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART2_MODE_M ); +#elif CONFIG_DEBUG_UART_BASE ==0xbe000e00 /* KSEG1ADDR(UART3_BASE) */ +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART3_MODE_M ); +#endif +}
arch/mips/mach-mtmips/mt7621/spl/Makefile new file +9 -0
@@ -0,0 +1,9 @@ + +extra-y += start.o + +obj-y += spl.o +obj-y += cps.o +obj-y += dram.o +obj-y += serial.o +obj-y += launch.o +obj-y += launch_ll.o
arch/mips/mach-mtmips/mt7621/spl/cps.c new file +153 -0
153 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/dram.c new file +153 -0
153 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/dram.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/ + +#ifndef _MT7621_DRAM_H_ +#define _MT7621_DRAM_H_ + +#define STAGE_LOAD_ADDR 0xBE108800 + +#ifndef __ASSEMBLY__ +#include <linux/types.h> + +#define DDR_PARAM_SIZE 24 + +struct stage_header { +u32 jump_insn[2 ]; +u32 ep; +u32 stage_size; +u32 has_stage2; +u32 next_ep; +u32 next_size; +u32 next_offset; +u32 cpu_pll_cfg; +u32 ddr_pll_cfg; +u32 reserved2[6 ]; +char build_tag[32 ]; +u32 ddr3_act[DDR_PARAM_SIZE ]; +u32 padding1[2 ]; +u32 ddr2_act[DDR_PARAM_SIZE ]; +u32 padding2[2 ]; +u32 baudrate; +u32 padding3; +}; +#endif + +#endif /* _MT7621_DRAM_H_ */
arch/mips/mach-mtmips/mt7621/spl/launch.c new file +100 -0
100 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/launch.h new file +52 -0
52 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/launch_ll.S new file +339 -0
339 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/serial.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/ + +#include <asm/io.h> +#include "../mt7621.h" + +void mtmips_spl_serial_init (void ) +{ +#ifdef CONFIG_SPL_SERIAL +void __iomem *base =ioremap_nocache (SYSCTL_BASE ,SYSCTL_SIZE ); + +#if CONFIG_CONS_INDEX ==1 +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART1_MODE ); +#elif CONFIG_CONS_INDEX ==2 +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART2_MODE_M ); +#elif CONFIG_CONS_INDEX ==3 +clrbits_32 (base +SYSCTL_GPIOMODE_REG ,UART3_MODE_M ); +#endif /* CONFIG_CONS_INDEX */ +#endif /* CONFIG_SPL_SERIAL */ +}
arch/mips/mach-mtmips/mt7621/spl/spl.c new file +95 -0
95 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/spl/start.S new file +226 -0
226 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/sram_init.S new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 MediaTek Inc. All rights reserved. + * + * Author: Weijie Gao <[email protected]> + */ + +#include <asm/addrspace.h> +#include <asm/asm.h> +#include <asm/regdef.h> +#include "mt7621.h" + +LEAF(mips_sram_init) + li t0, KSEG1ADDR(FE_BASE) + li t1, FE_PSE_RESET + sw t1, FE_RST_GLO_REG(t0) + + li t1, (FE_PSE_RAM | FE_PSE_MEM_EN) + sw t1, FE_RST_GLO_REG(t0) + + jr ra + END(mips_sram_init)
arch/mips/mach-mtmips/mt7621/tpl/Makefile new file +4 -0
@@ -0,0 +1,4 @@ + +extra-y += start.o + +obj-y += tpl.o
arch/mips/mach-mtmips/mt7621/tpl/start.S new file +161 -0
161 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/tpl/tpl.c new file +144 -0
144 lines not on this page · raw message
include/configs/mt7621.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 6/25 mips: mtmips: add two reference boards for mt7621
In reply to Weijie GaoThe mt7621_rfb board supports integrated giga PHYs plus one external giga PHYs. It also has up to 512MiB DDR3, 16MB SPI-NOR, 3 mini PCI-e x1 slots, SDXC and USB.
The mt7621_nand_rfb board is almost the same as mt7621_rfb board, but it uses NAND flash and SDXC is not available.
---
v6 changes: none
v5 changes:
Fix defconfig file names in MAINTAINERS
Remove unused configs in defconfig files
Move pinctrl default states to board dts files
v4 changes:
Modify defconfig files for booting from flash
v3 changes: none
v2 changes:
Add config file for mt7621-rfb boards
--- arch/mips/dts/Makefile | 2 + arch/mips/dts/mediatek,mt7621-nand-rfb.dts | 67 +++++++++++++++++ arch/mips/dts/mediatek,mt7621-rfb.dts | 82 +++++++++++++++++++++ arch/mips/mach-mtmips/mt7621/Kconfig | 20 ++++++ board/mediatek/mt7621/MAINTAINERS | 8 +++ board/mediatek/mt7621/Makefile | 3 + board/mediatek/mt7621/board.c | 6 ++ configs/mt7621_nand_rfb_defconfig | 83 ++++++++++++++++++++++ configs/mt7621_rfb_defconfig | 82 +++++++++++++++++++++ 9 files changed, 353 insertions(+) create mode 100644 arch/mips/dts/mediatek,mt7621-nand-rfb.dts create mode 100644 arch/mips/dts/mediatek,mt7621-rfb.dts create mode 100644 board/mediatek/mt7621/MAINTAINERS create mode 100644 board/mediatek/mt7621/Makefile create mode 100644 board/mediatek/mt7621/board.c create mode 100644 configs/mt7621_nand_rfb_defconfig create mode 100644 configs/mt7621_rfb_defconfig
arch/mips/dts/Makefile +2 -0
@@ -16,6 +16,8 @@ dtb-$(CONFIG_BOARD_COMTREND_WAP5813N) += comtrend,wap-5813n.dtb dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb dtb-$(CONFIG_BOARD_MT7620_RFB) += mediatek,mt7620-rfb.dtb dtb-$(CONFIG_BOARD_MT7620_MT7530_RFB) += mediatek,mt7620-mt7530-rfb.dtb +dtb-$(CONFIG_BOARD_MT7621_RFB) += mediatek,mt7621-rfb.dtb +dtb-$(CONFIG_BOARD_MT7621_NAND_RFB) += mediatek,mt7621-nand-rfb.dtb dtb-$(CONFIG_BOARD_MT7628_RFB) += mediatek,mt7628-rfb.dtb dtb-$(CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688) += gardena-smart-gateway-mt7688.dtb dtb-$(CONFIG_BOARD_LINKIT_SMART_7688) += linkit-smart-7688.dtb
arch/mips/dts/mediatek,mt7621-nand-rfb.dts new file +67 -0
67 lines not on this page · raw message
arch/mips/dts/mediatek,mt7621-rfb.dts new file +82 -0
82 lines not on this page · raw message
arch/mips/mach-mtmips/mt7621/Kconfig +20 -0
@@ -79,6 +79,26 @@ config MT7621_BOOT_FROM_NAND choice prompt "Board select" +config BOARD_MT7621_RFB + bool "MediaTek MT7621 RFB (SPI-NOR)" + help + The reference design of MT7621A (WS3010) booting from SPI-NOR flash. + The board can be configured with DDR2 (64MiB~256MiB) or DDR3 + (128MiB~512MiB). The board has 16 MiB SPI-NOR flash, built-in MT7530 + GbE switch, 1 UART, 1 USB 2.0 host, 1 USB 3.0 host, 1 SDXC, 3 PCIe + sockets, 1 RGMII to external GbE PHY, 2 audio jacks (in/out), + JTAG pins and expansion GPIO pins. + +config BOARD_MT7621_NAND_RFB + bool "MediaTek MT7621 RFB (NAND)" + help + The reference design of MT7621A (WS3010) booting from NAND flash. + The board can be configured with DDR2 (64MiB~256MiB) or DDR3 + (128MiB~512MiB). The board has 128 MiB parallel NAND flash, built-in + MT7530 GbE switch, 1 UART, 1 USB 2.0 host, 1 USB 3.0 host, 3 PCIe + sockets, 1 RGMII to external GbE PHY, 2 audio jacks (in/out), + JTAG pins and expansion GPIO pins. + endchoice config SYS_CONFIG_NAME
board/mediatek/mt7621/MAINTAINERS new file +8 -0
@@ -0,0 +1,8 @@ +MT7621_RFB BOARD +M: Weijie Gao <[email protected]> +S: Maintained +F: board/mediatek/mt7621 +F: configs/mt7621_rfb_defconfig +F: configs/mt7621_nand_rfb_defconfig +F: arch/mips/dts/mediatek,mt7621-rfb.dts +F: arch/mips/dts/mediatek,mt7621-nand-rfb.dts
board/mediatek/mt7621/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += board.o
board/mediatek/mt7621/board.c new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/
configs/mt7621_nand_rfb_defconfig new file +83 -0
83 lines not on this page · raw message
configs/mt7621_rfb_defconfig new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 9/25 reset: mtmips: add reset controller support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds reset controller bits definition header file for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- include/dt-bindings/reset/mt7621-reset.h | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/dt-bindings/reset/mt7621-reset.h
include/dt-bindings/reset/mt7621-reset.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/ + +#ifndef _DT_BINDINGS_MT7621_RESET_H_ +#define _DT_BINDINGS_MT7621_RESET_H_ + +#define RST_PPE 31 +#define RST_SDXC 30 +#define RST_CRYPTO 29 +#define RST_AUX_STCK 28 +#define RST_PCIE2 26 +#define RST_PCIE1 25 +#define RST_PCIE0 24 +#define RST_GMAC 23 +#define RST_UART3 21 +#define RST_UART2 20 +#define RST_UART1 19 +#define RST_SPI 18 +#define RST_I2S 17 +#define RST_I2C 16 +#define RST_NFI 15 +#define RST_GDMA 14 +#define RST_PIO 13 +#define RST_PCM 11 +#define RST_MC 10 +#define RST_INTC 9 +#define RST_TIMER 8 +#define RST_SPDIFTX 7 +#define RST_FE 6 +#define RST_HSDMA 5 +#define RST_MCM 2 +#define RST_SYS 0 + +#endif /* _DT_BINDINGS_MT7621_RESET_H_ */
Signature · 1 line
2.17.1
PATCH v6 10/25 pinctrl: mtmips: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds pinctrl support for MediaTek MT7621 SoC. The MT7621 SoC supports pinconf, but it is not the same as mt7628.
---
v6 changes: none
v5 changes: Remove the use of common.h
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/pinctrl/mtmips/Kconfig | 9 + drivers/pinctrl/mtmips/Makefile | 1 + drivers/pinctrl/mtmips/pinctrl-mt7621.c | 306 ++++++++++++++++++ .../pinctrl/mtmips/pinctrl-mtmips-common.c | 4 +- .../pinctrl/mtmips/pinctrl-mtmips-common.h | 12 + 5 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 drivers/pinctrl/mtmips/pinctrl-mt7621.c
drivers/pinctrl/mtmips/Kconfig +9 -0
@@ -12,6 +12,15 @@ config PINCTRL_MT7620 The driver is controlled by a device tree node which contains the pin mux functions for each available pin groups. +config PINCTRL_MT7621 + bool "MediaTek MT7621 pin control driver" + select PINCTRL_MTMIPS + depends on SOC_MT7621 && PINCTRL_GENERIC + help + Support pin multiplexing control on MediaTek MT7621. + The driver is controlled by a device tree node which contains + the pin mux functions for each available pin groups. + config PINCTRL_MT7628 bool "MediaTek MT7628 pin control driver" select PINCTRL_MTMIPS
drivers/pinctrl/mtmips/Makefile +1 -0
@@ -5,4 +5,5 @@ obj-$(CONFIG_PINCTRL_MTMIPS) += pinctrl-mtmips-common.o # SoC Drivers obj-$(CONFIG_PINCTRL_MT7620) += pinctrl-mt7620.o +obj-$(CONFIG_PINCTRL_MT7621) += pinctrl-mt7621.o obj-$(CONFIG_PINCTRL_MT7628) += pinctrl-mt7628.o
drivers/pinctrl/mtmips/pinctrl-mt7621.c new file +306 -0
306 lines not on this page · raw message
drivers/pinctrl/mtmips/pinctrl-mtmips-common.c +2 -2
@@ -13,8 +13,8 @@#include "pinctrl-mtmips-common.h" -static void mtmips_pinctrl_reg_set (struct mtmips_pinctrl_priv *priv, -u32 reg,u32 shift,u32 mask,u32 value) +void mtmips_pinctrl_reg_set (struct mtmips_pinctrl_priv *priv, +u32 reg,u32 shift,u32 mask,u32 value) {u32 val;
drivers/pinctrl/mtmips/pinctrl-mtmips-common.h +12 -0
@@ -22,6 +22,10 @@ struct mtmips_pmx_group {u32 shift;char mask; +int pconf_avail; +u32 pconf_reg; +u32 pconf_shift; +int nfuncs;const struct mtmips_pmx_func *funcs; };
@@ -42,6 +46,14 @@ struct mtmips_pinctrl_priv { { .name = (_name), .reg = (_reg), .shift = (_shift), .mask = (_mask), \ .funcs = (_funcs), .nfuncs = ARRAY_SIZE(_funcs) } +#define GRP_PCONF (_name, _funcs, _reg, _shift, _mask, _pconf_reg, _pconf_shift) \ + { .name = (_name), .reg = (_reg), .shift = (_shift), .mask = (_mask), \ + .funcs = (_funcs), .nfuncs = ARRAY_SIZE(_funcs), .pconf_avail = 1, \ + .pconf_reg = (_pconf_reg), .pconf_shift = (_pconf_shift) } + +void mtmips_pinctrl_reg_set (struct mtmips_pinctrl_priv *priv, +u32 reg,u32 shift,u32 mask,u32 value); +int mtmips_get_functions_count (struct udevice *dev);const char *mtmips_get_function_name (struct udevice *dev,unsigned int selector);
Signature · 1 line
2.17.1
PATCH v6 11/25 usb: xhci-mtk: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch makes xhci-mtk driver available for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/usb/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/Kconfig +1 -1
@@ -34,7 +34,7 @@ config USB_XHCI_DWC3_OF_SIMPLE config USB_XHCI_MTK bool "Support for MediaTek on-chip xHCI USB controller" - depends on ARCH_MEDIATEK + depends on ARCH_MEDIATEK || SOC_MT7621 help Enables support for the on-chip xHCI controller on MediaTek SoCs.
Signature · 1 line
2.17.1
PATCH v6 13/25 spi: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch makes mt7621_spi driver available for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/spi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/Kconfig +1 -1
@@ -240,7 +240,7 @@ config MT7620_SPI config MT7621_SPI bool "MediaTek MT7621 SPI driver" - depends on SOC_MT7628 + depends on SOC_MT7621 || SOC_MT7628 help Enable the MT7621 SPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Ralink / MediaTek
Signature · 1 line
2.17.1
PATCH v6 14/25 gpio: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch makes mt7621_gpio driver available for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/gpio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -1
@@ -552,7 +552,7 @@ config MT7620_GPIO config MT7621_GPIO bool "MediaTek MT7621 GPIO driver" - depends on DM_GPIO && SOC_MT7628 + depends on DM_GPIO && (SOC_MT7621 || SOC_MT7628) default y help Say yes here to support MediaTek MT7621 compatible GPIOs.
Signature · 1 line
2.17.1
PATCH v6 12/25 phy: mtk-tphy: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch makes mtk-tphy driver available for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/Kconfig +1 -1
@@ -266,7 +266,7 @@ config MT76X8_USB_PHY config PHY_MTK_TPHY bool "MediaTek T-PHY Driver" depends on PHY - depends on ARCH_MEDIATEK + depends on ARCH_MEDIATEK || SOC_MT7621 help MediaTek T-PHY driver supports usb2.0, usb3.0 ports, PCIe and SATA, and meanwhile supports two version T-PHY which have
Signature · 1 line
2.17.1
PATCH v6 16/25 mmc: mediatek: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds SDXC support for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/mmc/mtk-sd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mmc/mtk-sd.c +13 -0
@@ -1761,6 +1761,18 @@ static const struct msdc_compatible mt7620_compat = { .default_pad_dly = true, }; +static const struct msdc_compatible mt7621_compat = { + .clk_div_bits =8 , + .pad_tune0 = false, + .async_fifo = true, + .data_tune = true, + .busy_check = false, + .stop_clk_fix = false, + .enhance_rx = false, + .builtin_pad_ctrl = true, + .default_pad_dly = true, +}; +static const struct msdc_compatible mt7622_compat = { .clk_div_bits =12 , .pad_tune0 = true,
@@ -1809,6 +1821,7 @@ static const struct msdc_compatible mt8183_compat = {static const struct udevice_id msdc_ids[] = { { .compatible ="mediatek,mt7620-mmc" , .data = (ulong)&mt7620_compat }, + { .compatible ="mediatek,mt7621-mmc" , .data = (ulong)&mt7621_compat }, { .compatible ="mediatek,mt7622-mmc" , .data = (ulong)&mt7622_compat }, { .compatible ="mediatek,mt7623-mmc" , .data = (ulong)&mt7623_compat }, { .compatible ="mediatek,mt8512-mmc" , .data = (ulong)&mt8512_compat },
Signature · 1 line
2.17.1
PATCH v6 17/25 net: mediatek: remap iobase address
In reply to Weijie GaoThe iobase address from dts node is actually physical address. It's identical to the virtual address in ARM platform. This is ok because this driver was used only by ARM platforms (mt7622/mt7623 ...).
But now this driver will be used by mt7621 which is a MIPS SoC. For MIPS platform the physical address space is mapped to KSEG0 and KSEG1 and this makes the virtual address apparently not idential to its physical address.
To solve this issue, this patch replaces dev_read_addr with dev_remap_addr to get the remapped iobase address.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- drivers/net/mtk_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mtk_eth.c +1 -1
@@ -1419,7 +1419,7 @@ static int mtk_eth_of_to_plat(struct udevice *dev) priv->soc =dev_get_driver_data (dev); - pdata->iobase =dev_read_addr (dev); + pdata->iobase = (phys_addr_t )dev_remap_addr (dev);/* get corresponding ethsys phandle */ ret = dev_read_phandle_with_args(dev, "mediatek,ethsys", NULL, 0, 0,
Signature · 1 line
2.17.1
PATCH v6 15/25 watchdog: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch makes mt7621_wdt driver available for MediaTek MT7621 SoC
---
v6 changes: none
v5 changes: none
v4 changes: none
v3 changes: none
v2 changes: none
--- drivers/watchdog/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
@@ -191,7 +191,7 @@ config WDT_MT7620 config WDT_MT7621 bool "MediaTek MT7621 watchdog timer support" - depends on WDT && SOC_MT7628 + depends on WDT && (SOC_MT7621 || SOC_MT7628) help Select this to enable Ralink / Mediatek watchdog timer, which can be found on some MediaTek chips.
Signature · 1 line
2.17.1
PATCH v6 18/25 net: mediatek: use regmap api to modify ethsys registers
In reply to Weijie GaoThe address returned by regmap_get_range() is not remapped. Directly r/w to this address is ok for ARM platforms since it's idential to the virtual address.
But for MIPS platform only virtual address should be used for access. To solve this issue, the regmap api regmap_read/regmap_write should be used since they will remap address before accessing.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- drivers/net/mtk_eth.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/mtk_eth.c +11 -11
@@ -159,9 +159,10 @@ struct mtk_eth_priv {void __iomem *fe_base;void __iomem *gmac_base; -void __iomem *ethsys_base;void __iomem *sgmii_base; +struct regmap *ethsys_regmap; +struct mii_dev *mdio_bus;int (*mii_read)(struct mtk_eth_priv *priv,u8 phy,u8 reg);int (*mii_write)(struct mtk_eth_priv *priv,u8 phy,u8 reg,u16 val);
@@ -233,7 +234,12 @@ static void mtk_gmac_rmw(struct mtk_eth_priv *priv, u32 reg, u32 clr, u32 set)static void mtk_ethsys_rmw (struct mtk_eth_priv *priv,u32 reg,u32 clr,u32 set) { -clrsetbits_le32 (priv->ethsys_base + reg, clr, set); +uint val; + +regmap_read (priv->ethsys_regmap, reg, &val); + val &= ~clr; + val |= set; +regmap_write (priv->ethsys_regmap, reg, val); }/* Direct MDIO clause 22/45 access via SoC */
@@ -1427,15 +1433,9 @@ static int mtk_eth_of_to_plat(struct udevice *dev)if (ret)return ret; - regmap =syscon_node_to_regmap (args.node); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); - - priv->ethsys_base =regmap_get_range (regmap,0 ); -if (!priv->ethsys_base) { -dev_err (dev,"Unable to find ethsys\n" ); -return -ENODEV ; - } + priv->ethsys_regmap =syscon_node_to_regmap (args.node); +if (IS_ERR (priv->ethsys_regmap)) +return PTR_ERR (priv->ethsys_regmap);/* Reset controllers */ ret =reset_get_by_name (dev,"fe" , &priv->rst_fe);
Signature · 1 line
2.17.1
PATCH v6 19/25 net: mediatek: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds GMAC support for MediaTek MT7621 SoC. MT7621 has the same GMAC/Switch configuration as MT7623.
---
v6 changes: none
v5 changes: none
v4 changes:
Split unrelated changes to new patches
v3 changes:
Add register remap needed by mt7621
Fix use of noncached_alloc
v2 changes: none
--- drivers/net/mtk_eth.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/net/mtk_eth.c +15 -6
@@ -145,7 +145,8 @@ enum mtk_switch {enum mtk_soc {SOC_MT7623 ,SOC_MT7629 , -SOC_MT7622 +SOC_MT7622 , +SOC_MT7621 };struct mtk_eth_priv {
@@ -675,12 +676,18 @@ static int mt7530_pad_clk_setup(struct mtk_eth_priv *priv, int mode)static int mt7530_setup (struct mtk_eth_priv *priv) {u16 phy_addr, phy_val; -u32 val; +u32 val, txdrv;int i; -/* Select 250MHz clk for RGMII mode */ -mtk_ethsys_rmw (priv,ETHSYS_CLKCFG0_REG , -ETHSYS_TRGMII_CLK_SEL362_5 ,0 ); +if (priv->soc !=SOC_MT7621 ) { +/* Select 250MHz clk for RGMII mode */ +mtk_ethsys_rmw (priv,ETHSYS_CLKCFG0_REG , +ETHSYS_TRGMII_CLK_SEL362_5 ,0 ); + + txdrv =8 ; + }else { + txdrv =4 ; + }/* Modify HWTRAP first to allow direct access to internal PHYs */ mt753x_reg_read (priv,HWTRAP_REG , &val);
@@ -738,7 +745,8 @@ static int mt7530_setup(struct mtk_eth_priv *priv)/* Lower Tx Driving for TRGMII path */ for (i =0 ; i <NUM_TRGMII_CTRL ; i++)mt753x_reg_write (priv,MT7530_TRGMII_TD_ODT (i), - (8 <<TD_DM_DRVP_S ) | (8 <<TD_DM_DRVN_S )); + (txdrv <<TD_DM_DRVP_S ) | + (txdrv <<TD_DM_DRVN_S ));for (i =0 ; i <NUM_TRGMII_CTRL ; i++)mt753x_reg_rmw (priv,MT7530_TRGMII_RD (i),RD_TAP_M ,16 );
@@ -1540,6 +1548,7 @@ static const struct udevice_id mtk_eth_ids[] = { { .compatible = "mediatek,mt7629-eth", .data = SOC_MT7629 }, { .compatible = "mediatek,mt7623-eth", .data = SOC_MT7623 }, { .compatible = "mediatek,mt7622-eth", .data = SOC_MT7622 }, + { .compatible = "mediatek,mt7621-eth", .data = SOC_MT7621 }, {} };
Signature · 1 line
2.17.1
PATCH v6 21/25 spl: allow using nand base without standard nand driver
In reply to Weijie GaoThis patch removes the dependency to SPL_NAND_DRIVERS for SPL_NAND_BASE to allow minimal spl nand driver to use nand base for probing NAND chips.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- common/spl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/Kconfig +1 -1
@@ -764,7 +764,7 @@ config SPL_NAND_SIMPLE expose the cmd_ctrl() interface. config SPL_NAND_BASE - depends on SPL_NAND_DRIVERS + depends on SPL_NAND_SUPPORT bool "Use Base NAND Driver" help Include nand_base.c in the SPL.
Signature · 1 line
2.17.1
PATCH v6 22/25 spl: spl_legacy: fix the use of SPL_COPY_PAYLOAD_ONLY
In reply to Weijie GaoIf the payload is compressed, SPL_COPY_PAYLOAD_ONLY should always be set since the payload will not be directly read to its load address. The payload will first be read to a temporary buffer, and then be decompressed to its load address, without image header.
If the payload is not compressed, and SPL_COPY_PAYLOAD_ONLY is set, image header should be skipped on loading. Otherwise image header should also be read to its load address.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- common/spl/spl_legacy.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
common/spl/spl_legacy.c +19 -2
@@ -88,15 +88,29 @@ int spl_load_legacy_img(struct spl_image_info *spl_image,/* Read header into local struct */ load->read (load, header,sizeof (hdr), &hdr); +/* +* If the payload is compressed, the decompressed data should be +* directly write to its load address. +*/ +if (spl_image_get_comp (&hdr) !=IH_COMP_NONE ) + spl_image->flags |=SPL_COPY_PAYLOAD_ONLY ; + ret =spl_parse_image_header (spl_image, bootdev, &hdr);if (ret)return ret; - dataptr = header +sizeof (hdr); -/* Read image */ switch (spl_image_get_comp (&hdr)) {case IH_COMP_NONE : + dataptr = header; + +/* +* Image header will be skipped only if SPL_COPY_PAYLOAD_ONLY +* is set +*/ +if (spl_image->flags &SPL_COPY_PAYLOAD_ONLY ) + dataptr +=sizeof (hdr); + load->read (load, dataptr, spl_image->size, (void *)(unsigned long )spl_image->load_addr);break ;
@@ -104,6 +118,9 @@ int spl_load_legacy_img(struct spl_image_info *spl_image,case IH_COMP_LZMA : lzma_len =LZMA_LEN ; +/* dataptr points to compressed payload */ + dataptr = header +sizeof (hdr); +debug ("LZMA: Decompressing %08lx to %08lx\n" , dataptr, spl_image->load_addr); src =malloc (spl_image->size);
Signature · 1 line
2.17.1
PATCH v6 23/25 spl: nand: support loading legacy image with payload compressed
In reply to Weijie GaoAdd support to load legacy image with payload compressed. This redirects the boot flow for all legacy images. If the payload is not compressed, the actual behavior will remain unchanged.
---
v6 changes: none
v5 changes: none
v4 changes: new
--- common/spl/spl_nand.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
common/spl/spl_nand.c +27 -0
@@ -59,6 +59,21 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,return size / load->bl_len; } +static ulong spl_nand_legacy_read (struct spl_load_info *load,ulong offs, +ulong size,void *dst) +{ +int err; + +debug ("%s: offs %lx, size %lx, dst %p\n" , + __func__, offs, size, dst); + + err =nand_spl_load_image (offs, size, dst); +if (err) +return 0 ; + +return size; +} +struct mtd_info *__weak nand_get_mtd (void ) {return NULL ;
@@ -96,6 +111,18 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, load.bl_len = bl_len; load.read = spl_nand_fit_read;return spl_load_imx_container (spl_image, &load, offset / bl_len); + }else if (IS_ENABLED (CONFIG_SPL_LEGACY_IMAGE_FORMAT ) && +image_get_magic (header) ==IH_MAGIC ) { +struct spl_load_info load; + +debug ("Found legacy image\n" ); + load.dev =NULL ; + load.priv =NULL ; + load.filename =NULL ; + load.bl_len =1 ; + load.read = spl_nand_legacy_read; + +return spl_load_legacy_img (spl_image, bootdev, &load, offset); }else { err =spl_parse_image_header (spl_image, bootdev, header);if (err)
Signature · 1 line
2.17.1
PATCH v6 20/25 nand: raw: add support for MediaTek MT7621 SoC
In reply to Weijie GaoThis patch adds NAND flash controller driver for MediaTek MT7621 SoC. The NAND flash controller of MT7621 supports only SLC NAND flashes. It supports 4~12 bits correction with maximum 4KB page size.
---
v6 changes:
Use FIELD_GET/FIELD_PREP for register fields instead of shift opertations
v5 changes: remove unused code from spl loader
v4 changes: Add support for spl loader
v3 changes: none
v2 changes: none
--- drivers/mtd/nand/raw/Kconfig | 17 +- drivers/mtd/nand/raw/Makefile | 2 + drivers/mtd/nand/raw/mt7621_nand.c | 1205 ++++++++++++++++++++++++ drivers/mtd/nand/raw/mt7621_nand.h | 29 + drivers/mtd/nand/raw/mt7621_nand_spl.c | 237 +++++ 5 files changed, 1488 insertions(+), 2 deletions(-) create mode 100644 drivers/mtd/nand/raw/mt7621_nand.c create mode 100644 drivers/mtd/nand/raw/mt7621_nand.h create mode 100644 drivers/mtd/nand/raw/mt7621_nand_spl.c
drivers/mtd/nand/raw/Kconfig +15 -2
@@ -521,12 +521,25 @@ config TEGRA_NAND help Enables support for NAND Flash chips on Tegra SoCs platforms. +config NAND_MT7621 + bool "Support for MediaTek MT7621 NAND flash controller" + depends on SOC_MT7621 + select SYS_NAND_SELF_INIT + select SPL_SYS_NAND_SELF_INIT + imply CMD_NAND + help + This enables NAND driver for the NAND flash controller on MediaTek + MT7621 platform. + The controller supports 4~12 bits correction per 512 bytes with a + maximum 4KB page size. + comment "Generic NAND options" config SYS_NAND_BLOCK_SIZE hex "NAND chip eraseblock size" depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT - depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_FSL_IFC + depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \ + !NAND_FSL_IFC && !NAND_MT7621 help Number of data bytes in one eraseblock for the NAND chip on the board. This is the multiple of NAND_PAGE_SIZE and the number of
@@ -551,7 +564,7 @@ config SYS_NAND_PAGE_SIZE depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \ SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \ (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER - depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC + depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621 help Number of data bytes in one page for the NAND chip on the board, not including the OOB area.
drivers/mtd/nand/raw/Makefile +2 -0
@@ -72,6 +72,7 @@ obj-$(CONFIG_NAND_ZYNQ) += zynq_nand.o obj-$(CONFIG_NAND_STM32_FMC2) += stm32_fmc2_nand.o obj-$(CONFIG_CORTINA_NAND) += cortina_nand.o obj-$(CONFIG_ROCKCHIP_NAND) += rockchip_nfc.o +obj-$(CONFIG_NAND_MT7621) += mt7621_nand.o else # minimal SPL drivers
@@ -80,5 +81,6 @@ obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o obj-$(CONFIG_NAND_MXS) += mxs_nand_spl.o mxs_nand.o obj-$(CONFIG_NAND_SUNXI) += sunxi_nand_spl.o +obj-$(CONFIG_NAND_MT7621) += mt7621_nand_spl.o mt7621_nand.o endif # drivers
drivers/mtd/nand/raw/mt7621_nand.c new file +1205 -0
1,205 lines not on this page · raw message
drivers/mtd/nand/raw/mt7621_nand.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2022 MediaTek Inc. All rights reserved. +* +* Author: Weijie Gao <[email protected]> +*/ + +#ifndef _MT7621_NAND_H_ +#define _MT7621_NAND_H_ + +#include <linux/types.h> +#include <linux/mtd/mtd.h> +#include <linux/compiler.h> +#include <linux/mtd/rawnand.h> + +struct mt7621_nfc { +struct nand_chip nand; + +void __iomem *nfi_regs; +void __iomem *ecc_regs; + +u32 spare_per_sector; +}; + +/* for SPL */ +void mt7621_nfc_spl_init (struct mt7621_nfc *nfc); +int mt7621_nfc_spl_post_init (struct mt7621_nfc *nfc); + +#endif /* _MT7621_NAND_H_ */
drivers/mtd/nand/raw/mt7621_nand_spl.c new file +237 -0
237 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 25/25 MAINTAINERS: update maintainer for MediaTek MIPS platform
In reply to Weijie GaoUpdate maintainer for MediaTek MIPS platform
---
v6 changes: none
v5 changes: none
v4 changes: Add new files
v3 changes: none
v2 changes: none
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -995,15 +995,23 @@ R: GSS_MTK_Uboot_upstream <[email protected]> S: Maintained F: arch/mips/mach-mtmips/ F: arch/mips/dts/mt7620.dtsi +F: arch/mips/dts/mt7621.dtsi F: arch/mips/dts/mt7620-u-boot.dtsi +F: arch/mips/dts/mt7621-u-boot.dtsi F: include/configs/mt7620.h +F: include/configs/mt7621.h F: include/dt-bindings/clock/mt7620-clk.h +F: include/dt-bindings/clock/mt7621-clk.h F: include/dt-bindings/clock/mt7628-clk.h F: include/dt-bindings/reset/mt7620-reset.h +F: include/dt-bindings/reset/mt7621-reset.h F: include/dt-bindings/reset/mt7628-reset.h F: drivers/clk/mtmips/ F: drivers/pinctrl/mtmips/ F: drivers/gpio/mt7620_gpio.c +F: drivers/mtd/nand/raw/mt7621_nand.c +F: drivers/mtd/nand/raw/mt7621_nand.h +F: drivers/mtd/nand/raw/mt7621_nand_spl.c F: drivers/net/mt7620-eth.c F: drivers/phy/mt7620-usb-phy.c F: drivers/reset/reset-mtmips.c
Signature · 1 line
2.17.1
PATCH v6 24/25 tools: mtk_image: add support for MT7621 NAND images
In reply to Weijie GaoThe BootROM of MT7621 requires a image header for SPL to record its size and load address when booting from NAND.
To create such an image, one can use the following command line:
mkimage -T mtk_image -a 0x80200000 -e 0x80200000 -n "mt7621=1" -d u-boot-spl-ddr.bin u-boot-spl-ddr.img
---
v6 changes: none
v5 changes: none
v4 changes: new
--- tools/mtk_image.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++ tools/mtk_image.h | 24 ++++++ 2 files changed, 206 insertions(+)
tools/mtk_image.c +182 -0
@@ -6,7 +6,9 @@* Author: Weijie Gao <[email protected]> */ +#include <time.h> #include <image.h> +#include <u-boot/crc.h> #include <u-boot/sha256.h> #include "imagetool.h" #include "mtk_image.h"
@@ -251,17 +253,45 @@ static uint32_t img_size;static enum brlyt_img_type hdr_media;static uint32_t hdr_offset;static int use_lk_hdr; +static int use_mt7621_hdr;static bool is_arm64_image;/* LK image name */ static char lk_name[32 ] ="U-Boot" ; +/* CRC32 normal table required by MT7621 image */ +static uint32_t crc32tbl[256 ]; +/* NAND header selected by user */ static const union nand_boot_header *hdr_nand;/* GFH header + 2 * 4KB pages of NAND */ static char hdr_tmp[sizeof (struct gfh_header ) +0x2000 ]; +static uint32_t crc32_normal_cal (uint32_t crc,const void *data,size_t length, +const uint32_t *crc32c_table) +{ +const uint8_t *p = data; + +while (length--) + crc = crc32c_table[(uint8_t )((crc >>24 ) ^ *p++)] ^ (crc <<8 ); + +return crc; +} + +static void crc32_normal_init (uint32_t *crc32c_table,uint32_t poly) +{ +uint32_t v, i, j; + +for (i =0 ; i <256 ; i++) { + v = i <<24 ; +for (j =0 ; j <8 ; j++) + v = (v <<1 ) ^ ((v & (1 <<31 )) ? poly :0 ); + + crc32c_table[i] = v; + } +} +static int mtk_image_check_image_types (uint8_t type) {if (type ==IH_TYPE_MTKIMAGE )
@@ -283,6 +313,7 @@ static int mtk_brom_parse_imagename(const char *imagename)static const char *hdr_offs ="" ;static const char *nandinfo ="" ;static const char *lk ="" ; +static const char *mt7621 ="" ;static const char *arm64_param ="" ; key = buf;
@@ -332,6 +363,9 @@ static int mtk_brom_parse_imagename(const char *imagename)if (!strcmp (key,"lk" )) lk = val; +if (!strcmp (key,"mt7621" )) + mt7621 = val; +if (!strcmp (key,"lkname" ))snprintf (lk_name,sizeof (lk_name),"%s" , val);
@@ -352,6 +386,13 @@ static int mtk_brom_parse_imagename(const char *imagename)return 0 ; } +/* if user specified MT7621 image header, skip following checks */ +if (mt7621 && mt7621[0 ] =='1' ) { + use_mt7621_hdr =1 ; +free (buf); +return 0 ; + } +/* parse media type */ for (i =0 ; i <ARRAY_SIZE (brom_images); i++) {if (!strcmp (brom_images[i].name, media)) {
@@ -419,6 +460,13 @@ static int mtk_image_vrec_header(struct image_tool_params *params,return 0 ; } +if (use_mt7621_hdr) { + tparams->header_size =image_get_header_size (); + tparams->hdr = &hdr_tmp; +memset (&hdr_tmp,0 , tparams->header_size); +return 0 ; + } +if (hdr_media ==BRLYT_TYPE_NAND || hdr_media ==BRLYT_TYPE_SNAND ) tparams->header_size =2 *le16_to_cpu (hdr_nand->pagesize);else
@@ -579,9 +627,90 @@ static int mtk_image_verify_nand_header(const uint8_t *ptr, int print)return 0 ; } +static uint32_t crc32be_cal (const void *data,size_t length) +{ +uint32_t crc =0 ; +uint8_t c; + +if (crc32tbl[1 ] !=MT7621_IH_CRC_POLYNOMIAL ) +crc32_normal_init (crc32tbl,MT7621_IH_CRC_POLYNOMIAL ); + + crc =crc32_normal_cal (crc, data, length, crc32tbl); + +for (; length; length >>=8 ) { + c = length &0xff ; + crc =crc32_normal_cal (crc, &c,1 , crc32tbl); + } + +return ~crc; +} + +static int mtk_image_verify_mt7621_header (const uint8_t *ptr,int print) +{ +const image_header_t *hdr = (const image_header_t *)ptr; +struct mt7621_nand_header *nhdr; +uint32_t spl_size, crcval; +image_header_t header; +int ret; + + spl_size =image_get_size (hdr); + +if (spl_size > img_size) { +if (print) +printf ("Incomplete SPL image\n" ); +return -1 ; + } + + ret =image_check_hcrc (hdr); +if (!ret) { +if (print) +printf ("Bad header CRC\n" ); +return -1 ; + } + + ret =image_check_dcrc (hdr); +if (!ret) { +if (print) +printf ("Bad data CRC\n" ); +return -1 ; + } + +/* Copy header so we can blank CRC field for re-calculation */ +memmove (&header, hdr,image_get_header_size ()); +image_set_hcrc (&header,0 ); + + nhdr = (struct mt7621_nand_header *)header.ih_name; + crcval =be32_to_cpu (nhdr->crc); + nhdr->crc =0 ; + +if (crcval !=crc32be_cal (&header,image_get_header_size ())) { +if (print) +printf ("Bad NAND header CRC\n" ); +return -1 ; + } + +if (print) { +printf ("Load Address: %08x\n" ,image_get_load (hdr)); + +printf ("Image Name: %.*s\n" ,MT7621_IH_NMLEN , +image_get_name (hdr)); + +if (IMAGE_ENABLE_TIMESTAMP ) { +printf ("Created: " ); +genimg_print_time ((time_t )image_get_time (hdr)); + } + +printf ("Data Size: " ); +genimg_print_size (image_get_data_size (hdr)); + } + +return 0 ; +} +static int mtk_image_verify_header (unsigned char *ptr,int image_size,struct image_tool_params *params) { +image_header_t *hdr = (image_header_t *)ptr;union lk_hdr *lk = (union lk_hdr *)ptr;/* nothing to verify for LK image header */
@@ -590,6 +719,9 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size, img_size = image_size; +if (image_get_magic (hdr) ==IH_MAGIC ) +return mtk_image_verify_mt7621_header (ptr,0 ); +if (!strcmp ((char *)ptr,NAND_BOOT_NAME ))return mtk_image_verify_nand_header (ptr,0 );else
@@ -600,6 +732,7 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size,static void mtk_image_print_header (const void *ptr) { +image_header_t *hdr = (image_header_t *)ptr;union lk_hdr *lk = (union lk_hdr *)ptr;if (le32_to_cpu (lk->magic) ==LK_PART_MAGIC ) {
@@ -610,6 +743,11 @@ static void mtk_image_print_header(const void *ptr)printf ("Image Type: MediaTek BootROM Loadable Image\n" ); +if (image_get_magic (hdr) ==IH_MAGIC ) { +mtk_image_verify_mt7621_header (ptr,1 ); +return ; + } +if (!strcmp ((char *)ptr,NAND_BOOT_NAME ))mtk_image_verify_nand_header (ptr,1 );else
@@ -773,6 +911,45 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize, filesize - 2 * le16_to_cpu(hdr_nand->pagesize) - SHA256_SUM_LEN); } +static void mtk_image_set_mt7621_header (void *ptr,off_t filesize, +uint32_t loadaddr) +{ +image_header_t *hdr = (image_header_t *)ptr; +struct mt7621_stage1_header *shdr; +struct mt7621_nand_header *nhdr; +uint32_t datasize, crcval; + + datasize = filesize -image_get_header_size (); + nhdr = (struct mt7621_nand_header *)hdr->ih_name; + shdr = (struct mt7621_stage1_header *)(ptr +image_get_header_size ()); + + shdr->ep =cpu_to_be32 (loadaddr); + shdr->stage_size =cpu_to_be32 (datasize); + +image_set_magic (hdr,IH_MAGIC ); +image_set_time (hdr,time (NULL )); +image_set_size (hdr, datasize); +image_set_load (hdr, loadaddr); +image_set_ep (hdr, loadaddr); +image_set_os (hdr,IH_OS_U_BOOT ); +image_set_arch (hdr,IH_ARCH_MIPS ); +image_set_type (hdr,IH_TYPE_STANDALONE ); +image_set_comp (hdr,IH_COMP_NONE ); + + crcval =crc32 (0 , (uint8_t *)shdr, datasize); +image_set_dcrc (hdr, crcval); + +strncpy (nhdr->ih_name,"MT7621 NAND" ,MT7621_IH_NMLEN ); + + nhdr->ih_stage_offset =cpu_to_be32 (image_get_header_size ()); + + crcval =crc32be_cal (hdr,image_get_header_size ()); + nhdr->crc =cpu_to_be32 (crcval); + + crcval =crc32 (0 , (uint8_t *)hdr,image_get_header_size ()); +image_set_hcrc (hdr, crcval); +} +static void mtk_image_set_header (void *ptr,struct stat *sbuf,int ifd,struct image_tool_params *params) {
@@ -791,6 +968,11 @@ static void mtk_image_set_header(void *ptr, struct stat *sbuf, int ifd, img_gen = true; img_size = sbuf->st_size; +if (use_mt7621_hdr) { +mtk_image_set_mt7621_header (ptr, sbuf->st_size, params->addr); +return ; + } +if (hdr_media ==BRLYT_TYPE_NAND || hdr_media ==BRLYT_TYPE_SNAND )mtk_image_set_nand_header (ptr, sbuf->st_size, params->addr);else
tools/mtk_image.h +24 -0
@@ -200,4 +200,28 @@ union lk_hdr {#define LK_PART_MAGIC 0x58881688 +/* MT7621 NAND SPL image header */ + +#define MT7621_IH_NMLEN 12 +#define MT7621_IH_CRC_POLYNOMIAL 0x04c11db7 + +struct mt7621_nand_header { +char ih_name[MT7621_IH_NMLEN ]; +uint32_t nand_ac_timing; +uint32_t ih_stage_offset; +uint32_t ih_bootloader_offset; +uint32_t nand_info_1_data; +uint32_t crc; +}; + +struct mt7621_stage1_header { +uint32_t jump_insn[2 ]; +uint32_t ep; +uint32_t stage_size; +uint32_t has_stage2; +uint32_t next_ep; +uint32_t next_size; +uint32_t next_offset; +}; +#endif /* _MTK_IMAGE_H */
Signature · 1 line
2.17.1
Hi Weijie,
Quoted 7 lines · Weijie Gao
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-core dual-threaded MIPS 1004Kc processor running at a normal frequency of 880MHz. This chip can be found in many wireless routers.
Quoted 8 lines
This series add all basic drivers which are useful in u-boot, like usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is described in
doc/board/mediatek/mt7621.rstThanks,
Weijie
I applied v6 to u-boot-mips/next for the upcoming merge window. I needed to add some fixups to make CI happy. Could you check if the changes are okay, especially the Kconfig migration of CONFIG_SYS_NAND_U_BOOT_OFFS?
https://source.denx.de/u-boot/custodians/u-boot-mips/-/commits/next/
https://source.denx.de/u-boot/custodians/u-boot-mips/-/pipelines/12637
Thanks,
Daniel
Hi Daniel,
I've tested these changes and they work fine on both NOR and NAND boards.
Best Regards,
Weijie
-----邮件原件-----
发件人: Daniel Schwierzeck <[email protected]>
发送时间: 2022年7月7日 6:12
收件人: Weijie Gao (高惟杰) <[email protected]>; [email protected]
抄送: GSS_MTK_Uboot_upstream <[email protected]>; Marek Behún <[email protected]> 主题: Re: [PATCH v6 00/25] Add support for MediaTek MT7621 SoC - v6
Hi Weijie,
Quoted 7 lines · Weijie Gao
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-core dual-threaded MIPS 1004Kc processor running at a normal frequency of 880MHz. This chip can be found in many wireless routers.
Quoted 8 lines
This series add all basic drivers which are useful in u-boot, like usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is described in
doc/board/mediatek/mt7621.rstThanks,
Weijie
I applied v6 to u-boot-mips/next for the upcoming merge window. I needed to add some fixups to make CI happy. Could you check if the changes are okay, especially the Kconfig migration of CONFIG_SYS_NAND_U_BOOT_OFFS?
https://source.denx.de/u-boot/custodians/u-boot-mips/-/commits/next/
https://source.denx.de/u-boot/custodians/u-boot-mips/-/pipelines/12637
Thanks,
Daniel
FYI, Gmail marked this as Spam - no idea why!
Martin
Quoted 46 lines · Weijie Gao (高惟杰)
Hi Daniel,
I've tested these changes and they work fine on both NOR and NAND boards.
Best Regards,
Weijie-----邮件原件-----
发件人: Daniel Schwierzeck <[email protected]>
发送时间: 2022年7月7日 6:12
收件人: Weijie Gao (高惟杰) <[email protected]>; [email protected] 抄送:GSS_MTK_Uboot_upstream<[email protected]>; Marek Behún <[email protected]>
主题: Re: [PATCH v6 00/25] Add support for MediaTek MT7621 SoC - v6Hi Weijie,
Quoted 5 lines · Weijie Gao
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-core dual-threaded MIPS 1004Kc processor running at a normal frequency of
880MHz.
Quoted 10 lines
This chip can be found in many wireless routers.
This series add all basic drivers which are useful in u-boot, like usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is described in
doc/board/mediatek/mt7621.rstThanks,
WeijieI applied v6 to u-boot-mips/next for the upcoming merge window. I needed to add some fixups to make CI happy. Could you check if the changes are okay, especially the
Kconfigmigration ofCONFIG_SYS_NAND_U_BOOT_OFFS?https://source.denx.de/u-boot/custodians/u-boot-mips/-/commits/next/
https://source.denx.de/u-boot/custodians/u-boot-mips/-/pipelines/12637Thanks,
Daniel
Hi Martin,
That's weird. Maybe changing a mail client can solve this.
Weijie
Quoted 60 lines · Martin Bonner
FYI, Gmail marked this as Spam - no idea why!
Martin
Quoted 53 lines · Weijie Gao (高惟杰)
Hi Daniel,
I've tested these changes and they work fine on both NOR and NAND boards.
Best Regards,
Weijie-----邮件原件-----
发件人: Daniel Schwierzeck <[email protected]> 发送时间: 2022年7月7日 6:12
收件人: Weijie Gao (高惟杰) <[email protected]>; [email protected]. de
抄送:GSS_MTK_Uboot_upstream<[email protected]>; Marek Behún <[email protected]>
主题: Re: [PATCH v6 00/25] Add support for MediaTek MT7621 SoC - v6Hi Weijie,
Quoted 4 lines · Weijie Gao
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-
core
Quoted 1 line
dual-threaded MIPS 1004Kc processor running at a normal frequency
of 880MHz.
Quoted 3 lines
This chip can be found in many wireless routers.
This series add all basic drivers which are useful in u-boot,
like
Quoted 3 lines
usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is
described
Quoted 4 lines
in
doc/board/mediatek/mt7621.rstThanks,
WeijieI applied v6 to u-boot-mips/next for the upcoming merge window. I needed to add some fixups to make CI happy. Could you check if the changes are okay, especially the
Kconfigmigration ofCONFIG_SYS_NAND_U_BOOT_OFFS?https://source.denx.de/u-boot/custodians/u-boot-mips/-/commits/next
/
https://source.denx.de/u-boot/custodians/u-boot-mips/-/pipelines/12
637Thanks,
Daniel
Quoted 166 lines · Weijie Gao
This series will add support for MediaTek MT7621 SoC with two reference boards and related drivers.
The MediaTek MT7621 is a network processor integrating a dual-core dual-threaded MIPS 1004Kc processor running at a normal frequency of 880MHz. This chip can be found in many wireless routers.
This series add all basic drivers which are useful in u-boot, like usb, sdxc, ethernet, spi, nand and serial.
Building the u-boot requires external binary blob which is described in
doc/board/mediatek/mt7621.rstThanks,
Weijiev6 changes:
- Use FIELD_GET/FIELD_PREP for register fields instead of shift opertations
- Rename fixed clock node name inmt7621.dtsi
- Panic if dram binary blob is wrong in spl
- Remove redundant nop's if noreorder is not used
- Useexecution_hazard_barrier()in tplv5 changes:
- Adjustmt7621.dtsi, clkctrl node moved to sysc, pinctrl default states moved to board dts files
- Modify clk driver due to its node changed inmt7621.dtsi
- Minor fixesv4 changes:
- Add full support for booting from flashv3 changes:
- Rewrite clk driver to follow definitions from upstream kernel
- Implementnoncached_alloc()for MIPS platform
- Update register remap for mtk-eth driver needed by mt7621v2 changes:
- Add a kconfig for max supported ram size
- Remove network configs from default config file
- Add config file for mt7621-rfb boardsWeijie Gao (25):
mips: addasm/mipsmtregs.hfor MIPS multi-threading
mips: add more definitions forasm/cm.h
mips: add__image_copy_lenfor SPL linker script
mips: add support fornoncached_alloc()
mips: mtmips: add support for MediaTek MT7621 SoC
mips: mtmips: add two reference boards for mt7621
doc: mediatek: add documentation for mt7621 reference boards
clk: mtmips: add clock driver for MediaTek MT7621 SoC
reset: mtmips: add reset controller support for MediaTek MT7621 SoC
pinctrl: mtmips: add support for MediaTek MT7621 SoC
usb: xhci-mtk: add support for MediaTek MT7621 SoC
phy: mtk-tphy: add support for MediaTek MT7621 SoC
spi: add support for MediaTek MT7621 SoC
gpio: add support for MediaTek MT7621 SoC
watchdog: add support for MediaTek MT7621 SoC
mmc: mediatek: add support for MediaTek MT7621 SoC
net: mediatek: remap iobase address
net: mediatek: use regmap api to modify ethsys registers
net: mediatek: add support for MediaTek MT7621 SoC
nand: raw: add support for MediaTek MT7621 SoC
spl: allow using nand base without standard nand driver
spl:spl_legacy: fix the use ofSPL_COPY_PAYLOAD_ONLY
spl: nand: support loading legacy image with payload compressed
tools:mtk_image: add support for MT7621 NAND images
MAINTAINERS: update maintainer for MediaTek MIPS platformMAINTAINERS | 8 + arch/mips/cpu/u-boot-spl.lds | 3 + arch/mips/dts/Makefile | 2 + arch/mips/dts/mediatek,mt7621-nand-rfb.dts | 67 + arch/mips/dts/mediatek,mt7621-rfb.dts | 82 ++ arch/mips/dts/mt7621-u-boot.dtsi | 111 ++ arch/mips/dts/mt7621.dtsi | 349 +++++ arch/mips/include/asm/cm.h | 67 + arch/mips/include/asm/mipsmtregs.h | 142 ++ arch/mips/include/asm/system.h | 20 + arch/mips/lib/cache.c | 43 + arch/mips/mach-mtmips/Kconfig | 49 +- arch/mips/mach-mtmips/Makefile | 4 + arch/mips/mach-mtmips/cpu.c | 2 +- arch/mips/mach-mtmips/mt7621/Kconfig | 115 ++ arch/mips/mach-mtmips/mt7621/Makefile | 14 + arch/mips/mach-mtmips/mt7621/init.c | 246 ++++ arch/mips/mach-mtmips/mt7621/mt7621.h | 229 ++++ arch/mips/mach-mtmips/mt7621/serial.c | 23 + arch/mips/mach-mtmips/mt7621/spl/Makefile | 9 + arch/mips/mach-mtmips/mt7621/spl/cps.c | 153 +++ arch/mips/mach-mtmips/mt7621/spl/dram.c | 153 +++ arch/mips/mach-mtmips/mt7621/spl/dram.h | 39 + arch/mips/mach-mtmips/mt7621/spl/launch.c | 100 ++ arch/mips/mach-mtmips/mt7621/spl/launch.h | 52 + arch/mips/mach-mtmips/mt7621/spl/launch_ll.S | 339 +++++ arch/mips/mach-mtmips/mt7621/spl/serial.c | 24 + arch/mips/mach-mtmips/mt7621/spl/spl.c | 95 ++ arch/mips/mach-mtmips/mt7621/spl/start.S | 226 ++++ arch/mips/mach-mtmips/mt7621/sram_init.S | 22 + arch/mips/mach-mtmips/mt7621/tpl/Makefile | 4 + arch/mips/mach-mtmips/mt7621/tpl/start.S | 161 +++ arch/mips/mach-mtmips/mt7621/tpl/tpl.c | 144 ++ board/mediatek/mt7621/MAINTAINERS | 8 + board/mediatek/mt7621/Makefile | 3 + board/mediatek/mt7621/board.c | 6 + common/spl/Kconfig | 2 +- common/spl/spl_legacy.c | 21 +- common/spl/spl_nand.c | 27 + configs/mt7621_nand_rfb_defconfig | 83 ++ configs/mt7621_rfb_defconfig | 82 ++ doc/board/mediatek/mt7621.rst | 48 + drivers/clk/mtmips/Makefile | 1 + drivers/clk/mtmips/clk-mt7621.c | 288 ++++ drivers/gpio/Kconfig | 2 +- drivers/mmc/mtk-sd.c | 13 + drivers/mtd/nand/raw/Kconfig | 17 +- drivers/mtd/nand/raw/Makefile | 2 + drivers/mtd/nand/raw/mt7621_nand.c | 1205 +++++++++++++++++ drivers/mtd/nand/raw/mt7621_nand.h | 29 + drivers/mtd/nand/raw/mt7621_nand_spl.c | 237 ++++ drivers/net/mtk_eth.c | 45 +- drivers/phy/Kconfig | 2 +- drivers/pinctrl/mtmips/Kconfig | 9 + drivers/pinctrl/mtmips/Makefile | 1 + drivers/pinctrl/mtmips/pinctrl-mt7621.c | 306 +++++ .../pinctrl/mtmips/pinctrl-mtmips-common.c | 4 +- .../pinctrl/mtmips/pinctrl-mtmips-common.h | 12 + drivers/spi/Kconfig | 2 +- drivers/usb/host/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- include/configs/mt7621.h | 67 + include/dt-bindings/clock/mt7621-clk.h | 46 + include/dt-bindings/reset/mt7621-reset.h | 38 + tools/mtk_image.c | 182 +++ tools/mtk_image.h | 24 + 66 files changed, 5877 insertions(+), 36 deletions(-)create mode 100644
arch/mips/dts/mediatek,mt7621-nand-rfb.dtscreate mode 100644arch/mips/dts/mediatek,mt7621-rfb.dtscreate mode 100644arch/mips/dts/mt7621-u-boot.dtsicreate mode 100644arch/mips/dts/mt7621.dtsi
create mode 100644arch/mips/include/asm/mipsmtregs.hcreate mode 100644arch/mips/mach-mtmips/mt7621/Kconfigcreate mode 100644arch/mips/mach-mtmips/mt7621/Makefilecreate mode 100644arch/mips/mach-mtmips/mt7621/init.ccreate mode 100644arch/mips/mach-mtmips/mt7621/mt7621.hcreate mode 100644arch/mips/mach-mtmips/mt7621/serial.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/Makefilecreate mode 100644arch/mips/mach-mtmips/mt7621/spl/cps.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/dram.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/dram.hcreate mode 100644arch/mips/mach-mtmips/mt7621/spl/launch.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/launch.hcreate mode 100644arch/mips/mach-mtmips/mt7621/spl/launch_ll.Screate mode 100644arch/mips/mach-mtmips/mt7621/spl/serial.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/spl.ccreate mode 100644arch/mips/mach-mtmips/mt7621/spl/start.Screate mode 100644arch/mips/mach-mtmips/mt7621/sram_init.Screate mode 100644arch/mips/mach-mtmips/mt7621/tpl/Makefilecreate mode 100644arch/mips/mach-mtmips/mt7621/tpl/start.Screate mode 100644arch/mips/mach-mtmips/mt7621/tpl/tpl.ccreate mode 100644 board/mediatek/mt7621/MAINTAINERS create mode 100644 board/mediatek/mt7621/Makefile create mode 100644board/mediatek/mt7621/board.ccreate mode 100644 configs/mt7621_nand_rfb_defconfig create mode 100644 configs/mt7621_rfb_defconfig create mode 100644doc/board/mediatek/mt7621.rst
Quoted 9 lines
create mode 100644
drivers/clk/mtmips/clk-mt7621.ccreate mode 100644drivers/mtd/nand/raw/mt7621_nand.ccreate mode 100644drivers/mtd/nand/raw/mt7621_nand.hcreate mode 100644drivers/mtd/nand/raw/mt7621_nand_spl.ccreate mode 100644drivers/pinctrl/mtmips/pinctrl-mt7621.ccreate mode 100644include/configs/mt7621.hcreate mode 100644include/dt-bindings/clock/mt7621-clk.hcreate mode 100644include/dt-bindings/reset/mt7621-reset.h
series applied to u-boot-mips/next, thanks.
Signature · 1 line
- Daniel