From patchwork Tue Mar 30 14:30:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 1460089 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=ZQjMNhYY; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F8sMM6NBWz9sWF for ; Wed, 31 Mar 2021 01:31:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C06882946; Tue, 30 Mar 2021 16:31:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ZQjMNhYY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 57B8182927; Tue, 30 Mar 2021 16:31:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E1DAF8291B for ; Tue, 30 Mar 2021 16:31:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=fparent@baylibre.com Received: by mail-wr1-x435.google.com with SMTP id x16so16443928wrn.4 for ; Tue, 30 Mar 2021 07:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RSuUGbHhCB6vrrO9I0jwEb3H7kAXPDnHf4H6buzErGg=; b=ZQjMNhYYSRgxb643NRP9TI/vOl0o2y4TSd/FlH3iHpq8i1fnhasxD9S70D72w5APpM HP8gLi6wa7Evjv0fke7wN3GhPglkHVCD6J1DpZvYg6AAVISXfm+YN9Dc3RT+LdO+BVWr Hhnyrky8GvBor3ANbrHXWcwJam78Q22SpyJ5x/YPuZ02U2NhMMXRzVC9LAvw8mDIU30z 1aKc8rI4oGP9xrTG62L/wGCEhNLaaNPAiuPzPUD4fLkZUNxBfpwZj5VhEtsNIdbLjXT7 nFEN4MNoJRDb+3juyn98MCxxXEfjygJRzBeBtxyG6I3je/LGtOjkzTZLCnoMtmqHnaNt GhDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RSuUGbHhCB6vrrO9I0jwEb3H7kAXPDnHf4H6buzErGg=; b=gIWEi32wF+3g4iLTYp1UOaWoi4oui6gP98qdNjHE4dWUegPzVBOw9/J53k5xZVgCjn okfi7z2H3TWhlio821yjV0uHBuZtrIZ9Ds8wvCcNjNVfhpXvo1t/tUQ4u7sSPvVF8916 5KJ+Sp4bg0mjkKZoY/qZAXGIliCzW+E7xHau9D4Wm/vTlczTgcDvNhynrxy8efWFR4ZF Xygzrwqq+PAO/N5acHTpyI0iAu6N+STBVtwJkfWpRF9/pnKauVzt8qfZrPSbZQ0+qBlf /8tf4hnda2GmmI5VQei192ioVk9xsGWbQQqLtVCmpk0p2fOB3FqTL/hYWFNBYOse9lOP Dd6Q== X-Gm-Message-State: AOAM533B5x9yCxYOvW7jRgbAFJCR8yNhswOKNVo7Wt7lC9+PxNnPdPsC sNYVuclrpRpemX7GP3DPkICRkA== X-Google-Smtp-Source: ABdhPJwUyAtd5YikwoOoczgTivRMpy4LDvw3fShuel20ppIawemm4STU6W4nZMFnXvECm3jmCXalig== X-Received: by 2002:a05:6000:1803:: with SMTP id m3mr35057685wrh.50.1617114666400; Tue, 30 Mar 2021 07:31:06 -0700 (PDT) Received: from localhost.localdomain ([88.160.162.107]) by smtp.gmail.com with ESMTPSA id m15sm32902208wrp.96.2021.03.30.07.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 07:31:05 -0700 (PDT) From: Fabien Parent To: Ryder Lee , Weijie Gao , Chunfeng Yun , GSS_MTK_Uboot_upstream Cc: mkorpershoek@baylibre.com, Fabien Parent , u-boot@lists.denx.de Subject: [PATCH 2/3] ARM: mediatek: Add MT8175 support Date: Tue, 30 Mar 2021 16:30:57 +0200 Message-Id: <20210330143100.3358498-2-fparent@baylibre.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210330143100.3358498-1-fparent@baylibre.com> References: <20210330143100.3358498-1-fparent@baylibre.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Add MT8175 SoC support. Signed-off-by: Fabien Parent Reviewed-by: Chunfeng Yun --- v2: * Removed 'usb_host' node * Removed some unneeded "mac" reg and interrupts definitio in the 'usb' node * Modify the u3phy and its subnode to encode the ranges property as . arch/arm/dts/mt8175.dtsi | 229 +++++++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 9 + arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mt8175/Makefile | 3 + arch/arm/mach-mediatek/mt8175/init.c | 75 ++++++++ 5 files changed, 317 insertions(+) create mode 100644 arch/arm/dts/mt8175.dtsi create mode 100644 arch/arm/mach-mediatek/mt8175/Makefile create mode 100644 arch/arm/mach-mediatek/mt8175/init.c diff --git a/arch/arm/dts/mt8175.dtsi b/arch/arm/dts/mt8175.dtsi new file mode 100644 index 000000000000..bfb02741eef4 --- /dev/null +++ b/arch/arm/dts/mt8175.dtsi @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Copyright (C) 2021 BayLibre, SAS + * Author: Ben Ho + * Erin Lo + * Fabien Parent + */ + +#include +#include +#include +#include +#include + +/ { + compatible = "mediatek,mt8175"; + interrupt-parent = <&sysirq>; + #address-cells = <2>; + #size-cells = <2>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu-map { + cluster0 { + core0 { + cpu = <&cpu0>; + }; + core1 { + cpu = <&cpu1>; + }; + core2 { + cpu = <&cpu2>; + }; + core3 { + cpu = <&cpu3>; + }; + }; + }; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x000>; + enable-method = "psci"; + }; + + cpu1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x001>; + enable-method = "psci"; + }; + + cpu2: cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x002>; + enable-method = "psci"; + }; + + cpu3: cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x003>; + enable-method = "psci"; + }; + }; + + psci { + compatible = "arm,psci-1.0"; + method = "smc"; + }; + + soc { + #address-cells = <2>; + #size-cells = <2>; + compatible = "simple-bus"; + ranges; + + watchdog: watchdog@10007000 { + compatible = "mediatek,mt8175-rgu", + "mediatek,wdt"; + reg = <0 0x10007000 0 0x100>; + #reset-cells = <1>; + }; + + gic: interrupt-controller@c000000 { + compatible = "arm,gic-v3"; + #interrupt-cells = <4>; + interrupt-parent = <&gic>; + interrupt-controller; + reg = <0 0xc000000 0 0x80000>, + <0 0xc080000 0 0x80000>; + + interrupts = ; + }; + + sysirq: intpol-controller@10200a80 { + compatible = "mediatek,mt8175-sysirq", + "mediatek,mt6577-sysirq"; + interrupt-controller; + #interrupt-cells = <3>; + interrupt-parent = <&gic>; + reg = <0 0x10200a80 0 0x20>; + }; + + topckgen: topckgen@10000000 { + compatible = "mediatek,mt8175-topckgen", "syscon"; + reg = <0 0x10000000 0 0x1000>; + #clock-cells = <1>; + }; + + topckgen_cg: topckgen-cg@10000000 { + compatible = "mediatek,mt8175-topckgen-cg", "syscon"; + reg = <0 0x10000000 0 0x1000>; + #clock-cells = <1>; + }; + + infracfg: infracfg@10001000 { + compatible = "mediatek,mt8175-infracfg", "syscon"; + reg = <0 0x10001000 0 0x1000>; + #clock-cells = <1>; + }; + + apmixedsys: syscon@1000c000 { + compatible = "mediatek,mt8175-apmixedsys", "syscon"; + reg = <0 0x1000c000 0 0x1000>; + #clock-cells = <1>; + }; + + uart0: uart0@11002000 { + compatible = "mediatek,mt8175-uart", + "mediatek,hsuart"; + reg = <0 0x11002000 0 0x1000>; + interrupts = ; + clock-frequency = <26000000>; + clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART0>; + clock-names = "baud", "bus"; + status = "disabled"; + }; + + uart1: uart1@11003000 { + compatible = "mediatek,mt8175-uart", + "mediatek,hsuart"; + reg = <0 0x11003000 0 0x1000>; + interrupts = ; + clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART1>; + clock-names = "baud", "bus"; + status = "disabled"; + }; + + uart2: uart2@11004000 { + compatible = "mediatek,mt8175-uart", + "mediatek,hsuart"; + reg = <0 0x11004000 0 0x1000>; + interrupts = ; + clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART2>; + clock-names = "baud", "bus"; + status = "disabled"; + }; + + mmc0: mmc@11230000 { + compatible = "mediatek,mt8175-mmc", "mediatek,mt8183-mmc"; + reg = <0 0x11230000 0 0x1000>, + <0 0x11cd0000 0 0x1000>; + interrupts = ; + clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>, + <&infracfg CLK_IFR_MSDC0_HCLK>, + <&infracfg CLK_IFR_MSDC0_SRC>; + clock-names = "source", "hclk", "source_cg"; + status = "disabled"; + }; + + u3phy: usb-phy@11cc0000 { + compatible = "mediatek,generic-tphy-v2"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0x11cc0000 0x2000>; + status = "okay"; + + u2port0: usb-phy@0 { + reg = <0 0x400>; + clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>, + <&topckgen_cg CLK_TOP_USB20_48M_EN>; + clock-names = "ref", "da_ref"; + #phy-cells = <1>; + status = "okay"; + }; + + u2port1: usb-phy@1000 { + reg = <0x1000 0x400>; + clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>, + <&topckgen_cg CLK_TOP_USB20_48M_EN>; + clock-names = "ref", "da_ref"; + #phy-cells = <1>; + status = "okay"; + }; + }; + + usb: usb@11201000 { + compatible ="mediatek,mt8175-mtu3", "mediatek,mtu3"; + reg = <0 0x11203e00 0 0x0100>; + reg-names = "ippc"; + phys = <&u2port0 PHY_TYPE_USB2>, + <&u2port1 PHY_TYPE_USB2>; + clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>, + <&infracfg CLK_IFR_SSUSB_REF>, + <&infracfg CLK_IFR_SSUSB_SYS>, + <&infracfg CLK_IFR_ICUSB>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", + "dma_ck"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + status = "disabled"; + + ssusb: ssusb@11200000 { + compatible = "mediatek,ssusb"; + reg = <0 0x11200000 0 0x3e00>; + reg-names = "mac"; + interrupts = ; + status = "disabled"; + }; + }; + }; +}; diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index e067604d9b39..4a91fb764175 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -41,6 +41,14 @@ config TARGET_MT7629 including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet, switch, USB3.0, PCIe, UART, SPI, I2C and PWM. +config TARGET_MT8175 + bool "MediaTek MT8175 SoC" + select ARM64 + help + The MediaTek MT8175 is a ARM64-based SoC with a quad-core Cortex-A53. + It is including UART, SPI, USB2.0 dual role, SD and MMC cards, NAND, PWM, + I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options. + config TARGET_MT8183 bool "MediaTek MT8183 SoC" select ARM64 @@ -83,6 +91,7 @@ endchoice source "board/mediatek/mt7622/Kconfig" source "board/mediatek/mt7623/Kconfig" source "board/mediatek/mt7629/Kconfig" +source "board/mediatek/mt8175/Kconfig" source "board/mediatek/mt8183/Kconfig" source "board/mediatek/mt8512/Kconfig" source "board/mediatek/mt8516/Kconfig" diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile index 0f5b0c16d2cb..ba030fb0b373 100644 --- a/arch/arm/mach-mediatek/Makefile +++ b/arch/arm/mach-mediatek/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_MT8512) += mt8512/ obj-$(CONFIG_TARGET_MT7622) += mt7622/ obj-$(CONFIG_TARGET_MT7623) += mt7623/ obj-$(CONFIG_TARGET_MT7629) += mt7629/ +obj-$(CONFIG_TARGET_MT8175) += mt8175/ obj-$(CONFIG_TARGET_MT8183) += mt8183/ obj-$(CONFIG_TARGET_MT8516) += mt8516/ obj-$(CONFIG_TARGET_MT8518) += mt8518/ diff --git a/arch/arm/mach-mediatek/mt8175/Makefile b/arch/arm/mach-mediatek/mt8175/Makefile new file mode 100644 index 000000000000..886ab7e4eb9f --- /dev/null +++ b/arch/arm/mach-mediatek/mt8175/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += init.o diff --git a/arch/arm/mach-mediatek/mt8175/init.c b/arch/arm/mach-mediatek/mt8175/init.c new file mode 100644 index 000000000000..5161c1ce78d5 --- /dev/null +++ b/arch/arm/mach-mediatek/mt8175/init.c @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 MediaTek Inc. + * Copyright (C) 2021 BayLibre, SAS + * Author: Fabien Parent + */ + +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +int dram_init(void) +{ + int ret; + + ret = fdtdec_setup_memory_banksize(); + if (ret) + return ret; + + return fdtdec_setup_mem_size_base(); +} + +int dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = gd->ram_base; + gd->bd->bi_dram[0].size = gd->ram_size; + + return 0; +} + +int mtk_pll_early_init(void) +{ + return 0; +} + +int mtk_soc_early_init(void) +{ + return 0; +} + +void reset_cpu(ulong addr) +{ + psci_system_reset(); +} + +int print_cpuinfo(void) +{ + printf("CPU: MediaTek MT8175\n"); + return 0; +} + +static struct mm_region mt8175_mem_map[] = { + { + /* DDR */ + .virt = 0x40000000UL, + .phys = 0x40000000UL, + .size = 0x40000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, + }, { + .virt = 0x00000000UL, + .phys = 0x00000000UL, + .size = 0x20000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + 0, + } +}; + +struct mm_region *mem_map = mt8175_mem_map;