Add support for RK3308 SOC
Subsystems (5)
v2 cover Add support for RK3308 SOC
RK3308 is a quad Cortex A35 based SOC with rich audio interfaces(I2S/PCM/TDM/PDM/SPDIF/VAD/HDMI ARC), which designed for intelligent voice interaction and audio input/output processing.
This path set add basic support for it, test with a emmc board.
More boards support such as Firefly ROC-RK3308-CC will coming soon.
Changes in v2:
- Add board ROC-rk3308-CC
- Update doc/README.rockchip
Andy Yan (8):
arm: rockchip: Add RK3308 SOC support
arm: dts: rockchip: Add dts for rk3308 evb
board: rockchip: Add rk3308 evb support
rockchip: rk3308: Add sdram driver
rockchip: mkimage: add support for RK3308
rockchip: rk3308: Add dts for ROC-RK3308-CC
rockchip: rk3308: Add support for ROC-RK3308-CC board
doc: rockchip: Add documentation for rk3308 based boards
Finley Xiao (1):
rockchip: clk: Add clk driver for rk3308
arch/arm/dts/Makefile | 4 + arch/arm/dts/rk3308-evb-u-boot.dtsi | 17 + arch/arm/dts/rk3308-evb.dts | 230 +++ arch/arm/dts/rk3308-roc-cc-u-boot.dtsi | 17 + arch/arm/dts/rk3308-roc-cc.dts | 190 ++ arch/arm/dts/rk3308-u-boot.dtsi | 25 + arch/arm/dts/rk3308.dtsi | 1829 +++++++++++++++++ arch/arm/include/asm/arch-rk3308/boot0.h | 11 + arch/arm/include/asm/arch-rk3308/cru_rk3308.h | 290 +++ arch/arm/include/asm/arch-rk3308/gpio.h | 11 + arch/arm/include/asm/arch-rk3308/grf_rk3308.h | 197 ++ arch/arm/mach-rockchip/Kconfig | 24 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3308/Kconfig | 27 + arch/arm/mach-rockchip/rk3308/Makefile | 9 + arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 31 + arch/arm/mach-rockchip/rk3308/rk3308.c | 175 ++ arch/arm/mach-rockchip/rk3308/syscon_rk3308.c | 20 + board/firefly/firefly-rk3308/Kconfig | 15 + board/firefly/firefly-rk3308/MAINTAINERS | 5 + board/firefly/firefly-rk3308/Makefile | 7 + board/firefly/firefly-rk3308/roc_rk3308_cc.c | 82 + board/rockchip/evb_rk3308/Kconfig | 15 + board/rockchip/evb_rk3308/MAINTAINERS | 6 + board/rockchip/evb_rk3308/Makefile | 7 + board/rockchip/evb_rk3308/evb_rk3308.c | 44 + configs/evb-rk3308_defconfig | 77 + configs/roc-rk3308-cc_defconfig | 77 + doc/README.rockchip | 20 +- drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3308.c | 1078 ++++++++++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3308.c | 55 + include/configs/evb_rk3308.h | 20 + include/configs/rk3308_common.h | 58 + include/dt-bindings/clock/rk3308-cru.h | 387 ++++ tools/rkcommon.c | 1 + 37 files changed, 5063 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/rk3308-evb-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-evb.dts create mode 100644 arch/arm/dts/rk3308-roc-cc-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-roc-cc.dts create mode 100644 arch/arm/dts/rk3308-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308.dtsi create mode 100644 arch/arm/include/asm/arch-rk3308/boot0.h create mode 100644 arch/arm/include/asm/arch-rk3308/cru_rk3308.h create mode 100644 arch/arm/include/asm/arch-rk3308/gpio.h create mode 100644 arch/arm/include/asm/arch-rk3308/grf_rk3308.h create mode 100644 arch/arm/mach-rockchip/rk3308/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3308/Makefile create mode 100644 arch/arm/mach-rockchip/rk3308/clk_rk3308.c create mode 100644 arch/arm/mach-rockchip/rk3308/rk3308.c create mode 100644 arch/arm/mach-rockchip/rk3308/syscon_rk3308.c create mode 100644 board/firefly/firefly-rk3308/Kconfig create mode 100644 board/firefly/firefly-rk3308/MAINTAINERS create mode 100644 board/firefly/firefly-rk3308/Makefile create mode 100644 board/firefly/firefly-rk3308/roc_rk3308_cc.c create mode 100644 board/rockchip/evb_rk3308/Kconfig create mode 100644 board/rockchip/evb_rk3308/MAINTAINERS create mode 100644 board/rockchip/evb_rk3308/Makefile create mode 100644 board/rockchip/evb_rk3308/evb_rk3308.c create mode 100644 configs/evb-rk3308_defconfig create mode 100644 configs/roc-rk3308-cc_defconfig create mode 100644 drivers/clk/rockchip/clk_rk3308.c create mode 100644 drivers/ram/rockchip/sdram_rk3308.c create mode 100644 include/configs/evb_rk3308.h create mode 100644 include/configs/rk3308_common.h create mode 100644 include/dt-bindings/clock/rk3308-cru.h
Signature · 1 line
2.17.1
PATCH v2 1/9 arm: rockchip: Add RK3308 SOC support
RK3308 is a quad Cortex A35 based SOC with rich audio interfaces(I2S/PCM/TDM/PDM/SPDIF/VAD/HDMI ARC), which designed for intelligent voice interaction and audio input/output processing.
---
Changes in v2: None
arch/arm/include/asm/arch-rk3308/boot0.h | 11 + arch/arm/include/asm/arch-rk3308/cru_rk3308.h | 290 ++++++++++++++++++ arch/arm/include/asm/arch-rk3308/gpio.h | 11 + arch/arm/include/asm/arch-rk3308/grf_rk3308.h | 197 ++++++++++++ arch/arm/mach-rockchip/Kconfig | 24 ++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3308/Kconfig | 14 + arch/arm/mach-rockchip/rk3308/Makefile | 9 + arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 31 ++ arch/arm/mach-rockchip/rk3308/rk3308.c | 175 +++++++++++ arch/arm/mach-rockchip/rk3308/syscon_rk3308.c | 20 ++ include/configs/rk3308_common.h | 58 ++++ 12 files changed, 841 insertions(+) create mode 100644 arch/arm/include/asm/arch-rk3308/boot0.h create mode 100644 arch/arm/include/asm/arch-rk3308/cru_rk3308.h create mode 100644 arch/arm/include/asm/arch-rk3308/gpio.h create mode 100644 arch/arm/include/asm/arch-rk3308/grf_rk3308.h create mode 100644 arch/arm/mach-rockchip/rk3308/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3308/Makefile create mode 100644 arch/arm/mach-rockchip/rk3308/clk_rk3308.c create mode 100644 arch/arm/mach-rockchip/rk3308/rk3308.c create mode 100644 arch/arm/mach-rockchip/rk3308/syscon_rk3308.c create mode 100644 include/configs/rk3308_common.h
arch/arm/include/asm/arch-rk3308/boot0.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#ifndef __ASM_ARCH_BOOT0_H__ +#define __ASM_ARCH_BOOT0_H__ + +#include <asm/arch-rockchip/boot0.h> + +#endif
arch/arm/include/asm/arch-rk3308/cru_rk3308.h new file +290 -0
290 lines not on this page · raw message
arch/arm/include/asm/arch-rk3308/gpio.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#ifndef __ASM_ARCH_GPIO_H__ +#define __ASM_ARCH_GPIO_H__ + +#include <asm/arch-rockchip/gpio.h> + +#endif
arch/arm/include/asm/arch-rk3308/grf_rk3308.h new file +197 -0
197 lines not on this page · raw message
arch/arm/mach-rockchip/Kconfig +24 -0
@@ -105,6 +105,29 @@ config ROCKCHIP_RK3288 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UARTs, SPI, I2C and PWMs. +config ROCKCHIP_RK3308 + bool "Support Rockchip RK3308" + select ARM64 + select DEBUG_UART_BOARD_INIT + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select SPL_ATF + select SPL_ATF_NO_PLATFORM_PARAM + select SPL_LOAD_FIT + imply ROCKCHIP_COMMON_BOARD + imply SPL_ROCKCHIP_COMMON_BOARD + imply SPL_CLK + imply SPL_REGMAP + imply SPL_SYSCON + imply SPL_RAM + imply SPL_SERIAL_SUPPORT + imply TPL_SERIAL_SUPPORT + imply SPL_SEPARATE_BSS + help + The Rockchip RK3308 is a ARM-based Soc which embedded with quad + Cortex-A35 and highly integrated audio interfaces. + config ROCKCHIP_RK3328 bool "Support Rockchip RK3328" select ARM64
@@ -320,6 +343,7 @@ source "arch/arm/mach-rockchip/rk3128/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk322x/Kconfig" source "arch/arm/mach-rockchip/rk3288/Kconfig" +source "arch/arm/mach-rockchip/rk3308/Kconfig" source "arch/arm/mach-rockchip/rk3328/Kconfig" source "arch/arm/mach-rockchip/rk3368/Kconfig" source "arch/arm/mach-rockchip/rk3399/Kconfig"
arch/arm/mach-rockchip/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ +obj-$(CONFIG_ROCKCHIP_RK3308) += rk3308/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ obj-$(CONFIG_ROCKCHIP_RK3368) += rk3368/ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/
arch/arm/mach-rockchip/rk3308/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +if ROCKCHIP_RK3308 + +config SYS_SOC + default "rk3308" + +config SYS_MALLOC_F_LEN + default 0x400 + +config SPL_SERIAL_SUPPORT + default y + +config ROCKCHIP_BOOT_MODE_REG + default 0xff000500 +endif
arch/arm/mach-rockchip/rk3308/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += syscon_rk3308.o +obj-y += rk3308.o +obj-y += clk_rk3308.o
arch/arm/mach-rockchip/rk3308/clk_rk3308.c new file +31 -0
@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch/cru_rk3308.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (rockchip_rk3308_cru), devp); +} + +void *rockchip_get_cru (void ) +{ +struct rk3308_clk_priv *priv; +struct udevice *dev; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ERR_PTR (ret); + + priv =dev_get_priv (dev); + +return priv->cru; +}
arch/arm/mach-rockchip/rk3308/rk3308.c new file +175 -0
175 lines not on this page · raw message
arch/arm/mach-rockchip/rk3308/syscon_rk3308.c new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> + +static const struct udevice_id rk3308_syscon_ids[] = { + { .compatible ="rockchip,rk3308-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { } +}; + +U_BOOT_DRIVER (syscon_rk3308) = { + .name ="rk3308_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3308_syscon_ids, +};
include/configs/rk3308_common.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 1/9 arm: rockchip: Add RK3308 SOC support
Quoted 6 lines · Andy Yan
RK3308 is a quad Cortex A35 based SOC with rich audio interfaces(I2S/PCM/TDM/PDM/SPDIF/VAD/HDMI ARC), which designed for intelligent voice interaction and audio input/output processing.
Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 959 lines
---
Changes in v2: None
arch/arm/include/asm/arch-rk3308/boot0.h | 11 + arch/arm/include/asm/arch-rk3308/cru_rk3308.h | 290 ++++++++++++++++++ arch/arm/include/asm/arch-rk3308/gpio.h | 11 + arch/arm/include/asm/arch-rk3308/grf_rk3308.h | 197 ++++++++++++ arch/arm/mach-rockchip/Kconfig | 24 ++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3308/Kconfig | 14 + arch/arm/mach-rockchip/rk3308/Makefile | 9 + arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 31 ++ arch/arm/mach-rockchip/rk3308/rk3308.c | 175 +++++++++++ arch/arm/mach-rockchip/rk3308/syscon_rk3308.c | 20 ++ include/configs/rk3308_common.h | 58 ++++ 12 files changed, 841 insertions(+)create mode 100644
arch/arm/include/asm/arch-rk3308/boot0.hcreate mode 100644arch/arm/include/asm/arch-rk3308/cru_rk3308.hcreate mode 100644arch/arm/include/asm/arch-rk3308/gpio.hcreate mode 100644arch/arm/include/asm/arch-rk3308/grf_rk3308.hcreate mode 100644arch/arm/mach-rockchip/rk3308/Kconfigcreate mode 100644arch/arm/mach-rockchip/rk3308/Makefilecreate mode 100644arch/arm/mach-rockchip/rk3308/clk_rk3308.ccreate mode 100644arch/arm/mach-rockchip/rk3308/rk3308.ccreate mode 100644arch/arm/mach-rockchip/rk3308/syscon_rk3308.ccreate mode 100644include/configs/rk3308_common.harch/arm/include/asm/arch-rk3308/boot0.h new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#ifndef __ASM_ARCH_BOOT0_H__ +#define __ASM_ARCH_BOOT0_H__ + +#include <asm/arch-rockchip/boot0.h> + +#endif arch/arm/include/asm/arch-rk3308/cru_rk3308.h new file +290
-0@@ -0,0 +1,290 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd. +*/ +#ifndef _ASM_ARCH_CRU_RK3308_H +#define _ASM_ARCH_CRU_RK3308_H + +#include <common.h> + +#define MHz 1000000 +#define OSC_HZ (24 * MHz) + +#define APLL_HZ (816 * MHz) + +#define CORE_ACLK_HZ 408000000 +#define CORE_DBG_HZ 204000000 + +#define BUS_ACLK_HZ 200000000 +#define BUS_HCLK_HZ 100000000 +#define BUS_PCLK_HZ 100000000 + +#define PERI_ACLK_HZ 200000000 +#define PERI_HCLK_HZ 100000000 +#define PERI_PCLK_HZ 100000000 + +#define AUDIO_HCLK_HZ 100000000 +#define AUDIO_PCLK_HZ 100000000 + +#define RK3308_PLL_CON (x) ((x) * 0x4) +#define RK3308_MODE_CON 0xa0 + +/* RK3308 pll id */ +enum rk3308_pll_id { +APLL , +DPLL , +VPLL0 , +VPLL1 , +PLL_COUNT , +}; + +struct rk3308_clk_info { +unsigned long id; +char *name; +}; + +/* Private data for the clock driver - used by rockchip_get_cru() */ +struct rk3308_clk_priv { +struct rk3308_cru *cru; +ulong armclk_hz; +ulong dpll_hz; +ulong vpll0_hz; +ulong vpll1_hz; +}; + +struct rk3308_cru { +struct rk3308_pll { +unsigned int con0; +unsigned int con1; +unsigned int con2; +unsigned int con3; +unsigned int con4; +unsigned int reserved0[3 ]; + } pll[4 ]; +unsigned int reserved1[8 ]; +unsigned int mode; +unsigned int misc; +unsigned int reserved2[2 ]; +unsigned int glb_cnt_th; +unsigned int glb_rst_st; +unsigned int glb_srst_fst; +unsigned int glb_srst_snd; +unsigned int glb_rst_con; +unsigned int pll_lock; +unsigned int reserved3[6 ]; +unsigned int hwffc_con0; +unsigned int reserved4; +unsigned int hwffc_th; +unsigned int hwffc_intst; +unsigned int apll_con0_s; +unsigned int apll_con1_s; +unsigned int clksel_con0_s; +unsigned int reserved5; +unsigned int clksel_con[74 ]; +unsigned int reserved6[54 ]; +unsigned int clkgate_con[15 ]; +unsigned int reserved7[(0x380 -0x338 ) /4 -1 ]; +unsigned int ssgtbl[32 ]; +unsigned int softrst_con[10 ]; +unsigned int reserved8[(0x480 -0x424 ) /4 -1 ]; +unsigned int sdmmc_con[2 ]; +unsigned int sdio_con[2 ]; +unsigned int emmc_con[2 ]; +}; + +enum { +/* PLLCON0*/ +PLL_BP_SHIFT =15 , +PLL_POSTDIV1_SHIFT =12 , +PLL_POSTDIV1_MASK =7 <<PLL_POSTDIV1_SHIFT , +PLL_FBDIV_SHIFT =0 , +PLL_FBDIV_MASK =0xfff , + +/* PLLCON1 */ +PLL_PDSEL_SHIFT =15 , +PLL_PD1_SHIFT =14 , +PLL_PD_SHIFT =13 , +PLL_PD_MASK =1 <<PLL_PD_SHIFT , +PLL_DSMPD_SHIFT =12 , +PLL_DSMPD_MASK =1 <<PLL_DSMPD_SHIFT , +PLL_LOCK_STATUS_SHIFT =10 , +PLL_LOCK_STATUS_MASK =1 <<PLL_LOCK_STATUS_SHIFT , +PLL_POSTDIV2_SHIFT =6 , +PLL_POSTDIV2_MASK =7 <<PLL_POSTDIV2_SHIFT , +PLL_REFDIV_SHIFT =0 , +PLL_REFDIV_MASK =0x3f , + +/* PLLCON2 */ +PLL_FOUT4PHASEPD_SHIFT =27 , +PLL_FOUTVCOPD_SHIFT =26 , +PLL_FOUTPOSTDIVPD_SHIFT =25 , +PLL_DACPD_SHIFT =24 , +PLL_FRAC_DIV =0xffffff , + +/* CRU_MODE */ +PLLMUX_FROM_XIN24M =0 , +PLLMUX_FROM_PLL , +PLLMUX_FROM_RTC32K , +USBPHY480M_MODE_SHIFT =8 , +USBPHY480M_MODE_MASK =3 <<USBPHY480M_MODE_SHIFT , +VPLL1_MODE_SHIFT =6 , +VPLL1_MODE_MASK =3 <<VPLL1_MODE_SHIFT , +VPLL0_MODE_SHIFT =4 , +VPLL0_MODE_MASK =3 <<VPLL0_MODE_SHIFT , +DPLL_MODE_SHIFT =2 , +DPLL_MODE_MASK =3 <<DPLL_MODE_SHIFT , +APLL_MODE_SHIFT =0 , +APLL_MODE_MASK =3 <<APLL_MODE_SHIFT , + +/* CRU_CLK_SEL0_CON */ +CORE_ACLK_DIV_SHIFT =12 , +CORE_ACLK_DIV_MASK =0x7 <<CORE_ACLK_DIV_SHIFT , +CORE_DBG_DIV_SHIFT =8 , +CORE_DBG_DIV_MASK =0xf <<CORE_DBG_DIV_SHIFT , +CORE_CLK_PLL_SEL_SHIFT =6 , +CORE_CLK_PLL_SEL_MASK =0x3 <<CORE_CLK_PLL_SEL_SHIFT , +CORE_CLK_PLL_SEL_APLL =0 , +CORE_CLK_PLL_SEL_VPLL0 , +CORE_CLK_PLL_SEL_VPLL1 , +CORE_DIV_CON_SHIFT =0 , +CORE_DIV_CON_MASK =0x0f <<CORE_DIV_CON_SHIFT , + +/* CRU_CLK_SEL5_CON */ +BUS_PLL_SEL_SHIFT =6 , +BUS_PLL_SEL_MASK =0x3 <<BUS_PLL_SEL_SHIFT , +BUS_PLL_SEL_DPLL =0 , +BUS_PLL_SEL_VPLL0 , +BUS_PLL_SEL_VPLL1 , +BUS_ACLK_DIV_SHIFT =0 , +BUS_ACLK_DIV_MASK =0x1f <<BUS_ACLK_DIV_SHIFT , + +/* CRU_CLK_SEL6_CON */ +BUS_PCLK_DIV_SHIFT =8 , +BUS_PCLK_DIV_MASK =0x1f <<BUS_PCLK_DIV_SHIFT , +BUS_HCLK_DIV_SHIFT =0 , +BUS_HCLK_DIV_MASK =0x1f <<BUS_HCLK_DIV_SHIFT , + +/* CRU_CLK_SEL7_CON */ +CRYPTO_APK_SEL_SHIFT =14 , +CRYPTO_APK_PLL_SEL_MASK =3 <<CRYPTO_APK_SEL_SHIFT , +CRYPTO_PLL_SEL_DPLL =0 , +CRYPTO_PLL_SEL_VPLL0 , +CRYPTO_PLL_SEL_VPLL1 =0 , +CRYPTO_APK_DIV_SHIFT =8 , +CRYPTO_APK_DIV_MASK =0x1f <<CRYPTO_APK_DIV_SHIFT , +CRYPTO_PLL_SEL_SHIFT =6 , +CRYPTO_PLL_SEL_MASK =3 <<CRYPTO_PLL_SEL_SHIFT , +CRYPTO_DIV_SHIFT =0 , +CRYPTO_DIV_MASK =0x1f <<CRYPTO_DIV_SHIFT , + +/* CRU_CLK_SEL8_CON */ +DCLK_VOP_SEL_SHIFT =14 , +DCLK_VOP_SEL_MASK =0x3 <<DCLK_VOP_SEL_SHIFT , +DCLK_VOP_SEL_DIVOUT =0 , +DCLK_VOP_SEL_FRACOUT , +DCLK_VOP_SEL_24M , +DCLK_VOP_PLL_SEL_SHIFT =10 , +DCLK_VOP_PLL_SEL_MASK =0x3 <<DCLK_VOP_PLL_SEL_SHIFT , +DCLK_VOP_PLL_SEL_DPLL =0 , +DCLK_VOP_PLL_SEL_VPLL0 , +DCLK_VOP_PLL_SEL_VPLL1 , +DCLK_VOP_DIV_SHIFT =0 , +DCLK_VOP_DIV_MASK =0xff , + +/* CRU_CLK_SEL25_CON */ +/* CRU_CLK_SEL26_CON */ +/* CRU_CLK_SEL27_CON */ +/* CRU_CLK_SEL28_CON */ +CLK_I2C_PLL_SEL_SHIFT =14 , +CLK_I2C_PLL_SEL_MASK =0x3 <<CLK_I2C_PLL_SEL_SHIFT , +CLK_I2C_PLL_SEL_DPLL =0 , +CLK_I2C_PLL_SEL_VPLL0 , +CLK_I2C_PLL_SEL_24M , +CLK_I2C_DIV_CON_SHIFT =0 , +CLK_I2C_DIV_CON_MASK =0x7f <<CLK_I2C_DIV_CON_SHIFT , + +/* CRU_CLK_SEL29_CON */ +CLK_PWM_PLL_SEL_SHIFT =14 , +CLK_PWM_PLL_SEL_MASK =0x3 <<CLK_PWM_PLL_SEL_SHIFT , +CLK_PWM_PLL_SEL_DPLL =0 , +CLK_PWM_PLL_SEL_VPLL0 , +CLK_PWM_PLL_SEL_24M , +CLK_PWM_DIV_CON_SHIFT =0 , +CLK_PWM_DIV_CON_MASK =0x7f <<CLK_PWM_DIV_CON_SHIFT , + +/* CRU_CLK_SEL30_CON */ +/* CRU_CLK_SEL31_CON */ +/* CRU_CLK_SEL32_CON */ +CLK_SPI_PLL_SEL_SHIFT =14 , +CLK_SPI_PLL_SEL_MASK =0x3 <<CLK_SPI_PLL_SEL_SHIFT , +CLK_SPI_PLL_SEL_DPLL =0 , +CLK_SPI_PLL_SEL_VPLL0 , +CLK_SPI_PLL_SEL_24M , +CLK_SPI_DIV_CON_SHIFT =0 , +CLK_SPI_DIV_CON_MASK =0x7f <<CLK_SPI_DIV_CON_SHIFT , + +/* CRU_CLK_SEL34_CON */ +CLK_SARADC_DIV_CON_SHIFT =0 , +CLK_SARADC_DIV_CON_MASK =0x7ff <<CLK_SARADC_DIV_CON_SHIFT , + +/* CRU_CLK_SEL36_CON */ +PERI_PLL_SEL_SHIFT =6 , +PERI_PLL_SEL_MASK =0x3 <<PERI_PLL_SEL_SHIFT , +PERI_PLL_DPLL =0 , +PERI_PLL_VPLL0 , +PERI_PLL_VPLL1 , +PERI_ACLK_DIV_SHIFT =0 , +PERI_ACLK_DIV_MASK =0x1f <<PERI_ACLK_DIV_SHIFT , + +/* CRU_CLK_SEL37_CON */ +PERI_PCLK_DIV_SHIFT =8 , +PERI_PCLK_DIV_MASK =0x1f <<PERI_PCLK_DIV_SHIFT , +PERI_HCLK_DIV_SHIFT =0 , +PERI_HCLK_DIV_MASK =0x1f <<PERI_HCLK_DIV_SHIFT , + +/* CRU_CLKSEL41_CON */ +EMMC_CLK_SEL_SHIFT =15 , +EMMC_CLK_SEL_MASK =1 <<EMMC_CLK_SEL_SHIFT , +EMMC_CLK_SEL_EMMC =0 , +EMMC_CLK_SEL_EMMC_DIV50 , +EMMC_PLL_SHIFT =8 , +EMMC_PLL_MASK =0x3 <<EMMC_PLL_SHIFT , +EMMC_SEL_DPLL =0 , +EMMC_SEL_VPLL0 , +EMMC_SEL_VPLL1 , +EMMC_SEL_24M , +EMMC_DIV_SHIFT =0 , +EMMC_DIV_MASK =0xff <<EMMC_DIV_SHIFT , + +/* CRU_CLKSEL43_CON */ +MAC_CLK_SPEED_SEL_SHIFT =15 , +MAC_CLK_SPEED_SEL_MASK =1 <<MAC_CLK_SPEED_SEL_SHIFT , +MAC_CLK_SPEED_SEL_10M =0 , +MAC_CLK_SPEED_SEL_100M , +MAC_CLK_SOURCE_SEL_SHIFT =14 , +MAC_CLK_SOURCE_SEL_MASK =1 <<MAC_CLK_SOURCE_SEL_SHIFT , +MAC_CLK_SOURCE_SEL_INTERNAL =0 , +MAC_CLK_SOURCE_SEL_EXTERNAL , +MAC_PLL_SHIFT =6 , +MAC_PLL_MASK =0x3 <<MAC_PLL_SHIFT , +MAC_SEL_DPLL =0 , +MAC_SEL_VPLL0 , +MAC_SEL_VPLL1 , +MAC_DIV_SHIFT =0 , +MAC_DIV_MASK =0x1f <<MAC_DIV_SHIFT , + +/* CRU_CLK_SEL45_CON */ +AUDIO_PCLK_DIV_SHIFT =8 , +AUDIO_PCLK_DIV_MASK =0x1f <<AUDIO_PCLK_DIV_SHIFT , +AUDIO_PLL_SEL_SHIFT =6 , +AUDIO_PLL_SEL_MASK =0x3 <<AUDIO_PLL_SEL_SHIFT , +AUDIO_PLL_VPLL0 =0 , +AUDIO_PLL_VPLL1 , +AUDIO_PLL_24M , +AUDIO_HCLK_DIV_SHIFT =0 , +AUDIO_HCLK_DIV_MASK =0x1f <<AUDIO_HCLK_DIV_SHIFT , +}; + +check_member (rk3308_cru, emmc_con[1 ],0x494 ); + +#endif arch/arm/include/asm/arch-rk3308/gpio.h new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#ifndef __ASM_ARCH_GPIO_H__ +#define __ASM_ARCH_GPIO_H__ + +#include <asm/arch-rockchip/gpio.h> + +#endif arch/arm/include/asm/arch-rk3308/grf_rk3308.h new file +197
-0@@ -0,0 +1,197 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +*Copyright 2019 Rockchip Electronics Co., Ltd. +*/ +#ifndef _ASM_ARCH_GRF_rk3308_H +#define _ASM_ARCH_GRF_rk3308_H + +#include <common.h> + +struct rk3308_grf { +unsigned int gpio0a_iomux; +unsigned int reserved0; +unsigned int gpio0b_iomux; +unsigned int reserved1; +unsigned int gpio0c_iomux; +unsigned int reserved2[3 ]; +unsigned int gpio1a_iomux; +unsigned int reserved3; +unsigned int gpio1bl_iomux; +unsigned int gpio1bh_iomux; +unsigned int gpio1cl_iomux; +unsigned int gpio1ch_iomux; +unsigned int gpio1d_iomux; +unsigned int reserved4; +unsigned int gpio2a_iomux; +unsigned int reserved5; +unsigned int gpio2b_iomux; +unsigned int reserved6; +unsigned int gpio2c_iomux; +unsigned int reserved7[3 ]; +unsigned int gpio3a_iomux; +unsigned int reserved8; +unsigned int gpio3b_iomux; +unsigned int reserved9[5 ]; +unsigned int gpio4a_iomux; +unsigned int reserved33; +unsigned int gpio4b_iomux; +unsigned int reserved10; +unsigned int gpio4c_iomux; +unsigned int reserved11; +unsigned int gpio4d_iomux; +unsigned int reserved34; +unsigned int gpio0a_p; +unsigned int gpio0b_p; +unsigned int gpio0c_p; +unsigned int reserved12; +unsigned int gpio1a_p; +unsigned int gpio1b_p; +unsigned int gpio1c_p; +unsigned int gpio1d_p; +unsigned int gpio2a_p; +unsigned int gpio2b_p; +unsigned int gpio2c_p; +unsigned int reserved13; +unsigned int gpio3a_p; +unsigned int gpio3b_p; +unsigned int reserved14[2 ]; +unsigned int gpio4a_p; +unsigned int gpio4b_p; +unsigned int gpio4c_p; +unsigned int gpio4d_p; +unsigned int reserved15[(0x100 -0xec ) /4 -1 ]; +unsigned int gpio0a_e; +unsigned int gpio0b_e; +unsigned int gpio0c_e; +unsigned int reserved16; +unsigned int gpio1a_e; +unsigned int gpio1b_e; +unsigned int gpio1c_e; +unsigned int gpio1d_e; +unsigned int gpio2a_e; +unsigned int gpio2b_e; +unsigned int gpio2c_e; +unsigned int reserved17; +unsigned int gpio3a_e; +unsigned int gpio3b_e; +unsigned int reserved18[2 ]; +unsigned int gpio4a_e; +unsigned int gpio4b_e; +unsigned int gpio4c_e; +unsigned int gpio4d_e; +unsigned int gpio0a_sr; +unsigned int gpio0b_sr; +unsigned int gpio0c_sr; +unsigned int reserved19; +unsigned int gpio1a_sr; +unsigned int gpio1b_sr; +unsigned int gpio1c_sr; +unsigned int gpio1d_sr; +unsigned int gpio2a_sr; +unsigned int gpio2b_sr; +unsigned int gpio2c_sr; +unsigned int reserved20; +unsigned int gpio3a_sr; +unsigned int gpio3b_sr; +unsigned int reserved21[2 ]; +unsigned int gpio4a_sr; +unsigned int gpio4b_sr; +unsigned int gpio4c_sr; +unsigned int gpio4d_sr; +unsigned int gpio0a_smt; +unsigned int gpio0b_smt; +unsigned int gpio0c_smt; +unsigned int reserved22; +unsigned int gpio1a_smt; +unsigned int gpio1b_smt; +unsigned int gpio1c_smt; +unsigned int gpio1d_smt; +unsigned int gpio2a_smt; +unsigned int gpio2b_smt; +unsigned int gpio2c_smt; +unsigned int reserved23; +unsigned int gpio3a_smt; +unsigned int gpio3b_smt; +unsigned int reserved35[2 ]; +unsigned int gpio4a_smt; +unsigned int gpio4b_smt; +unsigned int gpio4c_smt; +unsigned int gpio4d_smt; +unsigned int reserved24[(0x300 -0x1EC ) /4 -1 ]; +unsigned int soc_con0; +unsigned int soc_con1; +unsigned int soc_con2; +unsigned int soc_con3; +unsigned int soc_con4; +unsigned int soc_con5; +unsigned int soc_con6; +unsigned int soc_con7; +unsigned int soc_con8; +unsigned int soc_con9; +unsigned int soc_con10; +unsigned int reserved25[(0x380 -0x328 ) /4 -1 ]; +unsigned int soc_status0; +unsigned int reserved26[(0x400 -0x380 ) /4 -1 ]; +unsigned int cpu_con0; +unsigned int cpu_con1; +unsigned int cpu_con2; +unsigned int reserved27[(0x420 -0x408 ) /4 -1 ]; +unsigned int cpu_status0; +unsigned int cpu_status1; +unsigned int reserved28[(0x440 -0x424 ) /4 -1 ]; +unsigned int pvtm_con0; +unsigned int pvtm_con1; +unsigned int pvtm_status0; +unsigned int pvtm_status1; +unsigned int reserved29[(0x460 -0x44C ) /4 -1 ]; +unsigned int tsadc_tbl; +unsigned int tsadc_tbh; +unsigned int reserved30[(0x480 -0x464 ) /4 -1 ]; +unsigned int host0_con0; +unsigned int host0_con1; +unsigned int otg_con0; +unsigned int host0_status0; +unsigned int reserved31[(0x4a0 -0x48C ) /4 -1 ]; +unsigned int mac_con0; +unsigned int upctrl_con0; +unsigned int upctrl_status0; +unsigned int reserved32[(0x500 -0x4A8 ) /4 -1 ]; +unsigned int os_reg0; +unsigned int os_reg1; +unsigned int os_reg2; +unsigned int os_reg3; +unsigned int os_reg4; +unsigned int os_reg5; +unsigned int os_reg6; +unsigned int os_reg7; +unsigned int os_reg8; +unsigned int os_reg9; +unsigned int os_reg10; +unsigned int os_reg11; +unsigned int reserved38[(0x600 -0x52c ) /4 -1 ]; +unsigned int soc_con12; +unsigned int reserved39; +unsigned int soc_con13; +unsigned int soc_con14; +unsigned int soc_con15; +unsigned int reserved40[(0x800 -0x610 ) /4 -1 ]; +unsigned int chip_id; +}; +check_member (rk3308_grf, gpio0a_p,0xa0 ); + +struct rk3308_sgrf { +unsigned int soc_con0; +unsigned int soc_con1; +unsigned int con_tzma_r0size; +unsigned int con_secure0; +unsigned int reserved0; +unsigned int clk_timer_en; +unsigned int clkgat_con; +unsigned int fastboot_addr; +unsigned int fastboot_en; +unsigned int reserved1[(0x30 -0x24 ) /4 ]; +unsigned int srst_con; +}; +check_member (rk3308_sgrf, fastboot_en,0x20 ); + +#endif arch/arm/mach-rockchip/Kconfig +24
-0@@ -105,6 +105,29 @@ config ROCKCHIP_RK3288 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UARTs, SPI, I2C and PWMs. +config ROCKCHIP_RK3308 + bool "Support Rockchip RK3308" + select ARM64 + select DEBUG_UART_BOARD_INIT + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select SPL_ATF + select SPL_ATF_NO_PLATFORM_PARAM + select SPL_LOAD_FIT + imply ROCKCHIP_COMMON_BOARD + imply SPL_ROCKCHIP_COMMON_BOARD + imply SPL_CLK + imply SPL_REGMAP + imply SPL_SYSCON + imply SPL_RAM + imply SPL_SERIAL_SUPPORT + imply TPL_SERIAL_SUPPORT + imply SPL_SEPARATE_BSS + help + The Rockchip RK3308 is a ARM-based Soc which embedded with quad + Cortex-A35 and highly integrated audio interfaces. + config ROCKCHIP_RK3328 bool "Support Rockchip RK3328" select ARM64@@ -320,6 +343,7 @@ source "arch/arm/mach-rockchip/rk3128/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk322x/Kconfig" source "arch/arm/mach-rockchip/rk3288/Kconfig" +source "arch/arm/mach-rockchip/rk3308/Kconfig" source "arch/arm/mach-rockchip/rk3328/Kconfig" source "arch/arm/mach-rockchip/rk3368/Kconfig" source "arch/arm/mach-rockchip/rk3399/Kconfig"arch/arm/mach-rockchip/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ +obj-$(CONFIG_ROCKCHIP_RK3308) += rk3308/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ obj-$(CONFIG_ROCKCHIP_RK3368) += rk3368/ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/arch/arm/mach-rockchip/rk3308/Kconfig new file +14
-0@@ -0,0 +1,14 @@ +if ROCKCHIP_RK3308 + +config SYS_SOC + default "rk3308" + +config SYS_MALLOC_F_LEN + default 0x400 + +config SPL_SERIAL_SUPPORT + default y + +config ROCKCHIP_BOOT_MODE_REG + default 0xff000500 +endifarch/arm/mach-rockchip/rk3308/Makefile new file +9
-0@@ -0,0 +1,9 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += syscon_rk3308.o +obj-y += rk3308.o +obj-y += clk_rk3308.oarch/arm/mach-rockchip/rk3308/clk_rk3308.c new file +31
-0@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch/cru_rk3308.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (rockchip_rk3308_cru), devp); +} + +void *rockchip_get_cru (void ) +{ +struct rk3308_clk_priv *priv; +struct udevice *dev; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ERR_PTR (ret); + + priv =dev_get_priv (dev); + +return priv->cru; +}arch/arm/mach-rockchip/rk3308/rk3308.c new file +175
-0@@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +*Copyright (c) 2018 Rockchip Electronics Co., Ltd +*/ +#include <common.h> +#include <asm/io.h> +#include <asm/arch/grf_rk3308.h> +#include <asm/arch-rockchip/hardware.h> +#include <asm/gpio.h> +#include <debug_uart.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#include <asm/armv8/mmu.h> +static struct mm_region rk3308_mem_map[] = { + { + .virt =0x0UL , + .phys =0x0UL , + .size =0xff000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_INNER_SHARE + }, { + .virt =0xff000000UL , + .phys =0xff000000UL , + .size =0x01000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, { +/* List terminator */ +0 , + } +}; + +struct mm_region *mem_map = rk3308_mem_map; + +#define GRF_BASE 0xff000000 +#define SGRF_BASE 0xff2b0000 + +enum { +GPIO1C7_SHIFT =8 , +GPIO1C7_MASK =GENMASK (11 ,8 ), +GPIO1C7_GPIO =0 , +GPIO1C7_UART1_RTSN , +GPIO1C7_UART2_TX_M0 , +GPIO1C7_SPI2_MOSI , +GPIO1C7_JTAG_TMS , + +GPIO1C6_SHIFT =4 , +GPIO1C6_MASK =GENMASK (7 ,4 ), +GPIO1C6_GPIO =0 , +GPIO1C6_UART1_CTSN , +GPIO1C6_UART2_RX_M0 , +GPIO1C6_SPI2_MISO , +GPIO1C6_JTAG_TCLK , + +GPIO4D3_SHIFT =6 , +GPIO4D3_MASK =GENMASK (7 ,6 ), +GPIO4D3_GPIO =0 , +GPIO4D3_SDMMC_D3 , +GPIO4D3_UART2_TX_M1 , + +GPIO4D2_SHIFT =4 , +GPIO4D2_MASK =GENMASK (5 ,4 ), +GPIO4D2_GPIO =0 , +GPIO4D2_SDMMC_D2 , +GPIO4D2_UART2_RX_M1 , + +UART2_IO_SEL_SHIFT =2 , +UART2_IO_SEL_MASK =GENMASK (3 ,2 ), +UART2_IO_SEL_M0 =0 , +UART2_IO_SEL_M1 , +UART2_IO_SEL_USB , + +GPIO3B3_SEL_SRC_CTRL_SHIFT =7 , +GPIO3B3_SEL_SRC_CTRL_MASK =BIT (7 ), +GPIO3B3_SEL_SRC_CTRL_IOMUX =0 , +GPIO3B3_SEL_SRC_CTRL_SEL_PLUS , + +GPIO3B3_SEL_PLUS_SHIFT =4 , +GPIO3B3_SEL_PLUS_MASK =GENMASK (6 ,4 ), +GPIO3B3_SEL_PLUS_GPIO3_B3 =0 , +GPIO3B3_SEL_PLUS_FLASH_ALE , +GPIO3B3_SEL_PLUS_EMMC_PWREN , +GPIO3B3_SEL_PLUS_SPI1_CLK , +GPIO3B3_SEL_PLUS_LCDC_D23_M1 , + +GPIO3B2_SEL_SRC_CTRL_SHIFT =3 , +GPIO3B2_SEL_SRC_CTRL_MASK =BIT (3 ), +GPIO3B2_SEL_SRC_CTRL_IOMUX =0 , +GPIO3B2_SEL_SRC_CTRL_SEL_PLUS , + +GPIO3B2_SEL_PLUS_SHIFT =0 , +GPIO3B2_SEL_PLUS_MASK =GENMASK (2 ,0 ), +GPIO3B2_SEL_PLUS_GPIO3_B2 =0 , +GPIO3B2_SEL_PLUS_FLASH_RDN , +GPIO3B2_SEL_PLUS_EMMC_RSTN , +GPIO3B2_SEL_PLUS_SPI1_MISO , +GPIO3B2_SEL_PLUS_LCDC_D22_M1 , +}; + +enum { +IOVSEL3_CTRL_SHIFT =8 , +IOVSEL3_CTRL_MASK =BIT (8 ), +VCCIO3_SEL_BY_GPIO =0 , +VCCIO3_SEL_BY_IOVSEL3 , + +IOVSEL3_SHIFT =3 , +IOVSEL3_MASK =BIT (3 ), +VCCIO3_3V3 =0 , +VCCIO3_1V8 , +}; + +/* +* The voltage of VCCIO3(which is the voltage domain of emmc/flash/sfc +* interface) can indicated by GPIO0_A4 or io_vsel3. The SOC defaults +* use GPIO0_A4 to indicate power supply voltage for VCCIO3 by hardware, +* then we can switch to io_vsel3 after system power on, and release GPIO0_A4 +* for other usage. +*/ + +#define GPIO0_A4 4 + +int rk_board_init (void ) +{ +static struct rk3308_grf *const grf = (void *)GRF_BASE ; +u32 val; +int ret; + + ret =gpio_request (GPIO0_A4 ,"gpio0_a4" ); +if (ret <0 ) { +printf ("request for gpio0_a4 failed:%d\n" , ret); +return 0 ; + } + +gpio_direction_input (GPIO0_A4 ); + +if (gpio_get_value (GPIO0_A4 )) + val =VCCIO3_SEL_BY_IOVSEL3 <<IOVSEL3_CTRL_SHIFT | +VCCIO3_1V8 <<IOVSEL3_SHIFT ; +else + val =VCCIO3_SEL_BY_IOVSEL3 <<IOVSEL3_CTRL_SHIFT | +VCCIO3_3V3 <<IOVSEL3_SHIFT ; +rk_clrsetreg (&grf->soc_con0,IOVSEL3_CTRL_MASK |IOVSEL3_MASK , val); + +gpio_free (GPIO0_A4 ); +return 0 ; +} + +#if defined(CONFIG_DEBUG_UART ) +__weak void board_debug_uart_init (void ) +{ +static struct rk3308_grf *const grf = (void *)GRF_BASE ; + +/* Enable early UART2 channel m1 on the rk3308 */ +rk_clrsetreg (&grf->soc_con5,UART2_IO_SEL_MASK , +UART2_IO_SEL_M1 <<UART2_IO_SEL_SHIFT ); +rk_clrsetreg (&grf->gpio4d_iomux, +GPIO4D3_MASK |GPIO4D2_MASK , +GPIO4D2_UART2_RX_M1 <<GPIO4D2_SHIFT | +GPIO4D3_UART2_TX_M1 <<GPIO4D3_SHIFT ); +} +#endif + +#if defined(CONFIG_SPL_BUILD ) +int arch_cpu_init (void ) +{ +static struct rk3308_sgrf *const sgrf = (void *)SGRF_BASE ; + +/* Set CRYPTO SDMMC EMMC NAND SFC USB master bus to be secure access */ +rk_clrreg (&sgrf->con_secure0,0x2b83 ); + +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3308/syscon_rk3308.c new file +20
-0@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> + +static const struct udevice_id rk3308_syscon_ids[] = { + { .compatible ="rockchip,rk3308-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { } +}; + +U_BOOT_DRIVER (syscon_rk3308) = { + .name ="rk3308_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3308_syscon_ids, +};include/configs/rk3308_common.h new file +58
-0@@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2017 Rockchip Electronics Co., Ltd +*/ + +#ifndef __CONFIG_RK3308_COMMON_H +#define __CONFIG_RK3308_COMMON_H + +#include "rockchip-common.h" + +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_SYS_MAX_NAND_DEVICE 1 +#define CONFIG_SYS_NAND_ONFI_DETECTION +#define CONFIG_SYS_NAND_PAGE_SIZE 2048 +#define CONFIG_SYS_NAND_PAGE_COUNT 64 +#define CONFIG_SYS_NAND_SIZE (256 * 1024 * 1024) +#define CONFIG_SPL_MAX_SIZE 0x20000 +#define CONFIG_SPL_BSS_START_ADDR 0x00400000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x2000 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000 + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_STIMER_BASE 0xff1b00a0 +#define CONFIG_IRAM_BASE 0xfff80000 +#define CONFIG_SYS_INIT_SP_ADDR 0x00800000 +#define CONFIG_SYS_LOAD_ADDR 0x00C00800 +#define CONFIG_SPL_STACK 0x00400000 +#define CONFIG_SYS_BOOTM_LEN (64 << 20)/* 64M */ + +#define COUNTER_FREQUENCY 24000000 + +#define CONFIG_SYS_BOOTM_LEN (64 << 20)/* 64M */ + +#define CONFIG_SYS_SDRAM_BASE 0 +#define SDRAM_MAX_SIZE 0xff000000 +#define SDRAM_BANK_SIZE (2UL << 30) + +#ifndef CONFIG_SPL_BUILD + +#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x00500000\0" \ + "pxefile_addr_r=0x00600000\0" \ + "fdt_addr_r=0x01f00000\0" \ + "kernel_addr_r=0x00680000\0" \ + "ramdisk_addr_r=0x04000000\0" + +#include <config_distro_bootcmd.h> +#define CONFIG_EXTRA_ENV_SETTINGS \ + ENV_MEM_LAYOUT_SETTINGS \ + "partitions=" PARTS_DEFAULT \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#endif + +#endif
PATCH v2 2/9 rockchip: clk: Add clk driver for rk3308
In reply to Andy YanFrom: Finley Xiao <[email protected]>
Add clk controller driver for RK3308 SOC.
---
Changes in v2: None
drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3308.c | 1078 ++++++++++++++++++++++++ include/dt-bindings/clock/rk3308-cru.h | 387 +++++++++ 3 files changed, 1466 insertions(+) create mode 100644 drivers/clk/rockchip/clk_rk3308.c create mode 100644 include/dt-bindings/clock/rk3308-cru.h
drivers/clk/rockchip/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_ROCKCHIP_RK3128) += clk_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) += clk_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) += clk_rk322x.o obj-$(CONFIG_ROCKCHIP_RK3288) += clk_rk3288.o +obj-$(CONFIG_ROCKCHIP_RK3308) += clk_rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) += clk_rk3328.o obj-$(CONFIG_ROCKCHIP_RK3368) += clk_rk3368.o obj-$(CONFIG_ROCKCHIP_RK3399) += clk_rk3399.o
drivers/clk/rockchip/clk_rk3308.c new file +1078 -0
1,078 lines not on this page · raw message
include/dt-bindings/clock/rk3308-cru.h new file +387 -0
387 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/9 rockchip: clk: Add clk driver for rk3308
Quoted 5 lines · Andy Yan
From: Finley Xiao <[email protected]>
Add clk controller driver for RK3308 SOC.
Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 1,500 lines
---
Changes in v2: None
drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3308.c | 1078 ++++++++++++++++++++++++ include/dt-bindings/clock/rk3308-cru.h | 387 +++++++++ 3 files changed, 1466 insertions(+)create mode 100644
drivers/clk/rockchip/clk_rk3308.ccreate mode 100644include/dt-bindings/clock/rk3308-cru.hdrivers/clk/rockchip/Makefile +1
-0@@ -9,6 +9,7 @@ obj-$(CONFIG_ROCKCHIP_RK3128) += clk_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) += clk_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) += clk_rk322x.o obj-$(CONFIG_ROCKCHIP_RK3288) += clk_rk3288.o +obj-$(CONFIG_ROCKCHIP_RK3308) += clk_rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) += clk_rk3328.o obj-$(CONFIG_ROCKCHIP_RK3368) += clk_rk3368.o obj-$(CONFIG_ROCKCHIP_RK3399) += clk_rk3399.odrivers/clk/rockchip/clk_rk3308.c new file +1078
-0@@ -0,0 +1,1078 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* (C) Copyright 2017 Rockchip Electronics Co., Ltd +*/ +#include <common.h> +#include <bitfield.h> +#include <clk-uclass.h> +#include <dm.h> +#include <div64.h> +#include <errno.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/cru_rk3308.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/hardware.h> +#include <dm/lists.h> +#include <dt-bindings/clock/rk3308-cru.h> + +DECLARE_GLOBAL_DATA_PTR ; + +enum { +VCO_MAX_HZ =3200U *1000000 , +VCO_MIN_HZ =800 *1000000 , +OUTPUT_MAX_HZ =3200U *1000000 , +OUTPUT_MIN_HZ =24 *1000000 , +}; + +#define DIV_TO_RATE (input_rate, div) ((input_rate) / ((div) + 1)) + +#define RK3308_CPUCLK_RATE (_rate, _aclk_div, _pclk_div) \ +{ \ + .rate = _rate##U, \ + .aclk_div = _aclk_div, \ + .pclk_div = _pclk_div, \ +} + +static struct rockchip_pll_rate_table rk3308_pll_rates[] = { +/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ +RK3036_PLL_RATE (1300000000 ,6 ,325 ,1 ,1 ,1 ,0 ), +RK3036_PLL_RATE (1200000000 ,1 ,50 ,1 ,1 ,1 ,0 ), +RK3036_PLL_RATE (816000000 ,1 ,68 ,2 ,1 ,1 ,0 ), +RK3036_PLL_RATE (748000000 ,2 ,187 ,3 ,1 ,1 ,0 ), +}; + +static struct rockchip_cpu_rate_table rk3308_cpu_rates[] = { +RK3308_CPUCLK_RATE (1200000000 ,1 ,5 ), +RK3308_CPUCLK_RATE (1008000000 ,1 ,5 ), +RK3308_CPUCLK_RATE (816000000 ,1 ,3 ), +RK3308_CPUCLK_RATE (600000000 ,1 ,3 ), +RK3308_CPUCLK_RATE (408000000 ,1 ,1 ), +}; + +static struct rockchip_pll_clock rk3308_pll_clks[] = { + [APLL ] =PLL (pll_rk3328,PLL_APLL ,RK3308_PLL_CON (0 ), +RK3308_MODE_CON ,0 ,10 ,0 , rk3308_pll_rates), + [DPLL ] =PLL (pll_rk3328,PLL_DPLL ,RK3308_PLL_CON (8 ), +RK3308_MODE_CON ,2 ,10 ,0 ,NULL ), + [VPLL0 ] =PLL (pll_rk3328,PLL_VPLL0 ,RK3308_PLL_CON (16 ), +RK3308_MODE_CON ,4 ,10 ,0 ,NULL ), + [VPLL1 ] =PLL (pll_rk3328,PLL_VPLL1 ,RK3308_PLL_CON (24 ), +RK3308_MODE_CON ,6 ,10 ,0 ,NULL ), +}; + +static ulong rk3308_armclk_set_clk (struct rk3308_clk_priv *priv,ulong hz) +{ +struct rk3308_cru *cru = priv->cru; +const struct rockchip_cpu_rate_table *rate; +ulong old_rate; + + rate =rockchip_get_cpu_settings (rk3308_cpu_rates, hz); +if (!rate) { +printf ("%s unsupport rate\n" , __func__); +return -EINVAL ; + } + +/* +* select apll as cpu/core clock pll source and +* set up dependent divisors for PERI and ACLK clocks. +* core hz : apll = 1:1 +*/ + old_rate =rockchip_pll_get_rate (&rk3308_pll_clks[APLL ], + priv->cru,APLL ); +if (old_rate > hz) { +if (rockchip_pll_set_rate (&rk3308_pll_clks[APLL ], + priv->cru,APLL , hz)) +return -EINVAL ; +rk_clrsetreg (&cru->clksel_con[0 ], +CORE_CLK_PLL_SEL_MASK |CORE_DIV_CON_MASK | +CORE_ACLK_DIV_MASK |CORE_DBG_DIV_MASK , + rate->aclk_div <<CORE_ACLK_DIV_SHIFT | + rate->pclk_div <<CORE_DBG_DIV_SHIFT | +CORE_CLK_PLL_SEL_APLL <<CORE_CLK_PLL_SEL_SHIFT | +0 <<CORE_DIV_CON_SHIFT ); + }else if (old_rate < hz) { +rk_clrsetreg (&cru->clksel_con[0 ], +CORE_CLK_PLL_SEL_MASK |CORE_DIV_CON_MASK | +CORE_ACLK_DIV_MASK |CORE_DBG_DIV_MASK , + rate->aclk_div <<CORE_ACLK_DIV_SHIFT | + rate->pclk_div <<CORE_DBG_DIV_SHIFT | +CORE_CLK_PLL_SEL_APLL <<CORE_CLK_PLL_SEL_SHIFT | +0 <<CORE_DIV_CON_SHIFT ); +if (rockchip_pll_set_rate (&rk3308_pll_clks[APLL ], + priv->cru,APLL , hz)) +return -EINVAL ; + } + +return rockchip_pll_get_rate (&rk3308_pll_clks[APLL ], priv->cru,APLL ); +} + +static void rk3308_clk_get_pll_rate (struct rk3308_clk_priv *priv) +{ +if (!priv->dpll_hz) + priv->dpll_hz =rockchip_pll_get_rate (&rk3308_pll_clks[DPLL ], + priv->cru,DPLL ); +if (!priv->vpll0_hz) + priv->vpll0_hz =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL0 ], + priv->cru,VPLL0 ); +if (!priv->vpll1_hz) + priv->vpll1_hz =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL1 ], + priv->cru,VPLL1 ); +} + +static ulong rk3308_i2c_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con, con_id; + +switch (clk->id) { +case SCLK_I2C0 : + con_id =25 ; +break ; +case SCLK_I2C1 : + con_id =26 ; +break ; +case SCLK_I2C2 : + con_id =27 ; +break ; +case SCLK_I2C3 : + con_id =28 ; +break ; +default : +printf ("do not support this i2c bus\n" ); +return -EINVAL ; + } + + con =readl (&cru->clksel_con[con_id]); + div = con >>CLK_I2C_DIV_CON_SHIFT &CLK_I2C_DIV_CON_MASK ; + +return DIV_TO_RATE (priv->dpll_hz, div); +} + +static ulong rk3308_i2c_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 src_clk_div, con_id; + + src_clk_div =DIV_ROUND_UP (priv->dpll_hz, hz); +assert (src_clk_div -1 <=127 ); + +switch (clk->id) { +case SCLK_I2C0 : + con_id =25 ; +break ; +case SCLK_I2C1 : + con_id =26 ; +break ; +case SCLK_I2C2 : + con_id =27 ; +break ; +case SCLK_I2C3 : + con_id =28 ; +break ; +default : +printf ("do not support this i2c bus\n" ); +return -EINVAL ; + } +rk_clrsetreg (&cru->clksel_con[con_id], +CLK_I2C_PLL_SEL_MASK |CLK_I2C_DIV_CON_MASK , +CLK_I2C_PLL_SEL_DPLL <<CLK_I2C_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<CLK_I2C_DIV_CON_SHIFT ); + +return rk3308_i2c_get_clk (clk); +} + +static ulong rk3308_mac_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 con =readl (&cru->clksel_con[43 ]); +ulong pll_rate; +u8 div; + +if ((con >>MAC_PLL_SHIFT ) &MAC_SEL_VPLL0 ) + pll_rate =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL0 ], + priv->cru,VPLL0 ); +else if ((con >>MAC_PLL_SHIFT ) &MAC_SEL_VPLL1 ) + pll_rate =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL1 ], + priv->cru,VPLL1 ); +else + pll_rate =rockchip_pll_get_rate (&rk3308_pll_clks[DPLL ], + priv->cru,DPLL ); + +/*default set 50MHZ for gmac*/ +if (!hz) + hz =50000000 ; + + div =DIV_ROUND_UP (pll_rate, hz) -1 ; +assert (div <32 ); +rk_clrsetreg (&cru->clksel_con[43 ],MAC_DIV_MASK , + div <<MAC_DIV_SHIFT ); + +return DIV_TO_RATE (pll_rate, div); +} + +static int rk3308_mac_set_speed_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; + +if (hz !=2500000 && hz !=25000000 ) { +debug ("Unsupported mac speed:%d\n" , hz); +return -EINVAL ; + } + +rk_clrsetreg (&cru->clksel_con[43 ],MAC_CLK_SPEED_SEL_MASK , + ((hz ==2500000 ) ?0 :1 ) <<MAC_CLK_SPEED_SEL_SHIFT ); + +return 0 ; +} + +static ulong rk3308_mmc_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con, con_id; + +switch (clk->id) { +case HCLK_SDMMC : +case SCLK_SDMMC : + con_id =39 ; +break ; +case HCLK_EMMC : +case SCLK_EMMC : +case SCLK_EMMC_SAMPLE : + con_id =41 ; +break ; +default : +return -EINVAL ; + } + + con =readl (&cru->clksel_con[con_id]); + div = (con &EMMC_DIV_MASK ) >>EMMC_DIV_SHIFT ; + +if ((con &EMMC_PLL_MASK ) >>EMMC_PLL_SHIFT + ==EMMC_SEL_24M ) +return DIV_TO_RATE (OSC_HZ , div) /2 ; +else +return DIV_TO_RATE (priv->vpll0_hz, div) /2 ; +} + +static ulong rk3308_mmc_set_clk (struct clk *clk,ulong set_rate) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +int src_clk_div; +u32 con_id; + +switch (clk->id) { +case HCLK_SDMMC : +case SCLK_SDMMC : + con_id =39 ; +break ; +case HCLK_EMMC : +case SCLK_EMMC : + con_id =41 ; +break ; +default : +return -EINVAL ; + } +/* Select clk_sdmmc/emmc source from VPLL0 by default */ +/* mmc clock defaulg div 2 internal, need provide double in cru */ + src_clk_div =DIV_ROUND_UP (priv->vpll0_hz /2 , set_rate); + +if (src_clk_div >127 ) { +/* use 24MHz source for 400KHz clock */ + src_clk_div =DIV_ROUND_UP (OSC_HZ /2 , set_rate); +rk_clrsetreg (&cru->clksel_con[con_id], +EMMC_PLL_MASK |EMMC_DIV_MASK |EMMC_CLK_SEL_MASK , +EMMC_CLK_SEL_EMMC <<EMMC_CLK_SEL_SHIFT | +EMMC_SEL_24M <<EMMC_PLL_SHIFT | + (src_clk_div -1 ) <<EMMC_DIV_SHIFT ); + }else { +rk_clrsetreg (&cru->clksel_con[con_id], +EMMC_PLL_MASK |EMMC_DIV_MASK |EMMC_CLK_SEL_MASK , +EMMC_CLK_SEL_EMMC <<EMMC_CLK_SEL_SHIFT | +EMMC_SEL_VPLL0 <<EMMC_PLL_SHIFT | + (src_clk_div -1 ) <<EMMC_DIV_SHIFT ); + } + +return rk3308_mmc_get_clk (clk); +} + +static ulong rk3308_saradc_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con; + + con =readl (&cru->clksel_con[34 ]); + div = con >>CLK_SARADC_DIV_CON_SHIFT &CLK_SARADC_DIV_CON_MASK ; + +return DIV_TO_RATE (OSC_HZ , div); +} + +static ulong rk3308_saradc_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (OSC_HZ , hz); +assert (src_clk_div -1 <=2047 ); + +rk_clrsetreg (&cru->clksel_con[34 ], +CLK_SARADC_DIV_CON_MASK , + (src_clk_div -1 ) <<CLK_SARADC_DIV_CON_SHIFT ); + +return rk3308_saradc_get_clk (clk); +} + +static ulong rk3308_tsadc_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con; + + con =readl (&cru->clksel_con[33 ]); + div = con >>CLK_SARADC_DIV_CON_SHIFT &CLK_SARADC_DIV_CON_MASK ; + +return DIV_TO_RATE (OSC_HZ , div); +} + +static ulong rk3308_tsadc_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (OSC_HZ , hz); +assert (src_clk_div -1 <=2047 ); + +rk_clrsetreg (&cru->clksel_con[33 ], +CLK_SARADC_DIV_CON_MASK , + (src_clk_div -1 ) <<CLK_SARADC_DIV_CON_SHIFT ); + +return rk3308_tsadc_get_clk (clk); +} + +static ulong rk3308_spi_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con, con_id; + +switch (clk->id) { +case SCLK_SPI0 : + con_id =30 ; +break ; +case SCLK_SPI1 : + con_id =31 ; +break ; +case SCLK_SPI2 : + con_id =32 ; +break ; +default : +printf ("do not support this spi bus\n" ); +return -EINVAL ; + } + + con =readl (&cru->clksel_con[con_id]); + div = con >>CLK_SPI_DIV_CON_SHIFT &CLK_SPI_DIV_CON_MASK ; + +return DIV_TO_RATE (priv->dpll_hz, div); +} + +static ulong rk3308_spi_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 src_clk_div, con_id; + + src_clk_div =DIV_ROUND_UP (priv->dpll_hz, hz); +assert (src_clk_div -1 <=127 ); + +switch (clk->id) { +case SCLK_SPI0 : + con_id =30 ; +break ; +case SCLK_SPI1 : + con_id =31 ; +break ; +case SCLK_SPI2 : + con_id =32 ; +break ; +default : +printf ("do not support this spi bus\n" ); +return -EINVAL ; + } + +rk_clrsetreg (&cru->clksel_con[con_id], +CLK_SPI_PLL_SEL_MASK |CLK_SPI_DIV_CON_MASK , +CLK_SPI_PLL_SEL_DPLL <<CLK_SPI_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<CLK_SPI_DIV_CON_SHIFT ); + +return rk3308_spi_get_clk (clk); +} + +static ulong rk3308_pwm_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, con; + + con =readl (&cru->clksel_con[29 ]); + div = con >>CLK_PWM_DIV_CON_SHIFT &CLK_PWM_DIV_CON_MASK ; + +return DIV_TO_RATE (priv->dpll_hz, div); +} + +static ulong rk3308_pwm_set_clk (struct clk *clk,uint hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (priv->dpll_hz, hz); +assert (src_clk_div -1 <=127 ); + +rk_clrsetreg (&cru->clksel_con[29 ], +CLK_PWM_PLL_SEL_MASK |CLK_PWM_DIV_CON_MASK , +CLK_PWM_PLL_SEL_DPLL <<CLK_PWM_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<CLK_PWM_DIV_CON_SHIFT ); + +return rk3308_pwm_get_clk (clk); +} + +static ulong rk3308_vop_get_clk (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +u32 div, pll_sel, vol_sel, con, parent; + + con =readl (&cru->clksel_con[8 ]); + vol_sel = (con &DCLK_VOP_SEL_MASK ) >>DCLK_VOP_SEL_SHIFT ; + pll_sel = (con &DCLK_VOP_PLL_SEL_MASK ) >>DCLK_VOP_PLL_SEL_SHIFT ; + div = con &DCLK_VOP_DIV_MASK ; + +if (vol_sel ==DCLK_VOP_SEL_24M ) { + parent =OSC_HZ ; + }else if (vol_sel ==DCLK_VOP_SEL_DIVOUT ) { +switch (pll_sel) { +case DCLK_VOP_PLL_SEL_DPLL : + parent = priv->dpll_hz; +break ; +case DCLK_VOP_PLL_SEL_VPLL0 : + parent = priv->vpll0_hz; +break ; +case DCLK_VOP_PLL_SEL_VPLL1 : + parent = priv->vpll0_hz; +break ; +default : +printf ("do not support this vop pll sel\n" ); +return -EINVAL ; + } + }else { +printf ("do not support this vop sel\n" ); +return -EINVAL ; + } + +return DIV_TO_RATE (parent, div); +} + +static ulong rk3308_vop_set_clk (struct clk *clk,ulong hz) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3308_cru *cru = priv->cru; +ulong pll_rate, now, best_rate =0 ; +u32 i, div, best_div =0 , best_sel =0 ; + +for (i =0 ; i <=DCLK_VOP_PLL_SEL_VPLL1 ; i++) { +switch (i) { +case DCLK_VOP_PLL_SEL_DPLL : + pll_rate = priv->dpll_hz; +break ; +case DCLK_VOP_PLL_SEL_VPLL0 : + pll_rate = priv->vpll0_hz; +break ; +case DCLK_VOP_PLL_SEL_VPLL1 : + pll_rate = priv->vpll1_hz; +break ; +default : +printf ("do not support this vop pll sel\n" ); +return -EINVAL ; + } + + div =DIV_ROUND_UP (pll_rate, hz); +if (div >255 ) +continue ; + now = pll_rate / div; +if (abs (hz - now) <abs (hz - best_rate)) { + best_rate = now; + best_div = div; + best_sel = i; + } +debug ("pll_rate=%lu, best_rate=%lu, best_div=%u, best_sel=%u\n" , + pll_rate, best_rate, best_div, best_sel); + } + +if (best_rate != hz && hz ==OSC_HZ ) { +rk_clrsetreg (&cru->clksel_con[8 ], +DCLK_VOP_SEL_MASK , +DCLK_VOP_SEL_24M <<DCLK_VOP_SEL_SHIFT ); + }else if (best_rate) { +rk_clrsetreg (&cru->clksel_con[8 ], +DCLK_VOP_SEL_MASK |DCLK_VOP_PLL_SEL_MASK | +DCLK_VOP_DIV_MASK , +DCLK_VOP_SEL_DIVOUT <<DCLK_VOP_SEL_SHIFT | + best_sel <<DCLK_VOP_PLL_SEL_SHIFT | + (best_div -1 ) <<DCLK_VOP_DIV_SHIFT ); + }else { +printf ("do not support this vop freq\n" ); +return -EINVAL ; + } + +return rk3308_vop_get_clk (clk); +} + +static ulong rk3308_bus_get_clk (struct rk3308_clk_priv *priv,ulong clk_id) +{ +struct rk3308_cru *cru = priv->cru; +u32 div, con, parent = priv->dpll_hz; + +switch (clk_id) { +case ACLK_BUS : + con =readl (&cru->clksel_con[5 ]); + div = (con &BUS_ACLK_DIV_MASK ) >>BUS_ACLK_DIV_SHIFT ; +break ; +case HCLK_BUS : + con =readl (&cru->clksel_con[6 ]); + div = (con &BUS_HCLK_DIV_MASK ) >>BUS_HCLK_DIV_SHIFT ; +break ; +case PCLK_BUS : +case PCLK_WDT : + con =readl (&cru->clksel_con[6 ]); + div = (con &BUS_PCLK_DIV_MASK ) >>BUS_PCLK_DIV_SHIFT ; +break ; +default : +return -ENOENT ; + } + +return DIV_TO_RATE (parent, div); +} + +static ulong rk3308_bus_set_clk (struct rk3308_clk_priv *priv,ulong clk_id, +ulong hz) +{ +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (priv->dpll_hz, hz); +assert (src_clk_div -1 <=31 ); + +/* +* select dpll as pd_bus bus clock source and +* set up dependent divisors for PCLK/HCLK and ACLK clocks. +*/ +switch (clk_id) { +case ACLK_BUS : +rk_clrsetreg (&cru->clksel_con[5 ], +BUS_PLL_SEL_MASK |BUS_ACLK_DIV_MASK , +BUS_PLL_SEL_DPLL <<BUS_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<BUS_ACLK_DIV_SHIFT ); +break ; +case HCLK_BUS : +rk_clrsetreg (&cru->clksel_con[6 ], +BUS_HCLK_DIV_MASK , + (src_clk_div -1 ) <<BUS_HCLK_DIV_SHIFT ); +break ; +case PCLK_BUS : +rk_clrsetreg (&cru->clksel_con[6 ], +BUS_PCLK_DIV_MASK , + (src_clk_div -1 ) <<BUS_PCLK_DIV_SHIFT ); +break ; +default : +printf ("do not support this bus freq\n" ); +return -EINVAL ; + } + +return rk3308_bus_get_clk (priv, clk_id); +} + +static ulong rk3308_peri_get_clk (struct rk3308_clk_priv *priv,ulong clk_id) +{ +struct rk3308_cru *cru = priv->cru; +u32 div, con, parent = priv->dpll_hz; + +switch (clk_id) { +case ACLK_PERI : + con =readl (&cru->clksel_con[36 ]); + div = (con &PERI_ACLK_DIV_MASK ) >>PERI_ACLK_DIV_SHIFT ; +break ; +case HCLK_PERI : + con =readl (&cru->clksel_con[37 ]); + div = (con &PERI_HCLK_DIV_MASK ) >>PERI_HCLK_DIV_SHIFT ; +break ; +case PCLK_PERI : + con =readl (&cru->clksel_con[37 ]); + div = (con &PERI_PCLK_DIV_MASK ) >>PERI_PCLK_DIV_SHIFT ; +break ; +default : +return -ENOENT ; + } + +return DIV_TO_RATE (parent, div); +} + +static ulong rk3308_peri_set_clk (struct rk3308_clk_priv *priv,ulong clk_id, +ulong hz) +{ +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (priv->dpll_hz, hz); +assert (src_clk_div -1 <=31 ); + +/* +* select dpll as pd_peri bus clock source and +* set up dependent divisors for PCLK/HCLK and ACLK clocks. +*/ +switch (clk_id) { +case ACLK_PERI : +rk_clrsetreg (&cru->clksel_con[36 ], +PERI_PLL_SEL_MASK |PERI_ACLK_DIV_MASK , +PERI_PLL_DPLL <<PERI_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<PERI_ACLK_DIV_SHIFT ); +break ; +case HCLK_PERI : +rk_clrsetreg (&cru->clksel_con[37 ], +PERI_HCLK_DIV_MASK , + (src_clk_div -1 ) <<PERI_HCLK_DIV_SHIFT ); +break ; +case PCLK_PERI : +rk_clrsetreg (&cru->clksel_con[37 ], +PERI_PCLK_DIV_MASK , + (src_clk_div -1 ) <<PERI_PCLK_DIV_SHIFT ); +break ; +default : +printf ("do not support this peri freq\n" ); +return -EINVAL ; + } + +return rk3308_peri_get_clk (priv, clk_id); +} + +static ulong rk3308_audio_get_clk (struct rk3308_clk_priv *priv,ulong clk_id) +{ +struct rk3308_cru *cru = priv->cru; +u32 div, con, parent = priv->vpll0_hz; + +switch (clk_id) { +case HCLK_AUDIO : + con =readl (&cru->clksel_con[45 ]); + div = (con &AUDIO_HCLK_DIV_MASK ) >>AUDIO_HCLK_DIV_SHIFT ; +break ; +case PCLK_AUDIO : + con =readl (&cru->clksel_con[45 ]); + div = (con &AUDIO_PCLK_DIV_MASK ) >>AUDIO_PCLK_DIV_SHIFT ; +break ; +default : +return -ENOENT ; + } + +return DIV_TO_RATE (parent, div); +} + +static ulong rk3308_audio_set_clk (struct rk3308_clk_priv *priv,ulong clk_id, +ulong hz) +{ +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (priv->vpll0_hz, hz); +assert (src_clk_div -1 <=31 ); + +/* +* select vpll0 as audio bus clock source and +* set up dependent divisors for HCLK and PCLK clocks. +*/ +switch (clk_id) { +case HCLK_AUDIO : +rk_clrsetreg (&cru->clksel_con[45 ], +AUDIO_PLL_SEL_MASK |AUDIO_HCLK_DIV_MASK , +AUDIO_PLL_VPLL0 <<AUDIO_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<AUDIO_HCLK_DIV_SHIFT ); +break ; +case PCLK_AUDIO : +rk_clrsetreg (&cru->clksel_con[45 ], +AUDIO_PLL_SEL_MASK |AUDIO_PCLK_DIV_MASK , +AUDIO_PLL_VPLL0 <<AUDIO_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<AUDIO_PCLK_DIV_SHIFT ); +break ; +default : +printf ("do not support this audio freq\n" ); +return -EINVAL ; + } + +return rk3308_peri_get_clk (priv, clk_id); +} + +static ulong rk3308_crypto_get_clk (struct rk3308_clk_priv *priv,ulong clk_id) +{ +struct rk3308_cru *cru = priv->cru; +u32 div, con, parent; + +switch (clk_id) { +case SCLK_CRYPTO : + con =readl (&cru->clksel_con[7 ]); + div = (con &CRYPTO_DIV_MASK ) >>CRYPTO_DIV_SHIFT ; + parent = priv->vpll0_hz; +break ; +case SCLK_CRYPTO_APK : + con =readl (&cru->clksel_con[7 ]); + div = (con &CRYPTO_APK_DIV_MASK ) >>CRYPTO_APK_DIV_SHIFT ; + parent = priv->vpll0_hz; +break ; +default : +return -ENOENT ; + } + +return DIV_TO_RATE (parent, div); +} + +static ulong rk3308_crypto_set_clk (struct rk3308_clk_priv *priv,ulong clk_id, +ulong hz) +{ +struct rk3308_cru *cru = priv->cru; +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (priv->vpll0_hz, hz); +assert (src_clk_div -1 <=31 ); + +/* +* select gpll as crypto clock source and +* set up dependent divisors for crypto clocks. +*/ +switch (clk_id) { +case SCLK_CRYPTO : +rk_clrsetreg (&cru->clksel_con[7 ], +CRYPTO_PLL_SEL_MASK |CRYPTO_DIV_MASK , +CRYPTO_PLL_SEL_VPLL0 <<CRYPTO_PLL_SEL_SHIFT | + (src_clk_div -1 ) <<CRYPTO_DIV_SHIFT ); +break ; +case SCLK_CRYPTO_APK : +rk_clrsetreg (&cru->clksel_con[7 ], +CRYPTO_APK_PLL_SEL_MASK |CRYPTO_APK_DIV_MASK , +CRYPTO_PLL_SEL_VPLL0 <<CRYPTO_APK_SEL_SHIFT | + (src_clk_div -1 ) <<CRYPTO_APK_DIV_SHIFT ); +break ; +default : +printf ("do not support this peri freq\n" ); +return -EINVAL ; + } + +return rk3308_crypto_get_clk (priv, clk_id); +} + +static ulong rk3308_clk_get_rate (struct clk *clk) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +ulong rate =0 ; + +debug ("%s id:%ld\n" , __func__, clk->id); + +switch (clk->id) { +case PLL_APLL : +case ARMCLK : + rate =rockchip_pll_get_rate (&rk3308_pll_clks[APLL ], + priv->cru,APLL ); +break ; +case PLL_DPLL : + rate =rockchip_pll_get_rate (&rk3308_pll_clks[DPLL ], + priv->cru,DPLL ); +break ; +case PLL_VPLL0 : + rate =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL0 ], + priv->cru,VPLL0 ); +break ; +case PLL_VPLL1 : + rate =rockchip_pll_get_rate (&rk3308_pll_clks[VPLL1 ], + priv->cru,VPLL1 ); +break ; +case HCLK_SDMMC : +case HCLK_EMMC : +case SCLK_SDMMC : +case SCLK_EMMC : +case SCLK_EMMC_SAMPLE : + rate =rk3308_mmc_get_clk (clk); +break ; +case SCLK_I2C0 : +case SCLK_I2C1 : +case SCLK_I2C2 : +case SCLK_I2C3 : + rate =rk3308_i2c_get_clk (clk); +break ; +case SCLK_SARADC : + rate =rk3308_saradc_get_clk (clk); +break ; +case SCLK_TSADC : + rate =rk3308_tsadc_get_clk (clk); +break ; +case SCLK_SPI0 : +case SCLK_SPI1 : + rate =rk3308_spi_get_clk (clk); +break ; +case SCLK_PWM0 : + rate =rk3308_pwm_get_clk (clk); +break ; +case DCLK_VOP : + rate =rk3308_vop_get_clk (clk); +break ; +case ACLK_BUS : +case HCLK_BUS : +case PCLK_BUS : +case PCLK_WDT : + rate =rk3308_bus_get_clk (priv, clk->id); +break ; +case ACLK_PERI : +case HCLK_PERI : +case PCLK_PERI : + rate =rk3308_peri_get_clk (priv, clk->id); +break ; +case HCLK_AUDIO : +case PCLK_AUDIO : + rate =rk3308_audio_get_clk (priv, clk->id); +break ; +case SCLK_CRYPTO : +case SCLK_CRYPTO_APK : + rate =rk3308_crypto_get_clk (priv, clk->id); +break ; +default : +return -ENOENT ; + } + +return rate; +} + +static ulong rk3308_clk_set_rate (struct clk *clk,ulong rate) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); +ulong ret =0 ; + +debug ("%s %ld %ld\n" , __func__, clk->id, rate); + +switch (clk->id) { +case PLL_DPLL : + ret =rockchip_pll_set_rate (&rk3308_pll_clks[DPLL ], priv->cru, +DPLL , rate); + priv->dpll_hz =rockchip_pll_get_rate (&rk3308_pll_clks[DPLL ], + priv->cru,DPLL ); +break ; +case ARMCLK : +if (priv->armclk_hz) +rk3308_armclk_set_clk (priv, rate); + priv->armclk_hz = rate; +break ; +case HCLK_SDMMC : +case HCLK_EMMC : +case SCLK_SDMMC : +case SCLK_EMMC : + ret =rk3308_mmc_set_clk (clk, rate); +break ; +case SCLK_I2C0 : +case SCLK_I2C1 : +case SCLK_I2C2 : +case SCLK_I2C3 : + ret =rk3308_i2c_set_clk (clk, rate); +break ; +case SCLK_MAC : + ret =rk3308_mac_set_clk (clk, rate); +break ; +case SCLK_MAC_RMII : + ret =rk3308_mac_set_speed_clk (clk, rate); +break ; +case SCLK_SARADC : + ret =rk3308_saradc_set_clk (clk, rate); +break ; +case SCLK_TSADC : + ret =rk3308_tsadc_set_clk (clk, rate); +break ; +case SCLK_SPI0 : +case SCLK_SPI1 : + ret =rk3308_spi_set_clk (clk, rate); +break ; +case SCLK_PWM0 : + ret =rk3308_pwm_set_clk (clk, rate); +break ; +case DCLK_VOP : + ret =rk3308_vop_set_clk (clk, rate); +break ; +case ACLK_BUS : +case HCLK_BUS : +case PCLK_BUS : + rate =rk3308_bus_set_clk (priv, clk->id, rate); +break ; +case ACLK_PERI : +case HCLK_PERI : +case PCLK_PERI : + rate =rk3308_peri_set_clk (priv, clk->id, rate); +break ; +case HCLK_AUDIO : +case PCLK_AUDIO : + rate =rk3308_audio_set_clk (priv, clk->id, rate); +break ; +case SCLK_CRYPTO : +case SCLK_CRYPTO_APK : + ret =rk3308_crypto_set_clk (priv, clk->id, rate); +break ; +default : +return -ENOENT ; + } + +return ret; +} + +#if CONFIG_IS_ENABLED (OF_CONTROL ) && !CONFIG_IS_ENABLED (OF_PLATDATA ) +static int __maybe_unused rk3308_mac_set_parent (struct clk *clk,struct clk *parent) +{ +struct rk3308_clk_priv *priv =dev_get_priv (clk->dev); + +/* +* If the requested parent is in the same clock-controller and +* the id is SCLK_MAC_SRC, switch to the internal clock. +*/ +if (parent->id ==SCLK_MAC_SRC ) { +debug ("%s: switching RMII to SCLK_MAC\n" , __func__); +rk_clrreg (&priv->cru->clksel_con[43 ],BIT (14 )); + }else { +debug ("%s: switching RMII to CLKIN\n" , __func__); +rk_setreg (&priv->cru->clksel_con[43 ],BIT (14 )); + } + +return 0 ; +} + +static int __maybe_unused rk3308_clk_set_parent (struct clk *clk,struct clk *parent) +{ +switch (clk->id) { +case SCLK_MAC : +return rk3308_mac_set_parent (clk, parent); +default : +break ; + } + +debug ("%s: unsupported clk %ld\n" , __func__, clk->id); +return -ENOENT ; +} +#endif + +static struct clk_ops rk3308_clk_ops = { + .get_rate = rk3308_clk_get_rate, + .set_rate = rk3308_clk_set_rate, +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) + .set_parent = rk3308_clk_set_parent, +#endif +}; + +static void rk3308_clk_init (struct udevice *dev) +{ +struct rk3308_clk_priv *priv =dev_get_priv (dev); +int ret; + +if (rockchip_pll_get_rate (&rk3308_pll_clks[APLL ], + priv->cru,APLL ) !=APLL_HZ ) { + ret =rk3308_armclk_set_clk (priv,APLL_HZ ); +if (ret <0 ) +printf ("%s failed to set armclk rate\n" , __func__); + } + +rk3308_clk_get_pll_rate (priv); + +rk3308_bus_set_clk (priv,ACLK_BUS ,BUS_ACLK_HZ ); +rk3308_bus_set_clk (priv,HCLK_BUS ,BUS_HCLK_HZ ); +rk3308_bus_set_clk (priv,PCLK_BUS ,BUS_PCLK_HZ ); + +rk3308_peri_set_clk (priv,ACLK_PERI ,PERI_ACLK_HZ ); +rk3308_peri_set_clk (priv,HCLK_PERI ,PERI_HCLK_HZ ); +rk3308_peri_set_clk (priv,PCLK_PERI ,PERI_PCLK_HZ ); + +rk3308_audio_set_clk (priv,HCLK_AUDIO ,AUDIO_HCLK_HZ ); +rk3308_audio_set_clk (priv,PCLK_AUDIO ,AUDIO_PCLK_HZ ); +} + +static int rk3308_clk_probe (struct udevice *dev) +{ +int ret; + +rk3308_clk_init (dev); + +/* Process 'assigned-{clocks/clock-parents/clock-rates}' properties */ + ret =clk_set_defaults (dev); +if (ret) +debug ("%s clk_set_defaults failed %d\n" , __func__, ret); + +return ret; +} + +static int rk3308_clk_ofdata_to_platdata (struct udevice *dev) +{ +struct rk3308_clk_priv *priv =dev_get_priv (dev); + + priv->cru =dev_read_addr_ptr (dev); + +return 0 ; +} + +static int rk3308_clk_bind (struct udevice *dev) +{ +int ret; +struct udevice *sys_child, *sf_child; +struct sysreset_reg *priv; +struct softreset_reg *sf_priv; + +/* The reset driver does not have a device node, so bind it here */ + ret =device_bind_driver (dev,"rockchip_sysreset" ,"sysreset" , + &sys_child); +if (ret) { +debug ("Warning: No sysreset driver: ret=%d\n" , ret); + }else { + priv =malloc (sizeof (struct sysreset_reg )); + priv->glb_srst_fst_value = offsetof(struct rk3308_cru , + glb_srst_fst); + priv->glb_srst_snd_value = offsetof(struct rk3308_cru , + glb_srst_snd); + sys_child->priv = priv; + } + + ret =device_bind_driver_to_node (dev,"rockchip_reset" ,"reset" , +dev_ofnode (dev), &sf_child); +if (ret) { +debug ("Warning: No rockchip reset driver: ret=%d\n" , ret); + }else { + sf_priv =malloc (sizeof (struct softreset_reg )); + sf_priv->sf_reset_offset = offsetof(struct rk3308_cru , + softrst_con[0]); + sf_priv->sf_reset_num =12 ; + sf_child->priv = sf_priv; + } + +return 0 ; +} + +static const struct udevice_id rk3308_clk_ids[] = { + { .compatible ="rockchip,rk3308-cru" }, + { } +}; + +U_BOOT_DRIVER (rockchip_rk3308_cru) = { + .name ="rockchip_rk3308_cru" , + .id =UCLASS_CLK , + .of_match = rk3308_clk_ids, + .priv_auto_alloc_size =sizeof (struct rk3308_clk_priv ), + .ofdata_to_platdata = rk3308_clk_ofdata_to_platdata, + .ops = &rk3308_clk_ops, + .bind = rk3308_clk_bind, + .probe = rk3308_clk_probe, +};include/dt-bindings/clock/rk3308-cru.h new file +387
-0@@ -0,0 +1,387 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 Rockchip Electronics Co. Ltd. +* Author: Finley Xiao <[email protected]> +*/ + +#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3308_H +#define _DT_BINDINGS_CLK_ROCKCHIP_RK3308_H + +/* core clocks */ +#define PLL_APLL 1 +#define PLL_DPLL 2 +#define PLL_VPLL0 3 +#define PLL_VPLL1 4 +#define ARMCLK 5 + +/* sclk (special clocks) */ +#define USB480M 14 +#define SCLK_RTC32K 15 +#define SCLK_PVTM_CORE 16 +#define SCLK_UART0 17 +#define SCLK_UART1 18 +#define SCLK_UART2 19 +#define SCLK_UART3 20 +#define SCLK_UART4 21 +#define SCLK_I2C0 22 +#define SCLK_I2C1 23 +#define SCLK_I2C2 24 +#define SCLK_I2C3 25 +#define SCLK_PWM0 26 +#define SCLK_SPI0 27 +#define SCLK_SPI1 28 +#define SCLK_SPI2 29 +#define SCLK_TIMER0 30 +#define SCLK_TIMER1 31 +#define SCLK_TIMER2 32 +#define SCLK_TIMER3 33 +#define SCLK_TIMER4 34 +#define SCLK_TIMER5 35 +#define SCLK_TSADC 36 +#define SCLK_SARADC 37 +#define SCLK_OTP 38 +#define SCLK_OTP_USR 39 +#define SCLK_CPU_BOOST 40 +#define SCLK_CRYPTO 41 +#define SCLK_CRYPTO_APK 42 +#define SCLK_NANDC_DIV 43 +#define SCLK_NANDC_DIV50 44 +#define SCLK_NANDC 45 +#define SCLK_SDMMC_DIV 46 +#define SCLK_SDMMC_DIV50 47 +#define SCLK_SDMMC 48 +#define SCLK_SDMMC_DRV 49 +#define SCLK_SDMMC_SAMPLE 50 +#define SCLK_SDIO_DIV 51 +#define SCLK_SDIO_DIV50 52 +#define SCLK_SDIO 53 +#define SCLK_SDIO_DRV 54 +#define SCLK_SDIO_SAMPLE 55 +#define SCLK_EMMC_DIV 56 +#define SCLK_EMMC_DIV50 57 +#define SCLK_EMMC 58 +#define SCLK_EMMC_DRV 59 +#define SCLK_EMMC_SAMPLE 60 +#define SCLK_SFC 61 +#define SCLK_OTG_ADP 62 +#define SCLK_MAC_SRC 63 +#define SCLK_MAC 64 +#define SCLK_MAC_REF 65 +#define SCLK_MAC_RX_TX 66 +#define SCLK_MAC_RMII 67 +#define SCLK_DDR_MON_TIMER 68 +#define SCLK_DDR_MON 69 +#define SCLK_DDRCLK 70 +#define SCLK_PMU 71 +#define SCLK_USBPHY_REF 72 +#define SCLK_WIFI 73 +#define SCLK_PVTM_PMU 74 +#define SCLK_PDM 75 +#define SCLK_I2S0_8CH_TX 76 +#define SCLK_I2S0_8CH_TX_OUT 77 +#define SCLK_I2S0_8CH_RX 78 +#define SCLK_I2S0_8CH_RX_OUT 79 +#define SCLK_I2S1_8CH_TX 80 +#define SCLK_I2S1_8CH_TX_OUT 81 +#define SCLK_I2S1_8CH_RX 82 +#define SCLK_I2S1_8CH_RX_OUT 83 +#define SCLK_I2S2_8CH_TX 84 +#define SCLK_I2S2_8CH_TX_OUT 85 +#define SCLK_I2S2_8CH_RX 86 +#define SCLK_I2S2_8CH_RX_OUT 87 +#define SCLK_I2S3_8CH_TX 88 +#define SCLK_I2S3_8CH_TX_OUT 89 +#define SCLK_I2S3_8CH_RX 90 +#define SCLK_I2S3_8CH_RX_OUT 91 +#define SCLK_I2S0_2CH 92 +#define SCLK_I2S0_2CH_OUT 93 +#define SCLK_I2S1_2CH 94 +#define SCLK_I2S1_2CH_OUT 95 +#define SCLK_SPDIF_TX_DIV 96 +#define SCLK_SPDIF_TX_DIV50 97 +#define SCLK_SPDIF_TX 98 +#define SCLK_SPDIF_RX_DIV 99 +#define SCLK_SPDIF_RX_DIV50 100 +#define SCLK_SPDIF_RX 101 +#define SCLK_I2S0_8CH_TX_MUX 102 +#define SCLK_I2S0_8CH_RX_MUX 103 +#define SCLK_I2S1_8CH_TX_MUX 104 +#define SCLK_I2S1_8CH_RX_MUX 105 +#define SCLK_I2S2_8CH_TX_MUX 106 +#define SCLK_I2S2_8CH_RX_MUX 107 +#define SCLK_I2S3_8CH_TX_MUX 108 +#define SCLK_I2S3_8CH_RX_MUX 109 +#define SCLK_I2S0_8CH_TX_SRC 110 +#define SCLK_I2S0_8CH_RX_SRC 111 +#define SCLK_I2S1_8CH_TX_SRC 112 +#define SCLK_I2S1_8CH_RX_SRC 113 +#define SCLK_I2S2_8CH_TX_SRC 114 +#define SCLK_I2S2_8CH_RX_SRC 115 +#define SCLK_I2S3_8CH_TX_SRC 116 +#define SCLK_I2S3_8CH_RX_SRC 117 +#define SCLK_I2S0_2CH_SRC 118 +#define SCLK_I2S1_2CH_SRC 119 +#define SCLK_PWM1 120 +#define SCLK_PWM2 121 +#define SCLK_OWIRE 122 + +/* dclk */ +#define DCLK_VOP 125 + +/* aclk */ +#define ACLK_BUS_SRC 130 +#define ACLK_BUS 131 +#define ACLK_PERI_SRC 132 +#define ACLK_PERI 133 +#define ACLK_MAC 134 +#define ACLK_CRYPTO 135 +#define ACLK_VOP 136 +#define ACLK_GIC 137 +#define ACLK_DMAC0 138 +#define ACLK_DMAC1 139 + +/* hclk */ +#define HCLK_BUS 150 +#define HCLK_PERI 151 +#define HCLK_AUDIO 152 +#define HCLK_NANDC 153 +#define HCLK_SDMMC 154 +#define HCLK_SDIO 155 +#define HCLK_EMMC 156 +#define HCLK_SFC 157 +#define HCLK_OTG 158 +#define HCLK_HOST 159 +#define HCLK_HOST_ARB 160 +#define HCLK_PDM 161 +#define HCLK_SPDIFTX 162 +#define HCLK_SPDIFRX 163 +#define HCLK_I2S0_8CH 164 +#define HCLK_I2S1_8CH 165 +#define HCLK_I2S2_8CH 166 +#define HCLK_I2S3_8CH 167 +#define HCLK_I2S0_2CH 168 +#define HCLK_I2S1_2CH 169 +#define HCLK_VAD 170 +#define HCLK_CRYPTO 171 +#define HCLK_VOP 172 + +/* pclk */ +#define PCLK_BUS 190 +#define PCLK_DDR 191 +#define PCLK_PERI 192 +#define PCLK_PMU 193 +#define PCLK_AUDIO 194 +#define PCLK_MAC 195 +#define PCLK_ACODEC 196 +#define PCLK_UART0 197 +#define PCLK_UART1 198 +#define PCLK_UART2 199 +#define PCLK_UART3 200 +#define PCLK_UART4 201 +#define PCLK_I2C0 202 +#define PCLK_I2C1 203 +#define PCLK_I2C2 204 +#define PCLK_I2C3 205 +#define PCLK_PWM0 206 +#define PCLK_SPI0 207 +#define PCLK_SPI1 208 +#define PCLK_SPI2 209 +#define PCLK_SARADC 210 +#define PCLK_TSADC 211 +#define PCLK_TIMER 212 +#define PCLK_OTP_NS 213 +#define PCLK_WDT 214 +#define PCLK_GPIO0 215 +#define PCLK_GPIO1 216 +#define PCLK_GPIO2 217 +#define PCLK_GPIO3 218 +#define PCLK_GPIO4 219 +#define PCLK_SGRF 220 +#define PCLK_GRF 221 +#define PCLK_USBSD_DET 222 +#define PCLK_DDR_UPCTL 223 +#define PCLK_DDR_MON 224 +#define PCLK_DDRPHY 225 +#define PCLK_DDR_STDBY 226 +#define PCLK_USB_GRF 227 +#define PCLK_CRU 228 +#define PCLK_OTP_PHY 229 +#define PCLK_CPU_BOOST 230 +#define PCLK_PWM1 231 +#define PCLK_PWM2 232 +#define PCLK_CAN 233 +#define PCLK_OWIRE 234 + +#define CLK_NR_CLKS (PCLK_OWIRE + 1) + +/* soft-reset indices */ + +/* cru_softrst_con0 */ +#define SRST_CORE0_PO 0 +#define SRST_CORE1_PO 1 +#define SRST_CORE2_PO 2 +#define SRST_CORE3_PO 3 +#define SRST_CORE0 4 +#define SRST_CORE1 5 +#define SRST_CORE2 6 +#define SRST_CORE3 7 +#define SRST_CORE0_DBG 8 +#define SRST_CORE1_DBG 9 +#define SRST_CORE2_DBG 10 +#define SRST_CORE3_DBG 11 +#define SRST_TOPDBG 12 +#define SRST_CORE_NOC 13 +#define SRST_STRC_A 14 +#define SRST_L2C 15 + +/* cru_softrst_con1 */ +#define SRST_DAP 16 +#define SRST_CORE_PVTM 17 +#define SRST_CORE_PRF 18 +#define SRST_CORE_GRF 19 +#define SRST_DDRUPCTL 20 +#define SRST_DDRUPCTL_P 22 +#define SRST_MSCH 23 +#define SRST_DDRMON_P 25 +#define SRST_DDRSTDBY_P 26 +#define SRST_DDRSTDBY 27 +#define SRST_DDRPHY 28 +#define SRST_DDRPHY_DIV 29 +#define SRST_DDRPHY_P 30 + +/* cru_softrst_con2 */ +#define SRST_BUS_NIU_H 32 +#define SRST_USB_NIU_P 33 +#define SRST_CRYPTO_A 34 +#define SRST_CRYPTO_H 35 +#define SRST_CRYPTO 36 +#define SRST_CRYPTO_APK 37 +#define SRST_VOP_A 38 +#define SRST_VOP_H 39 +#define SRST_VOP_D 40 +#define SRST_INTMEM_A 41 +#define SRST_ROM_H 42 +#define SRST_GIC_A 43 +#define SRST_UART0_P 44 +#define SRST_UART0 45 +#define SRST_UART1_P 46 +#define SRST_UART1 47 + +/* cru_softrst_con3 */ +#define SRST_UART2_P 48 +#define SRST_UART2 49 +#define SRST_UART3_P 50 +#define SRST_UART3 51 +#define SRST_UART4_P 52 +#define SRST_UART4 53 +#define SRST_I2C0_P 54 +#define SRST_I2C0 55 +#define SRST_I2C1_P 56 +#define SRST_I2C1 57 +#define SRST_I2C2_P 58 +#define SRST_I2C2 59 +#define SRST_I2C3_P 60 +#define SRST_I2C3 61 +#define SRST_PWM0_P 62 +#define SRST_PWM0 63 + +/* cru_softrst_con4 */ +#define SRST_SPI0_P 64 +#define SRST_SPI0 65 +#define SRST_SPI1_P 66 +#define SRST_SPI1 67 +#define SRST_SPI2_P 68 +#define SRST_SPI2 69 +#define SRST_SARADC_P 70 +#define SRST_TSADC_P 71 +#define SRST_TSADC 72 +#define SRST_TIMER0_P 73 +#define SRST_TIMER0 74 +#define SRST_TIMER1 75 +#define SRST_TIMER2 76 +#define SRST_TIMER3 77 +#define SRST_TIMER4 78 +#define SRST_TIMER5 79 + +/* cru_softrst_con5 */ +#define SRST_OTP_NS_P 80 +#define SRST_OTP_NS_SBPI 81 +#define SRST_OTP_NS_USR 82 +#define SRST_OTP_PHY_P 83 +#define SRST_OTP_PHY 84 +#define SRST_GPIO0_P 86 +#define SRST_GPIO1_P 87 +#define SRST_GPIO2_P 88 +#define SRST_GPIO3_P 89 +#define SRST_GPIO4_P 90 +#define SRST_GRF_P 91 +#define SRST_USBSD_DET_P 92 +#define SRST_PMU 93 +#define SRST_PMU_PVTM 94 +#define SRST_USB_GRF_P 95 + +/* cru_softrst_con6 */ +#define SRST_CPU_BOOST 96 +#define SRST_CPU_BOOST_P 97 +#define SRST_PWM1_P 98 +#define SRST_PWM1 99 +#define SRST_PWM2_P 100 +#define SRST_PWM2 101 +#define SRST_PERI_NIU_A 104 +#define SRST_PERI_NIU_H 105 +#define SRST_PERI_NIU_p 106 +#define SRST_USB2OTG_H 107 +#define SRST_USB2OTG 108 +#define SRST_USB2OTG_ADP 109 +#define SRST_USB2HOST_H 110 +#define SRST_USB2HOST_ARB_H 111 + +/* cru_softrst_con7 */ +#define SRST_USB2HOST_AUX_H 112 +#define SRST_USB2HOST_EHCI 113 +#define SRST_USB2HOST 114 +#define SRST_USBPHYPOR 115 +#define SRST_UTMI0 116 +#define SRST_UTMI1 117 +#define SRST_SDIO_H 118 +#define SRST_EMMC_H 119 +#define SRST_SFC_H 120 +#define SRST_SFC 121 +#define SRST_SD_H 122 +#define SRST_NANDC_H 123 +#define SRST_NANDC_N 124 +#define SRST_MAC_A 125 +#define SRST_CAN_P 126 +#define SRST_OWIRE_P 127 + +/* cru_softrst_con8 */ +#define SRST_AUDIO_NIU_H 128 +#define SRST_AUDIO_NIU_P 129 +#define SRST_PDM_H 130 +#define SRST_PDM_M 131 +#define SRST_SPDIFTX_H 132 +#define SRST_SPDIFTX_M 133 +#define SRST_SPDIFRX_H 134 +#define SRST_SPDIFRX_M 135 +#define SRST_I2S0_8CH_H 136 +#define SRST_I2S0_8CH_TX_M 137 +#define SRST_I2S0_8CH_RX_M 138 +#define SRST_I2S1_8CH_H 139 +#define SRST_I2S1_8CH_TX_M 140 +#define SRST_I2S1_8CH_RX_M 141 +#define SRST_I2S2_8CH_H 142 +#define SRST_I2S2_8CH_TX_M 143 + +/* cru_softrst_con9 */ +#define SRST_I2S2_8CH_RX_M 144 +#define SRST_I2S3_8CH_H 145 +#define SRST_I2S3_8CH_TX_M 146 +#define SRST_I2S3_8CH_RX_M 147 +#define SRST_I2S0_2CH_H 148 +#define SRST_I2S0_2CH_M 149 +#define SRST_I2S1_2CH_H 150 +#define SRST_I2S1_2CH_M 151 +#define SRST_VAD_H 152 +#define SRST_ACODEC_P 153 + +#endif
PATCH v2 3/9 arm: dts: rockchip: Add dts for rk3308 evb
In reply to Andy YanAdd dts for rk3308 evb, sync from the linux kernel upstream list [0].
[0]https://patchwork.kernel.org/patch/11201555/
---
Changes in v2: None
arch/arm/dts/Makefile | 3 + arch/arm/dts/rk3308-evb-u-boot.dtsi | 17 + arch/arm/dts/rk3308-evb.dts | 230 ++++ arch/arm/dts/rk3308-u-boot.dtsi | 25 + arch/arm/dts/rk3308.dtsi | 1829 +++++++++++++++++++++++++++ 5 files changed, 2104 insertions(+) create mode 100644 arch/arm/dts/rk3308-evb-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-evb.dts create mode 100644 arch/arm/dts/rk3308-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308.dtsi
arch/arm/dts/Makefile +3 -0
@@ -93,6 +93,9 @@ dtb-$(CONFIG_ROCKCHIP_RK3288) += \ rk3288-veyron-speedy.dtb \ rk3288-vyasa.dtb +dtb-$(CONFIG_ROCKCHIP_RK3308) += \ + rk3308-evb.dtb + dtb-$(CONFIG_ROCKCHIP_RK3328) += \ rk3328-evb.dtb \ rk3328-rock64.dtb
arch/arm/dts/rk3308-evb-u-boot.dtsi new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd + */ +#include "rk3308-u-boot.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &emmc; + }; +}; + +&uart4 { + u-boot,dm-pre-reloc; + clock-frequency = <24000000>; + status = "okay"; +};
arch/arm/dts/rk3308-evb.dts new file +230 -0
230 lines not on this page · raw message
arch/arm/dts/rk3308-u-boot.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + *(C) Copyright 2019 Rockchip Electronics Co., Ltd + */ + +&cru { + u-boot,dm-pre-reloc; +}; + +&dmc { + u-boot,dm-pre-reloc; +}; + +&emmc { + u-boot,dm-pre-reloc; +}; + +&grf { + u-boot,dm-pre-reloc; +}; + +&saradc { + u-boot,dm-pre-reloc; + status = "okay"; +};
arch/arm/dts/rk3308.dtsi new file +1829 -0
1,829 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/9 arm: dts: rockchip: Add dts for rk3308 evb
Quoted 6 lines · Andy Yan
Add dts for rk3308 evb, sync from the linux kernel upstream list [0].
[0]https://patchwork.kernel.org/patch/11201555/
Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 2,154 lines
---
Changes in v2: None
arch/arm/dts/Makefile | 3 + arch/arm/dts/rk3308-evb-u-boot.dtsi | 17 + arch/arm/dts/rk3308-evb.dts | 230 ++++ arch/arm/dts/rk3308-u-boot.dtsi | 25 + arch/arm/dts/rk3308.dtsi | 1829 +++++++++++++++++++++++++++ 5 files changed, 2104 insertions(+)create mode 100644
arch/arm/dts/rk3308-evb-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308-evb.dtscreate mode 100644arch/arm/dts/rk3308-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308.dtsiarch/arm/dts/Makefile +3
-0@@ -93,6 +93,9 @@ dtb-$(CONFIG_ROCKCHIP_RK3288) += \ rk3288-veyron-speedy.dtb \ rk3288-vyasa.dtb +dtb-$(CONFIG_ROCKCHIP_RK3308) += \ + rk3308-evb.dtb + dtb-$(CONFIG_ROCKCHIP_RK3328) += \ rk3328-evb.dtb \ rk3328-rock64.dtbarch/arm/dts/rk3308-evb-u-boot.dtsi new file +17
-0@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd + */ +#include "rk3308-u-boot.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &emmc; + }; +}; + +&uart4 { + u-boot,dm-pre-reloc; + clock-frequency = <24000000>; + status = "okay"; +};arch/arm/dts/rk3308-evb.dts new file +230
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * + */ + +/dts-v1/; +#include <dt-bindings/input/input.h> +#include "rk3308.dtsi" + +/ { + model = "Rockchip RK3308 EVB"; + compatible = "rockchip,rk3308-evb", "rockchip,rk3308"; + + chosen { + stdout-path = "serial4:1500000n8"; + }; + + adc-keys0 { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + func-key { + linux,code = <KEY_FN>; + label = "function"; + press-threshold-microvolt = <18000>; + }; + }; + + adc-keys1 { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <1800000>; + + esc-key { + linux,code = <KEY_MICMUTE>; + label = "micmute"; + press-threshold-microvolt = <1130000>; + }; + + home-key { + linux,code = <KEY_MODE>; + label = "mode"; + press-threshold-microvolt = <901000>; + }; + + menu-key { + linux,code = <KEY_PLAY>; + label = "play"; + press-threshold-microvolt = <624000>; + }; + + vol-down-key { + linux,code = <KEY_VOLUMEDOWN>; + label = "volume down"; + press-threshold-microvolt = <300000>; + }; + + vol-up-key { + linux,code = <KEY_VOLUMEUP>; + label = "volume up"; + press-threshold-microvolt = <18000>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&pwr_key>; + + power { + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; + linux,code = <KEY_POWER>; + label = "GPIO Key Power"; + wakeup-source; + debounce-interval = <100>; + }; + }; + + vcc12v_dcin: vcc12v-dcin { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc12v_dcin>; + }; + + vdd_core: vdd-core { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 1>; + regulator-name = "vdd_core"; + regulator-min-microvolt = <827000>; + regulator-max-microvolt = <1340000>; + regulator-always-on; + regulator-boot-on; + regulator-settling-time-up-us = <250>; + pwm-supply = <&vcc5v0_sys>; + }; + + vdd_log: vdd-log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + + vdd_1v0: vdd-1v0 { + compatible = "regulator-fixed"; + regulator-name = "vdd_1v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + vin-supply = <&vcc5v0_sys>; + }; + + vccio_sdio: vcc_1v8: vcc-1v8 { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_io>; + }; + + vcc_ddr: vcc-ddr { + compatible = "regulator-fixed"; + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_io: vcc-io { + compatible = "regulator-fixed"; + regulator-name = "vcc_io"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc5v0_sys>; + }; + + vccio_flash: vccio-flash { + compatible = "regulator-fixed"; + regulator-name = "vccio_flash"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc_io>; + }; + + vcc5v0_host: vcc5v0-host { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&usb_drv>; + regulator-name = "vbus_host"; + vin-supply = <&vcc5v0_sys>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_core>; +}; + +&saradc { + status = "okay"; + vref-supply = <&vcc_1v8>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; + + buttons { + pwr_key: pwr-key { + rockchip,pins = <0 RK_PA6 0 &pcfg_pull_up>; + }; + }; + + usb { + usb_drv: usb-drv { + rockchip,pins = <0 RK_PC5 0 &pcfg_pull_none>; + }; + }; + + sdio-pwrseq { + wifi_enable_h: wifi-enable-h { + rockchip,pins = <0 RK_PA2 0 &pcfg_pull_none>; + }; + }; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_pin_pull_down>; +}; + +&uart4 { + pinctrl-names = "default"; + pinctrl-0 = <&uart4_xfer>; + status = "okay"; +};arch/arm/dts/rk3308-u-boot.dtsi new file +25
-0@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + *(C) Copyright 2019 Rockchip Electronics Co., Ltd + */ + +&cru { + u-boot,dm-pre-reloc; +}; + +&dmc { + u-boot,dm-pre-reloc; +}; + +&emmc { + u-boot,dm-pre-reloc; +}; + +&grf { + u-boot,dm-pre-reloc; +}; + +&saradc { + u-boot,dm-pre-reloc; + status = "okay"; +};arch/arm/dts/rk3308.dtsi new file +1829
-0@@ -0,0 +1,1829 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + * + */ + +#include <dt-bindings/clock/rk3308-cru.h> +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/thermal/thermal.h> + +/ { + compatible = "rockchip,rk3308"; + + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + i2c0 = &i2c0; + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; + serial0 = &uart0; + serial1 = &uart1; + serial2 = &uart2; + serial3 = &uart3; + serial4 = &uart4; + spi0 = &spi0; + spi1 = &spi1; + spi2 = &spi2; + }; + + cpus { + #address-cells = <2>; + #size-cells = <0>; + + cpu0: cpu at 0 { + device_type = "cpu"; + compatible = "arm,cortex-a35", "arm,armv8"; + reg = <0x0 0x0>; + enable-method = "psci"; + clocks = <&cru ARMCLK>; + #cooling-cells = <2>; + dynamic-power-coefficient = <90>; + operating-points-v2 = <&cpu0_opp_table>; + cpu-idle-states = <&CPU_SLEEP>; + next-level-cache = <&l2>; + }; + + cpu1: cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a35", "arm,armv8"; + reg = <0x0 0x1>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + cpu-idle-states = <&CPU_SLEEP>; + next-level-cache = <&l2>; + }; + + cpu2: cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a35", "arm,armv8"; + reg = <0x0 0x2>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + cpu-idle-states = <&CPU_SLEEP>; + next-level-cache = <&l2>; + }; + + cpu3: cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a35", "arm,armv8"; + reg = <0x0 0x3>; + enable-method = "psci"; + operating-points-v2 = <&cpu0_opp_table>; + cpu-idle-states = <&CPU_SLEEP>; + next-level-cache = <&l2>; + }; + + idle-states { + entry-method = "psci"; + + CPU_SLEEP: cpu-sleep { + compatible = "arm,idle-state"; + local-timer-stop; + arm,psci-suspend-param = <0x0010000>; + entry-latency-us = <120>; + exit-latency-us = <250>; + min-residency-us = <900>; + }; + }; + + l2: l2-cache { + compatible = "cache"; + }; + }; + + cpu0_opp_table: cpu0-opp-table { + compatible = "operating-points-v2"; + opp-shared; + + opp-408000000 { + opp-hz = /bits/ 64 <408000000>; + opp-microvolt = <950000 950000 1340000>; + clock-latency-ns = <40000>; + opp-suspend; + }; + opp-600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <950000 950000 1340000>; + clock-latency-ns = <40000>; + }; + opp-816000000 { + opp-hz = /bits/ 64 <816000000>; + opp-microvolt = <1025000 1025000 1340000>; + clock-latency-ns = <40000>; + }; + opp-1008000000 { + opp-hz = /bits/ 64 <1008000000>; + opp-microvolt = <1125000 1125000 1340000>; + clock-latency-ns = <40000>; + }; + }; + + arm-pmu { + compatible = "arm,cortex-a53-pmu"; + interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; + interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; + }; + + mac_clkin: external-mac-clock { + compatible = "fixed-clock"; + clock-frequency = <50000000>; + clock-output-names = "mac_clkin"; + #clock-cells = <0>; + }; + + psci { + compatible = "arm,psci-1.0"; + method = "smc"; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>, + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; + }; + + xin24m: xin24m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "xin24m"; + }; + + grf: grf at ff000000 { + compatible = "rockchip,rk3308-grf", "syscon", "simple-mfd"; + reg = <0x0 0xff000000 0x0 0x10000>; + }; + + dmc: dmc at 0xff010000 { + compatible = "rockchip,rk3308-dmc"; + reg = <0x0 0xff010000 0x0 0x10000>; + }; + + detect_grf: syscon at ff00b000 { + compatible = "rockchip,rk3308-detect-grf", "syscon", "simple-mfd"; + reg = <0x0 0xff00b000 0x0 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + }; + + core_grf: syscon at ff00c000 { + compatible = "rockchip,rk3308-core-grf", "syscon", "simple-mfd"; + reg = <0x0 0xff00c000 0x0 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + }; + + i2c0: i2c at ff040000 { + compatible = "rockchip,rk3308-i2c", "rockchip,rk3399-i2c"; + reg = <0x0 0xff040000 0x0 0x1000>; + clocks = <&cru SCLK_I2C0>, <&cru PCLK_I2C0>; + clock-names = "i2c", "pclk"; + interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_xfer>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c1: i2c at ff050000 { + compatible = "rockchip,rk3308-i2c", "rockchip,rk3399-i2c"; + reg = <0x0 0xff050000 0x0 0x1000>; + clocks = <&cru SCLK_I2C1>, <&cru PCLK_I2C1>; + clock-names = "i2c", "pclk"; + interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_xfer>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c2: i2c at ff060000 { + compatible = "rockchip,rk3308-i2c", "rockchip,rk3399-i2c"; + reg = <0x0 0xff060000 0x0 0x1000>; + clocks = <&cru SCLK_I2C2>, <&cru PCLK_I2C2>; + clock-names = "i2c", "pclk"; + interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_xfer>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c3: i2c at ff070000 { + compatible = "rockchip,rk3308-i2c", "rockchip,rk3399-i2c"; + reg = <0x0 0xff070000 0x0 0x1000>; + clocks = <&cru SCLK_I2C3>, <&cru PCLK_I2C3>; + clock-names = "i2c", "pclk"; + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c3m0_xfer>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + wdt: watchdog at ff080000 { + compatible = "snps,dw-wdt"; + reg = <0x0 0xff080000 0x0 0x100>; + clocks = <&cru PCLK_WDT>; + interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + uart0: serial at ff0a0000 { + compatible = "rockchip,rk3308-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff0a0000 0x0 0x100>; + interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "disabled"; + }; + + uart1: serial at ff0b0000 { + compatible = "rockchip,rk3308-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff0b0000 0x0 0x100>; + interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&uart1_xfer &uart1_cts &uart1_rts>; + status = "disabled"; + }; + + uart2: serial at ff0c0000 { + compatible = "rockchip,rk3308-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff0c0000 0x0 0x100>; + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&uart2m0_xfer>; + status = "disabled"; + }; + + uart3: serial at ff0d0000 { + compatible = "rockchip,rk3308-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff0d0000 0x0 0x100>; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_UART3>, <&cru PCLK_UART3>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&uart3_xfer>; + status = "disabled"; + }; + + uart4: serial at ff0e0000 { + compatible = "rockchip,rk3308-uart", "snps,dw-apb-uart"; + reg = <0x0 0xff0e0000 0x0 0x100>; + interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_UART4>, <&cru PCLK_UART4>; + clock-names = "baudclk", "apb_pclk"; + reg-shift = <2>; + reg-io-width = <4>; + pinctrl-names = "default"; + pinctrl-0 = <&uart4_xfer &uart4_cts &uart4_rts>; + status = "disabled"; + }; + + spi0: spi at ff120000 { + compatible = "rockchip,rk3308-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff120000 0x0 0x1000>; + interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>; + clock-names = "spiclk", "apb_pclk"; + dmas = <&dmac0 0>, <&dmac0 1>; + dma-names = "tx", "rx"; + pinctrl-names = "default", "high_speed"; + pinctrl-0 = <&spi0_clk &spi0_csn0 &spi0_miso &spi0_mosi>; + pinctrl-1 = <&spi0_clk_hs &spi0_csn0 &spi0_miso_hs &spi0_mosi_hs>; + status = "disabled"; + }; + + spi1: spi at ff130000 { + compatible = "rockchip,rk3308-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff130000 0x0 0x1000>; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&cru SCLK_SPI1>, <&cru PCLK_SPI1>; + clock-names = "spiclk", "apb_pclk"; + dmas = <&dmac0 2>, <&dmac0 3>; + dma-names = "tx", "rx"; + pinctrl-names = "default", "high_speed"; + pinctrl-0 = <&spi1_clk &spi1_csn0 &spi1_miso &spi1_mosi>; + pinctrl-1 = <&spi1_clk_hs &spi1_csn0 &spi1_miso_hs &spi1_mosi_hs>; + status = "disabled"; + }; + + spi2: spi at ff140000 { + compatible = "rockchip,rk3308-spi", "rockchip,rk3066-spi"; + reg = <0x0 0xff140000 0x0 0x1000>; + interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&cru SCLK_SPI2>, <&cru PCLK_SPI2>; + clock-names = "spiclk", "apb_pclk"; + dmas = <&dmac1 16>, <&dmac1 17>; + dma-names = "tx", "rx"; + pinctrl-names = "default", "high_speed"; + pinctrl-0 = <&spi2_clk &spi2_csn0 &spi2_miso &spi2_mosi>; + pinctrl-1 = <&spi2_clk_hs &spi2_csn0 &spi2_miso_hs &spi2_mosi_hs>; + status = "disabled"; + }; + + pwm8: pwm at ff160000 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff160000 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm8_pin>; + clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm9: pwm at ff160010 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff160010 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm9_pin>; + clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm10: pwm at ff160020 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff160020 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm10_pin>; + clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm11: pwm at ff160030 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff160030 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm11_pin>; + clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm4: pwm at ff170000 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff170000 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm4_pin>; + clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm5: pwm at ff170010 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff170010 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm5_pin>; + clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm6: pwm at ff170020 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff170020 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm6_pin>; + clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm7: pwm at ff170030 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff170030 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm7_pin>; + clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm0: pwm at ff180000 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff180000 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm1: pwm at ff180010 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff180010 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm1_pin>; + clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm2: pwm at ff180020 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff180020 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pin>; + clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + pwm3: pwm at ff180030 { + compatible = "rockchip,rk3308-pwm", "rockchip,rk3328-pwm"; + reg = <0x0 0xff180030 0x0 0x10>; + #pwm-cells = <3>; + pinctrl-names = "default"; + pinctrl-0 = <&pwm3_pin>; + clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; + clock-names = "pwm", "pclk"; + status = "disabled"; + }; + + rktimer: rktimer at ff1a0000 { + compatible = "rockchip,rk3288-timer"; + reg = <0x0 0xff1a0000 0x0 0x20>; + interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_TIMER>, <&cru SCLK_TIMER0>; + clock-names = "pclk", "timer"; + }; + + saradc: saradc at ff1e0000 { + compatible = "rockchip,rk3308-saradc", "rockchip,rk3399-saradc"; + reg = <0x0 0xff1e0000 0x0 0x100>; + interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; + #io-channel-cells = <1>; + clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>; + clock-names = "saradc", "apb_pclk"; + resets = <&cru SRST_SARADC_P>; + reset-names = "saradc-apb"; + status = "disabled"; + }; + + amba { + compatible = "arm,amba-bus"; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + dmac0: dma-controller at ff2c0000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0x0 0xff2c0000 0x0 0x4000>; + interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + clocks = <&cru ACLK_DMAC0>; + clock-names = "apb_pclk"; + peripherals-req-type-burst; + }; + + dmac1: dma-controller at ff2d0000 { + compatible = "arm,pl330", "arm,primecell"; + reg = <0x0 0xff2d0000 0x0 0x4000>; + interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + #dma-cells = <1>; + clocks = <&cru ACLK_DMAC1>; + clock-names = "apb_pclk"; + peripherals-req-type-burst; + }; + }; + + i2s_2ch_0: i2s at ff350000 { + compatible = "rockchip,rk3308-i2s", "rockchip,rk3066-i2s"; + reg = <0x0 0xff350000 0x0 0x1000>; + interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_I2S0_2CH>, <&cru HCLK_I2S0_2CH>; + clock-names = "i2s_clk", "i2s_hclk"; + dmas = <&dmac1 8>, <&dmac1 9>; + dma-names = "tx", "rx"; + resets = <&cru SRST_I2S0_2CH_M>, <&cru SRST_I2S0_2CH_H>; + reset-names = "reset-m", "reset-h"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_2ch_0_sclk + &i2s_2ch_0_lrck + &i2s_2ch_0_sdi + &i2s_2ch_0_sdo>; + status = "disabled"; + }; + + i2s_2ch_1: i2s at ff360000 { + compatible = "rockchip,rk3308-i2s", "rockchip,rk3066-i2s"; + reg = <0x0 0xff360000 0x0 0x1000>; + interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_I2S1_2CH>, <&cru HCLK_I2S1_2CH>; + clock-names = "i2s_clk", "i2s_hclk"; + dmas = <&dmac1 11>; + dma-names = "rx"; + resets = <&cru SRST_I2S1_2CH_M>, <&cru SRST_I2S1_2CH_H>; + reset-names = "reset-m", "reset-h"; + status = "disabled"; + }; + + spdif_tx: spdif-tx at ff3a0000 { + compatible = "rockchip,rk3308-spdif", "rockchip,rk3328-spdif"; + reg = <0x0 0xff3a0000 0x0 0x1000>; + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_SPDIF_TX>, <&cru HCLK_SPDIFTX>; + clock-names = "mclk", "hclk"; + dmas = <&dmac1 13>; + dma-names = "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&spdif_out>; + status = "disabled"; + }; + + sdmmc: dwmmc at ff480000 { + compatible = "rockchip,rk3308-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff480000 0x0 0x4000>; + max-frequency = <150000000>; + bus-width = <4>; + clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>, + <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_det &sdmmc_bus4>; + status = "disabled"; + }; + + emmc: dwmmc at ff490000 { + compatible = "rockchip,rk3308-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff490000 0x0 0x4000>; + max-frequency = <150000000>; + bus-width = <8>; + clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>, + <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + + sdio: dwmmc at ff4a0000 { + compatible = "rockchip,rk3308-dw-mshc", "rockchip,rk3288-dw-mshc"; + reg = <0x0 0xff4a0000 0x0 0x4000>; + max-frequency = <150000000>; + bus-width = <4>; + clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>, + <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>; + clock-names = "biu", "ciu", "ciu-drv", "ciu-sample"; + fifo-depth = <0x100>; + interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&sdio_bus4 &sdio_cmd &sdio_clk>; + status = "disabled"; + }; + + cru: clock-controller at ff500000 { + compatible = "rockchip,rk3308-cru"; + reg = <0x0 0xff500000 0x0 0x1000>; + rockchip,grf = <&grf>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + gic: interrupt-controller at ff580000 { + compatible = "arm,gic-400"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + + reg = <0x0 0xff581000 0x0 0x1000>, + <0x0 0xff582000 0x0 0x2000>, + <0x0 0xff584000 0x0 0x2000>, + <0x0 0xff586000 0x0 0x2000>; + interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; + }; + + sram: sram at fff80000 { + compatible = "mmio-sram"; + reg = <0x0 0xfff80000 0x0 0x40000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x0 0xfff80000 0x40000>; + /* reserved for ddr dvfs and system suspend/resume */ + ddr-sram at 0 { + reg = <0x0 0x8000>; + }; + /* reserved for vad audio buffer */ + vad_sram: vad-sram at 8000 { + reg = <0x8000 0x38000>; + }; + }; + + pinctrl: pinctrl { + compatible = "rockchip,rk3308-pinctrl"; + rockchip,grf = <&grf>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + gpio0: gpio0 at ff220000 { + compatible = "rockchip,gpio-bank"; + reg = <0x0 0xff220000 0x0 0x100>; + interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO0>; + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio1: gpio1 at ff230000 { + compatible = "rockchip,gpio-bank"; + reg = <0x0 0xff230000 0x0 0x100>; + interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO1>; + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio2: gpio2 at ff240000 { + compatible = "rockchip,gpio-bank"; + reg = <0x0 0xff240000 0x0 0x100>; + interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO2>; + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio3: gpio3 at ff250000 { + compatible = "rockchip,gpio-bank"; + reg = <0x0 0xff250000 0x0 0x100>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO3>; + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio4: gpio4 at ff260000 { + compatible = "rockchip,gpio-bank"; + reg = <0x0 0xff260000 0x0 0x100>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO4>; + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + pcfg_pull_up: pcfg-pull-up { + bias-pull-up; + }; + + pcfg_pull_down: pcfg-pull-down { + bias-pull-down; + }; + + pcfg_pull_none: pcfg-pull-none { + bias-disable; + }; + + pcfg_pull_none_2ma: pcfg-pull-none-2ma { + bias-disable; + drive-strength = <2>; + }; + + pcfg_pull_up_2ma: pcfg-pull-up-2ma { + bias-pull-up; + drive-strength = <2>; + }; + + pcfg_pull_up_4ma: pcfg-pull-up-4ma { + bias-pull-up; + drive-strength = <4>; + }; + + pcfg_pull_none_4ma: pcfg-pull-none-4ma { + bias-disable; + drive-strength = <4>; + }; + + pcfg_pull_down_4ma: pcfg-pull-down-4ma { + bias-pull-down; + drive-strength = <4>; + }; + + pcfg_pull_none_8ma: pcfg-pull-none-8ma { + bias-disable; + drive-strength = <8>; + }; + + pcfg_pull_up_8ma: pcfg-pull-up-8ma { + bias-pull-up; + drive-strength = <8>; + }; + + pcfg_pull_none_12ma: pcfg-pull-none-12ma { + bias-disable; + drive-strength = <12>; + }; + + pcfg_pull_up_12ma: pcfg-pull-up-12ma { + bias-pull-up; + drive-strength = <12>; + }; + + pcfg_pull_none_smt: pcfg-pull-none-smt { + bias-disable; + input-schmitt-enable; + }; + + pcfg_output_high: pcfg-output-high { + output-high; + }; + + pcfg_output_low: pcfg-output-low { + output-low; + }; + + pcfg_input_high: pcfg-input-high { + bias-pull-up; + input-enable; + }; + + pcfg_input: pcfg-input { + input-enable; + }; + + i2c0 { + i2c0_xfer: i2c0-xfer { + rockchip,pins = + <1 RK_PD0 2 &pcfg_pull_none_smt>, + <1 RK_PD1 2 &pcfg_pull_none_smt>; + }; + }; + + i2c1 { + i2c1_xfer: i2c1-xfer { + rockchip,pins = + <0 RK_PB3 1 &pcfg_pull_none_smt>, + <0 RK_PB4 1 &pcfg_pull_none_smt>; + }; + }; + + i2c2 { + i2c2_xfer: i2c2-xfer { + rockchip,pins = + <2 RK_PA2 3 &pcfg_pull_none_smt>, + <2 RK_PA3 3 &pcfg_pull_none_smt>; + }; + }; + + i2c3-m0 { + i2c3m0_xfer: i2c3m0-xfer { + rockchip,pins = + <0 RK_PB7 2 &pcfg_pull_none_smt>, + <0 RK_PC0 2 &pcfg_pull_none_smt>; + }; + }; + + i2c3-m1 { + i2c3m1_xfer: i2c3m1-xfer { + rockchip,pins = + <3 RK_PB4 2 &pcfg_pull_none_smt>, + <3 RK_PB5 2 &pcfg_pull_none_smt>; + }; + }; + + i2c3-m2 { + i2c3m2_xfer: i2c3m2-xfer { + rockchip,pins = + <2 RK_PA1 3 &pcfg_pull_none_smt>, + <2 RK_PA0 3 &pcfg_pull_none_smt>; + }; + }; + + i2s_2ch_0 { + i2s_2ch_0_mclk: i2s-2ch-0-mclk { + rockchip,pins = + <4 RK_PB4 1 &pcfg_pull_none>; + }; + + i2s_2ch_0_sclk: i2s-2ch-0-sclk { + rockchip,pins = + <4 RK_PB5 1 &pcfg_pull_none>; + }; + + i2s_2ch_0_lrck: i2s-2ch-0-lrck { + rockchip,pins = + <4 RK_PB6 1 &pcfg_pull_none>; + }; + + i2s_2ch_0_sdo: i2s-2ch-0-sdo { + rockchip,pins = + <4 RK_PB7 1 &pcfg_pull_none>; + }; + + i2s_2ch_0_sdi: i2s-2ch-0-sdi { + rockchip,pins = + <4 RK_PC0 1 &pcfg_pull_none>; + }; + }; + + i2s_8ch_0 { + i2s_8ch_0_mclk: i2s-8ch-0-mclk { + rockchip,pins = + <2 RK_PA4 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sclktx: i2s-8ch-0-sclktx { + rockchip,pins = + <2 RK_PA5 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sclkrx: i2s-8ch-0-sclkrx { + rockchip,pins = + <2 RK_PA6 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_lrcktx: i2s-8ch-0-lrcktx { + rockchip,pins = + <2 RK_PA7 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_lrckrx: i2s-8ch-0-lrckrx { + rockchip,pins = + <2 RK_PB0 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdo0: i2s-8ch-0-sdo0 { + rockchip,pins = + <2 RK_PB1 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdo1: i2s-8ch-0-sdo1 { + rockchip,pins = + <2 RK_PB2 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdo2: i2s-8ch-0-sdo2 { + rockchip,pins = + <2 RK_PB3 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdo3: i2s-8ch-0-sdo3 { + rockchip,pins = + <2 RK_PB4 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdi0: i2s-8ch-0-sdi0 { + rockchip,pins = + <2 RK_PB5 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdi1: i2s-8ch-0-sdi1 { + rockchip,pins = + <2 RK_PB6 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdi2: i2s-8ch-0-sdi2 { + rockchip,pins = + <2 RK_PB7 1 &pcfg_pull_none>; + }; + + i2s_8ch_0_sdi3: i2s-8ch-0-sdi3 { + rockchip,pins = + <2 RK_PC0 1 &pcfg_pull_none>; + }; + }; + + i2s_8ch_1_m0 { + i2s_8ch_1_m0_mclk: i2s-8ch-1-m0-mclk { + rockchip,pins = + <1 RK_PA2 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sclktx: i2s-8ch-1-m0-sclktx { + rockchip,pins = + <1 RK_PA3 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sclkrx: i2s-8ch-1-m0-sclkrx { + rockchip,pins = + <1 RK_PA4 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_lrcktx: i2s-8ch-1-m0-lrcktx { + rockchip,pins = + <1 RK_PA5 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_lrckrx: i2s-8ch-1-m0-lrckrx { + rockchip,pins = + <1 RK_PA6 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sdo0: i2s-8ch-1-m0-sdo0 { + rockchip,pins = + <1 RK_PA7 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sdo1_sdi3: i2s-8ch-1-m0-sdo1-sdi3 { + rockchip,pins = + <1 RK_PB0 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sdo2_sdi2: i2s-8ch-1-m0-sdo2-sdi2 { + rockchip,pins = + <1 RK_PB1 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sdo3_sdi1: i2s-8ch-1-m0-sdo3_sdi1 { + rockchip,pins = + <1 RK_PB2 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m0_sdi0: i2s-8ch-1-m0-sdi0 { + rockchip,pins = + <1 RK_PB3 2 &pcfg_pull_none>; + }; + }; + + i2s_8ch_1_m1 { + i2s_8ch_1_m1_mclk: i2s-8ch-1-m1-mclk { + rockchip,pins = + <1 RK_PB4 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sclktx: i2s-8ch-1-m1-sclktx { + rockchip,pins = + <1 RK_PB5 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sclkrx: i2s-8ch-1-m1-sclkrx { + rockchip,pins = + <1 RK_PB6 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_lrcktx: i2s-8ch-1-m1-lrcktx { + rockchip,pins = + <1 RK_PB7 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_lrckrx: i2s-8ch-1-m1-lrckrx { + rockchip,pins = + <1 RK_PC0 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sdo0: i2s-8ch-1-m1-sdo0 { + rockchip,pins = + <1 RK_PC1 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sdo1_sdi3: i2s-8ch-1-m1-sdo1-sdi3 { + rockchip,pins = + <1 RK_PC2 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sdo2_sdi2: i2s-8ch-1-m1-sdo2-sdi2 { + rockchip,pins = + <1 RK_PC3 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sdo3_sdi1: i2s-8ch-1-m1-sdo3_sdi1 { + rockchip,pins = + <1 RK_PC4 2 &pcfg_pull_none>; + }; + + i2s_8ch_1_m1_sdi0: i2s-8ch-1-m1-sdi0 { + rockchip,pins = + <1 RK_PC5 2 &pcfg_pull_none>; + }; + }; + + pdm_m0 { + pdm_m0_clk: pdm-m0-clk { + rockchip,pins = + <1 RK_PA4 3 &pcfg_pull_none>; + }; + + pdm_m0_sdi0: pdm-m0-sdi0 { + rockchip,pins = + <1 RK_PB3 3 &pcfg_pull_none>; + }; + + pdm_m0_sdi1: pdm-m0-sdi1 { + rockchip,pins = + <1 RK_PB2 3 &pcfg_pull_none>; + }; + + pdm_m0_sdi2: pdm-m0-sdi2 { + rockchip,pins = + <1 RK_PB1 3 &pcfg_pull_none>; + }; + + pdm_m0_sdi3: pdm-m0-sdi3 { + rockchip,pins = + <1 RK_PB0 3 &pcfg_pull_none>; + }; + }; + + pdm_m1 { + pdm_m1_clk: pdm-m1-clk { + rockchip,pins = + <1 RK_PB6 4 &pcfg_pull_none>; + }; + + pdm_m1_sdi0: pdm-m1-sdi0 { + rockchip,pins = + <1 RK_PC5 4 &pcfg_pull_none>; + }; + + pdm_m1_sdi1: pdm-m1-sdi1 { + rockchip,pins = + <1 RK_PC4 4 &pcfg_pull_none>; + }; + + pdm_m1_sdi2: pdm-m1-sdi2 { + rockchip,pins = + <1 RK_PC3 4 &pcfg_pull_none>; + }; + + pdm_m1_sdi3: pdm-m1-sdi3 { + rockchip,pins = + <1 RK_PC2 4 &pcfg_pull_none>; + }; + }; + + pdm_m2 { + pdm_m2_clkm: pdm-m2-clkm { + rockchip,pins = + <2 RK_PA4 3 &pcfg_pull_none>; + }; + + pdm_m2_clk: pdm-m2-clk { + rockchip,pins = + <2 RK_PA6 2 &pcfg_pull_none>; + }; + + pdm_m2_sdi0: pdm-m2-sdi0 { + rockchip,pins = + <2 RK_PB5 2 &pcfg_pull_none>; + }; + + pdm_m2_sdi1: pdm-m2-sdi1 { + rockchip,pins = + <2 RK_PB6 2 &pcfg_pull_none>; + }; + + pdm_m2_sdi2: pdm-m2-sdi2 { + rockchip,pins = + <2 RK_PB7 2 &pcfg_pull_none>; + }; + + pdm_m2_sdi3: pdm-m2-sdi3 { + rockchip,pins = + <2 RK_PC0 2 &pcfg_pull_none>; + }; + }; + + spdif_in { + spdif_in: spdif-in { + rockchip,pins = + <0 RK_PC2 1 &pcfg_pull_none>; + }; + }; + + spdif_out { + spdif_out: spdif-out { + rockchip,pins = + <0 RK_PC1 1 &pcfg_pull_none>; + }; + }; + + tsadc { + tsadc_otp_gpio: tsadc-otp-gpio { + rockchip,pins = + <0 RK_PB2 0 &pcfg_pull_none>; + }; + + tsadc_otp_out: tsadc-otp-out { + rockchip,pins = + <0 RK_PB2 1 &pcfg_pull_none>; + }; + }; + + uart0 { + uart0_xfer: uart0-xfer { + rockchip,pins = + <2 RK_PA1 1 &pcfg_pull_up>, + <2 RK_PA0 1 &pcfg_pull_up>; + }; + + uart0_cts: uart0-cts { + rockchip,pins = + <2 RK_PA2 1 &pcfg_pull_none>; + }; + + uart0_rts: uart0-rts { + rockchip,pins = + <2 RK_PA3 1 &pcfg_pull_none>; + }; + + uart0_rts_gpio: uart0-rts-gpio { + rockchip,pins = + <2 RK_PA3 0 &pcfg_pull_none>; + }; + }; + + uart1 { + uart1_xfer: uart1-xfer { + rockchip,pins = + <1 RK_PD1 1 &pcfg_pull_up>, + <1 RK_PD0 1 &pcfg_pull_up>; + }; + + uart1_cts: uart1-cts { + rockchip,pins = + <1 RK_PC6 1 &pcfg_pull_none>; + }; + + uart1_rts: uart1-rts { + rockchip,pins = + <1 RK_PC7 1 &pcfg_pull_none>; + }; + }; + + uart2-m0 { + uart2m0_xfer: uart2m0-xfer { + rockchip,pins = + <1 RK_PC7 2 &pcfg_pull_up>, + <1 RK_PC6 2 &pcfg_pull_up>; + }; + }; + + uart2-m1 { + uart2m1_xfer: uart2m1-xfer { + rockchip,pins = + <4 RK_PD3 2 &pcfg_pull_up>, + <4 RK_PD2 2 &pcfg_pull_up>; + }; + }; + + uart3 { + uart3_xfer: uart3-xfer { + rockchip,pins = + <3 RK_PB5 4 &pcfg_pull_up>, + <3 RK_PB4 4 &pcfg_pull_up>; + }; + }; + + uart3-m1 { + uart3m1_xfer: uart3m1-xfer { + rockchip,pins = + <0 RK_PC2 3 &pcfg_pull_up>, + <0 RK_PC1 3 &pcfg_pull_up>; + }; + }; + + uart4 { + + uart4_xfer: uart4-xfer { + rockchip,pins = + <4 RK_PB1 1 &pcfg_pull_up>, + <4 RK_PB0 1 &pcfg_pull_up>; + }; + + uart4_cts: uart4-cts { + rockchip,pins = + <4 RK_PA6 1 &pcfg_pull_none>; + + }; + + uart4_rts: uart4-rts { + rockchip,pins = + <4 RK_PA7 1 &pcfg_pull_none>; + }; + + uart4_rts_gpio: uart4-rts-gpio { + rockchip,pins = + <4 RK_PA7 0 &pcfg_pull_none>; + }; + }; + + spi0 { + spi0_clk: spi0-clk { + rockchip,pins = + <2 RK_PA2 2 &pcfg_pull_up_4ma>; + }; + + spi0_csn0: spi0-csn0 { + rockchip,pins = + <2 RK_PA3 2 &pcfg_pull_up_4ma>; + }; + + spi0_miso: spi0-miso { + rockchip,pins = + <2 RK_PA0 2 &pcfg_pull_up_4ma>; + }; + + spi0_mosi: spi0-mosi { + rockchip,pins = + <2 RK_PA1 2 &pcfg_pull_up_4ma>; + }; + + spi0_clk_hs: spi0-clk-hs { + rockchip,pins = + <2 RK_PA2 2 &pcfg_pull_up_8ma>; + }; + + spi0_miso_hs: spi0-miso-hs { + rockchip,pins = + <2 RK_PA0 2 &pcfg_pull_up_8ma>; + }; + + spi0_mosi_hs: spi0-mosi-hs { + rockchip,pins = + <2 RK_PA1 2 &pcfg_pull_up_8ma>; + }; + + }; + + spi1 { + spi1_clk: spi1-clk { + rockchip,pins = + <3 RK_PB3 3 &pcfg_pull_up_4ma>; + }; + + spi1_csn0: spi1-csn0 { + rockchip,pins = + <3 RK_PB5 3 &pcfg_pull_up_4ma>; + }; + + spi1_miso: spi1-miso { + rockchip,pins = + <3 RK_PB2 3 &pcfg_pull_up_4ma>; + }; + + spi1_mosi: spi1-mosi { + rockchip,pins = + <3 RK_PB4 3 &pcfg_pull_up_4ma>; + }; + + spi1_clk_hs: spi1-clk-hs { + rockchip,pins = + <3 RK_PB3 3 &pcfg_pull_up_8ma>; + }; + + spi1_miso_hs: spi1-miso-hs { + rockchip,pins = + <3 RK_PB2 3 &pcfg_pull_up_8ma>; + }; + + spi1_mosi_hs: spi1-mosi-hs { + rockchip,pins = + <3 RK_PB4 3 &pcfg_pull_up_8ma>; + }; + }; + + spi1-m1 { + spi1m1_miso: spi1m1-miso { + rockchip,pins = + <2 RK_PA4 2 &pcfg_pull_up_4ma>; + }; + + spi1m1_mosi: spi1m1-mosi { + rockchip,pins = + <2 RK_PA5 2 &pcfg_pull_up_4ma>; + }; + + spi1m1_clk: spi1m1-clk { + rockchip,pins = + <2 RK_PA7 2 &pcfg_pull_up_4ma>; + }; + + spi1m1_csn0: spi1m1-csn0 { + rockchip,pins = + <2 RK_PB1 2 &pcfg_pull_up_4ma>; + }; + + spi1m1_miso_hs: spi1m1-miso-hs { + rockchip,pins = + <2 RK_PA4 2 &pcfg_pull_up_8ma>; + }; + + spi1m1_mosi_hs: spi1m1-mosi-hs { + rockchip,pins = + <2 RK_PA5 2 &pcfg_pull_up_8ma>; + }; + + spi1m1_clk_hs: spi1m1-clk-hs { + rockchip,pins = + <2 RK_PA7 2 &pcfg_pull_up_8ma>; + }; + + spi1m1_csn0_hs: spi1m1-csn0-hs { + rockchip,pins = + <2 RK_PB1 2 &pcfg_pull_up_8ma>; + }; + }; + + spi2 { + spi2_clk: spi2-clk { + rockchip,pins = + <1 RK_PD0 3 &pcfg_pull_up_4ma>; + }; + + spi2_csn0: spi2-csn0 { + rockchip,pins = + <1 RK_PD1 3 &pcfg_pull_up_4ma>; + }; + + spi2_miso: spi2-miso { + rockchip,pins = + <1 RK_PC6 3 &pcfg_pull_up_4ma>; + }; + + spi2_mosi: spi2-mosi { + rockchip,pins = + <1 RK_PC7 3 &pcfg_pull_up_4ma>; + }; + + spi2_clk_hs: spi2-clk-hs { + rockchip,pins = + <1 RK_PD0 3 &pcfg_pull_up_8ma>; + }; + + spi2_miso_hs: spi2-miso-hs { + rockchip,pins = + <1 RK_PC6 3 &pcfg_pull_up_8ma>; + }; + + spi2_mosi_hs: spi2-mosi-hs { + rockchip,pins = + <1 RK_PC7 3 &pcfg_pull_up_8ma>; + }; + }; + + sdmmc { + sdmmc_clk: sdmmc-clk { + rockchip,pins = + <4 RK_PD5 1 &pcfg_pull_none_4ma>; + }; + + sdmmc_cmd: sdmmc-cmd { + rockchip,pins = + <4 RK_PD4 1 &pcfg_pull_up_4ma>; + }; + + sdmmc_det: sdmmc-det { + rockchip,pins = + <0 RK_PA3 1 &pcfg_pull_up_4ma>; + }; + + sdmmc_pwren: sdmmc-pwren { + rockchip,pins = + <4 RK_PD6 1 &pcfg_pull_none_4ma>; + }; + + sdmmc_bus1: sdmmc-bus1 { + rockchip,pins = + <4 RK_PD0 1 &pcfg_pull_up_4ma>; + }; + + sdmmc_bus4: sdmmc-bus4 { + rockchip,pins = + <4 RK_PD0 1 &pcfg_pull_up_4ma>, + <4 RK_PD1 1 &pcfg_pull_up_4ma>, + <4 RK_PD2 1 &pcfg_pull_up_4ma>, + <4 RK_PD3 1 &pcfg_pull_up_4ma>; + }; + + sdmmc_gpio: sdmmc-gpio { + rockchip,pins = + <4 RK_PD0 0 &pcfg_pull_up_4ma>, + <4 RK_PD1 0 &pcfg_pull_up_4ma>, + <4 RK_PD2 0 &pcfg_pull_up_4ma>, + <4 RK_PD3 0 &pcfg_pull_up_4ma>, + <4 RK_PD4 0 &pcfg_pull_up_4ma>, + <4 RK_PD5 0 &pcfg_pull_up_4ma>, + <4 RK_PD6 0 &pcfg_pull_up_4ma>; + }; + }; + + sdio { + sdio_clk: sdio-clk { + rockchip,pins = + <4 RK_PA5 1 &pcfg_pull_none_8ma>; + }; + + sdio_cmd: sdio-cmd { + rockchip,pins = + <4 RK_PA4 1 &pcfg_pull_up_8ma>; + }; + + sdio_pwren: sdio-pwren { + rockchip,pins = + <0 RK_PA2 1 &pcfg_pull_none_8ma>; + }; + + sdio_wrpt: sdio-wrpt { + rockchip,pins = + <0 RK_PA1 1 &pcfg_pull_none_8ma>; + }; + + sdio_intn: sdio-intn { + rockchip,pins = + <0 RK_PA0 1 &pcfg_pull_none_8ma>; + }; + + sdio_bus1: sdio-bus1 { + rockchip,pins = + <4 RK_PA0 1 &pcfg_pull_up_8ma>; + }; + + sdio_bus4: sdio-bus4 { + rockchip,pins = + <4 RK_PA0 1 &pcfg_pull_up_8ma>, + <4 RK_PA1 1 &pcfg_pull_up_8ma>, + <4 RK_PA2 1 &pcfg_pull_up_8ma>, + <4 RK_PA3 1 &pcfg_pull_up_8ma>; + }; + + sdio_gpio: sdio-gpio { + rockchip,pins = + <4 RK_PA0 0 &pcfg_pull_up_4ma>, + <4 RK_PA1 0 &pcfg_pull_up_4ma>, + <4 RK_PA2 0 &pcfg_pull_up_4ma>, + <4 RK_PA3 0 &pcfg_pull_up_4ma>, + <4 RK_PA4 0 &pcfg_pull_up_4ma>, + <4 RK_PA5 0 &pcfg_pull_up_4ma>; + }; + }; + + emmc { + emmc_clk: emmc-clk { + rockchip,pins = + <3 RK_PB1 2 &pcfg_pull_none_8ma>; + }; + + emmc_cmd: emmc-cmd { + rockchip,pins = + <3 RK_PB0 2 &pcfg_pull_up_8ma>; + }; + + emmc_pwren: emmc-pwren { + rockchip,pins = + <3 RK_PB3 2 &pcfg_pull_none>; + }; + + emmc_rstn: emmc-rstn { + rockchip,pins = + <3 RK_PB2 2 &pcfg_pull_none>; + }; + + emmc_bus1: emmc-bus1 { + rockchip,pins = + <3 RK_PA0 2 &pcfg_pull_up_8ma>; + }; + + emmc_bus4: emmc-bus4 { + rockchip,pins = + <3 RK_PA0 2 &pcfg_pull_up_8ma>, + <3 RK_PA1 2 &pcfg_pull_up_8ma>, + <3 RK_PA2 2 &pcfg_pull_up_8ma>, + <3 RK_PA3 2 &pcfg_pull_up_8ma>; + }; + + emmc_bus8: emmc-bus8 { + rockchip,pins = + <3 RK_PA0 2 &pcfg_pull_up_8ma>, + <3 RK_PA1 2 &pcfg_pull_up_8ma>, + <3 RK_PA2 2 &pcfg_pull_up_8ma>, + <3 RK_PA3 2 &pcfg_pull_up_8ma>, + <3 RK_PA4 2 &pcfg_pull_up_8ma>, + <3 RK_PA5 2 &pcfg_pull_up_8ma>, + <3 RK_PA6 2 &pcfg_pull_up_8ma>, + <3 RK_PA7 2 &pcfg_pull_up_8ma>; + }; + }; + + flash { + flash_csn0: flash-csn0 { + rockchip,pins = + <3 RK_PB5 1 &pcfg_pull_none>; + }; + + flash_rdy: flash-rdy { + rockchip,pins = + <3 RK_PB4 1 &pcfg_pull_none>; + }; + + flash_ale: flash-ale { + rockchip,pins = + <3 RK_PB3 1 &pcfg_pull_none>; + }; + + flash_cle: flash-cle { + rockchip,pins = + <3 RK_PB1 1 &pcfg_pull_none>; + }; + + flash_wrn: flash-wrn { + rockchip,pins = + <3 RK_PB0 1 &pcfg_pull_none>; + }; + + flash_rdn: flash-rdn { + rockchip,pins = + <3 RK_PB2 1 &pcfg_pull_none>; + }; + + flash_bus8: flash-bus8 { + rockchip,pins = + <3 RK_PA0 1 &pcfg_pull_up_12ma>, + <3 RK_PA1 1 &pcfg_pull_up_12ma>, + <3 RK_PA2 1 &pcfg_pull_up_12ma>, + <3 RK_PA3 1 &pcfg_pull_up_12ma>, + <3 RK_PA4 1 &pcfg_pull_up_12ma>, + <3 RK_PA5 1 &pcfg_pull_up_12ma>, + <3 RK_PA6 1 &pcfg_pull_up_12ma>, + <3 RK_PA7 1 &pcfg_pull_up_12ma>; + }; + }; + + pwm0 { + pwm0_pin: pwm0-pin { + rockchip,pins = + <0 RK_PB5 1 &pcfg_pull_none>; + }; + + pwm0_pin_pull_down: pwm0-pin-pull-down { + rockchip,pins = + <0 RK_PB5 1 &pcfg_pull_down>; + }; + }; + + pwm1 { + pwm1_pin: pwm1-pin { + rockchip,pins = + <0 RK_PB6 1 &pcfg_pull_none>; + }; + + pwm1_pin_pull_down: pwm1-pin-pull-down { + rockchip,pins = + <0 RK_PB6 1 &pcfg_pull_down>; + }; + }; + + pwm2 { + pwm2_pin: pwm2-pin { + rockchip,pins = + <0 RK_PB7 1 &pcfg_pull_none>; + }; + + pwm2_pin_pull_down: pwm2-pin-pull-down { + rockchip,pins = + <0 RK_PB7 1 &pcfg_pull_down>; + }; + }; + + pwm3 { + pwm3_pin: pwm3-pin { + rockchip,pins = + <0 RK_PC0 1 &pcfg_pull_none>; + }; + + pwm3_pin_pull_down: pwm3-pin-pull-down { + rockchip,pins = + <0 RK_PC0 1 &pcfg_pull_down>; + }; + }; + + pwm4 { + pwm4_pin: pwm4-pin { + rockchip,pins = + <0 RK_PA1 2 &pcfg_pull_none>; + }; + + pwm4_pin_pull_down: pwm4-pin-pull-down { + rockchip,pins = + <0 RK_PA1 2 &pcfg_pull_down>; + }; + }; + + pwm5 { + pwm5_pin: pwm5-pin { + rockchip,pins = + <0 RK_PC1 2 &pcfg_pull_none>; + }; + + pwm5_pin_pull_down: pwm5-pin-pull-down { + rockchip,pins = + <0 RK_PC1 2 &pcfg_pull_down>; + }; + }; + + pwm6 { + pwm6_pin: pwm6-pin { + rockchip,pins = + <0 RK_PC2 2 &pcfg_pull_none>; + }; + + pwm6_pin_pull_down: pwm6-pin-pull-down { + rockchip,pins = + <0 RK_PC2 2 &pcfg_pull_down>; + }; + }; + + pwm7 { + pwm7_pin: pwm7-pin { + rockchip,pins = + <2 RK_PB0 2 &pcfg_pull_none>; + }; + + pwm7_pin_pull_down: pwm7-pin-pull-down { + rockchip,pins = + <2 RK_PB0 2 &pcfg_pull_down>; + }; + }; + + pwm8 { + pwm8_pin: pwm8-pin { + rockchip,pins = + <2 RK_PB2 2 &pcfg_pull_none>; + }; + + pwm8_pin_pull_down: pwm8-pin-pull-down { + rockchip,pins = + <2 RK_PB2 2 &pcfg_pull_down>; + }; + }; + + pwm9 { + pwm9_pin: pwm9-pin { + rockchip,pins = + <2 RK_PB3 2 &pcfg_pull_none>; + }; + + pwm9_pin_pull_down: pwm9-pin-pull-down { + rockchip,pins = + <2 RK_PB3 2 &pcfg_pull_down>; + }; + }; + + pwm10 { + pwm10_pin: pwm10-pin { + rockchip,pins = + <2 RK_PB4 2 &pcfg_pull_none>; + }; + + pwm10_pin_pull_down: pwm10-pin-pull-down { + rockchip,pins = + <2 RK_PB4 2 &pcfg_pull_down>; + }; + }; + + pwm11 { + pwm11_pin: pwm11-pin { + rockchip,pins = + <2 RK_PC0 4 &pcfg_pull_none>; + }; + + pwm11_pin_pull_down: pwm11-pin-pull-down { + rockchip,pins = + <2 RK_PC0 4 &pcfg_pull_down>; + }; + }; + + gmac { + rmii_pins: rmii-pins { + rockchip,pins = + /* mac_txen */ + <1 RK_PC1 3 &pcfg_pull_none_12ma>, + /* mac_txd1 */ + <1 RK_PC3 3 &pcfg_pull_none_12ma>, + /* mac_txd0 */ + <1 RK_PC2 3 &pcfg_pull_none_12ma>, + /* mac_rxd0 */ + <1 RK_PC4 3 &pcfg_pull_none>, + /* mac_rxd1 */ + <1 RK_PC5 3 &pcfg_pull_none>, + /* mac_rxer */ + <1 RK_PB7 3 &pcfg_pull_none>, + /* mac_rxdv */ + <1 RK_PC0 3 &pcfg_pull_none>, + /* mac_mdio */ + <1 RK_PB6 3 &pcfg_pull_none>, + /* mac_mdc */ + <1 RK_PB5 3 &pcfg_pull_none>; + }; + + mac_refclk_12ma: mac-refclk-12ma { + rockchip,pins = + <1 RK_PB4 3 &pcfg_pull_none_12ma>; + }; + + mac_refclk: mac-refclk { + rockchip,pins = + <1 RK_PB4 3 &pcfg_pull_none>; + }; + }; + + gmac-m1 { + rmiim1_pins: rmiim1-pins { + rockchip,pins = + /* mac_txen */ + <4 RK_PB7 2 &pcfg_pull_none_12ma>, + /* mac_txd1 */ + <4 RK_PA5 2 &pcfg_pull_none_12ma>, + /* mac_txd0 */ + <4 RK_PA4 2 &pcfg_pull_none_12ma>, + /* mac_rxd0 */ + <4 RK_PA2 2 &pcfg_pull_none>, + /* mac_rxd1 */ + <4 RK_PA3 2 &pcfg_pull_none>, + /* mac_rxer */ + <4 RK_PA0 2 &pcfg_pull_none>, + /* mac_rxdv */ + <4 RK_PA1 2 &pcfg_pull_none>, + /* mac_mdio */ + <4 RK_PB6 2 &pcfg_pull_none>, + /* mac_mdc */ + <4 RK_PB5 2 &pcfg_pull_none>; + }; + + macm1_refclk_12ma: macm1-refclk-12ma { + rockchip,pins = + <4 RK_PB4 2 &pcfg_pull_none_12ma>; + }; + + macm1_refclk: macm1-refclk { + rockchip,pins = + <4 RK_PB4 2 &pcfg_pull_none>; + }; + }; + + rtc { + rtc_32k: rtc-32k { + rockchip,pins = + <0 RK_PC3 1 &pcfg_pull_none>; + }; + }; + + }; +};
PATCH v2 4/9 board: rockchip: Add rk3308 evb support
In reply to Andy YanAdd support for rk3308 evaluation board.
---
Changes in v2: None
arch/arm/mach-rockchip/rk3308/Kconfig | 8 +++ board/rockchip/evb_rk3308/Kconfig | 15 +++++ board/rockchip/evb_rk3308/MAINTAINERS | 6 ++ board/rockchip/evb_rk3308/Makefile | 7 +++ board/rockchip/evb_rk3308/evb_rk3308.c | 44 +++++++++++++++ configs/evb-rk3308_defconfig | 77 ++++++++++++++++++++++++++ include/configs/evb_rk3308.h | 20 +++++++ 7 files changed, 177 insertions(+) create mode 100644 board/rockchip/evb_rk3308/Kconfig create mode 100644 board/rockchip/evb_rk3308/MAINTAINERS create mode 100644 board/rockchip/evb_rk3308/Makefile create mode 100644 board/rockchip/evb_rk3308/evb_rk3308.c create mode 100644 configs/evb-rk3308_defconfig create mode 100644 include/configs/evb_rk3308.h
arch/arm/mach-rockchip/rk3308/Kconfig +8 -0
@@ -1,5 +1,9 @@ if ROCKCHIP_RK3308 +config TARGET_EVB_RK3308 + bool "EVB_RK3308" + select BOARD_LATE_INIT + config SYS_SOC default "rk3308"
@@ -11,4 +15,8 @@ config SPL_SERIAL_SUPPORT config ROCKCHIP_BOOT_MODE_REG default 0xff000500 + + +source "board/rockchip/evb_rk3308/Kconfig" + endif
board/rockchip/evb_rk3308/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_EVB_RK3308 + +config SYS_BOARD + default "evb_rk3308" + +config SYS_VENDOR + default "rockchip" + +config SYS_CONFIG_NAME + default "evb_rk3308" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/rockchip/evb_rk3308/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +EVB-RK3308 +M: Andy Yan <[email protected]> +S: Maintained +F: board/rockchip/evb_rk3308 +F: include/configs/evb_rk3308.h +F: configs/evb-rk3308_defconfig
board/rockchip/evb_rk3308/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += evb_rk3308.o
board/rockchip/evb_rk3308/evb_rk3308.c new file +44 -0
44 lines not on this page · raw message
configs/evb-rk3308_defconfig new file +77 -0
77 lines not on this page · raw message
include/configs/evb_rk3308.h new file +20 -0
@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd +*/ + +#ifndef __EVB_RK3308_H +#define __EVB_RK3308_H + +#include <configs/rk3308_common.h> + +#define CONFIG_SUPPORT_EMMC_RPMB +#define CONFIG_SYS_MMC_ENV_DEV 0 + +#define ROCKCHIP_DEVICE_SETTINGS \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" +#undef CONFIG_CONSOLE_SCROLL_LINES +#define CONFIG_CONSOLE_SCROLL_LINES 10 + +#endif
Signature · 1 line
2.17.1
PATCH v2 4/9 board: rockchip: Add rk3308 evb support
Quoted 3 lines · Andy Yan
Add support for rk3308 evaluation board.
Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 247 lines
---
Changes in v2: None
arch/arm/mach-rockchip/rk3308/Kconfig | 8 +++ board/rockchip/evb_rk3308/Kconfig | 15 +++++ board/rockchip/evb_rk3308/MAINTAINERS | 6 ++ board/rockchip/evb_rk3308/Makefile | 7 +++ board/rockchip/evb_rk3308/evb_rk3308.c | 44 +++++++++++++++ configs/evb-rk3308_defconfig | 77 ++++++++++++++++++++++++++ include/configs/evb_rk3308.h | 20 +++++++ 7 files changed, 177 insertions(+)create mode 100644 board/rockchip/evb_rk3308/Kconfig create mode 100644 board/rockchip/evb_rk3308/MAINTAINERS create mode 100644 board/rockchip/evb_rk3308/Makefile create mode 100644
board/rockchip/evb_rk3308/evb_rk3308.ccreate mode 100644 configs/evb-rk3308_defconfig create mode 100644include/configs/evb_rk3308.harch/arm/mach-rockchip/rk3308/Kconfig +8
-0@@ -1,5 +1,9 @@ if ROCKCHIP_RK3308 +config TARGET_EVB_RK3308 + bool "EVB_RK3308" + select BOARD_LATE_INIT + config SYS_SOC default "rk3308"@@ -11,4 +15,8 @@ config SPL_SERIAL_SUPPORT config ROCKCHIP_BOOT_MODE_REG default 0xff000500 + + +source "board/rockchip/evb_rk3308/Kconfig" + endifboard/rockchip/evb_rk3308/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_EVB_RK3308 + +config SYS_BOARD + default "evb_rk3308" + +config SYS_VENDOR + default "rockchip" + +config SYS_CONFIG_NAME + default "evb_rk3308" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endifboard/rockchip/evb_rk3308/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +EVB-RK3308 +M: Andy Yan <[email protected]> +S: Maintained +F: board/rockchip/evb_rk3308 +F: include/configs/evb_rk3308.h +F: configs/evb-rk3308_defconfigboard/rockchip/evb_rk3308/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += evb_rk3308.oboard/rockchip/evb_rk3308/evb_rk3308.c new file +44
-0@@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <adc.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define KEY_DOWN_MIN_VAL 0 +#define KEY_DOWN_MAX_VAL 30 + +/* +* Two board variants whith adc channel 3 is for board id +* v10: 1024, v11: 512 +* v10: adc channel 0 for dnl key +* v11: adc channel 1 for dnl key +*/ +int rockchip_dnl_key_pressed (void ) +{ +unsigned int key_val, id_val; +int key_ch; + +if (adc_channel_single_shot ("saradc" ,3 , &id_val)) { +printf ("%s read board id failed\n" , __func__); +return false; + } + +if (abs (id_val -1024 ) <=30 ) + key_ch =0 ; +else + key_ch =1 ; + +if (adc_channel_single_shot ("saradc" , key_ch, &key_val)) { +printf ("%s read adc key val failed\n" , __func__); +return false; + } + +if (key_val >=KEY_DOWN_MIN_VAL && key_val <=KEY_DOWN_MAX_VAL ) +return true; +else +return false; +}configs/evb-rk3308_defconfig new file +77
-0@@ -0,0 +1,77 @@ +CONFIG_ARM=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_SYS_TEXT_BASE=0x00600000 +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_ROCKCHIP_RK3308=y +CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_TARGET_EVB_RK3308=y +CONFIG_SPL_STACK_R_ADDR=0xc00000 +CONFIG_DEBUG_UART_BASE=0xFF0C0000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_DEBUG_UART=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_BOOTDELAY=0 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_SPL_STACK_R=y +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPT=y +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_MISC is not set +# CONFIG_DOS_PARTITION is not set +# CONFIG_ISO_PARTITION is not set +CONFIG_EFI_PARTITION_ENTRIES_NUMBERS=64 +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_LIVE=y +CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb" +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +CONFIG_REGMAP=y +CONFIG_SYSCON=y +CONFIG_CLK=y +# CONFIG_USB_FUNCTION_FASTBOOT is not set +CONFIG_ROCKCHIP_GPIO=y +CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY=y +CONFIG_PINCTRL=y +CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_PWM_ROCKCHIP=y +CONFIG_RAM=y +CONFIG_DM_RESET=y +CONFIG_BAUDRATE=1500000 +CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_DEBUG_UART_SKIP_INIT=y +CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_DWC2=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_SPL_TINY_MEMSET=y +CONFIG_LZ4=y +CONFIG_LZO=y +CONFIG_ERRNO_STR=y +# CONFIG_EFI_LOADER is not setinclude/configs/evb_rk3308.h new file +20
-0@@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2018 Rockchip Electronics Co., Ltd +*/ + +#ifndef __EVB_RK3308_H +#define __EVB_RK3308_H + +#include <configs/rk3308_common.h> + +#define CONFIG_SUPPORT_EMMC_RPMB +#define CONFIG_SYS_MMC_ENV_DEV 0 + +#define ROCKCHIP_DEVICE_SETTINGS \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0" +#undef CONFIG_CONSOLE_SCROLL_LINES +#define CONFIG_CONSOLE_SCROLL_LINES 10 + +#endif
PATCH v2 5/9 rockchip: rk3308: Add sdram driver
In reply to Andy YanA dm based dram driver for rk3308 u-boot
to get capacity.
---
Changes in v2: None
drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3308.c | 55 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 drivers/ram/rockchip/sdram_rk3308.c
drivers/ram/rockchip/Makefile +1 -0
@@ -9,5 +9,6 @@ obj-$(CONFIG_ROCKCHIP_RK3128) = sdram_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) = sdram_rk322x.o obj-$(CONFIG_ROCKCHIP_RK3288) = sdram_rk3288.o +obj-$(CONFIG_ROCKCHIP_RK3308) = sdram_rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) = sdram_rk3328.o obj-$(CONFIG_RAM_RK3399) += sdram_rk3399.o
drivers/ram/rockchip/sdram_rk3308.c new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 6/9 rockchip: mkimage: add support for RK3308
Usage:
(1) tools/mkimage -n rk3308 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
(2) cat spl/u-boot-spl.bin >> idbloader.img
(3) upgrade_tool wl 0x40 idbloader.img
Note:
When use a ddr binary from rkbin as tpl, use it replace u-boot-tpl.bin in (1)
---
Changes in v2: None
tools/rkcommon.c | 1 + 1 file changed, 1 insertion(+)
tools/rkcommon.c +1 -0
@@ -72,6 +72,7 @@ static struct spl_info spl_infos[] = { { "rk3188", "RK31", 0x8000 - 0x800, true }, { "rk322x", "RK32", 0x8000 - 0x1000, false }, { "rk3288", "RK32", 0x8000, false }, + { "rk3308", "RK33", 0x40000 - 0x1000, false}, { "rk3328", "RK32", 0x8000 - 0x1000, false }, { "rk3368", "RK33", 0x8000 - 0x1000, false }, { "rk3399", "RK33", 0x30000 - 0x2000, false },
Signature · 1 line
2.17.1
PATCH v2 6/9 rockchip: mkimage: add support for RK3308
Quoted 10 lines · Andy Yan
Usage:
(1)
tools/mkimage-n rk3308 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
(2) cat spl/u-boot-spl.bin >> idbloader.img
(3)upgrade_toolwl0x40idbloader.imgNote:
When use a ddr binary from rkbin as tpl, use it replace u-boot-tpl.bin in (1)Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 19 lines
---
Changes in v2: None
tools/rkcommon.c | 1 + 1 file changed, 1 insertion(+)tools/rkcommon.c +1
-0@@ -72,6 +72,7 @@ static struct spl_info spl_infos[] = { { "rk3188", "RK31", 0x8000 - 0x800, true }, { "rk322x", "RK32", 0x8000 - 0x1000, false }, { "rk3288", "RK32", 0x8000, false }, + { "rk3308", "RK33", 0x40000 - 0x1000, false}, { "rk3328", "RK32", 0x8000 - 0x1000, false }, { "rk3368", "RK33", 0x8000 - 0x1000, false }, { "rk3399", "RK33", 0x30000 - 0x2000, false },
PATCH v2 7/9 rockchip: rk3308: Add dts for ROC-RK3308-CC
In reply to Andy Yan---
Changes in v2: None
arch/arm/dts/Makefile | 3 +- arch/arm/dts/rk3308-roc-cc-u-boot.dtsi | 17 +++ arch/arm/dts/rk3308-roc-cc.dts | 190 +++++++++++++++++++++++++ 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/rk3308-roc-cc-u-boot.dtsi create mode 100644 arch/arm/dts/rk3308-roc-cc.dts
arch/arm/dts/Makefile +2 -1
@@ -94,7 +94,8 @@ dtb-$(CONFIG_ROCKCHIP_RK3288) += \ rk3288-vyasa.dtb dtb-$(CONFIG_ROCKCHIP_RK3308) += \ - rk3308-evb.dtb + rk3308-evb.dtb \ + rk3308-roc-cc.dtb dtb-$(CONFIG_ROCKCHIP_RK3328) += \ rk3328-evb.dtb \
arch/arm/dts/rk3308-roc-cc-u-boot.dtsi new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd + */ +#include "rk3308-u-boot.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &emmc; + }; +}; + +&uart2 { + u-boot,dm-pre-reloc; + clock-frequency = <24000000>; + status = "okay"; +};
arch/arm/dts/rk3308-roc-cc.dts new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 7/9 rockchip: rk3308: Add dts for ROC-RK3308-CC
Quoted 1 line · Andy Yan
Signed-off-by Andy Yan <[email protected]>
Please add commit message for patch.
Thanks,
- Kever
Quoted 244 lines
---
Changes in v2: None
arch/arm/dts/Makefile | 3 +- arch/arm/dts/rk3308-roc-cc-u-boot.dtsi | 17 +++ arch/arm/dts/rk3308-roc-cc.dts | 190 +++++++++++++++++++++++++ 3 files changed, 209 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/rk3308-roc-cc-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308-roc-cc.dtsarch/arm/dts/Makefile +2
-1@@ -94,7 +94,8 @@ dtb-$(CONFIG_ROCKCHIP_RK3288) += \ rk3288-vyasa.dtb dtb-$(CONFIG_ROCKCHIP_RK3308) += \ - rk3308-evb.dtb + rk3308-evb.dtb \ + rk3308-roc-cc.dtb dtb-$(CONFIG_ROCKCHIP_RK3328) += \ rk3328-evb.dtb \arch/arm/dts/rk3308-roc-cc-u-boot.dtsi new file +17
-0@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd + */ +#include "rk3308-u-boot.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &emmc; + }; +}; + +&uart2 { + u-boot,dm-pre-reloc; + clock-frequency = <24000000>; + status = "okay"; +};arch/arm/dts/rk3308-roc-cc.dts new file +190
-0@@ -0,0 +1,190 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd + */ + +/dts-v1/; +#include "rk3308.dtsi" + +/ { + model = "Firefly ROC-RK3308-CC board"; + compatible = "firefly,roc-rk3308-cc", "rockchip,rk3308"; + chosen { + stdout-path = "serial2:1500000n8"; + }; + + ir_rx { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_recv_pin>; + }; + + ir_tx { + compatible = "pwm-ir-tx"; + pwms = <&pwm5 0 25000 0>; + }; + + leds { + compatible = "gpio-leds"; + power { + label = "firefly:red:power"; + linux,default-trigger = "ir-power-click"; + default-state = "on"; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + }; + + user { + label = "firefly:blue:user"; + linux,default-trigger = "ir-user-click"; + default-state = "off"; + gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; + }; + }; + + typec_vcc5v: typec-vcc5v { + compatible = "regulator-fixed"; + regulator-name = "typec_vcc5v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc5v0_sys: vcc5v0-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&typec_vcc5v>; + }; + + vdd_core: vdd-core { + compatible = "pwm-regulator"; + pwms = <&pwm0 0 5000 1>; + regulator-name = "vdd_core"; + regulator-min-microvolt = <827000>; + regulator-max-microvolt = <1340000>; + regulator-init-microvolt = <1015000>; + regulator-always-on; + regulator-boot-on; + regulator-settling-time-up-us = <250>; + pwm-supply = <&vcc5v0_sys>; + }; + + vdd_log: vdd-log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_io: vcc-io { + compatible = "regulator-fixed"; + regulator-name = "vcc_io"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_sdmmc: vcc-sdmmc { + compatible = "regulator-gpio"; + regulator-name = "vcc_sdmmc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; + states = <1800000 0x0 + 3300000 0x1>; + vin-supply = <&vcc5v0_sys>; + }; + + vcc_sd: vcc-sd { + compatible = "regulator-fixed"; + gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_LOW>; + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + vim-supply = <&vcc_io>; + }; + +}; + +&cpu0 { + cpu-supply = <&vdd_core>; +}; + +&emmc { + bus-width = <8>; + cap-mmc-highspeed; + supports-emmc; + disable-wp; + non-removable; + num-slots = <1>; + status = "okay"; +}; + +&i2c1 { + clock-frequency = <400000>; + status = "okay"; + + rtc: rtc at 51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + #clock-cells = <0>; + }; +}; + +&pwm5 { + status = "okay"; + pinctrl-names = "active"; + pinctrl-0 = <&pwm5_pin_pull_down>; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&rtc_32k>; + + ir-receiver { + ir_recv_pin: ir-recv-pin { + rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + buttons { + pwr_key: pwr-key { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_pin_pull_down>; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + supports-sd; + card-detect-delay = <300>; + sd-uhs-sdr25; + sd-uhs-sdr50; + sd-uhs-sdr104; + vmmc-supply = <&vcc_sd>; + vqmmc-supply = <&vcc_sdmmc>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +};
PATCH v2 8/9 rockchip: rk3308: Add support for ROC-RK3308-CC board
In reply to Andy Yan---
Changes in v2:
- Add board ROC-rk3308-CC
arch/arm/mach-rockchip/rk3308/Kconfig | 5 ++ board/firefly/firefly-rk3308/Kconfig | 15 ++++ board/firefly/firefly-rk3308/MAINTAINERS | 5 ++ board/firefly/firefly-rk3308/Makefile | 7 ++ board/firefly/firefly-rk3308/roc_rk3308_cc.c | 82 ++++++++++++++++++++ configs/roc-rk3308-cc_defconfig | 77 ++++++++++++++++++ 6 files changed, 191 insertions(+) create mode 100644 board/firefly/firefly-rk3308/Kconfig create mode 100644 board/firefly/firefly-rk3308/MAINTAINERS create mode 100644 board/firefly/firefly-rk3308/Makefile create mode 100644 board/firefly/firefly-rk3308/roc_rk3308_cc.c create mode 100644 configs/roc-rk3308-cc_defconfig
arch/arm/mach-rockchip/rk3308/Kconfig +5 -0
@@ -4,6 +4,10 @@ config TARGET_EVB_RK3308 bool "EVB_RK3308" select BOARD_LATE_INIT +config TARGET_ROC_RK3308_CC + bool "Firefly roc-rk3308-cc" + select BOARD_LATE_INIT + config SYS_SOC default "rk3308"
@@ -18,5 +22,6 @@ config ROCKCHIP_BOOT_MODE_REG source "board/rockchip/evb_rk3308/Kconfig" +source "board/firefly/firefly-rk3308/Kconfig" endif
board/firefly/firefly-rk3308/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_ROC_RK3308_CC + +config SYS_BOARD + default "firefly-rk3308" + +config SYS_VENDOR + default "firefly" + +config SYS_CONFIG_NAME + default "evb_rk3308" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/firefly/firefly-rk3308/MAINTAINERS new file +5 -0
@@ -0,0 +1,5 @@ +ROC-RK3308-CC +M: Andy Yan <[email protected]> +S: Maintained +F: board/firefly/firefly-rk3308/roc_rk3308_cc.c +F: configs/roc-rk3308-cc_defconfig
board/firefly/firefly-rk3308/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += roc_rk3308_cc.o
board/firefly/firefly-rk3308/roc_rk3308_cc.c new file +82 -0
82 lines not on this page · raw message
configs/roc-rk3308-cc_defconfig new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 8/9 rockchip: rk3308: Add support for ROC-RK3308-CC board
Quoted 1 line · Andy Yan
Signed-off-by Andy Yan <[email protected]>
Please add commit message.
Quoted 46 lines
---
Changes in v2:
- Add board ROC-rk3308-CCarch/arm/mach-rockchip/rk3308/Kconfig | 5 ++ board/firefly/firefly-rk3308/Kconfig | 15 ++++ board/firefly/firefly-rk3308/MAINTAINERS | 5 ++ board/firefly/firefly-rk3308/Makefile | 7 ++ board/firefly/firefly-rk3308/roc_rk3308_cc.c | 82 ++++++++++++++++++++ configs/roc-rk3308-cc_defconfig | 77 ++++++++++++++++++ 6 files changed, 191 insertions(+)create mode 100644 board/firefly/firefly-rk3308/Kconfig create mode 100644 board/firefly/firefly-rk3308/MAINTAINERS create mode 100644 board/firefly/firefly-rk3308/Makefile create mode 100644
board/firefly/firefly-rk3308/roc_rk3308_cc.ccreate mode 100644 configs/roc-rk3308-cc_defconfigarch/arm/mach-rockchip/rk3308/Kconfig +5
-0@@ -4,6 +4,10 @@ config TARGET_EVB_RK3308 bool "EVB_RK3308" select BOARD_LATE_INIT +config TARGET_ROC_RK3308_CC + bool "Firefly roc-rk3308-cc" + select BOARD_LATE_INIT + config SYS_SOC default "rk3308"@@ -18,5 +22,6 @@ config ROCKCHIP_BOOT_MODE_REG source "board/rockchip/evb_rk3308/Kconfig" +source "board/firefly/firefly-rk3308/Kconfig" endifboard/firefly/firefly-rk3308/Kconfig new file +0
-0
board/firefly/firefly-rk3308/Kconfig line 4
Quoted 4 lines
board/firefly/firefly-rk3308/Kconfig new file +4
-0@@ -0,0 +1,15 @@ +if TARGET_ROC_RK3308_CC + +config SYS_BOARD + default "firefly-rk3308"
roc-rk3308-cc?
board/firefly/firefly-rk3308/Kconfig line 10
Quoted 6 lines
board/firefly/firefly-rk3308/Kconfig new file +6
-0+ +config SYS_VENDOR + default "firefly" + +config SYS_CONFIG_NAME + default "evb_rk3308"
This can update to firefly-rk3308?
Thanks,
- Kever
Quoted 200 lines
board/firefly/firefly-rk3308/Kconfig new file +5
-0+ +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endifboard/firefly/firefly-rk3308/MAINTAINERS new file +5
-0@@ -0,0 +1,5 @@ +ROC-RK3308-CC +M: Andy Yan <[email protected]> +S: Maintained +F: board/firefly/firefly-rk3308/roc_rk3308_cc.c +F: configs/roc-rk3308-cc_defconfigboard/firefly/firefly-rk3308/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# +# (C) Copyright 2018 Rockchip Electronics Co., Ltd +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += roc_rk3308_cc.oboard/firefly/firefly-rk3308/roc_rk3308_cc.c new file +82
-0@@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <adc.h> +#include <asm/io.h> +#include <asm/arch/grf_rk3308.h> +#include <asm/arch-rockchip/hardware.h> + +#if defined(CONFIG_DEBUG_UART ) +#define GRF_BASE 0xff000000 + +enum { +GPIO1C7_SHIFT =8 , +GPIO1C7_MASK =GENMASK (11 ,8 ), +GPIO1C7_GPIO =0 , +GPIO1C7_UART1_RTSN , +GPIO1C7_UART2_TX_M0 , +GPIO1C7_SPI2_MOSI , +GPIO1C7_JTAG_TMS , + +GPIO1C6_SHIFT =4 , +GPIO1C6_MASK =GENMASK (7 ,4 ), +GPIO1C6_GPIO =0 , +GPIO1C6_UART1_CTSN , +GPIO1C6_UART2_RX_M0 , +GPIO1C6_SPI2_MISO , +GPIO1C6_JTAG_TCLK , + +GPIO4D3_SHIFT =6 , +GPIO4D3_MASK =GENMASK (7 ,6 ), +GPIO4D3_GPIO =0 , +GPIO4D3_SDMMC_D3 , +GPIO4D3_UART2_TX_M1 , + +GPIO4D2_SHIFT =4 , +GPIO4D2_MASK =GENMASK (5 ,4 ), +GPIO4D2_GPIO =0 , +GPIO4D2_SDMMC_D2 , +GPIO4D2_UART2_RX_M1 , + +UART2_IO_SEL_SHIFT =2 , +UART2_IO_SEL_MASK =GENMASK (3 ,2 ), +UART2_IO_SEL_M0 =0 , +UART2_IO_SEL_M1 , +UART2_IO_SEL_USB , +}; + +void board_debug_uart_init (void ) +{ +static struct rk3308_grf *const grf = (void *)GRF_BASE ; + +/* Enable early UART2 channel m0 on the rk3308 */ +rk_clrsetreg (&grf->soc_con5,UART2_IO_SEL_MASK , +UART2_IO_SEL_M0 <<UART2_IO_SEL_SHIFT ); +rk_clrsetreg (&grf->gpio1ch_iomux, +GPIO1C6_MASK |GPIO1C7_MASK , +GPIO1C6_UART2_RX_M0 <<GPIO1C6_SHIFT | +GPIO1C7_UART2_TX_M0 <<GPIO1C7_SHIFT ); +} +#endif + +#define KEY_DOWN_MIN_VAL 0 +#define KEY_DOWN_MAX_VAL 30 + +int rockchip_dnl_key_pressed (void ) +{ +unsigned int val; + + +if (adc_channel_single_shot ("saradc" ,1 , &val)) { +printf ("%s read adc key val failed\n" , __func__); +return false; + } + +if (val >=KEY_DOWN_MIN_VAL && val <=KEY_DOWN_MAX_VAL ) +return true; +else +return false; +}configs/roc-rk3308-cc_defconfig new file +77
-0@@ -0,0 +1,77 @@ +CONFIG_ARM=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_SYS_TEXT_BASE=0x00600000 +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_ROCKCHIP_RK3308=y +CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y +CONFIG_TARGET_ROC_RK3308_CC=y +CONFIG_SPL_STACK_R_ADDR=0xc00000 +CONFIG_DEBUG_UART_BASE=0xFF0C0000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_DEBUG_UART=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_BOOTDELAY=0 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_SPL_STACK_R=y +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPT=y +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_MISC is not set +# CONFIG_DOS_PARTITION is not set +# CONFIG_ISO_PARTITION is not set +CONFIG_EFI_PARTITION_ENTRIES_NUMBERS=64 +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_LIVE=y +CONFIG_DEFAULT_DEVICE_TREE="rk3308-roc-cc" +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +CONFIG_REGMAP=y +CONFIG_SYSCON=y +CONFIG_CLK=y +# CONFIG_USB_FUNCTION_FASTBOOT is not set +CONFIG_ROCKCHIP_GPIO=y +CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_DM_ETH=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY=y +CONFIG_PINCTRL=y +CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_PWM_ROCKCHIP=y +CONFIG_RAM=y +CONFIG_DM_RESET=y +CONFIG_BAUDRATE=1500000 +CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_DEBUG_UART_SKIP_INIT=y +CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_DWC2=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_SPL_TINY_MEMSET=y +CONFIG_LZ4=y +CONFIG_LZO=y +CONFIG_ERRNO_STR=y +# CONFIG_EFI_LOADER is not set
PATCH v2 9/9 doc: rockchip: Add documentation for rk3308 based boards
In reply to Andy YanAdd build documentation for rk3308 based boards.
---
Changes in v2:
- Update doc/README.rockchip
doc/README.rockchip | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
doc/README.rockchip +19 -1
@@ -47,6 +47,11 @@ Two RK3036 boards are supported: - EVB RK3036 - use evb-rk3036 configuration - Kylin - use kylin_rk3036 configuration +Two RK3308 boards are supported: + + - EVB RK3308 - use evb-rk3308 configuration + - roc-RK3308-CC - use roc-rk3308-cc configuration + Two RK3328 board are supported: - EVB RK3328 - use evb-rk3328_defconfig
@@ -94,7 +99,20 @@ For example: (or you can use another cross compiler if you prefer) -2. To build RK3399 board: +2. To build RK3308 board: + - Get the rkbin + => git clone https://github.com/rockchip-linux/rkbin.git + + - Compile U-Boot + => cd /path/to/u-boot + => export BL31=/path/to/rkbin/bin/rk33/rk3308_bl31_v2.22.elf + => make roc-rk3308-cc_defconfig + => make CROSS_COMPILE=aarch64-linux-gnu- all + => make CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb + => ./tools/mkimage -n rk3308 -T rksd -d /path/to/rkbin/bin/rk33/rk3308_ddr_589MHz_uart2_m0_v1.26.bin idbloader.img + => cat spl/u-boot-spl.bin >> idbloader.img + +3. To build RK3399 board: Option 1: Package the image with Rockchip miniloader:
Signature · 1 line
2.17.1
PATCH v2 9/9 doc: rockchip: Add documentation for rk3308 based boards
Quoted 17 lines · Andy Yan
Add build documentation for rk3308 based boards.
Signed-off-by Andy Yan <[email protected]>---
Changes in v2:
- Update doc/README.rockchipdoc/README.rockchip | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)doc/README.rockchip +0
-0
doc/README.rockchip Two RK3036 boards are supported: · line 53
Quoted 7 lines
doc/README.rockchip +4
-0@@ -47,6 +47,11 @@ Two RK3036 boards are supported: - EVB RK3036 - use evb-rk3036 configuration - Kylin - use kylin_rk3036 configuration +Two RK3308 boards are supported: + + - EVB RK3308 - use evb-rk3308 configuration + - roc-RK3308-CC - use roc-rk3308-cc configuration
ROC-RK3308-CC
Thanks,
- Kever
Quoted 26 lines
doc/README.rockchip +15
-1+ Two RK3328 board are supported: - EVB RK3328 - use evb-rk3328_defconfig@@ -94,7 +99,20 @@ For example: (or you can use another cross compiler if you prefer) -2. To build RK3399 board: +2. To build RK3308 board: + - Get the rkbin + => git clone https://github.com/rockchip-linux/rkbin.git + + - Compile U-Boot + => cd /path/to/u-boot + => export BL31=/path/to/rkbin/bin/rk33/rk3308_bl31_v2.22.elf + => make roc-rk3308-cc_defconfig + => make CROSS_COMPILE=aarch64-linux-gnu- all + => make CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb + => ./tools/mkimage -n rk3308 -T rksd -d /path/to/rkbin/bin/rk33/rk3308_ddr_589MHz_uart2_m0_v1.26.bin idbloader.img + => cat spl/u-boot-spl.bin >> idbloader.img + +3. To build RK3399 board: Option 1: Package the image with Rockchip miniloader:
PATCH v2 5/9 rockchip: rk3308: Add sdram driver
In reply to Andy YanQuoted 4 lines · Andy Yan
A dm based dram driver for rk3308 u-boot
to get capacity.Signed-off-by Andy Yan <[email protected]>
Thanks,
- Kever
Quoted 81 lines
---
Changes in v2: None
drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3308.c | 55 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+)create mode 100644
drivers/ram/rockchip/sdram_rk3308.cdrivers/ram/rockchip/Makefile +1
-0@@ -9,5 +9,6 @@ obj-$(CONFIG_ROCKCHIP_RK3128) = sdram_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) = sdram_rk322x.o obj-$(CONFIG_ROCKCHIP_RK3288) = sdram_rk3288.o +obj-$(CONFIG_ROCKCHIP_RK3308) = sdram_rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) = sdram_rk3328.o obj-$(CONFIG_RAM_RK3399) += sdram_rk3399.odrivers/ram/rockchip/sdram_rk3308.c new file +55
-0@@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* +* (C) Copyright 2019 Rockchip Electronics Co., Ltd. +*/ + +#include <common.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/arch/grf_rk3308.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/sdram_common.h> + +struct dram_info { +struct ram_info info; +struct rk3308_grf *grf; +}; + +static int rk3308_dmc_probe (struct udevice *dev) +{ +struct dram_info *priv =dev_get_priv (dev); + + priv->grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); + priv->info.base =CONFIG_SYS_SDRAM_BASE ; + priv->info.size =rockchip_sdram_size ((phys_addr_t)&priv->grf->os_reg2); + +return 0 ; +} + +static int rk3308_dmc_get_info (struct udevice *dev,struct ram_info *info) +{ +struct dram_info *priv =dev_get_priv (dev); + + *info = priv->info; + +return 0 ; +} + +static struct ram_ops rk3308_dmc_ops = { + .get_info = rk3308_dmc_get_info, +}; + +static const struct udevice_id rk3308_dmc_ids[] = { + { .compatible ="rockchip,rk3308-dmc" }, + { } +}; + +U_BOOT_DRIVER (dmc_rk3308) = { + .name ="rockchip_rk3308_dmc" , + .id =UCLASS_RAM , + .of_match = rk3308_dmc_ids, + .ops = &rk3308_dmc_ops, + .probe = rk3308_dmc_probe, + .priv_auto_alloc_size =sizeof (struct dram_info ), +};
v2 cover Add support for RK3308 SOC
In reply to Andy YanQuoted 24 lines · Andy Yan
RK3308 is a quad Cortex A35 based SOC with rich audio interfaces(I2S/PCM/TDM/PDM/SPDIF/VAD/HDMI ARC), which designed for intelligent voice interaction and audio input/output processing.
This path set add basic support for it, test with a emmc board.
More boards support such as Firefly ROC-RK3308-CC will coming soon.
Changes in v2:
- Add board ROC-rk3308-CC
- Update doc/README.rockchipAndy Yan (8):
arm: rockchip: Add RK3308 SOC support
arm: dts: rockchip: Add dts for rk3308 evb
board: rockchip: Add rk3308 evb support
rockchip: rk3308: Add sdram driver
rockchip: mkimage: add support for RK3308
rockchip: rk3308: Add dts for ROC-RK3308-CC
rockchip: rk3308: Add support for ROC-RK3308-CC board
doc: rockchip: Add documentation for rk3308 based boards
Quoted 2 lines
Finley Xiao (1):
rockchip: clk: Add clk driver for rk3308
Applied to u-boot-rockchip master with rebase on TOF and some checkpatch warning fix.
Thanks,
- Kever
Quoted 70 lines
arch/arm/dts/Makefile | 4 + arch/arm/dts/rk3308-evb-u-boot.dtsi | 17 + arch/arm/dts/rk3308-evb.dts | 230 +++ arch/arm/dts/rk3308-roc-cc-u-boot.dtsi | 17 + arch/arm/dts/rk3308-roc-cc.dts | 190 ++ arch/arm/dts/rk3308-u-boot.dtsi | 25 + arch/arm/dts/rk3308.dtsi | 1829 +++++++++++++++++ arch/arm/include/asm/arch-rk3308/boot0.h | 11 + arch/arm/include/asm/arch-rk3308/cru_rk3308.h | 290 +++ arch/arm/include/asm/arch-rk3308/gpio.h | 11 + arch/arm/include/asm/arch-rk3308/grf_rk3308.h | 197 ++ arch/arm/mach-rockchip/Kconfig | 24 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3308/Kconfig | 27 + arch/arm/mach-rockchip/rk3308/Makefile | 9 + arch/arm/mach-rockchip/rk3308/clk_rk3308.c | 31 + arch/arm/mach-rockchip/rk3308/rk3308.c | 175 ++ arch/arm/mach-rockchip/rk3308/syscon_rk3308.c | 20 + board/firefly/firefly-rk3308/Kconfig | 15 + board/firefly/firefly-rk3308/MAINTAINERS | 5 + board/firefly/firefly-rk3308/Makefile | 7 + board/firefly/firefly-rk3308/roc_rk3308_cc.c | 82 + board/rockchip/evb_rk3308/Kconfig | 15 + board/rockchip/evb_rk3308/MAINTAINERS | 6 + board/rockchip/evb_rk3308/Makefile | 7 + board/rockchip/evb_rk3308/evb_rk3308.c | 44 + configs/evb-rk3308_defconfig | 77 + configs/roc-rk3308-cc_defconfig | 77 + doc/README.rockchip | 20 +- drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3308.c | 1078 ++++++++++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3308.c | 55 + include/configs/evb_rk3308.h | 20 + include/configs/rk3308_common.h | 58 + include/dt-bindings/clock/rk3308-cru.h | 387 ++++ tools/rkcommon.c | 1 + 37 files changed, 5063 insertions(+), 1 deletion(-)create mode 100644
arch/arm/dts/rk3308-evb-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308-evb.dts
create mode 100644arch/arm/dts/rk3308-roc-cc-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308-roc-cc.dtscreate mode 100644arch/arm/dts/rk3308-u-boot.dtsicreate mode 100644arch/arm/dts/rk3308.dtsi
create mode 100644arch/arm/include/asm/arch-rk3308/boot0.hcreate mode 100644arch/arm/include/asm/arch-rk3308/cru_rk3308.hcreate mode 100644arch/arm/include/asm/arch-rk3308/gpio.hcreate mode 100644arch/arm/include/asm/arch-rk3308/grf_rk3308.hcreate mode 100644arch/arm/mach-rockchip/rk3308/Kconfigcreate mode 100644arch/arm/mach-rockchip/rk3308/Makefilecreate mode 100644arch/arm/mach-rockchip/rk3308/clk_rk3308.ccreate mode 100644arch/arm/mach-rockchip/rk3308/rk3308.ccreate mode 100644arch/arm/mach-rockchip/rk3308/syscon_rk3308.ccreate mode 100644 board/firefly/firefly-rk3308/Kconfig create mode 100644 board/firefly/firefly-rk3308/MAINTAINERS create mode 100644 board/firefly/firefly-rk3308/Makefile create mode 100644board/firefly/firefly-rk3308/roc_rk3308_cc.ccreate mode 100644 board/rockchip/evb_rk3308/Kconfig create mode 100644 board/rockchip/evb_rk3308/MAINTAINERS create mode 100644 board/rockchip/evb_rk3308/Makefile create mode 100644board/rockchip/evb_rk3308/evb_rk3308.ccreate mode 100644 configs/evb-rk3308_defconfig create mode 100644 configs/roc-rk3308-cc_defconfig create mode 100644drivers/clk/rockchip/clk_rk3308.ccreate mode 100644drivers/ram/rockchip/sdram_rk3308.ccreate mode 100644include/configs/evb_rk3308.hcreate mode 100644include/configs/rk3308_common.hcreate mode 100644include/dt-bindings/clock/rk3308-cru.h