From patchwork Thu Jun 18 15:39:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1410 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 172C53F03F for ; Thu, 18 Jun 2020 18:08:10 +0200 (CEST) Received: by mail-pj1-f72.google.com with SMTP id x14sf4325692pjt.5 for ; Thu, 18 Jun 2020 09:08:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1592496488; cv=pass; d=google.com; s=arc-20160816; b=CybiNnhUSWOQ8ssygi9HYzCMshGA2KTyW64WIS2YHOrTb2np0+CUgk4DhP7AYLViiT lNIhJNPblVsNd5cj6XB/B9j5mJH9RWJQehvFcYeml3AxqdOl9yPaKE4wazHx38oYN7/M zGA4jmkeRmAvqC/5KEbp43nEplK02mVYwiqTQkyPMSxOJkBSHGM7/iYB8uhp8zh6tQ9z 5KXxQ8Tg1BV7lyyazM2xiyc2nE0liiO2be4ZGM+7epvIvnBYrE8ET7zQXTHsRVvrgbqC uFfQ4h3l72Nw6oG51tYVa1DQW8Kp+3nm3ElXQqnFEexjrB/kFs7Rr4iG7/0whq/8Af5I KnOw== 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=Uc0lpRusUbf4kpfVglZSCpK2herH+f741b0UVltRW8M=; b=KloreO3j5khphBnBSmFVTVHsu+mkSZmZIGjiNwF4MqD2XENczcvHbGs5rQfG+AIOA7 dLTxnREviPnE1QOyqshGaRQyiEhE6qd5iEOD/ff1geVNa5FhpFz1tB7pi/BbWGbc/Q5O 5sEpGN5tgBp/2+RLl4ErgM/iylMG+C+hOKxUCVv/KbWXuu+OLN+HDPumOeHlqTY4fW5A 46cJTylpQi6Xt2sdC9hpQFC4iCIHp0XfMG+qoxhFL2QW00A7cfSv9gDz7UhYGe4G3zGl sYwGPselIKCb1BSfdI5YobfdXYcvF9YBNhbD8SPyjKgsHKbTxOoGXWjATnv6S/pN0nZL 8oww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZtGWj5LQ; 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=Uc0lpRusUbf4kpfVglZSCpK2herH+f741b0UVltRW8M=; b=dlc9UfQONAsexblXflRhIjSMSSlm3A/6Ee5jNERzZQk+Ont5o0TawbZ0jYkO932j+c gvdU/XdBBV+4yDJ0VegvHlBpx8hycOx6SIforaF6PmdjBwHql9ErvgjjqPWCUEXm0S/0 9zs4p2dppphXiwu8P6oq+6JTg/yj9HqslEPa0= 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=Uc0lpRusUbf4kpfVglZSCpK2herH+f741b0UVltRW8M=; b=EcqA5wqsALyzylZX2KD0NaHqh+ykWfYUb67RBL3LGxapbN4IFpcMgkON68TzduYlYu AFWcfHbehPBzkhM2WGFLlsyvKhlsFOWaM4KiQ4/dQGTDfAPUKzheGk3CJve0PWXm0gdu AdEZHF6xSrT4eIXT/VkPRJos4PV7nJzRTIMKVX6jP+Tamcfvh8N10WgbvBQz01FGeqgt Hvh5DqiBRlCcWxdNTTbRiOEaMEoK6pzRp44Dx6NMb1Cok02FqNZVEPABCNiHslOaRzyW IZS6CpZLZS7TjDH9L6+MwWGMZlJyhpx06Q4jyBFoiXUBcdRTiyagmwciBNReLYfhu8ds aR+w== X-Gm-Message-State: AOAM533NXq+UztMkQ6Ly4EGp5R6rOica1rw/qilQ2jKtxYNeBAU+7c1Q OJThK4Pu+dg1R1SK7B6s5yN3s6OP X-Google-Smtp-Source: ABdhPJz46JBdfTysqcbUsmjGACKI6GKBPJoecmg1qxIHmKv51fnhunFQfYfwTTG2jZrwEpaTV0A70Q== X-Received: by 2002:a63:ef03:: with SMTP id u3mr3838104pgh.254.1592496488603; Thu, 18 Jun 2020 09:08:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:6845:: with SMTP id f5ls2378022pln.8.gmail; Thu, 18 Jun 2020 09:08:08 -0700 (PDT) X-Received: by 2002:a17:90a:898a:: with SMTP id v10mr4753102pjn.95.1592496488103; Thu, 18 Jun 2020 09:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592496488; cv=none; d=google.com; s=arc-20160816; b=D6sQhT0FFPPu3KndlMXZLazzEKl8aR4v5v70P/1zgJorz9vHl71ISxR5GI91ErBVcH PV0RZ8Gx31K4GxR7S3JWu2vNGD6aNlj5BZYXmkUey0cs/ul1JrQC/yXQ5DcpDaWhh78I kxuaNnVaKt/nAjY58oB+uSpGN6cU8/yN8X3k/2o6co09noyVE7humGoQRFgxCVPs9w1v /rBxhOpYr9/8tnrxrs7Yj1lzYz4tBhtaLQBLsoQhPtoZIqhG+3oTNSCLkEqzsPxAighM Z5dUK4HJfDHoAqs1h0nXXz+TJJ0VsTRPAQ7jPFLPZgr28x4fV5PSsPH7+abOgy/z00Hl biTg== 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=jSsm2gL9QZAY4GTGbTrZamobNQaqEtToYRe2AvoAmHk=; b=M6RwHPiSECapHf+8WwtSAkqxJicPmi/1Br0AZqtn8TEjxMLYMOEBeIiBElywhjD0Q5 LICcMzguhWGNgWcI4I4BYTKfdluJ4Ek9BJdrnUHvIY4+a/oMaux1GjVMCjM/CkjV/dJp NXj8S+zcoGB1eCpqsptD01dHZub6MWLYEDTuPBvy8bQBQ4utBqIReS/wWbXy03S71AVU WltNZfThCcEpH3/c5i+bKP8DxZhBt+4DixleXQE25TnOWH1ZpvDQgJPynPPE1fU5ZrVu LwwX56SXN1vcZzZOelmXNVLEyVm1ZlhhKgR+jxOwGwQmfKUSJ37aeLEpelg8sU/cRTmh jCGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZtGWj5LQ; 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 lt12sor4073326pjb.38.2020.06.18.09.08.08 for (Google Transport Security); Thu, 18 Jun 2020 09:08:08 -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:90b:1009:: with SMTP id gm9mr5016843pjb.213.1592496487794; Thu, 18 Jun 2020 09:08:07 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:b0c7:f192:869b:df87]) by smtp.gmail.com with ESMTPSA id u4sm3264943pfl.102.2020.06.18.09.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 09:08:07 -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 v4 3/5] roc-rk3399-pc: Move leds setup in SPL Date: Thu, 18 Jun 2020 21:09:46 +0530 Message-Id: <20200618153948.218506-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618153948.218506-1-jagan@amarulasolutions.com> References: <20200618153948.218506-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=ZtGWj5LQ; 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 v4: - none 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 595f052cb7..060b4bfecf 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 @@ -20,7 +21,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 1c4db3443f..9897a52cd8 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 @@ -20,7 +21,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