{"id":819252,"url":"http://patchwork.ozlabs.org/api/patches/819252/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1506533594-9741-4-git-send-email-chakra.divi@openedev.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1506533594-9741-4-git-send-email-chakra.divi@openedev.com>","list_archive_url":null,"date":"2017-09-27T17:33:12","name":"[U-Boot,v2,3/5] rk3288: vyasa: Add TPL support","commit_ref":"532cb7f5ada0cc3779c33606d760ec99f6aa847a","pull_url":null,"state":"accepted","archived":false,"hash":"874b6e3914b2fc8a21db70a0f27ae9492d49877d","submitter":{"id":71741,"url":"http://patchwork.ozlabs.org/api/people/71741/?format=json","name":"Chakra Divi","email":"2chakrass@gmail.com"},"delegate":{"id":69486,"url":"http://patchwork.ozlabs.org/api/users/69486/?format=json","username":"ptomsich","first_name":"Philipp","last_name":"Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1506533594-9741-4-git-send-email-chakra.divi@openedev.com/mbox/","series":[{"id":5413,"url":"http://patchwork.ozlabs.org/api/series/5413/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=5413","date":"2017-09-27T17:33:09","name":"rk3288: Falcon mode support","version":2,"mbox":"http://patchwork.ozlabs.org/series/5413/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/819252/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/819252/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"FbtpGJj1\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2QBL0Qn0z9t5l\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 03:42:17 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid AD684C21DD9; Wed, 27 Sep 2017 17:41:05 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 9EACFC21C51;\n\tWed, 27 Sep 2017 17:40:43 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid C55FCC21CB1; Wed, 27 Sep 2017 17:40:02 +0000 (UTC)","from mail-pg0-f67.google.com (mail-pg0-f67.google.com\n\t[74.125.83.67])\n\tby lists.denx.de (Postfix) with ESMTPS id 07DF8C21D64\n\tfor <u-boot@lists.denx.de>; Wed, 27 Sep 2017 17:39:59 +0000 (UTC)","by mail-pg0-f67.google.com with SMTP id v5so9881272pgn.4\n\tfor <u-boot@lists.denx.de>; Wed, 27 Sep 2017 10:39:58 -0700 (PDT)","from localhost.localdomain ([115.97.184.62])\n\tby smtp.gmail.com with ESMTPSA id\n\tq7sm24609290pgn.56.2017.09.27.10.39.53\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 27 Sep 2017 10:39:56 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=kqMAtRm22VWg9MHZJODLF05oYXUh0M7yL/85FuoDESc=;\n\tb=FbtpGJj1n9QzDXqEuz/cAHODhO5gPDhMtfpgKoPGZokJwOlSgx8i2bZVfplEOt0fV5\n\tjh/aIy96uL3D/pWTszzv4BirCFOcfv0gFOCmXS0Eb9CEhuhboFMvfq76JfaQmjDVPkBD\n\t3t6XyNcI+vsxSgGvNdrZbs1dmkIbWYJ+ZTJrytHu/Ibj2SqrNW2U2GLHoaKCm0KC3Nda\n\tSsQzvzMmZjioz8vprw6zy4U93dh4a2uf8KjlYcGU0rOPU7tZjJxu4oendW/5LBP12co4\n\tNU5kdYYxKTxyuLzKuNd9OFhX8KGbrgRskSQJXtwDKSEj2D4ItvmIYdiC/84CFkmhQmQG\n\tK4jA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=kqMAtRm22VWg9MHZJODLF05oYXUh0M7yL/85FuoDESc=;\n\tb=jQUec63qKNE+rp40DiU5dUpa/jkBNZDOq5udBlfGFN4J/iEHDhPXO7lhr5Nus17O/4\n\tLchaujLw+Wooi/B5KpjhHJ/qxn+0WnIkbyGMINfpOaKJFsHDn6olIM3YuEQrgvlUMUXl\n\tRVokV9yC7lOzWgKn41/QukLQqqgDJY50J8EWM32uP15C2jvP9ss5tM7g2RuNpc5W7x0A\n\tjMgeZgHhq51OPaw+RnM+4IYcJvUE8s1TY5cUQ00z4+IVEYrM7oH9rPf8lijKmvGynTHR\n\tQZbxlopaMH3096ZUFn7hYPynGInqQWVy/zlTDa6jRB8TP3FTElAHpeN07aN0DJmglYcQ\n\tbDEw==","X-Gm-Message-State":"AHPjjUh/Zvze0QHi/n3Exc6U1XEReiFUcTKlAZ5DxsPmIunQXGLuo42B\n\tjPcZ3L6UFVtlfquMCEQvzMs=","X-Google-Smtp-Source":"AOwi7QDnoutw0gXRPrhWFaJl74aEqN77Ij3H3Mk1JG9qSCdou6hANZTAMe2jF2ghxtxeD9CaQQWOjg==","X-Received":"by 10.84.133.66 with SMTP id 60mr1885221plf.386.1506533997649;\n\tWed, 27 Sep 2017 10:39:57 -0700 (PDT)","From":"Chakra Divi <2chakrass@gmail.com>","X-Google-Original-From":"Chakra Divi <chakra.divi@openedev.com>","To":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","Date":"Wed, 27 Sep 2017 23:03:12 +0530","Message-Id":"<1506533594-9741-4-git-send-email-chakra.divi@openedev.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1506533594-9741-1-git-send-email-chakra.divi@openedev.com>","References":"<1506533594-9741-1-git-send-email-chakra.divi@openedev.com>","Cc":"u-boot@lists.denx.de","Subject":"[U-Boot] [PATCH v2 3/5] rk3288: vyasa: Add TPL support","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"From: Jagan Teki <jagan@amarulasolutions.com>\n\nSince the size of SPL can't be exceeded 0x8000 bytes in RK3288,\nit is not possible add new SPL features like Falcon mode or etc.\n\nSo add TPL stage so-that adding new features to SPL is possible.\n- TPL: DRAM init, clocks\n- SPL: MMC, falcon, etc\n\nSigned-off-by: Jagan Teki <jagan@amarulasolutions.com>\nReviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n---\nChanges for v2:\n- Drop console output from commit message\n- Updated licence note\n- Moved read/write L2CTRL and configure_l2ctlr to common\n- Moved debug header in include files list\n- Moved preprocessor macro to top\nNote:\nIdea is not to build this in SPL when TPL enabled,\nso CONFIG_SUPPORT_TPL work that case.\n\n arch/arm/mach-rockchip/Makefile           |  1 +\n arch/arm/mach-rockchip/rk3288-board-spl.c |  3 ++\n arch/arm/mach-rockchip/rk3288-board-tpl.c | 84 +++++++++++++++++++++++++++++++\n arch/arm/mach-rockchip/rk3288/Kconfig     | 16 ++++++\n configs/vyasa-rk3288_defconfig            |  3 ++\n doc/README.rockchip                       | 18 +++++++\n include/configs/rk3288_common.h           |  6 ++-\n 7 files changed, 130 insertions(+), 1 deletion(-)\n create mode 100644 arch/arm/mach-rockchip/rk3288-board-tpl.c","diff":"diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile\nindex 79e9704..daafc8d 100644\n--- a/arch/arm/mach-rockchip/Makefile\n+++ b/arch/arm/mach-rockchip/Makefile\n@@ -12,6 +12,7 @@ obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o\n obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o\n \n obj-tpl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o\n+obj-tpl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-tpl.o\n obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o\n \n obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o\ndiff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c\nindex 23af653..5239cbc 100644\n--- a/arch/arm/mach-rockchip/rk3288-board-spl.c\n+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c\n@@ -204,12 +204,15 @@ void board_init_f(ulong dummy)\n \t}\n #endif\n \n+#if !defined(CONFIG_SUPPORT_TPL)\n \tdebug(\"\\nspl:init dram\\n\");\n \tret = uclass_get_device(UCLASS_RAM, 0, &dev);\n \tif (ret) {\n \t\tdebug(\"DRAM init failed: %d\\n\", ret);\n \t\treturn;\n \t}\n+#endif\n+\n #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) && !defined(CONFIG_SPL_BOARD_INIT)\n \tback_to_bootrom();\n #endif\ndiff --git a/arch/arm/mach-rockchip/rk3288-board-tpl.c b/arch/arm/mach-rockchip/rk3288-board-tpl.c\nnew file mode 100644\nindex 0000000..3d08b5b\n--- /dev/null\n+++ b/arch/arm/mach-rockchip/rk3288-board-tpl.c\n@@ -0,0 +1,84 @@\n+/*\n+ * Copyright (C) 2017 Amarula Solutions\n+ *\n+ * SPDX-License-Identifier:     GPL-2.0+\n+ */\n+\n+#include <common.h>\n+#include <debug_uart.h>\n+#include <dm.h>\n+#include <ram.h>\n+#include <spl.h>\n+#include <version.h>\n+#include <asm/io.h>\n+#include <asm/arch/bootrom.h>\n+#include <asm/arch/clock.h>\n+#include <asm/arch/grf_rk3288.h>\n+#include <asm/arch/periph.h>\n+#include <asm/arch/pmu_rk3288.h>\n+#include <asm/arch/sys_proto.h>\n+#include <asm/arch/timer.h>\n+\n+DECLARE_GLOBAL_DATA_PTR;\n+\n+#define GRF_BASE\t\t0xff770000\n+void board_init_f(ulong dummy)\n+{\n+\tstruct udevice *dev;\n+\tint ret;\n+\n+\t/* Example code showing how to enable the debug UART on RK3288 */\n+\t/* Enable early UART on the RK3288 */\n+\tstruct rk3288_grf * const grf = (void *)GRF_BASE;\n+\n+\trk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |\n+\t\t     GPIO7C6_MASK << GPIO7C6_SHIFT,\n+\t\t     GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |\n+\t\t     GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);\n+\t/*\n+\t * Debug UART can be used from here if required:\n+\t *\n+\t * debug_uart_init();\n+\t * printch('a');\n+\t * printhex8(0x1234);\n+\t * printascii(\"string\");\n+\t */\n+\tdebug_uart_init();\n+\n+\tret = spl_early_init();\n+\tif (ret) {\n+\t\tdebug(\"spl_early_init() failed: %d\\n\", ret);\n+\t\thang();\n+\t}\n+\n+\trockchip_timer_init();\n+\tconfigure_l2ctlr();\n+\n+\tret = rockchip_get_clk(&dev);\n+\tif (ret) {\n+\t\tdebug(\"CLK init failed: %d\\n\", ret);\n+\t\treturn;\n+\t}\n+\n+\tret = uclass_get_device(UCLASS_RAM, 0, &dev);\n+\tif (ret) {\n+\t\tdebug(\"DRAM init failed: %d\\n\", ret);\n+\t\treturn;\n+\t}\n+}\n+\n+void board_return_to_bootrom(void)\n+{\n+\tback_to_bootrom();\n+}\n+\n+u32 spl_boot_device(void)\n+{\n+\treturn BOOT_DEVICE_BOOTROM;\n+}\n+\n+void spl_board_init(void)\n+{\n+\tputs(\"\\nU-Boot TPL \" PLAIN_VERSION \" (\" U_BOOT_DATE \" - \" \\\n+\t\t\t\tU_BOOT_TIME \")\\n\");\n+}\ndiff --git a/arch/arm/mach-rockchip/rk3288/Kconfig b/arch/arm/mach-rockchip/rk3288/Kconfig\nindex 4ad2940..6beb26f 100644\n--- a/arch/arm/mach-rockchip/rk3288/Kconfig\n+++ b/arch/arm/mach-rockchip/rk3288/Kconfig\n@@ -87,6 +87,22 @@ config TARGET_POPMETAL_RK3288\n config TARGET_VYASA_RK3288\n \tbool \"Vyasa-RK3288\"\n \tselect BOARD_LATE_INIT\n+\tselect TPL\n+\tselect SUPPORT_TPL\n+\tselect TPL_DM\n+\tselect TPL_REGMAP\n+\tselect TPL_SYSCON\n+\tselect TPL_CLK\n+\tselect TPL_RAM\n+\tselect TPL_OF_PLATDATA\n+\tselect TPL_OF_CONTROL\n+\tselect TPL_BOOTROM_SUPPORT\n+\tselect TPL_NEEDS_SEPARATE_TEXT_BASE if SPL\n+\tselect ROCKCHIP_BROM_HELPER\n+\tselect TPL_DRIVERS_MISC_SUPPORT\n+\tselect TPL_LIBCOMMON_SUPPORT\n+\tselect TPL_LIBGENERIC_SUPPORT\n+\tselect TPL_SERIAL_SUPPORT\n \thelp\n \t  Vyasa is a RK3288-based development board with 2 USB ports,\n \t  HDMI, VGA, micro-SD card, audio, WiFi  and Gigabit Ethernet, It\ndiff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig\nindex 7db7b0b..7bd6068 100644\n--- a/configs/vyasa-rk3288_defconfig\n+++ b/configs/vyasa-rk3288_defconfig\n@@ -1,8 +1,11 @@\n CONFIG_ARM=y\n+# CONFIG_SPL_USE_ARCH_MEMCPY is not set\n+# CONFIG_SPL_USE_ARCH_MEMSET is not set\n CONFIG_ARCH_ROCKCHIP=y\n CONFIG_SYS_MALLOC_F_LEN=0x2000\n CONFIG_ROCKCHIP_RK3288=y\n CONFIG_TARGET_VYASA_RK3288=y\n+CONFIG_TPL_TEXT_BASE=0xff704004\n CONFIG_SPL_STACK_R_ADDR=0x80000\n CONFIG_DEFAULT_DEVICE_TREE=\"rk3288-vyasa\"\n CONFIG_DEBUG_UART=y\ndiff --git a/doc/README.rockchip b/doc/README.rockchip\nindex 12fec38..4b7be0b 100644\n--- a/doc/README.rockchip\n+++ b/doc/README.rockchip\n@@ -150,6 +150,24 @@ Note: rk3036 SDMMC and debug uart use the same iomux, so if you boot from SD, th\n       debug uart must be disabled\n \n \n+Booting from an SD card on RK3288 with TPL\n+==========================================\n+\n+Since the size of SPL can't be exceeded 0x8000 bytes in RK3288, it is not possible add\n+new SPL features like Falcon mode or etc.\n+\n+So introduce TPL so-that adding new features to SPL is possible because now TPL should\n+run minimal with code like DDR, clock etc and rest of new features in SPL.\n+\n+As of now TPL is added on Vyasa-RK3288 board.\n+\n+To write an image that boots from an SD card (assumed to be /dev/mmcblk0):\n+\n+   ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out &&\n+    cat ./spl/u-boot-spl-dtb.bin >> out &&\n+    sudo dd if=out of=/dev/mmcblk0 seek=64 &&\n+    sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=256\n+\n Booting from an SD card on RK3188\n =================================\n \ndiff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h\nindex e9e3c40..34f2558 100644\n--- a/include/configs/rk3288_common.h\n+++ b/include/configs/rk3288_common.h\n@@ -32,7 +32,11 @@\n #define CONFIG_SYS_INIT_SP_ADDR\t\t0x00100000\n #define CONFIG_SYS_LOAD_ADDR\t\t0x00800800\n #define CONFIG_SPL_STACK\t\t0xff718000\n-#define CONFIG_SPL_TEXT_BASE\t\t0xff704004\n+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT)\n+# define CONFIG_SPL_TEXT_BASE\t\t0x0\n+#else\n+# define CONFIG_SPL_TEXT_BASE\t\t0xff704004\n+#endif\n \n /* MMC/SD IP block */\n #define CONFIG_BOUNCE_BUFFER\n","prefixes":["U-Boot","v2","3/5"]}