Add Rikomagic MK808 board
Subsystems (6)
v8 cover Add Rikomagic MK808 board
MK808 is a RK3066-based board with 1 USB host and 1 USB OTG port, HDMI and a micro-SD card slot. It also includes on-board NAND and 1GB of SDRAM.
===
Boot procedure flow for a Rockchip rk3066 SoC:
1.Read 2K SDRAM initialization image code to internal SRAM 2.Run image code to do SDRAM initialization 3.Transfer boot image code to SDRAM
4.Run boot image code
Supported system boot from the following devices:
Nand Flash
SPI nor Flash
eMMC device
UART interface
If all boot options fail then enter into BootROM mode on the USB OTG port. Unlike later SoC models the rk3066 BootROM doesn't have SDMMC support.
The size of a full U-boot binary is too large for the internal SDRAM memory. Of that 64k size only 32kb sram - 2kb bootrom is available for the first stage.
Similar to the already supported rk3188, the BootROM will attempt to load up the first stage image in two steps: first 1KB to offset 0x800 in the SRAM and
then the remainder to offset 0xc00 in the SRAM.
It always enters at offset 0x804 after a 4 ASCII character "RK30" header.
With CONFIG_TPL_ROCKCHIP_EARLYRETURN_TO_BROM=y this first stage is combined with the U-boot TPL binary (u-boot-tpl.bin).
For rk3066 with NAND flash and U-boot this gives the following stages:
- TPL: init external SDRAM
- SPL: init SDMMC and read U-boot from SD CARD.
- U-boot: read Linux kernel from SD CARD.
- Kernel
Additionally the rk3066 requires everything the BootROM loads to be RC4-encrypted.
===
Boot solution with full U-boot stored on SD CARD:
Compile commands(U-boot):
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make mk808_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make menuconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make all
===
Size of SPL and TPL must be aligned to 2kb.
If bricked and no BootROM mode shows up then connect pin 8 and 9 of the NAND flash with a needle while reconnecting to the USB OTG port to a PC.
===
Show connected devices with:
lsusb
Bus 001 Device 004: ID 2207:300a Fuzhou Rockchip Electronics Company RK3066 in Mask ROM mode
===
Program commands with ./flash.sh:
#!/bin/sh
printf "RK30" > tplspl.bin
dd if=u-boot-tpl.bin >> tplspl.bin
truncate -s %2048 tplspl.bin
truncate -s %2048 u-boot-spl.bin
../tools/boot_merger --verbose config-flash.ini
../tools/upgrade_tool ul ./RK30xxLoader_uboot.bin
===
config-flash.ini:
[CHIP_NAME]
NAME=RK30
[VERSION]
MAJOR=2
MINOR=21
[CODE471_OPTION]
NUM=1
Path1=30_LPDDR2_300MHz_DD.bin
[CODE472_OPTION]
NUM=1
Path1=rk30usbplug.bin
[LOADER_OPTION]
NUM=2
LOADER1=FlashData
LOADER2=FlashBoot
FlashData=tplspl.bin
FlashBoot=u-boot-spl.bin
[OUTPUT]
PATH=RK30xxLoader_uboot.bin
===
Partition Map for MMC device 0 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000040 0x00001f7f "loader1"
2 0x00004000 0x00005fff "loader2"
3 0x00006000 0x00007fff "trust"
4 0x00008000 0x0003ffff "boot"
5 0x00040000 0x00ed7fde "rootfs"
Make sure boot and esp flag are set for boot partition. Loader1 not used by
===
Boot partition:
extlinux -- extlinux.conf
zImage
rk3066a-mk808.dtb
===
extlinux.conf:
label kernel
kernel /zImage
fdt /rk3066a-mk808.dtb
append root=LABEL=linuxroot init=/sbin/init rootfstype=ext4 rootwait
===
Program commands (SD CARD with GPT partition):
sudo dd if=u-boot-dtb.img of=/dev/sda seek=16384
===
TODO:
Better program flow/tools
USB
NAND
etc etc
===
Johan Jonker (11):
rockchip: rk3066-power: sync power domain dt-binding header from Linux
arm: dts: rockchip: fix rk3xxx-u-boot.dtsi
arm: dts: rockchip: add rk3066a.dtsi
arm: dts: rockchip: add rk3066a-mk808.dts
rockchip: rk3066: add include
rockchip: rk3066: add rk3066_common.h include
rockchip: rk3066: add core support
rockchip: rk3066: add Rikomagic MK808 board
rockchip: rk3066: add mk808_defconfig
rockchip: tools: add rk3066 support to rkcommon.c
doc: rockchip: add rk3066 Rikomagic MK808
Paweł Jarosz (4):
rockchip: rk3066: add grf header file
rockchip: rk3066: add clock driver for rk3066 soc
rockchip: rk3066: add rk3066 pinctrl driver
rockchip: rk3066: add sdram driver
arch/arm/dts/Makefile | 3 + arch/arm/dts/rk3066a-mk808-u-boot.dtsi | 42 + arch/arm/dts/rk3066a-mk808.dts | 216 +++++ arch/arm/dts/rk3066a-u-boot.dtsi | 3 + arch/arm/dts/rk3066a.dtsi | 880 +++++++++++++++++ arch/arm/dts/rk3xxx-u-boot.dtsi | 8 +- arch/arm/include/asm/arch-rk3066/boot0.h | 8 + arch/arm/include/asm/arch-rk3066/gpio.h | 8 + arch/arm/include/asm/arch-rk3066/timer.h | 6 + .../include/asm/arch-rockchip/cru_rk3066.h | 157 +++ .../include/asm/arch-rockchip/grf_rk3066.h | 210 +++++ arch/arm/mach-rockchip/Kconfig | 23 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3066/Kconfig | 39 + arch/arm/mach-rockchip/rk3066/Makefile | 5 + arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 + arch/arm/mach-rockchip/rk3066/rk3066.c | 49 + arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 55 ++ board/rikomagic/mk808/Kconfig | 15 + board/rikomagic/mk808/MAINTAINERS | 6 + board/rikomagic/mk808/Makefile | 3 + board/rikomagic/mk808/mk808.c | 3 + configs/mk808_defconfig | 99 ++ doc/board/rockchip/rockchip.rst | 2 + drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 717 ++++++++++++++ drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3066.c | 113 +++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3066.c | 892 ++++++++++++++++++ include/configs/mk808.h | 9 + include/configs/rk3066_common.h | 56 ++ include/dt-bindings/power/rk3066-power.h | 22 + tools/rkcommon.c | 1 + 34 files changed, 3683 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/rk3066a-mk808-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 arch/arm/dts/rk3066a-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a.dtsi create mode 100644 arch/arm/include/asm/arch-rk3066/boot0.h create mode 100644 arch/arm/include/asm/arch-rk3066/gpio.h create mode 100644 arch/arm/include/asm/arch-rk3066/timer.h create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h create mode 100644 arch/arm/mach-rockchip/rk3066/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3066/Makefile create mode 100644 arch/arm/mach-rockchip/rk3066/clk_rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/syscon_rk3066.c create mode 100644 board/rikomagic/mk808/Kconfig create mode 100644 board/rikomagic/mk808/MAINTAINERS create mode 100644 board/rikomagic/mk808/Makefile create mode 100644 board/rikomagic/mk808/mk808.c create mode 100644 configs/mk808_defconfig create mode 100644 drivers/clk/rockchip/clk_rk3066.c create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3066.c create mode 100644 drivers/ram/rockchip/sdram_rk3066.c create mode 100644 include/configs/mk808.h create mode 100644 include/configs/rk3066_common.h create mode 100644 include/dt-bindings/power/rk3066-power.h
Signature · 1 line
2.20.1
PATCH v8 1/15 rockchip: rk3066-power: sync power domain dt-binding header from Linux
In order to update the DT for rk3066
sync the power domain dt-binding header.
This is the state as of v5.12 in Linux.
--- include/dt-bindings/power/rk3066-power.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 include/dt-bindings/power/rk3066-power.h
include/dt-bindings/power/rk3066-power.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __DT_BINDINGS_POWER_RK3066_POWER_H__ +#define __DT_BINDINGS_POWER_RK3066_POWER_H__ + +/* VD_CORE */ +#define RK3066_PD_A9_0 0 +#define RK3066_PD_A9_1 1 +#define RK3066_PD_DBG 4 +#define RK3066_PD_SCU 5 + +/* VD_LOGIC */ +#define RK3066_PD_VIDEO 6 +#define RK3066_PD_VIO 7 +#define RK3066_PD_GPU 8 +#define RK3066_PD_PERI 9 +#define RK3066_PD_CPU 10 +#define RK3066_PD_ALIVE 11 + +/* VD_PMU */ +#define RK3066_PD_RTC 12 + +#endif
Signature · 1 line
2.20.1
PATCH v8 2/15 rockchip: rk3066: add grf header file
In reply to Johan JonkerFrom: Paweł Jarosz <[email protected]>
grf is needed by various drivers for rk3066 soc.
---
Changed V8:
add GRF_GPIO3B_IOMUX for SDMMC0
use GENMASK, __bf_shf and REG defines
add includes
--- .../include/asm/arch-rockchip/grf_rk3066.h | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h
arch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +210 -0
@@ -0,0 +1,210 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2021 Paweł Jarosz <[email protected]> +*/ + +#ifndef _ASM_ARCH_GRF_RK3066_H +#define _ASM_ARCH_GRF_RK3066_H + +#include <linux/bitops.h> +#include <linux/bitfield.h> + +#define REG (name, h, l) \ + name##_MASK = GENMASK(h, l), \ + name##_SHIFT = __bf_shf(name##_MASK) + +struct rk3066_grf_gpio_lh { +u32 l; +u32 h; +}; + +struct rk3066_grf { +struct rk3066_grf_gpio_lh gpio_dir[7 ]; +struct rk3066_grf_gpio_lh gpio_do[7 ]; +struct rk3066_grf_gpio_lh gpio_en[7 ]; + +u32 gpio0a_iomux; +u32 gpio0b_iomux; +u32 gpio0c_iomux; +u32 gpio0d_iomux; + +u32 gpio1a_iomux; +u32 gpio1b_iomux; +u32 gpio1c_iomux; +u32 gpio1d_iomux; + +u32 gpio2a_iomux; +u32 gpio2b_iomux; +u32 gpio2c_iomux; +u32 gpio2d_iomux; + +u32 gpio3a_iomux; +u32 gpio3b_iomux; +u32 gpio3c_iomux; +u32 gpio3d_iomux; + +u32 gpio4a_iomux; +u32 gpio4b_iomux; +u32 gpio4c_iomux; +u32 gpio4d_iomux; + +u32 reserved0[5 ]; + +u32 gpio6b_iomux; + +u32 reserved1[2 ]; + +struct rk3066_grf_gpio_lh gpio_pull[7 ]; + +u32 soc_con0; +u32 soc_con1; +u32 soc_con2; + +u32 soc_status0; + +u32 dmac1_con[3 ]; +u32 dmac2_con[4 ]; + +u32 uoc0_con[3 ]; +u32 uoc1_con[4 ]; +u32 ddrc_con; +u32 ddrc_stat; + +u32 reserved2[10 ]; + +u32 os_reg[4 ]; +}; + +check_member (rk3066_grf, os_reg[3 ],0x01d4 ); + +/* GRF_GPIO1B_IOMUX */ +enum { + REG(GPIO1B1, 2, 2), +GPIO1B1_GPIO =0 , +GPIO1B1_UART2_SOUT , + + REG(GPIO1B0, 0, 0), +GPIO1B0_GPIO =0 , +GPIO1B0_UART2_SIN +}; + +/* GRF_GPIO3B_IOMUX */ +enum { + REG(GPIO3B6, 12, 12), +GPIO3B6_GPIO =0 , +GPIO3B6_SDMMC0_DECTN , + + REG(GPIO3B5, 10, 10), +GPIO3B5_GPIO =0 , +GPIO3B5_SDMMC0_DATA3 , + + REG(GPIO3B4, 8, 8), +GPIO3B4_GPIO =0 , +GPIO3B4_SDMMC0_DATA2 , + + REG(GPIO3B3, 6, 6), +GPIO3B3_GPIO =0 , +GPIO3B3_SDMMC0_DATA1 , + + REG(GPIO3B2, 4, 4), +GPIO3B2_GPIO =0 , +GPIO3B2_SDMMC0_DATA0 , + + REG(GPIO3B1, 2, 2), +GPIO3B1_GPIO =0 , +GPIO3B1_SDMMC0_CMD , + + REG(GPIO3B0, 0, 0), +GPIO3B0_GPIO =0 , +GPIO3B0_SDMMC0_CLKOUT , +}; + +/* GRF_SOC_CON0 */ +enum { + REG(SMC_MUX_CON, 13, 13), + + REG(NOC_REMAP, 12, 12), + + REG(EMMC_FLASH_SEL, 11, 11), + + REG(TZPC_REVISION, 10, 7), + + REG(L2CACHE_ACC, 6, 5), + + REG(L2RD_WAIT, 4, 3), + + REG(IMEMRD_WAIT, 2, 1), + + REG(SOC_REMAP, 0, 0), +}; + +/* GRF_SOC_CON1 */ +enum { + REG(RKI2C4_SEL, 15, 15), + + REG(RKI2C3_SEL, 14, 14), + + REG(RKI2C2_SEL, 13, 13), + + REG(RKI2C1_SEL, 12, 12), + + REG(RKI2C0_SEL, 11, 11), + + REG(VCODEC_SEL, 10, 10), + + REG(PERI_EMEM_PAUSE, 9, 9), + + REG(PERI_USB_PAUSE, 8, 8), + + REG(SMC_MUX_MODE_0, 6, 6), + + REG(SMC_SRAM_MW_0, 5, 4), + + REG(SMC_REMAP_0, 3, 3), + + REG(SMC_A_GT_M0_SYNC, 2, 2), + + REG(EMAC_SPEED, 1, 1), + + REG(EMAC_MODE, 0, 0), +}; + +/* GRF_SOC_CON2 */ +enum { + REG(MSCH4_MAINDDR3, 7, 7), +MSCH4_MAINDDR3_DDR3 =1 , + + REG(EMAC_NEWRCV_EN, 6, 6), + + REG(SW_ADDR15_EN, 5, 5), + + REG(SW_ADDR16_EN, 4, 4), + + REG(SW_ADDR17_EN, 3, 3), + + REG(BANK2_TO_RANK_EN, 2, 2), + + REG(RANK_TO_ROW15_EN, 1, 1), + + REG(UPCTL_C_ACTIVE_IN, 0, 0), +UPCTL_C_ACTIVE_IN_MAY =0 , +UPCTL_C_ACTIVE_IN_WILL , +}; + +/* GRF_DDRC_CON0 */ +enum { + REG(DTO_LB, 12, 11), + + REG(DTO_TE, 10, 9), + + REG(DTO_PDR, 8, 7), + + REG(DTO_PDD, 6, 5), + + REG(DTO_IOM, 4, 3), + + REG(DTO_OE, 2, 1), + + REG(ATO_AE, 0, 0), +}; +#endif
Signature · 1 line
2.20.1
PATCH v8 3/15 rockchip: rk3066: add clock driver for rk3066 soc
In reply to Johan JonkerFrom: Paweł Jarosz <[email protected]>
Add the clock driver for the rk3066 platform.
Derived from the rk3288 and rk3188 driver it supports only a bare minimum to bring up the system to reduce the TPL size for:
SDRAM clock configuration.
The boot devices NAND, EMMC, SDMMC, SPI.
A UART for the debug messages (fixed) at 115200n8. A SARADC for the recovery button.
A TIMER for the delays (fixed).
There's support for two possible frequencies,
the safe 600MHz which will work with default pmic settings and will be set to get away from the 24MHz default and the maximum of 1.416Ghz, which boards can set if they were able to get pmic support for it.
After the clock tree is set during the TPL probe
there's no parent update support.
In OF_REAL mode the drivers ns16550.c and dw-apb-timer.c obtain the (fixed) clk_get_rate from the clock driver instead of platdata.
The rk3066 cru node has a number of assigned-clocks properties that call the .set_rate() function. Add them to the list so that they return a 0 instead of -ENOENT.
---
Changed V8:
add SCLK_TIMER[0..2]
add SCLK_UART[0..3]
fix assigned-clocks
use GENMASK, __bf_shf and REG defines
fix clk defines
add includes
fix bit position CRU_CLKSEL0_CON rk3066 vs rk3188 fix comments
rename PLL_MODE defines
use dev_bind
use dev_dbg
use a different variable name
Changed V7:
changed function prefix
changed #if where possible
restyle U_BOOT_DRIVER structure
--- .../include/asm/arch-rockchip/cru_rk3066.h | 157 ++++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 717 ++++++++++++++++++ 3 files changed, 875 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h create mode 100644 drivers/clk/rockchip/clk_rk3066.c
arch/arm/include/asm/arch-rockchip/cru_rk3066.h new file +157 -0
@@ -0,0 +1,157 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2021 Paweł Jarosz <[email protected]> +*/ + +#ifndef _ASM_ARCH_CRU_RK3066_H +#define _ASM_ARCH_CRU_RK3066_H + +#include <linux/bitops.h> +#include <linux/bitfield.h> + +#define REG (name, h, l) \ + name##_MASK = GENMASK(h, l), \ + name##_SHIFT = __bf_shf(name##_MASK) + +#define OSC_HZ (24 * 1000 * 1000) + +#define APLL_HZ (1416 * 1000000) +#define APLL_SAFE_HZ (600 * 1000000) +#define GPLL_HZ (594 * 1000000) +#define CPLL_HZ (384 * 1000000) + +/* The SRAM is clocked off aclk_cpu, so we want to max it out for boot speed */ +#define CPU_ACLK_HZ 297000000 +#define CPU_HCLK_HZ 148500000 +#define CPU_PCLK_HZ 74250000 +#define CPU_H2P_HZ 74250000 + +#define PERI_ACLK_HZ 148500000 +#define PERI_HCLK_HZ 148500000 +#define PERI_PCLK_HZ 74250000 + +/* Private data for the clock driver - used by rockchip_get_cru() */ +struct rk3066_clk_priv { +struct rk3066_grf *grf; +struct rk3066_cru *cru; +ulong rate; +bool has_bwadj; +}; + +struct rk3066_cru { +struct rk3066_pll { +u32 con0; +u32 con1; +u32 con2; +u32 con3; + } pll[4 ]; +u32 cru_mode_con; +u32 cru_clksel_con[35 ]; +u32 cru_clkgate_con[10 ]; +u32 reserved1[2 ]; +u32 cru_glb_srst_fst_value; +u32 cru_glb_srst_snd_value; +u32 reserved2[2 ]; +u32 cru_softrst_con[9 ]; +u32 cru_misc_con; +u32 reserved3[2 ]; +u32 cru_glb_cnt_th; +}; + +check_member (rk3066_cru, cru_glb_cnt_th,0x0140 ); + +/* CRU_CLKSEL0_CON */ +enum { + REG(CPU_ACLK_PLL, 8, 8), +CPU_ACLK_PLL_SELECT_APLL =0 , +CPU_ACLK_PLL_SELECT_GPLL , + + REG(CORE_PERI_DIV, 7, 6), + + REG(A9_CORE_DIV, 4, 0), +}; + +/* CRU_CLKSEL1_CON */ +enum { + REG(AHB2APB_DIV, 15, 14), + + REG(CPU_PCLK_DIV, 13, 12), + + REG(CPU_HCLK_DIV, 9, 8), + + REG(CPU_ACLK_DIV, 2, 0), +}; + +/* CRU_CLKSEL10_CON */ +enum { + REG(PERI_SEL_PLL, 15, 15), +PERI_SEL_CPLL =0 , +PERI_SEL_GPLL , + + REG(PERI_PCLK_DIV, 13, 12), + + REG(PERI_HCLK_DIV, 9, 8), + + REG(PERI_ACLK_DIV, 4, 0), +}; + +/* CRU_CLKSEL11_CON */ +enum { + REG(MMC0_DIV, 5, 0), +}; + +/* CRU_CLKSEL12_CON */ +enum { + REG(UART_PLL, 15, 15), +UART_PLL_SELECT_GENERAL =0 , +UART_PLL_SELECT_CODEC , + + REG(EMMC_DIV, 13, 8), + + REG(SDIO_DIV, 5, 0), +}; + +/* CRU_CLKSEL24_CON */ +enum { + REG(SARADC_DIV, 15, 8), +}; + +/* CRU_CLKSEL25_CON */ +enum { + REG(SPI1_DIV, 14, 8), + + REG(SPI0_DIV, 6, 0), +}; + +/* CRU_CLKSEL34_CON */ +enum { + REG(TSADC_DIV, 15, 0), +}; + +/* CRU_MODE_CON */ +enum { + REG(GPLL_MODE, 13, 12), + + REG(CPLL_MODE, 9, 8), + + REG(DPLL_MODE, 5, 4), + + REG(APLL_MODE, 1, 0), +PLL_MODE_SLOW =0 , +PLL_MODE_NORMAL , +PLL_MODE_DEEP , +}; + +/* CRU_APLL_CON0 */ +enum { + REG(CLKR, 13, 8), + + REG(CLKOD, 3, 0), +}; + +/* CRU_APLL_CON1 */ +enum { + REG(CLKF, 12, 0), +}; + +#endif
drivers/clk/rockchip/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-y += clk_pll.o obj-$(CONFIG_ROCKCHIP_PX30) += clk_px30.o obj-$(CONFIG_ROCKCHIP_RK3036) += clk_rk3036.o +obj-$(CONFIG_ROCKCHIP_RK3066) += clk_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3128) += clk_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) += clk_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) += clk_rk322x.o
drivers/clk/rockchip/clk_rk3066.c new file +717 -0
717 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v8 03/15] rockchip: rk3066: add clock driver for rk3066 soc
Quoted 949 lines · Johan Jonker
From: Paweł Jarosz <[email protected]>
Add the clock driver for the rk3066 platform.
Derived from the rk3288 and rk3188 driver it supports only a bare minimum to bring up the system to reduce the TPL size for:
SDRAM clock configuration.
The boot devices NAND, EMMC, SDMMC, SPI.
A UART for the debug messages (fixed) at 115200n8. A SARADC for the recovery button.
A TIMER for the delays (fixed).There's support for two possible frequencies,
the safe 600MHz which will work with default pmic settings and will be set to get away from the 24MHz default and the maximum of 1.416Ghz, which boards can set if they were able to get pmic support for it.After the clock tree is set during the TPL probe
there's no parent update support.In
OF_REALmode the driversns16550.canddw-apb-timer.cobtain the (fixed)clk_get_ratefrom the clock driver instead of platdata.The rk3066 cru node has a number of assigned-clocks properties that call the .set_rate() function. Add them to the list so that they return a 0 instead of
-ENOENT.Signed-off-by Paweł Jarosz <[email protected]>Signed-off-by Johan Jonker <[email protected]>---
Changed V8:
add SCLK_TIMER[0..2]
add SCLK_UART[0..3]
fix assigned-clocks
use GENMASK,__bf_shfand REG defines
fix clk defines
add includes
fix bit positionCRU_CLKSEL0_CONrk3066 vs rk3188 fix comments
renamePLL_MODEdefines
usedev_bind
usedev_dbg
use a different variable nameChanged V7:
changed function prefix
changed #if where possible
restyleU_BOOT_DRIVERstructure--- .../include/asm/arch-rockchip/cru_rk3066.h | 157 ++++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 717 ++++++++++++++++++ 3 files changed, 875 insertions(+)create mode 100644
arch/arm/include/asm/arch-rockchip/cru_rk3066.hcreate mode 100644drivers/clk/rockchip/clk_rk3066.carch/arm/include/asm/arch-rockchip/cru_rk3066.h new file +157
-0@@ -0,0 +1,157 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2021 Paweł Jarosz <[email protected]> +*/ + +#ifndef _ASM_ARCH_CRU_RK3066_H +#define _ASM_ARCH_CRU_RK3066_H + +#include <linux/bitops.h> +#include <linux/bitfield.h> + +#define REG (name, h, l) \ + name##_MASK = GENMASK(h, l), \ + name##_SHIFT = __bf_shf(name##_MASK) + +#define OSC_HZ (24 * 1000 * 1000) + +#define APLL_HZ (1416 * 1000000) +#define APLL_SAFE_HZ (600 * 1000000) +#define GPLL_HZ (594 * 1000000) +#define CPLL_HZ (384 * 1000000) + +/* The SRAM is clocked off aclk_cpu, so we want to max it out for boot speed */ +#define CPU_ACLK_HZ 297000000 +#define CPU_HCLK_HZ 148500000 +#define CPU_PCLK_HZ 74250000 +#define CPU_H2P_HZ 74250000 + +#define PERI_ACLK_HZ 148500000 +#define PERI_HCLK_HZ 148500000 +#define PERI_PCLK_HZ 74250000 + +/* Private data for the clock driver - used by rockchip_get_cru() */ +struct rk3066_clk_priv { +struct rk3066_grf *grf; +struct rk3066_cru *cru; +ulong rate; +bool has_bwadj; +}; + +struct rk3066_cru { +struct rk3066_pll { +u32 con0; +u32 con1; +u32 con2; +u32 con3; + } pll[4 ]; +u32 cru_mode_con; +u32 cru_clksel_con[35 ]; +u32 cru_clkgate_con[10 ]; +u32 reserved1[2 ]; +u32 cru_glb_srst_fst_value; +u32 cru_glb_srst_snd_value; +u32 reserved2[2 ]; +u32 cru_softrst_con[9 ]; +u32 cru_misc_con; +u32 reserved3[2 ]; +u32 cru_glb_cnt_th; +}; + +check_member (rk3066_cru, cru_glb_cnt_th,0x0140 ); + +/* CRU_CLKSEL0_CON */ +enum { + REG(CPU_ACLK_PLL, 8, 8), +CPU_ACLK_PLL_SELECT_APLL =0 , +CPU_ACLK_PLL_SELECT_GPLL , + + REG(CORE_PERI_DIV, 7, 6), + + REG(A9_CORE_DIV, 4, 0), +}; + +/* CRU_CLKSEL1_CON */ +enum { + REG(AHB2APB_DIV, 15, 14), + + REG(CPU_PCLK_DIV, 13, 12), + + REG(CPU_HCLK_DIV, 9, 8), + + REG(CPU_ACLK_DIV, 2, 0), +}; + +/* CRU_CLKSEL10_CON */ +enum { + REG(PERI_SEL_PLL, 15, 15), +PERI_SEL_CPLL =0 , +PERI_SEL_GPLL , + + REG(PERI_PCLK_DIV, 13, 12), + + REG(PERI_HCLK_DIV, 9, 8), + + REG(PERI_ACLK_DIV, 4, 0), +}; + +/* CRU_CLKSEL11_CON */ +enum { + REG(MMC0_DIV, 5, 0), +}; + +/* CRU_CLKSEL12_CON */ +enum { + REG(UART_PLL, 15, 15), +UART_PLL_SELECT_GENERAL =0 , +UART_PLL_SELECT_CODEC , + + REG(EMMC_DIV, 13, 8), + + REG(SDIO_DIV, 5, 0), +}; + +/* CRU_CLKSEL24_CON */ +enum { + REG(SARADC_DIV, 15, 8), +}; + +/* CRU_CLKSEL25_CON */ +enum { + REG(SPI1_DIV, 14, 8), + + REG(SPI0_DIV, 6, 0), +}; + +/* CRU_CLKSEL34_CON */ +enum { + REG(TSADC_DIV, 15, 0), +}; + +/* CRU_MODE_CON */ +enum { + REG(GPLL_MODE, 13, 12), + + REG(CPLL_MODE, 9, 8), + + REG(DPLL_MODE, 5, 4), + + REG(APLL_MODE, 1, 0), +PLL_MODE_SLOW =0 , +PLL_MODE_NORMAL , +PLL_MODE_DEEP , +}; + +/* CRU_APLL_CON0 */ +enum { + REG(CLKR, 13, 8), + + REG(CLKOD, 3, 0), +}; + +/* CRU_APLL_CON1 */ +enum { + REG(CLKF, 12, 0), +}; + +#endif drivers/clk/rockchip/Makefile +1
-0@@ -6,6 +6,7 @@ obj-y += clk_pll.o obj-$(CONFIG_ROCKCHIP_PX30) += clk_px30.o obj-$(CONFIG_ROCKCHIP_RK3036) += clk_rk3036.o +obj-$(CONFIG_ROCKCHIP_RK3066) += clk_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3128) += clk_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) += clk_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) += clk_rk322x.odrivers/clk/rockchip/clk_rk3066.c new file +707
-0@@ -0,0 +1,717 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* (C) Copyright 2015 Google, Inc +* (C) Copyright 2016 Heiko Stuebner <[email protected]> +*/ + +#include <bitfield.h> +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> +#include <dt-structs.h> +#include <errno.h> +#include <log.h> +#include <malloc.h> +#include <mapmem.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/cru_rk3066.h> +#include <asm/arch-rockchip/grf_rk3066.h> +#include <asm/arch-rockchip/hardware.h> +#include <dt-bindings/clock/rk3066a-cru.h> +#include <dm/device_compat.h> +#include <dm/device-internal.h> +#include <dm/lists.h> +#include <dm/uclass-internal.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/log2.h> +#include <linux/stringify.h> + +struct rk3066_clk_plat { +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct dtd_rockchip_rk3066a_cru dtd; +#endif +}; + +struct pll_div { +u32 nr; +u32 nf; +u32 no; +}; + +enum { +VCO_MAX_HZ =1416U *1000000 , +VCO_MIN_HZ =300 *1000000 , +OUTPUT_MAX_HZ =1416U *1000000 , +OUTPUT_MIN_HZ =30 *1000000 , +FREF_MAX_HZ =1416U *1000000 , +FREF_MIN_HZ =30 *1000 , +}; + +enum { +/* PLL CON0 */ +PLL_OD_MASK =GENMASK (3 ,0 ), + +/* PLL CON1 */ +PLL_NF_MASK =GENMASK (12 ,0 ), + +/* PLL CON2 */ +PLL_BWADJ_MASK =GENMASK (11 ,0 ), + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =BIT (4 ), +SOCSTS_APLL_LOCK =BIT (5 ), +SOCSTS_CPLL_LOCK =BIT (6 ), +SOCSTS_GPLL_LOCK =BIT (7 ), +}; + +#define DIV_TO_RATE (input_rate, div) ((input_rate) / ((div) + 1)) + +#define PLL_DIVISORS (hz, _nr, _no) {\ + .nr = _nr, .nf = (u32)((u64)hz * _nr * _no / OSC_HZ), .no = _no};\ + _Static_assert(((u64)hz * _nr * _no / OSC_HZ) * OSC_HZ /\ + (_nr * _no) == hz, #hz "Hz cannot be hit with PLL "\ + "divisors on line " __stringify(__LINE__)) + +/* Keep divisors as low as possible to reduce jitter and power usage. */ +static const struct pll_div gpll_init_cfg =PLL_DIVISORS (GPLL_HZ ,2 ,2 ); +static const struct pll_div cpll_init_cfg =PLL_DIVISORS (CPLL_HZ ,1 ,2 ); + +static int rk3066_clk_set_pll (struct rk3066_cru *cru,enum rk_clk_id clk_id, +const struct pll_div *div) +{ +int pll_id =rk_pll_id (clk_id); +struct rk3066_pll *pll = &cru->pll[pll_id]; +/* All PLLs have the same VCO and output frequency range restrictions. */ +uint vco_hz =OSC_HZ /1000 * div->nf / div->nr *1000 ; +uint output_hz = vco_hz / div->no; + +debug ("%s: PLL at %x: nf=%d, nr=%d, no=%d, vco=%u Hz, output=%u Hz\n" , __func__, + (uint )pll, div->nf, div->nr, div->no, vco_hz, output_hz); +assert (vco_hz >=VCO_MIN_HZ && vco_hz <=VCO_MAX_HZ && + output_hz >=OUTPUT_MIN_HZ && output_hz <=OUTPUT_MAX_HZ && + (div->no ==1 || !(div->no %2 ))); + +/* Enter reset. */ +rk_setreg (&pll->con3,BIT (PLL_RESET_SHIFT )); + +rk_clrsetreg (&pll->con0, +CLKR_MASK |PLL_OD_MASK , + ((div->nr -1 ) <<CLKR_SHIFT ) | (div->no -1 )); +rk_clrsetreg (&pll->con1,CLKF_MASK , div->nf -1 ); + +rk_clrsetreg (&pll->con2,PLL_BWADJ_MASK , (div->nf >>1 ) -1 ); + +/* Exit reset. */ +rk_clrreg (&pll->con3,BIT (PLL_RESET_SHIFT )); + +return 0 ; +} + +static int rk3066_clk_configure_ddr (struct rk3066_cru *cru,struct rk3066_grf *grf, +unsigned int hz) +{ +static const struct pll_div dpll_cfg[] = { + {.nf =25 , .nr =2 , .no =1 }, + {.nf =400 , .nr =9 , .no =2 }, + {.nf =500 , .nr =9 , .no =2 }, + {.nf =100 , .nr =3 , .no =1 }, + }; +int cfg; + +switch (hz) { +case 300000000 : + cfg =0 ; +break ; +case 533000000 :/* actually 533.3P MHz */ + cfg =1 ; +break ; +case 666000000 :/* actually 666.6P MHz */ + cfg =2 ; +break ; +case 800000000 : + cfg =3 ; +break ; +default : +debug ("%s: unsupported SDRAM frequency" , __func__); +return -EINVAL ; + } + +/* Enter PLL slow mode. */ +rk_clrsetreg (&cru->cru_mode_con,DPLL_MODE_MASK , +PLL_MODE_SLOW <<DPLL_MODE_SHIFT ); + +rk3066_clk_set_pll (cru,CLK_DDR , &dpll_cfg[cfg]); + +/* Wait for PLL lock. */ +while (!(readl (&grf->soc_status0) &SOCSTS_DPLL_LOCK )) +udelay (1 ); + +/* Enter PLL normal mode. */ +rk_clrsetreg (&cru->cru_mode_con,DPLL_MODE_MASK , +PLL_MODE_NORMAL <<DPLL_MODE_SHIFT ); + +return 0 ; +} + +static int rk3066_clk_configure_cpu (struct rk3066_cru *cru,struct rk3066_grf *grf, +unsigned int hz) +{ +static const struct pll_div apll_cfg[] = { + {.nf =50 , .nr =1 , .no =2 }, + {.nf =59 , .nr =1 , .no =1 }, + }; +int div_core_peri, div_cpu_aclk, cfg; + +/* +* We support two possible frequencies, the safe 600MHz +* which will work with default pmic settings and will +* be set to get away from the 24MHz default and +* the maximum of 1.416Ghz, which boards can set if they +* were able to get pmic support for it. +*/ +switch (hz) { +case APLL_SAFE_HZ : + cfg =0 ; + div_core_peri =1 ; + div_cpu_aclk =3 ; +break ; +case APLL_HZ : + cfg =1 ; + div_core_peri =2 ; + div_cpu_aclk =3 ; +break ; +default : +debug ("unsupported ARMCLK frequency" ); +return -EINVAL ; + } + +/* Enter PLL slow mode. */ +rk_clrsetreg (&cru->cru_mode_con,APLL_MODE_MASK , +PLL_MODE_SLOW <<APLL_MODE_SHIFT ); + +rk3066_clk_set_pll (cru,CLK_ARM , &apll_cfg[cfg]); + +/* Wait for PLL lock. */ +while (!(readl (&grf->soc_status0) &SOCSTS_APLL_LOCK )) +udelay (1 ); + +/* Set divider for peripherals attached to the CPU core. */ +rk_clrsetreg (&cru->cru_clksel_con[0 ], +CORE_PERI_DIV_MASK , + div_core_peri <<CORE_PERI_DIV_SHIFT ); + +/* Set up dependent divisor for cpu_aclk. */ +rk_clrsetreg (&cru->cru_clksel_con[1 ], +CPU_ACLK_DIV_MASK , + div_cpu_aclk <<CPU_ACLK_DIV_SHIFT ); + +/* Enter PLL normal mode. */ +rk_clrsetreg (&cru->cru_mode_con,APLL_MODE_MASK , +PLL_MODE_NORMAL <<APLL_MODE_SHIFT ); + +return hz; +} + +static uint32_t rk3066_clk_pll_get_rate (struct rk3066_cru *cru, +enum rk_clk_id clk_id) +{ +u32 nr, no, nf; +u32 con; +int pll_id =rk_pll_id (clk_id); +struct rk3066_pll *pll = &cru->pll[pll_id]; +static u8 clk_shift[CLK_COUNT ] = { +0xff ,APLL_MODE_SHIFT ,DPLL_MODE_SHIFT ,CPLL_MODE_SHIFT , +GPLL_MODE_SHIFT + }; +uint shift; + + con =readl (&cru->cru_mode_con); + shift = clk_shift[clk_id]; +switch (FIELD_GET (APLL_MODE_MASK , con >> shift)) { +case PLL_MODE_SLOW : +return OSC_HZ ; +case PLL_MODE_NORMAL : +/* normal mode */ + con =readl (&pll->con0); + no =bitfield_extract_by_mask (con,CLKOD_MASK ) +1 ; + nr =bitfield_extract_by_mask (con,CLKR_MASK ) +1 ; + con =readl (&pll->con1); + nf =bitfield_extract_by_mask (con,CLKF_MASK ) +1 ; + +return (OSC_HZ * nf) / (nr * no); +case PLL_MODE_DEEP : +default : +return 32768 ; + } +} + +static ulong rk3066_clk_mmc_get_clk (struct rk3066_cru *cru,uint gclk_rate, +int periph) +{ +uint div; +u32 con; + +switch (periph) { +case HCLK_EMMC : +case SCLK_EMMC : + con =readl (&cru->cru_clksel_con[12 ]); + div =bitfield_extract_by_mask (con,EMMC_DIV_MASK ); +break ; +case HCLK_SDMMC : +case SCLK_SDMMC : + con =readl (&cru->cru_clksel_con[11 ]); + div =bitfield_extract_by_mask (con,MMC0_DIV_MASK ); +break ; +case HCLK_SDIO : +case SCLK_SDIO : + con =readl (&cru->cru_clksel_con[12 ]); + div =bitfield_extract_by_mask (con,SDIO_DIV_MASK ); +break ; +default : +return -EINVAL ; + } + +return DIV_TO_RATE (gclk_rate, div) /2 ; +} + +static ulong rk3066_clk_mmc_set_clk (struct rk3066_cru *cru,uint gclk_rate, +int periph,uint freq) +{ +int src_clk_div; + +debug ("%s: gclk_rate=%u\n" , __func__, gclk_rate); +/* MMC clock by default divides by 2 internally, so need to provide double in CRU. */ + src_clk_div =DIV_ROUND_UP (gclk_rate /2 , freq) -1 ; +assert (src_clk_div <=0x3f ); + +switch (periph) { +case HCLK_EMMC : +case SCLK_EMMC : +rk_clrsetreg (&cru->cru_clksel_con[12 ], +EMMC_DIV_MASK , + src_clk_div <<EMMC_DIV_SHIFT ); +break ; +case HCLK_SDMMC : +case SCLK_SDMMC : +rk_clrsetreg (&cru->cru_clksel_con[11 ], +MMC0_DIV_MASK , + src_clk_div <<MMC0_DIV_SHIFT ); +break ; +case HCLK_SDIO : +case SCLK_SDIO : +rk_clrsetreg (&cru->cru_clksel_con[12 ], +SDIO_DIV_MASK , + src_clk_div <<SDIO_DIV_SHIFT ); +break ; +default : +return -EINVAL ; + } + +return rk3066_clk_mmc_get_clk (cru, gclk_rate, periph); +} + +static ulong rk3066_clk_spi_get_clk (struct rk3066_cru *cru,uint gclk_rate, +int periph) +{ +uint div; +u32 con; + +switch (periph) { +case SCLK_SPI0 : + con =readl (&cru->cru_clksel_con[25 ]); + div =bitfield_extract_by_mask (con,SPI0_DIV_MASK ); +break ; +case SCLK_SPI1 : + con =readl (&cru->cru_clksel_con[25 ]); + div =bitfield_extract_by_mask (con,SPI1_DIV_MASK ); +break ; +default : +return -EINVAL ; + } + +return DIV_TO_RATE (gclk_rate, div); +} + +static ulong rk3066_clk_spi_set_clk (struct rk3066_cru *cru,uint gclk_rate, +int periph,uint freq) +{ +int src_clk_div =DIV_ROUND_UP (gclk_rate, freq) -1 ; + +assert (src_clk_div <128 ); +switch (periph) { +case SCLK_SPI0 : +assert (src_clk_div <=SPI0_DIV_MASK >>SPI0_DIV_SHIFT ); +rk_clrsetreg (&cru->cru_clksel_con[25 ], +SPI0_DIV_MASK , + src_clk_div <<SPI0_DIV_SHIFT ); +break ; +case SCLK_SPI1 : +assert (src_clk_div <=SPI1_DIV_MASK >>SPI1_DIV_SHIFT ); +rk_clrsetreg (&cru->cru_clksel_con[25 ], +SPI1_DIV_MASK , + src_clk_div <<SPI1_DIV_SHIFT ); +break ; +default : +return -EINVAL ; + } + +return rk3066_clk_spi_get_clk (cru, gclk_rate, periph); +} + +static ulong rk3066_clk_saradc_get_clk (struct rk3066_cru *cru,int periph) +{ +u32 div, con; + +switch (periph) { +case SCLK_SARADC : + con =readl (&cru->cru_clksel_con[24 ]); + div =bitfield_extract_by_mask (con,SARADC_DIV_MASK ); +break ; +case SCLK_TSADC : + con =readl (&cru->cru_clksel_con[34 ]); + div =bitfield_extract_by_mask (con,TSADC_DIV_MASK ); +break ; +default : +return -EINVAL ; + } +return DIV_TO_RATE (PERI_PCLK_HZ , div); +} + +static ulong rk3066_clk_saradc_set_clk (struct rk3066_cru *cru,uint hz, +int periph) +{ +int src_clk_div; + + src_clk_div =DIV_ROUND_UP (PERI_PCLK_HZ , hz) -1 ; +assert (src_clk_div <128 ); + +switch (periph) { +case SCLK_SARADC : +rk_clrsetreg (&cru->cru_clksel_con[24 ], +SARADC_DIV_MASK , + src_clk_div <<SARADC_DIV_SHIFT ); +break ; +case SCLK_TSADC : +rk_clrsetreg (&cru->cru_clksel_con[34 ], +SARADC_DIV_MASK , + src_clk_div <<SARADC_DIV_SHIFT ); +break ; +default : +return -EINVAL ; + } + +return rk3066_clk_saradc_get_clk (cru, periph); +} + +static void rk3066_clk_init (struct rk3066_cru *cru,struct rk3066_grf *grf) +{ +u32 aclk_div, hclk_div, pclk_div, h2p_div; + +/* Enter PLL slow mode. */ +rk_clrsetreg (&cru->cru_mode_con, +GPLL_MODE_MASK | +CPLL_MODE_MASK , +PLL_MODE_SLOW <<GPLL_MODE_SHIFT | +PLL_MODE_SLOW <<CPLL_MODE_SHIFT ); + +/* Init PLL. */ +rk3066_clk_set_pll (cru,CLK_GENERAL , &gpll_init_cfg); +rk3066_clk_set_pll (cru,CLK_CODEC , &cpll_init_cfg); + +/* Wait for PLL lock. */ +while ((readl (&grf->soc_status0) & + (SOCSTS_CPLL_LOCK |SOCSTS_GPLL_LOCK )) != + (SOCSTS_CPLL_LOCK |SOCSTS_GPLL_LOCK )) +udelay (1 ); + +/* +* Select CPU clock PLL source and +* reparent aclk_cpu_pre from APPL to GPLL. +* Set up dependent divisors for PCLK/HCLK and ACLK clocks. +*/ + aclk_div =DIV_ROUND_UP (GPLL_HZ ,CPU_ACLK_HZ ) -1 ; +assert ((aclk_div +1 ) *CPU_ACLK_HZ ==GPLL_HZ && aclk_div <=0x1f ); + +rk_clrsetreg (&cru->cru_clksel_con[0 ], +CPU_ACLK_PLL_MASK | +A9_CORE_DIV_MASK , +CPU_ACLK_PLL_SELECT_GPLL <<CPU_ACLK_PLL_SHIFT | + aclk_div <<A9_CORE_DIV_SHIFT ); + + hclk_div =ilog2 (CPU_ACLK_HZ /CPU_HCLK_HZ ); +assert ((1 << hclk_div) *CPU_HCLK_HZ ==CPU_ACLK_HZ && hclk_div <0x3 ); + pclk_div =ilog2 (CPU_ACLK_HZ /CPU_PCLK_HZ ); +assert ((1 << pclk_div) *CPU_PCLK_HZ ==CPU_ACLK_HZ && pclk_div <0x4 ); + h2p_div =ilog2 (CPU_HCLK_HZ /CPU_H2P_HZ ); +assert ((1 << h2p_div) *CPU_H2P_HZ ==CPU_HCLK_HZ && pclk_div <0x3 ); + +rk_clrsetreg (&cru->cru_clksel_con[1 ], +AHB2APB_DIV_MASK | +CPU_PCLK_DIV_MASK | +CPU_HCLK_DIV_MASK , + h2p_div <<AHB2APB_DIV_SHIFT | + pclk_div <<CPU_PCLK_DIV_SHIFT | + hclk_div <<CPU_HCLK_DIV_SHIFT ); + +/* +* Select PERI clock PLL source and +* set up dependent divisors for PCLK/HCLK and ACLK clocks. +*/ + aclk_div =GPLL_HZ /PERI_ACLK_HZ -1 ; +assert ((aclk_div +1 ) *PERI_ACLK_HZ ==GPLL_HZ && aclk_div <0x1f ); + + hclk_div =ilog2 (PERI_ACLK_HZ /PERI_HCLK_HZ ); +assert ((1 << hclk_div) *PERI_HCLK_HZ == +PERI_ACLK_HZ && (hclk_div <0x4 )); + + pclk_div =ilog2 (PERI_ACLK_HZ /PERI_PCLK_HZ ); +assert ((1 << pclk_div) *PERI_PCLK_HZ == +PERI_ACLK_HZ && (pclk_div <0x4 )); + +rk_clrsetreg (&cru->cru_clksel_con[10 ], +PERI_PCLK_DIV_MASK | +PERI_HCLK_DIV_MASK | +PERI_ACLK_DIV_MASK , +PERI_SEL_GPLL <<PERI_SEL_PLL_SHIFT | + pclk_div <<PERI_PCLK_DIV_SHIFT | + hclk_div <<PERI_HCLK_DIV_SHIFT | + aclk_div <<PERI_ACLK_DIV_SHIFT ); + +/* Enter PLL normal mode. */ +rk_clrsetreg (&cru->cru_mode_con, +GPLL_MODE_MASK | +CPLL_MODE_MASK , +PLL_MODE_NORMAL <<GPLL_MODE_SHIFT | +PLL_MODE_NORMAL <<CPLL_MODE_SHIFT ); + +rk3066_clk_mmc_set_clk (cru,PERI_HCLK_HZ ,HCLK_SDMMC ,16000000 ); +} + +static ulong rk3066_clk_get_rate (struct clk *clk) +{ +struct rk3066_clk_priv *priv =dev_get_priv (clk->dev); +ulong new_rate, gclk_rate; + + gclk_rate =rk3066_clk_pll_get_rate (priv->cru,CLK_GENERAL ); +switch (clk->id) { + case 1 ... 4: + new_rate =rk3066_clk_pll_get_rate (priv->cru, clk->id); +break ; +case HCLK_EMMC : +case HCLK_SDMMC : +case HCLK_SDIO : +case SCLK_EMMC : +case SCLK_SDMMC : +case SCLK_SDIO : + new_rate =rk3066_clk_mmc_get_clk (priv->cru,PERI_HCLK_HZ , + clk->id); +break ; +case SCLK_SPI0 : +case SCLK_SPI1 : + new_rate =rk3066_clk_spi_get_clk (priv->cru,PERI_PCLK_HZ , + clk->id); +break ; +case PCLK_I2C0 : +case PCLK_I2C1 : +case PCLK_I2C2 : +case PCLK_I2C3 : +case PCLK_I2C4 : +return gclk_rate; +case SCLK_SARADC : +case SCLK_TSADC : + new_rate =rk3066_clk_saradc_get_clk (priv->cru, clk->id); +break ; +case SCLK_TIMER0 : +case SCLK_TIMER1 : +case SCLK_TIMER2 : +case SCLK_UART0 : +case SCLK_UART1 : +case SCLK_UART2 : +case SCLK_UART3 : +return OSC_HZ ; +default : +return -ENOENT ; + } + +return new_rate; +} + +static ulong rk3066_clk_set_rate (struct clk *clk,ulong rate) +{ +struct rk3066_clk_priv *priv =dev_get_priv (clk->dev); +struct rk3066_cru *cru = priv->cru; +ulong new_rate; + +switch (clk->id) { +case PLL_APLL : + new_rate =rk3066_clk_configure_cpu (priv->cru, priv->grf, rate); +break ; +case CLK_DDR : + new_rate =rk3066_clk_configure_ddr (priv->cru, priv->grf, rate); +break ; +case HCLK_EMMC : +case HCLK_SDMMC : +case HCLK_SDIO : +case SCLK_EMMC : +case SCLK_SDMMC : +case SCLK_SDIO : + new_rate =rk3066_clk_mmc_set_clk (cru,PERI_HCLK_HZ , + clk->id, rate); +break ; +case SCLK_SPI0 : +case SCLK_SPI1 : + new_rate =rk3066_clk_spi_set_clk (cru,PERI_PCLK_HZ , + clk->id, rate); +break ; +case SCLK_SARADC : +case SCLK_TSADC : + new_rate =rk3066_clk_saradc_set_clk (cru, rate, clk->id); +break ; +case PLL_CPLL : +case PLL_GPLL : +case ACLK_CPU : +case HCLK_CPU : +case PCLK_CPU : +case ACLK_PERI : +case HCLK_PERI : +case PCLK_PERI : +return 0 ; +default : +return -ENOENT ; + } + +return new_rate; +} + +static int rk3066_clk_enable (struct clk *clk) +{ +struct rk3066_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case HCLK_NANDC0 : +rk_clrreg (&priv->cru->cru_clkgate_con[5 ],BIT (9 )); +break ; +case HCLK_SDMMC : +rk_clrreg (&priv->cru->cru_clkgate_con[5 ],BIT (10 )); +break ; +case HCLK_SDIO : +rk_clrreg (&priv->cru->cru_clkgate_con[5 ],BIT (11 )); +break ; + } + +return 0 ; +} + +static int rk3066_clk_disable (struct clk *clk) +{ +struct rk3066_clk_priv *priv =dev_get_priv (clk->dev); + +switch (clk->id) { +case HCLK_NANDC0 : +rk_setreg (&priv->cru->cru_clkgate_con[5 ],BIT (9 )); +break ; +case HCLK_SDMMC : +rk_setreg (&priv->cru->cru_clkgate_con[5 ],BIT (10 )); +break ; +case HCLK_SDIO : +rk_setreg (&priv->cru->cru_clkgate_con[5 ],BIT (11 )); +break ; + } + +return 0 ; +} + +static struct clk_ops rk3066_clk_ops = { + .disable = rk3066_clk_disable, + .enable = rk3066_clk_enable, + .get_rate = rk3066_clk_get_rate, + .set_rate = rk3066_clk_set_rate, +}; + +static int rk3066_clk_of_to_plat (struct udevice *dev) +{ +if (CONFIG_IS_ENABLED (OF_REAL )) { +struct rk3066_clk_priv *priv =dev_get_priv (dev); + + priv->cru =dev_read_addr_ptr (dev); + } + +return 0 ; +} + +static int rk3066_clk_probe (struct udevice *dev) +{ +struct rk3066_clk_priv *priv =dev_get_priv (dev); + + priv->grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (priv->grf)) +return PTR_ERR (priv->grf); + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +struct rk3066_clk_plat *plat =dev_get_plat (dev); + + priv->cru =map_sysmem (plat->dtd.reg[0 ], plat->dtd.reg[1 ]); +#endif + +if (IS_ENABLED (CONFIG_TPL_BUILD )) { +rk3066_clk_init (priv->cru, priv->grf); + +/* Init CPU frequency. */ +rk3066_clk_configure_cpu (priv->cru, priv->grf,APLL_SAFE_HZ ); + } + +return 0 ; +} + +static int rk3066_clk_bind (struct udevice *dev) +{ +struct udevice *sys_child; +struct sysreset_reg *priv; +int reg_offset, ret; + +/* The reset driver does not have a device node, so bind it here. */ + ret =device_bind (dev,DM_DRIVER_GET (sysreset_rockchip),"sysreset" , +NULL ,ofnode_null (), &sys_child); +if (ret) { +dev_dbg (dev,"Warning: No sysreset driver: ret=%d\n" , ret); + }else { + priv =malloc (sizeof (struct sysreset_reg )); + priv->glb_srst_fst_value = offsetof(struct rk3066_cru , + cru_glb_srst_fst_value); + priv->glb_srst_snd_value = offsetof(struct rk3066_cru , + cru_glb_srst_snd_value); +dev_set_priv (sys_child, priv); + } + +if (CONFIG_IS_ENABLED (RESET_ROCKCHIP )) { + reg_offset = offsetof(struct rk3066_cru, cru_softrst_con[0]); + ret =rockchip_reset_bind (dev, reg_offset,9 ); +if (ret) +dev_dbg (dev,"Warning: software reset driver bind failed\n" ); + } + +return 0 ; +} + +static const struct udevice_id rk3066_clk_ids[] = { + { .compatible ="rockchip,rk3066a-cru" }, + { } +}; + +U_BOOT_DRIVER (rockchip_rk3066a_cru) = {
drivers/clk/rockchip/clk_rk3066.c line 717
Quoted 10 lines
drivers/clk/rockchip/clk_rk3066.c new file +10
-0+ .name = "rockchip_rk3066a_cru", + .id = UCLASS_CLK, + .ops = &rk3066_clk_ops, + .probe = rk3066_clk_probe, + .bind = rk3066_clk_bind, + .of_match = rk3066_clk_ids, + .of_to_plat = rk3066_clk_of_to_plat, + .priv_auto = sizeof(struct rk3066_clk_priv), + .plat_auto = sizeof(struct rk3066_clk_plat), +};
PATCH v8 4/15 rockchip: rk3066: add rk3066 pinctrl driver
In reply to Johan JonkerFrom: Paweł Jarosz <[email protected]>
Add driver supporting pin multiplexing on rk3066 platform.
---
Changed V7:
restyle
changed function prefix.
restyle U_BOOT_DRIVER structure
use OF_REAL
use EOPNOTSUPP
--- drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3066.c | 113 ++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3066.c
drivers/pinctrl/rockchip/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += pinctrl-rockchip-core.o obj-$(CONFIG_ROCKCHIP_PX30) += pinctrl-px30.o obj-$(CONFIG_ROCKCHIP_RK3036) += pinctrl-rk3036.o +obj-$(CONFIG_ROCKCHIP_RK3066) += pinctrl-rk3066.o obj-$(CONFIG_ROCKCHIP_RK3128) += pinctrl-rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) += pinctrl-rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) += pinctrl-rk322x.o
drivers/pinctrl/rockchip/pinctrl-rk3066.c new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 5/15 rockchip: rk3066: add sdram driver
In reply to Johan JonkerFrom: Paweł Jarosz <[email protected]>
Add rockchip rk3066 sdram driver
---
Changed V7:
restyle
rename TEST_PATTERN
changed function prefix
changed #if where possible
restyle U_BOOT_DRIVER structure
remove rk3066_dmc_of_to_plat because dmc DT data only used in TPL in combination with OF_PLATDATA
--- drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3066.c | 892 ++++++++++++++++++++++++++++ 2 files changed, 893 insertions(+) create mode 100644 drivers/ram/rockchip/sdram_rk3066.c
drivers/ram/rockchip/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_ROCKCHIP_PX30) += sdram_px30.o sdram_pctl_px30.o sdram_phy_px30.o obj-$(CONFIG_ROCKCHIP_RK3368) = dmc-rk3368.o +obj-$(CONFIG_ROCKCHIP_RK3066) = sdram_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3128) = sdram_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) = sdram_rk322x.o
drivers/ram/rockchip/sdram_rk3066.c new file +892 -0
892 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 6/15 arm: dts: rockchip: fix rk3xxx-u-boot.dtsi
In reply to Johan JonkerThe file rk3xxx-u-boot.dtsi was original only for rk3188 and SPL. With rk3066 added some nodes are also needed in TPL,
so change them to u-boot,dm-pre-reloc
--- arch/arm/dts/rk3xxx-u-boot.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/dts/rk3xxx-u-boot.dtsi +4 -4
@@ -4,7 +4,7 @@ noc: syscon@10128000 { compatible = "rockchip,rk3188-noc", "syscon"; reg = <0x10128000 0x2000>; - u-boot,dm-spl; + u-boot,dm-pre-reloc; }; dmc: dmc@20020000 {
@@ -18,16 +18,16 @@ rockchip,grf = <&grf>; rockchip,pmu = <&pmu>; rockchip,noc = <&noc>; - u-boot,dm-spl; + u-boot,dm-pre-reloc; }; }; &grf { - u-boot,dm-spl; + u-boot,dm-pre-reloc; }; &pmu { - u-boot,dm-spl; + u-boot,dm-pre-reloc; }; &uart2 {
Signature · 1 line
2.20.1
PATCH v8 7/15 arm: dts: rockchip: add rk3066a.dtsi
In reply to Johan JonkerIn the Linux DT the file rk3xxx.dtsi is shared between rk3066 and rk3188. Add rk3066a.dtsi. Move U-boot specific things in a rk3066a-u-boot.dtsi file.
---
Changed V8:
update dtsi
--- arch/arm/dts/rk3066a-u-boot.dtsi | 3 + arch/arm/dts/rk3066a.dtsi | 880 +++++++++++++++++++++++++++++++ 2 files changed, 883 insertions(+) create mode 100644 arch/arm/dts/rk3066a-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a.dtsi
arch/arm/dts/rk3066a-u-boot.dtsi new file +3 -0
@@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include "rockchip-u-boot.dtsi"
arch/arm/dts/rk3066a.dtsi new file +880 -0
880 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 8/15 arm: dts: rockchip: add rk3066a-mk808.dts
In reply to Johan JonkerMK808 is a RK3066-based board with 1 USB host and 1 USB OTG port, HDMI and a micro-SD card slot. It also includes on-board NAND and 1GB of SDRAM. Add rk3066a-mk808.dts. Move U-boot specific things in a rk3066a-mk808-u-boot.dtsi file.
---
Changed V8:
update dts
--- arch/arm/dts/Makefile | 3 + arch/arm/dts/rk3066a-mk808-u-boot.dtsi | 42 +++++ arch/arm/dts/rk3066a-mk808.dts | 216 +++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 arch/arm/dts/rk3066a-mk808-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a-mk808.dts
arch/arm/dts/Makefile +3 -0
@@ -89,6 +89,9 @@ dtb-$(CONFIG_ROCKCHIP_RK3036) += \ dtb-$(CONFIG_ROCKCHIP_RK3128) += \ rk3128-evb.dtb +dtb-$(CONFIG_ROCKCHIP_RK3066) += \ + rk3066a-mk808.dtb + dtb-$(CONFIG_ROCKCHIP_RK3188) += \ rk3188-radxarock.dtb
arch/arm/dts/rk3066a-mk808-u-boot.dtsi new file +42 -0
42 lines not on this page · raw message
arch/arm/dts/rk3066a-mk808.dts new file +216 -0
216 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 9/15 rockchip: rk3066: add include
In reply to Johan JonkerAdd include for rk3066.
--- arch/arm/include/asm/arch-rk3066/boot0.h | 8 ++++++++ arch/arm/include/asm/arch-rk3066/gpio.h | 8 ++++++++ arch/arm/include/asm/arch-rk3066/timer.h | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 arch/arm/include/asm/arch-rk3066/boot0.h create mode 100644 arch/arm/include/asm/arch-rk3066/gpio.h create mode 100644 arch/arm/include/asm/arch-rk3066/timer.h
arch/arm/include/asm/arch-rk3066/boot0.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __ASM_ARCH_BOOT0_H__ +#define __ASM_ARCH_BOOT0_H__ + +#include <asm/arch-rockchip/boot0.h> + +#endif
arch/arm/include/asm/arch-rk3066/gpio.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __ASM_ARCH_GPIO_H__ +#define __ASM_ARCH_GPIO_H__ + +#include <asm/arch-rockchip/gpio.h> + +#endif
arch/arm/include/asm/arch-rk3066/timer.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __ASM_ARCH_TIMER_H__ +#define __ASM_ARCH_TIMER_H__ + +#endif
Signature · 1 line
2.20.1
PATCH v8 10/15 rockchip: rk3066: add rk3066_common.h include
In reply to Johan JonkerAdd rk3066_common.h include.
--- include/configs/mk808.h | 9 ++++++ include/configs/rk3066_common.h | 56 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 include/configs/mk808.h create mode 100644 include/configs/rk3066_common.h
include/configs/mk808.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define ROCKCHIP_DEVICE_SETTINGS +#include <configs/rk3066_common.h> + +#endif
include/configs/rk3066_common.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 11/15 rockchip: rk3066: add core support
In reply to Johan JonkerAdd the core architecture code for the rk3066.
--- arch/arm/mach-rockchip/Kconfig | 23 ++++++++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3066/Kconfig | 30 ++++++++++ arch/arm/mach-rockchip/rk3066/Makefile | 5 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++++++++ arch/arm/mach-rockchip/rk3066/rk3066.c | 49 +++++++++++++++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 55 +++++++++++++++++++ 7 files changed, 196 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3066/Makefile create mode 100644 arch/arm/mach-rockchip/rk3066/clk_rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/syscon_rk3066.c
arch/arm/mach-rockchip/Kconfig +23 -0
@@ -36,6 +36,28 @@ config ROCKCHIP_RK3036 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. +config ROCKCHIP_RK3066 + bool "Support Rockchip RK3066" + select CPU_V7A + select SPL_BOARD_INIT if SPL + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select TPL_ROCKCHIP_BACK_TO_BROM + select TPL_ROCKCHIP_EARLYRETURN_TO_BROM + imply ROCKCHIP_COMMON_BOARD + imply SPL_ROCKCHIP_COMMON_BOARD + imply SPL_SERIAL + imply TPL_ROCKCHIP_COMMON_BOARD + imply TPL_SERIAL + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A9 + including NEON and GPU, 512KB L2 cache, Mali-400 graphics, two + video interfaces, several memory options and video codec support. + Peripherals include Fast Ethernet, USB2 host and OTG, SDIO, I2S, + UART, SPI, I2C and PWMs. + config ROCKCHIP_RK3128 bool "Support Rockchip RK3128" select CPU_V7A
@@ -420,6 +442,7 @@ config ROCKCHIP_SPI_IMAGE source "arch/arm/mach-rockchip/px30/Kconfig" source "arch/arm/mach-rockchip/rk3036/Kconfig" +source "arch/arm/mach-rockchip/rk3066/Kconfig" source "arch/arm/mach-rockchip/rk3128/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk322x/Kconfig"
arch/arm/mach-rockchip/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram.o obj-$(CONFIG_ROCKCHIP_PX30) += px30/ obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/ +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/ obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128/ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x/
arch/arm/mach-rockchip/rk3066/Kconfig new file +30 -0
@@ -0,0 +1,30 @@ +if ROCKCHIP_RK3066 + +config ROCKCHIP_BOOT_MODE_REG + default 0x20004040 + +config SYS_SOC + default "rk3066" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT + default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL + default y + +endif
arch/arm/mach-rockchip/rk3066/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += clk_rk3066.o +obj-y += rk3066.o +obj-y += syscon_rk3066.o
arch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2015 Google, Inc +* Written by Simon Glass <[email protected]> +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/cru_rk3066.h> +#include <linux/err.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_DRIVER_GET (rockchip_rk3066a_cru), devp); +} + +void *rockchip_get_cru (void ) +{ +struct rk3066_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/rk3066/rk3066.c new file +49 -0
49 lines not on this page · raw message
arch/arm/mach-rockchip/rk3066/syscon_rk3066.c new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v8 12/15 rockchip: rk3066: add Rikomagic MK808 board
In reply to Johan JonkerMK808 is a RK3066-based board with 1 USB host and 1 USB OTG port, HDMI and a micro-SD card slot. It also includes on-board NAND and 1GB of SDRAM.
--- arch/arm/mach-rockchip/rk3066/Kconfig | 9 +++++++++ board/rikomagic/mk808/Kconfig | 15 +++++++++++++++ board/rikomagic/mk808/MAINTAINERS | 6 ++++++ board/rikomagic/mk808/Makefile | 3 +++ board/rikomagic/mk808/mk808.c | 3 +++ 5 files changed, 36 insertions(+) create mode 100644 board/rikomagic/mk808/Kconfig create mode 100644 board/rikomagic/mk808/MAINTAINERS create mode 100644 board/rikomagic/mk808/Makefile create mode 100644 board/rikomagic/mk808/mk808.c
arch/arm/mach-rockchip/rk3066/Kconfig +9 -0
@@ -1,5 +1,12 @@ if ROCKCHIP_RK3066 +config TARGET_MK808 + bool "MK808" + help + MK808 is a RK3066-based board with 1 USB host and 1 USB OTG port, + HDMI and a micro-SD card slot. It also includes on-board NAND + and 1GB of SDRAM. + config ROCKCHIP_BOOT_MODE_REG default 0x20004040
@@ -27,4 +34,6 @@ config TPL_LIBGENERIC_SUPPORT config TPL_SERIAL default y +source "board/rikomagic/mk808/Kconfig" + endif
board/rikomagic/mk808/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_MK808 + +config SYS_BOARD + default "mk808" + +config SYS_VENDOR + default "rikomagic" + +config SYS_CONFIG_NAME + default "mk808" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/rikomagic/mk808/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +MK808 +M: Johan Jonker <[email protected]> +S: Maintained +F: board/rikomagic/mk808 +F: configs/mk808_defconfig +F: include/configs/mk808.h
board/rikomagic/mk808/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += mk808.o
board/rikomagic/mk808/mk808.c new file +3 -0
@@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <common.h>
Signature · 1 line
2.20.1
PATCH v8 13/15 rockchip: rk3066: add mk808_defconfig
In reply to Johan JonkerThis commit adds the default configuration file and relevant description for a MK808 board.
---
Changed V8:
use default log level
ENV_IS_NOWHERE
--- configs/mk808_defconfig | 99 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 configs/mk808_defconfig
configs/mk808_defconfig new file +99 -0
@@ -0,0 +1,99 @@ +CONFIG_ARM=y +# CONFIG_SPL_SYS_THUMB_BUILD is not set +# CONFIG_TPL_SYS_THUMB_BUILD is not set +# CONFIG_SPL_USE_ARCH_MEMCPY is not set +# CONFIG_SPL_USE_ARCH_MEMSET is not set +CONFIG_ARCH_ROCKCHIP=y +CONFIG_SYS_TEXT_BASE=0x60408000 +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_ENV_SIZE=0x8000 +CONFIG_DEFAULT_DEVICE_TREE="rk3066a-mk808" +CONFIG_SPL_TEXT_BASE=0x60000000 +CONFIG_ROCKCHIP_RK3066=y +CONFIG_TPL_TEXT_BASE=0x10080C04 +CONFIG_TPL_MAX_SIZE=32764 +CONFIG_TPL_STACK=0x1008FFFF +CONFIG_TARGET_MK808=y +CONFIG_SPL_STACK_R_ADDR=0x70000000 +CONFIG_DEBUG_UART_BASE=0x20064000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_SPL_FS_FAT=y +CONFIG_SPL_PAYLOAD="u-boot.bin" +CONFIG_DEBUG_UART=y +CONFIG_SYS_LOAD_ADDR=0x70800800 +CONFIG_SD_BOOT=y +CONFIG_USE_PREBOOT=y +CONFIG_DEFAULT_FDT_FILE="rk3066a-mk808.dtb" +# CONFIG_DISPLAY_CPUINFO is not set +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_LATE_INIT=y +CONFIG_SPL_STACK_R=y +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200000 +CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_FS_EXT4=y +CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=2 +CONFIG_TPL_NEEDS_SEPARATE_TEXT_BASE=y +CONFIG_TPL_NEEDS_SEPARATE_STACK=y +# CONFIG_BOOTM_PLAN9 is not set +# CONFIG_BOOTM_RTEMS is not set +# CONFIG_BOOTM_VXWORKS is not set +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_CACHE=y +CONFIG_CMD_TIME=y +CONFIG_CMD_REGULATOR=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_TPL_OF_CONTROL=y +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +CONFIG_OF_DTB_PROPS_REMOVE=y +CONFIG_SPL_OF_PLATDATA=y +CONFIG_TPL_OF_PLATDATA=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +# CONFIG_NET is not set +CONFIG_TPL_DM=y +# CONFIG_DM_WARN is not set +CONFIG_REGMAP=y +CONFIG_SPL_REGMAP=y +CONFIG_TPL_REGMAP=y +CONFIG_SYSCON=y +CONFIG_SPL_SYSCON=y +CONFIG_TPL_SYSCON=y +# CONFIG_SIMPLE_BUS is not set +# CONFIG_SPL_SIMPLE_BUS is not set +# CONFIG_TPL_BLK is not set +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_TPL_CLK=y +CONFIG_ROCKCHIP_GPIO=y +# CONFIG_SPL_DM_I2C is not set +CONFIG_LED=y +CONFIG_MMC_IO_VOLTAGE=y +CONFIG_SPL_MMC_IO_VOLTAGE=y +CONFIG_MMC_UHS_SUPPORT=y +CONFIG_SPL_MMC_UHS_SUPPORT=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_SF_DEFAULT_SPEED=20000000 +CONFIG_PINCTRL=y +CONFIG_DM_PMIC=y +# CONFIG_SPL_PMIC_CHILDREN is not set +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_RAM=y +CONFIG_SPL_RAM=y +CONFIG_TPL_RAM=y +CONFIG_DM_RESET=y +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_DEBUG_UART_ANNOUNCE=y +CONFIG_ROCKCHIP_SERIAL=y +CONFIG_SYSRESET=y +CONFIG_TIMER=y +CONFIG_SPL_TIMER=y +CONFIG_TPL_TIMER=y +CONFIG_DESIGNWARE_APB_TIMER=y +CONFIG_SPL_TINY_MEMSET=y +CONFIG_ERRNO_STR=y +# CONFIG_TPL_OF_LIBFDT is not set
Signature · 1 line
2.20.1
PATCH v8 14/15 rockchip: tools: add rk3066 support to rkcommon.c
In reply to Johan JonkerAdd rk3066 support to rkcommon.c
--- tools/rkcommon.c | 1 + 1 file changed, 1 insertion(+)
tools/rkcommon.c +1 -0
@@ -123,6 +123,7 @@ struct spl_info {static struct spl_info spl_infos[] = { {"px30" ,"RK33" ,0x2800 , false,RK_HEADER_V1 }, {"rk3036" ,"RK30" ,0x1000 , false,RK_HEADER_V1 }, + {"rk3066" ,"RK30" ,0x8000 -0x800 , true,RK_HEADER_V1 }, {"rk3128" ,"RK31" ,0x1800 , false,RK_HEADER_V1 }, {"rk3188" ,"RK31" ,0x8000 -0x800 , true,RK_HEADER_V1 }, {"rk322x" ,"RK32" ,0x8000 -0x1000 , false,RK_HEADER_V1 },
Signature · 1 line
2.20.1
PATCH v8 15/15 doc: rockchip: add rk3066 Rikomagic MK808
In reply to Johan JonkerAdd rk3066 Rikomagic MK808 to the list of
mainline supported Rockchip boards.
--- doc/board/rockchip/rockchip.rst | 2 ++ 1 file changed, 2 insertions(+)
doc/board/rockchip/rockchip.rst +2 -0
@@ -24,6 +24,8 @@ List of mainline supported Rockchip boards: * rk3036 - Rockchip Evb-RK3036 (evb-rk3036) - Kylin (kylin_rk3036) +* rk3066 + - Rikomagic MK808 (mk808) * rk3128 - Rockchip Evb-RK3128 (evb-rk3128) * rk3188
Signature · 1 line
2.20.1