[coreboot-gerrit] Patch set updated for coreboot: AMD Bettong: add get_board_id to read board version

WANG Siyuan (wangsiyuanbuaa@gmail.com) gerrit at coreboot.org
Sun Oct 11 18:53:52 CET 2015


WANG Siyuan (wangsiyuanbuaa at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11732

-gerrit

commit ddc2ec217dba9ae9697673ed2169ccfb6cc47037
Author: WANG Siyuan <wangsiyuanbuaa at gmail.com>
Date:   Fri Jul 3 20:29:56 2015 +0800

    AMD Bettong: add get_board_id to read board version
    
    Bettong use 3 GPIO(5-7) ports to identify board.
    The GPIO ports are mapped to MMIO space.
    The GPIO value and board version are mapped as follow:
    GPIO5 GPIO6 GPIO7 Version
      0     0     0      A
      0     0     1      B
      ......
      1     1     1      H
    
    Change-Id: I72df28043057d8c4ccc4a2e645011ca5379e9928
    Signed-off-by: WANG Siyuan <wangsiyuanbuaa at gmail.com>
    Signed-off-by: WANG Siyuan <SiYuan.Wang at amd.com>
---
 src/mainboard/amd/bettong/Makefile.inc    |  2 ++
 src/mainboard/amd/bettong/boardid.c       | 45 +++++++++++++++++++++++++++++++
 src/northbridge/amd/pi/00660F01/dimmSpd.c | 11 ++++++++
 3 files changed, 58 insertions(+)

diff --git a/src/mainboard/amd/bettong/Makefile.inc b/src/mainboard/amd/bettong/Makefile.inc
index 70722ee..197da03 100644
--- a/src/mainboard/amd/bettong/Makefile.inc
+++ b/src/mainboard/amd/bettong/Makefile.inc
@@ -19,9 +19,11 @@
 
 romstage-y += BiosCallOuts.c
 romstage-y += PlatformGnbPcie.c
+romstage-y += boardid.c
 
 ramstage-y += BiosCallOuts.c
 ramstage-y += PlatformGnbPcie.c
 ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
 ramstage-y += fchec.c
 endif
+ramstage-y += boardid.c
diff --git a/src/mainboard/amd/bettong/boardid.c b/src/mainboard/amd/bettong/boardid.c
new file mode 100644
index 0000000..30343d7
--- /dev/null
+++ b/src/mainboard/amd/bettong/boardid.c
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <stdint.h>
+#include <arch/io.h>
+#include <arch/acpi.h>
+#include <console/console.h>
+#include <reset.h>
+#include <boardid.h>
+
+uint8_t board_id(void)
+{
+	u32 gpiommioaddr;
+	u8  value = 0;
+	u8  boardrev = 0;
+	char boardid;
+
+	gpiommioaddr = 0xfed80000ul + 0x1500;
+	value = *(volatile u8 *) (gpiommioaddr + (7 << 2) + 2); //agpio7 //board_id2
+	boardrev = value & 1;
+	value = *(volatile u8 *) (gpiommioaddr + (6 << 2) + 2); //agpio6 //board_id1
+	boardrev |= (value & 1) << 1;
+	value = *(volatile u8 *) (gpiommioaddr + (5 << 2) + 2); //agpio5 //board_id0
+	boardrev |= (value & 1) << 2;
+
+	boardid = 'A' + boardrev;
+
+	return boardid;
+}
diff --git a/src/northbridge/amd/pi/00660F01/dimmSpd.c b/src/northbridge/amd/pi/00660F01/dimmSpd.c
index 6996f83..0cc6968 100644
--- a/src/northbridge/amd/pi/00660F01/dimmSpd.c
+++ b/src/northbridge/amd/pi/00660F01/dimmSpd.c
@@ -28,6 +28,17 @@
 #include "chip.h"
 #include "northbridge/amd/pi/dimmSpd.h"
 
+/**
+ *Bettong use 3 GPIO(5-7) ports to identify board.
+ *The GPIO ports are mapped to MMIO space.
+ *The GPIO value and board version are mapped as follow:
+ *GPIO5 GPIO6 GPIO7 Version
+ *  0     0     0      A
+ *  0     0     1      B
+ *  ......
+ *  1     1     1      H
+ */
+
 AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINT32 unused2, AGESA_READ_SPD_PARAMS *info)
 {
 	int spdAddress;



More information about the coreboot-gerrit mailing list