Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
mb/facebook/fbg1701: Add mainboard_read_pcb_version()

PCB version is determined using inb() in actual code.

Create function mainboard_read_pcb_version to read pcb version.

BUG=N/A
TEST=Boot and verified on Facebook FBG-1701

Change-Id: I7c16627f468d84ca4ad2aab8bf9fb555f50dc23c
Signed-off-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35741
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
---
M src/mainboard/facebook/fbg1701/mainboard.c
M src/mainboard/facebook/fbg1701/mainboard.h
M src/mainboard/facebook/fbg1701/ramstage.c
3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mainboard/facebook/fbg1701/mainboard.c b/src/mainboard/facebook/fbg1701/mainboard.c
index 8524b24..a8cb34c 100644
--- a/src/mainboard/facebook/fbg1701/mainboard.c
+++ b/src/mainboard/facebook/fbg1701/mainboard.c
@@ -16,7 +16,10 @@
* GNU General Public License for more details.
*/

+#include <arch/io.h>
#include <device/device.h>
+#include "mainboard.h"
+#include "onboard.h"

/*
* Declare the resources we are using
@@ -36,6 +39,13 @@
res->flags = IORESOURCE_IRQ | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
}

+/* Read PCB version */
+unsigned int mainboard_read_pcb_version(void)
+{
+ return ((inb(CPLD_PCB_VERSION_PORT) & CPLD_PCB_VERSION_MASK) >>
+ CPLD_PCB_VERSION_BIT);
+}
+
/*
* mainboard_enable is executed as first thing after
* enumerate_buses().
diff --git a/src/mainboard/facebook/fbg1701/mainboard.h b/src/mainboard/facebook/fbg1701/mainboard.h
index e161da0..3cace54 100644
--- a/src/mainboard/facebook/fbg1701/mainboard.h
+++ b/src/mainboard/facebook/fbg1701/mainboard.h
@@ -16,6 +16,7 @@
#ifndef MAINBOARD_H
#define MAINBOARD_H

+unsigned int mainboard_read_pcb_version(void);
void *load_logo(size_t *logo_size);

#endif
diff --git a/src/mainboard/facebook/fbg1701/ramstage.c b/src/mainboard/facebook/fbg1701/ramstage.c
index 5c78bcc..c5fb798 100644
--- a/src/mainboard/facebook/fbg1701/ramstage.c
+++ b/src/mainboard/facebook/fbg1701/ramstage.c
@@ -324,15 +324,11 @@

static void mainboard_configure_edp_bridge(void)
{
- u8 cpld_version;
const struct edp_data *edptable;
unsigned int loops;
int status;

- cpld_version = (inb(CPLD_PCB_VERSION_PORT) & CPLD_PCB_VERSION_MASK) >>
- CPLD_PCB_VERSION_BIT;
- printk(BIOS_DEBUG, "CPLD version: %x\n", cpld_version);
- if (cpld_version < 7)
+ if (mainboard_read_pcb_version() < 7)
edptable = b101uan01_table;
else
edptable = b101uan08_table;

To view, visit change 35741. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7c16627f468d84ca4ad2aab8bf9fb555f50dc23c
Gerrit-Change-Number: 35741
Gerrit-PatchSet: 2
Gerrit-Owner: Frans Hendriks <fhendriks@eltan.com>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Frans Hendriks <fhendriks@eltan.com>
Gerrit-Reviewer: Lance Zhao <lance.zhao@gmail.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged