add support for rk3066 platform.
Subsystems (6)
cover add support for rk3066 platform.
This patch serie adds support for Rockchip RK3066 processor.
Paweł Jarosz (13):
rockchip: rk3066: add grf header file
rockchip: rk3066: add rk3066 pinctrl driver
rockchip: rk3066: add sysreset driver
rockchip: rk3066: add clock driver for rk3066 soc
rockchip: rk3066: add rk3066 platform devicetree file
rockchip: rk3066: add core support
rockchip: rk3066: add mk808 board files
rockchip: mmc: support rk3066 mmc
rockchip: dts: set fifo mode as default for mmc
rockchip: rk3066: add sdram driver
rockchip: serial: support rockchip rk3066
armv7: support rk3066 early back to bootrom in start.S
rockchip: rk3066: add sdram init code for tpl
arch/arm/cpu/armv7/start.S | 13 + arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3066a-mk808.dts | 172 ++++ arch/arm/dts/rk3066a.dtsi | 699 +++++++++++++++++ arch/arm/dts/rk3xxx.dtsi | 3 + arch/arm/include/asm/arch-rockchip/cru_rk3066.h | 189 +++++ arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/include/asm/arch-rockchip/grf_rk3066.h | 621 +++++++++++++++ arch/arm/mach-rockchip/Kconfig | 16 + arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 ++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 ++ arch/arm/mach-rockchip/rk3066-board.c | 180 +++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 + arch/arm/mach-rockchip/rk3066/Makefile | 13 + arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/sdram_rk3066.c | 111 +++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++ board/rikomagic/mk808_rk3066/Kconfig | 15 + board/rikomagic/mk808_rk3066/MAINTAINERS | 6 + board/rikomagic/mk808_rk3066/Makefile | 7 + board/rikomagic/mk808_rk3066/mk808_rk3066.c | 10 + configs/mk808-rk3066_defconfig | 54 ++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 586 ++++++++++++++ drivers/mmc/rockchip_dw_mmc.c | 31 +- drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl_rk3066.c | 342 ++++++++ drivers/serial/serial_rockchip.c | 19 +- drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_rk3066.c | 62 ++ include/configs/mk808_rk3066.h | 15 + include/configs/rk3066_common.h | 125 +++ 35 files changed, 4643 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 arch/arm/dts/rk3066a.dtsi 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-board-spl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board-tpl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board.c 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/sdram_init.c create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/syscon_rk3066.c create mode 100644 board/rikomagic/mk808_rk3066/Kconfig create mode 100644 board/rikomagic/mk808_rk3066/MAINTAINERS create mode 100644 board/rikomagic/mk808_rk3066/Makefile create mode 100644 board/rikomagic/mk808_rk3066/mk808_rk3066.c create mode 100644 configs/mk808-rk3066_defconfig create mode 100644 drivers/clk/rockchip/clk_rk3066.c create mode 100644 drivers/pinctrl/rockchip/pinctrl_rk3066.c create mode 100644 drivers/sysreset/sysreset_rk3066.c create mode 100644 include/configs/mk808_rk3066.h create mode 100644 include/configs/rk3066_common.h
Signature · 1 line
2.7.4
PATCH 1/13 rockchip: rk3066: add grf header file
grf is needed by various drivers for rk3066 soc.
--- arch/arm/include/asm/arch-rockchip/grf_rk3066.h | 621 ++++++++++++++++++++++++ 1 file changed, 621 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h
arch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +621 -0
@@ -0,0 +1,621 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef _ASM_ARCH_GRF_RK3066_H +#define _ASM_ARCH_GRF_RK3066_H + +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_GPIO0A_IOMUX */ +enum { +GPIO0A6_SHIFT =12 , +GPIO0A6_MASK =1 , +GPIO0A6_GPIO =0 , +GPIO0A6_HOST_DRV_VBUS , + +GPIO0A5_SHIFT =10 , +GPIO0A5_MASK =1 , +GPIO0A5_GPIO =0 , +GPIO0A5_OTG_DRV_VBUS , + +GPIO0A4_SHIFT =8 , +GPIO0A4_MASK =1 , +GPIO0A4_GPIO =0 , +GPIO0A4_PWM1 , + +GPIO0A3_SHIFT =6 , +GPIO0A3_MASK =1 , +GPIO0A3_GPIO =0 , +GPIO0A3_PWM0 +}; + +/* GRF_GPIO0D_IOMUX */ +enum { +GPIO0D7_SHIFT =14 , +GPIO0D7_MASK =1 , +GPIO0D7_GPIO =0 , +GPIO0D7_PWM3 , + +GPIO0D6_SHIFT =12 , +GPIO0D6_MASK =1 , +GPIO0D6_GPIO =0 , +GPIO0D6_PWM2 +}; + +/* GRF_GPIO1A_IOMUX */ +enum { +GPIO1A7_SHIFT =14 , +GPIO1A7_MASK =3 , +GPIO1A7_GPIO =0 , +GPIO1A7_UART1_RTS_N , +GPIO1A7_SPI0_TXD , + +GPIO1A6_SHIFT =12 , +GPIO1A6_MASK =3 , +GPIO1A6_GPIO =0 , +GPIO1A6_UART1_CTS_N , +GPIO1A6_SPI0_RXD , + +GPIO1A5_SHIFT =10 , +GPIO1A5_MASK =3 , +GPIO1A5_GPIO =0 , +GPIO1A5_UART1_SOUT , +GPIO1A5_SPI0_CLK , + +GPIO1A4_SHIFT =8 , +GPIO1A4_MASK =3 , +GPIO1A4_GPIO =0 , +GPIO1A4_UART1_SIN , +GPIO1A4_SPI0_CSN0 , + +GPIO1A3_SHIFT =6 , +GPIO1A3_MASK =1 , +GPIO1A3_GPIO =0 , +GPIO1A3_UART0_RTS_N , + +GPIO1A2_SHIFT =4 , +GPIO1A2_MASK =1 , +GPIO1A2_GPIO =0 , +GPIO1A2_UART0_CTS_N , + +GPIO1A1_SHIFT =2 , +GPIO1A1_MASK =1 , +GPIO1A1_GPIO =0 , +GPIO1A1_UART0_SOUT , + +GPIO1A0_SHIFT =0 , +GPIO1A0_MASK =1 , +GPIO1A0_GPIO =0 , +GPIO1A0_UART0_SIN +}; + +/* GRF_GPIO1B_IOMUX */ +enum { +GPIO1B1_SHIFT =2 , +GPIO1B1_MASK =1 , +GPIO1B1_GPIO =0 , +GPIO1B1_UART2_SOUT , + +GPIO1B0_SHIFT =0 , +GPIO1B0_MASK =1 , +GPIO1B0_GPIO =0 , +GPIO1B0_UART2_SIN +}; + +/* GRF_GPIO2C_IOMUX */ +enum { +GPIO2C7_SHIFT =14 , +GPIO2C7_MASK =3 , +GPIO2C7_GPIO =0 , +GPIO2C7_LCDC1_DATA23 , +GPIO2C7_SPI1_CSN1 , +GPIO2C7_HSADC_DATA4 , + +GPIO2C6_SHIFT =12 , +GPIO2C6_MASK =3 , +GPIO2C6_GPIO =0 , +GPIO2C6_LCDC1_DATA22 , +GPIO2C6_SPI1_RXD , +GPIO2C6_HSADC_DATA3 , + +GPIO2C5_SHIFT =10 , +GPIO2C5_MASK =3 , +GPIO2C5_GPIO =0 , +GPIO2C5_LCDC1_DATA21 , +GPIO2C5_SPI1_TXD , +GPIO2C5_HSADC_DATA2 , + +GPIO2C4_SHIFT =8 , +GPIO2C4_MASK =3 , +GPIO2C4_GPIO =0 , +GPIO2C4_LCDC1_DATA20 , +GPIO2C4_SPI1_CSN0 , +GPIO2C4_HSADC_DATA1 , + +GPIO2C3_SHIFT =6 , +GPIO2C3_MASK =3 , +GPIO2C3_GPIO =0 , +GPIO2C3_LCDC1_DATA19 , +GPIO2C3_SPI1_CLK , +GPIO2C3_HSADC_DATA0 +}; + +/* GRF_GPIO2D_IOMUX */ +enum { +GPIO2D7_SHIFT =14 , +GPIO2D7_MASK =1 , +GPIO2D7_GPIO =0 , +GPIO2D7_I2C1_SCL , + +GPIO2D6_SHIFT =12 , +GPIO2D6_MASK =1 , +GPIO2D6_GPIO =0 , +GPIO2D6_I2C1_SDA , + +GPIO2D5_SHIFT =10 , +GPIO2D5_MASK =1 , +GPIO2D5_GPIO =0 , +GPIO2D5_I2C0_SCL , + +GPIO2D4_SHIFT =8 , +GPIO2D4_MASK =1 , +GPIO2D4_GPIO =0 , +GPIO2D4_I2C0_SDA + +}; + +/* GRF_GPIO3A_IOMUX */ +enum { +GPIO3A7_SHIFT =14 , +GPIO3A7_MASK =1 , +GPIO3A7_GPIO =0 , +GPIO3A7_SDMMC0_WRITE_PRT , + +GPIO3A6_SHIFT =12 , +GPIO3A6_MASK =1 , +GPIO3A6_GPIO =0 , +GPIO3A6_SDMMC0_RSTN_OUT , + +GPIO3A5_SHIFT =10 , +GPIO3A5_MASK =1 , +GPIO3A5_GPIO =0 , +GPIO3A5_I2C4_SCL , + +GPIO3A4_SHIFT =8 , +GPIO3A4_MASK =1 , +GPIO3A4_GPIO =0 , +GPIO3A4_I2C4_SDA , + +GPIO3A3_SHIFT =6 , +GPIO3A3_MASK =1 , +GPIO3A3_GPIO =0 , +GPIO3A3_I2C3_SCL , + +GPIO3A2_SHIFT =4 , +GPIO3A2_MASK =1 , +GPIO3A2_GPIO =0 , +GPIO3A2_I2C3_SDA , + +GPIO3A1_SHIFT =2 , +GPIO3A1_MASK =1 , +GPIO3A1_GPIO =0 , +GPIO3A1_I2C2_SCL , + +GPIO3A0_SHIFT =0 , +GPIO3A0_MASK =1 , +GPIO3A0_GPIO =0 , +GPIO3A0_I2C2_SDA , +}; + +/* GRF_GPIO3B_IOMUX */ +enum { +GPIO3B7_SHIFT =14 , +GPIO3B7_MASK =1 , +GPIO3B7_GPIO =0 , +GPIO3B7_SDMMC0_WRITE_PRT , + +GPIO3B6_SHIFT =12 , +GPIO3B6_MASK =1 , +GPIO3B6_GPIO =0 , +GPIO3B6_SDMMC0_DETECT_N , + +GPIO3B5_SHIFT =10 , +GPIO3B5_MASK =1 , +GPIO3B5_GPIO =0 , +GPIO3B5_SDMMC0_DATA3 , + +GPIO3B4_SHIFT =8 , +GPIO3B4_MASK =1 , +GPIO3B4_GPIO =0 , +GPIO3B4_SDMMC0_DATA2 , + +GPIO3B3_SHIFT =6 , +GPIO3B3_MASK =1 , +GPIO3B3_GPIO =0 , +GPIO3B3_SDMMC0_DATA1 , + +GPIO3B2_SHIFT =4 , +GPIO3B2_MASK =1 , +GPIO3B2_GPIO =0 , +GPIO3B2_SDMMC0_DATA0 , + +GPIO3B1_SHIFT =2 , +GPIO3B1_MASK =1 , +GPIO3B1_GPIO =0 , +GPIO3B1_SDMMC0_CMD , + +GPIO3B0_SHIFT =0 , +GPIO3B0_MASK =1 , +GPIO3B0_GPIO =0 , +GPIO3B0_SDMMC0_CLKOUT + +}; + +/* GRF_GPIO3C_IOMUX */ +enum { +GPIO3C7_SHIFT =14 , +GPIO3C7_MASK =1 , +GPIO3C7_GPIO =0 , +GPIO3C7_SDMMC1_WRITE_PRT , + +GPIO3C6_SHIFT =12 , +GPIO3C6_MASK =1 , +GPIO3C6_GPIO =0 , +GPIO3C6_SDMMC1_DETECT_N , + +GPIO3C5_SHIFT =10 , +GPIO3C5_MASK =1 , +GPIO3C5_GPIO =0 , +GPIO3C5_SDMMC1_CLKOUT , + +GPIO3C4_SHIFT =8 , +GPIO3C4_MASK =1 , +GPIO3C4_GPIO =0 , +GPIO3C4_SDMMC1_DATA3 , + +GPIO3C3_SHIFT =6 , +GPIO3C3_MASK =1 , +GPIO3C3_GPIO =0 , +GPIO3C3_SDMMC1_DATA2 , + +GPIO3C2_SHIFT =4 , +GPIO3C2_MASK =1 , +GPIO3C2_GPIO =0 , +GPIO3C2_SDMMC1_DATA1 , + +GPIO3C1_SHIFT =2 , +GPIO3C1_MASK =1 , +GPIO3C1_GPIO =0 , +GPIO3C1_SDMMC1_DATA0 , + +GPIO3C0_SHIFT =0 , +GPIO3C0_MASK =1 , +GPIO3C0_GPIO =0 , +GPIO3C0_SMMC1_CMD +}; + +/* GRF_GPIO3D_IOMUX */ +enum { +GPIO3D7_SHIFT =14 , +GPIO3D7_MASK =3 , +GPIO3D7_GPIO =0 , +GPIO3D7_FLASH_DQS , +GPIO3D7_EMMC_CLKOUT , + +GPIO3D6_SHIFT =12 , +GPIO3D6_MASK =1 , +GPIO3D6_GPIO =0 , +GPIO3D6_UART3_RTS_N , + +GPIO3D5_SHIFT =10 , +GPIO3D5_MASK =1 , +GPIO3D5_GPIO =0 , +GPIO3D5_UART3_CTS_N , + +GPIO3D4_SHIFT =8 , +GPIO3D4_MASK =1 , +GPIO3D4_GPIO =0 , +GPIO3D4_UART3_SOUT , + +GPIO3D3_SHIFT =6 , +GPIO3D3_MASK =1 , +GPIO3D3_GPIO =0 , +GPIO3D3_UART3_SIN , + +GPIO3D2_SHIFT =4 , +GPIO3D2_MASK =1 , +GPIO3D2_GPIO =0 , +GPIO3D2_SDMMC1_INT_N , + +GPIO3D1_SHIFT =2 , +GPIO3D1_MASK =1 , +GPIO3D1_GPIO =0 , +GPIO3D1_SDMMC1_BACKEND_PWR , + +GPIO3D0_SHIFT =0 , +GPIO3D0_MASK =1 , +GPIO3D0_GPIO =0 , +GPIO3D0_SDMMC1_PWR_EN + +}; + +/* GRF_GPIO4A_IOMUX */ +enum { +GPIO4A7_SHIFT =14 , +GPIO4A7_MASK =1 , +GPIO4A7_GPIO =0 , +GPIO4A7_FLASH_DATA15 , + +GPIO4A6_SHIFT =12 , +GPIO4A6_MASK =1 , +GPIO4A6_GPIO =0 , +GPIO4A6_FLASH_DATA14 , + +GPIO4A5_SHIFT =10 , +GPIO4A5_MASK =1 , +GPIO4A5_GPIO =0 , +GPIO4A5_FLASH_DATA13 , + +GPIO4A4_SHIFT =8 , +GPIO4A4_MASK =1 , +GPIO4A4_GPIO =0 , +GPIO4A4_FLASH_DATA12 , + +GPIO4A3_SHIFT =6 , +GPIO4A3_MASK =1 , +GPIO4A3_GPIO =0 , +GPIO4A3_FLASH_DATA11 , + +GPIO4A2_SHIFT =4 , +GPIO4A2_MASK =1 , +GPIO4A2_GPIO =0 , +GPIO4A2_FLASH_DATA10 , + +GPIO4A1_SHIFT =2 , +GPIO4A1_MASK =1 , +GPIO4A1_GPIO =0 , +GPIO4A1_FLASH_DATA9 , + +GPIO4A0_SHIFT =0 , +GPIO4A0_MASK =1 , +GPIO4A0_GPIO =0 , +GPIO4A0_FLASH_DATA8 + +}; + +/* GRF_GPIO4B_IOMUX */ +enum { +GPIO4B7_SHIFT =14 , +GPIO4B7_MASK =1 , +GPIO4B7_GPIO =0 , +GPIO4B7_SPI0_CSN1 , + +GPIO4B6_SHIFT =12 , +GPIO4B6_MASK =1 , +GPIO4B6_GPIO =0 , +GPIO4B6_FLASH_CSN7 , + +GPIO4B5_SHIFT =10 , +GPIO4B5_MASK =1 , +GPIO4B5_GPIO =0 , +GPIO4B5_FLASH_CSN6 , + +GPIO4B4_SHIFT =8 , +GPIO4B4_MASK =1 , +GPIO4B4_GPIO =0 , +GPIO4B4_FLASH_CSN5 , + +GPIO4B3_SHIFT =6 , +GPIO4B3_MASK =1 , +GPIO4B3_GPIO =0 , +GPIO4B3_FLASH_CSN4 , + +GPIO4B2_SHIFT =4 , +GPIO4B2_MASK =3 , +GPIO4B2_GPIO =0 , +GPIO4B2_FLASH_CSN3 , +GPIO4B2_EMMC_RSTN_OUT , + +GPIO4B1_SHIFT =2 , +GPIO4B1_MASK =3 , +GPIO4B1_GPIO =0 , +GPIO4B1_FLASH_CSN2 , +GPIO4B1_EMMC_CMD , + +GPIO4B0_SHIFT =0 , +GPIO4B0_MASK =1 , +GPIO4B0_GPIO =0 , +GPIO4B0_FLASH_CSN1 +}; + +/* GRF_SOC_CON0 */ +enum { +SMC_MUX_CON_SHIFT =13 , +SMC_MUX_CON_MASK =1 , + +NOC_REMAP_SHIFT =12 , +NOC_REMAP_MASK =1 , + +EMMC_FLASH_SEL_SHIFT =11 , +EMMC_FLASH_SEL_MASK =1 , + +TZPC_REVISION_SHIFT =7 , +TZPC_REVISION_MASK =0xf , + +L2CACHE_ACC_SHIFT =5 , +L2CACHE_ACC_MASK =3 , + +L2RD_WAIT_SHIFT =3 , +L2RD_WAIT_MASK =3 , + +IMEMRD_WAIT_SHIFT =1 , +IMEMRD_WAIT_MASK =3 , + +SOC_REMAP_SHIFT =0 , +SOC_REMAP_MASK =1 , +}; + +/* GRF_SOC_CON1 */ +enum { +RKI2C4_SEL_SHIFT =15 , +RKI2C4_SEL_MASK =1 , + +RKI2C3_SEL_SHIFT =14 , +RKI2C3_SEL_MASK =1 , + +RKI2C2_SEL_SHIFT =13 , +RKI2C2_SEL_MASK =1 , + +RKI2C1_SEL_SHIFT =12 , +RKI2C1_SEL_MASK =1 , + +RKI2C0_SEL_SHIFT =11 , +RKI2C0_SEL_MASK =1 , + +VCODEC_SEL_SHIFT =10 , +VCODEC_SEL_MASK =1 , + +PERI_EMEM_PAUSE_SHIFT =9 , +PERI_EMEM_PAUSE_MASK =1 , + +PERI_USB_PAUSE_SHIFT =8 , +PERI_USB_PAUSE_MASK =1 , + +SMC_MUX_MODE_0_SHIFT =6 , +SMC_MUX_MODE_0_MASK =1 , + +SMC_SRAM_MW_0_SHIFT =4 , +SMC_SRAM_MW_0_MASK =3 , + +SMC_REMAP_0_SHIFT =3 , +SMC_REMAP_0_MASK =1 , + +SMC_A_GT_M0_SYNC_SHIFT =2 , +SMC_A_GT_M0_SYNC_MASK =1 , + +EMAC_SPEED_SHIFT =1 , +EMAC_SPEEC_MASK =1 , + +EMAC_MODE_SHIFT =0 , +EMAC_MODE_MASK =1 , +}; + +/* GRF_SOC_CON2 */ +enum { + +MSCH4_MAINDDR3_SHIFT =7 , +MSCH4_MAINDDR3_MASK =1 , +MSCH4_MAINDDR3_DDR3 =1 , + +EMAC_NEWRCV_EN_SHIFT =6 , +EMAC_NEWRCV_EN_MASK =1 , + +SW_ADDR15_EN_SHIFT =5 , +SW_ADDR15_EN_MASK =1 , + +SW_ADDR16_EN_SHIFT =4 , +SW_ADDR16_EN_MASK =1 , + +SW_ADDR17_EN_SHIFT =3 , +SW_ADDR17_EN_MASK =1 , + +BANK2_TO_RANK_EN_SHIFT =2 , +BANK2_TO_RANK_EN_MASK =1 , + +RANK_TO_ROW15_EN_SHIFT =1 , +RANK_TO_ROW15_EN_MASK =1 , + +UPCTL_C_ACTIVE_IN_SHIFT =0 , +UPCTL_C_ACTIVE_IN_MASK =1 , +UPCTL_C_ACTIVE_IN_MAY =0 , +UPCTL_C_ACTIVE_IN_WILL , +}; + +/* GRF_DDRC_CON0 */ +enum { +DTO_LB_SHIFT =11 , +DTO_LB_MASK =3 , + +DTO_TE_SHIFT =9 , +DTO_TE_MASK =3 , + +DTO_PDR_SHIFT =7 , +DTO_PDR_MASK =3 , + +DTO_PDD_SHIFT =5 , +DTO_PDD_MASK =3 , + +DTO_IOM_SHIFT =3 , +DTO_IOM_MASK =3 , + +DTO_OE_SHIFT =1 , +DTO_OE_MASK =3 , + +ATO_AE_SHIFT =0 , +ATO_AE_MASK =1 , +}; +#endif
Signature · 1 line
2.7.4
PATCH 1/13 rockchip: rk3066: add grf header file
Hi Pawel,
Quoted 80 lines · Paweł Jarosz
grf is needed by various drivers for rk3066 soc.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/grf_rk3066.h | 621 ++++++++++++++++++++++++ 1 file changed, 621 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.harch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +66
-0@@ -0,0 +1,621 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef _ASM_ARCH_GRF_RK3066_H +#define _ASM_ARCH_GRF_RK3066_H + +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; +
arch/arm/include/asm/arch-rockchip/grf_rk3066.h line 76
Quoted 10 lines
arch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +10
-0+u32 reserved2[10 ]; + +u32 os_reg[4 ]; +}; +check_member (rk3066_grf, os_reg[3 ],0x01d4 ); + +/* GRF_GPIO0A_IOMUX */ +enum { +GPIO0A6_SHIFT =12 , +GPIO0A6_MASK =1 ,
Can you please use shifted masks for these values?
GPIO0A6_MASK = 1 << GPIO0A6_SHIFT,
Quoted 2 lines
arch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +2
-0+GPIO0A6_GPIO =0 , + GPIO0A6_HOST_DRV_VBUS,
PATCH 1/13 rockchip: rk3066: add grf header file
Hi Simon
W dniu 06.06.2017 o 23:09, Simon Glass pisze:
Quoted 95 lines
Hi Pawel,
Quoted 80 lines · Paweł Jarosz
grf is needed by various drivers for rk3066 soc.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/grf_rk3066.h | 621 ++++++++++++++++++++++++ 1 file changed, 621 insertions(+)create mode 100644
arch/arm/include/asm/arch-rockchip/grf_rk3066.harch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +66
-0@@ -0,0 +1,621 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#ifndef _ASM_ARCH_GRF_RK3066_H +#define _ASM_ARCH_GRF_RK3066_H + +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; +arch/arm/include/asm/arch-rockchip/grf_rk3066.h line 76
Quoted 10 lines
arch/arm/include/asm/arch-rockchip/grf_rk3066.h new file +10
-0+u32 reserved2[10 ]; + +u32 os_reg[4 ]; +}; +check_member (rk3066_grf, os_reg[3 ],0x01d4 ); + +/* GRF_GPIO0A_IOMUX */ +enum { +GPIO0A6_SHIFT =12 , +GPIO0A6_MASK =1 ,Can you please use shifted masks for these values?
Quoted 1 line
GPIO0A6_MASK= 1 <<GPIO0A6_SHIFT,
I will do that in the next version.
Regards
Paweł
PATCH 1/13 rockchip: rk3066: add grf header file
In reply to Paweł JaroszQuoted 8 lines
grf is needed by various drivers for rk3066 soc.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/grf_rk3066.h | 621 ++++++++++++++++++++++++ 1 file changed, 621 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h
PATCH 2/13 rockchip: rk3066: add rk3066 pinctrl driver
In reply to Paweł JaroszAdd driver supporting pin multiplexing on rk3066 platform.
--- drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl_rk3066.c | 342 ++++++++++++++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl_rk3066.c
drivers/pinctrl/Kconfig +9 -0
@@ -167,6 +167,15 @@ config PINCTRL_ROCKCHIP_RK3036 the GPIO definitions and pin control functions for each available multiplex function. +config PINCTRL_ROCKCHIP_RK3066 + bool "Rockchip rk3066 pin control driver" + depends on DM + help + Support pin multiplexing control on Rockchip rk3066 SoCs. The driver is + controlled by a device tree node which contains both the GPIO + definitions and pin control functions for each available multiplex + function. + config PINCTRL_ROCKCHIP_RK3188 bool "Rockchip rk3188 pin control driver" depends on DM
drivers/pinctrl/rockchip/Makefile +1 -0
@@ -6,6 +6,7 @@ # obj-$(CONFIG_PINCTRL_ROCKCHIP_RK3036) += pinctrl_rk3036.o +obj-$(CONFIG_PINCTRL_ROCKCHIP_RK3066) += pinctrl_rk3066.o obj-$(CONFIG_PINCTRL_ROCKCHIP_RK3188) += pinctrl_rk3188.o obj-$(CONFIG_PINCTRL_ROCKCHIP_RK3288) += pinctrl_rk3288.o obj-$(CONFIG_PINCTRL_ROCKCHIP_RK3328) += pinctrl_rk3328.o
drivers/pinctrl/rockchip/pinctrl_rk3066.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/13 rockchip: rk3066: add rk3066 pinctrl driver
Quoted 9 lines · Paweł Jarosz
Add driver supporting pin multiplexing on rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl_rk3066.c | 342 ++++++++++++++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl_rk3066.c
Can you please update the masks here as per the previous comment on grf?
Otherwise looks good.
PATCH 2/13 rockchip: rk3066: add rk3066 pinctrl driver
In reply to Paweł JaroszQuoted 10 lines
Add driver supporting pin multiplexing on rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/pinctrl/Kconfig | 9 + drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl_rk3066.c | 342 ++++++++++++++++++++++++++++++ 3 files changed, 352 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl_rk3066.c
PATCH 3/13 rockchip: rk3066: add sysreset driver
In reply to Paweł JaroszAdd support for system reset for rk3066 socs.
--- drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_rk3066.c | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 drivers/sysreset/sysreset_rk3066.c
drivers/sysreset/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o endif +obj-$(CONFIG_ROCKCHIP_RK3066) += sysreset_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o obj-$(CONFIG_ROCKCHIP_RK3328) += sysreset_rk3328.o
drivers/sysreset/sysreset_rk3066.c new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/13 rockchip: rk3066: add sysreset driver
Quoted 9 lines · Paweł Jarosz
Add support for system reset for rk3066 socs.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_rk3066.c | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 drivers/sysreset/sysreset_rk3066.c
PATCH 3/13 rockchip: rk3066: add sysreset driver
In reply to Paweł JaroszQuoted 10 lines
Add support for system reset for rk3066 socs.
Signed-off-by Paweł Jarosz <[email protected]>Reviewed-by Simon Glass <[email protected]>--- drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_rk3066.c | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 drivers/sysreset/sysreset_rk3066.c
PATCH 3/13 rockchip: rk3066: add sysreset driver
In reply to Paweł JaroszLooks like we're ending up with a lot of sysreset_rk3***.o drivers here that all have more or less the same logic in them. This one looks like a verbatim copy of the RK3188 one...
Can we start deduplicating this and have rk3188/rk3066_sysreset_request as a common function that is parameterised using register offsets from a driver-data structure?
As a side-note: I think I need to do the same for the other ones (i.e. RK32xx and RK33xx sysreset drivers that are basically copy-and-paste...) for the next iteration.
Quoted 92 lines · Paweł Jarosz
Add support for system reset for rk3066 socs.
Signed-off-by Paweł Jarosz <[email protected]>Reviewed-by Simon Glass <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
drivers/sysreset/Makefile| 1 +drivers/sysreset/sysreset_rk3066.c| 62 ++++++++++++++++++++++++++++++++++++++2 files changed, 63 insertions(+)create mode 100644
drivers/sysreset/sysreset_rk3066.cdrivers/sysreset/Makefile +0
-0@@ -12,6 +12,7 @@ obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.oifndef
CONFIG_SPL_BUILDobj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o endif
+obj-$(CONFIG_ROCKCHIP_RK3066) += sysreset_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3188) += sysreset_rk3188.o obj-$(CONFIG_ROCKCHIP_RK3288) += sysreset_rk3288.o obj-$(CONFIG_ROCKCHIP_RK3328) += sysreset_rk3328.odrivers/sysreset/sysreset_rk3066.c new file +62
-0@@ -0,0 +1,62 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0 +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <syscon.h> +#include <sysreset.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/hardware.h> +#include <linux/err.h> + +int rk3066_sysreset_request (struct udevice *dev,enum sysreset_t type) +{ +struct rk3066_cru *cru =rockchip_get_cru (); +struct rk3066_grf *grf; + +if (IS_ERR (cru)) +return PTR_ERR (cru); + +switch (type) { +case SYSRESET_WARM : + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) +return -EPROTONOSUPPORT ; +/* +* warm-reset keeps the remap value, +* so make sure it's disabled. +*/ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +0 <<NOC_REMAP_SHIFT ); + +rk_clrreg (&cru->cru_mode_con,0xffff ); +writel (0xeca8 , &cru->cru_glb_srst_snd_value); +break ; +case SYSRESET_COLD : +rk_clrreg (&cru->cru_mode_con,0xffff ); +writel (0xfdb9 , &cru->cru_glb_srst_fst_value); +break ; +default : +return -EPROTONOSUPPORT ; + } + +return -EINPROGRESS ; +} + +static struct sysreset_ops rk3066_sysreset = { + .request = rk3066_sysreset_request, +}; + +U_BOOT_DRIVER (sysreset_rk3066) = { + .name ="rk3066_sysreset" , + .id =UCLASS_SYSRESET , + .ops = &rk3066_sysreset, +};
PATCH 3/13 rockchip: rk3066: add sysreset driver
Quoted 5 lines · Philipp Tomsich
Looks like we're ending up with a lot of sysreset_rk3***.o drivers here that all have more or less the same logic in them. This one looks like a verbatim copy of the RK3188 one...
Quoted 7 lines
Can we start deduplicating this and have rk3188/rk3066_sysreset_request as a common function that is parameterised using register offsets from a driver-data structure?
As a side-note: I think I need to do the same for the other ones (i.e. RK32xx and RK33xx sysreset drivers that are basically copy-and-paste...) for the next iteration.
Sounds good!
PATCH 4/13 rockchip: rk3066: add clock driver for rk3066 soc
In reply to Paweł JaroszAdd clock driver for rk3066 platform.
--- arch/arm/include/asm/arch-rockchip/cru_rk3066.h | 189 ++++++++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 586 ++++++++++++++++++++++++ 3 files changed, 776 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 +189 -0
@@ -0,0 +1,189 @@ +/* +* (C) Copyright 2016 Heiko Stuebner <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _ASM_ARCH_CRU_RK3066_H +#define _ASM_ARCH_CRU_RK3066_H + +#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 { +/* a9_core_div: core = core_src / (a9_core_div + 1) */ +A9_CORE_DIV_SHIFT =9 , +A9_CORE_DIV_MASK =0x1f , +CORE_PLL_SHIFT =8 , +CORE_PLL_MASK =1 , +CORE_PLL_SELECT_APLL =0 , +CORE_PLL_SELECT_GPLL , + +/* core peri div: core:core_peri = 2:1, 4:1, 8:1 or 16:1 */ +CORE_PERI_DIV_SHIFT =6 , +CORE_PERI_DIV_MASK =3 , + +/* aclk_cpu pll selection */ +CPU_ACLK_PLL_SHIFT =5 , +CPU_ACLK_PLL_MASK =1 , +CPU_ACLK_PLL_SELECT_APLL =0 , +CPU_ACLK_PLL_SELECT_GPLL , + +/* a9_cpu_div: aclk_cpu = cpu_src / (a9_cpu_div + 1) */ +A9_CPU_DIV_SHIFT =0 , +A9_CPU_DIV_MASK =0x1f , +}; + +/* CRU_CLKSEL1_CON */ +enum { +/* ahb2apb_pclk_div: hclk_cpu:pclk_cpu = 1:1, 2:1 or 4:1 */ +AHB2APB_DIV_SHIFT =14 , +AHB2APB_DIV_MASK =3 , + +/* cpu_pclk_div: aclk_cpu:pclk_cpu = 1:1, 2:1, 4:1 or 8:1 */ +CPU_PCLK_DIV_SHIFT =12 , +CPU_PCLK_DIV_MASK =3 , + +/* cpu_hclk_div: aclk_cpu:hclk_cpu = 1:1, 2:1 or 4:1 */ +CPU_HCLK_DIV_SHIFT =8 , +CPU_HCLK_DIV_MASK =3 , + +/* core_aclk_div: cire:aclk_core = 1:1, 2:1, 3:1, 4:1 or 8:1 */ +CORE_ACLK_DIV_SHIFT =3 , +CORE_ACLK_DIV_MASK =7 , +}; + +/* CRU_CLKSEL10_CON */ +enum { +PERI_SEL_PLL_MASK =1 , +PERI_SEL_PLL_SHIFT =15 , +PERI_SEL_CPLL =0 , +PERI_SEL_GPLL , + +/* peri pclk div: aclk_bus:pclk_bus = 1:1, 2:1, 4:1 or 8:1 */ +PERI_PCLK_DIV_SHIFT =12 , +PERI_PCLK_DIV_MASK =3 , + +/* peripheral bus hclk div:aclk_bus: hclk_bus = 1:1, 2:1 or 4:1 */ +PERI_HCLK_DIV_SHIFT =8 , +PERI_HCLK_DIV_MASK =3 , + +/* peri aclk div: aclk_peri = periph_src / (peri_aclk_div + 1) */ +PERI_ACLK_DIV_SHIFT =0 , +PERI_ACLK_DIV_MASK =0x1f , +}; +/* CRU_CLKSEL11_CON */ +enum { +MMC0_DIV_SHIFT =0 , +MMC0_DIV_MASK =0x3f , +}; + +/* CRU_CLKSEL12_CON */ +enum { +UART_PLL_SHIFT =15 , +UART_PLL_MASK =1 , +UART_PLL_SELECT_GENERAL =0 , +UART_PLL_SELECT_CODEC , + +EMMC_DIV_SHIFT =8 , +EMMC_DIV_MASK =0x3f , + +SDIO_DIV_SHIFT =0 , +SDIO_DIV_MASK =0x3f , +}; + +/* CRU_CLKSEL25_CON */ +enum { +SPI1_DIV_SHIFT =8 , +SPI1_DIV_MASK =0x7f , + +SPI0_DIV_SHIFT =0 , +SPI0_DIV_MASK =0x7f , +}; + +/* CRU_MODE_CON */ +enum { +GPLL_MODE_SHIFT =12 , +GPLL_MODE_MASK =3 , +GPLL_MODE_SLOW =0 , +GPLL_MODE_NORMAL , +GPLL_MODE_DEEP , + +CPLL_MODE_SHIFT =8 , +CPLL_MODE_MASK =3 , +CPLL_MODE_SLOW =0 , +CPLL_MODE_NORMAL , +CPLL_MODE_DEEP , + +DPLL_MODE_SHIFT =4 , +DPLL_MODE_MASK =3 , +DPLL_MODE_SLOW =0 , +DPLL_MODE_NORMAL , +DPLL_MODE_DEEP , + +APLL_MODE_SHIFT =0 , +APLL_MODE_MASK =3 , +APLL_MODE_SLOW =0 , +APLL_MODE_NORMAL , +APLL_MODE_DEEP , +}; + +/* CRU_APLL_CON0 */ +enum { +CLKR_SHIFT =8 , +CLKR_MASK =0x3f , + +CLKOD_SHIFT =0 , +CLKOD_MASK =0x3f , +}; + +/* CRU_APLL_CON1 */ +enum { +CLKF_SHIFT =0 , +CLKF_MASK =0x1fff , +}; + +#endif
drivers/clk/rockchip/Makefile +1 -0
@@ -5,6 +5,7 @@ # obj-$(CONFIG_ROCKCHIP_RK3036) += clk_rk3036.o +obj-$(CONFIG_ROCKCHIP_RK3066) += clk_rk3066.o obj-$(CONFIG_ROCKCHIP_RK3188) += clk_rk3188.o obj-$(CONFIG_ROCKCHIP_RK3288) += clk_rk3288.o obj-$(CONFIG_ROCKCHIP_RK3328) += clk_rk3328.o
drivers/clk/rockchip/clk_rk3066.c new file +586 -0
586 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 4/13 rockchip: rk3066: add clock driver for rk3066 soc
Quoted 10 lines · Paweł Jarosz
Add clock driver for rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/cru_rk3066.h | 189 ++++++++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 586 ++++++++++++++++++++++++ 3 files changed, 776 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h create mode 100644 drivers/clk/rockchip/clk_rk3066.c
Again please can you update the masks?
PATCH 4/13 rockchip: rk3066: add clock driver for rk3066 soc
In reply to Paweł JaroszQuoted 11 lines
Add clock driver for rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/cru_rk3066.h | 189 ++++++++ drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 586 ++++++++++++++++++++++++ 3 files changed, 776 insertions(+) create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h create mode 100644 drivers/clk/rockchip/clk_rk3066.c
PATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
In reply to Paweł Jaroszrk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
--- arch/arm/dts/rk3066a.dtsi | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 arch/arm/dts/rk3066a.dtsi
arch/arm/dts/rk3066a.dtsi new file +699 -0
@@ -0,0 +1,699 @@ +/* + * Copyright (c) 2013 MundoReader S.L. + * Author: Heiko Stuebner <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/clock/rk3066a-cru.h> +#include "rk3xxx.dtsi" + +/ { + compatible = "rockchip,rk3066a"; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + enable-method = "rockchip,rk3066-smp"; + + cpu0: cpu at 0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + next-level-cache = <&L2>; + reg = <0x0>; + operating-points = < + /* kHz uV */ + 1416000 1300000 + 1200000 1175000 + 1008000 1125000 + 816000 1125000 + 600000 1100000 + 504000 1100000 + 312000 1075000 + >; + clock-latency = <40000>; + clocks = <&cru ARMCLK>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + }; + + sram: sram at 10080000 { + compatible = "mmio-sram"; + reg = <0x10080000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x10080000 0x10000>; + + smp-sram at 0 { + compatible = "rockchip,rk3066-smp-sram"; + reg = <0x0 0x50>; + }; + }; + + i2s0: i2s at 10118000 { + compatible = "rockchip,rk3066-i2s"; + reg = <0x10118000 0x2000>; + interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_bus>; + dmas = <&dmac1_s 4>, <&dmac1_s 5>; + dma-names = "tx", "rx"; + clock-names = "i2s_hclk", "i2s_clk"; + clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; + rockchip,playback-channels = <8>; + rockchip,capture-channels = <2>; + status = "disabled"; + }; + + i2s1: i2s at 1011a000 { + compatible = "rockchip,rk3066-i2s"; + reg = <0x1011a000 0x2000>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_bus>; + dmas = <&dmac1_s 6>, <&dmac1_s 7>; + dma-names = "tx", "rx"; + clock-names = "i2s_hclk", "i2s_clk"; + clocks = <&cru HCLK_I2S1>, <&cru SCLK_I2S1>; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + status = "disabled"; + }; + + i2s2: i2s at 1011c000 { + compatible = "rockchip,rk3066-i2s"; + reg = <0x1011c000 0x2000>; + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s2_bus>; + dmas = <&dmac1_s 9>, <&dmac1_s 10>; + dma-names = "tx", "rx"; + clock-names = "i2s_hclk", "i2s_clk"; + clocks = <&cru HCLK_I2S2>, <&cru SCLK_I2S2>; + rockchip,playback-channels = <2>; + rockchip,capture-channels = <2>; + status = "disabled"; + }; + + cru: clock-controller at 20000000 { + compatible = "rockchip,rk3066a-cru"; + reg = <0x20000000 0x1000>; + rockchip,grf = <&grf>; + u-boot,dm-spl; + + #clock-cells = <1>; + #reset-cells = <1>; + assigned-clocks = <&cru PLL_CPLL>, <&cru PLL_GPLL>, + <&cru ACLK_CPU>, <&cru HCLK_CPU>, + <&cru PCLK_CPU>, <&cru ACLK_PERI>, + <&cru HCLK_PERI>, <&cru PCLK_PERI>; + assigned-clock-rates = <400000000>, <594000000>, + <300000000>, <150000000>, + <75000000>, <300000000>, + <150000000>, <75000000>; + }; + + timer at 2000e000 { + compatible = "snps,dw-apb-timer-osc"; + reg = <0x2000e000 0x100>; + interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_TIMER2>, <&cru PCLK_TIMER2>; + clock-names = "timer", "pclk"; + }; + + efuse: efuse at 20010000 { + compatible = "rockchip,rk3066a-efuse"; + reg = <0x20010000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; + clocks = <&cru PCLK_EFUSE>; + clock-names = "pclk_efuse"; + + cpu_leakage: cpu_leakage at 17 { + reg = <0x17 0x1>; + }; + }; + + timer at 20038000 { + compatible = "snps,dw-apb-timer-osc"; + reg = <0x20038000 0x100>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_TIMER0>, <&cru PCLK_TIMER0>; + clock-names = "timer", "pclk"; + }; + + timer at 2003a000 { + compatible = "snps,dw-apb-timer-osc"; + reg = <0x2003a000 0x100>; + interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_TIMER1>, <&cru PCLK_TIMER1>; + clock-names = "timer", "pclk"; + }; + + tsadc: tsadc at 20060000 { + compatible = "rockchip,rk3066-tsadc"; + reg = <0x20060000 0x100>; + clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; + clock-names = "saradc", "apb_pclk"; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + #io-channel-cells = <1>; + resets = <&cru SRST_TSADC>; + reset-names = "saradc-apb"; + status = "disabled"; + }; + + usbphy: phy { + compatible = "rockchip,rk3066a-usb-phy", "rockchip,rk3288-usb-phy"; + rockchip,grf = <&grf>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + usbphy0: usb-phy at 17c { + #phy-cells = <0>; + reg = <0x17c>; + clocks = <&cru SCLK_OTGPHY0>; + clock-names = "phyclk"; + #clock-cells = <0>; + }; + + usbphy1: usb-phy at 188 { + #phy-cells = <0>; + reg = <0x188>; + clocks = <&cru SCLK_OTGPHY1>; + clock-names = "phyclk"; + #clock-cells = <0>; + }; + }; + + pinctrl: pinctrl { + compatible = "rockchip,rk3066a-pinctrl"; + rockchip,grf = <&grf>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + u-boot,dm-spl; + + gpio0: gpio0 at 20034000 { + compatible = "rockchip,gpio-bank"; + reg = <0x20034000 0x100>; + interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO0>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio1: gpio1 at 2003c000 { + compatible = "rockchip,gpio-bank"; + reg = <0x2003c000 0x100>; + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO1>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio2: gpio2 at 2003e000 { + compatible = "rockchip,gpio-bank"; + reg = <0x2003e000 0x100>; + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO2>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio3: gpio3 at 20080000 { + compatible = "rockchip,gpio-bank"; + reg = <0x20080000 0x100>; + interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO3>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio4: gpio4 at 20084000 { + compatible = "rockchip,gpio-bank"; + reg = <0x20084000 0x100>; + interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO4>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpio6: gpio6 at 2000a000 { + compatible = "rockchip,gpio-bank"; + reg = <0x2000a000 0x100>; + interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru PCLK_GPIO6>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + }; + + pcfg_pull_default: pcfg_pull_default { + bias-pull-pin-default; + }; + + pcfg_pull_none: pcfg_pull_none { + bias-disable; + }; + + emac { + emac_xfer: emac-xfer { + rockchip,pins = <RK_GPIO1 16 RK_FUNC_2 &pcfg_pull_none>, /* mac_clk */ + <RK_GPIO1 17 RK_FUNC_2 &pcfg_pull_none>, /* tx_en */ + <RK_GPIO1 18 RK_FUNC_2 &pcfg_pull_none>, /* txd1 */ + <RK_GPIO1 19 RK_FUNC_2 &pcfg_pull_none>, /* txd0 */ + <RK_GPIO1 20 RK_FUNC_2 &pcfg_pull_none>, /* rx_err */ + <RK_GPIO1 21 RK_FUNC_2 &pcfg_pull_none>, /* crs_dvalid */ + <RK_GPIO1 22 RK_FUNC_2 &pcfg_pull_none>, /* rxd1 */ + <RK_GPIO1 23 RK_FUNC_2 &pcfg_pull_none>; /* rxd0 */ + }; + + emac_mdio: emac-mdio { + rockchip,pins = <RK_GPIO1 24 RK_FUNC_2 &pcfg_pull_none>, /* mac_md */ + <RK_GPIO1 25 RK_FUNC_2 &pcfg_pull_none>; /* mac_mdclk */ + }; + }; + + emmc { + emmc_clk: emmc-clk { + rockchip,pins = <RK_GPIO3 31 RK_FUNC_2 &pcfg_pull_default>; + }; + + emmc_cmd: emmc-cmd { + rockchip,pins = <RK_GPIO4 9 RK_FUNC_2 &pcfg_pull_default>; + }; + + emmc_rst: emmc-rst { + rockchip,pins = <RK_GPIO4 10 RK_FUNC_2 &pcfg_pull_default>; + }; + + /* + * The data pins are shared between nandc and emmc and + * not accessible through pinctrl. Also they should've + * been already set correctly by firmware, as + * flash/emmc is the boot-device. + */ + }; + + i2c0 { + i2c0_xfer: i2c0-xfer { + rockchip,pins = <RK_GPIO2 28 RK_FUNC_1 &pcfg_pull_none>, + <RK_GPIO2 29 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + i2c1 { + i2c1_xfer: i2c1-xfer { + rockchip,pins = <RK_GPIO2 30 RK_FUNC_1 &pcfg_pull_none>, + <RK_GPIO2 31 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + i2c2 { + i2c2_xfer: i2c2-xfer { + rockchip,pins = <RK_GPIO3 0 RK_FUNC_1 &pcfg_pull_none>, + <RK_GPIO3 1 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + i2c3 { + i2c3_xfer: i2c3-xfer { + rockchip,pins = <RK_GPIO3 2 RK_FUNC_2 &pcfg_pull_none>, + <RK_GPIO3 3 RK_FUNC_2 &pcfg_pull_none>; + }; + }; + + i2c4 { + i2c4_xfer: i2c4-xfer { + rockchip,pins = <RK_GPIO3 4 RK_FUNC_1 &pcfg_pull_none>, + <RK_GPIO3 5 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + pwm0 { + pwm0_out: pwm0-out { + rockchip,pins = <RK_GPIO0 3 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + pwm1 { + pwm1_out: pwm1-out { + rockchip,pins = <RK_GPIO0 4 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + pwm2 { + pwm2_out: pwm2-out { + rockchip,pins = <RK_GPIO0 30 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + pwm3 { + pwm3_out: pwm3-out { + rockchip,pins = <RK_GPIO0 31 RK_FUNC_1 &pcfg_pull_none>; + }; + }; + + spi0 { + spi0_clk: spi0-clk { + rockchip,pins = <RK_GPIO1 5 RK_FUNC_2 &pcfg_pull_default>; + }; + spi0_cs0: spi0-cs0 { + rockchip,pins = <RK_GPIO1 4 RK_FUNC_2 &pcfg_pull_default>; + }; + spi0_tx: spi0-tx { + rockchip,pins = <RK_GPIO1 7 RK_FUNC_2 &pcfg_pull_default>; + }; + spi0_rx: spi0-rx { + rockchip,pins = <RK_GPIO1 6 RK_FUNC_2 &pcfg_pull_default>; + }; + spi0_cs1: spi0-cs1 { + rockchip,pins = <RK_GPIO4 15 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + spi1 { + spi1_clk: spi1-clk { + rockchip,pins = <RK_GPIO2 19 RK_FUNC_2 &pcfg_pull_default>; + }; + spi1_cs0: spi1-cs0 { + rockchip,pins = <RK_GPIO2 20 RK_FUNC_2 &pcfg_pull_default>; + }; + spi1_rx: spi1-rx { + rockchip,pins = <RK_GPIO2 22 RK_FUNC_2 &pcfg_pull_default>; + }; + spi1_tx: spi1-tx { + rockchip,pins = <RK_GPIO2 21 RK_FUNC_2 &pcfg_pull_default>; + }; + spi1_cs1: spi1-cs1 { + rockchip,pins = <RK_GPIO2 23 RK_FUNC_2 &pcfg_pull_default>; + }; + }; + + uart0 { + uart0_xfer: uart0-xfer { + rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart0_cts: uart0-cts { + rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart0_rts: uart0-rts { + rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + uart1 { + uart1_xfer: uart1-xfer { + rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart1_cts: uart1-cts { + rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart1_rts: uart1-rts { + rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + uart2 { + uart2_xfer: uart2-xfer { + rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>; + }; + /* no rts / cts for uart2 */ + }; + + uart3 { + uart3_xfer: uart3-xfer { + rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart3_cts: uart3-cts { + rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>; + }; + + uart3_rts: uart3-rts { + rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + sd0 { + sd0_clk: sd0-clk { + rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd0_cmd: sd0-cmd { + rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd0_cd: sd0-cd { + rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd0_wp: sd0-wp { + rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd0_bus1: sd0-bus-width1 { + rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd0_bus4: sd0-bus-width4 { + rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + sd1 { + sd1_clk: sd1-clk { + rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd1_cmd: sd1-cmd { + rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd1_cd: sd1-cd { + rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd1_wp: sd1-wp { + rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd1_bus1: sd1-bus-width1 { + rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>; + }; + + sd1_bus4: sd1-bus-width4 { + rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + i2s0 { + i2s0_bus: i2s0-bus { + rockchip,pins = <RK_GPIO0 7 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 8 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 9 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 10 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 11 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 12 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 13 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 14 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 15 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + i2s1 { + i2s1_bus: i2s1-bus { + rockchip,pins = <RK_GPIO0 16 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 17 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 18 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 19 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 20 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 21 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + + i2s2 { + i2s2_bus: i2s2-bus { + rockchip,pins = <RK_GPIO0 24 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 25 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 26 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 27 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 28 RK_FUNC_1 &pcfg_pull_default>, + <RK_GPIO0 29 RK_FUNC_1 &pcfg_pull_default>; + }; + }; + }; +}; + +&grf { + compatible = "rockchip,rk3066-grf", "syscon"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_xfer>; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_xfer>; +}; + +&i2c2 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_xfer>; +}; + +&i2c3 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c3_xfer>; +}; + +&i2c4 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c4_xfer>; +}; + +&mmc0 { + clock-frequency = <50000000>; + clock-freq-min-max = <5000000 50000000>; + dmas = <&dmac2 1>; + dma-names = "rx-tx"; + max-frequency = <50000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4>; + u-boot,dm-spl; +}; + +&mmc1 { + dmas = <&dmac2 3>; + dma-names = "rx-tx"; + pinctrl-names = "default"; + pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_bus4>; +}; + +&emmc { + dmas = <&dmac2 4>; + dma-names = "rx-tx"; +}; + +&pwm0 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_out>; +}; + +&pwm1 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm1_out>; +}; + +&pwm2 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_out>; +}; + +&pwm3 { + pinctrl-names = "default"; + pinctrl-0 = <&pwm3_out>; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_clk &spi0_tx &spi0_rx &spi0_cs0>; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0>; +}; + +&uart0 { + compatible = "rockchip,rk3066-uart", "snps,dw-apb-uart"; + dmas = <&dmac1_s 0>, <&dmac1_s 1>; + dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer>; +}; + +&uart1 { + compatible = "rockchip,rk3066-uart", "snps,dw-apb-uart"; + dmas = <&dmac1_s 2>, <&dmac1_s 3>; + dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1_xfer>; +}; + +&uart2 { + compatible = "rockchip,rk3066-uart", "snps,dw-apb-uart"; + dmas = <&dmac2 6>, <&dmac2 7>; + dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart2_xfer>; +}; + +&uart3 { + compatible = "rockchip,rk3066-uart", "snps,dw-apb-uart"; + dmas = <&dmac2 8>, <&dmac2 9>; + dma-names = "tx", "rx"; + pinctrl-names = "default"; + pinctrl-0 = <&uart3_xfer>; +}; + +&wdt { + compatible = "rockchip,rk3066-wdt", "snps,dw-wdt"; +}; + +&emac { + compatible = "rockchip,rk3066-emac"; +};
Signature · 1 line
2.7.4
PATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
Hi Pawel,
Quoted 8 lines · Paweł Jarosz
rk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/dts/rk3066a.dtsi | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 arch/arm/dts/rk3066a.dtsi
How come this file has 'a' on the end?
PATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 6 lines
Hi Pawel,
Quoted 3 lines · Paweł Jarosz
rk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
Quoted 8 lines
Quoted 5 lines
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/dts/rk3066a.dtsi | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+)create mode 100644
arch/arm/dts/rk3066a.dtsiHow come this file has 'a' on the end?
Reviewed-by Simon Glass <[email protected]>
Not sure why ... as there is no rk3066a named chip (acording to datasheet) but there is rk3066b.
I have copied linux source without renaming it.
Regards
Paweł
Heiko Stübner
maintainerPATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
Am Mittwoch, 7. Juni 2017, 17:12:24 CEST schrieb Paweł Jarosz:
Quoted 17 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 14 lines
Hi Pawel,
Quoted 10 lines · Paweł Jarosz
rk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
Signed-off-by Paweł Jarosz <[email protected]>---
arch/arm/dts/rk3066a.dtsi | 699++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+)
create mode 100644arch/arm/dts/rk3066a.dtsi
Quoted 7 lines
Quoted 3 lines
How come this file has 'a' on the end?
Reviewed-by Simon Glass <[email protected]>Not sure why ... as there is no rk3066a named chip (acording to datasheet) but there is rk3066b.
I have copied linux source without renaming it.
actually there are "only" rk3066a and rk3066b ... only the rk3066a often just gets called rk3066. If you look in device schematics you always find the rk3066a naming.
Also, so far I haven't seen any rk3066b yet, therefore we have no support for it at all.
Heiko
PATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
In reply to Paweł JaroszQuoted 10 lines
rk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
Signed-off-by Paweł Jarosz <[email protected]>Reviewed-by Simon Glass <[email protected]>--- arch/arm/dts/rk3066a.dtsi | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 arch/arm/dts/rk3066a.dtsi
PATCH 5/13 rockchip: rk3066: add rk3066 platform devicetree file
In reply to Paweł JaroszQuoted 11 lines
rk3066 peripherials include usb, i2c, pwm, gpio, sdio, sdmmc, emmc, spi, watchdog and uart
Signed-off-by Paweł Jarosz <[email protected]>Reviewed-by Simon Glass <[email protected]>Acked-by Philipp Tomsich <[email protected]>--- arch/arm/dts/rk3066a.dtsi | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 arch/arm/dts/rk3066a.dtsi
PATCH 6/13 rockchip: rk3066: add core support
In reply to Paweł JaroszAdd core skeleton for rk3066
--- arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 +++++++ arch/arm/mach-rockchip/rk3066-board.c | 180 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066-board-spl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board-tpl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board.c 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/syscon_rk3066.c create mode 100644 include/configs/rk3066_common.h
arch/arm/mach-rockchip/Kconfig +16 -0
@@ -11,6 +11,21 @@ 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_V7 + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select BOARD_LATE_INIT + select ROCKCHIP_BROM_HELPER + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A7 + including NEON and GPU, Mali-400 graphics, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. + config ROCKCHIP_RK3188 bool "Support Rockchip RK3188" select CPU_V7
@@ -91,6 +106,7 @@ config SPL_MMC_SUPPORT default y if !ROCKCHIP_SPL_BACK_TO_BROM source "arch/arm/mach-rockchip/rk3036/Kconfig" +source "arch/arm/mach-rockchip/rk3066/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk3288/Kconfig" source "arch/arm/mach-rockchip/rk3328/Kconfig"
arch/arm/mach-rockchip/Makefile +4 -0
@@ -7,15 +7,18 @@ obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o ifdef CONFIG_TPL_BUILD +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-tpl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else ifdef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o
@@ -29,6 +32,7 @@ ifndef CONFIG_TPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ endif +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/
arch/arm/mach-rockchip/rk3066-board-spl.c new file +173 -0
173 lines not on this page · raw message
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +46 -0
46 lines not on this page · raw message
arch/arm/mach-rockchip/rk3066-board.c new file +180 -0
180 lines not on this page · raw message
arch/arm/mach-rockchip/rk3066/Kconfig new file +34 -0
@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066" + help + MK808 is a tv stick with usb host and otg, microsd card slot, hdmi and wifi. + +config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT + default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endif
arch/arm/mach-rockchip/rk3066/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endif
arch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +54 -0
54 lines not on this page · raw message
include/configs/rk3066_common.h new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 6/13 rockchip: rk3066: add core support
Hi Pawel,
Quoted 115 lines · Paweł Jarosz
Add core skeleton for rk3066
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 +++++++ arch/arm/mach-rockchip/rk3066-board.c | 180 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066-board-spl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board-tpl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board.c 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/syscon_rk3066.c create mode 100644 include/configs/rk3066_common.harch/arm/mach-rockchip/Kconfig +16
-0@@ -11,6 +11,21 @@ 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_V7 + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select BOARD_LATE_INIT + select ROCKCHIP_BROM_HELPER + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A7 + including NEON and GPU, Mali-400 graphics, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. + config ROCKCHIP_RK3188 bool "Support Rockchip RK3188" select CPU_V7@@ -91,6 +106,7 @@ config SPL_MMC_SUPPORT default y if !ROCKCHIP_SPL_BACK_TO_BROM source "arch/arm/mach-rockchip/rk3036/Kconfig" +source "arch/arm/mach-rockchip/rk3066/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk3288/Kconfig" source "arch/arm/mach-rockchip/rk3328/Kconfig"arch/arm/mach-rockchip/Makefile +4
-0@@ -7,15 +7,18 @@ obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o ifdef CONFIG_TPL_BUILD +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-tpl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else ifdef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o@@ -29,6 +32,7 @@ ifndef CONFIG_TPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ endif +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/arch/arm/mach-rockchip/rk3066-board-spl.c new file +20
-0@@ -0,0 +1,173 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <clk.h> +#include <common.h> +#include <debug_uart.h> +#include <dm.h> +#include <fdtdec.h> +#include <led.h> +#include <malloc.h> +#include <ram.h> +#include <spl.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h>
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +10
-0+#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <asm/arch/timer.h> +#include <dm/pinctrl.h> +#include <dm/root.h> +#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h>
That should go below spi.h
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 5 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{
This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Quoted 177 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +138
-0+#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +const void *blob = gd->fdt_blob; +struct udevice *dev; +const char *bootdev; +int node; +int ret; + + bootdev =fdtdec_get_config_string (blob,"u-boot,boot0" ); +debug ("Boot device %s\n" , bootdev); +if (!bootdev) + goto fallback; + + node =fdt_path_offset (blob, bootdev); +if (node <0 ) { +debug ("node=%d\n" , node); + goto fallback; + } + ret =device_get_global_by_of_offset (node, &dev); +if (ret) { +debug ("device at node %s/%d not found: %d\n" , bootdev, node, + ret); + goto fallback; + } +debug ("Found device %s\n" , dev->name); +switch (device_get_uclass_id (dev)) { +case UCLASS_SPI_FLASH : +return BOOT_DEVICE_SPI ; +case UCLASS_MMC : +return BOOT_DEVICE_MMC1 ; +default : +debug ("Booting from device uclass '%s' not supported\n" , +dev_get_uclass_name (dev)); + } + +fallback: +#endif +return BOOT_DEVICE_MMC1 ; +} + +u32 spl_boot_mode (const u32 boot_device) +{ +return MMCSD_MODE_FS ; +} + +static int setup_arm_clock (void ) +{ +struct udevice *dev; +struct clk clk; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ret; + + clk.id =CLK_ARM ; + ret =clk_request (dev, &clk); +if (ret <0 ) +return ret; + + ret =clk_set_rate (&clk,600000000 ); + +clk_free (&clk); +return ret; +} + +void board_init_f (ulong dummy) +{ +struct udevice *pinctrl, *dev; +int ret; + +debug_uart_init (); + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } + +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +0x8 ,0x1 ,0x1 ); + + ret =rockchip_get_clk (&dev); +if (ret) { +debug ("CLK init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("Pinctrl init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ; + } + +setup_arm_clock (); +} + +void spl_board_init (void ) +{ +struct udevice *pinctrl; +int ret; + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + +#ifdef CONFIG_SPL_MMC_SUPPORT + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } +#endif + +/* Enable debug UART */ + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); +if (ret) { +debug ("%s: Failed to set up console UART\n" , __func__); + goto err; + } + +preloader_console_init (); + +return ; + +err: +printf ("spl_board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); +}arch/arm/mach-rockchip/rk3066-board-tpl.c new file +33
-0@@ -0,0 +1,46 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <debug_uart.h> +#include <spl.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define RK3066_TIMER_CONTROL 0x8 +#define GRF_BASE 0x20008000 + +void board_init_f (ulong dummy) +{ +/* Enable early UART on the RK3066 */ + +struct rk3066_grf *const grf = (void *)GRF_BASE ; + +rk_clrsetreg (&grf->gpio1b_iomux, +GPIO1B1_MASK <<GPIO1B1_SHIFT | +GPIO1B0_MASK <<GPIO1B0_SHIFT , +GPIO1B1_UART2_SOUT <<GPIO1B1_SHIFT | +GPIO1B0_UART2_SIN <<GPIO1B0_SHIFT ); + +debug_uart_init ();
arch/arm/mach-rockchip/rk3066-board-tpl.c line 43
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +10
-0+ +printch ('T' ); +printch ('P' ); +printch ('L' ); +printch ('\n' ); + +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +RK3066_TIMER_CONTROL ,0x1 ,0x1 ); + +sdram_initialise ();
How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Quoted 28 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +3
-0+ +back_to_bootrom (); +}arch/arm/mach-rockchip/rk3066-board.c new file +19
-0@@ -0,0 +1,180 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/boot_mode.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h>
arch/arm/mach-rockchip/rk3066-board.c line 29
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board.c new file +10
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +int board_late_init (void ) +{ +struct rk3066_grf *grf; + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +error ("grf syscon returned %ld\n" ,PTR_ERR (grf));
debug() might be better here. Also please return the error so that it halts.
arch/arm/mach-rockchip/rk3066-board.c line 30
Quoted 1 line
arch/arm/mach-rockchip/rk3066-board.c new file +1
-0+ }else {
Then drop this else because you will have returned by now.
Quoted 91 lines
arch/arm/mach-rockchip/rk3066-board.c new file +91
-0+/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + +return 0 ; +} + +int board_init (void ) +{ +#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM ) +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initialization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else +return 0 ; +#endif +} + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + ret =ram_get_info (dev, &ram); +if (ret) { +debug ("Cannot get DRAM size: %d\n" , ret); +return ret; + } +debug ("SDRAM base=%lx, size=%x\n" , ram.base, ram.size); + gd->ram_size = ram.size; + +return 0 ; +} + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif + +int print_cpuinfo (void ) +{ +printf ("CPU: Rockchip RK3066\n" ); +return 0 ; +} + +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3066_otg_data = { + .rx_fifo_sz =275 , + .np_tx_fifo_sz =16 , + .tx_fifo_sz =256 , +}; + +int board_usb_init (int index,enum usb_init_type init)
arch/arm/mach-rockchip/rk3066-board.c line 131
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board.c new file +10
-0+{ +int node, phy_node; +const char *mode; +bool matched = false; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + +/* find the usb_otg node */ + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-usb" );
Can you please use live tree functions? You'll need to add a separate patch to add this (see ofnode_path() for something simliar). Perhaps call it ofnode_by_compatible()?
Ideally we should turn this into a driver so you can use dev_read_... functions. But that can come later.
arch/arm/mach-rockchip/rk3066-board.c line 134
Quoted 3 lines
arch/arm/mach-rockchip/rk3066-board.c new file +3
-0+ +while (node >0 ) { + mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
This becomes ofnode_read_string()
arch/arm/mach-rockchip/rk3066-board.c line 147
Quoted 13 lines
arch/arm/mach-rockchip/rk3066-board.c new file +13
-0+if (mode &&strcmp (mode,"otg" ) ==0 ) { + matched = true; +break ; + } + + node =fdt_node_offset_by_compatible (blob, node, + "rockchip,rk3066-usb") + } +if (!matched) { +debug ("Not found usb_otg device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" );
ofnode_get_addr
arch/arm/mach-rockchip/rk3066-board.c line 149
Quoted 2 lines
arch/arm/mach-rockchip/rk3066-board.c new file +2
-0+ + node =fdtdec_lookup_phandle (blob, node,"phys" );
etc.
Quoted 41 lines
arch/arm/mach-rockchip/rk3066-board.c new file +31
-0+if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + rk3066_otg_data.phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + + return dwc2_udc_probe(&rk3066_otg_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3066/Kconfig new file +4
-0@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066"
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +10
-0+ help + MK808 is a tv stick with usb host and otg, microsd card slot, hdmi and wifi. + +config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT
You should be able to add these as 'imply' options now (to the ROCKCHIP_RK3066 config)
Quoted 184 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +20
-0+ default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endifarch/arm/mach-rockchip/rk3066/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endifarch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33
-0@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +54
-0@@ -0,0 +1,54 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> + +static const struct udevice_id rk3066_syscon_ids[] = { + { .compatible ="rockchip,rk3188-noc" , .data =ROCKCHIP_SYSCON_NOC }, + { .compatible ="rockchip,rk3066-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { .compatible ="rockchip,rk3066-pmu" , .data =ROCKCHIP_SYSCON_PMU }, + { } +}; + +U_BOOT_DRIVER (syscon_rk3066) = { + .name ="rk3066_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, +}; + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +static int rk3066_syscon_bind_of_platdata (struct udevice *dev) +{ + dev->driver_data = dev->driver->of_match->data; +debug ("syscon: %s %d\n" , dev->name, (uint )dev->driver_data); + +return 0 ; +} + +U_BOOT_DRIVER (rockchip_rk3188_noc) = { + .name ="rockchip_rk3188_noc" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_grf) = { + .name ="rockchip_rk3066_grf" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +1 , + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_pmu) = { + .name ="rockchip_rk3066_pmu" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +2 , + .bind = rk3066_syscon_bind_of_platdata, +}; +#endif include/configs/rk3066_common.h new file +41
-0@@ -0,0 +1,125 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_RK3066_COMMON_H +#define __CONFIG_RK3066_COMMON_H + +#include <asm/arch/hardware.h> +#include "rockchip-common.h" + +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_MALLOC_LEN (64 << 20) +#define CONFIG_SYS_CBSIZE 256 + +#define CONFIG_SYS_TIMER_RATE 24000000 +#define CONFIG_SYS_TIMER_BASE 0x20038000 +#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 4) +#define CONFIG_SYS_TIMER_COUNTS_DOWN + +#define CONFIG_SPL_BOARD_INIT + +#define CONFIG_SYS_TEXT_BASE 0x60408000 + +#define CONFIG_SYS_INIT_SP_ADDR 0x78000000 +#define CONFIG_SYS_LOAD_ADDR 0x70800800 + +#ifdef CONFIG_TPL_BUILD +#define CONFIG_SPL_TEXT_BASE 0x10080C04 +#define CONFIG_SPL_STACK 0x1008FFFF +/* tpl size max 32kb - 4byte RK30 header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x4) +#elif defined(CONFIG_SPL_BUILD ) +/* spl size max 200k */ +#define CONFIG_SPL_MAX_SIZE 0x32000 +#define CONFIG_SPL_TEXT_BASE 0x60000000
include/configs/rk3066_common.h line 51
Quoted 10 lines
include/configs/rk3066_common.h new file +10
-0+#define CONFIG_SPL_STACK 0x1008FFFF +#define CONFIG_SPL_STACK_R_ADDR 0x70000000 +#define CONFIG_SPL_STACK_R 1 +#define CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN 0x200000 +#define CONFIG_SPL_OF_CONTROL 1 +#define CONFIG_SPL_OF_PLATDATA 1 +#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1
Many of these should be set in Kconfig or the defconfig file.
Quoted 75 lines
include/configs/rk3066_common.h new file +74
-1+#define CONFIG_SPL_SYSCON 1 +#define CONFIG_SPL_RAM 1 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT 1 +#define CONFIG_SPL_MMC_SUPPORT 1 +#define CONFIG_ROCKCHIP_SERIAL 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.bin" +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_LIBDISK_SUPPORT 1 +#define CONFIG_SPL_EXT_SUPPORT 1 +#define CONFIG_SPL_FAT_SUPPORT 1 +#define CONFIG_SPL_DM 1 +#define CONFIG_SPL_GPIO_SUPPORT 1 +#define CONFIG_SPL_POWER_SUPPORT 1 +#endif + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x10000 - 0xC00) +#define CONFIG_ROCKCHIP_CHIP_TAG "RK30" + +/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + +#define CONFIG_CMD_CACHE + +#define CONFIG_SYS_SDRAM_BASE 0x60000000 +#define CONFIG_NR_DRAM_BANKS 1 +#define SDRAM_BANK_SIZE (1024UL << 20UL) + +#ifndef CONFIG_SPL_BUILD +/* usb */ +#define CONFIG_USB +#define CONFIG_DM_USB +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_USB +#define CONFIG_USB_DWC2 + +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_ROCKCHIP_USB2_PHY +#define CONFIG_USB_GADGET_VBUS_DRAW 0 + +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + +#define CONFIG_USB_GADGET_DOWNLOAD +#define CONFIG_G_DNL_MANUFACTURER "Rockchip" +#define CONFIG_G_DNL_VENDOR_NUM 0x2207 +#define CONFIG_G_DNL_PRODUCT_NUM 0x300a + +#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x60000000\0" \ + "pxefile_addr_r=0x60100000\0" \ + "fdt_addr_r=0x61f00000\0" \ + "kernel_addr_r=0x62000000\0" \ + "ramdisk_addr_r=0x64000000\0" + +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0x6fffffff\0" \ + "initrd_high=0x6fffffff\0" \ + "partitions=" PARTS_DEFAULT \ + ENV_MEM_LAYOUT_SETTINGS \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#include <config_distro_defaults.h> +#endif + +#define CONFIG_PREBOOT + +#endif --
Quoted 2 lines
2.7.4
Regards,
Simon
PATCH 6/13 rockchip: rk3066: add core support
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 9 lines
Hi Pawel,
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 4 lines · Paweł Jarosz
arch/arm/mach-rockchip/rk3066-board-spl.c new file +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> That should go below
spi.h
Ok
Quoted 7 lines
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 5 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram settings
should be done by code executed in SRAM or you get to hang a board.
Quoted 31 lines
Quoted 31 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +3
-0+ +back_to_bootrom (); +}arch/arm/mach-rockchip/rk3066-board.c new file +22
-0@@ -0,0 +1,180 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/boot_mode.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h> + +DECLARE_GLOBAL_DATA_PTR ; +
Quoted 8 lines
arch/arm/mach-rockchip/rk3066-board.c line 29
Quoted 7 lines
arch/arm/mach-rockchip/rk3066-board.c new file +7
-0+int board_late_init (void ) +{ +struct rk3066_grf *grf; + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +error ("grf syscon returned %ld\n" ,PTR_ERR (grf));
debug()might be better here. Also please return the error so that it halts.
Ok
Quoted 2 lines
arch/arm/mach-rockchip/rk3066-board.c line 30
Quoted 1 line
arch/arm/mach-rockchip/rk3066-board.c new file +1
-0+ }else {Then drop this else because you will have returned by now.
Ok
Quoted 177 lines
Quoted 91 lines
arch/arm/mach-rockchip/rk3066-board.c new file +91
-0+/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + +return 0 ; +} + +int board_init (void ) +{ +#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM ) +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initialization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else +return 0 ; +#endif +} + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + ret =ram_get_info (dev, &ram); +if (ret) { +debug ("Cannot get DRAM size: %d\n" , ret); +return ret; + } +debug ("SDRAM base=%lx, size=%x\n" , ram.base, ram.size); + gd->ram_size = ram.size; + +return 0 ; +} + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif + +int print_cpuinfo (void ) +{ +printf ("CPU: Rockchip RK3066\n" ); +return 0 ; +} + +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3066_otg_data = { + .rx_fifo_sz =275 , + .np_tx_fifo_sz =16 , + .tx_fifo_sz =256 , +}; + +int board_usb_init (int index,enum usb_init_type init)arch/arm/mach-rockchip/rk3066-board.c line 131
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board.c new file +10
-0+{ +int node, phy_node; +const char *mode; +bool matched = false; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + +/* find the usb_otg node */ + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-usb" );Can you please use live tree functions? You'll need to add a separate patch to add this (see
ofnode_path()for something simliar). Perhaps call itofnode_by_compatible()?Ideally we should turn this into a driver so you can use
dev_read_... functions. But that can come later.arch/arm/mach-rockchip/rk3066-board.c line 134
Quoted 3 lines
arch/arm/mach-rockchip/rk3066-board.c new file +3
-0+ +while (node >0 ) { + mode =fdt_getprop (blob, node,"dr_mode" ,NULL );This becomes
ofnode_read_string()arch/arm/mach-rockchip/rk3066-board.c line 147
Quoted 13 lines
arch/arm/mach-rockchip/rk3066-board.c new file +13
-0+if (mode &&strcmp (mode,"otg" ) ==0 ) { + matched = true; +break ; + } + + node =fdt_node_offset_by_compatible (blob, node, + "rockchip,rk3066-usb") + } +if (!matched) { +debug ("Not found usb_otg device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" );
ofnode_get_addrarch/arm/mach-rockchip/rk3066-board.c line 149
Quoted 2 lines
arch/arm/mach-rockchip/rk3066-board.c new file +2
-0+ + node =fdtdec_lookup_phandle (blob, node,"phys" );etc.
Quoted 45 lines
arch/arm/mach-rockchip/rk3066-board.c new file +31
-0+if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + rk3066_otg_data.phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + + return dwc2_udc_probe(&rk3066_otg_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3066/Kconfig new file +8
-0@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066" + help + MK808 is a tv stick with usb host and otg, microsd card slot, hdmi and wifi. + +config SYS_SOC
Quoted 9 lines
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +6
-0+ default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORTYou should be able to add these as 'imply' options now (to the
ROCKCHIP_RK3066config)
What do you mean by 'imply' options?
Quoted 187 lines
Quoted 187 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +20
-0+ default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endifarch/arm/mach-rockchip/rk3066/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endifarch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33
-0@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +54
-0@@ -0,0 +1,54 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> + +static const struct udevice_id rk3066_syscon_ids[] = { + { .compatible ="rockchip,rk3188-noc" , .data =ROCKCHIP_SYSCON_NOC }, + { .compatible ="rockchip,rk3066-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { .compatible ="rockchip,rk3066-pmu" , .data =ROCKCHIP_SYSCON_PMU }, + { } +}; + +U_BOOT_DRIVER (syscon_rk3066) = { + .name ="rk3066_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, +}; + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +static int rk3066_syscon_bind_of_platdata (struct udevice *dev) +{ + dev->driver_data = dev->driver->of_match->data; +debug ("syscon: %s %d\n" , dev->name, (uint )dev->driver_data); + +return 0 ; +} + +U_BOOT_DRIVER (rockchip_rk3188_noc) = { + .name ="rockchip_rk3188_noc" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_grf) = { + .name ="rockchip_rk3066_grf" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +1 , + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_pmu) = { + .name ="rockchip_rk3066_pmu" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +2 , + .bind = rk3066_syscon_bind_of_platdata, +}; +#endif include/configs/rk3066_common.h new file +44
-0@@ -0,0 +1,125 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_RK3066_COMMON_H +#define __CONFIG_RK3066_COMMON_H + +#include <asm/arch/hardware.h> +#include "rockchip-common.h" + +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_MALLOC_LEN (64 << 20) +#define CONFIG_SYS_CBSIZE 256 + +#define CONFIG_SYS_TIMER_RATE 24000000 +#define CONFIG_SYS_TIMER_BASE 0x20038000 +#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 4) +#define CONFIG_SYS_TIMER_COUNTS_DOWN + +#define CONFIG_SPL_BOARD_INIT + +#define CONFIG_SYS_TEXT_BASE 0x60408000 + +#define CONFIG_SYS_INIT_SP_ADDR 0x78000000 +#define CONFIG_SYS_LOAD_ADDR 0x70800800 + +#ifdef CONFIG_TPL_BUILD +#define CONFIG_SPL_TEXT_BASE 0x10080C04 +#define CONFIG_SPL_STACK 0x1008FFFF +/* tpl size max 32kb - 4byte RK30 header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x4) +#elif defined(CONFIG_SPL_BUILD ) +/* spl size max 200k */ +#define CONFIG_SPL_MAX_SIZE 0x32000 +#define CONFIG_SPL_TEXT_BASE 0x60000000 +#define CONFIG_SPL_STACK 0x1008FFFF +#define CONFIG_SPL_STACK_R_ADDR 0x70000000 +#define CONFIG_SPL_STACK_R 1
Quoted 9 lines
include/configs/rk3066_common.h line 51
Quoted 7 lines
include/configs/rk3066_common.h new file +7
-0+#define CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN 0x200000 +#define CONFIG_SPL_OF_CONTROL 1 +#define CONFIG_SPL_OF_PLATDATA 1 +#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1Many of these should be set in
Kconfigor the defconfig file.
Yes but some have gave me tpl build issues that's why i did that here
Quoted 71 lines
Quoted 71 lines
include/configs/rk3066_common.h new file +71
-0+#define CONFIG_SPL_SYSCON 1 +#define CONFIG_SPL_RAM 1 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT 1 +#define CONFIG_SPL_MMC_SUPPORT 1 +#define CONFIG_ROCKCHIP_SERIAL 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.bin" +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_LIBDISK_SUPPORT 1 +#define CONFIG_SPL_EXT_SUPPORT 1 +#define CONFIG_SPL_FAT_SUPPORT 1 +#define CONFIG_SPL_DM 1 +#define CONFIG_SPL_GPIO_SUPPORT 1 +#define CONFIG_SPL_POWER_SUPPORT 1 +#endif + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x10000 - 0xC00) +#define CONFIG_ROCKCHIP_CHIP_TAG "RK30" + +/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + +#define CONFIG_CMD_CACHE + +#define CONFIG_SYS_SDRAM_BASE 0x60000000 +#define CONFIG_NR_DRAM_BANKS 1 +#define SDRAM_BANK_SIZE (1024UL << 20UL) + +#ifndef CONFIG_SPL_BUILD +/* usb */ +#define CONFIG_USB +#define CONFIG_DM_USB +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_USB +#define CONFIG_USB_DWC2 + +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_ROCKCHIP_USB2_PHY +#define CONFIG_USB_GADGET_VBUS_DRAW 0 + +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + +#define CONFIG_USB_GADGET_DOWNLOAD +#define CONFIG_G_DNL_MANUFACTURER "Rockchip" +#define CONFIG_G_DNL_VENDOR_NUM 0x2207 +#define CONFIG_G_DNL_PRODUCT_NUM 0x300a + +#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x60000000\0" \ + "pxefile_addr_r=0x60100000\0" \ + "fdt_addr_r=0x61f00000\0" \ + "kernel_addr_r=0x62000000\0" \ + "ramdisk_addr_r=0x64000000\0" + +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0x6fffffff\0" \ + "initrd_high=0x6fffffff\0" \ + "partitions=" PARTS_DEFAULT \ + ENV_MEM_LAYOUT_SETTINGS \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#include <config_distro_defaults.h> +#endif +
Quoted 8 lines
Quoted 6 lines
include/configs/rk3066_common.h new file +3
-1+#define CONFIG_PREBOOT + +#endif --2.7.4
Regards,
Simon
Regards,
Paweł
PATCH 6/13 rockchip: rk3066: add core support
Hi Pawel,
Quoted 30 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 12 lines
Hi Pawel,
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 5 lines · Paweł Jarosz
arch/arm/mach-rockchip/rk3066-board-spl.c new file +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> That should go below
spi.hOk
Quoted 9 lines
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 6 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram settings
should be done by code executed in SRAM or you get to hang a board.
What is the size limit on SRAM?
[...]
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +7
-0+config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORTYou should be able to add these as 'imply' options now (to the
ROCKCHIP_RK3066config)
Quoted 1 line
What do you mean by 'imply' options?
Things like:
config ROCKCHIP_RK3288
bool "Support Rockchip RK3288"
select CPU_V7
select SPL_BOARD_INIT if SPL
select SUPPORT_SPL
select SPL
imply SPL_LIBCOMMON_SUPPORT
Either select or imply cause that option to be enabled.
Quoted 8 lines
Quoted 7 lines
include/configs/rk3066_common.h line 51
Quoted 4 lines
include/configs/rk3066_common.h new file +4
-0+#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1Many of these should be set in
Kconfigor the defconfig file.Yes but some have gave me tpl build issues that's why i did that here
We need to figure out if TPL is really needed. E.g. I don't think kylin_rk3036 needs it. It produces an SPL that is about 4KB.
Regards,
Simon
PATCH 6/13 rockchip: rk3066: add core support
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 26 lines
Hi Pawel,
Quoted 23 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 9 lines
Hi Pawel,
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 4 lines · Paweł Jarosz
arch/arm/mach-rockchip/rk3066-board-spl.c new file +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> That should go below
spi.hOk
Quoted 7 lines
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 5 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 1 line
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram settings
should be done by code executed in SRAM or you get to hang a board.What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
Quoted 31 lines
[...]
Quoted 11 lines
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +7
-0+config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORTYou should be able to add these as 'imply' options now (to the
ROCKCHIP_RK3066config)What do you mean by 'imply' options?
Things like:
config
ROCKCHIP_RK3288
bool "Support Rockchip RK3288"
selectCPU_V7
selectSPL_BOARD_INITif SPL
selectSUPPORT_SPL
select SPL
implySPL_LIBCOMMON_SUPPORTEither select or imply cause that option to be enabled.
Quoted 6 lines
Quoted 6 lines
include/configs/rk3066_common.h line 51
Quoted 4 lines
include/configs/rk3066_common.h new file +4
-0+#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1Many of these should be set in
Kconfigor the defconfig file.
Quoted 3 lines
Quoted 1 line
Yes but some have gave me tpl build issues that's why i did that here
We need to figure out if TPL is really needed. E.g. I don't think
kylin_rk3036needs it. It produces an SPL that is about 4KB.
RK3036 has a different bootrom load process so we shouldn't compare those two.
Better is to compare RK3066 and RK3188 as those are similiar(RK3188 is without 200KB limit i think)
Paweł
Quoted 2 lines
Regards,
Simon
PATCH 6/13 rockchip: rk3066: add core support
Hi Pawel,
Quoted 48 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 44 lines
Hi Pawel,
Quoted 40 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 12 lines
Hi Pawel,
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 5 lines · Paweł Jarosz
arch/arm/mach-rockchip/rk3066-board-spl.c new file +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> That should go below
spi.hOk
Quoted 9 lines
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 6 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram
settings
should be done by code executed in SRAM or you get to hang a board.
Quoted 4 lines
Quoted 1 line
What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
That is not a very low limit. RK3288 uses SPL (and not TPL) and it has the same limit. Can we not just drop the use of TPL?
Quoted 37 lines
Quoted 37 lines
[...]
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +7
-0+config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORTYou should be able to add these as 'imply' options now (to the
ROCKCHIP_RK3066config)Quoted 1 line
What do you mean by 'imply' options?
Things like:
config
ROCKCHIP_RK3288
bool "Support Rockchip RK3288"
selectCPU_V7
selectSPL_BOARD_INITif SPL
selectSUPPORT_SPL
select SPL
implySPL_LIBCOMMON_SUPPORTEither select or imply cause that option to be enabled.
Quoted 8 lines
Quoted 7 lines
include/configs/rk3066_common.h line 51
Quoted 4 lines
include/configs/rk3066_common.h new file +4
-0+#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1Many of these should be set in
Kconfigor the defconfig file.Yes but some have gave me tpl build issues that's why i did that here
Quoted 8 lines
Quoted 2 lines
We need to figure out if TPL is really needed. E.g. I don't think
kylin_rk3036needs it. It produces an SPL that is about 4KB.RK3036 has a different bootrom load process so we shouldn't compare those two.
Better is to compare RK3066 and RK3188 as those are similiar(RK3188 is without 200KB limit i think)
OK, still I don't understand why SPL cannot work.
Quoted 7 lines
Paweł
Quoted 3 lines
Regards,
Simon
Regards,
Simon
PATCH 6/13 rockchip: rk3066: add core support
Simon,
Quoted 40 lines · Simon Glass
Hi Pawel,
Quoted 37 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 34 lines
Hi Pawel,
Quoted 31 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 9 lines
Hi Pawel,
arch/arm/mach-rockchip/rk3066-board-spl.c line 30
Quoted 4 lines · Paweł Jarosz
arch/arm/mach-rockchip/rk3066-board-spl.c new file +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> That should go below
spi.hOk
Quoted 7 lines
arch/arm/mach-rockchip/rk3066-board-spl.c line 35
Quoted 5 lines
arch/arm/mach-rockchip/rk3066-board-spl.c new file +5
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram
settings
should be done by code executed in SRAM or you get to hang a board.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
That is not a very low limit. RK3288 uses SPL (and not TPL) and it has the same limit. Can we not just drop the use of TPL?
I don't think rk3066 can drop TPL, because the bootrom for rk3066 is very much like rk3188:
- bootrom read 1KB and run it, in purpose of get higher frequency;
- back to bootrom;
- bootrom continue read 31KB most and run it;
- back to bootrom if needed;
- boot rom read and run loader like uboot.
Thanks,
- Kever
Quoted 52 lines
Quoted 32 lines
Quoted 32 lines
[...]
Quoted 11 lines
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/Kconfig line 14
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/Kconfig new file +7
-0+config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORTYou should be able to add these as 'imply' options now (to the
ROCKCHIP_RK3066config)What do you mean by 'imply' options?
Things like:
config
ROCKCHIP_RK3288
bool "Support Rockchip RK3288"
selectCPU_V7
selectSPL_BOARD_INITif SPL
selectSUPPORT_SPL
select SPL
implySPL_LIBCOMMON_SUPPORTEither select or imply cause that option to be enabled.
Quoted 6 lines
Quoted 6 lines
include/configs/rk3066_common.h line 51
Quoted 4 lines
include/configs/rk3066_common.h new file +4
-0+#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1Many of these should be set in
Kconfigor the defconfig file.Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Yes but some have gave me tpl build issues that's why i did that here
We need to figure out if TPL is really needed. E.g. I don't think
kylin_rk3036needs it. It produces an SPL that is about 4KB.RK3036 has a different bootrom load process so we shouldn't compare those two.
Better is to compare RK3066 and RK3188 as those are similiar(RK3188 is without 200KB limit i think)OK, still I don't understand why SPL cannot work.
Quoted 4 lines
Paweł
Quoted 2 lines
Regards,
SimonRegards,
Simon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 6/13 rockchip: rk3066: add core support
+Philipp
Hi Kever,
Quoted 67 lines · Kever Yang
Simon,
Quoted 53 lines · Simon Glass
Hi Pawel,
Quoted 49 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 45 lines
Hi Pawel,
Quoted 41 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 6 lines
Hi Pawel,
Quoted 1 line · Paweł Jarosz
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h>That should go below
spi.hOk
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+ +DECLARE_GLOBAL_DATA_PTR; + +u32 spl_boot_device(void) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram
settings
should be done by code executed in SRAM or you get to hang a board.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
That is not a very low limit. RK3288 uses SPL (and not TPL) and it has the same limit. Can we not just drop the use of TPL?
Quoted 7 lines
I don't think rk3066 can drop TPL, because the bootrom for rk3066 is very much like rk3188:
- bootrom read 1KB and run it, in purpose of get higher frequency;
- back to bootrom;
- bootrom continue read 31KB most and run it;
- back to bootrom if needed;
- boot rom read and run loader like uboot.
OK then it sounds like we will need TPL. Is that right Pawel?
Quoted 3 lines
Thanks,
- Kever
PATCH 6/13 rockchip: rk3066: add core support
Hi
W dniu 15.06.2017 o 16:57, Simon Glass pisze:
Quoted 57 lines
+Philipp
Hi Kever,
Quoted 52 lines · Kever Yang
Simon,
Quoted 46 lines · Simon Glass
Hi Pawel,
Quoted 34 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 31 lines
Hi Pawel,
Quoted 28 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 10 lines
Hi Pawel,
Review
Quoted 4 lines · Paweł Jarosz
(quoted diff) +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h>That should go below
spi.hOk
Quoted 7 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ +DECLARE_GLOBAL_DATA_PTR; + +u32 spl_boot_device(void) +{This function seems to be common. Can you please (in a separate patch) move it into a separate shared file and delete all the copies?
Ok
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Due to size issues i needed to move spl load to sdram (not sram) and sdram
settings
should be done by code executed in SRAM or you get to hang a board.What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
That is not a very low limit. RK3288 uses SPL (and not TPL) and it has the same limit. Can we not just drop the use of TPL?
Quoted 9 lines
Quoted 7 lines
I don't think rk3066 can drop TPL, because the bootrom for rk3066 is very much like rk3188:
- bootrom read 1KB and run it, in purpose of get higher frequency;
- back to bootrom;
- bootrom continue read 31KB most and run it;
- back to bootrom if needed;
- boot rom read and run loader like uboot.OK then it sounds like we will need TPL. Is that right Pawel?
We don't need tpl if i use early back to bootrom in start.S patch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?
Quoted 2 lines
Quoted 2 lines
Thanks,
- Kever
Thanks
Paweł
PATCH 6/13 rockchip: rk3066: add core support
Hi Pawel,
Quoted 88 lines · Paweł Jarosz
Hi
W dniu 15.06.2017 o 16:57, Simon Glass pisze:
Quoted 83 lines
+Philipp
Hi Kever,
Quoted 77 lines · Kever Yang
Simon,
Quoted 55 lines · Simon Glass
Hi Pawel,
Quoted 51 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 47 lines
Hi Pawel,
Quoted 42 lines · Paweł Jarosz
Hi Simon
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 6 lines
Hi Pawel,
Quoted 1 line · Paweł Jarosz
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h>That should go below
spi.hOk
Quoted 10 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+ +DECLARE_GLOBAL_DATA_PTR; + +u32 spl_boot_device(void) +{This function seems to be common. Can you please (in a separate patch)
move it into a separate shared file and delete all the copies?Ok
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+ + sdram_initialise();How come TPL is setting up the DRAM? Shouldn't that be done in SPL?
Due to size issues i needed to move spl load to sdram (not sram) and sdram
settings
should be done by code executed in SRAM or you get to hang a board.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
What is the size limit on SRAM?
RK3066 has 64KB SRAM but bootrom only reads 1KB + 31KB.
That is not a very low limit. RK3288 uses SPL (and not TPL) and it has the same limit. Can we not just drop the use of TPL?
I don't think rk3066 can drop TPL, because the bootrom for rk3066 is very much like rk3188:
- bootrom read 1KB and run it, in purpose of get higher frequency;
- back to bootrom;
- bootrom continue read 31KB most and run it;
- back to bootrom if needed;
- boot rom read and run loader like uboot.
Quoted 6 lines
Quoted 2 lines
OK then it sounds like we will need TPL. Is that right Pawel?
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
Regards,
Simon
PATCH 6/13 rockchip: rk3066: add core support
In reply to Paweł JaroszHi Pawel:
2017-06-07 2:50 GMT+08:00 Paweł Jarosz <[email protected]>:
Quoted 37 lines
Add core skeleton for rk3066
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 +++++++ arch/arm/mach-rockchip/rk3066-board.c | 180 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066-board-spl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board-tpl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board.c 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/syscon_rk3066.c create mode 100644 include/configs/rk3066_common.harch/arm/mach-rockchip/ renamed from arch/arm/mach-rockchip/Kconfig +0
-0
Kconfig
index 6be2ab5..ad35e0a 100644arch/arm/mach-rockchip/Kconfig +2
-0@@ -11,6 +11,21 @@ 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"
arch/arm/mach-rockchip/Kconfig config ROCKCHIP_RK3036 · line 25
Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +9
-0+ select CPU_V7 + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select BOARD_LATE_INIT + select ROCKCHIP_BROM_HELPER + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A7
RK3066 is dual-core Cortex-A9
Quoted 774 lines
arch/arm/mach-rockchip/Kconfig +4
-0+ including NEON and GPU, Mali-400 graphics, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. + config ROCKCHIP_RK3188 bool "Support Rockchip RK3188"select
CPU_V7arch/arm/mach-rockchip/Kconfig +1
-0@@ -91,6 +106,7 @@ config SPL_MMC_SUPPORT default y if !ROCKCHIP_SPL_BACK_TO_BROM source "arch/arm/mach-rockchip/rk3036/Kconfig" +source "arch/arm/mach-rockchip/rk3066/Kconfig" source "arch/arm/mach-rockchip/rk3188/Kconfig" source "arch/arm/mach-rockchip/rk3288/Kconfig" source "arch/arm/mach-rockchip/rk3328/Kconfig"arch/arm/mach-rockchip/ renamed from arch/arm/mach-rockchip/Makefile +0
-0
Makefile
index 327b267..1ebba0c 100644arch/arm/mach-rockchip/Makefile +4
-0@@ -7,15 +7,18 @@ obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o ifdef CONFIG_TPL_BUILD +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-tpl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else ifdef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o@@ -29,6 +32,7 @@ ifndef CONFIG_TPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/ endif +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/ obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/ obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/arch/arm/mach-rockchip/rk3066-board-spl.c new file +55
-0@@ -0,0 +1,173 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <clk.h> +#include <common.h> +#include <debug_uart.h> +#include <dm.h> +#include <fdtdec.h> +#include <led.h> +#include <malloc.h> +#include <ram.h> +#include <spl.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <asm/arch/timer.h> +#include <dm/pinctrl.h> +#include <dm/root.h> +#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> + +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device(void) +{ +#if !CONFIG_IS_ENABLED(OF_PLATDATA) + const void *blob = gd->fdt_blob; + struct udevice *dev; + const char *bootdev; + int node; + int ret; + + bootdev = fdtdec_get_config_string(blob, "u-boot,boot0"); + debug("Boot device %s\n", bootdev); + if (!bootdev) + goto fallback; + + node = fdt_path_offset(blob, bootdev); + if (node < 0) { + debug("node=%d\n", node); + goto fallback; + } + ret = device_get_global_by_of_offset(node, &dev); + if (ret) { + debug("device at node %s/%d not found: %d\n", bootdev,node,
arch/arm/mach-rockchip/rk3066-board-spl.c new file +118
-0+ ret); + goto fallback; + } +debug ("Found device %s\n" , dev->name); +switch (device_get_uclass_id (dev)) { +case UCLASS_SPI_FLASH : +return BOOT_DEVICE_SPI ; +case UCLASS_MMC : +return BOOT_DEVICE_MMC1 ; +default : +debug ("Booting from device uclass '%s' not supported\n" , +dev_get_uclass_name (dev)); + } + +fallback: +#endif +return BOOT_DEVICE_MMC1 ; +} + +u32 spl_boot_mode (const u32 boot_device) +{ +return MMCSD_MODE_FS ; +} + +static int setup_arm_clock (void ) +{ +struct udevice *dev; +struct clk clk; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ret; + + clk.id =CLK_ARM ; + ret =clk_request (dev, &clk); +if (ret <0 ) +return ret; + + ret =clk_set_rate (&clk,600000000 ); + +clk_free (&clk); +return ret; +} + +void board_init_f (ulong dummy) +{ +struct udevice *pinctrl, *dev; +int ret; + +debug_uart_init (); + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } + +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +0x8 ,0x1 ,0x1 ); + + ret =rockchip_get_clk (&dev); +if (ret) { +debug ("CLK init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("Pinctrl init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ; + } + +setup_arm_clock (); +} + +void spl_board_init (void ) +{ +struct udevice *pinctrl; +int ret; + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + +#ifdef CONFIG_SPL_MMC_SUPPORT + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } +#endif + +/* Enable debug UART */ + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); +if (ret) { +debug ("%s: Failed to set up console UART\n" , __func__); + goto err; + } + +preloader_console_init (); + +return ; + +err: +printf ("spl_board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); +}arch/arm/mach-rockchip/rk3066-board-tpl.c new file +41
-0@@ -0,0 +1,46 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <debug_uart.h> +#include <spl.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define RK3066_TIMER_CONTROL 0x8 +#define GRF_BASE 0x20008000 + +void board_init_f (ulong dummy) +{ +/* Enable early UART on the RK3066 */ + +struct rk3066_grf *const grf = (void *)GRF_BASE ; + +rk_clrsetreg (&grf->gpio1b_iomux, +GPIO1B1_MASK <<GPIO1B1_SHIFT | +GPIO1B0_MASK <<GPIO1B0_SHIFT , +GPIO1B1_UART2_SOUT <<GPIO1B1_SHIFT | +GPIO1B0_UART2_SIN <<GPIO1B0_SHIFT ); + +debug_uart_init (); + +printch ('T' ); +printch ('P' ); +printch ('L' ); +printch ('\n' ); + +/* Enable Timer0 */ + rk_clrsetreg(CONFIG_SYS_TIMER_BASE + RK3066_TIMER_CONTROL, 0x1,
0x1);arch/arm/mach-rockchip/rk3066-board-tpl.c new file +5
-0+ +sdram_initialise (); + +back_to_bootrom (); +}arch/arm/mach-rockchip/rk3066-board.c new file +180
-0@@ -0,0 +1,180 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/boot_mode.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int board_late_init (void ) +{ +struct rk3066_grf *grf; + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +error ("grf syscon returned %ld\n" ,PTR_ERR (grf)); + }else { +/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + +return 0 ; +} + +int board_init (void ) +{ +#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM ) +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initialization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else +return 0 ; +#endif +} + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + ret =ram_get_info (dev, &ram); +if (ret) { +debug ("Cannot get DRAM size: %d\n" , ret); +return ret; + } +debug ("SDRAM base=%lx, size=%x\n" , ram.base, ram.size); + gd->ram_size = ram.size; + +return 0 ; +} + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif + +int print_cpuinfo (void ) +{ +printf ("CPU: Rockchip RK3066\n" ); +return 0 ; +} + +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3066_otg_data = { + .rx_fifo_sz =275 , + .np_tx_fifo_sz =16 , + .tx_fifo_sz =256 , +}; + +int board_usb_init (int index,enum usb_init_type init) +{ +int node, phy_node; +const char *mode; +bool matched = false; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + +/* find the usb_otg node */ + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-usb" ); + +while (node >0 ) { + mode =fdt_getprop (blob, node,"dr_mode" ,NULL ); +if (mode &&strcmp (mode,"otg" ) ==0 ) { + matched = true; +break ; + } + + node =fdt_node_offset_by_compatible (blob, node, +"rockchip,rk3066-usb" ); + } +if (!matched) { +debug ("Not found usb_otg device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + rk3066_otg_data.phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + +return dwc2_udc_probe (&rk3066_otg_data); +} + +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3066/Kconfig new file +6
-0@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066" + help + MK808 is a tv stick with usb host and otg, microsd card slot,hdmi and wifi.
arch/arm/mach-rockchip/rk3066/Kconfig new file +28
-0+ +config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT + default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endifarch/arm/mach-rockchip/rk3066/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endifarch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33
-0@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +13
-0@@ -0,0 +1,54 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> + +static const struct udevice_id rk3066_syscon_ids[] = { + { .compatible ="rockchip,rk3188-noc" , .data =ROCKCHIP_SYSCON_NOC },
+ { .compatible = "rockchip,rk3066-grf", .data =ROCKCHIP_SYSCON_GRF
},
+ { .compatible = "rockchip,rk3066-pmu", .data =ROCKCHIP_SYSCON_PMU
},arch/arm/mach-rockchip/rk3066/syscon_rk3066.c new file +39
-0+ { } +}; + +U_BOOT_DRIVER (syscon_rk3066) = { + .name ="rk3066_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, +}; + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +static int rk3066_syscon_bind_of_platdata (struct udevice *dev) +{ + dev->driver_data = dev->driver->of_match->data; +debug ("syscon: %s %d\n" , dev->name, (uint )dev->driver_data); + +return 0 ; +} + +U_BOOT_DRIVER (rockchip_rk3188_noc) = { + .name ="rockchip_rk3188_noc" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_grf) = { + .name ="rockchip_rk3066_grf" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +1 , + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_pmu) = { + .name ="rockchip_rk3066_pmu" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +2 , + .bind = rk3066_syscon_bind_of_platdata, +}; +#endif include/configs/rk3066_ renamed from include/configs/rk3066_common.h +0
-0
common.h
new file mode 100644
index 0000000..7009616include/configs/rk3066_common.h new file +125
-1@@ -0,0 +1,125 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_RK3066_COMMON_H +#define __CONFIG_RK3066_COMMON_H + +#include <asm/arch/hardware.h> +#include "rockchip-common.h" + +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_MALLOC_LEN (64 << 20) +#define CONFIG_SYS_CBSIZE 256 + +#define CONFIG_SYS_TIMER_RATE 24000000 +#define CONFIG_SYS_TIMER_BASE 0x20038000 +#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 4) +#define CONFIG_SYS_TIMER_COUNTS_DOWN + +#define CONFIG_SPL_BOARD_INIT + +#define CONFIG_SYS_TEXT_BASE 0x60408000 + +#define CONFIG_SYS_INIT_SP_ADDR 0x78000000 +#define CONFIG_SYS_LOAD_ADDR 0x70800800 + +#ifdef CONFIG_TPL_BUILD +#define CONFIG_SPL_TEXT_BASE 0x10080C04 +#define CONFIG_SPL_STACK 0x1008FFFF +/* tpl size max 32kb - 4byte RK30 header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x4) +#elif defined(CONFIG_SPL_BUILD ) +/* spl size max 200k */ +#define CONFIG_SPL_MAX_SIZE 0x32000 +#define CONFIG_SPL_TEXT_BASE 0x60000000 +#define CONFIG_SPL_STACK 0x1008FFFF +#define CONFIG_SPL_STACK_R_ADDR 0x70000000 +#define CONFIG_SPL_STACK_R 1 +#define CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN 0x200000 +#define CONFIG_SPL_OF_CONTROL 1 +#define CONFIG_SPL_OF_PLATDATA 1 +#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1 +#define CONFIG_SPL_SYSCON 1 +#define CONFIG_SPL_RAM 1 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT 1 +#define CONFIG_SPL_MMC_SUPPORT 1 +#define CONFIG_ROCKCHIP_SERIAL 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.bin" +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_LIBDISK_SUPPORT 1 +#define CONFIG_SPL_EXT_SUPPORT 1 +#define CONFIG_SPL_FAT_SUPPORT 1 +#define CONFIG_SPL_DM 1 +#define CONFIG_SPL_GPIO_SUPPORT 1 +#define CONFIG_SPL_POWER_SUPPORT 1 +#endif + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x10000 - 0xC00) +#define CONFIG_ROCKCHIP_CHIP_TAG "RK30" + +/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + +#define CONFIG_CMD_CACHE + +#define CONFIG_SYS_SDRAM_BASE 0x60000000 +#define CONFIG_NR_DRAM_BANKS 1 +#define SDRAM_BANK_SIZE (1024UL << 20UL) + +#ifndef CONFIG_SPL_BUILD +/* usb */ +#define CONFIG_USB +#define CONFIG_DM_USB +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_USB +#define CONFIG_USB_DWC2 + +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_ROCKCHIP_USB2_PHY +#define CONFIG_USB_GADGET_VBUS_DRAW 0 + +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + +#define CONFIG_USB_GADGET_DOWNLOAD +#define CONFIG_G_DNL_MANUFACTURER "Rockchip" +#define CONFIG_G_DNL_VENDOR_NUM 0x2207 +#define CONFIG_G_DNL_PRODUCT_NUM 0x300a + +#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x60000000\0" \ + "pxefile_addr_r=0x60100000\0" \ + "fdt_addr_r=0x61f00000\0" \ + "kernel_addr_r=0x62000000\0" \ + "ramdisk_addr_r=0x64000000\0" + +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0x6fffffff\0" \ + "initrd_high=0x6fffffff\0" \ + "partitions=" PARTS_DEFAULT \ + ENV_MEM_LAYOUT_SETTINGS \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#include <config_distro_defaults.h> +#endif + +#define CONFIG_PREBOOT + +#endif --2.7.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 6/13 rockchip: rk3066: add core support
In reply to Paweł JaroszQuoted 15 lines
Add core skeleton for rk3066
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 +++++++ arch/arm/mach-rockchip/rk3066-board.c | 180 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+)
Quoted 9 lines
create mode 100644 arch/arm/mach-rockchip/rk3066-board-spl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board-tpl.c create mode 100644 arch/arm/mach-rockchip/rk3066-board.c 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/syscon_rk3066.c create mode 100644 include/configs/rk3066_common.h
PATCH 6/13 rockchip: rk3066: add core support
In reply to Paweł JaroszQuoted 303 lines · Paweł Jarosz
Add core skeleton for rk3066
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066-board-tpl.c | 46 +++++++ arch/arm/mach-rockchip/rk3066-board.c | 180 ++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066-board-spl.ccreate mode 100644arch/arm/mach-rockchip/rk3066-board-tpl.ccreate mode 100644arch/arm/mach-rockchip/rk3066-board.ccreate mode 100644arch/arm/mach-rockchip/rk3066/Kconfigcreate mode 100644arch/arm/mach-rockchip/rk3066/Makefilecreate mode 100644arch/arm/mach-rockchip/rk3066/clk_rk3066.ccreate mode 100644arch/arm/mach-rockchip/rk3066/syscon_rk3066.ccreate mode 100644include/configs/rk3066_common.harch/arm/mach-rockchip/Kconfig +15
-0@@ -11,6 +11,21 @@ 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_V7 + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select BOARD_LATE_INIT + select ROCKCHIP_BROM_HELPER + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A7 + including NEON and GPU, Mali-400 graphics, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. +config
ROCKCHIP_RK3188
bool "Support Rockchip RK3188"
selectCPU_V7arch/arm/mach-rockchip/Kconfig +0
-0@@ -91,6 +106,7 @@ config SPL_MMC_SUPPORT default y if !ROCKCHIP_SPL_BACK_TO_BROMsource "
arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3066/Kconfig"
source "arch/arm/mach-rockchip/rk3188/Kconfig"
source "arch/arm/mach-rockchip/rk3288/Kconfig"
source "arch/arm/mach-rockchip/rk3328/Kconfig"arch/arm/mach-rockchip/Makefile +0
-0@@ -7,15 +7,18 @@obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
ifdef
CONFIG_TPL_BUILD+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-tpl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else ifdefCONFIG_SPL_BUILDobj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else
+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.oarch/arm/mach-rockchip/Makefile +0
-0@@ -29,6 +32,7 @@ ifndef CONFIG_TPL_BUILDobj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/
endif+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/
obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/arch/arm/mach-rockchip/rk3066-board-spl.c new file +173
-0@@ -0,0 +1,173 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <clk.h> +#include <common.h> +#include <debug_uart.h> +#include <dm.h> +#include <fdtdec.h> +#include <led.h> +#include <malloc.h> +#include <ram.h> +#include <spl.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <asm/arch/timer.h> +#include <dm/pinctrl.h> +#include <dm/root.h> +#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> + +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{ +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +const void *blob = gd->fdt_blob; +struct udevice *dev; +const char *bootdev; +int node; +int ret; + + bootdev =fdtdec_get_config_string (blob,"u-boot,boot0" ); +debug ("Boot device %s\n" , bootdev); +if (!bootdev) + goto fallback; + + node =fdt_path_offset (blob, bootdev); +if (node <0 ) { +debug ("node=%d\n" , node); + goto fallback; + } + ret =device_get_global_by_of_offset (node, &dev); +if (ret) { +debug ("device at node %s/%d not found: %d\n" , bootdev, node, + ret); + goto fallback; + } +debug ("Found device %s\n" , dev->name); +switch (device_get_uclass_id (dev)) { +case UCLASS_SPI_FLASH : +return BOOT_DEVICE_SPI ; +case UCLASS_MMC : +return BOOT_DEVICE_MMC1 ; +default : +debug ("Booting from device uclass '%s' not supported\n" , +dev_get_uclass_name (dev)); + } + +fallback: +#endif +return BOOT_DEVICE_MMC1 ; +} + +u32 spl_boot_mode (const u32 boot_device) +{ +return MMCSD_MODE_FS ; +} + +static int setup_arm_clock (void ) +{ +struct udevice *dev; +struct clk clk; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ret; + + clk.id =CLK_ARM ; + ret =clk_request (dev, &clk); +if (ret <0 ) +return ret; + + ret =clk_set_rate (&clk,600000000 ); + +clk_free (&clk); +return ret; +} + +void board_init_f (ulong dummy) +{ +struct udevice *pinctrl, *dev; +int ret; + +debug_uart_init (); + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } + +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +0x8 ,0x1 ,0x1 ); + + ret =rockchip_get_clk (&dev); +if (ret) { +debug ("CLK init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("Pinctrl init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ; + } + +setup_arm_clock (); +} + +void spl_board_init (void ) +{ +struct udevice *pinctrl; +int ret; + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + +#ifdef CONFIG_SPL_MMC_SUPPORT + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } +#endif + +/* Enable debug UART */ + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); +if (ret) { +debug ("%s: Failed to set up console UART\n" , __func__); + goto err; + } + +preloader_console_init (); + +return ; + +err: +printf ("spl_board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); +}arch/arm/mach-rockchip/rk3066-board-tpl.c new file +28
-0@@ -0,0 +1,46 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <debug_uart.h> +#include <spl.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define RK3066_TIMER_CONTROL 0x8 +#define GRF_BASE 0x20008000 + +void board_init_f (ulong dummy) +{ +/* Enable early UART on the RK3066 */ + +struct rk3066_grf *const grf = (void *)GRF_BASE ; + + rk_clrsetreg(&grf->gpio1b_iomux, + GPIO1B1_MASK << GPIO1B1_SHIFT |
arch/arm/mach-rockchip/rk3066-board-tpl.c line 38
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +10
-0+GPIO1B0_MASK <<GPIO1B0_SHIFT , +GPIO1B1_UART2_SOUT <<GPIO1B1_SHIFT | + GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); + +debug_uart_init (); + +printch ('T' ); +printch ('P' ); +printch ('L' ); +printch ('\n' );
Can you make this printascii("TPL\n")?
Quoted 113 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +8
-0+ +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +RK3066_TIMER_CONTROL ,0x1 ,0x1 ); + +sdram_initialise (); + +back_to_bootrom (); +}arch/arm/mach-rockchip/rk3066-board.c new file +99
-0@@ -0,0 +1,180 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/boot_mode.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int board_late_init (void ) +{ +struct rk3066_grf *grf; + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +error ("grf syscon returned %ld\n" ,PTR_ERR (grf)); + }else { +/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + +return 0 ; +} + +int board_init (void ) +{ +#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM ) +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initialization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else +return 0 ; +#endif +} + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + ret =ram_get_info (dev, &ram); +if (ret) { +debug ("Cannot get DRAM size: %d\n" , ret); +return ret; + } +debug ("SDRAM base=%lx, size=%x\n" , ram.base, ram.size); + gd->ram_size = ram.size; + +return 0 ; +} + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{
arch/arm/mach-rockchip/rk3066-board.c line 109
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board.c new file +10
-0+/* Enable D-cache. I-cache is already enabled in start.S */ + dcache_enable(); +} +#endif + +int print_cpuinfo (void ) +{ +printf ("CPU: Rockchip RK3066\n" ); +return 0 ; +}
This should be implemented in a way that we can share this across all the Rockchip boards.
Quoted 54 lines
arch/arm/mach-rockchip/rk3066-board.c new file +54
-0+#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3066_otg_data = { + .rx_fifo_sz =275 , + .np_tx_fifo_sz =16 , + .tx_fifo_sz =256 , +}; + +int board_usb_init (int index,enum usb_init_type init) +{ +int node, phy_node; +const char *mode; +bool matched = false; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + +/* find the usb_otg node */ + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-usb" ); + +while (node >0 ) { + mode =fdt_getprop (blob, node,"dr_mode" ,NULL ); +if (mode &&strcmp (mode,"otg" ) ==0 ) { + matched = true; +break ; + } + + node =fdt_node_offset_by_compatible (blob, node, +"rockchip,rk3066-usb" ); + } +if (!matched) { +debug ("Not found usb_otg device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + rk3066_otg_data.phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + + node = fdt_node_offset_by_compatible(blob, -1,
arch/arm/mach-rockchip/rk3066-board.c line 174
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board.c new file +10
-0+ "rockchip,rk3066-grf"); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + +return dwc2_udc_probe (&rk3066_otg_data); +}
This looks a lot like what we have in board/rockchip/evb_rk3328/evb-rk3328.c (and possibly other places?). Can we deduplicate this for the various boards/devices using the DWC2?
Quoted 222 lines
arch/arm/mach-rockchip/rk3066-board.c new file +5
-0+int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3066/Kconfig new file +34
-0@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066" + help + MK808 is a tv stick with usb host and otg, microsd card slot, hdmi and wifi. + +config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT + default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endifarch/arm/mach-rockchip/rk3066/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endifarch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33
-0@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +54
-0@@ -0,0 +1,54 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> + +static const struct udevice_id rk3066_syscon_ids[] = { + { .compatible ="rockchip,rk3188-noc" , .data =ROCKCHIP_SYSCON_NOC }, + { .compatible ="rockchip,rk3066-grf" , .data =ROCKCHIP_SYSCON_GRF }, + { .compatible ="rockchip,rk3066-pmu" , .data =ROCKCHIP_SYSCON_PMU }, + { } +}; + +U_BOOT_DRIVER (syscon_rk3066) = { + .name ="rk3066_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, +}; + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +static int rk3066_syscon_bind_of_platdata (struct udevice *dev) +{ + dev->driver_data = dev->driver->of_match->data; +debug ("syscon: %s %d\n" , dev->name, (uint )dev->driver_data); + +return 0 ; +} + +U_BOOT_DRIVER (rockchip_rk3188_noc) = { + .name ="rockchip_rk3188_noc" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_grf) = { + .name ="rockchip_rk3066_grf" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +1 , + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_pmu) = { + .name ="rockchip_rk3066_pmu" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +2 , + .bind = rk3066_syscon_bind_of_platdata, +}; +#endif include/configs/rk3066_common.h new file +54
-0@@ -0,0 +1,125 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_RK3066_COMMON_H +#define __CONFIG_RK3066_COMMON_H + +#include <asm/arch/hardware.h> +#include "rockchip-common.h" + +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_MALLOC_LEN (64 << 20) +#define CONFIG_SYS_CBSIZE 256 + +#define CONFIG_SYS_TIMER_RATE 24000000 +#define CONFIG_SYS_TIMER_BASE 0x20038000 +#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 4) +#define CONFIG_SYS_TIMER_COUNTS_DOWN + +#define CONFIG_SPL_BOARD_INIT + +#define CONFIG_SYS_TEXT_BASE 0x60408000 + +#define CONFIG_SYS_INIT_SP_ADDR 0x78000000 +#define CONFIG_SYS_LOAD_ADDR 0x70800800 + +#ifdef CONFIG_TPL_BUILD +#define CONFIG_SPL_TEXT_BASE 0x10080C04 +#define CONFIG_SPL_STACK 0x1008FFFF +/* tpl size max 32kb - 4byte RK30 header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x4) +#elif defined(CONFIG_SPL_BUILD ) +/* spl size max 200k */ +#define CONFIG_SPL_MAX_SIZE 0x32000 +#define CONFIG_SPL_TEXT_BASE 0x60000000 +#define CONFIG_SPL_STACK 0x1008FFFF +#define CONFIG_SPL_STACK_R_ADDR 0x70000000 +#define CONFIG_SPL_STACK_R 1 +#define CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN 0x200000 +#define CONFIG_SPL_OF_CONTROL 1 +#define CONFIG_SPL_OF_PLATDATA 1 +#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1 +#define CONFIG_SPL_SYSCON 1 +#define CONFIG_SPL_RAM 1 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT 1
include/configs/rk3066_common.h line 64
Quoted 10 lines
include/configs/rk3066_common.h new file +10
-0+#define CONFIG_SPL_MMC_SUPPORT 1 +#define CONFIG_ROCKCHIP_SERIAL 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.bin" +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_LIBDISK_SUPPORT 1 +#define CONFIG_SPL_EXT_SUPPORT 1 +#define CONFIG_SPL_FAT_SUPPORT 1 +#define CONFIG_SPL_DM 1 +#define CONFIG_SPL_GPIO_SUPPORT 1 +#define CONFIG_SPL_POWER_SUPPORT 1
Most of these should be in defconfig.
Please don't add any configurations via #define that can also go through defconfig.
include/configs/rk3066_common.h line 70
Quoted 6 lines
include/configs/rk3066_common.h new file +6
-0+#endif + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x10000 - 0xC00) +#define CONFIG_ROCKCHIP_CHIP_TAG "RK30"
Why do we have this ROCKCHIP_CHIP_TAG? I can't find any use of it across our entire code-base.
Quoted 6 lines
include/configs/rk3066_common.h new file +6
-0+/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + +#define CONFIG_CMD_CACHE + +#define CONFIG_SYS_SDRAM_BASE 0x60000000
include/configs/rk3066_common.h line 87
Quoted 10 lines
include/configs/rk3066_common.h new file +10
-0+#define CONFIG_NR_DRAM_BANKS 1 +#define SDRAM_BANK_SIZE (1024UL << 20UL) + +#ifndef CONFIG_SPL_BUILD +/* usb */ +#define CONFIG_USB +#define CONFIG_DM_USB +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_USB +#define CONFIG_USB_DWC2
Most of these should be in defconfig.
include/configs/rk3066_common.h line 101
Quoted 13 lines
include/configs/rk3066_common.h new file +13
-0+#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_ROCKCHIP_USB2_PHY +#define CONFIG_USB_GADGET_VBUS_DRAW 0 + +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + +#define CONFIG_USB_GADGET_DOWNLOAD +#define CONFIG_G_DNL_MANUFACTURER "Rockchip" +#define CONFIG_G_DNL_VENDOR_NUM 0x2207 +#define CONFIG_G_DNL_PRODUCT_NUM 0x300a
Again: these should be in *_defconfig and not in the header-file. Please check your entire header to make sure we don't add any definitions here that could go through defconfig.
Quoted 24 lines
include/configs/rk3066_common.h new file +23
-0+#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x60000000\0" \ + "pxefile_addr_r=0x60100000\0" \ + "fdt_addr_r=0x61f00000\0" \ + "kernel_addr_r=0x62000000\0" \ + "ramdisk_addr_r=0x64000000\0" + +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0x6fffffff\0" \ + "initrd_high=0x6fffffff\0" \ + "partitions=" PARTS_DEFAULT \ + ENV_MEM_LAYOUT_SETTINGS \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#include <config_distro_defaults.h> +#endif + +#define CONFIG_PREBOOT + +#endif
PATCH 6/13 rockchip: rk3066: add core support
Hi Phillip,
W dniu 04.07.2017 o 19:35, Philipp Tomsich pisze:
Quoted 446 lines · Paweł Jarosz
Quoted 310 lines
Add core skeleton for rk3066
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/mach-rockchip/Kconfig | 16 +++ arch/arm/mach-rockchip/Makefile | 4 + arch/arm/mach-rockchip/rk3066-board-spl.c | 173+++++++++++++++++++++++++
arch/arm/mach-rockchip/rk3066-board-tpl.c| 46 +++++++arch/arm/mach-rockchip/rk3066-board.c| 180
++++++++++++++++++++++++++arch/arm/mach-rockchip/rk3066/Kconfig | 34 +++++ arch/arm/mach-rockchip/rk3066/Makefile | 12 ++ arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 +++++ arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 54 ++++++++ include/configs/rk3066_common.h | 125 ++++++++++++++++++ 10 files changed, 677 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066-board-spl.ccreate mode 100644arch/arm/mach-rockchip/rk3066-board-tpl.ccreate mode 100644arch/arm/mach-rockchip/rk3066-board.ccreate mode 100644arch/arm/mach-rockchip/rk3066/Kconfigcreate mode 100644arch/arm/mach-rockchip/rk3066/Makefilecreate mode 100644arch/arm/mach-rockchip/rk3066/clk_rk3066.ccreate mode 100644arch/arm/mach-rockchip/rk3066/syscon_rk3066.ccreate mode 100644include/configs/rk3066_common.harch/arm/mach-rockchip/Kconfig +15
-0@@ -11,6 +11,21 @@ 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_V7 + select SUPPORT_SPL + select SUPPORT_TPL + select SPL + select TPL + select BOARD_LATE_INIT + select ROCKCHIP_BROM_HELPER + help + The Rockchip RK3066 is a ARM-based SoC with a dual-core Cortex-A7 + including NEON and GPU, Mali-400 graphics, several DDR3 options + and video codec support. Peripherals include Gigabit Ethernet, + USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. +config
ROCKCHIP_RK3188
bool "Support Rockchip RK3188"
selectCPU_V7arch/arm/mach-rockchip/Kconfig +0
-0@@ -91,6 +106,7 @@ config SPL_MMC_SUPPORT default y if !ROCKCHIP_SPL_BACK_TO_BROMsource "
arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3066/Kconfig"
source "arch/arm/mach-rockchip/rk3188/Kconfig"
source "arch/arm/mach-rockchip/rk3288/Kconfig"
source "arch/arm/mach-rockchip/rk3328/Kconfig"arch/arm/mach-rockchip/Makefile +0
-0@@ -7,15 +7,18 @@obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
ifdef
CONFIG_TPL_BUILD+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-tpl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else ifdefCONFIG_SPL_BUILDobj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o else
+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066-board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.oarch/arm/mach-rockchip/Makefile +0
-0@@ -29,6 +32,7 @@ ifndef CONFIG_TPL_BUILDobj-$(CONFIG_ROCKCHIP_RK3188) += rk3188/
endif+obj-$(CONFIG_ROCKCHIP_RK3066) += rk3066/
obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/
obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328/
obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/arch/arm/mach-rockchip/rk3066-board-spl.c new file +173
-0@@ -0,0 +1,173 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <clk.h> +#include <common.h> +#include <debug_uart.h> +#include <dm.h> +#include <fdtdec.h> +#include <led.h> +#include <malloc.h> +#include <ram.h> +#include <spl.h> +#include <asm/gpio.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/clock.h> +#include <asm/arch/hardware.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <asm/arch/timer.h> +#include <dm/pinctrl.h> +#include <dm/root.h> +#include <dm/test.h> +#include <dm/util.h> +#include <power/regulator.h> +#include <syscon.h> + +DECLARE_GLOBAL_DATA_PTR ; + +u32 spl_boot_device (void ) +{ +#if !CONFIG_IS_ENABLED (OF_PLATDATA ) +const void *blob = gd->fdt_blob; +struct udevice *dev; +const char *bootdev; +int node; +int ret; + + bootdev =fdtdec_get_config_string (blob,"u-boot,boot0" ); +debug ("Boot device %s\n" , bootdev); +if (!bootdev) + goto fallback; + + node =fdt_path_offset (blob, bootdev); +if (node <0 ) { +debug ("node=%d\n" , node); + goto fallback; + } + ret =device_get_global_by_of_offset (node, &dev); +if (ret) { +debug ("device at node %s/%d not found: %d\n" , bootdev, node, + ret); + goto fallback; + } +debug ("Found device %s\n" , dev->name); +switch (device_get_uclass_id (dev)) { +case UCLASS_SPI_FLASH : +return BOOT_DEVICE_SPI ; +case UCLASS_MMC : +return BOOT_DEVICE_MMC1 ; +default : +debug ("Booting from device uclass '%s' not supported\n" , +dev_get_uclass_name (dev)); + } + +fallback: +#endif +return BOOT_DEVICE_MMC1 ; +} + +u32 spl_boot_mode (const u32 boot_device) +{ +return MMCSD_MODE_FS ; +} + +static int setup_arm_clock (void ) +{ +struct udevice *dev; +struct clk clk; +int ret; + + ret =rockchip_get_clk (&dev); +if (ret) +return ret; + + clk.id =CLK_ARM ; + ret =clk_request (dev, &clk); +if (ret <0 ) +return ret; + + ret =clk_set_rate (&clk,600000000 ); + +clk_free (&clk); +return ret; +} + +void board_init_f (ulong dummy) +{ +struct udevice *pinctrl, *dev; +int ret; + +debug_uart_init (); + + ret =spl_early_init (); +if (ret) { +debug ("spl_early_init() failed: %d\n" , ret); +hang (); + } + +/* Enable Timer0 */ +rk_clrsetreg (CONFIG_SYS_TIMER_BASE +0x8 ,0x1 ,0x1 ); + + ret =rockchip_get_clk (&dev); +if (ret) { +debug ("CLK init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("Pinctrl init failed: %d\n" , ret); +return ; + } + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ; + } + +setup_arm_clock (); +} + +void spl_board_init (void ) +{ +struct udevice *pinctrl; +int ret; + + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + +#ifdef CONFIG_SPL_MMC_SUPPORT + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } +#endif + +/* Enable debug UART */ + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); +if (ret) { +debug ("%s: Failed to set up console UART\n" , __func__); + goto err; + } + +preloader_console_init (); + +return ; + +err: +printf ("spl_board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); +}arch/arm/mach-rockchip/rk3066-board-tpl.c new file +28
-0@@ -0,0 +1,46 @@ +/* +* (C) Copyright 2015 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <debug_uart.h> +#include <spl.h> +#include <asm/io.h> +#include <asm/arch/bootrom.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define RK3066_TIMER_CONTROL 0x8 +#define GRF_BASE 0x20008000 + +void board_init_f (ulong dummy) +{ +/* Enable early UART on the RK3066 */ + +struct rk3066_grf *const grf = (void *)GRF_BASE ; + + rk_clrsetreg(&grf->gpio1b_iomux, + GPIO1B1_MASK << GPIO1B1_SHIFT |arch/arm/mach-rockchip/rk3066-board-tpl.c line 38
Quoted 10 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +10
-0+GPIO1B0_MASK <<GPIO1B0_SHIFT , +GPIO1B1_UART2_SOUT <<GPIO1B1_SHIFT | + GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); + +debug_uart_init (); + +printch ('T' ); +printch ('P' ); +printch ('L' ); +printch ('\n' );Can you make this
printascii("TPL\n")?Quoted 120 lines
arch/arm/mach-rockchip/rk3066-board-tpl.c new file +3
-0+ +/* Enable Timer0 */ + rk_clrsetreg(CONFIG_SYS_TIMER_BASE + RK3066_TIMER_CONTROL, 0x1,
0x1);arch/arm/mach-rockchip/rk3066-board-tpl.c new file +5
-0+ +sdram_initialise (); + +back_to_bootrom (); +}arch/arm/mach-rockchip/rk3066-board.c new file +104
-0@@ -0,0 +1,180 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <ram.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/periph.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/boot_mode.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int board_late_init (void ) +{ +struct rk3066_grf *grf; + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +error ("grf syscon returned %ld\n" ,PTR_ERR (grf)); + }else { +/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + +return 0 ; +} + +int board_init (void ) +{ +#if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM ) +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initialization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else +return 0 ; +#endif +} + +int dram_init (void ) +{ +struct ram_info ram; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + ret =ram_get_info (dev, &ram); +if (ret) { +debug ("Cannot get DRAM size: %d\n" , ret); +return ret; + } +debug ("SDRAM base=%lx, size=%x\n" , ram.base, ram.size); + gd->ram_size = ram.size; + +return 0 ; +} + +#ifndef CONFIG_SYS_DCACHE_OFF +void enable_caches (void ) +{ +/* Enable D-cache. I-cache is already enabled in start.S */ +dcache_enable (); +} +#endif +
Quoted 9 lines
arch/arm/mach-rockchip/rk3066-board.c line 109
Quoted 5 lines
arch/arm/mach-rockchip/rk3066-board.c new file +5
-0+int print_cpuinfo (void ) +{ +printf ("CPU: Rockchip RK3066\n" ); +return 0 ; +}This should be implemented in a way that we can share this across all the Rockchip boards.
i've deleted that part because i don't know how to implement this :)
Quoted 61 lines
Quoted 61 lines
arch/arm/mach-rockchip/rk3066-board.c new file +61
-0+#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3066_otg_data = { + .rx_fifo_sz =275 , + .np_tx_fifo_sz =16 , + .tx_fifo_sz =256 , +}; + +int board_usb_init (int index,enum usb_init_type init) +{ +int node, phy_node; +const char *mode; +bool matched = false; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + +/* find the usb_otg node */ + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-usb" ); + +while (node >0 ) { + mode =fdt_getprop (blob, node,"dr_mode" ,NULL ); +if (mode &&strcmp (mode,"otg" ) ==0 ) { + matched = true; +break ; + } + + node =fdt_node_offset_by_compatible (blob, node, +"rockchip,rk3066-usb" ); + } +if (!matched) { +debug ("Not found usb_otg device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + rk3066_otg_data.phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + + node =fdt_node_offset_by_compatible (blob,-1 , +"rockchip,rk3066-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + rk3066_otg_data.regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" );
Quoted 9 lines
arch/arm/mach-rockchip/rk3066-board.c line 174
Quoted 3 lines
arch/arm/mach-rockchip/rk3066-board.c new file +3
-0+ +return dwc2_udc_probe (&rk3066_otg_data); +}This looks a lot like what we have in
board/rockchip/evb_rk3328/evb-rk3328.c
(and possibly other places?). Can we deduplicate this for the various boards/devices using the DWC2?
i have already moved to ofnode api as Simon sugested
Quoted 246 lines
Quoted 231 lines
arch/arm/mach-rockchip/rk3066-board.c new file +5
-0+int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} +#endif arch/arm/mach-rockchip/rk3066/Kconfig new file +6
-0@@ -0,0 +1,34 @@ +if ROCKCHIP_RK3066 + +config TARGET_MK808_RK3066 + bool "MK808_RK3066" + help + MK808 is a tv stick with usb host and otg, microsd card slot,hdmi and wifi.
arch/arm/mach-rockchip/rk3066/Kconfig new file +28
-0+ +config SYS_SOC + default "rockchip" + +config SYS_MALLOC_F_LEN + default 0x0800 + +config SPL_LIBCOMMON_SUPPORT + default y + +config SPL_LIBGENERIC_SUPPORT + default y + +config SPL_SERIAL_SUPPORT + default y + +config TPL_LIBCOMMON_SUPPORT + default y + +config TPL_LIBGENERIC_SUPPORT + default y + +config TPL_SERIAL_SUPPORT + default y + +source "board/rikomagic/mk808_rk3066/Kconfig" + +endifarch/arm/mach-rockchip/rk3066/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright (c) 2017 Paweł Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifndef CONFIG_TPL_BUILD +obj-y += clk_rk3066.o +obj-y += syscon_rk3066.o +else +obj-y += sdram_init.o +endifarch/arm/mach-rockchip/rk3066/clk_rk3066.c new file +33
-0@@ -0,0 +1,33 @@ +/* +* Copyright (C) 2016 Google, Inc +* Written by Simon Glass <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> + +int rockchip_get_clk (struct udevice **devp) +{ +return uclass_get_device_by_driver (UCLASS_CLK , +DM_GET_DRIVER (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/syscon_rk3066.c new file +13
-0@@ -0,0 +1,54 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <syscon.h> +#include <asm/arch/clock.h> + +static const struct udevice_id rk3066_syscon_ids[] = { + { .compatible = "rockchip,rk3188-noc", .data =
ROCKCHIP_SYSCON_NOC},
+ { .compatible = "rockchip,rk3066-grf", .data =ROCKCHIP_SYSCON_GRF},
+ { .compatible = "rockchip,rk3066-pmu", .data =ROCKCHIP_SYSCON_PMU},arch/arm/mach-rockchip/rk3066/syscon_rk3066.c new file +39
-0+ { } +}; + +U_BOOT_DRIVER (syscon_rk3066) = { + .name ="rk3066_syscon" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, +}; + +#if CONFIG_IS_ENABLED (OF_PLATDATA ) +static int rk3066_syscon_bind_of_platdata (struct udevice *dev) +{ + dev->driver_data = dev->driver->of_match->data; +debug ("syscon: %s %d\n" , dev->name, (uint )dev->driver_data); + +return 0 ; +} + +U_BOOT_DRIVER (rockchip_rk3188_noc) = { + .name ="rockchip_rk3188_noc" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids, + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_grf) = { + .name ="rockchip_rk3066_grf" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +1 , + .bind = rk3066_syscon_bind_of_platdata, +}; + +U_BOOT_DRIVER (rockchip_rk3066_pmu) = { + .name ="rockchip_rk3066_pmu" , + .id =UCLASS_SYSCON , + .of_match = rk3066_syscon_ids +2 , + .bind = rk3066_syscon_bind_of_platdata, +}; +#endif include/configs/rk3066_common.h new file +54
-0@@ -0,0 +1,125 @@ +/* +* Copyright (c) 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_RK3066_COMMON_H +#define __CONFIG_RK3066_COMMON_H + +#include <asm/arch/hardware.h> +#include "rockchip-common.h" + +#define CONFIG_SKIP_LOWLEVEL_INIT_ONLY +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_MALLOC_LEN (64 << 20) +#define CONFIG_SYS_CBSIZE 256 + +#define CONFIG_SYS_TIMER_RATE 24000000 +#define CONFIG_SYS_TIMER_BASE 0x20038000 +#define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 4) +#define CONFIG_SYS_TIMER_COUNTS_DOWN + +#define CONFIG_SPL_BOARD_INIT + +#define CONFIG_SYS_TEXT_BASE 0x60408000 + +#define CONFIG_SYS_INIT_SP_ADDR 0x78000000 +#define CONFIG_SYS_LOAD_ADDR 0x70800800 + +#ifdef CONFIG_TPL_BUILD +#define CONFIG_SPL_TEXT_BASE 0x10080C04 +#define CONFIG_SPL_STACK 0x1008FFFF +/* tpl size max 32kb - 4byte RK30 header */ +#define CONFIG_SPL_MAX_SIZE (0x8000 - 0x4) +#elif defined(CONFIG_SPL_BUILD ) +/* spl size max 200k */ +#define CONFIG_SPL_MAX_SIZE 0x32000 +#define CONFIG_SPL_TEXT_BASE 0x60000000 +#define CONFIG_SPL_STACK 0x1008FFFF +#define CONFIG_SPL_STACK_R_ADDR 0x70000000 +#define CONFIG_SPL_STACK_R 1 +#define CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN 0x200000 +#define CONFIG_SPL_OF_CONTROL 1 +#define CONFIG_SPL_OF_PLATDATA 1 +#define CONFIG_SPL_FRAMEWORK 1 +#define CONFIG_SPL_CLK 1 +#define CONFIG_SPL_PINCTRL 1 +#define CONFIG_SPL_REGMAP 1 +#define CONFIG_SPL_SYSCON 1 +#define CONFIG_SPL_RAM 1 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT 1include/configs/rk3066_common.h line 64
Quoted 10 lines
include/configs/rk3066_common.h new file +10
-0+#define CONFIG_SPL_MMC_SUPPORT 1 +#define CONFIG_ROCKCHIP_SERIAL 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.bin" +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_LIBDISK_SUPPORT 1 +#define CONFIG_SPL_EXT_SUPPORT 1 +#define CONFIG_SPL_FAT_SUPPORT 1 +#define CONFIG_SPL_DM 1 +#define CONFIG_SPL_GPIO_SUPPORT 1 +#define CONFIG_SPL_POWER_SUPPORT 1Most of these should be in defconfig.
Please don't add any configurations via #define that can also go through defconfig.
Quoted 9 lines
include/configs/rk3066_common.h line 70
Quoted 6 lines
include/configs/rk3066_common.h new file +6
-0+#endif + +#define CONFIG_SYS_NS16550_MEM32 + +#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x10000 - 0xC00) +#define CONFIG_ROCKCHIP_CHIP_TAG "RK30"Why do we have this
ROCKCHIP_CHIP_TAG? I can't find any use of it across our entire code-base.
I've deleted that ... sorry for the confusion
Quoted 62 lines
Quoted 7 lines
include/configs/rk3066_common.h new file +6
-0+/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + +#define CONFIG_CMD_CACHE + +#define CONFIG_SYS_SDRAM_BASE 0x60000000include/configs/rk3066_common.h line 87
Quoted 10 lines
include/configs/rk3066_common.h new file +10
-0+#define CONFIG_NR_DRAM_BANKS 1 +#define SDRAM_BANK_SIZE (1024UL << 20UL) + +#ifndef CONFIG_SPL_BUILD +/* usb */ +#define CONFIG_USB +#define CONFIG_DM_USB +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_USB +#define CONFIG_USB_DWC2 Most of these should be in defconfig.
include/configs/rk3066_common.h line 101
Quoted 13 lines
include/configs/rk3066_common.h new file +13
-0+#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_DWC2_OTG +#define CONFIG_ROCKCHIP_USB2_PHY +#define CONFIG_USB_GADGET_VBUS_DRAW 0 + +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_CMD_USB_MASS_STORAGE + +#define CONFIG_USB_GADGET_DOWNLOAD +#define CONFIG_G_DNL_MANUFACTURER "Rockchip" +#define CONFIG_G_DNL_VENDOR_NUM 0x2207 +#define CONFIG_G_DNL_PRODUCT_NUM 0x300aAgain: these should be in
*_defconfigand not in the header-file. Please check your entire header to make sure we don't add any definitions here that could go through defconfig.Quoted 24 lines
include/configs/rk3066_common.h new file +23
-0+#define ENV_MEM_LAYOUT_SETTINGS \ + "scriptaddr=0x60000000\0" \ + "pxefile_addr_r=0x60100000\0" \ + "fdt_addr_r=0x61f00000\0" \ + "kernel_addr_r=0x62000000\0" \ + "ramdisk_addr_r=0x64000000\0" + +#include <config_distro_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0x6fffffff\0" \ + "initrd_high=0x6fffffff\0" \ + "partitions=" PARTS_DEFAULT \ + ENV_MEM_LAYOUT_SETTINGS \ + ROCKCHIP_DEVICE_SETTINGS \ + BOOTENV + +#include <config_distro_defaults.h> +#endif + +#define CONFIG_PREBOOT + +#endif
PATCH 7/13 rockchip: rk3066: add mk808 board files
In reply to Paweł Jaroszmk808 is a tv stick with two usb ports, micro sd card slot, hdmi and nand onboard.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3066a-mk808.dts | 172 ++++++++++++++++++++++++++++ board/rikomagic/mk808_rk3066/Kconfig | 15 +++ board/rikomagic/mk808_rk3066/MAINTAINERS | 6 + board/rikomagic/mk808_rk3066/Makefile | 7 ++ board/rikomagic/mk808_rk3066/mk808_rk3066.c | 10 ++ configs/mk808-rk3066_defconfig | 54 +++++++++ include/configs/mk808_rk3066.h | 15 +++ 8 files changed, 280 insertions(+) create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 board/rikomagic/mk808_rk3066/Kconfig create mode 100644 board/rikomagic/mk808_rk3066/MAINTAINERS create mode 100644 board/rikomagic/mk808_rk3066/Makefile create mode 100644 board/rikomagic/mk808_rk3066/mk808_rk3066.c create mode 100644 configs/mk808-rk3066_defconfig create mode 100644 include/configs/mk808_rk3066.h
arch/arm/dts/Makefile +1 -0
@@ -29,6 +29,7 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \ dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += \ rk3036-sdk.dtb \ + rk3066a-mk808.dtb \ rk3188-radxarock.dtb \ rk3288-evb.dtb \ rk3288-fennec.dtb \
arch/arm/dts/rk3066a-mk808.dts new file +172 -0
172 lines not on this page · raw message
board/rikomagic/mk808_rk3066/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_MK808_RK3066 + +config SYS_BOARD + default "mk808_rk3066" + +config SYS_VENDOR + default "rikomagic" + +config SYS_CONFIG_NAME + default "mk808_rk3066" + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + +endif
board/rikomagic/mk808_rk3066/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +MK808 +M: Paweł Jarosz <[email protected]> +S: Maintained +F: include/configs/mk808_rk3066.h +F: configs/mk808-rk3066_defconfig +F: board/rikomagic/mk808_rk3066
board/rikomagic/mk808_rk3066/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright (c) 2017 Paweł‚ Jarosz <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += mk808_rk3066.o
board/rikomagic/mk808_rk3066/mk808_rk3066.c new file +10 -0
@@ -0,0 +1,10 @@ +/* +* (C) Copyright 2017 Paweł Jarosz <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> + +DECLARE_GLOBAL_DATA_PTR ; +
configs/mk808-rk3066_defconfig new file +54 -0
54 lines not on this page · raw message
include/configs/mk808_rk3066.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* (C) Copyright 2015 Rockchip Electronics Co., Ltd +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define ROCKCHIP_DEVICE_SETTINGS + +#include <configs/rk3066_common.h> + +#endif +
Signature · 1 line
2.7.4
PATCH 7/13 rockchip: rk3066: add mk808 board files
Quoted 13 lines · Paweł Jarosz
mk808 is a tv stick with two usb ports, micro sd card slot, hdmi and nand onboard.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3066a-mk808.dts | 172 ++++++++++++++++++++++++++++ board/rikomagic/mk808_rk3066/Kconfig | 15 +++ board/rikomagic/mk808_rk3066/MAINTAINERS | 6 + board/rikomagic/mk808_rk3066/Makefile | 7 ++ board/rikomagic/mk808_rk3066/mk808_rk3066.c | 10 ++ configs/mk808-rk3066_defconfig | 54 +++++++++ include/configs/mk808_rk3066.h | 15 +++
Quoted 8 lines
8 files changed, 280 insertions(+) create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 board/rikomagic/mk808_rk3066/Kconfig create mode 100644 board/rikomagic/mk808_rk3066/MAINTAINERS create mode 100644 board/rikomagic/mk808_rk3066/Makefile create mode 100644 board/rikomagic/mk808_rk3066/mk808_rk3066.c create mode 100644 configs/mk808-rk3066_defconfig create mode 100644 include/configs/mk808_rk3066.h
PATCH 7/13 rockchip: rk3066: add mk808 board files
In reply to Paweł JaroszQuoted 14 lines
mk808 is a tv stick with two usb ports, micro sd card slot, hdmi and nand onboard.
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3066a-mk808.dts | 172 ++++++++++++++++++++++++++++ board/rikomagic/mk808_rk3066/Kconfig | 15 +++ board/rikomagic/mk808_rk3066/MAINTAINERS | 6 + board/rikomagic/mk808_rk3066/Makefile | 7 ++ board/rikomagic/mk808_rk3066/mk808_rk3066.c | 10 ++ configs/mk808-rk3066_defconfig | 54 +++++++++ include/configs/mk808_rk3066.h | 15 +++
Quoted 9 lines
8 files changed, 280 insertions(+) create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 board/rikomagic/mk808_rk3066/Kconfig create mode 100644 board/rikomagic/mk808_rk3066/MAINTAINERS create mode 100644 board/rikomagic/mk808_rk3066/Makefile create mode 100644 board/rikomagic/mk808_rk3066/mk808_rk3066.c create mode 100644 configs/mk808-rk3066_defconfig create mode 100644 include/configs/mk808_rk3066.h
PATCH 7/13 rockchip: rk3066: add mk808 board files
In reply to Paweł JaroszQuoted 15 lines
mk808 is a tv stick with two usb ports, micro sd card slot, hdmi and nand onboard.
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Philipp Tomsich <[email protected]>--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3066a-mk808.dts | 172 ++++++++++++++++++++++++++++ board/rikomagic/mk808_rk3066/Kconfig | 15 +++ board/rikomagic/mk808_rk3066/MAINTAINERS | 6 + board/rikomagic/mk808_rk3066/Makefile | 7 ++ board/rikomagic/mk808_rk3066/mk808_rk3066.c | 10 ++ configs/mk808-rk3066_defconfig | 54 +++++++++ include/configs/mk808_rk3066.h | 15 +++
Quoted 9 lines
8 files changed, 280 insertions(+) create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 board/rikomagic/mk808_rk3066/Kconfig create mode 100644 board/rikomagic/mk808_rk3066/MAINTAINERS create mode 100644 board/rikomagic/mk808_rk3066/Makefile create mode 100644 board/rikomagic/mk808_rk3066/mk808_rk3066.c create mode 100644 configs/mk808-rk3066_defconfig create mode 100644 include/configs/mk808_rk3066.h
PATCH 8/13 rockchip: mmc: support rk3066 mmc
In reply to Paweł Jaroszrk3066 and rk3288 mmc designware ip's are very similiar. They differ in internal dma support and max driver frequency.
--- drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/mmc/rockchip_dw_mmc.c +29 -2
@@ -22,8 +22,14 @@ DECLARE_GLOBAL_DATA_PTR;struct rockchip_mmc_plat {#if CONFIG_IS_ENABLED (OF_PLATDATA ) + +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc dtplat;#endif + +#endif struct mmc_config cfg;struct mmc mmc; };
@@ -109,8 +115,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev)int ret;#if CONFIG_IS_ENABLED (OF_PLATDATA ) +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc *dtplat = &plat->dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; - +#endif host->name = dev->name; host->ioaddr =map_sysmem (dtplat->reg[0 ], dtplat->reg[1 ]); host->buswidth = dtplat->bus_width;
@@ -118,7 +127,12 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->priv = dev; host->dev_index =0 ; priv->fifo_depth = dtplat->fifo_depth; + +#ifdef CONFIG_ROCKCHIP_RK3066 + priv->fifo_mode =1 ; +#else priv->fifo_mode =0 ; +#endif memcpy (priv->minmax, dtplat->clock_freq_min_max,sizeof (priv->minmax)); ret =clk_get_by_index_platdata (dev,0 , dtplat->clocks, &priv->clk);
@@ -162,14 +176,27 @@ static int rockchip_dwmmc_bind(struct udevice *dev) }static const struct udevice_id rockchip_dwmmc_ids[] = { + { .compatible ="rockchip,rk2928-dw-mshc" }, { .compatible ="rockchip,rk3288-dw-mshc" }, { } }; +U_BOOT_DRIVER (rockchip_rk2928_dw_mshc) = { + .name ="rockchip_rk2928_dw_mshc" , + .id =UCLASS_MMC , + .of_match = rockchip_dwmmc_ids, + .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, + .ops = &dm_dwmci_ops, + .bind = rockchip_dwmmc_bind, + .probe = rockchip_dwmmc_probe, + .priv_auto_alloc_size =sizeof (struct rockchip_dwmmc_priv ), + .platdata_auto_alloc_size =sizeof (struct rockchip_mmc_plat ), +}; +U_BOOT_DRIVER (rockchip_dwmmc_drv) = { .name ="rockchip_rk3288_dw_mshc" , .id =UCLASS_MMC , - .of_match = rockchip_dwmmc_ids, + .of_match = rockchip_dwmmc_ids +1 , .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, .ops = &dm_dwmci_ops, .bind = rockchip_dwmmc_bind,
Signature · 1 line
2.7.4
PATCH 8/13 rockchip: mmc: support rk3066 mmc
Hi Pawel,
Quoted 28 lines · Paweł Jarosz
rk3066 and rk3288 mmc designware ip's are very similiar. They differ in internal dma support and max driver frequency.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)drivers/mmc/rockchip_dw_mmc.c +6
-0@@ -22,8 +22,14 @@ DECLARE_GLOBAL_DATA_PTR;struct rockchip_mmc_plat {#if CONFIG_IS_ENABLED (OF_PLATDATA ) + +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc dtplat;#endif + +#endif struct mmc_config cfg;struct mmc mmc; };
drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 122
Quoted 9 lines
drivers/mmc/rockchip_dw_mmc.c +4
-1@@ -109,8 +115,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev)int ret;#if CONFIG_IS_ENABLED (OF_PLATDATA ) +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc *dtplat = &plat->dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; - +#endif
I am not keen on this - it will get ugly. Can you please do this:
Create a new driver for rk3288 which just has the platdata stuff, rockchip_dwmmc_ofdata_to_platdata() and the U_BOOT_DRIVER(). Everything else should remain in this file.
Then in a new patch, create a driver for rk3066 which uses the same common elements from rockchip_dw_mmc.c
drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 135
Quoted 13 lines
drivers/mmc/rockchip_dw_mmc.c +5
-0host->name = dev->name; host->ioaddr =map_sysmem (dtplat->reg[0 ], dtplat->reg[1 ]); host->buswidth = dtplat->bus_width;@@ -118,7 +127,12 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->priv = dev; host->dev_index =0 ; priv->fifo_depth = dtplat->fifo_depth; + +#ifdef CONFIG_ROCKCHIP_RK3066 + priv->fifo_mode =1 ; +#else priv->fifo_mode =0 ; +#endif
What about the fifo_mode property in the DT?
If you have to hard-code this you should use a .data parameter in rockchip_dwmmc_ids (e.g. RK2928, RK3288) and use that to determine the mode. But hopefully the DT is enough.
For OF_PLATDATA however I suggest you have a different probe() which either sets up this value and then calls rockchip_dwmmc_probe(), or add it as a parameter to rockchip_dwmmc_probe().
Quoted 18 lines
drivers/mmc/rockchip_dw_mmc.c +7
-0memcpy (priv->minmax, dtplat->clock_freq_min_max,sizeof (priv->minmax)); ret =clk_get_by_index_platdata (dev,0 , dtplat->clocks, &priv->clk);@@ -162,14 +176,27 @@ static int rockchip_dwmmc_bind(struct udevice *dev) }static const struct udevice_id rockchip_dwmmc_ids[] = { + { .compatible ="rockchip,rk2928-dw-mshc" }, { .compatible ="rockchip,rk3288-dw-mshc" }, { } }; +U_BOOT_DRIVER (rockchip_rk2928_dw_mshc) = { + .name ="rockchip_rk2928_dw_mshc" , + .id =UCLASS_MMC , + .of_match = rockchip_dwmmc_ids, + .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, + .ops = &dm_dwmci_ops,
drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_bind(struct udevice *dev) · line 172
Quoted 10 lines
drivers/mmc/rockchip_dw_mmc.c +6
-1+ .bind = rockchip_dwmmc_bind, + .probe = rockchip_dwmmc_probe, + .priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv), + .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat), +}; +U_BOOT_DRIVER (rockchip_dwmmc_drv) = { .name ="rockchip_rk3288_dw_mshc" , .id =UCLASS_MMC , - .of_match = rockchip_dwmmc_ids,
I think you ne
Quoted 6 lines
drivers/mmc/rockchip_dw_mmc.c +0
-1.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, .ops = &dm_dwmci_ops, .bind = rockchip_dwmmc_bind, --2.7.4
Regards,
Simon
PATCH 8/13 rockchip: mmc: support rk3066 mmc
Simon,
Quoted 42 lines · Simon Glass
Hi Pawel,
Quoted 28 lines · Paweł Jarosz
rk3066 and rk3288 mmc designware ip's are very similiar. They differ in internal dma support and max driver frequency.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)drivers/mmc/rockchip_dw_mmc.c +6
-0@@ -22,8 +22,14 @@ DECLARE_GLOBAL_DATA_PTR;struct rockchip_mmc_plat {#if CONFIG_IS_ENABLED (OF_PLATDATA ) + +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc dtplat;#endif + +#endif struct mmc_config cfg;struct mmc mmc; };drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 122
Quoted 9 lines
drivers/mmc/rockchip_dw_mmc.c +4
-1@@ -109,8 +115,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev)int ret;#if CONFIG_IS_ENABLED (OF_PLATDATA ) +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc *dtplat = &plat->dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; - +#endif I am not keen on this - it will get ugly. Can you please do this:
Quoted 6 lines
Create a new driver for rk3288 which just has the platdata stuff,
rockchip_dwmmc_ofdata_to_platdata()and theU_BOOT_DRIVER(). Everything else should remain in this file.Then in a new patch, create a driver for rk3066 which uses the same common elements from
rockchip_dw_mmc.c
I think I have discuss this with you online or offline for many times, when OF_PLATADATA enabled, the dts is pre-compile by dtoc and then there is structure like 'dtd_rockchip_rk2928_dw_mshc' which is from the dts node compatible name, I propose to use the last compatible name in dtoc instead of the first one, then we can get the same structure name and used in drivers.
I still not enable the dwmmc when OF_PLATDATA enabled on rk3399 because of the same reason.
I think we should fix this from the root cause, but not make different driver
for different SoCs.
Thanks,
- Kever
Quoted 65 lines
Quoted 5 lines
drivers/mmc/rockchip_dw_mmc.c +0
-0host->name = dev->name; host->ioaddr =map_sysmem (dtplat->reg[0 ], dtplat->reg[1 ]); host->buswidth = dtplat->bus_width;drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 135
Quoted 9 lines
drivers/mmc/rockchip_dw_mmc.c +5
-0@@ -118,7 +127,12 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->priv = dev; host->dev_index =0 ; priv->fifo_depth = dtplat->fifo_depth; + +#ifdef CONFIG_ROCKCHIP_RK3066 + priv->fifo_mode =1 ; +#else priv->fifo_mode =0 ; +#endif What about the
fifo_modeproperty in the DT?If you have to hard-code this you should use a .data parameter in
rockchip_dwmmc_ids(e.g. RK2928, RK3288) and use that to determine the mode. But hopefully the DT is enough.For
OF_PLATDATAhowever I suggest you have a differentprobe()which either sets up this value and then callsrockchip_dwmmc_probe(), or add it as a parameter torockchip_dwmmc_probe().Quoted 18 lines
drivers/mmc/rockchip_dw_mmc.c +7
-0memcpy (priv->minmax, dtplat->clock_freq_min_max,sizeof (priv->minmax)); ret =clk_get_by_index_platdata (dev,0 , dtplat->clocks, &priv->clk);@@ -162,14 +176,27 @@ static int rockchip_dwmmc_bind(struct udevice *dev) }static const struct udevice_id rockchip_dwmmc_ids[] = { + { .compatible ="rockchip,rk2928-dw-mshc" }, { .compatible ="rockchip,rk3288-dw-mshc" }, { } }; +U_BOOT_DRIVER (rockchip_rk2928_dw_mshc) = { + .name ="rockchip_rk2928_dw_mshc" , + .id =UCLASS_MMC , + .of_match = rockchip_dwmmc_ids, + .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, + .ops = &dm_dwmci_ops,drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_bind(struct udevice *dev) · line 172
Quoted 10 lines
drivers/mmc/rockchip_dw_mmc.c +6
-1+ .bind = rockchip_dwmmc_bind, + .probe = rockchip_dwmmc_probe, + .priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv), + .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat), +}; +U_BOOT_DRIVER (rockchip_dwmmc_drv) = { .name ="rockchip_rk3288_dw_mshc" , .id =UCLASS_MMC , - .of_match = rockchip_dwmmc_ids,I think you ne
Quoted 6 lines
drivers/mmc/rockchip_dw_mmc.c +0
-1.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, .ops = &dm_dwmci_ops, .bind = rockchip_dwmmc_bind, --2.7.4
Regards,
Simon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 8/13 rockchip: mmc: support rk3066 mmc
Hi Kever,
Quoted 66 lines · Kever Yang
Simon,
Quoted 46 lines · Simon Glass
Hi Pawel,
Quoted 30 lines · Paweł Jarosz
rk3066 and rk3288 mmc designware ip's are very similiar. They differ in internal dma support and max driver frequency.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)drivers/mmc/rockchip_dw_mmc.c +6
-0@@ -22,8 +22,14 @@ DECLARE_GLOBAL_DATA_PTR;struct rockchip_mmc_plat {#if CONFIG_IS_ENABLED (OF_PLATDATA ) + +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc dtplat;#endif + +#endif struct mmc_config cfg;struct mmc mmc; };drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 122
Quoted 9 lines
drivers/mmc/rockchip_dw_mmc.c +4
-1@@ -109,8 +115,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev)int ret;#if CONFIG_IS_ENABLED (OF_PLATDATA ) +#ifdef CONFIG_ROCKCHIP_RK3066 +struct dtd_rockchip_rk2928_dw_mshc *dtplat = &plat->dtplat; +#else struct dtd_rockchip_rk3288_dw_mshc *dtplat = &plat->dtplat; - +#endif I am not keen on this - it will get ugly. Can you please do this:
Quoted 6 lines
Create a new driver for rk3288 which just has the platdata stuff,
rockchip_dwmmc_ofdata_to_platdata()and theU_BOOT_DRIVER(). Everything else should remain in this file.Then in a new patch, create a driver for rk3066 which uses the same common elements from
rockchip_dw_mmc.cI think I have discuss this with you online or offline for many times, when
OF_PLATADATAenabled, the dts is pre-compile by dtoc and then there is structure like 'dtd_rockchip_rk2928_dw_mshc' which is from the dts node compatible name, I propose to use the last compatible name in dtoc instead of the first one, then we can get the same structure name and used in drivers.
Quoted 6 lines
I still not enable the dwmmc when
OF_PLATDATAenabled on rk3399 because of the same reason.I think we should fix this from the root cause, but not make different driver
for different SoCs.
OK, well if you think that will work it is fine with me. I will take a look at the change.
Regards,
Simon
Quoted 77 lines
Thanks,
- KeverQuoted 71 lines
Quoted 6 lines
drivers/mmc/rockchip_dw_mmc.c +0
-0host->name = dev->name; host->ioaddr =map_sysmem (dtplat->reg[0 ], dtplat->reg[1 ]); host->buswidth = dtplat->bus_width;drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_probe(struct udevice *dev) · line 135
Quoted 9 lines
drivers/mmc/rockchip_dw_mmc.c +5
-0@@ -118,7 +127,12 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->priv = dev; host->dev_index =0 ; priv->fifo_depth = dtplat->fifo_depth; + +#ifdef CONFIG_ROCKCHIP_RK3066 + priv->fifo_mode =1 ; +#else priv->fifo_mode =0 ; +#endif What about the
fifo_modeproperty in the DT?If you have to hard-code this you should use a .data parameter in
rockchip_dwmmc_ids(e.g. RK2928, RK3288) and use that to determine the mode. But hopefully the DT is enough.For
OF_PLATDATAhowever I suggest you have a differentprobe()which either sets up this value and then callsrockchip_dwmmc_probe(), or add it as a parameter torockchip_dwmmc_probe().Quoted 20 lines
drivers/mmc/rockchip_dw_mmc.c +0
-0memcpy (priv->minmax, dtplat->clock_freq_min_max,sizeof (priv->minmax));ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks,
&priv->clk);drivers/mmc/rockchip_dw_mmc.c +7
-0@@ -162,14 +176,27 @@ static int rockchip_dwmmc_bind(struct udevice *dev) }static const struct udevice_id rockchip_dwmmc_ids[] = { + { .compatible ="rockchip,rk2928-dw-mshc" }, { .compatible ="rockchip,rk3288-dw-mshc" }, { } }; +U_BOOT_DRIVER (rockchip_rk2928_dw_mshc) = { + .name ="rockchip_rk2928_dw_mshc" , + .id =UCLASS_MMC , + .of_match = rockchip_dwmmc_ids, + .ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, + .ops = &dm_dwmci_ops,drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_bind(struct udevice *dev) · line 172
Quoted 10 lines
drivers/mmc/rockchip_dw_mmc.c +6
-1+ .bind = rockchip_dwmmc_bind, + .probe = rockchip_dwmmc_probe, + .priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv), + .platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat), +}; +U_BOOT_DRIVER (rockchip_dwmmc_drv) = { .name ="rockchip_rk3288_dw_mshc" , .id =UCLASS_MMC , - .of_match = rockchip_dwmmc_ids,I think you ne
Quoted 7 lines
drivers/mmc/rockchip_dw_mmc.c +0
-1.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata, .ops = &dm_dwmci_ops, .bind = rockchip_dwmmc_bind, --2.7.4
Regards,
Simon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 8/13 rockchip: mmc: support rk3066 mmc
In reply to Paweł JaroszQuoted 8 lines
rk3066 and rk3288 mmc designware ip's are very similiar. They differ in internal dma support and max driver frequency.
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
PATCH 9/13 rockchip: dts: set fifo mode as default for mmc
In reply to Paweł Jaroszrk3066 and rk3188 designware mmc ip doesn't support internal dma transfer mode. So set fifo mode as default.
--- arch/arm/dts/rk3xxx.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/dts/rk3xxx.dtsi +3 -0
@@ -192,6 +192,7 @@ clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };
@@ -202,6 +203,7 @@ clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };
@@ -212,6 +214,7 @@ clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };
Signature · 1 line
2.7.4
PATCH 9/13 rockchip: dts: set fifo mode as default for mmc
Quoted 8 lines · Paweł Jarosz
rk3066 and rk3188 designware mmc ip doesn't support internal dma transfer mode. So set fifo mode as default.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/dts/rk3xxx.dtsi | 3 +++ 1 file changed, 3 insertions(+)
PATCH 9/13 rockchip: dts: set fifo mode as default for mmc
In reply to Paweł JaroszQuoted 9 lines
rk3066 and rk3188 designware mmc ip doesn't support internal dma transfer mode. So set fifo mode as default.
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>--- arch/arm/dts/rk3xxx.dtsi | 3 +++ 1 file changed, 3 insertions(+)
PATCH 9/13 rockchip: dts: set fifo mode as default for mmc
In reply to Paweł JaroszThis would be a change from the upstream DTSI file in Linux, which we should try to avoid if possible.
Please handle this the same way as in Linux and fall back to fifo-mode based on the transfer-mode bits [17:16] in HCON.
Quoted 39 lines · Paweł Jarosz
rk3066 and rk3188 designware mmc ip doesn't support internal dma transfer mode. So set fifo mode as default.
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/dts/rk3xxx.dtsi| 3 +++1 file changed, 3 insertions(+)arch/arm/dts/rk3xxx.dtsi +3
-0@@ -192,6 +192,7 @@ clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };@@ -202,6 +203,7 @@ clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };@@ -212,6 +214,7 @@ clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>; clock-names = "biu", "ciu"; fifo-depth = <256>; + fifo-mode; status = "disabled"; };
PATCH 10/13 rockchip: rk3066: add sdram driver
In reply to Paweł Jarosz--- arch/arm/mach-rockchip/rk3066/Makefile | 1 + arch/arm/mach-rockchip/rk3066/sdram_rk3066.c | 111 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_rk3066.c
arch/arm/mach-rockchip/rk3066/Makefile +1 -0
@@ -6,6 +6,7 @@ ifndef CONFIG_TPL_BUILD obj-y += clk_rk3066.o +obj-y += sdram_rk3066.o obj-y += syscon_rk3066.o else obj-y += sdram_init.o
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 10/13 rockchip: rk3066: add sdram driver
On 6 June 2017 at 12:52, Paweł Jarosz <[email protected]> wrote:
Commit message?
Quoted 7 lines
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/mach-rockchip/rk3066/Makefile | 1 + arch/arm/mach-rockchip/rk3066/sdram_rk3066.c | 111 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_rk3066.c
Quoted 42 lines
arch/arm/mach-rockchip/rk3066/Makefile +1
-0@@ -6,6 +6,7 @@ ifndef CONFIG_TPL_BUILD obj-y += clk_rk3066.o +obj-y += sdram_rk3066.o obj-y += syscon_rk3066.o else obj-y += sdram_init.oarch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +24
-0@@ -0,0 +1,111 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dt-structs.h> +#include <errno.h> +#include <ram.h> +#include <regmap.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h>
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c line 34
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +10
-0+#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +struct dram_info { +struct ram_info info; +struct rk3188_pmu *pmu; +}; + +size_t sdram_size_mb (struct rk3188_pmu *pmu)
I wonder if most of this could go in a common function, or are the registers / offsets different?
Quoted 39 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +39
-0+{ +u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4; +size_t chipsize_mb =0 ; +size_t size_mb =0 ; +u32 ch; +u32 sys_reg =readl (&pmu->sys_reg[2 ]); +u32 chans; + + chans =1 + ((sys_reg >>SYS_REG_NUM_CH_SHIFT ) &SYS_REG_NUM_CH_MASK ); + +for (ch =0 ; ch < chans; ch++) { + rank =1 + (sys_reg >>SYS_REG_RANK_SHIFT (ch) & +SYS_REG_RANK_MASK ); + col =9 + (sys_reg >>SYS_REG_COL_SHIFT (ch) &SYS_REG_COL_MASK ); + bk =3 - ((sys_reg >>SYS_REG_BK_SHIFT (ch)) &SYS_REG_BK_MASK ); + cs0_row =13 + (sys_reg >>SYS_REG_CS0_ROW_SHIFT (ch) & +SYS_REG_CS0_ROW_MASK ); + cs1_row =13 + (sys_reg >>SYS_REG_CS1_ROW_SHIFT (ch) & +SYS_REG_CS1_ROW_MASK ); + bw = (2 >> ((sys_reg >>SYS_REG_BW_SHIFT (ch)) & +SYS_REG_BW_MASK )); + row_3_4 = sys_reg >>SYS_REG_ROW_3_4_SHIFT (ch) & +SYS_REG_ROW_3_4_MASK ; + chipsize_mb = (1 << (cs0_row + col + bk + bw -20 )); + +if (rank >1 ) + chipsize_mb += chipsize_mb >> + (cs0_row - cs1_row); +if (row_3_4) + chipsize_mb = chipsize_mb *3 /4 ; + size_mb += chipsize_mb; + } + +/* there can be no more than 2gb of memory */ + size_mb =min (size_mb,0x80000000 >>20 ); + +return size_mb; +} +
PATCH 10/13 rockchip: rk3066: add sdram driver
Simon, Pawel,
Quoted 59 lines · Simon Glass
On 6 June 2017 at 12:52, Paweł Jarosz <[email protected]> wrote:
Commit message?
Quoted 7 lines
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/mach-rockchip/rk3066/Makefile | 1 + arch/arm/mach-rockchip/rk3066/sdram_rk3066.c | 111 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_rk3066.cAcked-by Simon Glass <[email protected]>Quoted 46 lines
arch/arm/mach-rockchip/rk3066/Makefile +1
-0@@ -6,6 +6,7 @@ ifndef CONFIG_TPL_BUILD obj-y += clk_rk3066.o +obj-y += sdram_rk3066.o obj-y += syscon_rk3066.o else obj-y += sdram_init.oarch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +28
-0@@ -0,0 +1,111 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dt-structs.h> +#include <errno.h> +#include <ram.h> +#include <regmap.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; +
Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c line 34
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +6
-0+struct dram_info { +struct ram_info info; +struct rk3188_pmu *pmu; +}; + +size_t sdram_size_mb (struct rk3188_pmu *pmu)I wonder if most of this could go in a common function, or are the registers / offsets different?
The definition of sys_reg for all the Rockchip SoC are the same, the only difference may be some chip have dual channel while others only have one, but the definition is not conflict.
The dram driver for rk3066, rk3188 and rk3288 are very similar.
Thanks,
- Kever
Quoted 44 lines
Quoted 30 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +29
-0+{ +u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4; +size_t chipsize_mb =0 ; +size_t size_mb =0 ; +u32 ch; +u32 sys_reg =readl (&pmu->sys_reg[2 ]); +u32 chans; + + chans =1 + ((sys_reg >>SYS_REG_NUM_CH_SHIFT ) &SYS_REG_NUM_CH_MASK ); + +for (ch =0 ; ch < chans; ch++) { + rank =1 + (sys_reg >>SYS_REG_RANK_SHIFT (ch) & +SYS_REG_RANK_MASK ); + col =9 + (sys_reg >>SYS_REG_COL_SHIFT (ch) &SYS_REG_COL_MASK ); + bk =3 - ((sys_reg >>SYS_REG_BK_SHIFT (ch)) &SYS_REG_BK_MASK ); + cs0_row =13 + (sys_reg >>SYS_REG_CS0_ROW_SHIFT (ch) & +SYS_REG_CS0_ROW_MASK ); + cs1_row =13 + (sys_reg >>SYS_REG_CS1_ROW_SHIFT (ch) & +SYS_REG_CS1_ROW_MASK ); + bw = (2 >> ((sys_reg >>SYS_REG_BW_SHIFT (ch)) & +SYS_REG_BW_MASK )); + row_3_4 = sys_reg >>SYS_REG_ROW_3_4_SHIFT (ch) & +SYS_REG_ROW_3_4_MASK ; + chipsize_mb = (1 << (cs0_row + col + bk + bw -20 )); + +if (rank >1 ) + chipsize_mb += chipsize_mb >> + (cs0_row - cs1_row); +if (row_3_4)arch/arm/mach-rockchip/rk3066/sdram_rk3066.c line 73
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +10
-0+ chipsize_mb = chipsize_mb *3 /4 ; + size_mb += chipsize_mb; + } + +/* there can be no more than 2gb of memory */ + size_mb =min (size_mb,0x80000000 >>20 ); + +return size_mb; +} +_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH 10/13 rockchip: rk3066: add sdram driver
In reply to Paweł JaroszQuoted 8 lines
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>--- arch/arm/mach-rockchip/rk3066/Makefile | 1 + arch/arm/mach-rockchip/rk3066/sdram_rk3066.c | 111 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_rk3066.c
PATCH 10/13 rockchip: rk3066: add sdram driver
In reply to Paweł JaroszQuoted 89 lines · Paweł Jarosz
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/mach-rockchip/rk3066/Makefile| 1 +arch/arm/mach-rockchip/rk3066/sdram_rk3066.c| 111 +++++++++++++++++++++++++++2 files changed, 112 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_rk3066.carch/arm/mach-rockchip/rk3066/Makefile +0
-0@@ -6,6 +6,7 @@ifndef
CONFIG_TPL_BUILD
obj-y += clk_rk3066.o
+obj-y += sdram_rk3066.o
obj-y += syscon_rk3066.o
else
obj-y += sdram_init.oarch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +62
-0@@ -0,0 +1,111 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dt-structs.h> +#include <errno.h> +#include <ram.h> +#include <regmap.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +struct dram_info { +struct ram_info info; +struct rk3188_pmu *pmu; +}; + +size_t sdram_size_mb (struct rk3188_pmu *pmu) +{ +u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4; +size_t chipsize_mb =0 ; +size_t size_mb =0 ; +u32 ch; +u32 sys_reg =readl (&pmu->sys_reg[2 ]); +u32 chans; + + chans =1 + ((sys_reg >>SYS_REG_NUM_CH_SHIFT ) &SYS_REG_NUM_CH_MASK ); + +for (ch =0 ; ch < chans; ch++) { + rank =1 + (sys_reg >>SYS_REG_RANK_SHIFT (ch) & +SYS_REG_RANK_MASK ); + col =9 + (sys_reg >>SYS_REG_COL_SHIFT (ch) &SYS_REG_COL_MASK ); + bk =3 - ((sys_reg >>SYS_REG_BK_SHIFT (ch)) &SYS_REG_BK_MASK ); + cs0_row =13 + (sys_reg >>SYS_REG_CS0_ROW_SHIFT (ch) & +SYS_REG_CS0_ROW_MASK ); + cs1_row =13 + (sys_reg >>SYS_REG_CS1_ROW_SHIFT (ch) & +SYS_REG_CS1_ROW_MASK ); + bw = (2 >> ((sys_reg >>SYS_REG_BW_SHIFT (ch)) & +SYS_REG_BW_MASK )); + row_3_4 = sys_reg >>SYS_REG_ROW_3_4_SHIFT (ch) & +SYS_REG_ROW_3_4_MASK ; + chipsize_mb = (1 << (cs0_row + col + bk + bw -20 )); + +if (rank >1 ) + chipsize_mb += chipsize_mb >> + (cs0_row - cs1_row);
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c line 72
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +10
-0+if (row_3_4) + chipsize_mb = chipsize_mb *3 /4 ; + size_mb += chipsize_mb; + } + +/* there can be no more than 2gb of memory */ + size_mb =min (size_mb,0x80000000 >>20 ); + +return size_mb; +}
The common functions for these are already merged on u-boot-rockchip/next. Please update your patchset to use these instead of duplicating here.
Quoted 39 lines
arch/arm/mach-rockchip/rk3066/sdram_rk3066.c new file +38
-0+static int rk3066_dmc_probe (struct udevice *dev) +{ +struct dram_info *priv =dev_get_priv (dev); + + priv->pmu =syscon_get_first_range (ROCKCHIP_SYSCON_PMU ); + + priv->info.base =CONFIG_SYS_SDRAM_BASE ; + priv->info.size =sdram_size_mb (priv->pmu) <<20 ; + +return 0 ; +} + +static int rk3066_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 rk3066_dmc_ops = { + .get_info = rk3066_dmc_get_info, +}; + +static const struct udevice_id rk3066_dmc_ids[] = { + { .compatible ="rockchip,rk3066-dmc" }, + { } +}; + +U_BOOT_DRIVER (dmc_rk3066) = { + .name ="rockchip_rk3066_dmc" , + .id =UCLASS_RAM , + .of_match = rk3066_dmc_ids, + .ops = &rk3066_dmc_ops, + .probe = rk3066_dmc_probe, + .priv_auto_alloc_size =sizeof (struct dram_info ), +};
PATCH 11/13 rockchip: serial: support rockchip rk3066
In reply to Paweł Jaroszupdate driver to support rk3066 serial
--- drivers/serial/serial_rockchip.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/serial/serial_rockchip.c +18 -1
@@ -12,7 +12,14 @@#include <serial.h> #include <asm/arch/clock.h> -#if defined(CONFIG_ROCKCHIP_RK3188) + +#if defined(CONFIG_ROCKCHIP_RK3066) +struct rockchip_uart_platdata { + struct dtd_rockchip_rk3066_uart dtplat; + struct ns16550_platdata plat; +}; +struct dtd_rockchip_rk3066_uart *dtplat, s_dtplat; +#elif defined(CONFIG_ROCKCHIP_RK3188) struct rockchip_uart_platdata { struct dtd_rockchip_rk3188_uart dtplat; struct ns16550_platdata plat;
@@ -40,6 +47,16 @@ static int rockchip_serial_probe(struct udevice *dev)return ns16550_serial_probe (dev); } +U_BOOT_DRIVER (rockchip_rk3066_uart) = { + .name ="rockchip_rk3066_uart" , + .id =UCLASS_SERIAL , + .priv_auto_alloc_size =sizeof (struct NS16550 ), + .platdata_auto_alloc_size =sizeof (struct rockchip_uart_platdata ), + .probe = rockchip_serial_probe, + .ops = &ns16550_serial_ops, + .flags =DM_FLAG_PRE_RELOC , +}; +U_BOOT_DRIVER (rockchip_rk3188_uart) = { .name ="rockchip_rk3188_uart" , .id =UCLASS_SERIAL ,
Signature · 1 line
2.7.4
PATCH 11/13 rockchip: serial: support rockchip rk3066
Hi Pawel,
Quoted 6 lines · Paweł Jarosz
update driver to support rk3066 serial
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/serial/serial_rockchip.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
Similar comments here to the mmc driver.
Regards,
Simon
PATCH 11/13 rockchip: serial: support rockchip rk3066
In reply to Paweł JaroszQuoted 7 lines
update driver to support rk3066 serial
Signed-off-by Paweł Jarosz <[email protected]>--- drivers/serial/serial_rockchip.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
In reply to Paweł JaroszRockchip bootrom first reads 1KB data from nand at offset 0x10080C00 and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset 0x60000000 and jumps to it.
32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
Adding this few lines of code here meets these conditions.
--- arch/arm/cpu/armv7/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/cpu/armv7/start.S +13 -0
@@ -36,6 +36,19 @@ #endif reset: + +#if defined(CONFIG_ROCKCHIP_RK3066) && defined(CONFIG_TPL_BUILD) + ldr r3, =0x10080900 + ldr r0, [r3] + cmp r0, #1 + movne r0, #1 + strne r0, [r3] + beq out_of_bootrom + bx lr +out_of_bootrom: + mov r0, #0 + str r0, [r3] +#endif /* Allow the board to save important registers */ b save_boot_params save_boot_params_ret:
Signature · 1 line
2.7.4
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Pawel,
Quoted 9 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
Quoted 8 lines
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Quoted 33 lines
Adding this few lines of code here meets these conditions.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/cpu/armv7/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/cpu/armv7/start.S +13
-1@@ -36,6 +36,19 @@ #endif reset: + +#if defined(CONFIG_ROCKCHIP_RK3066) && defined(CONFIG_TPL_BUILD) + ldr r3, =0x10080900 + ldr r0, [r3] + cmp r0, #1 + movne r0, #1 + strne r0, [r3] + beq out_of_bootrom + bx lr +out_of_bootrom: + mov r0, #0 + str r0, [r3] +#endif /* Allow the board to save important registers */ b save_boot_params save_boot_params_ret: --
Quoted 2 lines
2.7.4
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 16 lines
Hi Pawel,
Quoted 13 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
Quoted 7 lines
Quoted 4 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).
Quoted 28 lines
Quoted 28 lines
Adding this few lines of code here meets these conditions.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/cpu/armv7/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/cpu/armv7/start.S +13
-0@@ -36,6 +36,19 @@ #endif reset: + +#if defined(CONFIG_ROCKCHIP_RK3066) && defined(CONFIG_TPL_BUILD) + ldr r3, =0x10080900 + ldr r0, [r3] + cmp r0, #1 + movne r0, #1 + strne r0, [r3] + beq out_of_bootrom + bx lr +out_of_bootrom: + mov r0, #0 + str r0, [r3] +#endif
Quoted 8 lines
Quoted 6 lines
arch/arm/cpu/armv7/start.S +0
-1/* Allow the board to save important registers */ b save_boot_params save_boot_params_ret: --2.7.4
Regards,
Simon
Regards,
Paweł
Heiko Stuebner
maintainerPATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Quoted 31 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 16 lines
Hi Pawel,
Quoted 13 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
Quoted 7 lines
Quoted 4 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.
Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).
At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the back_to_bootrom at all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.
Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver (rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needing back_to_bootrom.
Heiko
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Quoted 43 lines
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Quoted 31 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 16 lines
Hi Pawel,
Quoted 13 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
Quoted 7 lines
Quoted 4 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.
Quoted 8 lines
Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver (rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needing
back_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.
Paweł
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Pawel,
Quoted 72 lines · Paweł Jarosz
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Quoted 68 lines
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Quoted 47 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 34 lines
Hi Pawel,
Quoted 22 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.Quoted 7 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.Quoted 3 lines
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.
Quoted 7 lines
Quoted 1 line
Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.
What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
+Philippe
Hi Pawel,
Quoted 83 lines · Simon Glass
Hi Pawel,
Quoted 72 lines · Paweł Jarosz
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Quoted 68 lines
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Quoted 47 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 34 lines
Hi Pawel,
Quoted 22 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.Quoted 7 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.Quoted 3 lines
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Quoted 7 lines
Quoted 1 line
Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.
Quoted 4 lines
What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjust start.S to return to the boot room early in SPL to load the other 31KB
Can you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
Quoted 90 lines
+Philippe
Hi Pawel,
Quoted 74 lines · Simon Glass
Hi Pawel,
Quoted 65 lines · Paweł Jarosz
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Quoted 62 lines
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Quoted 42 lines
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 31 lines
Hi Pawel,
Quoted 21 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.Quoted 7 lines
But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.Quoted 3 lines
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Quoted 6 lines
Quoted 1 line
Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.Quoted 4 lines
What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KB
Quoted 6 lines
Can you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
Simon
About moving dram init to spl i agree.
I think early back to bootrom in start.S is a good solution as it would give me 1KB more space for spl and i could drop hacks like jumping to spl in tpl board file. But I would like to hear the opinion of other people on this.
Also i got a nandc driver from Heiko and i would like to adopt it for u-boot in the next version. Is it ok?
Paweł
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
+ Some other rockchip people
Hi Pawel,
Quoted 113 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
Simon
Quoted 5 lines
About moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give me 1KB more space for spl and i could drop hacks like jumping to spl in tpl board file. But I would like to hear the opinion of other people on this.
So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
Quoted 3 lines
Also i got a nandc driver from Heiko and i would like to adopt it for u-boot in the next version. Is it ok?
Sounds good.
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 118 lines
+ Some other rockchip people
Hi Pawel,
Quoted 113 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066. If not done bootrom stays in weird state and halts on bringup secondary cpu in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
Simon
Quoted 7 lines
Quoted 5 lines
About moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give me 1KB more space for spl and i could drop hacks like jumping to spl in tpl board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in start.S patch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?
Quoted 6 lines
Quoted 2 lines
Also i got a nandc driver from Heiko and i would like to adopt it for u-boot in the next version. Is it ok?
Sounds good.
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
(just repeating other thread for completeness)
Quoted 134 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 130 lines
+ Some other rockchip people
Hi Pawel,
Quoted 124 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonAbout moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.
Quoted 7 lines
Quoted 2 lines
So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
Quoted 12 lines
Quoted 10 lines
Quoted 5 lines
Also i got a nandc driver from Heiko and i would like to adopt it for u-boot
in the next version. Is it ok?Sounds good.
Regards,
Simon
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 137 lines
(just repeating other thread for completeness)
Quoted 134 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 130 lines
+ Some other rockchip people
Hi Pawel,
Quoted 116 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in the past, without requiring the
back_to_bootromat all. So question would be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually work on previous socs down to the rk3066 as well) and it may be possible to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonQuoted 7 lines
About moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
Quoted 8 lines
Quoted 3 lines
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
BROM re-enters same address 0x10080C04 two times. First when it boots, second after first back to brom. That is why i used counter at address 0x10080900 to count boot entries.
So it's not painful at all.
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Also i got a nandc driver from Heiko and i would like to adopt it for u-boot
in the next version. Is it ok?Sounds good.
Regards,
SimonRegards,
Simon
Cheers
Paweł
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Pawel,
Quoted 164 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 154 lines
(just repeating other thread for completeness)
Quoted 142 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 138 lines
+ Some other rockchip people
Hi Pawel,
Quoted 131 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonAbout moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.Quoted 7 lines
Quoted 2 lines
So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?Quoted 4 lines
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
Quoted 4 lines
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.
OK from my POV this seems good.
[..]
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi,
W dniu 15.06.2017 o 18:40, Simon Glass pisze:
Quoted 164 lines
Hi Pawel,
Quoted 157 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 145 lines
(just repeating other thread for completeness)
Quoted 142 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 138 lines
+ Some other rockchip people
Hi Pawel,
Quoted 122 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonQuoted 8 lines
About moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
Quoted 8 lines
Quoted 3 lines
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
Quoted 4 lines
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.
Quoted 6 lines
OK from my POV this seems good.
[..]
Regards,
Simon
It turns out that i will be needing tpl, spl and main u-boot. Also sdram initialization will be needed in tpl.
Reason for that is how bootrom on rk3066 executes stuff:
1. At first stage it reads 2KB of data from nand to sram at address 0x10080C00 and decodes 1KB, executes decoded data at 0x10080C04 and waits for back to bootrom.
2. At second stage it reads 31KB, decodes it and executes again data at 0x10080C04 and waits for second back to bootrom. Also SDRAM init MUST BE HERE or board hangs at third stage.
3. At third stage bootrom reads ~200KB data to RAM at 0x60000000, decodes it and do final execution.
All three stages are required or else later kernel will halt at bringup secondary cpus using bootrom (there is another back to bootrom in kernel code to bringup secondary cpus)
So there are two ways to boot main u-boot:
1. TPL + SPL loaded to sram (stages one and two) and main u-boot loaded to sdram(third stage). In this case main u-boot must fit in ~200KB which is not much and ONLY ONE of the features nand, mmc, usb might be compiled in.
2. TPL with SDRAM INIT + early back to bootrom patch as stage one and two, SPL as stage three, and main u-boot loaded from nand by SPL (stage four).
I know all of this from bootrom disassembly and tests.
So is it ok to go the second way?
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Quoted 177 lines · Paweł Jarosz
Hi,
W dniu 15.06.2017 o 18:40, Simon Glass pisze:
Quoted 164 lines
Hi Pawel,
Quoted 157 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 145 lines
(just repeating other thread for completeness)
Quoted 142 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 138 lines
+ Some other rockchip people
Hi Pawel,
Quoted 122 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonQuoted 8 lines
About moving dram init to spl i agree.
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
Quoted 8 lines
Quoted 3 lines
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
Quoted 4 lines
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.Quoted 6 lines
OK from my POV this seems good.
[..]
Regards,
Simon
Quoted 7 lines
It turns out that i will be needing tpl, spl and main u-boot. Also sdram initialization will be needed in tpl.
Reason for that is how bootrom on rk3066 executes stuff:
1. At first stage it reads 2KB of data from nand to sram at address
0x10080C00and decodes 1KB, executes decoded data at0x10080C04and waits for back to bootrom.
2. At second stage it reads 31KB, decodes it and executes again data at0x10080C04and waits for second back to bootrom. Also SDRAM init MUST BE HERE or board hangs at third stage.
3. At third stage bootrom reads ~200KB data to RAM at0x60000000, decodes it and do final execution.
Are both the first stage and the second stage loaded to SRAM + 0xc00? I.e. does the second stage (31KB) overwrite the first stage?
Quoted 11 lines
All three stages are required or else later kernel will halt at bringup secondary cpus using bootrom (there is another back to bootrom in kernel code to bringup secondary cpus)
So there are two ways to boot main u-boot:
1. TPL + SPL loaded to sram (stages one and two) and main u-boot loaded to sdram(third stage). In this case main u-boot must fit in ~200KB which is not much and ONLY ONE of the features nand, mmc, usb might be compiled in.
2. TPL with SDRAM INIT + early back to bootrom patch as stage one and two, SPL as stage three, and main u-boot loaded from nand by SPL (stage four).
I know all of this from bootrom disassembly and tests.
So is it ok to go the second way?
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Philipp,
W dniu 04.08.2017 o 18:51, Dr. Philipp Tomsich pisze:
Quoted 173 lines
Quoted 173 lines · Paweł Jarosz
Hi,
W dniu 15.06.2017 o 18:40, Simon Glass pisze:
Quoted 159 lines
Hi Pawel,
Quoted 148 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 146 lines
(just repeating other thread for completeness)
Quoted 143 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 130 lines
+ Some other rockchip people
Hi Pawel,
Quoted 124 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonAbout moving dram init to spl i agree.
Quoted 8 lines
Quoted 6 lines
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?Quoted 8 lines
Quoted 4 lines
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.Quoted 6 lines
OK from my POV this seems good.
[..]
Regards,
SimonIt turns out that i will be needing tpl, spl and main u-boot. Also sdram initialization will be needed in tpl.
Quoted 7 lines
Quoted 5 lines
Reason for that is how bootrom on rk3066 executes stuff:
1. At first stage it reads 2KB of data from nand to sram at address
0x10080C00and decodes 1KB, executes decoded data at0x10080C04and waits for back to bootrom.
2. At second stage it reads 31KB, decodes it and executes again data at0x10080C04and waits for second back to bootrom. Also SDRAM init MUST BE HERE or board hangs at third stage.
3. At third stage bootrom reads ~200KB data to RAM at0x60000000, decodes it and do final execution.Are both the first stage and the second stage loaded to SRAM +
0xc00? I.e. does the second stage (31KB) overwrite the first stage?
No. First stage is loaded to 0xC00 in sram(2KB but decoded from rc4 only 1KB), second stage is then loaded to 0xC00 + 2KB(0x400)
Quoted 12 lines
Quoted 12 lines
All three stages are required or else later kernel will halt at bringup secondary cpus using bootrom (there is another back to bootrom in kernel code to bringup secondary cpus)
So there are two ways to boot main u-boot:
1. TPL + SPL loaded to sram (stages one and two) and main u-boot loaded to sdram(third stage). In this case main u-boot must fit in ~200KB which is not much and ONLY ONE of the features nand, mmc, usb might be compiled in.
2. TPL with SDRAM INIT + early back to bootrom patch as stage one and two, SPL as stage three, and main u-boot loaded from nand by SPL (stage four).
I know all of this from bootrom disassembly and tests.
So is it ok to go the second way?
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Quoted 182 lines · Paweł Jarosz
Hi Philipp,
W dniu 04.08.2017 o 18:51, Dr. Philipp Tomsich pisze:
Quoted 175 lines
Quoted 175 lines · Paweł Jarosz
Hi,
W dniu 15.06.2017 o 18:40, Simon Glass pisze:
Quoted 159 lines
Hi Pawel,
Quoted 148 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 146 lines
(just repeating other thread for completeness)
Quoted 143 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 130 lines
+ Some other rockchip people
Hi Pawel,
Quoted 124 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonAbout moving dram init to spl i agree.
Quoted 8 lines
Quoted 6 lines
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?Quoted 8 lines
Quoted 4 lines
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.Quoted 6 lines
OK from my POV this seems good.
[..]
Regards,
SimonIt turns out that i will be needing tpl, spl and main u-boot. Also sdram initialization will be needed in tpl.
Reason for that is how bootrom on rk3066 executes stuff:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
1. At first stage it reads 2KB of data from nand to sram at address
0x10080C00and decodes 1KB, executes decoded data at0x10080C04and waits for back to bootrom.
2. At second stage it reads 31KB, decodes it and executes again data at0x10080C04and waits for second back to bootrom. Also SDRAM init MUST BE HERE or board hangs at third stage.
3. At third stage bootrom reads ~200KB data to RAM at0x60000000, decodes it and do final execution.Are both the first stage and the second stage loaded to SRAM +
0xc00? I.e. does the second stage (31KB) overwrite the first stage?No. First stage is loaded to
0xC00in sram(2KB but decoded from rc4 only 1KB), second stage is then loaded to0xC00+ 2KB(0x400)
If you have no logic (except for counting ‘reentries’) in the first stage, you might be able to implement this as a boot0 hook.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
All three stages are required or else later kernel will halt at bringup secondary cpus using bootrom (there is another back to bootrom in kernel code to bringup secondary cpus)
So there are two ways to boot main u-boot:
1. TPL + SPL loaded to sram (stages one and two) and main u-boot loaded to sdram(third stage). In this case main u-boot must fit in ~200KB which is not much and ONLY ONE of the features nand, mmc, usb might be compiled in.
2. TPL with SDRAM INIT + early back to bootrom patch as stage one and two, SPL as stage three, and main u-boot loaded from nand by SPL (stage four).
I know all of this from bootrom disassembly and tests.
So is it ok to go the second way?
I would view option two as just having the usual three stages, but the TPL stage being loaded in pieces and being entered twice. So option 2 will then look a lot like other Rockchip boot sequences.
Cheers,
Philipp.
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
Hi Phillip,
W dniu 09.08.2017 o 22:01, Dr. Philipp Tomsich pisze:
Quoted 181 lines
Quoted 181 lines · Paweł Jarosz
Hi Philipp,
W dniu 04.08.2017 o 18:51, Dr. Philipp Tomsich pisze:
Quoted 175 lines
Quoted 175 lines · Paweł Jarosz
Hi,
W dniu 15.06.2017 o 18:40, Simon Glass pisze:
Quoted 159 lines
Hi Pawel,
Quoted 148 lines · Paweł Jarosz
W dniu 15.06.2017 o 18:00, Simon Glass pisze:
Quoted 146 lines
(just repeating other thread for completeness)
Quoted 143 lines · Paweł Jarosz
W dniu 15.06.2017 o 16:50, Simon Glass pisze:
Quoted 130 lines
+ Some other rockchip people
Hi Pawel,
Quoted 124 lines · Paweł Jarosz
Hi Simon
W dniu 14.06.2017 o 13:06, Simon Glass pisze:
+Philippe
Hi Pawel,
On 12 June 2017 at 17:50, Simon Glass <[email protected]> wrote:
Hi Pawel,
On 9 June 2017 at 06:31, Paweł Jarosz <[email protected]> wrote:
W dniu 09.06.2017 o 13:46, Heiko Stuebner pisze:
Am Mittwoch, 7. Juni 2017, 17:37:13 CEST schrieb Paweł Jarosz:
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Hi Pawel,
On 6 June 2017 at 12:53, Paweł Jarosz <[email protected]> wrote:
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and
executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000
and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl
execution.So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).At least the rk3288-Firefly was able to also have mmc stack in the SPL in
the past, without requiring theback_to_bootromat all. So question would
be why this doesn't fit anymore, or on the rk3066 specifically.Also, it seems like I got my hands on a preliminary (linux/mtd) nand driver
(rk3228 but cursory glance at the registers suggests that it may actually
work on previous socs down to the rk3066 as well) and it may be possible
to adapt that for uboot, therefore making the spl able to also load the full u-boot from without needingback_to_bootrom.Heiko
I was not able to get mmc support on rk3066 in spl in ~31kb (32kb - 1kb for
tpl)size limit.
One (or two i didn't check how much) back to bootrom is required on rk3066.
If not done bootrom stays in weird state and halts on bringup secondary cpu
in kernel. So it's rk3066 specific.What size do you get? With firefly-rk3288 I get about 25KB with SDRAM init and MMC stack. Are you building with Thumb 2?
If you are on irc we could try to clear this up more quicky (I am sjg1)
To summarise where I think we got to:
- move DRAM init into SPL
- either have a very small TPL which just returns to boot ROM, or adjuststart.Sto return to the boot room early in SPL to load the other 31KBCan you please post to the mailing list with your thoughts on this so that others (including rockchip) can chime in? I think either will work but I think others will have an opinion.
Regards,
SimonAbout moving dram init to spl i agree.
Quoted 8 lines
Quoted 6 lines
I think early back to bootrom in
start.Sis a good solution as it would give
me 1KB more space for spl and i could drop hacks like jumping to spl in tpl
board file. But I would like to hear the opinion of other people on this.So with this solution there would be no TPL needed? It sounds reasonable to me. I'd like to hear other opinions also.
We don't need tpl if i use early back to bootrom in
start.Spatch with spl... but i didn't test it yet. If it will work i will drop the tpl. Is that ok?Quoted 8 lines
Quoted 4 lines
It's OK with me. I don't know how the BROM re-enters SPL after the first call into the 1KB region. Depending on how that works, it might be too painful to use SPL only (e.g. if it jumps to a place in the middle of SPL).
BROM re-enters same address
0x10080C04two times. First when it boots, second after first back to brom. That is why i used counter at address0x10080900to count boot entries.
So it's not painful at all.Quoted 6 lines
OK from my POV this seems good.
[..]
Regards,
SimonIt turns out that i will be needing tpl, spl and main u-boot. Also sdram initialization will be needed in tpl.
Reason for that is how bootrom on rk3066 executes stuff:
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
1. At first stage it reads 2KB of data from nand to sram at address
0x10080C00and decodes 1KB, executes decoded data at0x10080C04and waits for back to bootrom.
2. At second stage it reads 31KB, decodes it and executes again data at0x10080C04and waits for second back to bootrom. Also SDRAM init MUST BE HERE or board hangs at third stage.
3. At third stage bootrom reads ~200KB data to RAM at0x60000000, decodes it and do final execution.Are both the first stage and the second stage loaded to SRAM +
0xc00? I.e. does the second stage (31KB) overwrite the first stage?No. First stage is loaded to
0xC00in sram(2KB but decoded from rc4 only 1KB), second stage is then loaded to0xC00+ 2KB(0x400)If you have no logic (except for counting ‘reentries’) in the first stage, you might be able to implement this as a boot0 hook.
I will implement this as boot0 hook.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
All three stages are required or else later kernel will halt at bringup secondary cpus using bootrom (there is another back to bootrom in kernel code to bringup secondary cpus)
So there are two ways to boot main u-boot:
1. TPL + SPL loaded to sram (stages one and two) and main u-boot loaded to sdram(third stage). In this case main u-boot must fit in ~200KB which is not much and ONLY ONE of the features nand, mmc, usb might be compiled in.
2. TPL with SDRAM INIT + early back to bootrom patch as stage one and two, SPL as stage three, and main u-boot loaded from nand by SPL (stage four).
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I know all of this from bootrom disassembly and tests.
So is it ok to go the second way?
I would view option two as just having the usual three stages, but the TPL stage being loaded in pieces and being entered twice. So option 2 will then look a lot like other Rockchip boot sequences.
Cheers,
Philipp.
So i'll go option two.
Cheers,
Paweł
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
In reply to Paweł JaroszHi Pawel,
Quoted 34 lines · Paweł Jarosz
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 30 lines
Hi Pawel,
Quoted 25 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram
which also executes. Sdram initialisation code needs to be in one of these two
steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for
u-boot part(for example to boot from mmc you need to disable usb support.My solution to size problem is to move sdram initialisation code to tpl stage,
move spl part to third stage(reading 200KB data) and add support for loading
u-boot by spl from ext2/4, fat partitions.But moving sdram initialisation code to tpl increases size of tpl above 1KB
(first boot stage). Solution to this is to add code which will be below 1KB
offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
Quoted 7 lines
Quoted 3 lines
So do you mean that TPL starts and then loads more of itself? Why not put SDRAM init in SPL? You say above that 32KB is 'too low', but It's not clear why.
Ad.1 No. Tpl starts and at the first execution returns to bootrom. Bootrom then loads
rest of the tpl (31KB) and executes it for a second time.
So can we do this trick with SPL and drop TPL?
Quoted 8 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).
You should be able to fit MMC and SDRAM into 32KB. E.g. I can build firefly-rk3288 that way as Heiko mentions
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Adding this few lines of code here meets these conditions.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/cpu/armv7/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)arch/arm/cpu/armv7/start.S +10
-0@@ -36,6 +36,19 @@ #endif reset: + +#if defined(CONFIG_ROCKCHIP_RK3066) && defined(CONFIG_TPL_BUILD) + ldr r3, =0x10080900 + ldr r0, [r3] + cmp r0, #1 + movne r0, #1 + strne r0, [r3] + beq out_of_bootrom + bx lr +out_of_bootrom:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/cpu/armv7/start.S +3
-1+ mov r0, #0 + str r0, [r3] +#endif /* Allow the board to save important registers */ b save_boot_params save_boot_params_ret: --2.7.4
Regards,
Simon
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 1 line
So can we do this trick with SPL and drop TPL?
I think it's better to leave tpl build as it is.
Quoted 10 lines
Quoted 7 lines
Ad.2,3 Due to size issues (200KB limit) i needed to move main u-boot to mmc. To load u-boot from
mmc by SPL (there is 32KB bootrom limit, not enough space for mmc support) i moved SPL to sdram.
Code executed in sdram can't mess with sdram settings because it will hang the board. Sdram setup
needs to be done by code in SRAM (tpl).You should be able to fit MMC and SDRAM into 32KB. E.g. I can build firefly-rk3288 that way as Heiko mentions
Maybe i could drop some configs and fit in 32KB SPL but not with very convenient for users configs for loading u-boot from partition and not offset in mmc :-).
Paweł
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
In reply to Paweł JaroszQuoted 18 lines
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
Quoted 7 lines
Adding this few lines of code here meets these conditions.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/cpu/armv7/start.S | 13 +++++++++++++ 1 file changed, 13 insertions(+)
PATCH 12/13 armv7: support rk3066 early back to bootrom in start.S
In reply to Paweł JaroszQuoted 37 lines · Paweł Jarosz
Rockchip bootrom first reads 1KB data from nand at offset
0x10080C00and executes it. Then waits for back to bootrom and loads another 32KB to sram which also executes. Sdram initialisation code needs to be in one of these two steps. Then bootloader loads another ~200KB of data at offset0x60000000and jumps to it.32KB of data is a little low for tpl + spl part and ~200KB data is to low for u-boot part(for example to boot from mmc you need to disable usb support.
My solution to size problem is to move sdram initialisation code to tpl stage, move spl part to third stage(reading 200KB data) and add support for loading u-boot by spl from ext2/4, fat partitions.
But moving sdram initialisation code to tpl increases size of tpl above 1KB (first boot stage). Solution to this is to add code which will be below 1KB offset in tpl binary and do back to bootrom at very beginning of the tpl execution.
Adding this few lines of code here meets these conditions.
Signed-off-by Paweł Jarosz <[email protected]>Acked-by Philipp Tomsich <[email protected]>---
arch/arm/cpu/armv7/start.S| 13 +++++++++++++1 file changed, 13 insertions(+)arch/arm/cpu/armv7/start.S +0
-0@@ -36,6 +36,19 @@ #endifreset:
arch/arm/cpu/armv7/start.S +3
-0+ +#if defined(CONFIG_ROCKCHIP_RK3066) && defined(CONFIG_TPL_BUILD) + ldr r3, =0x10080900
arch/arm/cpu/armv7/start.S line 51
Quoted 10 lines
arch/arm/cpu/armv7/start.S +10
-0+ ldr r0, [r3] + cmp r0, #1 + movne r0, #1 + strne r0, [r3] + beq out_of_bootrom + bx lr +out_of_bootrom: + mov r0, #0 + str r0, [r3] +#endif
I don't like us adding device-specific code to armv7/start.S. Can you try to handle this in the boot0 hook (device-specific) or somewhere else (more suitable/chip-specific)?
Quoted 4 lines
/* Allow the board to save important registers */ b save_boot_params
save_boot_params_ret:
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
In reply to Paweł JaroszAdd sdram initialisation code which will be ussed by tpl first boot stage. We need to implement sdram initialisation in tpl due to size issues on rk3066 platform.
--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_init.c
arch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5 -0
@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +995 -0
995 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
Hi Pawel,
Quoted 88 lines · Paweł Jarosz
Add sdram initialisation code which will be ussed by tpl first boot stage. We need to implement sdram initialisation in tpl due to size issues on rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_init.carch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5
-0@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {arch/arm/mach-rockchip/rk3066/sdram_init.c new file +55
-0@@ -0,0 +1,995 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <errno.h> +#include <ram.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +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 =0x0f , + +/* PLL CON1 */ +PLL_NF_MASK =0x1fff , + +/* PLL CON2 */ +PLL_BWADJ_MASK =0x0fff , + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =1 <<4 , +SOCSTS_APLL_LOCK =1 <<5 ,
arch/arm/mach-rockchip/rk3066/sdram_init.c line 65
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +10
-0+SOCSTS_CPLL_LOCK =1 <<6 , + SOCSTS_GPLL_LOCK = 1 << 7, +}; + +#define CRU_BASE 0x20000000 +#define GRF_BASE 0x20008000 +#define PMU_BASE 0x20004000 +#define PCTL_BASE 0x20020000 +#define PUBL_BASE 0x20040000 +#define NOC_BASE 0x10128000
I'm assume we cannot use the DT / syscon because of space constraints?
arch/arm/mach-rockchip/rk3066/sdram_init.c line 67
Quoted 2 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +2
-0+ +#define RK3066_PCTL_TIMING_DEFAULT { \
Do you need this? Why not just put these values below and avoid the indirection?
Quoted 86 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +86
-0+ .togcnt1u = 0x12c, \ + .tinit = 0xc8, \ + .trsth = 0x1f4, \ + .togcnt100n = 0x1e, \ + .trefi = 0x4e, \ + .tmrd = 0x4, \ + .trfc = 0x69, \ + .trp = 0x6, \ + .trtw = 0x3, \ + .tal = 0x0, \ + .tcl = 0x6, \ + .tcwl = 0x5, \ + .tras = 0xc, \ + .trc = 0x10, \ + .trcd = 0x6, \ + .trrd = 0x4, \ + .trtp = 0x4, \ + .twr = 0x5, \ + .twtr = 0x4, \ + .texsr = 0x200, \ + .txp = 0x3, \ + .txpdll = 0xa, \ + .tzqcs = 0x40, \ + .tzqcsi = 0x0, \ + .tdqs = 0x1, \ + .tcksre = 0x5, \ + .tcksrx = 0x5, \ + .tcke = 0x3, \ + .tmod = 0xc, \ + .trstl = 0x1e, \ + .tzqcl = 0x100, \ + .tmrr = 0x0, \ + .tckesr = 0x4, \ + .tdpd = 0x0 \ +} + +#define RK3066_PHY_TIMING_DEFAULT { \ + .dtpr0 = 0x208c6690, \ + .dtpr1 = 0x690878, \ + .dtpr2 = 0x10022a00, \ + .mr = { 0x220, 0x40, 0x0, 0x0 } \ +} + +#define RK3066_SDRAM_PARAMS_DEFAULT { \ + .noc_timing = 0x24716310, \ + .noc_activate = 0, \ + .ddrconfig = 2, \ + .ddr_freq = 300000000, \ + .dramtype = 3, \ + .stride = 9, \ + .odt = 0 \ +} + +#ifndef RK3066_PCTL_TIMING +#define RK3066_PCTL_TIMING RK3066_PCTL_TIMING_DEFAULT +#endif + +#ifndef RK3066_PHY_TIMING +#define RK3066_PHY_TIMING RK3066_PHY_TIMING_DEFAULT +#endif + +#ifndef RK3066_SDRAM_PARAMS +#define RK3066_SDRAM_PARAMS RK3066_SDRAM_PARAMS_DEFAULT +#endif + +struct chan_info { +struct rk3288_ddr_pctl *pctl; +struct rk3288_ddr_publ *publ; +struct rk3188_msch *msch; +}; + +struct dram_info { +struct chan_info chan[1 ]; +struct ram_info info; +struct rk3066_cru *cru; +struct rk3066_grf *grf; +struct rk3188_pmu *pmu; +}; + +struct rk3066_sdram_params { +struct rk3288_sdram_channel ch[2 ]; +struct rk3288_sdram_pctl_timing pctl_timing; +struct rk3288_sdram_phy_timing phy_timing; +struct rk3288_base_params base; +int num_channels; +struct regmap *map;
arch/arm/mach-rockchip/rk3066/sdram_init.c line 163
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +10
-0+}; + +const int ddrconf_table[] = { +/* +* [5:4] row(13+n) +* [1:0] col(9+n), assume bw=2 +* row col,bw +*/ +0 , + ((2 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ),
You can drop the ()
Quoted 39 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +39
-0+ ((1 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ), + ((2 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((1 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((1 <<DDRCONF_ROW_SHIFT ) |0 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |0 <<DDRCONF_COL_SHIFT ), +0 , +0 , +0 , +0 , +0 , +0 , + 0, +}; + +#define TEST_PATTEN 0x5aa5f00f +#define DQS_GATE_TRAINING_ERROR_RANK0 (1 << 4) +#define DQS_GATE_TRAINING_ERROR_RANK1 (2 << 4) + + +static void copy_to_reg (u32 *dest,const u32 *src,u32 n) +{ +int i; + +for (i =0 ; i < n /sizeof (u32); i++) { +writel (*src, dest); + src++; + dest++; + } +} + +static void ddr_reset (struct rk3066_cru *cru,u32 ch,u32 ctl,u32 phy) +{ +u32 phy_ctl_srstn_shift =13 ; +u32 ctl_psrstn_shift =11 ; +u32 ctl_srstn_shift =10 ; +u32 phy_psrstn_shift =9 ; +u32 phy_srstn_shift =8 ;
arch/arm/mach-rockchip/rk3066/sdram_init.c line 212
Quoted 10 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +10
-0+ +rk_clrsetreg (&cru->cru_softrst_con[5 ], +1 << phy_ctl_srstn_shift |1 << ctl_psrstn_shift | +1 << ctl_srstn_shift |1 << phy_psrstn_shift | +1 << phy_srstn_shift, + phy << phy_ctl_srstn_shift | ctl << ctl_psrstn_shift | + ctl << ctl_srstn_shift | phy << phy_psrstn_shift | + phy << phy_srstn_shift); +} +
How similar is this to rk3288? Could we put common code in a separate file?
Regards,
Simon
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 94 lines
Hi Pawel,
Quoted 91 lines · Paweł Jarosz
Add sdram initialisation code which will be ussed by tpl first boot stage. We need to implement sdram initialisation in tpl due to size issues on rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_init.carch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5
-0@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {arch/arm/mach-rockchip/rk3066/sdram_init.c new file +58
-0@@ -0,0 +1,995 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <errno.h> +#include <ram.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +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 =0x0f , + +/* PLL CON1 */ +PLL_NF_MASK =0x1fff , + +/* PLL CON2 */ +PLL_BWADJ_MASK =0x0fff , + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =1 <<4 , +SOCSTS_APLL_LOCK =1 <<5 , +SOCSTS_CPLL_LOCK =1 <<6 , +SOCSTS_GPLL_LOCK =1 <<7 , +};
Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 65
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +7
-0+ +#define CRU_BASE 0x20000000 +#define GRF_BASE 0x20008000 +#define PMU_BASE 0x20004000 +#define PCTL_BASE 0x20020000 +#define PUBL_BASE 0x20040000 +#define NOC_BASE 0x10128000I'm assume we cannot use the DT / syscon because of space constraints?
Correct.
Quoted 3 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 67
Quoted 2 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +2
-0+ +#define RK3066_PCTL_TIMING_DEFAULT { \Do you need this? Why not just put these values below and avoid the indirection?
Some board may need this in the future as sdram timings are not universal. Default timings are dumped from rockchip proprietary loader. Look here:
Quoted 43 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +43
-0+#ifndef RK3066_PCTL_TIMING +#define RK3066_PCTL_TIMING RK3066_PCTL_TIMING_DEFAULT +#endif + +#ifndef RK3066_PHY_TIMING +#define RK3066_PHY_TIMING RK3066_PHY_TIMING_DEFAULT +#endif + +#ifndef RK3066_SDRAM_PARAMS +#define RK3066_SDRAM_PARAMS RK3066_SDRAM_PARAMS_DEFAULT +#endif + +struct chan_info { +struct rk3288_ddr_pctl *pctl; +struct rk3288_ddr_publ *publ; +struct rk3188_msch *msch; +}; + +struct dram_info { +struct chan_info chan[1 ]; +struct ram_info info; +struct rk3066_cru *cru; +struct rk3066_grf *grf; +struct rk3188_pmu *pmu; +}; + +struct rk3066_sdram_params { +struct rk3288_sdram_channel ch[2 ]; +struct rk3288_sdram_pctl_timing pctl_timing; +struct rk3288_sdram_phy_timing phy_timing; +struct rk3288_base_params base; +int num_channels; +struct regmap *map; +}; + +const int ddrconf_table[] = { +/* +* [5:4] row(13+n) +* [1:0] col(9+n), assume bw=2 +* row col,bw +*/ +0 , + ((2 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ),
Quoted 1 line
You can drop the ()
Ok
Quoted 42 lines
Quoted 42 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +42
-0+ ((1 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |1 <<DDRCONF_COL_SHIFT ), + ((2 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((1 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |2 <<DDRCONF_COL_SHIFT ), + ((1 <<DDRCONF_ROW_SHIFT ) |0 <<DDRCONF_COL_SHIFT ), + ((0 <<DDRCONF_ROW_SHIFT ) |0 <<DDRCONF_COL_SHIFT ), +0 , +0 , +0 , +0 , +0 , +0 , + 0, +}; + +#define TEST_PATTEN 0x5aa5f00f +#define DQS_GATE_TRAINING_ERROR_RANK0 (1 << 4) +#define DQS_GATE_TRAINING_ERROR_RANK1 (2 << 4) + + +static void copy_to_reg (u32 *dest,const u32 *src,u32 n) +{ +int i; + +for (i =0 ; i < n /sizeof (u32); i++) { +writel (*src, dest); + src++; + dest++; + } +} + +static void ddr_reset (struct rk3066_cru *cru,u32 ch,u32 ctl,u32 phy) +{ +u32 phy_ctl_srstn_shift =13 ; +u32 ctl_psrstn_shift =11 ; +u32 ctl_srstn_shift =10 ; +u32 phy_psrstn_shift =9 ; +u32 phy_srstn_shift =8 ; + + rk_clrsetreg(&cru->cru_softrst_con[5], + 1 << phy_ctl_srstn_shift | 1 << ctl_psrstn_shift |
Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 212
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +7
-0+1 << ctl_srstn_shift |1 << phy_psrstn_shift | +1 << phy_srstn_shift, + phy << phy_ctl_srstn_shift | ctl << ctl_psrstn_shift | + ctl << ctl_srstn_shift | phy << phy_psrstn_shift | + phy << phy_srstn_shift); +} +How similar is this to rk3288? Could we put common code in a separate file?
Not sure how similar is it to rk3288. CRU, GRF, PMU differ a little between socs.
Also i needed to add few adjustments to make it build and run with tpl.
Quoted 2 lines
Regards,
Simon
Regards
Paweł
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
Hi Pawel,
Quoted 123 lines · Paweł Jarosz
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 101 lines
Hi Pawel,
Quoted 98 lines · Paweł Jarosz
Add sdram initialisation code which will be ussed by tpl first boot stage.
We need to implement sdram initialisation in tpl due to size issues on rk3066
platform.Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_init.carch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5
-0@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {arch/arm/mach-rockchip/rk3066/sdram_init.c new file +59
-0@@ -0,0 +1,995 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <errno.h> +#include <ram.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +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 =0x0f , + +/* PLL CON1 */ +PLL_NF_MASK =0x1fff , + +/* PLL CON2 */ +PLL_BWADJ_MASK =0x0fff , + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =1 <<4 , +SOCSTS_APLL_LOCK =1 <<5 , +SOCSTS_CPLL_LOCK =1 <<6 , +SOCSTS_GPLL_LOCK =1 <<7 , +}; +Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 65
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +6
-0+#define CRU_BASE 0x20000000 +#define GRF_BASE 0x20008000 +#define PMU_BASE 0x20004000 +#define PCTL_BASE 0x20020000 +#define PUBL_BASE 0x20040000 +#define NOC_BASE 0x10128000I'm assume we cannot use the DT / syscon because of space constraints?
Correct.
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 67
Quoted 3 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +2
-0+ +#define RK3066_PCTL_TIMING_DEFAULT { \Do you need this? Why not just put these values below and avoid the indirection?
Quoted 3 lines
Some board may need this in the future as sdram timings are not universal. Default timings are dumped from rockchip proprietary loader. Look here:
In that case these should go in the device tree like with other Rockchip boards. [...]
Quoted 6 lines
Quoted 3 lines
How similar is this to rk3288? Could we put common code in a separate file?
Not sure how similar is it to rk3288. CRU, GRF, PMU differ a little between socs.
Where did you get the code from? I want to avoid duplicate code and factor out the differences if we can.
Quoted 1 line
Also i needed to add few adjustments to make it build and run with tpl.
I am still hoping we can drop TPL.
Regards,
Simon
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 120 lines
Hi Pawel,
Quoted 117 lines · Paweł Jarosz
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 99 lines
Hi Pawel,
Quoted 96 lines · Paweł Jarosz
Add sdram initialisation code which will be ussed by tpl first boot stage.
We need to implement sdram initialisation in tpl due to size issues on rk3066
platform.Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_init.carch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5
-0@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {arch/arm/mach-rockchip/rk3066/sdram_init.c new file +58
-0@@ -0,0 +1,995 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <errno.h> +#include <ram.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +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 =0x0f , + +/* PLL CON1 */ +PLL_NF_MASK =0x1fff , + +/* PLL CON2 */ +PLL_BWADJ_MASK =0x0fff , + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =1 <<4 , +SOCSTS_APLL_LOCK =1 <<5 , +SOCSTS_CPLL_LOCK =1 <<6 , +SOCSTS_GPLL_LOCK =1 <<7 , +};Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 65
Quoted 7 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +7
-0+ +#define CRU_BASE 0x20000000 +#define GRF_BASE 0x20008000 +#define PMU_BASE 0x20004000 +#define PCTL_BASE 0x20020000 +#define PUBL_BASE 0x20040000 +#define NOC_BASE 0x10128000I'm assume we cannot use the DT / syscon because of space constraints?
Correct.
Quoted 4 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 67
Quoted 2 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +2
-0+ +#define RK3066_PCTL_TIMING_DEFAULT { \Do you need this? Why not just put these values below and avoid the indirection?
Quoted 5 lines
Quoted 3 lines
Some board may need this in the future as sdram timings are not universal. Default timings are dumped from rockchip proprietary loader. Look here:
In that case these should go in the device tree like with other Rockchip boards. [...]
It's tpl build. Is device tree supported in tpl?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
How similar is this to rk3288? Could we put common code in a separate file?
Not sure how similar is it to rk3288. CRU, GRF, PMU differ a little between socs.
Where did you get the code from? I want to avoid duplicate code and factor out the differences if we can.
It's adjusted code from rk3188 sdram driver.
Quoted 5 lines
Quoted 1 line
Also i needed to add few adjustments to make it build and run with tpl.
I am still hoping we can drop TPL.
Regards,
Simon
Regards
Paweł
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
Hi Pawel,
Quoted 136 lines · Paweł Jarosz
W dniu 09.06.2017 o 14:27, Simon Glass pisze:
Quoted 132 lines
Hi Pawel,
Quoted 128 lines · Paweł Jarosz
Hi Simon,
W dniu 06.06.2017 o 23:10, Simon Glass pisze:
Quoted 101 lines
Hi Pawel,
Quoted 98 lines · Paweł Jarosz
Add sdram initialisation code which will be ussed by tpl first boot stage.
We need to implement sdram initialisation in tpl due to size issues on rk3066
platform.Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+)create mode 100644
arch/arm/mach-rockchip/rk3066/sdram_init.carch/arm/include/asm/arch-rockchip/ddr_rk3188.h +5
-0@@ -10,6 +10,11 @@#include <asm/arch/ddr_rk3288.h> /* +* RK3066 Tpl memory init. +*/ +void sdram_initialise (void ); + +/* * RK3188 Memory scheduler register map. */ struct rk3188_msch {arch/arm/mach-rockchip/rk3066/sdram_init.c new file +59
-0@@ -0,0 +1,995 @@ +/* +* (C) Copyright 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +* +* SPDX-License-Identifier: GPL-2.0 +* +* Adapted from the very similar rk3288 ddr init. +*/ + +#include <common.h> +#include <clk.h> +#include <errno.h> +#include <ram.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/cru_rk3066.h> +#include <asm/arch/ddr_rk3188.h> +#include <asm/arch/grf_rk3066.h> +#include <asm/arch/pmu_rk3188.h> +#include <asm/arch/sdram.h> +#include <linux/err.h> + +DECLARE_GLOBAL_DATA_PTR ; + +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 =0x0f , + +/* PLL CON1 */ +PLL_NF_MASK =0x1fff , + +/* PLL CON2 */ +PLL_BWADJ_MASK =0x0fff , + +/* PLL CON3 */ +PLL_RESET_SHIFT =5 , + +/* GRF_SOC_STATUS0 */ +SOCSTS_DPLL_LOCK =1 <<4 , +SOCSTS_APLL_LOCK =1 <<5 , +SOCSTS_CPLL_LOCK =1 <<6 , +SOCSTS_GPLL_LOCK =1 <<7 , +}; +Quoted 8 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 65
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +6
-0+#define CRU_BASE 0x20000000 +#define GRF_BASE 0x20008000 +#define PMU_BASE 0x20004000 +#define PCTL_BASE 0x20020000 +#define PUBL_BASE 0x20040000 +#define NOC_BASE 0x10128000I'm assume we cannot use the DT / syscon because of space constraints?
Correct.
Quoted 6 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c line 67
Quoted 3 lines
arch/arm/mach-rockchip/rk3066/sdram_init.c new file +2
-0+ +#define RK3066_PCTL_TIMING_DEFAULT { \Do you need this? Why not just put these values below and avoid the indirection?
Some board may need this in the future as sdram timings are not universal.
Default timings are dumped from rockchip proprietary loader. Look here:
Quoted 6 lines
Quoted 3 lines
In that case these should go in the device tree like with other Rockchip boards.
[...]It's tpl build. Is device tree supported in tpl?
Well maybe, but you only use TPL if things are really tight, so I wouldn't recommend it.
Quoted 16 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
How similar is this to rk3288? Could we put common code in a separate file?
Not sure how similar is it to rk3288. CRU, GRF, PMU differ a little between
socs.Where did you get the code from? I want to avoid duplicate code and factor out the differences if we can.
It's adjusted code from rk3188 sdram driver.
Quoted 2 lines
Quoted 1 line
Also i needed to add few adjustments to make it build and run with tpl.
Quoted 8 lines
Quoted 4 lines
I am still hoping we can drop TPL.
Regards,
SimonRegards
Paweł
Regards,
Simon
PATCH 13/13 rockchip: rk3066: add sdram init code for tpl
In reply to Paweł JaroszQuoted 11 lines
Add sdram initialisation code which will be ussed by tpl first boot stage. We need to implement sdram initialisation in tpl due to size issues on rk3066 platform.
Signed-off-by Paweł Jarosz <[email protected]>--- arch/arm/include/asm/arch-rockchip/ddr_rk3188.h | 5 + arch/arm/mach-rockchip/rk3066/sdram_init.c | 995 ++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 arch/arm/mach-rockchip/rk3066/sdram_init.c