From acf230c2ea3f549f4392a53d5b3f41e3fc7e78a3 Mon Sep 17 00:00:00 2001
From: Nico Huber <nico.huber@secunet.com>
Date: Tue, 30 Mar 2021 16:51:53 +0200
Subject: mb/ti/beaglebone: Fix MMAP_HELPER API usage

This replays the changes made in commit 9b1f3cc6fb (cbfs: Pull
handling of the CBFS_CACHE mem_pool into CBFS core) for the latest
work on the BeagleBone port. I hope it's the right thing to do.

Fixes: Makes `master` compile again.

Change-Id: Ia51c66dbe425a662ea2a6b2527b2b6982f587891
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51943
Reviewed-by: Sam Lewis <sam.vr.lewis@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
 src/mainboard/ti/beaglebone/sd_media.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/mainboard/ti/beaglebone/sd_media.c b/src/mainboard/ti/beaglebone/sd_media.c
index 7e04f211dd..f6009be160 100644
--- a/src/mainboard/ti/beaglebone/sd_media.c
+++ b/src/mainboard/ti/beaglebone/sd_media.c
@@ -6,6 +6,7 @@
 #include <assert.h>
 #include <commonlib/storage/sd_mmc.h>
 #include <cbmem.h>
+#include <cbfs.h>
 
 #include <soc/ti/am335x/mmc.h>
 #include <soc/ti/am335x/header.h>
@@ -92,8 +93,9 @@ static const struct region_device_ops am335x_sd_ops = {
 
 extern struct omap_image_headers headers;
 
-static struct mmap_helper_region_device sd_mdev = MMAP_HELPER_REGION_INIT(
-	&am335x_sd_ops, COREBOOT_IMAGE_OFFSET + sizeof(headers), CONFIG_ROM_SIZE);
+static struct mmap_helper_region_device sd_mdev = MMAP_HELPER_DEV_INIT(
+	&am335x_sd_ops, COREBOOT_IMAGE_OFFSET + sizeof(headers), CONFIG_ROM_SIZE,
+	&cbfs_cache);
 
 static bool init_done = false;
 
@@ -108,13 +110,6 @@ void boot_device_init(void)
 	storage_setup_media(&media, &sd_host.sd_mmc_ctrlr);
 	storage_display_setup(&media);
 
-	if (ENV_BOOTBLOCK) {
-		mmap_helper_device_init(&sd_mdev, _cbfs_cache, REGION_SIZE(cbfs_cache));
-	} else {
-		mmap_helper_device_init(&sd_mdev, _postram_cbfs_cache,
-					REGION_SIZE(postram_cbfs_cache));
-	}
-
 	init_done = true;
 }
 
-- 
cgit v1.2.3