aboutsummaryrefslogtreecommitdiff
path: root/board/nvidia/p3450-0000
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2021-09-03 15:16:22 +0200
committerTom Warren <twarren@nvidia.com>2021-10-13 14:18:30 -0700
commitdb8a0306c91c470854fcfb9b3373ab98b18d3eba (patch)
tree0c4e484059507defb10bd445a869bd841fe62b12 /board/nvidia/p3450-0000
parentb9aad375917d4ae0dec5aedcdfa79929e1dbb730 (diff)
downloadu-boot-db8a0306c91c470854fcfb9b3373ab98b18d3eba.zip
u-boot-db8a0306c91c470854fcfb9b3373ab98b18d3eba.tar.gz
u-boot-db8a0306c91c470854fcfb9b3373ab98b18d3eba.tar.bz2
ARM: tegra: Support multiple reserved memory regions
Support multiple reserved memory regions per device to support platforms that use both a framebuffer and color conversion lookup table for early boot display splash. While at it, also pass along the name, compatible strings and flags of the carveouts. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'board/nvidia/p3450-0000')
-rw-r--r--board/nvidia/p3450-0000/p3450-0000.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/board/nvidia/p3450-0000/p3450-0000.c b/board/nvidia/p3450-0000/p3450-0000.c
index 2770862..97b9900 100644
--- a/board/nvidia/p3450-0000/p3450-0000.c
+++ b/board/nvidia/p3450-0000/p3450-0000.c
@@ -11,6 +11,7 @@
#include <linux/bitops.h>
#include <linux/libfdt.h>
#include <pca953x.h>
+#include <stdlib.h>
#include <asm/arch-tegra/cboot.h>
#include <asm/arch/gpio.h>
#include <asm/arch/pinmux.h>
@@ -124,24 +125,52 @@ static void ft_mac_address_setup(void *fdt)
static int ft_copy_carveout(void *dst, const void *src, const char *node)
{
- struct fdt_memory fb;
+ unsigned int index = 0;
int err;
- err = fdtdec_get_carveout(src, node, "memory-region", 0, &fb, NULL,
- NULL, NULL, NULL);
- if (err < 0) {
- if (err != -FDT_ERR_NOTFOUND)
- printf("failed to get carveout for %s: %d\n", node,
+ while (true) {
+ const char **compatibles = NULL;
+ unsigned int num_compatibles;
+ struct fdt_memory carveout;
+ unsigned long flags;
+ char *copy = NULL;
+ const char *name;
+
+ err = fdtdec_get_carveout(src, node, "memory-region", index,
+ &carveout, &name, &compatibles,
+ &num_compatibles, &flags);
+ if (err < 0) {
+ if (err != -FDT_ERR_NOTFOUND)
+ printf("failed to get carveout for %s: %d\n",
+ node, err);
+
+ return err;
+ }
+
+ if (name) {
+ const char *ptr = strchr(name, '@');
+
+ if (ptr) {
+ copy = strndup(name, ptr - name);
+ name = copy;
+ }
+ } else {
+ name = "carveout";
+ }
+
+ err = fdtdec_set_carveout(dst, node, "memory-region", index,
+ &carveout, name, compatibles,
+ num_compatibles, flags);
+ if (err < 0) {
+ printf("failed to set carveout for %s: %d\n", node,
err);
+ return err;
+ }
- return err;
- }
+ if (copy)
+ free(copy);
- err = fdtdec_set_carveout(dst, node, "memory-region", 0, &fb,
- "framebuffer", NULL, 0, 0);
- if (err < 0) {
- printf("failed to set carveout for %s: %d\n", node, err);
- return err;
+ index++;
}
return 0;