Request to submit the phytium platform to the uboot. Dear Maintainers: My name is Hao Liu, a software engineer from Phytium Technology Co., Ltd. We need to submit the phytium platform to the uboot Home. I hope that the Maintainers can approve with me. This soc is ft2004, and now this patch only support uart and gmac. I know that this patch has some problem, but I will make great efforts.
PATCH 1/1 Request to submit the phytium platform to the uboot. Dear Maintainers: My name is Hao Liu, a software engineer from Phytium Technology Co., Ltd. We need to submit the phytium platform to the uboot Home. I hope that the Maintainers can approve with me. This soc is ft2004, and now this patch only support uart and gmac. I know that this patch has some problem, but I will make great efforts.
--- MAINTAINERS | 6 +++ arch/arm/Kconfig | 8 ++++ arch/arm/dts/Makefile | 2 + arch/arm/dts/phytium-ft2004.dts | 33 ++++++++++++++ board/phytium/ft2004/Kconfig | 12 +++++ board/phytium/ft2004/MAINTAINERS | 8 ++++ board/phytium/ft2004/Makefile | 9 ++++ board/phytium/ft2004/cpu.h | 23 ++++++++++ board/phytium/ft2004/ft2004.c | 96 ++++++++++++++++++++++++++++++++++++++++ configs/ft2004_defconfig | 33 ++++++++++++++ include/configs/ft2004.h | 31 +++++++++++++ 11 files changed, 261 insertions(+) create mode 100644 arch/arm/dts/phytium-ft2004.dts create mode 100644 board/phytium/ft2004/Kconfig create mode 100644 board/phytium/ft2004/MAINTAINERS create mode 100644 board/phytium/ft2004/Makefile create mode 100644 board/phytium/ft2004/cpu.h create mode 100644 board/phytium/ft2004/ft2004.c create mode 100644 configs/ft2004_defconfig create mode 100644 include/configs/ft2004.h
MAINTAINERS +6 -0
@@ -427,6 +427,12 @@ S: Maintained T: git https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze.git F: arch/arm/mach-zynqmp-r5/ +ARM PHYTIUM +M: liuhao <[email protected]> +M: shuyiqi <[email protected]> +S: Maintained +F: arch/arm/dts/phytium-ft2004.dts + BINMAN M: Simon Glass <[email protected]> S: Maintained
arch/arm/Kconfig +8 -0
@@ -1044,6 +1044,13 @@ config TEGRA imply DISTRO_DEFAULTS imply FAT_WRITE +config TARGET_FT2004 + bool "Support Phytium FT2004 Platform" + select ARM64 + help + Support for FT2004 platform. + It has 1GB Sdram, uart and gmac. + config TARGET_VEXPRESS64_AEMV8A bool "Support vexpress_aemv8a" select ARM64
@@ -1718,6 +1725,7 @@ source "arch/arm/cpu/armv8/Kconfig" source "arch/arm/mach-imx/Kconfig" +source "board/phytium/ft2004/Kconfig" source "board/bosch/shc/Kconfig" source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig"
arch/arm/dts/Makefile +2 -0
@@ -14,6 +14,8 @@ dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \ exynos4412-trats2.dtb \ exynos4412-odroid.dtb +dtb-$(CONFIG_TARGET_FT2004) += phytium-ft2004.dtb + dtb-$(CONFIG_TARGET_HIKEY) += hi6220-hikey.dtb dtb-$(CONFIG_TARGET_POPLAR) += hi3798cv200-poplar.dtb
arch/arm/dts/phytium-ft2004.dts new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019, Phytium Ltd. + * shuyiqi <[email protected]> + */ + +/dts-v1/; + +/memreserve/ 0x0000000080000000 0x0000000000100000; +/ { + compatible = "phytium,ft2004"; + #address-cells = <2>; + #size-cells = <2>; + + ethernet at 2820c000 { + compatible = "st,stm32-dwmac"; + reg = <0x0 0x2820C000 0x0 0x2000>; + phy-mode = "rgmii"; + }; + + ethernet at 28210000 { + compatible = "st,stm32-dwmac"; + reg = <0x0 0x28210000 0x0 0x2000>; + phy-mode = "rgmii"; + }; + + uart at 28001000 { + compatible = "arm,pl011"; + reg = <0x0 0x28001000 0x0 0x1000>; + clock = <48000000>; + }; +}; +
board/phytium/ft2004/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +if TARGET_FT2004 + +config SYS_BOARD + default "ft2004" + +config SYS_VENDOR + default "phytium" + +config SYS_CONFIG_NAME + default "ft2004" + +endif
board/phytium/ft2004/MAINTAINERS new file +8 -0
@@ -0,0 +1,8 @@ +PHYTIUM BOARD +M: liuhao <[email protected]> +M: shuyiqi <[email protected]> +S: Maintained +F: board/phytium/ft2004/* +F: include/configs/ft2004.h +F: configs/ft2004_defconfig +
board/phytium/ft2004/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019 +# shuyiqi <[email protected]> +# liuhao <[email protected]> +# + +obj-y += ft2004.o +
board/phytium/ft2004/cpu.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 +* Phytium Technology Ltd <www.phytium.com> +* shuyiqi <[email protected]> +*/ + +#ifndef _FT2004_CPU_H +#define _FT2004_CPU_H + +/* FLUSH L3 CASHE */ +#define HNF_COUNT 0x8 +#define HNF_PSTATE_REQ (HNF_BASE + 0x10) +#define HNF_PSTATE_STAT (HNF_BASE + 0x18) +#define HNF_PSTATE_OFF 0x0 +#define HNF_PSTATE_SFONLY 0x1 +#define HNF_PSTATE_HALF 0x2 +#define HNF_PSTATE_FULL 0x3 +#define HNF_STRIDE 0x10000 +#define HNF_BASE (unsigned long)(0x3A200000) + +#endif /* _FT2004_CPU_H */ +
board/phytium/ft2004/ft2004.c new file +96 -0
96 lines not on this page · raw message
configs/ft2004_defconfig new file +33 -0
@@ -0,0 +1,33 @@ +CONFIG_ARM=y +CONFIG_ARM64=y +CONFIG_TARGET_FT2004=y +CONFIG_SYS_PROMPT="ft2004#" +CONFIG_SYS_TEXT_BASE=0x88000000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_AHCI=y +CONFIG_ARM_SMCCC=y + +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y +CONFIG_DEFAULT_DEVICE_TREE="phytium-ft2004" +CONFIG_DM=y + +CONFIG_NET=y +CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y +CONFIG_CMD_NET=y +CONFIG_CMD_BOOTP=y +CONFIG_CMD_TFTPBOOT=y +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_PING=y +CONFIG_ETH_DESIGNWARE=y + +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y + +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +# CONFIG_CMD_LZMADEC is not set +# CONFIG_CMD_UNZIP is not set +# CONFIG_MMC is not set +# CONFIG_PSCI_RESET is not set
include/configs/ft2004.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 +* shuyiqi <[email protected]> +* liuhao <[email protected]> +*/ + +#ifndef __FT_2004_CONFIG_H__ +#define __FT_2004_CONFIG_H__ + +/* Sdram Bank #1 Address */ +#define PHYS_SDRAM_1 0x80000000 +#define PHYS_SDRAM_1_SIZE 0x7B000000 +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 + +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x10000000) + +/* Size of Malloc Pool */ +#define CONFIG_ENV_SIZE 4096 +#define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024 + CONFIG_ENV_SIZE) + +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - 0x100000) + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "ethaddr=11:22:33:44:55:66\0" \ + "ipaddr=192.168.1.250\0" \ + "gatewayip=192.168.1.1\0" \ + "netmask=255.255.255.0\0" \ + "serverip=192.168.1.110\0" + +#endif
Signature · 1 line
2.7.4
PATCH 1/1 Request to submit the phytium platform to the uboot.
On 10/8/19 4:58 AM, liuhao wrote:
When creating the commit your forgot to leave an empty line between the subject line and the rest of the commit message.
The commit subject and text should allow merging without further editing. It is sufficient that your commit subject and message describe the change, e.g:
arm: add initial support for the Phytium FT2004 SoC
This adds platform code and the device tree for the Phytium FT2004 SoC. The initial support comprises the UART and the GMAC.
See further comments below.
Quoted 28 lines
Signed-off-by liuhao <[email protected]>--- MAINTAINERS | 6 +++ arch/arm/Kconfig | 8 ++++ arch/arm/dts/Makefile | 2 + arch/arm/dts/phytium-ft2004.dts | 33 ++++++++++++++ board/phytium/ft2004/Kconfig | 12 +++++ board/phytium/ft2004/MAINTAINERS | 8 ++++ board/phytium/ft2004/Makefile | 9 ++++ board/phytium/ft2004/cpu.h | 23 ++++++++++ board/phytium/ft2004/ft2004.c | 96 ++++++++++++++++++++++++++++++++++++++++ configs/ft2004_defconfig | 33 ++++++++++++++ include/configs/ft2004.h | 31 +++++++++++++ 11 files changed, 261 insertions(+)create mode 100644 arch/arm//dts/phytium-ft2004.dts create mode 100644 board/phytium/ft2004/Kconfig create mode 100644 board/phytium/ft2004/MAINTAINERS create mode 100644 board/phytium/ft2004/Makefile create mode 100644
board/phytium/ft2004/cpu.hcreate mode 100644board/phytium/ft2004/ft2004.ccreate mode 100644 configs/ft2004_defconfig create mode 100644include/configs/ft2004.hMAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 434
Quoted 8 lines
MAINTAINERS +5
-0@@ -427,6 +427,12 @@ S: Maintained T: git https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze.git F: arch/arm/mach-zynqmp-r5/ +ARM PHYTIUM +M: liuhao <[email protected]> +M: shuyiqi <[email protected]> +S: Maintained +F: arch/arm/dts/phytium-ft2004.dts
Defining ARM PHYTIUM in two places is not necessary. You can add this file to board/phytium/ft2004/MAINTAINERS.
Quoted 35 lines
MAINTAINERS +1
-0+ BINMAN M: Simon Glass <[email protected]> S: Maintainedarch/arm/Kconfig +8
-0@@ -1044,6 +1044,13 @@ config TEGRA imply DISTRO_DEFAULTS imply FAT_WRITE +config TARGET_FT2004 + bool "Support Phytium FT2004 Platform" + select ARM64 + help + Support for FT2004 platform. + It has 1GB Sdram, uart and gmac. + config TARGET_VEXPRESS64_AEMV8A bool "Support vexpress_aemv8a" select ARM64@@ -1718,6 +1725,7 @@ source "arch/arm/cpu/armv8/Kconfig" source "arch/arm/mach-imx/Kconfig" +source "board/phytium/ft2004/Kconfig" source "board/bosch/shc/Kconfig" source "board/bosch/guardian/Kconfig" source "board/CarMediaLab/flea3/Kconfig"arch/arm/dts/Makefile +0
-0
arch/arm/dts/Makefile dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \ · line 19
Quoted 6 lines
arch/arm/dts/Makefile +2
-0@@ -14,6 +14,8 @@ dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \ exynos4412-trats2.dtb \ exynos4412-odroid.dtb +dtb-$(CONFIG_TARGET_FT2004) += phytium-ft2004.dtb + dtb-$(CONFIG_TARGET_HIKEY) += hi6220-hikey.dtb
You patch does not apply cleanly.
Please, rebase your patch on the current origin/master of U-Boot.
Quoted 8 lines
arch/arm/dts/Makefile +0
-0dtb-$(CONFIG_TARGET_POPLAR) += hi3798cv200-poplar.dtbarch/arm/dts/phytium-ft2004.dts new file +0
-0
arch/arm/dts/phytium-ft2004.dts line 8
Quoted 8 lines
arch/arm/dts/phytium-ft2004.dts new file +8
-0@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019, Phytium Ltd. + * shuyiqi <[email protected]> + */ + +/dts-v1/; +
Please, add a comment here explaining why this memory region is reserved.
arch/arm/dts/phytium-ft2004.dts line 10
Quoted 2 lines
arch/arm/dts/phytium-ft2004.dts new file +2
-0+/memreserve/ 0x0000000080000000 0x0000000000100000; +/ {
Please, provide a model property, e.g.
model = "Phytium FT2004";
Quoted 261 lines
arch/arm/dts/phytium-ft2004.dts new file +23
-0+ compatible = "phytium,ft2004"; + #address-cells = <2>; + #size-cells = <2>; + + ethernet at 2820c000 { + compatible = "st,stm32-dwmac"; + reg = <0x0 0x2820C000 0x0 0x2000>; + phy-mode = "rgmii"; + }; + + ethernet at 28210000 { + compatible = "st,stm32-dwmac"; + reg = <0x0 0x28210000 0x0 0x2000>; + phy-mode = "rgmii"; + }; + + uart at 28001000 { + compatible = "arm,pl011"; + reg = <0x0 0x28001000 0x0 0x1000>; + clock = <48000000>; + }; +}; +board/phytium/ft2004/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if TARGET_FT2004 + +config SYS_BOARD + default "ft2004" + +config SYS_VENDOR + default "phytium" + +config SYS_CONFIG_NAME + default "ft2004" + +endifboard/phytium/ft2004/MAINTAINERS new file +8
-0@@ -0,0 +1,8 @@ +PHYTIUM BOARD +M: liuhao <[email protected]> +M: shuyiqi <[email protected]> +S: Maintained +F: board/phytium/ft2004/* +F: include/configs/ft2004.h +F: configs/ft2004_defconfig +board/phytium/ft2004/Makefile new file +9
-0@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019 +# shuyiqi <[email protected]> +# liuhao <[email protected]> +# + +obj-y += ft2004.o +board/phytium/ft2004/cpu.h new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 +* Phytium Technology Ltd <www.phytium.com> +* shuyiqi <[email protected]> +*/ + +#ifndef _FT2004_CPU_H +#define _FT2004_CPU_H + +/* FLUSH L3 CASHE */ +#define HNF_COUNT 0x8 +#define HNF_PSTATE_REQ (HNF_BASE + 0x10) +#define HNF_PSTATE_STAT (HNF_BASE + 0x18) +#define HNF_PSTATE_OFF 0x0 +#define HNF_PSTATE_SFONLY 0x1 +#define HNF_PSTATE_HALF 0x2 +#define HNF_PSTATE_FULL 0x3 +#define HNF_STRIDE 0x10000 +#define HNF_BASE (unsigned long)(0x3A200000) + +#endif /* _FT2004_CPU_H */ +board/phytium/ft2004/ft2004.c new file +96
-0@@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2019 +* shuyiqi <[email protected]> +* liuhao <[email protected]> +*/ + +#include <common.h> +#include <asm/armv8/mmu.h> +#include <asm/system.h> +#include <asm/io.h> +#include <linux/arm-smccc.h> +#include <linux/kernel.h> +#include <scsi.h> +#include "cpu.h" + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ + gd->mem_clk =0 ; + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int dram_init_banksize (void ) +{ + gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; + gd->bd->bi_dram[0 ].size =PHYS_SDRAM_1_SIZE ; + +return 0 ; +} + +int board_init (void ) +{ +return 0 ; +} + +void reset_cpu (ulong addr) +{ +struct arm_smccc_res res; + +printf ("run in %s\n" , __func__); +arm_smccc_smc (0x84000009 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , &res); +printf ("reset cpu error, %lx\n" , res.a0); +} + +static struct mm_region ft2004_mem_map[] = { + { + .virt =0x0UL , + .phys =0x0UL , + .size =0x80000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | +PTE_BLOCK_UXN + }, + { + .virt = (u64 )PHYS_SDRAM_1 , + .phys = (u64 )PHYS_SDRAM_1 , + .size = (u64 )PHYS_SDRAM_1_SIZE , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_NS | +PTE_BLOCK_INNER_SHARE + }, + { +0 , + } +}; + +struct mm_region *mem_map = ft2004_mem_map; + +int print_cpuinfo (void ) +{ +printf ("CPU: Phytium ft2004 %ld MHz\n" , gd->cpu_clk); +return 0 ; +} + +int __asm_flush_l3_dcache (void ) +{ +int i, pstate; + +for (i =0 ; i <HNF_COUNT ; i++) +writeq (HNF_PSTATE_SFONLY ,HNF_PSTATE_REQ + i *HNF_STRIDE ); +for (i =0 ; i <HNF_COUNT ; i++) { +do { + pstate =readq (HNF_PSTATE_STAT + i *HNF_STRIDE ); + }while ((pstate &0xf ) != (HNF_PSTATE_SFONLY <<2 )); + } + +for (i =0 ; i <HNF_COUNT ; i++) +writeq (HNF_PSTATE_FULL ,HNF_PSTATE_REQ + i *HNF_STRIDE ); + +return 0 ; +} +configs/ft2004_defconfig new file +33
-0@@ -0,0 +1,33 @@ +CONFIG_ARM=y +CONFIG_ARM64=y +CONFIG_TARGET_FT2004=y +CONFIG_SYS_PROMPT="ft2004#" +CONFIG_SYS_TEXT_BASE=0x88000000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_AHCI=y +CONFIG_ARM_SMCCC=y + +CONFIG_OF_CONTROL=y +CONFIG_OF_SEPARATE=y +CONFIG_DEFAULT_DEVICE_TREE="phytium-ft2004" +CONFIG_DM=y + +CONFIG_NET=y +CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y +CONFIG_CMD_NET=y +CONFIG_CMD_BOOTP=y +CONFIG_CMD_TFTPBOOT=y +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_PING=y +CONFIG_ETH_DESIGNWARE=y + +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y + +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +# CONFIG_CMD_LZMADEC is not set +# CONFIG_CMD_UNZIP is not set +# CONFIG_MMC is not set +# CONFIG_PSCI_RESET is not setinclude/configs/ft2004.h new file +15
-0@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 +* shuyiqi <[email protected]> +* liuhao <[email protected]> +*/ + +#ifndef __FT_2004_CONFIG_H__ +#define __FT_2004_CONFIG_H__ + +/* Sdram Bank #1 Address */ +#define PHYS_SDRAM_1 0x80000000 +#define PHYS_SDRAM_1_SIZE 0x7B000000 +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +
include/configs/ft2004.h line 25
Quoted 10 lines
include/configs/ft2004.h new file +10
-0+#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x10000000) + +/* Size of Malloc Pool */ +#define CONFIG_ENV_SIZE 4096 +#define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024 + CONFIG_ENV_SIZE) + +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - 0x100000) + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "ethaddr=11:22:33:44:55:66\0" \
With two FT2400 in the same network this will cause trouble. Can't the Designware driver read the MAC from the network adapter?
Otherwise add CONFIG_NET_RANDOM_ETHADDR to your configuration file to generate a random MAC address.
include/configs/ft2004.h line 29
Quoted 4 lines
include/configs/ft2004.h new file +4
-0+"ipaddr=192.168.1.250\0" \ +"gatewayip=192.168.1.1\0" \ +"netmask=255.255.255.0\0" \ +"serverip=192.168.1.110\0"
These definitions will not fit for end users. If you only need them for your own test environment, please, remove them. The dhcp command is meant to fill the variables.
Otherwise the code looks fine to me.
Best regards
Heinrich
Quoted 3 lines
include/configs/ft2004.h new file +2
-0+ +#endif