[U-Boot] [PATCH] board: rockchip: rk3399: add Rockpro64 board support

akash akash at openedev.com
Wed Nov 14 07:22:07 UTC 2018


Hi Alexander Graf,

On 11/14/2018 1:17 AM, Alexander Graf wrote:
>
> On 03.11.18 12:28, Akash Gajjar wrote:
>> Rockpro64 is rk3399 based board from pine64.org. add initial board support for
>> Rockpro64. complete board support will be added later in upcoming patchsets.
>>
>> Signed-off-by: Akash Gajjar <akash at openedev.com>
>> ---
> [...]
>
>> diff --git a/board/rockchip/rockpro64/rockpro64.c b/board/rockchip/rockpro64/rockpro64.c
>> new file mode 100644
>> index 0000000000..74c7a56bd5
>> --- /dev/null
>> +++ b/board/rockchip/rockpro64/rockpro64.c
>> @@ -0,0 +1,94 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * (C) Copyright 2018 Akash Gajjar <akash at openedev.com>
> Given the file is copied from another copyrighted file, you can not just
> go and replace the (c) with yours.
Thanks for correction, will add original copyrights.
>> + */
>> +
>> +#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)
>> +{
>> +	struct udevice *pinctrl, *regulator;
>> +	int ret;
>> +
>> +	/*
>> +	 * The PWM do not have decicated interrupt number in dts and can
> dedicated?
>
> This whole file seems to just be a copy of
> board/rockchip/evb_rk3399/evb-rk3399.c. Maybe you can abstract and share
> code?
>
> But please double check if what they do is actually necessary on
> RockPro64 first.

yes, we have takenĀ  evb rk3399 bsp support for reference.

will add only necessary support in v2 patch-sets and submit in couple of 
days.

>
> Alex
>
>> +	 * not get periph_id by pinctrl framework, so let's init them here.
>> +	 * The PWM2 and PWM3 are for pwm regulater.
>> +	 */
>> +	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
>> +	if (ret) {
>> +		debug("%s: Cannot find pinctrl device\n", __func__);
>> +		goto out;
>> +	}
>> +
>> +	/* Enable pwm0 for panel backlight */
>> +	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0);
>> +	if (ret) {
>> +		debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__, ret);
>> +		goto out;
>> +	}
>> +
>> +	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
>> +	if (ret) {
>> +		debug("%s PWM2 pinctrl init fail!\n", __func__);
>> +		goto out;
>> +	}
>> +
>> +	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
>> +	if (ret) {
>> +		debug("%s PWM3 pinctrl init fail!\n", __func__);
>> +		goto out;
>> +	}
>> +
>> +	ret = regulators_enable_boot_on(false);
>> +	if (ret)
>> +		debug("%s: Cannot enable boot on regulator\n", __func__);
>> +
>> +	ret = regulator_get_by_platname("vcc5v0_host", &regulator);
>> +	if (ret) {
>> +		debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
>> +		goto out;
>> +	}
>> +
>> +	ret = regulator_set_enable(regulator, true);
>> +	if (ret) {
>> +		debug("%s vcc5v0-host-en set fail!\n", __func__);
>> +		goto out;
>> +	}
>> +
>> +out:
>> +	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();
>> +}
>> diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
>> new file mode 100644
>> index 0000000000..88422f2db4
>> --- /dev/null
>> +++ b/configs/rockpro64-rk3399_defconfig
>> @@ -0,0 +1,78 @@
>> +CONFIG_ARM=y
>> +CONFIG_ARCH_ROCKCHIP=y
>> +CONFIG_SYS_TEXT_BASE=0x00200000
>> +CONFIG_SPL_LIBCOMMON_SUPPORT=y
>> +CONFIG_SPL_LIBGENERIC_SUPPORT=y
>> +CONFIG_SYS_MALLOC_F_LEN=0x4000
>> +CONFIG_ROCKCHIP_RK3399=y
>> +CONFIG_TARGET_ROCKPRO64_RK3399=y
>> +CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
>> +CONFIG_DEBUG_UART_BASE=0xFF1A0000
>> +CONFIG_DEBUG_UART_CLOCK=24000000
>> +CONFIG_SPL_STACK_R_ADDR=0x80000
>> +CONFIG_DEBUG_UART=y
>> +CONFIG_NR_DRAM_BANKS=1
>> +CONFIG_FIT=y
>> +CONFIG_SPL_LOAD_FIT=y
>> +CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
>> +CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb"
>> +# CONFIG_DISPLAY_CPUINFO is not set
>> +CONFIG_DISPLAY_BOARDINFO_LATE=y
>> +CONFIG_SPL_STACK_R=y
>> +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
>> +CONFIG_SPL_ATF=y
>> +CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
>> +CONFIG_CMD_BOOTZ=y
>> +CONFIG_CMD_GPT=y
>> +CONFIG_CMD_MMC=y
>> +CONFIG_CMD_SF=y
>> +CONFIG_CMD_USB=y
>> +# CONFIG_CMD_SETEXPR is not set
>> +CONFIG_CMD_TIME=y
>> +CONFIG_SPL_OF_CONTROL=y
>> +CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64"
>> +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
>> +CONFIG_ENV_IS_IN_MMC=y
>> +CONFIG_REGMAP=y
>> +CONFIG_SPL_REGMAP=y
>> +CONFIG_SYSCON=y
>> +CONFIG_SPL_SYSCON=y
>> +CONFIG_CLK=y
>> +CONFIG_SPL_CLK=y
>> +CONFIG_ROCKCHIP_GPIO=y
>> +CONFIG_SYS_I2C_ROCKCHIP=y
>> +CONFIG_MMC_DW=y
>> +CONFIG_MMC_DW_ROCKCHIP=y
>> +CONFIG_MMC_SDHCI=y
>> +CONFIG_MMC_SDHCI_ROCKCHIP=y
>> +CONFIG_DM_ETH=y
>> +CONFIG_ETH_DESIGNWARE=y
>> +CONFIG_GMAC_ROCKCHIP=y
>> +CONFIG_PINCTRL=y
>> +CONFIG_SPL_PINCTRL=y
>> +CONFIG_PINCTRL_ROCKCHIP_RK3399=y
>> +CONFIG_DM_PMIC=y
>> +CONFIG_PMIC_RK8XX=y
>> +CONFIG_REGULATOR_PWM=y
>> +CONFIG_DM_REGULATOR_FIXED=y
>> +CONFIG_REGULATOR_RK8XX=y
>> +CONFIG_PWM_ROCKCHIP=y
>> +CONFIG_RAM=y
>> +CONFIG_SPL_RAM=y
>> +CONFIG_BAUDRATE=1500000
>> +CONFIG_DEBUG_UART_SHIFT=2
>> +CONFIG_SYSRESET=y
>> +CONFIG_USB=y
>> +CONFIG_USB_XHCI_HCD=y
>> +CONFIG_USB_XHCI_DWC3=y
>> +CONFIG_USB_EHCI_HCD=y
>> +CONFIG_USB_EHCI_GENERIC=y
>> +CONFIG_USB_STORAGE=y
>> +CONFIG_USB_HOST_ETHER=y
>> +CONFIG_USB_ETHER_ASIX=y
>> +CONFIG_USB_ETHER_ASIX88179=y
>> +CONFIG_USB_ETHER_MCS7830=y
>> +CONFIG_USB_ETHER_RTL8152=y
>> +CONFIG_USB_ETHER_SMSC95XX=y
>> +CONFIG_USE_TINY_PRINTF=y
>> +CONFIG_ERRNO_STR=y
>> diff --git a/include/configs/rockpro64.h b/include/configs/rockpro64.h
>> new file mode 100644
>> index 0000000000..1a7e850c94
>> --- /dev/null
>> +++ b/include/configs/rockpro64.h
>> @@ -0,0 +1,15 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * (C) Copyright 2018 Akash Gajjar <akash at openedev.com>
>> + */
>> +
>> +#ifndef __ROCKPRO64_RK3399_H
>> +#define __ROCKPRO64_RK3399_H
>> +
>> +#include <configs/rk3399_common.h>
>> +
>> +#define CONFIG_SYS_MMC_ENV_DEV 1
>> +
>> +#define SDRAM_BANK_SIZE			(2UL << 30)
>> +
>> +#endif
>>


More information about the U-Boot mailing list