diff options
Diffstat (limited to 'board')
38 files changed, 509 insertions, 340 deletions
diff --git a/board/8dtech/eco5pk/eco5pk.c b/board/8dtech/eco5pk/eco5pk.c index e05928f322..dcbd4835b3 100644 --- a/board/8dtech/eco5pk/eco5pk.c +++ b/board/8dtech/eco5pk/eco5pk.c @@ -16,7 +16,7 @@ #include <asm/arch/emac_defs.h> #include <asm/gpio.h> #include <i2c.h> -#include <crc.h> +#include <u-boot/crc.h> #include <asm/mach-types.h> #include "eco5pk.h" diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c index 5f4ca0f5a7..d343453f22 100644 --- a/board/AndesTech/ax25-ae350/ax25-ae350.c +++ b/board/AndesTech/ax25-ae350/ax25-ae350.c @@ -14,6 +14,7 @@ DECLARE_GLOBAL_DATA_PTR; +extern phys_addr_t prior_stage_fdt_address; /* * Miscellaneous platform dependent initializations */ @@ -66,7 +67,7 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) void *board_fdt_blob_setup(void) { - void **ptr = (void *)CONFIG_SYS_SDRAM_BASE; + void **ptr = (void *)&prior_stage_fdt_address; if (fdt_magic(*ptr) == FDT_MAGIC) return (void *)*ptr; diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 160d30cd79..1f7650cb36 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -212,7 +212,7 @@ static struct mv_ddr_topology_map board_topology_map_1g = { SPEED_BIN_DDR_1600K, /* speed_bin */ MV_DDR_DEV_WIDTH_16BIT, /* memory_width */ MV_DDR_DIE_CAP_4GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_NORMAL, /* temperature */ MV_DDR_TIM_2T} }, /* timing */ @@ -234,7 +234,7 @@ static struct mv_ddr_topology_map board_topology_map_2g = { SPEED_BIN_DDR_1600K, /* speed_bin */ MV_DDR_DEV_WIDTH_16BIT, /* memory_width */ MV_DDR_DIE_CAP_8GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_NORMAL, /* temperature */ MV_DDR_TIM_2T} }, /* timing */ diff --git a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c index 92d7ae77f0..bc18fe6ddf 100644 --- a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c +++ b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c @@ -67,7 +67,7 @@ static struct mv_ddr_topology_map board_topology_map = { SPEED_BIN_DDR_1866L, /* speed_bin */ MV_DDR_DEV_WIDTH_8BIT, /* memory_width */ MV_DDR_DIE_CAP_2GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_LOW, /* temperature */ MV_DDR_TIM_DEFAULT} }, /* timing */ diff --git a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c index a8cfe8af0a..9368bce26c 100644 --- a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c +++ b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c @@ -88,7 +88,7 @@ static struct mv_ddr_topology_map board_topology_map = { SPEED_BIN_DDR_1866L, /* speed_bin */ MV_DDR_DEV_WIDTH_8BIT, /* memory_width */ MV_DDR_DIE_CAP_4GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_LOW, /* temperature */ MV_DDR_TIM_DEFAULT} }, /* timing */ diff --git a/board/armadeus/apf27/apf27.c b/board/armadeus/apf27/apf27.c index 0f0c8a4a97..bf2586d326 100644 --- a/board/armadeus/apf27/apf27.c +++ b/board/armadeus/apf27/apf27.c @@ -16,8 +16,8 @@ #include <asm/arch/gpio.h> #include <asm/gpio.h> #include <linux/errno.h> +#include <u-boot/crc.h> #include "apf27.h" -#include "crc.h" #include "fpga.h" DECLARE_GLOBAL_DATA_PTR; diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c index b4b8081c90..b857a5a935 100644 --- a/board/eets/pdu001/board.c +++ b/board/eets/pdu001/board.c @@ -209,7 +209,6 @@ void am33xx_spl_board_init(void) const struct dpll_params *get_dpll_ddr_params(void) { enable_i2c0_pin_mux(); - i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); return &dpll_ddr; } diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index 33ca253432..56bb5337d4 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -13,7 +13,8 @@ config SYS_CONFIG_NAME default "qemu-riscv" config SYS_TEXT_BASE - default 0x80000000 + default 0x80000000 if !RISCV_SMODE + default 0x80200000 if RISCV_SMODE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y diff --git a/board/emulation/qemu-riscv/MAINTAINERS b/board/emulation/qemu-riscv/MAINTAINERS index 3c6eb4f844..c701c83d77 100644 --- a/board/emulation/qemu-riscv/MAINTAINERS +++ b/board/emulation/qemu-riscv/MAINTAINERS @@ -4,4 +4,6 @@ S: Maintained F: board/emulation/qemu-riscv/ F: include/configs/qemu-riscv.h F: configs/qemu-riscv32_defconfig +F: configs/qemu-riscv32_smode_defconfig F: configs/qemu-riscv64_defconfig +F: configs/qemu-riscv64_smode_defconfig diff --git a/board/freescale/ls1012afrdm/MAINTAINERS b/board/freescale/ls1012afrdm/MAINTAINERS index 5ef4ae8fe9..480b6bb325 100644 --- a/board/freescale/ls1012afrdm/MAINTAINERS +++ b/board/freescale/ls1012afrdm/MAINTAINERS @@ -7,6 +7,7 @@ F: include/configs/ls1012afrdm.h F: configs/ls1012afrdm_qspi_defconfig F: configs/ls1012afrdm_tfa_defconfig F: configs/ls1012afrwy_tfa_defconfig +F: configs/ls1012afrwy_tfa_SECURE_BOOT_defconfig LS1012AFRWY BOARD M: Bhaskar Upadhaya <bhaskar.upadhaya@nxp.com> diff --git a/board/freescale/ls1012aqds/MAINTAINERS b/board/freescale/ls1012aqds/MAINTAINERS index 2dcc22a485..dbd4670c3b 100644 --- a/board/freescale/ls1012aqds/MAINTAINERS +++ b/board/freescale/ls1012aqds/MAINTAINERS @@ -6,3 +6,4 @@ F: board/freescale/ls1012aqds/ F: include/configs/ls1012aqds.h F: configs/ls1012aqds_qspi_defconfig F: configs/ls1012aqds_tfa_defconfig +F: configs/ls1012aqds_tfa_SECURE_BOOT_defconfig diff --git a/board/freescale/ls1012ardb/MAINTAINERS b/board/freescale/ls1012ardb/MAINTAINERS index bb2a183b34..60e184d10f 100644 --- a/board/freescale/ls1012ardb/MAINTAINERS +++ b/board/freescale/ls1012ardb/MAINTAINERS @@ -6,6 +6,8 @@ F: board/freescale/ls1012ardb/ F: include/configs/ls1012ardb.h F: configs/ls1012ardb_qspi_defconfig F: configs/ls1012ardb_tfa_defconfig +F: configs/ls1012ardb_tfa_SECURE_BOOT_defconfig +F: configs/ls1012a2g5rdb_tfa_defconfig M: Sumit Garg <sumit.garg@nxp.com> S: Maintained diff --git a/board/freescale/ls1043aqds/MAINTAINERS b/board/freescale/ls1043aqds/MAINTAINERS index d10eb56d28..9fb6cc85cd 100644 --- a/board/freescale/ls1043aqds/MAINTAINERS +++ b/board/freescale/ls1043aqds/MAINTAINERS @@ -12,3 +12,4 @@ F: configs/ls1043aqds_sdcard_qspi_defconfig F: configs/ls1043aqds_qspi_defconfig F: configs/ls1043aqds_lpuart_defconfig F: configs/ls1043aqds_tfa_defconfig +F: configs/ls1043aqds_tfa_SECURE_BOOT_defconfig diff --git a/board/freescale/ls1043ardb/MAINTAINERS b/board/freescale/ls1043ardb/MAINTAINERS index 3f64a6fc02..ed62396760 100644 --- a/board/freescale/ls1043ardb/MAINTAINERS +++ b/board/freescale/ls1043ardb/MAINTAINERS @@ -9,6 +9,7 @@ F: configs/ls1043ardb_defconfig F: configs/ls1043ardb_nand_defconfig F: configs/ls1043ardb_sdcard_defconfig F: configs/ls1043ardb_tfa_defconfig +F: configs/ls1043ardb_tfa_SECURE_BOOT_defconfig LS1043A_SECURE_BOOT BOARD M: Ruchika Gupta <ruchika.gupta@nxp.com> diff --git a/board/freescale/ls1046aqds/MAINTAINERS b/board/freescale/ls1046aqds/MAINTAINERS index 22c3926539..39a48da95a 100644 --- a/board/freescale/ls1046aqds/MAINTAINERS +++ b/board/freescale/ls1046aqds/MAINTAINERS @@ -11,6 +11,7 @@ F: configs/ls1046aqds_sdcard_qspi_defconfig F: configs/ls1046aqds_qspi_defconfig F: configs/ls1046aqds_lpuart_defconfig F: configs/ls1046aqds_tfa_defconfig +F: configs/ls1046aqds_tfa_SECURE_BOOT_defconfig M: Sumit Garg <sumit.garg@nxp.com> S: Maintained diff --git a/board/freescale/ls1046ardb/MAINTAINERS b/board/freescale/ls1046ardb/MAINTAINERS index b7d9564057..8b4b45e9ed 100644 --- a/board/freescale/ls1046ardb/MAINTAINERS +++ b/board/freescale/ls1046ardb/MAINTAINERS @@ -10,6 +10,7 @@ F: configs/ls1046ardb_qspi_spl_defconfig F: configs/ls1046ardb_sdcard_defconfig F: configs/ls1046ardb_emmc_defconfig F: configs/ls1046ardb_tfa_defconfig +F: configs/ls1046ardb_tfa_SECURE_BOOT_defconfig LS1046A_SECURE_BOOT BOARD M: Ruchika Gupta <ruchika.gupta@nxp.com> diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c index 4ec0af4d1c..d40ed3742e 100644 --- a/board/freescale/mpc8349emds/mpc8349emds.c +++ b/board/freescale/mpc8349emds/mpc8349emds.c @@ -273,7 +273,7 @@ void spi_cs_deactivate(struct spi_slave *slave) iopd->dat |= SPI_CS_MASK; } -#endif /* CONFIG_HARD_SPI */ +#endif #if defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, bd_t *bd) diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c index dd4c083fbd..86051aedf8 100644 --- a/board/gdsys/a38x/controlcenterdc.c +++ b/board/gdsys/a38x/controlcenterdc.c @@ -64,7 +64,7 @@ static struct mv_ddr_topology_map ddr_topology_map = { SPEED_BIN_DDR_1600K, /* speed_bin */ MV_DDR_DEV_WIDTH_16BIT, /* memory_width */ MV_DDR_DIE_CAP_4GBIT, /* mem_size */ - DDR_FREQ_533, /* frequency */ + MV_DDR_FREQ_533, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_LOW, /* temperature */ MV_DDR_TIM_DEFAULT} }, /* timing */ diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c index a411d4e7f6..d547af4b05 100644 --- a/board/ids/ids8313/ids8313.c +++ b/board/ids/ids8313/ids8313.c @@ -208,4 +208,4 @@ void spi_cs_deactivate(struct spi_slave *slave) /* deactivate the spi_cs */ setbits_be32(&iopd->dat, IDSCPLD_SPI_CS_MASK); } -#endif /* CONFIG_HARD_SPI */ +#endif diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c index 341678319a..8c0864bcdd 100644 --- a/board/kobol/helios4/helios4.c +++ b/board/kobol/helios4/helios4.c @@ -33,18 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; #define BOARD_GPP_POL_LOW 0x0 #define BOARD_GPP_POL_MID 0x0 -/* IO expander on Marvell GP board includes e.g. fan enabling */ -struct marvell_io_exp { - u8 addr; - u8 val; -}; - -static struct marvell_io_exp io_exp[] = { - {6, 0xf9}, - {2, 0x46}, /* Assert reset signals and enable USB3 current limiter */ - {6, 0xb9} -}; - static struct serdes_map board_serdes_map[] = { {SATA0, SERDES_SPEED_6_GBPS, SERDES_DEFAULT_MODE, 0, 0}, {USB3_HOST0, SERDES_SPEED_5_GBPS, SERDES_DEFAULT_MODE, 0, 0}, @@ -78,7 +66,7 @@ static struct mv_ddr_topology_map board_topology_map = { SPEED_BIN_DDR_1600K, /* speed_bin */ MV_DDR_DEV_WIDTH_16BIT, /* memory_width */ MV_DDR_DIE_CAP_8GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_LOW, /* temperature */ MV_DDR_TIM_DEFAULT} }, /* timing */ @@ -123,29 +111,9 @@ int board_early_init_f(void) int board_init(void) { - int i; - /* Address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; - /* Init I2C IO expanders */ - for (i = 0; i < ARRAY_SIZE(io_exp); i++) { - struct udevice *dev; - int ret; - - ret = i2c_get_chip_for_busnum(0, io_exp[i].addr, 1, &dev); - if (ret) { - printf("Cannot find I2C: %d\n", ret); - return 0; - } - - ret = dm_i2c_write(dev, io_exp[i].val, &io_exp[i].val, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - } - return 0; } diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c index 8b15267d7b..8f0247e046 100644 --- a/board/renesas/salvator-x/salvator-x.c +++ b/board/renesas/salvator-x/salvator-x.c @@ -31,7 +31,6 @@ void s_init(void) { } -#define SCIF2_MSTP310 BIT(10) /* SCIF2 */ #define DVFS_MSTP926 BIT(26) #define HSUSB_MSTP704 BIT(4) /* HSUSB */ @@ -100,3 +99,25 @@ void reset_cpu(ulong addr) writel(RST_CODE, RST_CA57RESCNT); #endif } + +#ifdef CONFIG_MULTI_DTB_FIT +int board_fit_config_name_match(const char *name) +{ + /* PRR driver is not available yet */ + u32 cpu_type = rmobile_get_cpu_type(); + + if ((cpu_type == RMOBILE_CPU_TYPE_R8A7795) && + !strcmp(name, "r8a7795-salvator-x-u-boot")) + return 0; + + if ((cpu_type == RMOBILE_CPU_TYPE_R8A7796) && + !strcmp(name, "r8a7796-salvator-x-u-boot")) + return 0; + + if ((cpu_type == RMOBILE_CPU_TYPE_R8A77965) && + !strcmp(name, "r8a77965-salvator-x-u-boot")) + return 0; + + return -1; +} +#endif diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c index 63550af1f0..81d6f8f6f2 100644 --- a/board/renesas/ulcb/ulcb.c +++ b/board/renesas/ulcb/ulcb.c @@ -30,8 +30,6 @@ void s_init(void) { } -#define GSX_MSTP112 BIT(12) /* 3DG */ -#define SCIF2_MSTP310 BIT(10) /* SCIF2 */ #define DVFS_MSTP926 BIT(26) #define HSUSB_MSTP704 BIT(4) /* HSUSB */ @@ -84,3 +82,21 @@ int dram_init_banksize(void) return 0; } + +#ifdef CONFIG_MULTI_DTB_FIT +int board_fit_config_name_match(const char *name) +{ + /* PRR driver is not available yet */ + u32 cpu_type = rmobile_get_cpu_type(); + + if ((cpu_type == RMOBILE_CPU_TYPE_R8A7795) && + !strcmp(name, "r8a7795-h3ulcb-u-boot")) + return 0; + + if ((cpu_type == RMOBILE_CPU_TYPE_R8A7796) && + !strcmp(name, "r8a7796-m3ulcb-u-boot")) + return 0; + + return -1; +} +#endif diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 4e1386c8a2..1742aa8921 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -65,7 +65,7 @@ static struct mv_ddr_topology_map board_topology_map = { SPEED_BIN_DDR_1600K, /* speed_bin */ MV_DDR_DEV_WIDTH_16BIT, /* memory_width */ MV_DDR_DIE_CAP_4GBIT, /* mem_size */ - DDR_FREQ_800, /* frequency */ + MV_DDR_FREQ_800, /* frequency */ 0, 0, /* cas_wl cas_l */ MV_DDR_TEMP_LOW, /* temperature */ MV_DDR_TIM_DEFAULT} }, /* timing */ diff --git a/board/sunxi/README.sunxi64 b/board/sunxi/README.sunxi64 index bba2e01b60..258921af22 100644 --- a/board/sunxi/README.sunxi64 +++ b/board/sunxi/README.sunxi64 @@ -12,8 +12,13 @@ file describes how to make full use of the 64-bit capabilities. Quick Start / Overview ====================== - Build the ARM Trusted Firmware binary (see "ARM Trusted Firmware (ATF)" below) + $ cd /src/arm-trusted-firmware + $ make PLAT=sun50i_a64 DEBUG=1 bl31 - Build U-Boot (see "SPL/U-Boot" below) + $ export BL31=/path/to/bl31.bin + $ make pine64_plus_defconfig && make -j5 - Transfer to an uSD card (see "microSD card" below) + $ dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=8k seek=1 - Boot and enjoy! Building the firmware @@ -29,14 +34,18 @@ to build it first. ARM Trusted Firmware (ATF) ---------------------------- -Checkout the "allwinner" branch from the github repository [1] and build it: +Checkout the latest master branch from the official ATF repository [1] and +build it: $ export CROSS_COMPILE=aarch64-linux-gnu- -$ make PLAT=sun50iw1p1 DEBUG=1 bl31 -The resulting binary is build/sun50iw1p1/debug/bl31.bin. Either put the +$ make PLAT=sun50i_a64 DEBUG=1 bl31 +The resulting binary is build/sun50i_a64/debug/bl31.bin. Either put the location of this file into the BL31 environment variable or copy this to the root of your U-Boot build directory (or create a symbolic link). -$ export BL31=/src/arm-trusted-firmware/build/sun50iw1p1/debug/bl31.bin +$ export BL31=/src/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin (adjust the actual path accordingly) +The platform target "sun50i_a64" covers all boards with either an Allwinner +A64 or H5 SoC (since they are very similar). For boards with an Allwinner H6 +SoC use "sun50i_h6". If you run into size issues with the resulting U-Boot image file, it might help to use a release build, by using "DEBUG=0" when building bl31.bin. @@ -59,7 +68,8 @@ $ make pine64_plus_defconfig $ make This will build the SPL in spl/sunxi-spl.bin and a FIT image called u-boot.itb, -which contains the rest of the firmware. +which contains the rest of the firmware. u-boot-sunxi-with-spl.bin joins those +two components in one convenient image file. Boot process @@ -91,6 +101,9 @@ by using the USB-OTG interface and a host port on another computer. As the FEL mode is controlled by the boot ROM, it expects to be running in AArch32. For now the AArch64 SPL cannot properly return into FEL mode, so the feature is disabled in the configuration at the moment. +The repository in [3] contains FEL capable SPL binaries, built using an +off-tree branch to generate 32-bit ARM code (along with instructions +how to re-create them). microSD card ------------ @@ -165,6 +178,6 @@ Then write this image to a microSD card, replacing /dev/sdx with the right device file (see above): $ dd if=firmware.img of=/dev/sdx bs=8k seek=1 -[1] https://github.com/apritzel/arm-trusted-firmware.git +[1] https://github.com/ARM-software/arm-trusted-firmware.git [2] git://github.com/linux-sunxi/sunxi-tools.git [3] https://github.com/apritzel/pine64/ diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 64ccbc7245..917f5b18f6 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -28,7 +28,7 @@ #endif #include <asm/gpio.h> #include <asm/io.h> -#include <crc.h> +#include <u-boot/crc.h> #include <environment.h> #include <linux/libfdt.h> #include <nand.h> @@ -637,13 +637,6 @@ void sunxi_board_init(void) power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON)); #endif #endif - printf("DRAM:"); - gd->ram_size = sunxi_dram_init(); - printf(" %d MiB\n", (int)(gd->ram_size >> 20)); - if (!gd->ram_size) - hang(); - - sunxi_spl_store_dram_size(gd->ram_size); /* * Only clock up the CPU to full speed if we are reasonably @@ -652,7 +645,16 @@ void sunxi_board_init(void) if (!power_failed) clock_set_pll1(CONFIG_SYS_CLK_FREQ); else - printf("Failed to set core voltage! Can't set CPU frequency\n"); + printf("Error setting up the power controller.\n" + "CPU frequency not set.\n"); + + printf("DRAM:"); + gd->ram_size = sunxi_dram_init(); + printf(" %d MiB\n", (int)(gd->ram_size >> 20)); + if (!gd->ram_size) + hang(); + + sunxi_spl_store_dram_size(gd->ram_size); } #endif @@ -663,7 +665,7 @@ int g_dnl_board_usb_cable_connected(void) struct phy phy; int ret; - ret = uclass_get_device(UCLASS_USB_DEV_GENERIC, 0, &dev); + ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev); if (ret) { pr_err("%s: Cannot find USB device\n", __func__); return ret; diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 13845251af..d67f94ad47 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -70,8 +70,9 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; void do_board_detect(void) { enable_i2c0_pin_mux(); +#ifndef CONFIG_DM_I2C i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); - +#endif if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS)) printf("ti_i2c_eeprom_init failed\n"); @@ -328,8 +329,14 @@ static void scale_vcores_bone(int freq) if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4)) return; +#ifndef CONFIG_DM_I2C if (i2c_probe(TPS65217_CHIP_PM)) return; +#else + if (power_tps65217_init(0)) + return; +#endif + /* * On Beaglebone White we need to ensure we have AC power @@ -421,9 +428,13 @@ void scale_vcores_generic(int freq) * 1.10V. For MPU voltage we need to switch based on * the frequency we are running at. */ +#ifndef CONFIG_DM_I2C if (i2c_probe(TPS65910_CTRL_I2C_ADDR)) return; - +#else + if (power_tps65910_init(0)) + return; +#endif /* * Depending on MPU clock and PG we will need a different * VDD to drive at that speed. @@ -451,8 +462,10 @@ void gpi2c_init(void) if (first_time) { enable_i2c0_pin_mux(); +#ifndef CONFIG_DM_I2C i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); +#endif first_time = false; } } diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c index 41333f93f4..04f4b8e693 100644 --- a/board/ti/am335x/mux.c +++ b/board/ti/am335x/mux.c @@ -329,12 +329,23 @@ static unsigned short detect_daughter_board_profile(void) { unsigned short val; +#ifndef CONFIG_DM_I2C if (i2c_probe(I2C_CPLD_ADDR)) return PROFILE_NONE; if (i2c_read(I2C_CPLD_ADDR, CFG_REG, 1, (unsigned char *)(&val), 2)) return PROFILE_NONE; +#else + struct udevice *dev = NULL; + int rc; + rc = i2c_get_chip_for_busnum(0, I2C_CPLD_ADDR, 1, &dev); + if (rc) + return PROFILE_NONE; + rc = dm_i2c_read(dev, CFG_REG, (unsigned char *)(&val), 2); + if (rc) + return PROFILE_NONE; +#endif return (1 << (val & PROFILE_MASK)); } diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 2a59b06035..31bc0f49a4 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -43,6 +43,8 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; #ifdef CONFIG_TI_I2C_BOARD_DETECT void do_board_detect(void) { + /* Ensure I2C is initialized for EEPROM access*/ + gpi2c_init(); if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS)) printf("ti_i2c_eeprom_init failed\n"); @@ -386,8 +388,13 @@ void scale_vcores_generic(u32 m) { int mpu_vdd, ddr_volt; +#ifndef CONFIG_DM_I2C if (i2c_probe(TPS65218_CHIP_PM)) return; +#else + if (power_tps65218_init(0)) + return; +#endif switch (m) { case 1000: @@ -439,8 +446,13 @@ void scale_vcores_idk(u32 m) { int mpu_vdd; +#ifndef CONFIG_DM_I2C if (i2c_probe(TPS62362_I2C_ADDR)) return; +#else + if (power_tps62362_init(0)) + return; +#endif switch (m) { case 1000: @@ -462,14 +474,12 @@ void scale_vcores_idk(u32 m) puts("Unknown MPU clock, not scaling\n"); return; } - /* Set VDD_MPU voltage */ if (tps62362_voltage_update(TPS62362_SET3, mpu_vdd)) { printf("%s failure\n", __func__); return; } } - void gpi2c_init(void) { /* When needed to be invoked prior to BSS initialization */ @@ -477,8 +487,10 @@ void gpi2c_init(void) if (first_time) { enable_i2c0_pin_mux(); +#ifndef CONFIG_DM_I2C i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); +#endif first_time = false; } } @@ -614,20 +626,32 @@ void sdram_init(void) /* setup board specific PMIC */ int power_init_board(void) { - struct pmic *p; - + int rc; +#ifndef CONFIG_DM_I2C + struct pmic *p = NULL; +#endif if (board_is_idk()) { - power_tps62362_init(I2C_PMIC); + rc = power_tps62362_init(0); + if (rc) + goto done; +#ifndef CONFIG_DM_I2C p = pmic_get("TPS62362"); - if (p && !pmic_probe(p)) - puts("PMIC: TPS62362\n"); + if (!p || pmic_probe(p)) + goto done; +#endif + puts("PMIC: TPS62362\n"); } else { - power_tps65218_init(I2C_PMIC); + rc = power_tps65218_init(0); + if (rc) + goto done; +#ifndef CONFIG_DM_I2C p = pmic_get("TPS65218_PMIC"); - if (p && !pmic_probe(p)) - puts("PMIC: TPS65218\n"); + if (!p || pmic_probe(p)) + goto done; +#endif + puts("PMIC: TPS65218\n"); } - +done: return 0; } diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 177a3246c3..7063345dcc 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -623,7 +623,7 @@ void am57x_idk_lcd_detect(void) { int r = -ENODEV; char *idk_lcd = "no"; - uint8_t buf = 0; + struct udevice *dev; /* Only valid for IDKs */ if (board_is_x15() || board_is_am572x_evm()) @@ -633,32 +633,29 @@ void am57x_idk_lcd_detect(void) if (board_is_am571x_idk() && !am571x_idk_needs_lcd()) goto out; - r = i2c_set_bus_num(OSD_TS_FT_BUS_ADDRESS); - if (r) { - printf("%s: Failed to set bus address to %d: %d\n", - __func__, OSD_TS_FT_BUS_ADDRESS, r); - goto out; - } - r = i2c_probe(OSD_TS_FT_CHIP_ADDRESS); + r = i2c_get_chip_for_busnum(OSD_TS_FT_BUS_ADDRESS, + OSD_TS_FT_CHIP_ADDRESS, 1, &dev); if (r) { + printf("%s: Failed to get I2C device %d/%d (ret %d)\n", + __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, + r); /* AM572x IDK has no explicit settings for optional LCD kit */ - if (board_is_am571x_idk()) { + if (board_is_am571x_idk()) printf("%s: Touch screen detect failed: %d!\n", __func__, r); - } goto out; } /* Read FT ID */ - r = i2c_read(OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, 1, &buf, 1); - if (r) { + r = dm_i2c_reg_read(dev, OSD_TS_FT_REG_ID); + if (r < 0) { printf("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n", __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, r); goto out; } - switch (buf) { + switch (r) { case OSD_TS_FT_ID_5606: idk_lcd = "osd101t2045"; break; @@ -667,7 +664,7 @@ void am57x_idk_lcd_detect(void) break; default: printf("%s: Unidentifed Touch screen ID 0x%02x\n", - __func__, buf); + __func__, r); /* we will let default be "no lcd" */ } out: @@ -675,6 +672,19 @@ out: return; } +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) +static int device_okay(const char *path) +{ + int node; + + node = fdt_path_offset(gd->fdt_blob, path); + if (node < 0) + return 0; + + return fdtdec_get_is_enabled(gd->fdt_blob, node); +} +#endif + int board_late_init(void) { setup_board_eeprom_env(); @@ -714,6 +724,12 @@ int board_late_init(void) board_ti_set_ethaddr(2); #endif +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) + if (device_okay("/ocp/omap_dwc3_1@48880000")) + enable_usb_clocks(0); + if (device_okay("/ocp/omap_dwc3_2@488c0000")) + enable_usb_clocks(1); +#endif return 0; } @@ -864,93 +880,6 @@ int spl_start_uboot(void) } #endif -#ifdef CONFIG_USB_DWC3 -static struct dwc3_device usb_otg_ss2 = { - .maximum_speed = USB_SPEED_HIGH, - .base = DRA7_USB_OTG_SS2_BASE, - .tx_fifo_resize = false, - .index = 1, -}; - -static struct dwc3_omap_device usb_otg_ss2_glue = { - .base = (void *)DRA7_USB_OTG_SS2_GLUE_BASE, - .utmi_mode = DWC3_OMAP_UTMI_MODE_SW, - .index = 1, -}; - -static struct ti_usb_phy_device usb_phy2_device = { - .usb2_phy_power = (void *)DRA7_USB2_PHY2_POWER, - .index = 1, -}; - -int usb_gadget_handle_interrupts(int index) -{ - u32 status; - - status = dwc3_omap_uboot_interrupt_status(index); - if (status) - dwc3_uboot_handle_interrupt(index); - - return 0; -} -#endif /* CONFIG_USB_DWC3 */ - -#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) -int board_usb_init(int index, enum usb_init_type init) -{ - enable_usb_clocks(index); - switch (index) { - case 0: - if (init == USB_INIT_DEVICE) { - printf("port %d can't be used as device\n", index); - disable_usb_clocks(index); - return -EINVAL; - } - break; - case 1: - if (init == USB_INIT_DEVICE) { -#ifdef CONFIG_USB_DWC3 - usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL; - usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID; - ti_usb_phy_uboot_init(&usb_phy2_device); - dwc3_omap_uboot_init(&usb_otg_ss2_glue); - dwc3_uboot_init(&usb_otg_ss2); -#endif - } else { - printf("port %d can't be used as host\n", index); - disable_usb_clocks(index); - return -EINVAL; - } - - break; - default: - printf("Invalid Controller Index\n"); - } - - return 0; -} - -int board_usb_cleanup(int index, enum usb_init_type init) -{ -#ifdef CONFIG_USB_DWC3 - switch (index) { - case 0: - case 1: - if (init == USB_INIT_DEVICE) { - ti_usb_phy_uboot_exit(index); - dwc3_uboot_exit(index); - dwc3_omap_uboot_exit(index); - } - break; - default: - printf("Invalid Controller Index\n"); - } -#endif - disable_usb_clocks(index); - return 0; -} -#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */ - #ifdef CONFIG_DRIVER_TI_CPSW /* Delay value to add to calibrated value */ diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index c475f106b2..e258e22f37 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -14,42 +14,7 @@ #include "board_detect.h" -#if defined(CONFIG_DM_I2C_COMPAT) -/** - * ti_i2c_set_alen - Set chip's i2c address length - * @bus_addr - I2C bus number - * @dev_addr - I2C eeprom id - * @alen - I2C address length in bytes - * - * DM_I2C by default sets the address length to be used to 1. This - * function allows this address length to be changed to match the - * eeprom used for board detection. - */ -int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen) -{ - struct udevice *dev; - struct udevice *bus; - int rc; - - rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus); - if (rc) - return rc; - rc = i2c_get_chip(bus, dev_addr, 1, &dev); - if (rc) - return rc; - rc = i2c_set_chip_offset_len(dev, alen); - if (rc) - return rc; - - return 0; -} -#else -int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen) -{ - return 0; -} -#endif - +#if !defined(CONFIG_DM_I2C) /** * ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device * @i2c_bus: i2c bus number to initialize @@ -82,18 +47,9 @@ static int __maybe_unused ti_i2c_eeprom_init(int i2c_bus, int dev_addr) static int __maybe_unused ti_i2c_eeprom_read(int dev_addr, int offset, uchar *ep, int epsize) { - int bus_num, rc, alen; - - bus_num = i2c_get_bus_num(); - - alen = 2; - - rc = ti_i2c_set_alen(bus_num, dev_addr, alen); - if (rc) - return rc; - - return i2c_read(dev_addr, offset, alen, ep, epsize); + return i2c_read(dev_addr, offset, 2, ep, epsize); } +#endif /** * ti_eeprom_string_cleanup() - Handle eeprom programming errors @@ -122,23 +78,67 @@ __weak void gpi2c_init(void) static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, u32 header, u32 size, uint8_t *ep) { - u32 byte, hdr_read; + u32 hdr_read; int rc; - gpi2c_init(); - rc = ti_i2c_eeprom_init(bus_addr, dev_addr); +#if defined(CONFIG_DM_I2C) + struct udevice *dev; + struct udevice *bus; + + rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus); + if (rc) + return rc; + rc = i2c_get_chip(bus, dev_addr, 1, &dev); if (rc) return rc; /* * Read the header first then only read the other contents. */ - byte = 2; + rc = i2c_set_chip_offset_len(dev, 2); + if (rc) + return rc; + + rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); + if (rc) + return rc; + + /* Corrupted data??? */ + if (hdr_read != header) { + rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); + /* + * read the eeprom header using i2c again, but use only a + * 1 byte address (some legacy boards need this..) + */ + if (rc) { + rc = i2c_set_chip_offset_len(dev, 1); + if (rc) + return rc; + + rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4); + } + if (rc) + return rc; + } + if (hdr_read != header) + return -1; + + rc = dm_i2c_read(dev, 0, ep, size); + if (rc) + return rc; +#else + u32 byte; - rc = ti_i2c_set_alen(bus_addr, dev_addr, byte); + gpi2c_init(); + rc = ti_i2c_eeprom_init(bus_addr, dev_addr); if (rc) return rc; + /* + * Read the header first then only read the other contents. + */ + byte = 2; + rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, 4); if (rc) return rc; @@ -152,10 +152,6 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, */ byte = 1; if (rc) { - rc = ti_i2c_set_alen(bus_addr, dev_addr, byte); - if (rc) - return rc; - rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, 4); } @@ -168,7 +164,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, rc = i2c_read(dev_addr, 0x0, byte, ep, size); if (rc) return rc; - +#endif return 0; } diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index bbe54450ae..d69641e3a0 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -646,6 +646,19 @@ int dram_init_banksize(void) return 0; } +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) +static int device_okay(const char *path) +{ + int node; + + node = fdt_path_offset(gd->fdt_blob, path); + if (node < 0) + return 0; + + return fdtdec_get_is_enabled(gd->fdt_blob, node); +} +#endif + int board_late_init(void) { #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -685,6 +698,12 @@ int board_late_init(void) if (board_is_dra71x_evm()) palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7); #endif +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) + if (device_okay("/ocp/omap_dwc3_1@48880000")) + enable_usb_clocks(0); + if (device_okay("/ocp/omap_dwc3_2@488c0000")) + enable_usb_clocks(1); +#endif return 0; } @@ -896,110 +915,6 @@ const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr) } #endif -#ifdef CONFIG_USB_DWC3 -static struct dwc3_device usb_otg_ss1 = { - .maximum_speed = USB_SPEED_SUPER, - .base = DRA7_USB_OTG_SS1_BASE, - .tx_fifo_resize = false, - .index = 0, -}; - -static struct dwc3_omap_device usb_otg_ss1_glue = { - .base = (void *)DRA7_USB_OTG_SS1_GLUE_BASE, - .utmi_mode = DWC3_OMAP_UTMI_MODE_SW, - .index = 0, -}; - -static struct ti_usb_phy_device usb_phy1_device = { - .pll_ctrl_base = (void *)DRA7_USB3_PHY1_PLL_CTRL, - .usb2_phy_power = (void *)DRA7_USB2_PHY1_POWER, - .usb3_phy_power = (void *)DRA7_USB3_PHY1_POWER, - .index = 0, -}; - -static struct dwc3_device usb_otg_ss2 = { - .maximum_speed = USB_SPEED_SUPER, - .base = DRA7_USB_OTG_SS2_BASE, - .tx_fifo_resize = false, - .index = 1, -}; - -static struct dwc3_omap_device usb_otg_ss2_glue = { - .base = (void *)DRA7_USB_OTG_SS2_GLUE_BASE, - .utmi_mode = DWC3_OMAP_UTMI_MODE_SW, - .index = 1, -}; - -static struct ti_usb_phy_device usb_phy2_device = { - .usb2_phy_power = (void *)DRA7_USB2_PHY2_POWER, - .index = 1, -}; - -int board_usb_init(int index, enum usb_init_type init) -{ - enable_usb_clocks(index); - switch (index) { - case 0: - if (init == USB_INIT_DEVICE) { - usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL; - usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID; - } else { - usb_otg_ss1.dr_mode = USB_DR_MODE_HOST; - usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_ID_GROUND; - } - - ti_usb_phy_uboot_init(&usb_phy1_device); - dwc3_omap_uboot_init(&usb_otg_ss1_glue); - dwc3_uboot_init(&usb_otg_ss1); - break; - case 1: - if (init == USB_INIT_DEVICE) { - usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL; - usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID; - } else { - usb_otg_ss2.dr_mode = USB_DR_MODE_HOST; - usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_ID_GROUND; - } - - ti_usb_phy_uboot_init(&usb_phy2_device); - dwc3_omap_uboot_init(&usb_otg_ss2_glue); - dwc3_uboot_init(&usb_otg_ss2); - break; - default: - printf("Invalid Controller Index\n"); - } - - return 0; -} - -int board_usb_cleanup(int index, enum usb_init_type init) -{ - switch (index) { - case 0: - case 1: - ti_usb_phy_uboot_exit(index); - dwc3_uboot_exit(index); - dwc3_omap_uboot_exit(index); - break; - default: - printf("Invalid Controller Index\n"); - } - disable_usb_clocks(index); - return 0; -} - -int usb_gadget_handle_interrupts(int index) -{ - u32 status; - - status = dwc3_omap_uboot_interrupt_status(index); - if (status) - dwc3_uboot_handle_interrupt(index); - - return 0; -} -#endif - #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT) int spl_start_uboot(void) { diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c index 72709c0e41..3e06800608 100644 --- a/board/ti/ks2_evm/board.c +++ b/board/ti/ks2_evm/board.c @@ -59,6 +59,11 @@ int dram_init(void) return 0; } +struct image_header *spl_get_load_buffer(ssize_t offset, size_t size) +{ + return (struct image_header *)(CONFIG_SYS_TEXT_BASE); +} + int board_init(void) { gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c index 87dc4d009e..39a782e479 100644 --- a/board/ti/ks2_evm/board_k2g.c +++ b/board/ti/ks2_evm/board_k2g.c @@ -251,6 +251,7 @@ int board_fit_config_name_match(const char *name) #if defined(CONFIG_DTB_RESELECT) static int k2g_alt_board_detect(void) { +#ifndef CONFIG_DM_I2C int rc; rc = i2c_set_bus_num(1); @@ -260,7 +261,17 @@ static int k2g_alt_board_detect(void) rc = i2c_probe(K2G_GP_AUDIO_CODEC_ADDRESS); if (rc) return rc; +#else + struct udevice *bus, *dev; + int rc; + rc = uclass_get_device_by_seq(UCLASS_I2C, 1, &bus); + if (rc) + return rc; + rc = dm_i2c_probe(bus, K2G_GP_AUDIO_CODEC_ADDRESS, 0, &dev); + if (rc) + return rc; +#endif ti_i2c_eeprom_am_set("66AK2GGP", "1.0X"); return 0; diff --git a/board/vamrs/rock960_rk3399/Kconfig b/board/vamrs/rock960_rk3399/Kconfig new file mode 100644 index 0000000000..cacc53f378 --- /dev/null +++ b/board/vamrs/rock960_rk3399/Kconfig @@ -0,0 +1,15 @@ +if TARGET_ROCK960_RK3399 + +config SYS_BOARD + default "rock960_rk3399" + +config SYS_VENDOR + default "vamrs" + +config SYS_CONFIG_NAME + default "rock960_rk3399" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif diff --git a/board/vamrs/rock960_rk3399/MAINTAINERS b/board/vamrs/rock960_rk3399/MAINTAINERS new file mode 100644 index 0000000000..22b2db925a --- /dev/null +++ b/board/vamrs/rock960_rk3399/MAINTAINERS @@ -0,0 +1,11 @@ +ROCK960-RK3399 +M: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org +S: Maintained +F: board/rockchip/rock960_rk3399 +F: include/configs/rock960_rk3399.h +F: configs/rock960-rk3399_defconfig + +FICUS EE +M: Manivannan Sadhasivam manivannan.sadhasivam@linaro.org +S: Maintained +F: configs/ficus-rk3399_defconfig diff --git a/board/vamrs/rock960_rk3399/Makefile b/board/vamrs/rock960_rk3399/Makefile new file mode 100644 index 0000000000..6c3e475b3a --- /dev/null +++ b/board/vamrs/rock960_rk3399/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> +# + +obj-y += rock960-rk3399.o diff --git a/board/vamrs/rock960_rk3399/README b/board/vamrs/rock960_rk3399/README new file mode 100644 index 0000000000..d14399090e --- /dev/null +++ b/board/vamrs/rock960_rk3399/README @@ -0,0 +1,152 @@ +Contents +======== + +1. Introduction +2. Get the Source and prebuild binary +3. Compile the U-Boot +4. Compile the rkdeveloptool +5. Package the image + 5.1. Package the image for U-Boot SPL(option 1) + 5.2. Package the image for Rockchip miniloader(option 2) +6. Bootloader storage options +7. Flash the image to eMMC + 7.1. Flash the image with U-Boot SPL(option 1) + 7.2. Flash the image with Rockchip miniloader(option 2) +8. Create a bootable SD/MMC +9. And that is it + +Introduction +============ + +Rock960 board family consists of Rock960 (Consumer Edition) and +Ficus (Enterprise Edition) 96Boards featuring Rockchip RK3399 SoC. + +Common features implemented on both boards: + * CPU: ARMv8 64bit Big-Little architecture, + * Big: dual-core Cortex-A72 + * Little: quad-core Cortex-A53 + * IRAM: 200KB + * eMMC: 16/32GB eMMC 5.1 + * PMU: RK808 + * SD/MMC + * Display: HDMI/DP/MIPI + * Low Speed Expansion Connector + * High Speed Expansion Connector + +Additional features of Rock960: + * DRAM: 2GB/4GB LPDDR3 @ 1866MHz + * 1x USB 3.0 type A, 1x USB 2.0 type A (host mode only), + 1x USB 3.0 type C OTG + +Additional features of Ficus: + * DRAM: 2GB/4GB DDR3 @ 1600MHz + * Ethernet + * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only), + 1x USB 3.0 type C OTG + +Here is the step-by-step to boot to U-Boot on Rock960 boards. + +Get the Source and prebuild binary +================================== + + > git clone https://github.com/96rocks/rkbin.git + > git clone https://github.com/rockchip-linux/rkdeveloptool.git + +Compile the U-Boot +================== + + > cd ../u-boot + > cp ../rkbin/rk33/rk3399_bl31_v1.00.elf ./bl31.elf + > export ARCH=arm64 + > export CROSS_COMPILE=aarch64-linux-gnu- + > make rock960-rk3399_defconfig + > make + > make u-boot.itb + +Compile the rkdeveloptool +========================= + +Follow instructions in latest README + > cd ../rkdeveloptool + > autoreconf -i + > ./configure + > make + > sudo make install + +Package the image +================= + +Package the image for U-Boot SPL(option 1) +-------------------------------- + > cd .. + > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin idbspl.img + + Get idbspl.img in this step. + +Package the image for Rockchip miniloader(option 2) +------------------------------------------ + > cd ../rkbin + > ./tools/loaderimage --pack --uboot u-boot/u-boot-dtb.bin uboot.img 0x200000 + + > ../u-boot/tools/mkimage -n rk3399 -T rksd -d rk3399_ddr_933MHz_v1.08.bin idbloader.img + > cat ./rk33/rk3399_miniloader_v1.06.bin >> idbloader.img + + Get uboot.img and idbloader.img in this step. + +Bootloader storage options +========================== + +There are a few different storage options for the bootloader. +This document explores two of these: eMMC and removable SD/MMC. + +Flash the image to eMMC +======================= + +Flash the image with U-Boot SPL(option 1) +------------------------------- +Power on(or reset with RESET KEY) with MASKROM KEY preesed, and then: + > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin + > rkdeveloptool wl 64 u-boot/idbspl.img + > rkdeveloptool wl 0x4000 u-boot/u-boot.itb + > rkdeveloptool rd + +Flash the image with Rockchip miniloader(option 2) +---------------------------------------- +Power on(or reset with RESET KEY) with MASKROM KEY preesed, and then: + > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin + > rkdeveloptool wl 0x40 idbloader.img + > rkdeveloptool wl 0x4000 uboot.img + > rkdeveloptool wl 0x6000 ./img/rk3399/trust.img + > rkdeveloptool rd + +Create a bootable SD/MMC +======================== + +The idbspl.img contains the first stage, and the u-boot.img the second stage. +As explained in the Rockchip partition table reference [1], the first stage +(aka loader1) start sector is 64, and the second stage start sector is 16384. + +Each sector is 512 bytes, which means the first stage offset is 32 KiB, +and the second stage offset is 8 MiB. + +Note: the second stage location is actually not as per the spec, +but defined by the SPL. Mainline SPL defines an 8 MiB offset for the second +stage. + +Assuming the SD card is exposed by device /dev/mmcblk0, the commands +to write the two stages are: + + > dd if=idbspl.img of=/dev/mmcblk0 bs=1k seek=32 + > dd if=u-boot.itb of=/dev/mmcblk0 bs=1k seek=8192 + +Setting up the kernel and rootfs is beyond the scope of this document. + +And that is it +============== + +You should be able to get U-Boot log in console/UART2(baurdrate 1500000) + +For more detail, please reference [2]. + +[1] http://opensource.rock-chips.com/wiki_Partitions +[2] http://opensource.rock-chips.com/wiki_Boot_option diff --git a/board/vamrs/rock960_rk3399/rock960-rk3399.c b/board/vamrs/rock960_rk3399/rock960-rk3399.c new file mode 100644 index 0000000000..d3775b2219 --- /dev/null +++ b/board/vamrs/rock960_rk3399/rock960-rk3399.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> + */ + +#include <common.h> +#include <dm.h> +#include <dm/pinctrl.h> +#include <dm/uclass-internal.h> +#include <asm/arch/periph.h> +#include <power/regulator.h> +#include <spl.h> + +int board_init(void) +{ + int ret; + + ret = regulators_enable_boot_on(false); + if (ret) + debug("%s: Cannot enable boot on regulator\n", __func__); + + return 0; +} + +void spl_board_init(void) +{ + struct udevice *pinctrl; + int ret; + + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); + if (ret) { + debug("%s: Cannot find pinctrl device\n", __func__); + goto err; + } + + /* Enable debug UART */ + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG); + if (ret) { + debug("%s: Failed to set up console UART\n", __func__); + goto err; + } + + preloader_console_init(); + return; +err: + printf("%s: Error %d\n", __func__, ret); + + /* No way to report error here */ + hang(); +} |