From: Jorge Ramirez Date: Wed, 7 Jun 2017 16:57:33 +0200 Subject: [U-Boot] [PATCHv5 3/3] ARM64: poplar: hi3798cv200: u-boot support for Poplar 96Boards In-Reply-To: <1496067064-27447-3-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1496067064-27447-1-git-send-email-jorge.ramirez-ortiz@linaro.org> <1496067064-27447-3-git-send-email-jorge.ramirez-ortiz@linaro.org> Message-ID: <57366f4e-8610-6f14-420d-453d81102eeb@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de just a quick reminder that this is pending cheers jorge On 05/29/2017 04:11 PM, Jorge Ramirez-Ortiz wrote: > This port adds support for: > 1) Serial > 2) eMMC > 3) USB > > It has been tested with ARM TRUSTED FIRMWARE running u-boot as the > BL33 executable [see board's README] > > eMMC has been tested for reading and booting the loader and linux > kernels as well as saving the u-boot environment. > > USB has been tested with ASIX networking adapter and SanDisk 7.4GB > drive. > > PSCI has been tested via the reset call. > Since PSCI runs in DDR, u-boot carves the necessary memory from > the kernel memory map. > > The firwmare upgrade process has been tested via TFTP and USB FAT > filesystem containing the fastboot.bin image in one of the partitions. > > Signed-off-by: Jorge Ramirez-Ortiz > --- > arch/arm/Kconfig | 12 ++ > arch/arm/dts/hi3798cv200-u-boot.dtsi | 29 +++ > arch/arm/include/asm/arch-hi3798cv200/dwmmc.h | 13 ++ > .../arm/include/asm/arch-hi3798cv200/hi3798cv200.h | 50 +++++ > board/hisilicon/poplar/Kconfig | 15 ++ > board/hisilicon/poplar/MAINTAINERS | 6 + > board/hisilicon/poplar/Makefile | 7 + > board/hisilicon/poplar/README | 232 ++++++++++++++= +++++++ > board/hisilicon/poplar/poplar.c | 174 ++++++++++++++= ++ > configs/poplar_defconfig | 26 +++ > include/configs/poplar.h | 86 ++++++++ > 11 files changed, 650 insertions(+) > create mode 100644 arch/arm/dts/hi3798cv200-u-boot.dtsi > create mode 100644 arch/arm/include/asm/arch-hi3798cv200/dwmmc.h > create mode 100644 arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h > create mode 100644 board/hisilicon/poplar/Kconfig > create mode 100644 board/hisilicon/poplar/MAINTAINERS > create mode 100644 board/hisilicon/poplar/Makefile > create mode 100644 board/hisilicon/poplar/README > create mode 100644 board/hisilicon/poplar/poplar.c > create mode 100644 configs/poplar_defconfig > create mode 100644 include/configs/poplar.h > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 91f50b0..7e908ca 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -811,6 +811,17 @@ config TARGET_HIKEY > Support for HiKey 96boards platform. It features a HI6220 > SoC, with 8xA53 CPU, mali450 gpu, and 1GB RAM. > =20 > +config TARGET_POPLAR > + bool "Support Poplar 96boards Enterprise Edition Platform" > + select ARM64 > + select DM > + select OF_CONTROL > + select DM_SERIAL > + select DM_USB > + help > + Support for Poplar 96boards EE platform. It features a HI3798cv200 > + SoC, with 4xA53 CPU, MaliT720 GPU, and 1GB RAM. > + > config TARGET_LS1012AQDS > bool "Support ls1012aqds" > select ARCH_LS1012A > @@ -1137,6 +1148,7 @@ source "board/grinn/chiliboard/Kconfig" > source "board/gumstix/pepper/Kconfig" > source "board/h2200/Kconfig" > source "board/hisilicon/hikey/Kconfig" > +source "board/hisilicon/poplar/Kconfig" > source "board/imx31_phycore/Kconfig" > source "board/isee/igep003x/Kconfig" > source "board/olimex/mx23_olinuxino/Kconfig" > diff --git a/arch/arm/dts/hi3798cv200-u-boot.dtsi b/arch/arm/dts/hi3798cv= 200-u-boot.dtsi > new file mode 100644 > index 0000000..2b3713b > --- /dev/null > +++ b/arch/arm/dts/hi3798cv200-u-boot.dtsi > @@ -0,0 +1,29 @@ > +/* > + * U-Boot addition to: > + * 1) use platform data for the console > + * 2) provide support for the generic-ehci USB driver currently not ava= ilable > + * in the linux kernel (8/May/2017). > + * > + * (C) Copyright 2017 Jorge Ramirez-Ortiz > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +&soc { > + usb2: ehci at 9890000 { > + compatible =3D "generic-ehci"; > + reg =3D <0x9890000 0x100>; > + status =3D "okay"; > + }; > +}; > + > +&uart0 { > + status =3D "disabled"; > +}; > + > +/{ > + chosen { > + stdout-path =3D ""; > + }; > +}; > + > diff --git a/arch/arm/include/asm/arch-hi3798cv200/dwmmc.h b/arch/arm/inc= lude/asm/arch-hi3798cv200/dwmmc.h > new file mode 100644 > index 0000000..1060d94 > --- /dev/null > +++ b/arch/arm/include/asm/arch-hi3798cv200/dwmmc.h > @@ -0,0 +1,13 @@ > +/* > + * (C) Copyright 2017 Linaro > + * Jorge Ramirez-Ortiz > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#ifndef _HI3798cv200_DWMMC_H_ > +#define _HI3798cv200_DWMMC_H_ > + > +int hi6220_dwmci_add_port(int index, u32 regbase, int bus_width); > + > +#endif /* _HI3798cv200_DWMMC_H_ */ > diff --git a/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h b/arch/a= rm/include/asm/arch-hi3798cv200/hi3798cv200.h > new file mode 100644 > index 0000000..d30e0b4 > --- /dev/null > +++ b/arch/arm/include/asm/arch-hi3798cv200/hi3798cv200.h > @@ -0,0 +1,50 @@ > +/* > + * (C) Copyright 2017 Linaro > + * Jorge Ramirez-Ortiz > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#ifndef __HI3798cv200_H__ > +#define __HI3798cv200_H__ > + > +#define REG_BASE_PERI_CTRL 0xF8A20000 > +#define REG_BASE_CRG 0xF8A22000 > + > +/* DEVICES */ > +#define REG_BASE_MCI 0xF9830000 > +#define REG_BASE_UART0 0xF8B00000 > + > +/* PERI control registers (4KB) */ > + /* USB2 PHY01 configuration register */ > +#define PERI_CTRL_USB0 (REG_BASE_PERI_CTRL + 0x120) > + > +/* PERI CRG registers (4KB) */ > + /* USB2 CTRL0 clock and soft reset */ > +#define PERI_CRG46 (REG_BASE_CRG + 0xb8) > +#define USB2_BUS_CKEN (1<<0) > +#define USB2_OHCI48M_CKEN (1<<1) > +#define USB2_OHCI12M_CKEN (1<<2) > +#define USB2_OTG_UTMI_CKEN (1<<3) > +#define USB2_HST_PHY_CKEN (1<<4) > +#define USB2_UTMI0_CKEN (1<<5) > +#define USB2_BUS_SRST_REQ (1<<12) > +#define USB2_UTMI0_SRST_REQ (1<<13) > +#define USB2_HST_PHY_SYST_REQ (1<<16) > +#define USB2_OTG_PHY_SYST_REQ (1<<17) > +#define USB2_CLK48_SEL (1<<20) > + > + /* USB2 PHY clock and soft reset */ > +#define PERI_CRG47 (REG_BASE_CRG + 0xbc) > +#define USB2_PHY01_REF_CKEN (1 << 0) > +#define USB2_PHY2_REF_CKEN (1 << 2) > +#define USB2_PHY01_SRST_REQ (1 << 4) > +#define USB2_PHY2_SRST_REQ (1 << 6) > +#define USB2_PHY01_SRST_TREQ0 (1 << 8) > +#define USB2_PHY01_SRST_TREQ1 (1 << 9) > +#define USB2_PHY2_SRST_TREQ (1 << 10) > +#define USB2_PHY01_REFCLK_SEL (1 << 12) > +#define USB2_PHY2_REFCLK_SEL (1 << 14) > + > + > +#endif > diff --git a/board/hisilicon/poplar/Kconfig b/board/hisilicon/poplar/Kcon= fig > new file mode 100644 > index 0000000..3397295 > --- /dev/null > +++ b/board/hisilicon/poplar/Kconfig > @@ -0,0 +1,15 @@ > +if TARGET_POPLAR > + > +config SYS_BOARD > + default "poplar" > + > +config SYS_VENDOR > + default "hisilicon" > + > +config SYS_SOC > + default "hi3798cv200" > + > +config SYS_CONFIG_NAME > + default "poplar" > + > +endif > diff --git a/board/hisilicon/poplar/MAINTAINERS b/board/hisilicon/poplar/= MAINTAINERS > new file mode 100644 > index 0000000..0cc01c8 > --- /dev/null > +++ b/board/hisilicon/poplar/MAINTAINERS > @@ -0,0 +1,6 @@ > +Poplar BOARD > +M: Jorge Ramirez-Ortiz > +S: Maintained > +F: board/hisilicon/poplar > +F: include/configs/poplar.h > +F: configs/poplar_defconfig > diff --git a/board/hisilicon/poplar/Makefile b/board/hisilicon/poplar/Mak= efile > new file mode 100644 > index 0000000..101545d > --- /dev/null > +++ b/board/hisilicon/poplar/Makefile > @@ -0,0 +1,7 @@ > +# > +# (C) Copyright 2017 Linaro > +# Jorge Ramirez-Ortiz > +# > +# SPDX-License-Identifier: GPL-2.0+ > +# > +obj-y :=3D poplar.o > diff --git a/board/hisilicon/poplar/README b/board/hisilicon/poplar/README > new file mode 100644 > index 0000000..97782e7 > --- /dev/null > +++ b/board/hisilicon/poplar/README > @@ -0,0 +1,232 @@ > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + Board Information > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + > +Developed by HiSilicon, the board features the Hi3798C V200 with an > +integrated quad-core 64-bit ARM Cortex A53 processor and high > +performance Mali T720 GPU, making it capable of running any commercial > +set-top solution based on Linux or Android. Its high performance > +specification also supports a premium user experience with up to H.265 > +HEVC decoding of 4K video at 60 frames per second. > + > +SOC Hisilicon Hi3798CV200 > +CPU Quad-core ARM Cortex-A53 64 bit > +DRAM DDR3/3L/4 SDRAM interface, maximum 32-bit data width 2 GB > +USB Two USB 2.0 ports One USB 3.0 ports > +CONSOLE USB-micro port for console support > +ETHERNET 1 GBe Ethernet > +PCIE One PCIe 2.0 interfaces > +JTAG 8-Pin JTAG > +EXPANSION INTERFACE Linaro 96Boards Low Speed Expansion slot > +DIMENSION Standard 160=C3=97120 mm 96Boards Enterprice Edition form fact= or > +WIFI 802.11AC 2*2 with Bluetooth > +CONNECTORS One connector for Smart Card One connector for TSI > + > + > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + BUILD INSTRUCTIONS > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + > +Compile from source: > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +Get all the sources > + > + > mkdir -p ~/poplar/src ~/poplar/bin > + > cd ~/poplar/src > + > git clone https://github.com/Linaro/poplar-l-loader.git l-loader > + > git clone https://github.com/Linaro/poplar-arm-trusted-firmware.git = atf > + > git clone https://github.com/Linaro/poplar-u-boot.git u-boot > + > + > +Compile U-Boot: > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > + Prerequisite: > + # sudo apt-get install device-tree-compiler > + > + > cd ~/poplar/src/u-boot > + > make CROSS_COMPILE=3Daarch64-linux-gnu- poplar_defconfig > + > make CROSS_COMPILE=3Daarch64-linux-gnu- > + > cp u-boot.bin ~/poplar/bin > + > +Compile ARM Trusted Firmware (ATF): > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > + > cd ~/poplar/src/atf > + > make CROSS_COMPILE=3Daarch64-linux-gnu- all fip \ > + SPD=3Dnone BL33=3D~/poplar/bin/u-boot.bin DEBUG=3D1 PLAT=3Dpoplar > + > +Copy resulting binaries > + > cp build/hi3798cv200/debug/bl1.bin ~/poplar/src/l-loader/atf/ > + > cp build/hi3798cv200/debug/fip.bin ~/poplar/src/l-loader/atf/ > + > +Compile l-loader: > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > + > cd ~/poplar/src/l-loader > + > make clean > + > make CROSS_COMPILE=3Darm-linux-gnueabi- > + > + Due to BootROM requiremets, rename l-loader.bin to fastboot.bin: > + > cp l-loader.bin ~/poplar/bin/fastboot.bin > + > + > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + FLASH INSTRUCTIONS > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + > +Two methods: > + > +Using USB debrick support: > + Copy fastboot.bin to a FAT partition on the USB drive and reboot the > + poplar board while pressing S3(usb_boot). > + > + The system will execute the new u-boot and boot into a shell whic= h you > + can then use to write to eMMC. > + > +Using U-BOOT from shell: > + 1) using AXIS usb ethernet dongle and tftp > + 2) using FAT formated USB drive > + > + > +1. TFTP (USB ethernet dongle) > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > + > +Plug a USB AXIS ethernet dongle on any of the USB2 ports on the Poplar b= oard. > +Copy fastboot.bin to your tftp server. > +In u-boot make sure your network is properly setup. > + > +Then > + > +=3D> tftp 0x30000000 fastboot.bin > +starting USB... > +USB0: USB EHCI 1.00 > +scanning bus 0 for devices... 1 USB Device(s) found > +USB1: USB EHCI 1.00 > +scanning bus 1 for devices... 3 USB Device(s) found > + scanning usb for storage devices... 0 Storage Device(s) found > + scanning usb for ethernet devices... 1 Ethernet Device(s) found > +Waiting for Ethernet connection... done. > +Using asx0 device > +TFTP from server 192.168.1.4; our IP address is 192.168.1.10 > +Filename 'poplar/fastboot.bin'. > +Load address: 0x30000000 > +Loading: ###############################################################= ## > + ################################################################# > + ############################################################### > + 2 MiB/s > +done > +Bytes transferred =3D 983040 (f0000 hex) > + > +=3D> mmc write 0x30000000 0 0x780 > + > +MMC write: dev # 0, block # 0, count 1920 ... 1920 blocks written: OK > +=3D> reset > + > + > +2. USING USB FAT DRIVE > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +Copy fastboot.bin to any partition on a FAT32 formated usb flash drive. > +Enter the uboot prompt > + > +=3D> fatls usb 0:2 > + 983040 fastboot.bin > + > +1 file(s), 0 dir(s) > + > +=3D> fatload usb 0:2 0x30000000 fastboot.bin > +reading fastboot.bin > +983040 bytes read in 44 ms (21.3 MiB/s) > + > +=3D> mmc write 0x30000000 0 0x780 > + > +MMC write: dev # 0, block # 0, count 1920 ... 1920 blocks written: OK > + > + > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + BOOT TRACE > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > + > +Bootrom start > +Boot Media: eMMC > +Decrypt auxiliary code ...OK > + > +lsadc voltage min: 000000FE, max: 000000FF, aver: 000000FE, index: 00000= 000 > + > +Entry boot auxiliary code > + > +Auxiliary code - v1.00 > +DDR code - V1.1.2 20160205 > +Build: Mar 24 2016 - 17:09:44 > +Reg Version: v134 > +Reg Time: 2016/03/18 09:44:55 > +Reg Name: hi3798cv2dmb_hi3798cv200_ddr3_2gbyte_8bitx4_4layers.reg > + > +Boot auxiliary code success > +Bootrom success > + > +LOADER: Switched to aarch64 mode > +LOADER: Entering ARM TRUSTED FIRMWARE > +LOADER: CPU0 executes at 0x000ce000 > + > +INFO: BL1: 0xe1000 - 0xe7000 [size =3D 24576] > +NOTICE: Booting Trusted Firmware > +NOTICE: BL1: v1.3(debug):v1.3-372-g1ba9c60 > +NOTICE: BL1: Built : 17:51:33, Apr 30 2017 > +INFO: BL1: RAM 0xe1000 - 0xe7000 > +INFO: BL1: Loading BL2 > +INFO: Loading image id=3D1 at address 0xe9000 > +INFO: Image id=3D1 loaded at address 0xe9000, size =3D 0x5008 > +NOTICE: BL1: Booting BL2 > +INFO: Entry point address =3D 0xe9000 > +INFO: SPSR =3D 0x3c5 > +NOTICE: BL2: v1.3(debug):v1.3-372-g1ba9c60 > +NOTICE: BL2: Built : 17:51:33, Apr 30 2017 > +INFO: BL2: Loading BL31 > +INFO: Loading image id=3D3 at address 0x129000 > +INFO: Image id=3D3 loaded at address 0x129000, size =3D 0x8038 > +INFO: BL2: Loading BL33 > +INFO: Loading image id=3D5 at address 0x37000000 > +INFO: Image id=3D5 loaded at address 0x37000000, size =3D 0x58f17 > +NOTICE: BL1: Booting BL31 > +INFO: Entry point address =3D 0x129000 > +INFO: SPSR =3D 0x3cd > +INFO: Boot bl33 from 0x37000000 for 364311 Bytes > +NOTICE: BL31: v1.3(debug):v1.3-372-g1ba9c60 > +NOTICE: BL31: Built : 17:51:33, Apr 30 2017 > +INFO: BL31: Initializing runtime services > +INFO: BL31: Preparing for EL3 exit to normal world > +INFO: Entry point address =3D 0x37000000 > +INFO: SPSR =3D 0x3c9 > + > + > +U-Boot 2017.05-rc2-00130-gd2255b0 (Apr 30 2017 - 17:51:28 +0200)poplar > + > +Model: HiSilicon Poplar Development Board > +BOARD: Hisilicon HI3798cv200 Poplar > +DRAM: 1 GiB > +MMC: Hisilicon DWMMC: 0 > +In: serial at f8b00000 > +Out: serial at f8b00000 > +Err: serial at f8b00000 > +Net: Net Initialization Skipped > +No ethernet found. > + > +Hit any key to stop autoboot: 0 > +starting USB... > +USB0: USB EHCI 1.00 > +scanning bus 0 for devices... 1 USB Device(s) found > +USB1: USB EHCI 1.00 > +scanning bus 1 for devices... 4 USB Device(s) found > + scanning usb for storage devices... 1 Storage Device(s) found > + scanning usb for ethernet devices... 1 Ethernet Device(s) found > + > +USB device 0: > + Device 0: Vendor: SanDisk Rev: 1.00 Prod: Cruzer Blade > + Type: Removable Hard Disk > + Capacity: 7632.0 MB =3D 7.4 GB (15630336 x 512) > +... is now current device > +Scanning usb 0:1... > +=3D> > diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/pop= lar.c > new file mode 100644 > index 0000000..b4ac371 > --- /dev/null > +++ b/board/hisilicon/poplar/poplar.c > @@ -0,0 +1,174 @@ > +/* > + * (C) Copyright 2017 Linaro > + * Jorge Ramirez-Ortiz > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +static struct mm_region poplar_mem_map[] =3D { > + { > + .virt =3D 0x0UL, > + .phys =3D 0x0UL, > + .size =3D 0x80000000UL, > + .attrs =3D PTE_BLOCK_MEMTYPE(MT_NORMAL) | > + PTE_BLOCK_INNER_SHARE > + }, { > + .virt =3D 0x80000000UL, > + .phys =3D 0x80000000UL, > + .size =3D 0x80000000UL, > + .attrs =3D PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | > + PTE_BLOCK_NON_SHARE | > + PTE_BLOCK_PXN | PTE_BLOCK_UXN > + }, { > + 0, > + } > +}; > + > +struct mm_region *mem_map =3D poplar_mem_map; > + > +static const struct pl01x_serial_platdata serial_platdata =3D { > + .base =3D REG_BASE_UART0, > + .type =3D TYPE_PL010, > + .clock =3D 75000000, > +}; > + > +U_BOOT_DEVICE(poplar_serial) =3D { > + .name =3D "serial_pl01x", > + .platdata =3D &serial_platdata, > +}; > + > +int checkboard(void) > +{ > + puts("BOARD: Hisilicon HI3798cv200 Poplar\n"); > + > + return 0; > +} > + > +void reset_cpu(ulong addr) > +{ > + psci_system_reset(); > +} > + > +int dram_init(void) > +{ > + gd->ram_size =3D get_ram_size(NULL, 0x80000000); > + > + return 0; > +} > + > +int dram_init_banksize(void) > +{ > + const struct { > + phys_addr_t start; > + phys_addr_t end; > + char *name; > + } reserved =3D { > + /* ATF PSCI runs in DDR (no SRAM available for it) */ > + .name =3D "atf-bl31", > + .start =3D 0x129000, > + .end =3D 0x129000 + 0x8020, > + }; > + > + gd->bd->bi_dram[0].start =3D 0x0; > + gd->bd->bi_dram[0].size =3D reserved.start; > + > + gd->bd->bi_dram[1].start =3D reserved.end; > + gd->bd->bi_dram[1].size =3D gd->ram_size - reserved.end; > + > + return 0; > +} > + > +static void usb2_phy_config(void) > +{ > + const u32 config[] =3D { > + /* close EOP pre-emphasis. open data pre-emphasis */ > + 0xa1001c, > + /* Rcomp =3D 150mW, increase DC level */ > + 0xa00607, > + /* keep Rcomp working */ > + 0xa10700, > + /* Icomp =3D 212mW, increase current drive */ > + 0xa00aab, > + /* EMI fix: rx_active not stay 1 when error packets received */ > + 0xa11140, > + /* Comp mode select */ > + 0xa11041, > + /* adjust eye diagram */ > + 0xa0098c, > + /* adjust eye diagram */ > + 0xa10a0a, > + }; > + int i; > + > + for (i =3D 0; i < ARRAY_SIZE(config); i++) { > + writel(config[i], PERI_CTRL_USB0); > + clrsetbits_le32(PERI_CTRL_USB0, BIT(21), BIT(20) | BIT(22)); > + udelay(20); > + } > +} > + > +static void usb2_phy_init(void) > +{ > + /* reset usb2 controller bus/utmi/roothub */ > + setbits_le32(PERI_CRG46, USB2_BUS_SRST_REQ | USB2_UTMI0_SRST_REQ | > + USB2_HST_PHY_SYST_REQ | USB2_OTG_PHY_SYST_REQ); > + udelay(200); > + > + /* reset usb2 phy por/utmi */ > + setbits_le32(PERI_CRG47, USB2_PHY01_SRST_REQ | USB2_PHY01_SRST_TREQ1); > + udelay(200); > + > + /* open usb2 ref clk */ > + setbits_le32(PERI_CRG47, USB2_PHY01_REF_CKEN); > + udelay(300); > + > + /* cancel usb2 power on reset */ > + clrbits_le32(PERI_CRG47, USB2_PHY01_SRST_REQ); > + udelay(500); > + > + usb2_phy_config(); > + > + /* cancel usb2 port reset, wait comp circuit stable */ > + clrbits_le32(PERI_CRG47, USB2_PHY01_SRST_TREQ1); > + mdelay(10); > + > + /* open usb2 controller clk */ > + setbits_le32(PERI_CRG46, USB2_BUS_CKEN | USB2_OHCI48M_CKEN | > + USB2_OHCI12M_CKEN | USB2_OTG_UTMI_CKEN | > + USB2_HST_PHY_CKEN | USB2_UTMI0_CKEN); > + udelay(200); > + > + /* cancel usb2 control reset */ > + clrbits_le32(PERI_CRG46, USB2_BUS_SRST_REQ | USB2_UTMI0_SRST_REQ | > + USB2_HST_PHY_SYST_REQ | USB2_OTG_PHY_SYST_REQ); > + udelay(200); > +} > + > +int board_mmc_init(bd_t *bis) > +{ > + int ret; > + > + ret =3D hi6220_dwmci_add_port(0, REG_BASE_MCI, 8); > + if (ret) > + printf("mmc init error (%d)\n", ret); > + > + return ret; > +} > + > +int board_init(void) > +{ > + usb2_phy_init(); > + > + return 0; > +} > + > diff --git a/configs/poplar_defconfig b/configs/poplar_defconfig > new file mode 100644 > index 0000000..8f9f40f > --- /dev/null > +++ b/configs/poplar_defconfig > @@ -0,0 +1,26 @@ > +CONFIG_ARM=3Dy > +CONFIG_TARGET_POPLAR=3Dy > +CONFIG_IDENT_STRING=3D"poplar" > +CONFIG_DEFAULT_DEVICE_TREE=3D"hi3798cv200-poplar" > +CONFIG_SYS_PROMPT=3D"poplar# " > +CONFIG_DISTRO_DEFAULTS=3Dy > +CONFIG_DISPLAY_CPUINFO=3Dn > +CONFIG_DISPLAY_BOARDINFO=3Dy > +CONFIG_ISO_PARTITION=3Dn > +CONFIG_MMC_DW=3Dy > +CONFIG_MMC_DW_K3=3Dy > +CONFIG_PL011_SERIAL=3Dy > +CONFIG_PSCI_RESET=3Dy > +CONFIG_USB=3Dy > +CONFIG_USB_EHCI=3Dy > +CONFIG_USB_EHCI_HCD=3Dy > +CONFIG_USB_EHCI_GENERIC=3Dy > +CONFIG_USB_STORAGE=3Dy > +CONFIG_NET=3Dy > +# CONFIG_CMD_IMLS is not set > +# CONFIG_DM_GPIO is not set > +CONFIG_LIB_RAND=3Dy > +CONFIG_CMD_UNZIP=3Dy > +CONFIG_CMD_MMC=3Dy > +CONFIG_CMD_USB=3Dy > + > diff --git a/include/configs/poplar.h b/include/configs/poplar.h > new file mode 100644 > index 0000000..55e05d6 > --- /dev/null > +++ b/include/configs/poplar.h > @@ -0,0 +1,86 @@ > +/* > + * (C) Copyright 2017 Linaro > + * > + * Jorge Ramirez-Ortiz > + * > + * Configuration for Poplar 96boards CE. Parts were derived from other A= RM > + * configurations. > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#ifndef _POPLAR_H_ > +#define _POPLAR_H_ > + > +#include > + > +/* DRAM banks */ > +#define CONFIG_NR_DRAM_BANKS 2 > + > +/* SYS */ > +#define CONFIG_SYS_BOOTM_LEN 0x1400000 > +#define CONFIG_SYS_INIT_SP_ADDR 0x200000 > +#define CONFIG_SYS_LOAD_ADDR 0x800000 > +#define CONFIG_SYS_MALLOC_LEN SZ_32M > + > +/* ATF bl33.bin load address (must match) */ > +#define CONFIG_SYS_TEXT_BASE 0x37000000 > + > +/* PL010/PL011 */ > +#define CONFIG_PL01X_SERIAL > + > +/* USB configuration */ > +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 > +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2 > +#define CONFIG_SYS_USB_EVENT_POLL > +#define CONFIG_USB_HOST_ETHER > +#define CONFIG_USB_ETHER_ASIX > + > +/* SD/MMC */ > +#define CONFIG_BOUNCE_BUFFER > + > +/***********************************************************************= ****** > + * Initial environment variables > + ***********************************************************************= ******/ > + > +#define BOOT_TARGET_DEVICES(func) \ > + func(USB, usb, 0) \ > + func(MMC, mmc, 0) \ > + func(DHCP, dhcp, na) > +#ifndef CONFIG_SPL_BUILD > +#include > +#include > +#endif > + > +#define CONFIG_EXTRA_ENV_SETTINGS \ > + "loader_mmc_blknum=3D0x0\0" \ > + "loader_mmc_nblks=3D0x780\0" \ > + "env_mmc_blknum=3D0x780\0" \ > + "env_mmc_nblks=3D0x80\0" \ > + "kernel_addr_r=3D0x30000000\0" \ > + "pxefile_addr_r=3D0x32000000\0" \ > + "scriptaddr=3D0x32000000\0" \ > + "fdt_addr_r=3D0x32200000\0" \ > + "fdtfile=3Dhisilicon/hi3798cv200-poplar.dtb\0" \ > + "ramdisk_addr_r=3D0x32400000\0" \ > + BOOTENV > + > + > +/* Command line configuration */ > +#define CONFIG_ENV_IS_IN_MMC 1 > +#define CONFIG_SYS_MMC_ENV_DEV 0 > +#define CONFIG_ENV_OFFSET (0x780 * 512) /* env_mmc_blknum */ > +#define CONFIG_ENV_SIZE 0x10000 /* env_mmc_nblks bytes */ > +#define CONFIG_FAT_WRITE > +#define CONFIG_ENV_VARS_UBOOT_CONFIG > + > +/* Monitor Command Prompt */ > +#define CONFIG_CMDLINE_EDITING > +#define CONFIG_SYS_LONGHELP > +#define CONFIG_SYS_CBSIZE 512 > +#define CONFIG_SYS_MAXARGS 64 > +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ > + sizeof(CONFIG_SYS_PROMPT) + 16) > +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE > + > +#endif /* _POPLAR_H_ */