Commit abf2c68566ae007904633fb882cb71c56eb41ff0

Authored by mingming lee
Committed by Tom Rini
1 parent 485627dd5f

ARM: MediaTek: add basic support for MT8518 boards

This adds a general board file based on MT8518 SoCs from MediaTek.

Apart from the generic parts (cpu) we add some low level init codes
and initialize the early clocks.

This commit is adding the basic boot support for the MT8518 eMMC board.

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
[trini: Migrate env location to defconfig, set ENV_IS_IN_MMC]
Signeed-off-by: Tom Rini <trini@konsulko.com>

Showing 9 changed files with 257 additions and 1 deletions Side-by-side Diff

arch/arm/dts/Makefile
... ... @@ -835,7 +835,8 @@
835 835 dtb-$(CONFIG_ARCH_MEDIATEK) += \
836 836 mt7623n-bananapi-bpi-r2.dtb \
837 837 mt7629-rfb.dtb \
838   - mt8516-pumpkin.dtb
  838 + mt8516-pumpkin.dtb \
  839 + mt8518-ap1-emmc.dtb
839 840  
840 841 dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
841 842 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
arch/arm/dts/mt8518-ap1-emmc.dts
  1 +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
  2 +/*
  3 + * Copyright (C) 2019 MediaTek Inc.
  4 + * Author: Mingming Lee <mingming.lee@mediatek.com>
  5 + *
  6 + */
  7 +
  8 +/dts-v1/;
  9 +
  10 +#include <config.h>
  11 +#include "mt8518.dtsi"
  12 +
  13 +/ {
  14 + #address-cells = <1>;
  15 + #size-cells = <1>;
  16 +
  17 + model = "MT8518 AP1 EMMC";
  18 +
  19 + chosen {
  20 + stdout-path = &uart0;
  21 + tick-timer = &timer0;
  22 + };
  23 +
  24 + memory@40000000 {
  25 + device_type = "memory";
  26 + reg = <0x40000000 0x10000000>;
  27 + };
  28 +
  29 + reg_1p8v: regulator-1p8v {
  30 + compatible = "regulator-fixed";
  31 + regulator-name = "fixed-1.8V";
  32 + regulator-min-microvolt = <1800000>;
  33 + regulator-max-microvolt = <1800000>;
  34 + regulator-boot-on;
  35 + regulator-always-on;
  36 + };
  37 +
  38 + reg_3p3v: regulator-3p3v {
  39 + compatible = "regulator-fixed";
  40 + regulator-name = "fixed-3.3V";
  41 + regulator-min-microvolt = <3300000>;
  42 + regulator-max-microvolt = <3300000>;
  43 + regulator-boot-on;
  44 + regulator-always-on;
  45 + };
  46 +};
  47 +
  48 +&mmc0 {
  49 + pinctrl-names = "default";
  50 + pinctrl-0 = <&mmc0_pins_default>;
  51 + bus-width = <8>;
  52 + max-frequency = <200000000>;
  53 + cap-mmc-highspeed;
  54 + mmc-hs200-1_8v;
  55 + cap-mmc-hw-reset;
  56 + vmmc-supply = <&reg_3p3v>;
  57 + vqmmc-supply = <&reg_1p8v>;
  58 + non-removable;
  59 + status = "okay";
  60 +};
  61 +
  62 +&pinctrl {
  63 + mmc0_pins_default: mmc0default {
  64 + mux {
  65 + function = "msdc";
  66 + groups = "msdc0";
  67 + };
  68 +
  69 + conf-cmd-data {
  70 + pins = "MSDC0_CMD", "MSDC0_DAT0", "MSDC0_DAT1",
  71 + "MSDC0_DAT2", "MSDC0_DAT3", "MSDC0_DAT4",
  72 + "MSDC0_DAT5", "MSDC0_DAT6", "MSDC0_DAT7";
  73 + input-enable;
  74 + bias-pull-up;
  75 + };
  76 +
  77 + conf-clk {
  78 + pins = "MSDC0_CLK";
  79 + bias-pull-down;
  80 + };
  81 +
  82 + conf-rst {
  83 + pins = "MSDC0_RSTB";
  84 + bias-pull-up;
  85 + };
  86 + };
  87 +
  88 + uart0_pins: uart0 {
  89 + mux {
  90 + function = "uart";
  91 + groups = "uart0_0_rxd_txd";
  92 + };
  93 + };
  94 +};
  95 +
  96 +&uart0 {
  97 + pinctrl-names = "default";
  98 + pinctrl-0 = <&uart0_pins>;
  99 + status = "okay";
  100 +};
  101 +
  102 +&watchdog0 {
  103 + status = "okay";
  104 +};
