From patchwork Tue Jul 14 09:32:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1487 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0460E3F1BD for ; Tue, 14 Jul 2020 11:33:18 +0200 (CEST) Received: by mail-pl1-f198.google.com with SMTP id a8sf8994337plm.7 for ; Tue, 14 Jul 2020 02:33:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594719196; cv=pass; d=google.com; s=arc-20160816; b=NiHHzTAqESXbhQPmQRbJEShgsRDNNS32jkR4GWt2tK10uMMF5P7vI7zuoOtIm+1OG1 Swo0HhaI1/bmUJNLW1PXtMu1ZgPptMajpzJHctSeBZyGwIajojHLVC9sOP5S7HqjMdbf sPhqYAAlnHPAl+668UH4xiaX4/PPWbeHi83LUSTe6K7wFgmaGdqKUQjjoIMVu+Dykku5 sVfXINfmUjfCeKKSEj7l5jLZYwCn1O7LIIvTIJfiYGJPpgO13f4abb3l+/TXWpci94K3 3ZSiDawLEtjvUuREzs9dbrjx+PtJX1V5unntjHQh3EWALqehanYuGoQ+MJs6crw8x4l+ x7zw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jfvMO1G0MHggkU0+djPZ9e5HNR/jnl1ExxOSSleTdaI=; b=rMUEPXqUum1xq0JoA3+jLgm5zxwhHWHn6xNnn+rso7KlNE29TTx7mdvkSJKT26AjGz o/NCJqqoDL3NKBsrxp/oOFqRxwzvuIaXu7PoUgL+ckAvZMGy0/YfjVG/M8O7NGzHG1VC F2yW4ZeiVH8Z/nyNtJbD2Ic5TGdbWHSks5S81H/ELEF8E5iFY182a2zeNCNET/zAngn8 cR7+A1U1s7jlQTav5uHDyvDMkp+7YsTpXwEfPJKnJoP244et22ao/MqFnuzvHizSu5/7 VVEapKrF8vgKjW3GB4vNw+IbRs/jfrzfsJMSi4fwcSv7DDMRpW8r2uMJ7hxMJyT3uP6G XXqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fq+qKjjz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=jfvMO1G0MHggkU0+djPZ9e5HNR/jnl1ExxOSSleTdaI=; b=rkTZMqGN7DV0MX8tGmpRnQRocwE7Wouludqi8YeEksN3PadoVFgJaO+y43DdktjXWl G+ojgIVDeorM++vuUeqdO34YTKrApQrHXUIcVB+DVggl895doJRF/FmRu/KiGzMHgHmU KtOQWHx59Cy7+0pNsRiKW9iOmPmQZruMvU9mg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=jfvMO1G0MHggkU0+djPZ9e5HNR/jnl1ExxOSSleTdaI=; b=OW0Fzzd0Zt9j7vloALXkjDNEwMPshIyMT419BtStLoqs3H7kyQapCgSmsGsSfAG/C2 /lzNw8Eu2fzS7GwcS6gbNlaXAF0TI3CxLIoOOKCcQJy+EBhdk0F5QwQD2m8dDTWZvndc GYOh1CytILcrd/LaLiRF1+h0KzSGWN76U1grmS0Cv+LExMp6vPrbuNsJPYjhfDlzTMhr 3Xg1EjG2lOOEh1v4J6KScO5oznbHvtjGSH02RtrIkwp0iCrBm3l3zsJ1TXux1Rtbcxd2 v48Puni4LBHNKHNWQZIgWYNzdPKUuG9SJ/90uLEKnkubgo8NYQYYagqJ+MeXMaYGeyaW ef7A== X-Gm-Message-State: AOAM532c+bKVQfB28A/97Q8CjC+pzvJjrK/bY1sUzYevH5KAIT5B5nwO +FKSM8bZ0ZryEwo6dCvGRAP5+N+P X-Google-Smtp-Source: ABdhPJwuL9WtuUT8S8+Kj7cL5hDao+NbfnzLf/1mngSo66ogrFBEtvv3vgJKwooLnn9GRulxUgIsDA== X-Received: by 2002:a65:63ca:: with SMTP id n10mr2812762pgv.252.1594719196254; Tue, 14 Jul 2020 02:33:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:b602:: with SMTP id b2ls7804758pls.3.gmail; Tue, 14 Jul 2020 02:33:16 -0700 (PDT) X-Received: by 2002:a17:90a:8c01:: with SMTP id a1mr3507539pjo.97.1594719195843; Tue, 14 Jul 2020 02:33:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594719195; cv=none; d=google.com; s=arc-20160816; b=PGDzMz07m2ArDoAmBzgKIh4ddTkl4+FHjAss14NxP2RS+dGyMObF9edII/1fjjxfna XTKgSKW07MiD6niAnZPWIJySxYCVs7HeWsX3prwW73RwAIGWvSxG+k/j7uPkiSHzx7Nf M7W90RNKRvUWzuV6VzMARWcf3FF3LaM5e7LPZ2TRCuO0mkPwRXdRIXPmNSljJNcNAAci K2z6prrQI6lRRtYZAjpi2HqclAs/wETPcvwuyR1SOhCJ+N55NhhJI3h6RGSjgE77x3KM pHM+ZeanNm5s2G6H7gA37Hf16BoPuwddnrltBJolOwK9mqIEPl00JJEBTWNQfUuzalyS 5/aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kwTRhpuTxc9sDdo38EGgjW1TMyLLnsJC2wQxEispCl0=; b=anj0kAkC4GmcwJZLyScpXpOyrfQ5yE1/3K4qfC6HHhKlt01N/vnbufKICeycDeddBn Nahl1inB7rdplLLFozDeNApKR4nXi2cQyDhRWzWRZen8MbKQysTXablzIH8+MNDoCU0f uA+K87AcBsBkLtk80syqqwR/ymYdAg7ckHokfObOAwTMHmH6pC0PR7eu07NEu/ikXQVj jGICHRUtMXjwtrDMt9nRSY2ZVIUBs+yhAIbA1evuJuXyBv4IZ1Wl4rgD+yGadVMSSVtO D61S/XC9zNXnjbH3X1pDJWYApxgxtJpn0ndN9shkP+V63aP836xUe/fpM4FL3ggSxNVb qC1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fq+qKjjz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a126sor20224870pgc.17.2020.07.14.02.33.15 for (Google Transport Security); Tue, 14 Jul 2020 02:33:15 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:4e51:: with SMTP id o17mr2848616pgl.315.1594719195308; Tue, 14 Jul 2020 02:33:15 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:659e:b3d0:e662:3980]) by smtp.gmail.com with ESMTPSA id g6sm16924771pfr.129.2020.07.14.02.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 02:33:14 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: Suniel Mahesh , U-Boot-Denx , linux-rockchip@lists.infradead.org, linux-amarula , Jagan Teki Subject: [PATCH v5 1/5] roc-rk3399-pc: Move leds setup in SPL Date: Tue, 14 Jul 2020 15:02:25 +0530 Message-Id: <20200714093229.28763-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200714093229.28763-1-jagan@amarulasolutions.com> References: <20200714093229.28763-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Fq+qKjjz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , roc-rk3399-pc has some specific requirements to support LEDS, environment. board detection and etc prior to U-Boot proper. So as of now SPL would be a better stage for these custom board requirements to support unlike TPL. Adding few of these custom requirements like LEDS in TPL would require extra code pulling and also the size of TPL can grow. So, this patch moves the leds code from TPL into SPL after relocation. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- Changes for v5 - drop tpl.c file - update the code in board file arch/arm/mach-rockchip/tpl.c | 7 ---- board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 36 +++++++++++---------- configs/roc-pc-mezzanine-rk3399_defconfig | 2 +- configs/roc-pc-rk3399_defconfig | 2 +- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index 88f80b05a9..cc908e1b0e 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -43,18 +43,11 @@ __weak void rockchip_stimer_init(void) TIMER_CONTROL_REG); } -__weak int board_early_init_f(void) -{ - return 0; -} - void board_init_f(ulong dummy) { struct udevice *dev; int ret; - board_early_init_f(); - #if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL_SUPPORT) /* * Debug UART can be used from here if required: diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c index 7c3a803654..4db3dd739c 100644 --- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c @@ -6,14 +6,24 @@ #include #include #include -#include -#include #include -#include +#include + #include -#ifndef CONFIG_SPL_BUILD -int board_early_init_f(void) +#define GPIO0_BASE 0xff720000 + +static int led_setup(void) +{ + struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; + + /* Turn on red LED, indicating full power mode */ + spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); + + return 0; +} + +static int roc_pc_early_init_f(void) { struct udevice *regulator; int ret; @@ -30,19 +40,11 @@ int board_early_init_f(void) out: return 0; } -#endif - -#if defined(CONFIG_TPL_BUILD) - -#define GPIO0_BASE 0xff720000 int board_early_init_f(void) { - struct rockchip_gpio_regs * const gpio0 = (void *)GPIO0_BASE; - - /* Turn on red LED, indicating full power mode */ - spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1); - - return 0; + if (IS_ENABLED(CONFIG_SPL_BUILD)) + return led_setup(); + else + return roc_pc_early_init_f(); } -#endif diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig index c87a8568fc..15d511741f 100644 --- a/configs/roc-pc-mezzanine-rk3399_defconfig +++ b/configs/roc-pc-mezzanine-rk3399_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00200000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_ENV_SIZE=0x8000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_ENV_SECT_SIZE=0x1000 @@ -21,7 +22,6 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y -CONFIG_TPL_GPIO_SUPPORT=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig index 601f5c6ae1..2a6d0d22c8 100644 --- a/configs/roc-pc-rk3399_defconfig +++ b/configs/roc-pc-rk3399_defconfig @@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y CONFIG_SYS_TEXT_BASE=0x00200000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_ENV_SIZE=0x8000 CONFIG_ENV_OFFSET=0x3F8000 CONFIG_ENV_SECT_SIZE=0x1000 @@ -21,7 +22,6 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y CONFIG_TPL=y -CONFIG_TPL_GPIO_SUPPORT=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y