From patchwork Mon Apr 11 01:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 1615487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MxJAqKQq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KcBBB17Qjz9sBy for ; Mon, 11 Apr 2022 11:30:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1A67083DEE; Mon, 11 Apr 2022 03:30:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MxJAqKQq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6287783B1B; Mon, 11 Apr 2022 03:29:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55A9383B24 for ; Mon, 11 Apr 2022 03:29:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ed1-x534.google.com with SMTP id t25so3851439edt.9 for ; Sun, 10 Apr 2022 18:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OuSfy4b/cUwoXZo/6szOHEJErjcxqlhi6tWws1ZWcA4=; b=MxJAqKQqdCS/Jp0Gsd1nLHjpHBVAp5HwZIprICN8EknuyhVJro0zbmpy0iFX0RwSWx AC92F+rfAgm2DrvtFNK3myNgLqrOVI+9+rGY1642sNlo/KUnMyByIrkfE23RbcZFPDVP bNmJxKkPcn/FBruaOlP6y+kgDLRskORVxQiB1cliQf669ExxtxNXitPeVqfE4kaAwCek k47Ljq063s1tPq8BhQhuhni6y5Sr83K9sUlhbzKDBWw1DDTo4WG/9OUVIUtTV5hbMOrB A+aCY++7LREI97pYTsgzgIkFcBreZKY7Z5X9L4N9Dga7NyPqde6C+WjmzG92MGR8zHp/ fa9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OuSfy4b/cUwoXZo/6szOHEJErjcxqlhi6tWws1ZWcA4=; b=TzEy0Q71n5CBSF9J0aA8nqZG4Sbv9wzzsFn4C22hWtyOJCsCtoY13PXnKduyP3kgoh VmEZB7zkVOyuEoTVVTlrb81fQnpR/D9qwpxFofW895DnG9QHDlgj2IjqpT9+ogUDGitp 45vRoa/NL/S+ziGgYZoAOijkOUxK2AsbHL1x7HDeLnsKk9mRQtExiD5uZsIPuVT7LXcO C8mNTQ0OKMrqknqgYXF/+wX6zOOFq7+N3LiWX3yhMnaTG2gnNM0e1COB++Oclj1/BsUE PYTF9wTKgMwcgR4UKFZ/RhMiyluXaThO+3vQGio0Y8D81DK1EZkUMOoUqnYnz4iNU5R+ /RLg== X-Gm-Message-State: AOAM530YAExIfaxWIodYn10MblFS234dvjykLgv1e/t+XqOsYDqZuGR9 X5Qr3IlsuXWyTzoydYUHLtk= X-Google-Smtp-Source: ABdhPJzHYoC/kwbu9RKWv6IwUsyTT2uSgXptJavigaH/4Z1Rb7D/rR8hLQSjdJWA8YOsgf4r1nKZNA== X-Received: by 2002:a05:6402:35c7:b0:41d:1a10:4760 with SMTP id z7-20020a05640235c700b0041d1a104760mr15945481edc.28.1649640594794; Sun, 10 Apr 2022 18:29:54 -0700 (PDT) Received: from debian.home (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id a22-20020a50ff16000000b00410d029ea5csm14121333edu.96.2022.04.10.18.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 18:29:54 -0700 (PDT) From: Johan Jonker To: kever.yang@rock-chips.com Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, lukma@denx.de, seanga2@gmail.com, u-boot@lists.denx.de Subject: [PATCH v10 00/16] Add Rikomagic MK808 board Date: Mon, 11 Apr 2022 03:29:30 +0200 Message-Id: <20220411012946.14099-1-jbx6244@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean MK808 is a RK3066-based board with 1 USB host and 1 USB OTG port, HDMI and a micro-SD card slot. It also includes on-board NAND and 1GB of SDRAM. Changed V10: add u-boot,spl-fifo-mode property combine patches core support restyle doc rockchip.rst add more px30 doc info add more rk3066 doc info Changed V9: fix TABs and spaces add led config enable led gpio change pinctrl regmap source disable STIMER move include Changed V8: update clock driver update grf header file Changed V7: add board files enable boot from SD card restyle pinctrl driver restyle sdram driver === Boot procedure flow for a Rockchip rk3066 SoC: 1.Read 2K SDRAM initialization image code to internal SRAM 2.Run image code to do SDRAM initialization 3.Transfer boot image code to SDRAM 4.Run boot image code Supported system boot from the following devices: Nand Flash SPI nor Flash eMMC device UART interface If all boot options fail then enter into BootROM mode on the USB OTG port. Unlike later SoC models the rk3066 BootROM doesn't have SDMMC support. The size of a full U-boot binary is too large for the internal SDRAM memory. Of that 64k size only 32kb sram - 2kb bootrom is available for the first stage. Similar to the already supported rk3188, the BootROM will attempt to load up the first stage image in two steps: first 1KB to offset 0x800 in the SRAM and then the remainder to offset 0xc00 in the SRAM. It always enters at offset 0x804 after a 4 ASCII character "RK30" header. With CONFIG_TPL_ROCKCHIP_EARLYRETURN_TO_BROM=y this first stage is combined with the U-boot TPL binary (u-boot-tpl.bin). For rk3066 with NAND flash and U-boot this gives the following stages: - TPL: init external SDRAM - SPL: init SDMMC and read U-boot from SD CARD. - U-boot: read Linux kernel from SD CARD. - Kernel Additionally the rk3066 requires everything the BootROM loads to be RC4-encrypted. === Boot solution with full U-boot stored on SD CARD: Compile commands(U-boot): ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make mk808_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make menuconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make all === Size of SPL and TPL must be aligned to 2kb. If bricked and no BootROM mode shows up then connect pin 8 and 9 of the NAND flash with a needle while reconnecting to the USB OTG port to a PC. === Show connected devices with: lsusb Bus 001 Device 004: ID 2207:300a Fuzhou Rockchip Electronics Company RK3066 in Mask ROM mode === Program commands with ./flash.sh: #!/bin/sh printf "RK30" > tplspl.bin dd if=u-boot-tpl.bin >> tplspl.bin truncate -s %2048 tplspl.bin truncate -s %2048 u-boot-spl.bin ../tools/boot_merger --verbose config-flash.ini ../tools/upgrade_tool ul ./RK30xxLoader_uboot.bin === config-flash.ini: [CHIP_NAME] NAME=RK30 [VERSION] MAJOR=2 MINOR=21 [CODE471_OPTION] NUM=1 Path1=30_LPDDR2_300MHz_DD.bin [CODE472_OPTION] NUM=1 Path1=rk30usbplug.bin [LOADER_OPTION] NUM=2 LOADER1=FlashData LOADER2=FlashBoot FlashData=tplspl.bin FlashBoot=u-boot-spl.bin [OUTPUT] PATH=RK30xxLoader_uboot.bin === Partition Map for MMC device 0 -- Partition Type: EFI Part Start LBA End LBA Name Attributes Type GUID Partition GUID 1 0x00000040 0x00001f7f "loader1" 2 0x00004000 0x00005fff "loader2" 3 0x00006000 0x00007fff "trust" 4 0x00008000 0x0003ffff "boot" 5 0x00040000 0x00ed7fde "rootfs" Make sure boot and esp flag are set for boot partition. Loader1 partition is not used by RK3066. === Boot partition: extlinux -- extlinux.conf zImage rk3066a-mk808.dtb === extlinux.conf: label kernel kernel /zImage fdt /rk3066a-mk808.dtb append root=LABEL=linuxroot init=/sbin/init rootfstype=ext4 rootwait === Program commands (SD CARD with GPT partition): sudo dd if=u-boot-dtb.img of=/dev/sda seek=16384 === TODO: Better program flow/tools USB NAND etc etc === Johan Jonker (12): rockchip: rk3066-power: sync power domain dt-binding header from Linux arm: dts: rockchip: fix rk3xxx-u-boot.dtsi arm: dts: rockchip: fix include rk3xxx-u-boot.dtsi arm: dts: rockchip: add rk3066a.dtsi arm: dts: rockchip: add rk3066a-mk808.dts rockchip: tools: add rk3066 support to rkcommon.c rockchip: rk3066: add core support rockchip: rk3066: add Rikomagic MK808 board rockchip: rk3066: add mk808_defconfig doc: rockchip: restyle rockchip.rst doc: rockchip: add px30/rk3326 boards and examples doc: rockchip: add rk3066 Rikomagic MK808 Paweł Jarosz (4): rockchip: rk3066: add grf header file rockchip: rk3066: add clock driver for rk3066 soc rockchip: rk3066: add rk3066 pinctrl driver rockchip: rk3066: add sdram driver arch/arm/dts/Makefile | 3 + arch/arm/dts/rk3066a-mk808-u-boot.dtsi | 49 + arch/arm/dts/rk3066a-mk808.dts | 216 +++++ arch/arm/dts/rk3066a-u-boot.dtsi | 4 + arch/arm/dts/rk3066a.dtsi | 879 +++++++++++++++++ arch/arm/dts/rk3188-u-boot.dtsi | 1 + arch/arm/dts/rk3188.dtsi | 1 - arch/arm/dts/rk3xxx-u-boot.dtsi | 8 +- arch/arm/include/asm/arch-rk3066/boot0.h | 8 + arch/arm/include/asm/arch-rk3066/gpio.h | 8 + arch/arm/include/asm/arch-rk3066/timer.h | 6 + .../include/asm/arch-rockchip/cru_rk3066.h | 157 +++ .../include/asm/arch-rockchip/grf_rk3066.h | 210 +++++ arch/arm/mach-rockchip/Kconfig | 23 + arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/rk3066/Kconfig | 39 + arch/arm/mach-rockchip/rk3066/Makefile | 5 + arch/arm/mach-rockchip/rk3066/clk_rk3066.c | 33 + arch/arm/mach-rockchip/rk3066/rk3066.c | 49 + arch/arm/mach-rockchip/rk3066/syscon_rk3066.c | 55 ++ board/rikomagic/mk808/Kconfig | 15 + board/rikomagic/mk808/MAINTAINERS | 6 + board/rikomagic/mk808/Makefile | 3 + board/rikomagic/mk808/mk808.c | 3 + configs/mk808_defconfig | 100 ++ doc/board/rockchip/rockchip.rst | 263 +++++- drivers/clk/rockchip/Makefile | 1 + drivers/clk/rockchip/clk_rk3066.c | 717 ++++++++++++++ drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3066.c | 112 +++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_rk3066.c | 892 ++++++++++++++++++ include/configs/mk808.h | 9 + include/configs/rk3066_common.h | 56 ++ include/dt-bindings/power/rk3066-power.h | 22 + tools/rkcommon.c | 1 + 36 files changed, 3903 insertions(+), 54 deletions(-) create mode 100644 arch/arm/dts/rk3066a-mk808-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a-mk808.dts create mode 100644 arch/arm/dts/rk3066a-u-boot.dtsi create mode 100644 arch/arm/dts/rk3066a.dtsi create mode 100644 arch/arm/include/asm/arch-rk3066/boot0.h create mode 100644 arch/arm/include/asm/arch-rk3066/gpio.h create mode 100644 arch/arm/include/asm/arch-rk3066/timer.h create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3066.h create mode 100644 arch/arm/include/asm/arch-rockchip/grf_rk3066.h create mode 100644 arch/arm/mach-rockchip/rk3066/Kconfig create mode 100644 arch/arm/mach-rockchip/rk3066/Makefile create mode 100644 arch/arm/mach-rockchip/rk3066/clk_rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/rk3066.c create mode 100644 arch/arm/mach-rockchip/rk3066/syscon_rk3066.c create mode 100644 board/rikomagic/mk808/Kconfig create mode 100644 board/rikomagic/mk808/MAINTAINERS create mode 100644 board/rikomagic/mk808/Makefile create mode 100644 board/rikomagic/mk808/mk808.c create mode 100644 configs/mk808_defconfig create mode 100644 drivers/clk/rockchip/clk_rk3066.c create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3066.c create mode 100644 drivers/ram/rockchip/sdram_rk3066.c create mode 100644 include/configs/mk808.h create mode 100644 include/configs/rk3066_common.h create mode 100644 include/dt-bindings/power/rk3066-power.h