Re: [U-Boot] [PATCH 5/5] ARM: MediaTek: add basic support for MT8518 boards

2019-10-15 Thread Mingming Lee
On Sat, 2019-10-12 at 01:28 +0800, Tom Rini wrote:
> On Wed, Sep 11, 2019 at 07:14:59PM +0800, mingming lee wrote:
> 
> > 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 
> 
> OK, there's a few problems here:
> 
> [snip]
> > +int board_init(void)
> > +{
> > +   /* address of boot parameters */
> > +   gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
> > +
> > +   printf("gd->fdt_blob is %p\n", gd->fdt_blob);
> 
> Please remove this (and audit the series for other) bring-up debug
> printfs that we shouldn't need anymore.
> 
> > +   return 0;
> > +}
> > +
> > +int board_late_init(void)
> > +{
> > +   /*to load environment variable from persistent store*/
> > +   gd->env_valid = 1;
> > +   env_relocate();
> > +
> > +   return 0;
> > +}
> 
> Er, do you really need this?
> 
> [snip]
> > +/* Machine ID */
> > +#define CONFIG_MACH_TYPE   8518
> > +#define CONFIG_SYS_NONCACHED_MEMORYBIT(20)
> 
> CONFIG_MACH_TYPE is not relevant to aarch64 platforms (it's for
> pre-device tree boards) and 'BIT(20)' isn't a valid value for
> CONFIG_SYS_NONCACHED_MEMORY (and leads to a warning a build).
> 
> Thanks!
> 

Thank you for your advice.I would modify those issues in the next
Version.
For the debug info using API printf,I would modify it to the API
debug() 
For the API board_late_init and define CONFIG_MACH_TYPE,I would delete
it.
For BIT(20), I used to use SZ_1M,it also have warning.I think I would
modify it to 0x10.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] ARM: MediaTek: add basic support for MT8518 boards

2019-10-11 Thread Tom Rini
On Wed, Sep 11, 2019 at 07:14:59PM +0800, mingming lee wrote:

> 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 

OK, there's a few problems here:

[snip]
> +int board_init(void)
> +{
> + /* address of boot parameters */
> + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
> +
> + printf("gd->fdt_blob is %p\n", gd->fdt_blob);

Please remove this (and audit the series for other) bring-up debug
printfs that we shouldn't need anymore.

> + return 0;
> +}
> +
> +int board_late_init(void)
> +{
> + /*to load environment variable from persistent store*/
> + gd->env_valid = 1;
> + env_relocate();
> +
> + return 0;
> +}

Er, do you really need this?

[snip]
> +/* Machine ID */
> +#define CONFIG_MACH_TYPE 8518
> +#define CONFIG_SYS_NONCACHED_MEMORY  BIT(20)

CONFIG_MACH_TYPE is not relevant to aarch64 platforms (it's for
pre-device tree boards) and 'BIT(20)' isn't a valid value for
CONFIG_SYS_NONCACHED_MEMORY (and leads to a warning a build).

Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/5] ARM: MediaTek: add basic support for MT8518 boards

2019-09-11 Thread mingming lee
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 
---
 arch/arm/dts/Makefile  |   3 +-
 arch/arm/dts/mt8518-ap1-emmc.dts   | 104 +
 arch/arm/mach-mediatek/Kconfig |   1 +
 board/mediatek/mt8518/Kconfig  |  14 
 board/mediatek/mt8518/MAINTAINERS  |   6 ++
 board/mediatek/mt8518/Makefile |   3 +
 board/mediatek/mt8518/mt8518_ap1.c |  27 
 configs/mt8518_ap1_emmc_defconfig  |  54 +++
 include/configs/mt8518.h   |  73 
 9 files changed, 284 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8518-ap1-emmc.dts
 create mode 100644 board/mediatek/mt8518/Kconfig
 create mode 100644 board/mediatek/mt8518/MAINTAINERS
 create mode 100644 board/mediatek/mt8518/Makefile
 create mode 100644 board/mediatek/mt8518/mt8518_ap1.c
 create mode 100644 configs/mt8518_ap1_emmc_defconfig
 create mode 100644 include/configs/mt8518.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index aac1b83d49..54ca31c995 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -788,7 +788,8 @@ dtb-$(CONFIG_SOC_K3_J721E) += 
k3-j721e-common-proc-board.dtb \
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7623n-bananapi-bpi-r2.dtb \
mt7629-rfb.dtb \
-   mt8516-pumpkin.dtb
+   mt8516-pumpkin.dtb \
+   mt8518-ap1-emmc.dtb
 
 dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
diff --git a/arch/arm/dts/mt8518-ap1-emmc.dts b/arch/arm/dts/mt8518-ap1-emmc.dts
new file mode 100644
index 00..a542d65f59
--- /dev/null
+++ b/arch/arm/dts/mt8518-ap1-emmc.dts
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee 
+ *
+ */
+
+/dts-v1/;
+
+#include 
+#include "mt8518.dtsi"
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   model = "MT8518 AP1 EMMC";
+
+   chosen {
+   stdout-path = 
+   tick-timer = 
+   };
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0x4000 0x1000>;
+   };
+
+   reg_1p8v: regulator-1p8v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   reg_3p3v: regulator-3p3v {
+   compatible = "regulator-fixed";
+   regulator-name = "fixed-3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_default>;
+   bus-width = <8>;
+   max-frequency = <2>;
+   cap-mmc-highspeed;
+   mmc-hs200-1_8v;
+   cap-mmc-hw-reset;
+   vmmc-supply = <_3p3v>;
+   vqmmc-supply = <_1p8v>;
+   non-removable;
+   status = "okay";
+};
+
+ {
+   mmc0_pins_default: mmc0default {
+   mux {
+   function = "msdc";
+   groups =  "msdc0";
+   };
+
+   conf-cmd-data {
+   pins = "MSDC0_CMD", "MSDC0_DAT0", "MSDC0_DAT1",
+  "MSDC0_DAT2", "MSDC0_DAT3", "MSDC0_DAT4",
+  "MSDC0_DAT5", "MSDC0_DAT6", "MSDC0_DAT7";
+   input-enable;
+   bias-pull-up;
+   };
+
+   conf-clk {
+   pins = "MSDC0_CLK";
+   bias-pull-down;
+   };
+
+   conf-rst {
+   pins = "MSDC0_RSTB";
+   bias-pull-up;
+   };
+   };
+
+   uart0_pins: uart0 {
+   mux {
+   function = "uart";
+   groups = "uart0_0_rxd_txd";
+   };
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
index 8e343c3182..a5808bd343 100644
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -52,5 +52,6 @@ endchoice
 source "board/mediatek/mt7623/Kconfig"
 source "board/mediatek/mt7629/Kconfig"
 source "board/mediatek/pumpkin/Kconfig"
+source "board/mediatek/mt8518/Kconfig"
 
 endif
diff --git a/board/mediatek/mt8518/Kconfig b/board/mediatek/mt8518/Kconfig
new file mode 100644
index