arch/arm/mach-mediatek/Kconfig
... ... @@ -51,6 +51,7 @@
51 51  
52 52 source "board/mediatek/mt7623/Kconfig"
53 53 source "board/mediatek/mt7629/Kconfig"
  54 +source "board/mediatek/mt8518/Kconfig"
54 55 source "board/mediatek/pumpkin/Kconfig"
55 56  
56 57 endif
board/mediatek/mt8518/Kconfig
  1 +if TARGET_MT8518
  2 +
  3 +config SYS_BOARD
  4 + default "mt8518"
  5 +
  6 +config SYS_CONFIG_NAME
  7 + default "mt8518"
  8 +
  9 +
  10 +config MTK_BROM_HEADER_INFO
  11 + string
  12 + default "media=nor"
  13 +
  14 +endif
board/mediatek/mt8518/MAINTAINERS
  1 +MT8518
  2 +M: Mingming lee <mingming.lee@mediatek.com>
  3 +S: Maintained
  4 +F: board/mediatek/mt8518
  5 +F: include/configs/mt8518.h
  6 +F: configs/mt8518_ap1_emmc_defconfig
board/mediatek/mt8518/Makefile
  1 +# SPDX-License-Identifier: GPL-2.0
  2 +
  3 +obj-y += mt8518_ap1.o
board/mediatek/mt8518/mt8518_ap1.c
  1 +// SPDX-License-Identifier: GPL-2.0
  2 +/*
  3 + * Copyright (C) 2019 MediaTek Inc.
  4 + */
  5 +
  6 +#include <common.h>
  7 +#include <dm.h>
  8 +
  9 +DECLARE_GLOBAL_DATA_PTR;
  10 +
  11 +int board_init(void)
  12 +{
  13 + /* address of boot parameters */
  14 + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  15 +
  16 + debug("gd->fdt_blob is %p\n", gd->fdt_blob);
  17 + return 0;
  18 +}
configs/mt8518_ap1_emmc_defconfig
  1 +CONFIG_ARM=y
  2 +CONFIG_POSITION_INDEPENDENT=y
  3 +CONFIG_ARCH_MEDIATEK=y
  4 +CONFIG_SYS_TEXT_BASE=0x40008000
  5 +CONFIG_SYS_MALLOC_F_LEN=0x4000
  6 +CONFIG_TARGET_MT8518=y
  7 +CONFIG_SYS_PROMPT="MT8518> "
  8 +CONFIG_ENV_SIZE=0x1000
  9 +CONFIG_ENV_OFFSET=0x4E60000
  10 +CONFIG_NR_DRAM_BANKS=1
  11 +CONFIG_FIT=y
  12 +CONFIG_FIT_SIGNATURE=y
  13 +CONFIG_OF_LIBFDT=y
  14 +# CONFIG_FDT_DEBUG is not set
  15 +CONFIG_LZMA=y
  16 +CONFIG_LZ4=y
  17 +CONFIG_LZO=y
  18 +CONFIG_GZIP=y
  19 +CONFIG_BZIP2=y
  20 +CONFIG_CMD_BOOTMENU=y
  21 +CONFIG_MENU_SHOW=y
  22 +CONFIG_DEFAULT_FDT_FILE="mt8518-ap1-emmc.dtb"
  23 +CONFIG_DEFAULT_DEVICE_TREE="mt8518-ap1-emmc"
  24 +CONFIG_ENV_IS_IN_MMC=y
  25 +CONFIG_PINCTRL=y
  26 +CONFIG_PINCTRL_MT8518=y
  27 +CONFIG_RAM=y
  28 +CONFIG_BAUDRATE=921600
  29 +CONFIG_REGMAP=y
  30 +CONFIG_SYSCON=y
  31 +CONFIG_DM=y
  32 +# CONFIG_DM_DEBUG is not set
  33 +CONFIG_DM_SERIAL=y
  34 +CONFIG_MTK_SERIAL=y
  35 +CONFIG_WDT=y
  36 +CONFIG_WDT_MTK=y
  37 +CONFIG_CLK=y
  38 +CONFIG_TIMER=y
  39 +CONFIG_MTK_TIMER=y
  40 +CONFIG_CMD_MMC=y
  41 +CONFIG_DM_MMC=y
  42 +CONFIG_MMC_MTK=y
  43 +CONFIG_MMC_HS200_SUPPORT=y
  44 +# CONFIG_ENV_IS_IN_MMC is not set
