From: akash Date: Wed, 14 Nov 2018 12:52:07 +0530 Subject: [U-Boot] [PATCH] board: rockchip: rk3399: add Rockpro64 board support In-Reply-To: <084761ab-4e41-60fd-8638-12f4cf3d6f8a@suse.de> References: <20181103112826.5012-1-akash@openedev.com> <084761ab-4e41-60fd-8638-12f4cf3d6f8a@suse.de> Message-ID: <7554d53f-312d-73b8-781e-f662138fbd5e@openedev.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de 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 suppo= rt for >> Rockpro64. complete board support will be added later in upcoming patchs= ets. >> >> Signed-off-by: Akash Gajjar >> --- > [...] > >> diff --git a/board/rockchip/rockpro64/rockpro64.c b/board/rockchip/rockp= ro64/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 > 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 >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +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=C2=A0 evb rk3399 bsp support for reference. will add only necessary support in v2 patch-sets and submit in couple of=20 days. > > Alex > >> + * not get periph_id by pinctrl framework, so let's init them here. >> + * The PWM2 and PWM3 are for pwm regulater. >> + */ >> + ret =3D 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 =3D pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0); >> + if (ret) { >> + debug("%s PWM0 pinctrl init fail! (ret=3D%d)\n", __func__, ret); >> + goto out; >> + } >> + >> + ret =3D pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2); >> + if (ret) { >> + debug("%s PWM2 pinctrl init fail!\n", __func__); >> + goto out; >> + } >> + >> + ret =3D pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3); >> + if (ret) { >> + debug("%s PWM3 pinctrl init fail!\n", __func__); >> + goto out; >> + } >> + >> + ret =3D regulators_enable_boot_on(false); >> + if (ret) >> + debug("%s: Cannot enable boot on regulator\n", __func__); >> + >> + ret =3D regulator_get_by_platname("vcc5v0_host", ®ulator); >> + if (ret) { >> + debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret); >> + goto out; >> + } >> + >> + ret =3D 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 =3D uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); >> + if (ret) { >> + debug("%s: Cannot find pinctrl device\n", __func__); >> + goto err; >> + } >> + >> + /* Enable debug UART */ >> + ret =3D 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-rk33= 99_defconfig >> new file mode 100644 >> index 0000000000..88422f2db4 >> --- /dev/null >> +++ b/configs/rockpro64-rk3399_defconfig >> @@ -0,0 +1,78 @@ >> +CONFIG_ARM=3Dy >> +CONFIG_ARCH_ROCKCHIP=3Dy >> +CONFIG_SYS_TEXT_BASE=3D0x00200000 >> +CONFIG_SPL_LIBCOMMON_SUPPORT=3Dy >> +CONFIG_SPL_LIBGENERIC_SUPPORT=3Dy >> +CONFIG_SYS_MALLOC_F_LEN=3D0x4000 >> +CONFIG_ROCKCHIP_RK3399=3Dy >> +CONFIG_TARGET_ROCKPRO64_RK3399=3Dy >> +CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=3D0x4000 >> +CONFIG_DEBUG_UART_BASE=3D0xFF1A0000 >> +CONFIG_DEBUG_UART_CLOCK=3D24000000 >> +CONFIG_SPL_STACK_R_ADDR=3D0x80000 >> +CONFIG_DEBUG_UART=3Dy >> +CONFIG_NR_DRAM_BANKS=3D1 >> +CONFIG_FIT=3Dy >> +CONFIG_SPL_LOAD_FIT=3Dy >> +CONFIG_SPL_FIT_GENERATOR=3D"arch/arm/mach-rockchip/make_fit_atf.py" >> +CONFIG_DEFAULT_FDT_FILE=3D"rockchip/rk3399-rockpro64.dtb" >> +# CONFIG_DISPLAY_CPUINFO is not set >> +CONFIG_DISPLAY_BOARDINFO_LATE=3Dy >> +CONFIG_SPL_STACK_R=3Dy >> +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=3D0x4000 >> +CONFIG_SPL_ATF=3Dy >> +CONFIG_SPL_ATF_NO_PLATFORM_PARAM=3Dy >> +CONFIG_CMD_BOOTZ=3Dy >> +CONFIG_CMD_GPT=3Dy >> +CONFIG_CMD_MMC=3Dy >> +CONFIG_CMD_SF=3Dy >> +CONFIG_CMD_USB=3Dy >> +# CONFIG_CMD_SETEXPR is not set >> +CONFIG_CMD_TIME=3Dy >> +CONFIG_SPL_OF_CONTROL=3Dy >> +CONFIG_DEFAULT_DEVICE_TREE=3D"rk3399-rockpro64" >> +CONFIG_OF_SPL_REMOVE_PROPS=3D"pinctrl-0 pinctrl-names clock-names inter= rupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" >> +CONFIG_ENV_IS_IN_MMC=3Dy >> +CONFIG_REGMAP=3Dy >> +CONFIG_SPL_REGMAP=3Dy >> +CONFIG_SYSCON=3Dy >> +CONFIG_SPL_SYSCON=3Dy >> +CONFIG_CLK=3Dy >> +CONFIG_SPL_CLK=3Dy >> +CONFIG_ROCKCHIP_GPIO=3Dy >> +CONFIG_SYS_I2C_ROCKCHIP=3Dy >> +CONFIG_MMC_DW=3Dy >> +CONFIG_MMC_DW_ROCKCHIP=3Dy >> +CONFIG_MMC_SDHCI=3Dy >> +CONFIG_MMC_SDHCI_ROCKCHIP=3Dy >> +CONFIG_DM_ETH=3Dy >> +CONFIG_ETH_DESIGNWARE=3Dy >> +CONFIG_GMAC_ROCKCHIP=3Dy >> +CONFIG_PINCTRL=3Dy >> +CONFIG_SPL_PINCTRL=3Dy >> +CONFIG_PINCTRL_ROCKCHIP_RK3399=3Dy >> +CONFIG_DM_PMIC=3Dy >> +CONFIG_PMIC_RK8XX=3Dy >> +CONFIG_REGULATOR_PWM=3Dy >> +CONFIG_DM_REGULATOR_FIXED=3Dy >> +CONFIG_REGULATOR_RK8XX=3Dy >> +CONFIG_PWM_ROCKCHIP=3Dy >> +CONFIG_RAM=3Dy >> +CONFIG_SPL_RAM=3Dy >> +CONFIG_BAUDRATE=3D1500000 >> +CONFIG_DEBUG_UART_SHIFT=3D2 >> +CONFIG_SYSRESET=3Dy >> +CONFIG_USB=3Dy >> +CONFIG_USB_XHCI_HCD=3Dy >> +CONFIG_USB_XHCI_DWC3=3Dy >> +CONFIG_USB_EHCI_HCD=3Dy >> +CONFIG_USB_EHCI_GENERIC=3Dy >> +CONFIG_USB_STORAGE=3Dy >> +CONFIG_USB_HOST_ETHER=3Dy >> +CONFIG_USB_ETHER_ASIX=3Dy >> +CONFIG_USB_ETHER_ASIX88179=3Dy >> +CONFIG_USB_ETHER_MCS7830=3Dy >> +CONFIG_USB_ETHER_RTL8152=3Dy >> +CONFIG_USB_ETHER_SMSC95XX=3Dy >> +CONFIG_USE_TINY_PRINTF=3Dy >> +CONFIG_ERRNO_STR=3Dy >> 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 >> + */ >> + >> +#ifndef __ROCKPRO64_RK3399_H >> +#define __ROCKPRO64_RK3399_H >> + >> +#include >> + >> +#define CONFIG_SYS_MMC_ENV_DEV 1 >> + >> +#define SDRAM_BANK_SIZE (2UL << 30) >> + >> +#endif >>