* [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices
@ 2023-10-25 23:13 Adam Ford
2023-10-25 23:13 ` [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset Adam Ford
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Adam Ford @ 2023-10-25 23:13 UTC (permalink / raw)
To: u-boot; +Cc: marex, aford, Adam Ford
In order to save some space, disable the ability to dynamically
remove devices. Without this, U-Boot is too large to load without
recompiling TF-A.
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/configs/rzg2_beacon_defconfig b/configs/rzg2_beacon_defconfig
index 73abe966b8..7b14d225b5 100644
--- a/configs/rzg2_beacon_defconfig
+++ b/configs/rzg2_beacon_defconfig
@@ -48,6 +48,7 @@ CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_MMC_ENV_PART=2
CONFIG_VERSION_VARIABLE=y
+# CONFIG_DM_DEVICE_REMOVE is not set
CONFIG_REGMAP=y
CONFIG_SYSCON=y
CONFIG_CLK=y
--
2.40.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset
2023-10-25 23:13 [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Adam Ford
@ 2023-10-25 23:13 ` Adam Ford
2023-10-31 15:13 ` Adam Ford
2023-10-25 23:13 ` [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC Adam Ford
2023-10-26 6:39 ` [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Marek Vasut
2 siblings, 1 reply; 10+ messages in thread
From: Adam Ford @ 2023-10-25 23:13 UTC (permalink / raw)
To: u-boot; +Cc: marex, aford, Adam Ford
The ENV size and offset were changed to different
values in Beacon's downstream release. Change them to the
same values as the downstream for consistent behavior.
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/configs/rzg2_beacon_defconfig b/configs/rzg2_beacon_defconfig
index 7b14d225b5..534f641e84 100644
--- a/configs/rzg2_beacon_defconfig
+++ b/configs/rzg2_beacon_defconfig
@@ -3,7 +3,8 @@ CONFIG_ARCH_RMOBILE=y
CONFIG_TEXT_BASE=0x50000000
CONFIG_SYS_MALLOC_LEN=0x4000000
CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_ENV_OFFSET=0x0
+CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_OFFSET=0xFFFFE000
CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="r8a774a1-beacon-rzg2m-kit"
CONFIG_RCAR_GEN3=y
--
2.40.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC
2023-10-25 23:13 [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Adam Ford
2023-10-25 23:13 ` [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset Adam Ford
@ 2023-10-25 23:13 ` Adam Ford
2023-10-26 6:40 ` Marek Vasut
2023-10-26 6:39 ` [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Marek Vasut
2 siblings, 1 reply; 10+ messages in thread
From: Adam Ford @ 2023-10-25 23:13 UTC (permalink / raw)
To: u-boot; +Cc: marex, aford, Adam Ford
There is a function inside the board file to autodetect which device
tree is needed by U-Boot to properly load its own device tree, but
it currently defaults to always loading RZ/G2M for Linux. This is
not correct for other SoC variants. Add board_late_init function
to query the SoC name and use that to determine which device tree
is loaded for booting Linux.
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/board/beacon/beacon-rzg2m/beacon-rzg2m.c b/board/beacon/beacon-rzg2m/beacon-rzg2m.c
index 99fe1edfb3..6d37ff6ac9 100644
--- a/board/beacon/beacon-rzg2m/beacon-rzg2m.c
+++ b/board/beacon/beacon-rzg2m/beacon-rzg2m.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <asm/global_data.h>
#include <asm/io.h>
+#include <env.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -17,6 +18,38 @@ int board_init(void)
return 0;
}
+#if IS_ENABLED(CONFIG_BOARD_LATE_INIT)
+static u8 get_SoC_letter(void)
+{
+ const u8 *name = rzg_get_cpu_name();
+
+ if (*name)
+ return name[6];
+
+ return 0;
+}
+
+int board_late_init(void)
+{
+ /* If already defined, exit */
+ if (!env_get("fdt_file")) {
+ switch (get_SoC_letter()) {
+ case 'A':
+ env_set("fdt_file", "r8a774a1-beacon-rzg2m-kit.dtb");
+ break;
+ case 'B':
+ env_set("fdt_file", "r8a774b1-beacon-rzg2n-kit.dtb");
+ break;
+ case 'E':
+ env_set("fdt_file", "r8a774e1-beacon-rzg2h-kit.dtb");
+ break;
+ }
+ }
+
+ return 0;
+}
+#endif /* CONFIG_BOARD_LATE_INIT */
+
#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
int board_fit_config_name_match(const char *name)
{
diff --git a/configs/rzg2_beacon_defconfig b/configs/rzg2_beacon_defconfig
index 534f641e84..6894448b22 100644
--- a/configs/rzg2_beacon_defconfig
+++ b/configs/rzg2_beacon_defconfig
@@ -21,6 +21,7 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"
CONFIG_DEFAULT_FDT_FILE="r8a774a1-beacon-rzg2m-kit.dtb"
# CONFIG_BOARD_EARLY_INIT_F is not set
+CONFIG_BOARD_LATE_INIT=y
CONFIG_SYS_MALLOC_BOOTPARAMS=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_MAXARGS=64
diff --git a/include/configs/beacon-rzg2m.h b/include/configs/beacon-rzg2m.h
index 65c01835cc..493b98fbdf 100644
--- a/include/configs/beacon-rzg2m.h
+++ b/include/configs/beacon-rzg2m.h
@@ -18,7 +18,6 @@
"fdt_addr=0x48000000\0" \
"loadaddr=0x48080000\0" \
"boot_fdt=try\0" \
- "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
"initrd_addr=0x43800000\0" \
"mmcdev=1\0" \
"mmcpart=1\0" \
--
2.40.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices
2023-10-25 23:13 [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Adam Ford
2023-10-25 23:13 ` [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset Adam Ford
2023-10-25 23:13 ` [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC Adam Ford
@ 2023-10-26 6:39 ` Marek Vasut
2023-10-27 2:11 ` Adam Ford
2 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2023-10-26 6:39 UTC (permalink / raw)
To: Adam Ford, u-boot; +Cc: aford
On 10/26/23 01:13, Adam Ford wrote:
> In order to save some space, disable the ability to dynamically
> remove devices. Without this, U-Boot is too large to load without
> recompiling TF-A.
Did you enable LTO yet ?
Striping DM_REMOVE seems like a really bad idea, doesn't that break 'usb
reset' and its removal of devices ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC
2023-10-25 23:13 ` [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC Adam Ford
@ 2023-10-26 6:40 ` Marek Vasut
2023-10-27 2:12 ` Adam Ford
0 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2023-10-26 6:40 UTC (permalink / raw)
To: Adam Ford, u-boot; +Cc: aford
On 10/26/23 01:13, Adam Ford wrote:
> There is a function inside the board file to autodetect which device
> tree is needed by U-Boot to properly load its own device tree, but
> it currently defaults to always loading RZ/G2M for Linux. This is
> not correct for other SoC variants. Add board_late_init function
> to query the SoC name and use that to determine which device tree
> is loaded for booting Linux.
Can't this be scripted in environment instead ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices
2023-10-26 6:39 ` [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Marek Vasut
@ 2023-10-27 2:11 ` Adam Ford
0 siblings, 0 replies; 10+ messages in thread
From: Adam Ford @ 2023-10-27 2:11 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, aford
On Thu, Oct 26, 2023 at 8:44 PM Marek Vasut <marex@denx.de> wrote:
>
> On 10/26/23 01:13, Adam Ford wrote:
> > In order to save some space, disable the ability to dynamically
> > remove devices. Without this, U-Boot is too large to load without
> > recompiling TF-A.
>
> Did you enable LTO yet ?
Yes.
>
> Striping DM_REMOVE seems like a really bad idea, doesn't that break 'usb
> reset' and its removal of devices ?
I did not, but we can drop this one, and I'll just have to re-compile
TF-A to load a larger U-Boot.
adam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC
2023-10-26 6:40 ` Marek Vasut
@ 2023-10-27 2:12 ` Adam Ford
2023-11-19 20:06 ` Marek Vasut
0 siblings, 1 reply; 10+ messages in thread
From: Adam Ford @ 2023-10-27 2:12 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, aford
On Thu, Oct 26, 2023 at 8:44 PM Marek Vasut <marex@denx.de> wrote:
>
> On 10/26/23 01:13, Adam Ford wrote:
> > There is a function inside the board file to autodetect which device
> > tree is needed by U-Boot to properly load its own device tree, but
> > it currently defaults to always loading RZ/G2M for Linux. This is
> > not correct for other SoC variants. Add board_late_init function
> > to query the SoC name and use that to determine which device tree
> > is loaded for booting Linux.
>
> Can't this be scripted in environment instead ?
Do you have a recommendation for how to read the SoC type from a script?
adam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset
2023-10-25 23:13 ` [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset Adam Ford
@ 2023-10-31 15:13 ` Adam Ford
2023-11-19 20:05 ` Marek Vasut
0 siblings, 1 reply; 10+ messages in thread
From: Adam Ford @ 2023-10-31 15:13 UTC (permalink / raw)
To: u-boot; +Cc: marex, aford
On Wed, Oct 25, 2023 at 6:13 PM Adam Ford <aford173@gmail.com> wrote:
>
> The ENV size and offset were changed to different
> values in Beacon's downstream release. Change them to the
> same values as the downstream for consistent behavior.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
Marek,
I know you had some feedback on other patches in this series. I'll
drop one, and refactor another, but is this one ok to merge as-is or
should I re-post without the other patches?
adam
>
> diff --git a/configs/rzg2_beacon_defconfig b/configs/rzg2_beacon_defconfig
> index 7b14d225b5..534f641e84 100644
> --- a/configs/rzg2_beacon_defconfig
> +++ b/configs/rzg2_beacon_defconfig
> @@ -3,7 +3,8 @@ CONFIG_ARCH_RMOBILE=y
> CONFIG_TEXT_BASE=0x50000000
> CONFIG_SYS_MALLOC_LEN=0x4000000
> CONFIG_SYS_MALLOC_F_LEN=0x2000
> -CONFIG_ENV_OFFSET=0x0
> +CONFIG_ENV_SIZE=0x2000
> +CONFIG_ENV_OFFSET=0xFFFFE000
> CONFIG_DM_GPIO=y
> CONFIG_DEFAULT_DEVICE_TREE="r8a774a1-beacon-rzg2m-kit"
> CONFIG_RCAR_GEN3=y
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset
2023-10-31 15:13 ` Adam Ford
@ 2023-11-19 20:05 ` Marek Vasut
0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2023-11-19 20:05 UTC (permalink / raw)
To: Adam Ford, u-boot; +Cc: aford
On 10/31/23 16:13, Adam Ford wrote:
> On Wed, Oct 25, 2023 at 6:13 PM Adam Ford <aford173@gmail.com> wrote:
>>
>> The ENV size and offset were changed to different
>> values in Beacon's downstream release. Change them to the
>> same values as the downstream for consistent behavior.
>>
>> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> Marek,
>
> I know you had some feedback on other patches in this series. I'll
> drop one, and refactor another, but is this one ok to merge as-is or
> should I re-post without the other patches?
Please repost, and use the right To: address (+renesas@mailbox) , I'll
pick it up shortly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC
2023-10-27 2:12 ` Adam Ford
@ 2023-11-19 20:06 ` Marek Vasut
0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2023-11-19 20:06 UTC (permalink / raw)
To: Adam Ford; +Cc: u-boot, aford
On 10/27/23 04:12, Adam Ford wrote:
> On Thu, Oct 26, 2023 at 8:44 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 10/26/23 01:13, Adam Ford wrote:
>>> There is a function inside the board file to autodetect which device
>>> tree is needed by U-Boot to properly load its own device tree, but
>>> it currently defaults to always loading RZ/G2M for Linux. This is
>>> not correct for other SoC variants. Add board_late_init function
>>> to query the SoC name and use that to determine which device tree
>>> is loaded for booting Linux.
>>
>> Can't this be scripted in environment instead ?
>
> Do you have a recommendation for how to read the SoC type from a script?
If you want to read PRR from script:
$ setexpr prrcontent *0xFFF00044
$ printenv prrcontent
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-11-19 20:06 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 23:13 [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Adam Ford
2023-10-25 23:13 ` [PATCH 2/3] configs: rzg2_beacon: Realign ENV location and offset Adam Ford
2023-10-31 15:13 ` Adam Ford
2023-11-19 20:05 ` Marek Vasut
2023-10-25 23:13 ` [PATCH 3/3] arm: rmobile: rzg2_beacon: Auto select Linux device tree by SoC Adam Ford
2023-10-26 6:40 ` Marek Vasut
2023-10-27 2:12 ` Adam Ford
2023-11-19 20:06 ` Marek Vasut
2023-10-26 6:39 ` [PATCH 1/3] configs: rzg2_beacon: Disable the ability to remove devices Marek Vasut
2023-10-27 2:11 ` Adam Ford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox