From patchwork Mon Jun 8 18:31:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1348 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E29223F06D for ; Mon, 8 Jun 2020 20:32:11 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id o1sf12782023plk.22 for ; Mon, 08 Jun 2020 11:32:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1591641130; cv=pass; d=google.com; s=arc-20160816; b=lJOD+ql7QQC+VU9eBnW/e6rUOeolRasHE9nldJog1FE7ORxQBflrrDI5ETcryTC/lT uKTVKQc9LtU9/zK+qZ4jYAX+Z/OXrEVGzNUTmCpXFnXWdeLcknXec7Nb1gCB8TSC4rr4 GaIat9TubnkIz5l0Vd8cDJRqOOAG3L/dMQeBzPoChIsRMwQGfO2kXCNF2Evwk68D6gob WTnon4yDtjbsYksb4CNMr0x4+bPIu3GQo882QX9SU36SWwdEVLO0E+at8Ay/3ZIsRDfy Xv0C3BP14/eB1Cw+bHsBFewyLWFetTgooGZn93n0kfaWaEs5B193yuN/0X/nDpNpIZ63 SapA== 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=asr8QNnZbCqfOT5Cm7bBxE91kQIgA9m61DVvGCz7SYk=; b=plNA2JXLoPRHPOKedDRYS+ubRgN2MsbXSSkEtHh/AFLMSAIGZKtNHGsvsOz/TmTVNI CtWWiheuF4YI0PVdKnNM89LZowehaClRlt17EWxHwS+PWIBewp1XJWvyGigXk9ohfAjG +AVsRRx6DO4qmP5pUcCjgwF3NZD5VNR7If6x0rM6ASJjWPrjMPCdx70qv1flScjkYifL +HQ0DEbpznUAfduQtzFPBUaxMSfzLJ4JiPyb4BpfxWhhFwg0LlgTyMBr/lKS83Hb1ird +joMfG9GARoBgFKZbkrm6c3CoyIdpWIzbGnrqQs452zRt+ZKdOmvP9/9AJP9E9aUJjei RtoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XzaGTtGK; 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=asr8QNnZbCqfOT5Cm7bBxE91kQIgA9m61DVvGCz7SYk=; b=hSACEukdU0XHWBfoO3jGY0dHTv9Uqyiik+WhYQi/pJNi55rXkGYln7bUSnKJ8YB0nB tPeD17+gjoNvRjP5WVdPUJOgy/V3tWSvkQc3jIDAG9TdbvQ81J3L6UKRfgDhjCgIBUl4 fDp7AWgmNYs19/9LAoN4WgWH4SXXyskXKzXfE= 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=asr8QNnZbCqfOT5Cm7bBxE91kQIgA9m61DVvGCz7SYk=; b=EfeKwfnJrK6OeKPBn1mFrJi+94lMUQv2/kSM+Lowtlh1hEba6x4sIOY6KyZKpXvR5c rzKSMnRH2e9KLvF67xaLIQOGSi/arnhlEZzBd11tEQ63UgAV8Id6rxU3/dIJ8VCQL8c4 x8ejKIBeqwSw7tT8zFovWLoCX3RoP0wUTXrEBDjncpGh5PlFq2IfLJl3lWoo9//laCrs DJB9CvPFUyKCYVN/Bmo7Q/zIsx0U1Em69ljWBnxiDxNSzNNW5QbS994zwkiAcRMAP59B GnygqRYNkOAf4et9dBKf5suK6H65yxxAZL/o3ReuRVo9McuW9+6ei9hGroS9BFplP2mF cEqg== X-Gm-Message-State: AOAM533ojvFPn4BNHO+FBYSmv3818sP0/58uwGWTbQXhcd+4Ev/pEb2d JEtoNjot0Ad6CoOYF9exRbzJKFN2 X-Google-Smtp-Source: ABdhPJx1a1SMHA1SUU0sM2ReO02NHMiBlGz3LQY+navJbZI96KXJgDKCiUcZV8rsl8j3+/ultEHxXQ== X-Received: by 2002:a17:902:7281:: with SMTP id d1mr139036pll.78.1591641130612; Mon, 08 Jun 2020 11:32:10 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:3322:: with SMTP id m31ls144118pjb.3.canary-gmail; Mon, 08 Jun 2020 11:32:10 -0700 (PDT) X-Received: by 2002:a17:90a:fe88:: with SMTP id co8mr567448pjb.209.1591641130090; Mon, 08 Jun 2020 11:32:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591641130; cv=none; d=google.com; s=arc-20160816; b=JL1PSBB7DH6ot6ppLT3XX13fIc2RvTBXd8vPb/don0J33ev5/YGzsNaqcDzTrlTWvk Qifr6NmXMUg6GY/TFA2Zaw6kDHl5zs7CDjogZC9iIc8C/uiQPB++o5iNTASert3o80Z+ QACvPsHSy+7RPge+1RJeCSlQWWbkq4SIvHN1LxjxRBVBEfpAWuAdnJAaVIc5ky8ycIvP PUrtV4KxbMcFodua5gPpdgPnXJpszWizginN9njnUGWt86SwX9+wALaxZ5R4IdXFdRFQ 93T/XfbfLP0RP+jDug8HfrAaQbaXkHTSaQLLBWjhIXxLKa5WyWQjhoW5fclDeyWbUFLO ig/Q== 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=TaT1kiJbKgOZ27aOPi7fOvnt0RXKINFMOW4k3Bf6P3c=; b=VHhH/8CgnnXKaK/fs4omq7AxI76xIJ0PZHjSkKduWLkfLLZOE2nwa40Fm2Lzol7ifc qEpodU8cVXb5Hf7PEUGZvXEio6rYjGwcCZdwi8LiKQaj7vDC23ClLDlQ9jl6PftHZdDv s2bbZM2U7HHvFtL6ksQ6vwKpkuQ/OtVPnw0r61SVw+btg9sj6MSiFmuQdrAVhD8kn9VW hlKOCeBgmTW8nvPLW5AxAhuU6E16DnQXDlBFiyuiIIeiIL+9JbtxCWpBwCbXvj6rzIoQ qxKqNcIgETu45JspQ22rO4BOxuFYPibNg0MXRl4RwthM6MoIDl/XArqL7CfkIuUB8AzL rBQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XzaGTtGK; 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 x1sor11347432plr.50.2020.06.08.11.32.10 for (Google Transport Security); Mon, 08 Jun 2020 11:32:10 -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:a17:902:fe01:: with SMTP id g1mr127225plj.254.1591641129758; Mon, 08 Jun 2020 11:32:09 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9043:af95:b7b4:3ade]) by smtp.gmail.com with ESMTPSA id k29sm6680961pgf.77.2020.06.08.11.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 11:32:09 -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 v3 3/5] roc-rk3399-pc: Move leds setup in SPL Date: Mon, 8 Jun 2020 14:31:42 -0400 Message-Id: <20200608183144.26809-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200608183144.26809-1-jagan@amarulasolutions.com> References: <20200608183144.26809-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=XzaGTtGK; 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 Tested-by: Suniel Mahesh --- Changes for v3: - new patch arch/arm/mach-rockchip/tpl.c | 7 ------- board/firefly/roc-pc-rk3399/Makefile | 4 ++++ board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 21 ------------------- board/firefly/roc-pc-rk3399/spl.c | 23 +++++++++++++++++++++ configs/roc-pc-mezzanine-rk3399_defconfig | 2 +- configs/roc-pc-rk3399_defconfig | 2 +- 6 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 board/firefly/roc-pc-rk3399/spl.c 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/Makefile b/board/firefly/roc-pc-rk3399/Makefile index 29c79b25d7..3a9c4c744d 100644 --- a/board/firefly/roc-pc-rk3399/Makefile +++ b/board/firefly/roc-pc-rk3399/Makefile @@ -4,4 +4,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +else obj-y += roc-pc-rk3399.o +endif diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c index 7c3a803654..581cdcd3b0 100644 --- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c +++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c @@ -6,13 +6,8 @@ #include #include #include -#include #include -#include -#include -#include -#ifndef CONFIG_SPL_BUILD int board_early_init_f(void) { struct udevice *regulator; @@ -30,19 +25,3 @@ 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; -} -#endif diff --git a/board/firefly/roc-pc-rk3399/spl.c b/board/firefly/roc-pc-rk3399/spl.c new file mode 100644 index 0000000000..a7664c6b86 --- /dev/null +++ b/board/firefly/roc-pc-rk3399/spl.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Amarula Solutions(India) + */ + +#include +#include +#include + +#define GPIO0_BASE 0xff720000 + +static void 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); +} + +void rk_spl_board_init(void) +{ + led_setup(); +} diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig index 03ba519af1..8ad74dc408 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 @@ -19,7 +20,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 b59b54bd89..6fd06d6381 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 @@ -19,7 +20,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