include/configs/mt8518.h
  1 +/* SPDX-License-Identifier: GPL-2.0 */
  2 +/*
  3 + * Configuration for MediaTek MT8518 SoC
  4 + *
  5 + * Copyright (C) 2019 MediaTek Inc.
  6 + * Author: Mingming Lee <mingming.lee@mediatek.com>
  7 + */
  8 +
  9 +#ifndef __MT8518_H
  10 +#define __MT8518_H
  11 +
  12 +#include <linux/sizes.h>
  13 +
  14 +/* Machine ID */
  15 +#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
  16 +
  17 +#define CONFIG_CPU_ARMV8
  18 +
  19 +#define COUNTER_FREQUENCY 13000000
  20 +
  21 +/* DRAM definition */
  22 +#define CONFIG_SYS_SDRAM_BASE 0x40000000
  23 +#define CONFIG_SYS_SDRAM_SIZE 0x20000000
  24 +
  25 +#define CONFIG_SYS_LOAD_ADDR 0x41000000
  26 +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
  27 +
  28 +#define CONFIG_SYS_MALLOC_LEN SZ_32M
  29 +#define CONFIG_SYS_BOOTM_LEN SZ_64M
  30 +
  31 +/* Uboot definition */
  32 +#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
  33 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + \
  34 + SZ_2M - \
  35 + GENERATED_GBL_DATA_SIZE)
  36 +
  37 +/* ENV Setting */
  38 +#if defined(CONFIG_MMC_MTK)
  39 +#define CONFIG_SYS_MMC_ENV_DEV 0
  40 +#define CONFIG_ENV_OVERWRITE
  41 +
  42 +/* MMC offset in block unit,and block size is 0x200 */
  43 +#define ENV_BOOT_READ_IMAGE \
  44 + "boot_rd_img=mmc dev 0" \
  45 + ";mmc read ${loadaddr} 0x27400 0x4000" \
  46 + ";iminfo ${loadaddr}\0"
  47 +#endif
  48 +
  49 +/* Console configuration */
  50 +#define ENV_DEVICE_SETTINGS \
  51 + "stdin=serial\0" \
  52 + "stdout=serial\0" \
  53 + "stderr=serial\0"
  54 +
  55 +#define ENV_BOOT_CMD \
  56 + "mtk_boot=run boot_rd_img;bootm;\0"
  57 +
  58 +#define CONFIG_EXTRA_ENV_SETTINGS \
  59 + "fdt_high=0x6c000000\0" \
  60 + ENV_DEVICE_SETTINGS \
  61 + ENV_BOOT_READ_IMAGE \
  62 + ENV_BOOT_CMD \
  63 + "bootcmd=run mtk_boot;\0" \
  64 +
  65 +#endif