the following patch was just integrated into master:
commit 715643ffb2595fb7efb8f6d59fff2dd9634a9a96
Author: Sven Schnelle <svens(a)stackframe.org>
Date: Tue Jan 31 12:33:01 2012 +0100
X60/T60: fix default baudrate
Value required to get 115200 is actually 0, not 5.
Change-Id: Id1385822bf2213c035c4f378a72168ed6676ad03
Signed-off-by: Sven Schnelle <svens(a)stackframe.org>
Build-Tested: build bot (Jenkins) at Tue Jan 31 12:51:49 2012, giving +1
Reviewed-By: Sven Schnelle <svens(a)stackframe.org> at Tue Jan 31 12:52:18 2012, giving +2
See http://review.coreboot.org/592 for details.
-gerrit
Kerry Sheh (shekairui(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/568
-gerrit
commit b25218ecfccf73157856861ab0713f7860d5c476
Author: Kerry Sheh <shekairui(a)gmail.com>
Date: Tue Jan 31 20:42:35 2012 +0800
H8QGI: Increase xip size of supermicro/h8qgi from 512K to 1M Bytes.
For mainboard using AMD AGESA framework, lots of AGESA code will be
compiled into romstage, so romstage becomes larger, especially for mainboard
support 2 or more processor families.
H8QGI support both f10 and f15 CPUs, 512K default xip size is not enough,
so increase to 1M Bytes.
Change-Id: I1fb1aaad68aed8b41253a02cc0bc151c239b0dbe
Signed-off-by: Kerry Sheh <kerry.she(a)amd.com>
Signed-off-by: Kerry Sheh <shekairui(a)gmail.com>
---
src/mainboard/supermicro/h8qgi/Kconfig | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/mainboard/supermicro/h8qgi/Kconfig b/src/mainboard/supermicro/h8qgi/Kconfig
index e900ea8..201df45 100644
--- a/src/mainboard/supermicro/h8qgi/Kconfig
+++ b/src/mainboard/supermicro/h8qgi/Kconfig
@@ -123,5 +123,19 @@ config VGA_BIOS_ID
depends on VGA_BIOS
default "102b,0532"
+config XIP_ROM_BASE
+ hex
+ default 0xfff00000
+
+config XIP_ROM_SIZE
+ hex
+ default 0x100000
+ help
+ Overwride the default write through caching size as 1M Bytes.
+ On some AMD paltform, one socket support 2 kinds of processor family,
+ Compiling 2 cpu families agesa code will increase the romstage size.
+ In order to execute romstage in place on the flash rom,
+ more space is required to be set as write through caching.
+
endif # BOARD_SUPERMICRO_H8QGI
Kerry Sheh (shekairui(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/569
-gerrit
commit 4f1f36c488d570171c9bb8299ef8e601c2994bc8
Author: Kerry Sheh <shekairui(a)gmail.com>
Date: Tue Jan 31 20:42:37 2012 +0800
HWM: Nuvoton W83795G/ADG HWM support
Supermicro H8QGI-F 1 Unit Chassis contain 9 system Fans,
they are controled by a separate W83795G Hardware Monitor chip.
This patch adds Nuvoton W83795G/ADG HWM support.
Change-Id: I8756f5ed02dc2fa0884cde36e51451fd8aacee27
Signed-off-by: Kerry Sheh <kerry.she(a)amd.com>
Signed-off-by: Kerry Sheh <shekairui(a)gmail.com>
---
src/mainboard/supermicro/h8qgi/Makefile.inc | 1 +
src/mainboard/supermicro/h8qgi/romstage.c | 9 +
src/mainboard/supermicro/h8qgi/w83795.c | 236 +++++++++++++++++++++++++++
src/mainboard/supermicro/h8qgi/w83795.h | 75 +++++++++
4 files changed, 321 insertions(+), 0 deletions(-)
diff --git a/src/mainboard/supermicro/h8qgi/Makefile.inc b/src/mainboard/supermicro/h8qgi/Makefile.inc
index 82264a4..ef81caf 100644
--- a/src/mainboard/supermicro/h8qgi/Makefile.inc
+++ b/src/mainboard/supermicro/h8qgi/Makefile.inc
@@ -17,6 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
+romstage-y += w83795.c
romstage-$(CONFIG_NORTHBRIDGE_AMD_CIMX_RD890) += rd890_cfg.c
romstage-$(CONFIG_SOUTHBRIDGE_AMD_CIMX_SB700) += sb700_cfg.c
romstage-$(CONFIG_SOUTHBRIDGE_AMD_CIMX_SB700) += reset.c
diff --git a/src/mainboard/supermicro/h8qgi/romstage.c b/src/mainboard/supermicro/h8qgi/romstage.c
index 119593e..4d48474 100644
--- a/src/mainboard/supermicro/h8qgi/romstage.c
+++ b/src/mainboard/supermicro/h8qgi/romstage.c
@@ -33,6 +33,7 @@
#include <sb_cimx.h>
#include "superio/nuvoton/wpcm450/wpcm450.h"
#include "superio/winbond/w83627dhg/w83627dhg.h"
+#include "w83795.h"
extern void disable_cache_as_ram(void); /* cache_as_ram.inc */
@@ -119,6 +120,14 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
}
post_code(0x3C);
+ /* W83627DHG pin89,90 function select is RSTOUT3#, RSTOUT2# by default.
+ * In order to access W83795G/ADG HWM using I2C protocol,
+ * we select function to SDA, SCL function (or GP33, GP32 function).
+ */
+ w83627dhg_enable_i2c(PNP_DEV(0x2E, W83627DHG_SPI));
+ w83795_init(THERMAL_CRUISE_MODE, DTS_SRC_AMD_SBTSI);
+ w83627dhg_enable_serial(PNP_DEV(0x2E, W83627DHG_SP1), CONFIG_TTYS0_BASE);
+
nb_Ht_Init();
post_code(0x3D);
/* Reset for HT, FIDVID, PLL and ucode patch(errata) changes to take affect. */
diff --git a/src/mainboard/supermicro/h8qgi/w83795.c b/src/mainboard/supermicro/h8qgi/w83795.c
new file mode 100644
index 0000000..22828db
--- /dev/null
+++ b/src/mainboard/supermicro/h8qgi/w83795.c
@@ -0,0 +1,236 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <console/console.h>
+#include "southbridge/amd/cimx/sb700/smbus.h" /*SMBUS_IO_BASE*/
+#include "w83795.h"
+
+static u32 w83795_set_bank(u8 bank)
+{
+ return do_smbus_write_byte(SMBUS_IO_BASE, W83795_DEV, W83795_REG_BANKSEL, bank);
+}
+
+static u8 w83795_read(u16 reg)
+{
+ u32 ret;
+
+ ret = w83795_set_bank(reg >> 8);
+ if (ret < 0) {
+ printk(BIOS_DEBUG, "read faild to set bank %x\n", reg >> 8);
+ return -1;
+ }
+
+ ret = do_smbus_read_byte(SMBUS_IO_BASE, W83795_DEV, reg & 0xff);
+ return ret;
+}
+
+static u8 w83795_write(u16 reg, u8 value)
+{
+ u32 err;
+
+ err = w83795_set_bank(reg >> 8);
+ if (err < 0) {
+ printk(BIOS_DEBUG, "write faild to set bank %x\n", reg >> 8);
+ return -1;
+ }
+
+ err = do_smbus_write_byte(SMBUS_IO_BASE, W83795_DEV, reg & 0xff, value);
+ return err;
+}
+
+#if 0
+static void w83795_set_speed(void)
+{
+
+}
+
+static void w83795_set_ttti(void)//KR it works
+{
+ u32 i;
+ for (i = 0; i < 6; i++) {
+ //w83795_write(W83795_REG_TTTI(i), 0xa);//10 degree, default 40
+ //w83795_write(W83795_REG_CTFS(i), 0x20);//32 degree, default 80
+ }
+}
+#endif
+
+/*
+ * Enable Digital Temperature Sensor
+ */
+static void w83795_dts_enable(u8 dts_src)
+{
+ u8 val;
+
+ /* DIS */
+ val = w83795_read(W83795_REG_DTSC);
+ val |= (dts_src & 0x01);
+ w83795_write(W83795_REG_DTSC, val);
+
+ /* DTSE */
+ val = w83795_read(W83795_REG_DTSE);
+ val |= 0xFF;
+ w83795_write(W83795_REG_DTSE, val);
+
+ /* store bank3 regs first before enable DTS */
+
+ /*
+ * TD/TR1-4 termal diode by default
+ * 0x00 Disable
+ * 0x01 thermistors on motherboard
+ * 0x10 different mode voltage
+ * 0x11 CPU internal thermal diode output
+ *
+ * TR5-6 thermistors by default TRn
+ */
+ val = 0x55; /* thermal diode */
+ w83795_write(W83795_REG_TEMP_CTRL2, val);
+
+ /* Enable Digital Temperature Sensor */
+ val = w83795_read(W83795_REG_TEMP_CTRL1);
+ val |= W83795_REG_TEMP_CTRL1_EN_DTS; /* EN_DTS */
+ w83795_write(W83795_REG_TEMP_CTRL1, val);
+}
+
+static void w83795_set_tfmr(w83795_fan_mode_t mode)
+{
+ u8 val;
+ u8 i;
+
+ if ((mode == SMART_FAN_MODE) || (mode == THERMAL_CRUISE_MODE)) {
+ val = 0xFF;
+ } else {
+ val = 0x00;
+ }
+
+ for (i = 0; i < 6; i++)
+ w83795_write(W83795_REG_TFMR(i), val);
+}
+
+static u32 w83795_set_fan_mode(w83795_fan_mode_t mode)
+{
+ if (mode == SPEED_CRUISE_MODE) {
+ w83795_write(W83795_REG_FCMS1, 0xFF);
+ printk(BIOS_INFO, "W83795G/ADG work in Speed Cruise Mode\n");
+ } else {
+ w83795_write(W83795_REG_FCMS1, 0x00);
+ if (mode == THERMAL_CRUISE_MODE) {
+ w83795_write(W83795_REG_FCMS2, 0x00);
+ printk(BIOS_INFO, "W83795G/ADG work in Thermal Cruise Mode\n");
+ } else if (mode == SMART_FAN_MODE) {
+ w83795_write(W83795_REG_FCMS2, 0x3F);
+ printk(BIOS_INFO, "W83795G/ADG work in Smart Fan Mode\n");
+ } else {
+ printk(BIOS_INFO, "W83795G/ADG work in Manual Mode\n");
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static void w83795_set_tss(void)
+{
+ u8 val;
+
+ val = 0x00;
+ w83795_write(W83795_REG_TSS(0), val); /* Temp1, 2 */
+ w83795_write(W83795_REG_TSS(1), val); /* Temp3, 4 */
+ w83795_write(W83795_REG_TSS(2), val); /* Temp5, 6 */
+}
+
+static void w83795_set_fan(w83795_fan_mode_t mode)
+{
+ u8 i;
+
+ /* select temperature sensor (TSS)*/
+ w83795_set_tss();
+
+ /* select Temperature to Fan mapping Relationships (TFMR)*/
+ w83795_set_tfmr(mode);
+
+ /* set fan output controlled mode (FCMS)*/
+ w83795_set_fan_mode(mode);
+
+ /* Set Critical Temperature to Full Speed all fan (CTFS) */
+ for (i = 0; i < 6; i++) {
+ w83795_write(W83795_REG_CTFS(i), 0x50); /* default 80 celsius degree */
+ }
+
+ if (mode == THERMAL_CRUISE_MODE) {
+ /* Set Target Temperature of Temperature Inputs (TTTI) */
+ for (i = 0; i < 6; i++) {
+ w83795_write(W83795_REG_TTTI(i), 0x28); /* default 40 celsius degree */
+ }
+ } else if (mode == SMART_FAN_MODE) {
+ /* Set the Relative Register-at SMART FAN IV Control Mode Table */
+ //SFIV TODO
+ }
+
+ /* Set Hystersis of Temperature (HT) */
+}
+
+void w83795_init(w83795_fan_mode_t mode, u8 dts_src)
+{
+ u8 i;
+ u8 val;
+
+ if (do_smbus_read_byte(SMBUS_IO_BASE, W83795_DEV, 0x00) < 0) {
+ printk(BIOS_INFO, "W83795G/ADG Nuvoton H/W Monitor not found\n");
+ return;
+ }
+ val = w83795_read(W83795_REG_CONFIG);
+ if ((val & W83795_REG_CONFIG_CONFIG48) == 0)
+ printk(BIOS_INFO, "Found 64 pin W83795G Nuvoton H/W Monitor\n");
+ else if ((val & W83795_REG_CONFIG_CONFIG48) == 1)
+ printk(BIOS_INFO, "Found 48 pin W83795ADG Nuvoton H/W Monitor\n");
+
+ /* Reset */
+ val |= W83795_REG_CONFIG_INIT;
+ w83795_write(W83795_REG_CONFIG, val);
+
+ /* Fan monitoring setting */
+ val = 0xFF; /* FAN1-FAN8 */
+ w83795_write(W83795_REG_FANIN_CTRL1, val);
+ val = 0x3F; /* FAN9-FAN14 */
+ w83795_write(W83795_REG_FANIN_CTRL2, val);
+
+ /* enable monitoring operations */
+ val = w83795_read(W83795_REG_CONFIG);
+ val |= W83795_REG_CONFIG_START;
+ w83795_write(W83795_REG_CONFIG, val);
+
+ w83795_dts_enable(dts_src);
+ w83795_set_fan(mode);
+
+ printk(BIOS_INFO, "Fan CTFS(celsius) TTTI(celsius)\n");
+ for (i = 0; i < 6; i++) {
+ val = w83795_read(W83795_REG_CTFS(i));
+ printk(BIOS_INFO, " %x %d", i, val);
+ val = w83795_read(W83795_REG_TTTI(i));
+ printk(BIOS_INFO, " %d\n", val);
+ }
+
+ /* Temperature ReadOut */
+ for (i = 0; i < 9; i++) {
+ val = w83795_read(W83795_REG_DTS(i));
+ printk(BIOS_DEBUG, "DTS%x ReadOut=%x \n", i, val);
+ }
+}
+
diff --git a/src/mainboard/supermicro/h8qgi/w83795.h b/src/mainboard/supermicro/h8qgi/w83795.h
new file mode 100644
index 0000000..abc4d62
--- /dev/null
+++ b/src/mainboard/supermicro/h8qgi/w83795.h
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _W83795_H_
+#define _W83795_H_
+
+#define W83795_DEV 0x2F /* Host I2c Addr (strap to addr1 addr0 1 1, 0x5E) */
+
+#define W83795_REG_I2C_ADDR 0xFC
+#define W83795_REG_BANKSEL 0x00
+#define W83795_REG_CONFIG 0x01
+#define W83795_REG_CONFIG_START 0x01
+#define W83795_REG_CONFIG_CONFIG48 0x04
+#define W83795_REG_CONFIG_INIT 0x80
+
+#define W83795_REG_TEMP_CTRL1 0x04 /* Temperature Monitoring Control Register */
+#define W83795_REG_TEMP_CTRL2 0x05 /* Temperature Monitoring Control Register */
+#define W83795_REG_FANIN_CTRL1 0x06
+#define W83795_REG_FANIN_CTRL2 0x07
+#define W83795_REG_TEMP_CTRL1_EN_DTS 0x20 /* Enable DTS (Digital Temperature Sensor) interface from INTEL PECI or AMD SB-TSI. */
+#define DTS_SRC_INTEL_PECI (0 << 0)
+#define DTS_SRC_AMD_SBTSI (1 << 0)
+
+#define W83795_REG_TSS(n) (0x209 + (n)) /* Temperature Source Selection Register */
+#define W83795_REG_TTTI(n) (0x260 + (n)) /* tarrget temperature W83795G/ADG will try to tune the fan output to keep */
+#define W83795_REG_CTFS(n) (0x268 + (n)) /* Critical Temperature to Full Speed all fan */
+#define W83795_REG_HT(n) (0x270 + (n)) /* Hystersis of Temperature */
+#define W83795_REG_DTSC 0x301 /* Digital Temperature Sensor Configuration */
+
+#define W83795_REG_DTSE 0x302 /* Digital Temperature Sensor Enable */
+#define W83795_REG_DTS(n) (0x26 + (n))
+#define W83795_REG_VRLSB 0x3C
+
+#define W83795_TEMP_REG_TR1 0x21
+#define W83795_TEMP_REG_TR2 0x22
+#define W83795_TEMP_REG_TR3 0x23
+#define W83795_TEMP_REG_TR4 0x24
+#define W83795_TEMP_REG_TR5 0x1F
+#define W83795_TEMP_REG_TR6 0x20
+
+#define W83795_REG_FCMS1 0x201
+#define W83795_REG_FCMS2 0x208
+#define W83795_REG_TFMR(n) (0x202 + (n)) /*temperature to fam mappig*/
+#define W83795_REG_DFSP 0x20C
+
+#define W83795_REG_FTSH(n) (0x240 + (n) * 2)
+#define W83795_REG_FTSL(n) (0x241 + (n) * 2)
+#define W83795_REG_TFTS 0x250
+
+typedef enum w83795_fan_mode {
+ SPEED_CRUISE_MODE, ///< Fan Speed Cruise mode keeps the fan speed in a specified range
+ THERMAL_CRUISE_MODE, ///< Thermal Cruise mode is an algorithm to control the fan speed to keep the temperature source around the TTTI
+ SMART_FAN_MODE, ///< Smart Fan mode offers 6 slopes to control the fan speed
+ MANUAL_MODE, ///< control manually
+} w83795_fan_mode_t;
+
+void w83795_init(w83795_fan_mode_t mode, u8 dts_src);
+
+#endif
Kerry Sheh (shekairui(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/559
-gerrit
commit b0e96d64eaf3a7efaf11c23b6c915ad3ed118fd8
Author: Kerry Sheh <shekairui(a)gmail.com>
Date: Tue Jan 31 20:42:12 2012 +0800
RD890: AMD RD890/SR56X0 CIMX wrapper
Support AMD RD890 CIMX support AMD RD890TV, RX780, RD780, SR56x0,
RD890 and 990FX chipsets.
Change-Id: I39dc5fc316fbb465808bac48a13a49b7d867f04f
Signed-off-by: Kerry Sheh <kerry.she(a)amd.com>
Signed-off-by: Kerry Sheh <shekairui(a)gmail.com>
---
src/northbridge/amd/Kconfig | 1 +
src/northbridge/amd/Makefile.inc | 1 +
src/northbridge/amd/cimx/Kconfig | 24 ++
src/northbridge/amd/cimx/Makefile.inc | 20 ++
src/northbridge/amd/cimx/rd890/Kconfig | 33 +++
src/northbridge/amd/cimx/rd890/Makefile.inc | 26 ++
src/northbridge/amd/cimx/rd890/NbPlatform.h | 147 ++++++++++
src/northbridge/amd/cimx/rd890/amd.h | 385 +++++++++++++++++++++++++++
src/northbridge/amd/cimx/rd890/cbtypes.h | 71 +++++
src/northbridge/amd/cimx/rd890/chip.h | 38 +++
src/northbridge/amd/cimx/rd890/early.c | 113 ++++++++
src/northbridge/amd/cimx/rd890/late.c | 269 +++++++++++++++++++
src/northbridge/amd/cimx/rd890/nb_cimx.h | 44 +++
13 files changed, 1172 insertions(+), 0 deletions(-)
diff --git a/src/northbridge/amd/Kconfig b/src/northbridge/amd/Kconfig
index 4a120ca..33e19c2 100644
--- a/src/northbridge/amd/Kconfig
+++ b/src/northbridge/amd/Kconfig
@@ -4,6 +4,7 @@ source src/northbridge/amd/gx2/Kconfig
source src/northbridge/amd/amdfam10/Kconfig
source src/northbridge/amd/lx/Kconfig
source src/northbridge/amd/agesa/Kconfig
+source src/northbridge/amd/cimx/Kconfig
menu "HyperTransport setup"
#could be implemented for K8 (NORTHBRIDGE_AMD_AMDK8)
depends on (NORTHBRIDGE_AMD_AMDFAM10) && EXPERT
diff --git a/src/northbridge/amd/Makefile.inc b/src/northbridge/amd/Makefile.inc
index bf96b80..c438473 100644
--- a/src/northbridge/amd/Makefile.inc
+++ b/src/northbridge/amd/Makefile.inc
@@ -5,3 +5,4 @@ subdirs-$(CONFIG_NORTHBRIDGE_AMD_GX2) += gx2
subdirs-$(CONFIG_NORTHBRIDGE_AMD_LX) += lx
subdirs-$(CONFIG_AMD_AGESA) += agesa
+subdirs-$(CONFIG_AMD_NB_CIMX) += cimx
diff --git a/src/northbridge/amd/cimx/Kconfig b/src/northbridge/amd/cimx/Kconfig
new file mode 100644
index 0000000..6751bd4
--- /dev/null
+++ b/src/northbridge/amd/cimx/Kconfig
@@ -0,0 +1,24 @@
+#
+# This file is part of the coreboot project.
+#
+#Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+config AMD_NB_CIMX
+ bool
+ default n
+
+source src/northbridge/amd/cimx/rd890/Kconfig
diff --git a/src/northbridge/amd/cimx/Makefile.inc b/src/northbridge/amd/cimx/Makefile.inc
new file mode 100644
index 0000000..80844c8
--- /dev/null
+++ b/src/northbridge/amd/cimx/Makefile.inc
@@ -0,0 +1,20 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+subdirs-$(CONFIG_NORTHBRIDGE_AMD_CIMX_RD890) += rd890
diff --git a/src/northbridge/amd/cimx/rd890/Kconfig b/src/northbridge/amd/cimx/rd890/Kconfig
new file mode 100644
index 0000000..6731b60
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/Kconfig
@@ -0,0 +1,33 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+config NORTHBRIDGE_AMD_CIMX_RD890
+ bool
+ default n
+ select AMD_NB_CIMX
+
+config REDIRECT_NBCIMX_TRACE_TO_SERIAL
+ bool "Redirect AMD Northbridge CIMX Trace to serial console"
+ default n
+ depends on NORTHBRIDGE_AMD_CIMX_RD890
+ help
+ This Option allows you to redirect the AMD Northbridge CIMX
+ Trace debug information to the serial console.
+
+ Warning: Only enable this option when debuging or tracing AMD CIMX code.
diff --git a/src/northbridge/amd/cimx/rd890/Makefile.inc b/src/northbridge/amd/cimx/rd890/Makefile.inc
new file mode 100644
index 0000000..c3a5084
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/Makefile.inc
@@ -0,0 +1,26 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+subdirs-$(CONFIG_NORTHBRIDGE_AMD_CIMX_RD890) += ../../../../../src/vendorcode/amd/cimx/rd890
+
+# RD890 Platform Files
+romstage-y += early.c
+
+ramstage-y += late.c
+
diff --git a/src/northbridge/amd/cimx/rd890/NbPlatform.h b/src/northbridge/amd/cimx/rd890/NbPlatform.h
new file mode 100644
index 0000000..824057a
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/NbPlatform.h
@@ -0,0 +1,147 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _NB_PLATFORM_H_
+#define _NB_PLATFORM_H_
+
+#define SERIAL_OUT_SUPPORT //enable serial output
+#define CIMX_DEBUG
+
+#ifdef CIMX_DEBUG
+#define CIMX_TRACE_SUPPORT
+#define CIMX_ASSERT_SUPPORT
+#endif
+
+#ifdef CIMX_TRACE_SUPPORT
+ #define CIMX_INIT_TRACE(Arguments)
+ #if CONFIG_REDIRECT_NBCIMX_TRACE_TO_SERIAL
+ #define TRACE_DATA(Ptr, Level) BIOS_DEBUG //always enable
+ #define CIMX_TRACE(Argument) do {do_printk Argument;} while (0)
+ #else
+ #define TRACE_DATA(Ptr, Level)
+ #define CIMX_TRACE(Argument)
+ #endif
+#else
+ #define CIMX_TRACE(Argument)
+ #define CIMX_INIT_TRACE(Arguments)
+#endif
+
+#ifdef CIMX_ASSERT_SUPPORT
+ #ifdef ASSERT
+ #undef ASSERT
+ #define ASSERT CIMX_ASSERT
+ #endif
+ #ifdef CIMX_TRACE_SUPPORT
+ #define CIMX_ASSERT(x) if(!(x)) {\
+ LibAmdTraceDebug (CIMX_TRACE_ALL, (CHAR8 *)"ASSERT !!! "__FILE__" - line %d\n", __LINE__); \
+ /*__asm {jmp $}; */\
+ }
+ //#define IDS_HDT_CONSOLE(s, args...) do_printk(BIOS_DEBUG, s, ##args)
+ #else
+ #define CIMX_ASSERT(x) if(!(x)) {\
+ /*__asm {jmp $}; */\
+ }
+ #endif
+#else
+ #define CIMX_ASSERT(x)
+#endif
+
+/*----------------------------------------------------------------------------------------
+ * E X P O R T E D F U N C T I O N S
+ *----------------------------------------------------------------------------------------
+ */
+
+//#define STALL(Ptr, TimeUs, Flag) LibAmdSbStall(TimeUs)
+#define STALL(Ptr, TimeUs, Flag) LibAmdSbStall(TimeUs, Ptr)
+
+#ifdef B2_IMAGE
+#define REPORT_EVENT(Class, Info, Param1, Param2, Param3, Param4, CfgPtr) LibNbEventLog(Class, Info, Param1, Param2, Param3, Param4, CfgPtr)
+#else
+#define REPORT_EVENT(Class, Info, Param1, Param2, Param3, Param4, CfgPtr)
+#endif
+
+
+
+// CIMX configuration parameters
+//#define CIMX_B2_IMAGE_BASE_ADDRESS 0xFFF40000
+/**
+ * PCIEX_BASE_ADDRESS - Define PCIE base address
+ *
+ * @param[Option] MOVE_PCIEBAR_TO_F0000000 Set PCIe base address to 0xF7000000
+ */
+#ifdef MOVE_PCIEBAR_TO_F0000000
+#define PCIEX_BASE_ADDRESS 0xF7000000
+#else
+#define PCIEX_BASE_ADDRESS CONFIG_MMCONF_BASE_ADDRESS
+#endif
+
+
+
+#define CIMX_S3_SAVE 1
+#include "cbtypes.h"
+#include <console/console.h>
+
+#include "amd.h" //cimx typedef
+#include <amdlib.h>
+#include "amdAcpiLib.h"
+#include "amdAcpiMadt.h"
+#include "amdAcpiIvrs.h"
+#include "amdSbLib.h"
+#include "nbPcie.h"
+
+//must put before the nbType.h
+#include "platform_cfg.h" /*platform dependented configuration */
+#include "nbType.h"
+
+#include "nbLib.h"
+#include "nbDef.h"
+#include "nbInit.h"
+#include "nbHtInit.h"
+#include "nbIommu.h"
+#include "nbEventLog.h"
+#include "nbRegisters.h"
+#include "nbPcieAspm.h"
+#include "nbPcieLinkWidth.h"
+#include "nbPcieHotplug.h"
+#include "nbPciePortRemap.h"
+#include "nbPcieWorkarounds.h"
+#include "nbPcieCplBuffers.h"
+#include "nbPciePllControl.h"
+#include "nbMiscInit.h"
+#include "nbIoApic.h"
+#include "nbPcieSb.h"
+#include "nbRecovery.h"
+#include "nbMaskedMemoryInit.h"
+
+
+#define FIX_PTR_ADDR(x, y) x
+
+#define TRACE_ALWAYS 0xffffffff
+
+#define AmdNbDispatcher NULL
+
+#define CIMX_TRACE_ALL 0xFFFFFFFF
+#define CIMX_NBPOR_TRACE 0xFFFFFFFF
+#define CIMX_NBHT_TRACE 0xFFFFFFFF
+#define CIMX_NBPCIE_TRACE 0xFFFFFFFF
+#define CIMX_NB_TRACE 0xFFFFFFFF
+#define CIMX_NBPCIE_MISC 0xFFFFFFFF
+
+#endif
+
diff --git a/src/northbridge/amd/cimx/rd890/amd.h b/src/northbridge/amd/cimx/rd890/amd.h
new file mode 100644
index 0000000..d99f90f
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/amd.h
@@ -0,0 +1,385 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _AMD_H_
+#define _AMD_H_
+
+#include "cbtypes.h"
+
+
+#define VOLATILE volatile
+#define CALLCONV
+#define ROMDATA
+#define CIMXAPI EFIAPI
+
+//
+//
+// AGESA Types and Definitions
+//
+//
+#ifndef NULL
+ #define NULL 0
+#endif
+
+
+#define LAST_ENTRY 0xFFFFFFFF
+#define IOCF8 0xCF8
+#define IOCFC 0xCFC
+#define IN
+#define OUT
+#define IMAGE_SIGNATURE 'DMA$'
+
+typedef UINTN AGESA_STATUS;
+
+
+#define AGESA_SUCCESS ((AGESA_STATUS) 0x0)
+#define AGESA_ALERT ((AGESA_STATUS) 0x40000000)
+#define AGESA_WARNING ((AGESA_STATUS) 0x40000001)
+#define AGESA_UNSUPPORTED ((AGESA_STATUS) 0x80000003)
+#define AGESA_ERROR ((AGESA_STATUS) 0xC0000001)
+#define AGESA_CRITICAL ((AGESA_STATUS) 0xC0000002)
+#define AGESA_FATAL ((AGESA_STATUS) 0xC0000003)
+
+typedef AGESA_STATUS (*CALLOUT_ENTRY) (UINT32 Param1, UINTN Param2, VOID* ConfigPtr);
+typedef AGESA_STATUS (*IMAGE_ENTRY) (IN OUT VOID* ConfigPtr);
+typedef AGESA_STATUS (*MODULE_ENTRY) (IN OUT VOID* ConfigPtr);
+
+///This allocation type is used by the AmdCreateStruct entry point
+typedef enum {
+ PreMemHeap = 0, ///< Create heap in cache.
+ PostMemDram, ///< Create heap in memory.
+ ByHost ///< Create heap by Host.
+} ALLOCATION_METHOD;
+
+/// These width descriptors are used by the library function, and others, to specify the data size
+typedef enum ACCESS_WIDTH {
+ AccessWidth8 = 1, ///< Access width is 8 bits.
+ AccessWidth16, ///< Access width is 16 bits.
+ AccessWidth32, ///< Access width is 32 bits.
+ AccessWidth64, ///< Access width is 64 bits.
+
+ AccessS3SaveWidth8 = 0x81, ///< Save 8 bits data.
+ AccessS3SaveWidth16, ///< Save 16 bits data.
+ AccessS3SaveWidth32, ///< Save 32 bits data.
+ AccessS3SaveWidth64, ///< Save 64 bits data.
+} ACCESS_WIDTH;
+
+
+// AGESA Structures
+/// The standard header AMD NB UEFI drivers
+typedef struct _AMD_CONFIG_PARAMS {
+ VOID **PeiServices; ///< Pointer to PEI service table
+ VOID *StallPpi; ///< Pointer to Stall PPI
+// UINT32 Func;
+ VOID *PcieBasePtr; ///< TBD
+ CALLOUT_ENTRY CalloutPtr; ///<pointer to local driver callback function
+ CALLOUT_ENTRY InterfaceCalloutPtr; ///<pointer to external interface driver callback function
+} AMD_CONFIG_PARAMS;
+
+
+/// AGESA Binary module header structure
+typedef struct _AMD_IMAGE_HEADER {
+ IN UINT32 Signature; ///< Binary Signature
+ IN CHAR8 CreatorID[8]; ///< 8 characters ID
+ IN CHAR8 Version[12]; ///< 12 characters version
+ IN UINT32 ModuleInfoOffset; ///< Offset of module
+ IN UINT32 EntryPointAddress; ///< Entry address
+ IN UINT32 ImageBase; ///< Image base
+ IN UINT32 RelocTableOffset; ///< Relocate Table offset
+ IN UINT32 ImageSize; ///< Size
+ IN UINT16 Checksum; ///< Checksum
+ IN UINT8 ImageType; ///< Type
+ IN UINT8 V_Reserved; ///< Reserved
+} AMD_IMAGE_HEADER;
+
+
+/// AGESA Binary module header structure
+typedef struct _AMD_MODULE_HEADER {
+ IN UINT32 ModuleHeaderSignature; ///< Module signature
+ IN CHAR8 ModuleIdentifier[8]; ///< 8 characters ID
+ IN CHAR8 ModuleVersion[12]; ///< 12 characters version
+ IN MODULE_ENTRY ModuleDispatcherPtr; ///< A pointer point to dispatcher
+ IN struct _AMD_MODULE_HEADER *NextBlockPtr; ///< Next module header link
+} AMD_MODULE_HEADER;
+
+/// Extended PCI address format
+typedef struct {
+ IN OUT UINT32 Register:12; ///< Register offset
+ IN OUT UINT32 Function:3; ///< Function number
+ IN OUT UINT32 Device:5; ///< Device number
+ IN OUT UINT32 Bus:8; ///< Bus number
+ IN OUT UINT32 Segment:4; ///< Segment
+} EXT_PCI_ADDR;
+
+/// Union type for PCI address
+typedef union _PCI_ADDR {
+ IN UINT32 AddressValue; ///< Formal address
+ IN EXT_PCI_ADDR Address; ///< Extended address
+} PCI_ADDR;
+
+#define FUNC_0 0 // bit-placed for PCI address creation
+#define FUNC_1 1
+#define FUNC_2 2
+#define FUNC_3 3
+#define FUNC_4 4
+#define FUNC_5 5
+#define FUNC_6 6
+#define FUNC_7 7
+
+// SBDFO - Segment Bus Device Function Offset
+// 31:28 Segment (4-bits)
+// 27:20 Bus (8-bits)
+// 19:15 Device (5-bits)
+// 14:12 Function(3-bits)
+// 11:00 Offset (12-bits)
+
+#define MAKE_SBDFO(Seg, Bus, Dev, Fun, Off) ((((UINT32) (Seg)) << 28) | (((UINT32) (Bus)) << 20) | \
+ (((UINT32)(Dev)) << 15) | (((UINT32)(Fun)) << 12) | ((UINT32)(Off)))
+#define ILLEGAL_SBDFO 0xFFFFFFFF
+
+/// CPUID data received registers format
+typedef struct _CPUID_DATA {
+ IN OUT UINT32 EAX_Reg; ///< CPUID instruction result in EAX
+ IN OUT UINT32 EBX_Reg; ///< CPUID instruction result in EBX
+ IN OUT UINT32 ECX_Reg; ///< CPUID instruction result in ECX
+ IN OUT UINT32 EDX_Reg; ///< CPUID instruction result in EDX
+} CPUID_DATA;
+
+#define WARM_RESET 1
+#define COLD_RESET 2
+
+/// HT frequency for external callbacks
+typedef enum {
+ HT_FREQUENCY_200M = 0, ///< HT speed 200 for external callbacks
+ HT_FREQUENCY_400M = 2, ///< HT speed 400 for external callbacks
+ HT_FREQUENCY_600M = 4, ///< HT speed 600 for external callbacks
+ HT_FREQUENCY_800M = 5, ///< HT speed 800 for external callbacks
+ HT_FREQUENCY_1000M = 6, ///< HT speed 1000 for external callbacks
+ HT_FREQUENCY_1200M = 7, ///< HT speed 1200 for external callbacks
+ HT_FREQUENCY_1400M = 8, ///< HT speed 1400 for external callbacks
+ HT_FREQUENCY_1600M = 9, ///< HT speed 1600 for external callbacks
+ HT_FREQUENCY_1800M = 10, ///< HT speed 1800 for external callbacks
+ HT_FREQUENCY_2000M = 11, ///< HT speed 2000 for external callbacks
+ HT_FREQUENCY_2200M = 12, ///< HT speed 2200 for external callbacks
+ HT_FREQUENCY_2400M = 13, ///< HT speed 2400 for external callbacks
+ HT_FREQUENCY_2600M = 14, ///< HT speed 2600 for external callbacks
+ HT_FREQUENCY_2800M = 17, ///< HT speed 2800 for external callbacks
+ HT_FREQUENCY_3000M = 18, ///< HT speed 3000 for external callbacks
+ HT_FREQUENCY_3200M = 19 ///< HT speed 3200 for external callbacks
+} HT_FREQUENCIES;
+
+#ifndef BIT0
+ #define BIT0 0x0000000000000001ull
+#endif
+#ifndef BIT1
+ #define BIT1 0x0000000000000002ull
+#endif
+#ifndef BIT2
+ #define BIT2 0x0000000000000004ull
+#endif
+#ifndef BIT3
+ #define BIT3 0x0000000000000008ull
+#endif
+#ifndef BIT4
+ #define BIT4 0x0000000000000010ull
+#endif
+#ifndef BIT5
+ #define BIT5 0x0000000000000020ull
+#endif
+#ifndef BIT6
+ #define BIT6 0x0000000000000040ull
+#endif
+#ifndef BIT7
+ #define BIT7 0x0000000000000080ull
+#endif
+#ifndef BIT8
+ #define BIT8 0x0000000000000100ull
+#endif
+#ifndef BIT9
+ #define BIT9 0x0000000000000200ull
+#endif
+#ifndef BIT10
+ #define BIT10 0x0000000000000400ull
+#endif
+#ifndef BIT11
+ #define BIT11 0x0000000000000800ull
+#endif
+#ifndef BIT12
+ #define BIT12 0x0000000000001000ull
+#endif
+#ifndef BIT13
+ #define BIT13 0x0000000000002000ull
+#endif
+#ifndef BIT14
+ #define BIT14 0x0000000000004000ull
+#endif
+#ifndef BIT15
+ #define BIT15 0x0000000000008000ull
+#endif
+#ifndef BIT16
+ #define BIT16 0x0000000000010000ull
+#endif
+#ifndef BIT17
+ #define BIT17 0x0000000000020000ull
+#endif
+#ifndef BIT18
+ #define BIT18 0x0000000000040000ull
+#endif
+#ifndef BIT19
+ #define BIT19 0x0000000000080000ull
+#endif
+#ifndef BIT20
+ #define BIT20 0x0000000000100000ull
+#endif
+#ifndef BIT21
+ #define BIT21 0x0000000000200000ull
+#endif
+#ifndef BIT22
+ #define BIT22 0x0000000000400000ull
+#endif
+#ifndef BIT23
+ #define BIT23 0x0000000000800000ull
+#endif
+#ifndef BIT24
+ #define BIT24 0x0000000001000000ull
+#endif
+#ifndef BIT25
+ #define BIT25 0x0000000002000000ull
+#endif
+#ifndef BIT26
+ #define BIT26 0x0000000004000000ull
+#endif
+#ifndef BIT27
+ #define BIT27 0x0000000008000000ull
+#endif
+#ifndef BIT28
+ #define BIT28 0x0000000010000000ull
+#endif
+#ifndef BIT29
+ #define BIT29 0x0000000020000000ull
+#endif
+#ifndef BIT30
+ #define BIT30 0x0000000040000000ull
+#endif
+#ifndef BIT31
+ #define BIT31 0x0000000080000000ull
+#endif
+#ifndef BIT32
+ #define BIT32 0x0000000100000000ull
+#endif
+#ifndef BIT33
+ #define BIT33 0x0000000200000000ull
+#endif
+#ifndef BIT34
+ #define BIT34 0x0000000400000000ull
+#endif
+#ifndef BIT35
+ #define BIT35 0x0000000800000000ull
+#endif
+#ifndef BIT36
+ #define BIT36 0x0000001000000000ull
+#endif
+#ifndef BIT37
+ #define BIT37 0x0000002000000000ull
+#endif
+#ifndef BIT38
+ #define BIT38 0x0000004000000000ull
+#endif
+#ifndef BIT39
+ #define BIT39 0x0000008000000000ull
+#endif
+#ifndef BIT40
+ #define BIT40 0x0000010000000000ull
+#endif
+#ifndef BIT41
+ #define BIT41 0x0000020000000000ull
+#endif
+#ifndef BIT42
+ #define BIT42 0x0000040000000000ull
+#endif
+#ifndef BIT43
+ #define BIT43 0x0000080000000000ull
+#endif
+#ifndef BIT44
+ #define BIT44 0x0000100000000000ull
+#endif
+#ifndef BIT45
+ #define BIT45 0x0000200000000000ull
+#endif
+#ifndef BIT46
+ #define BIT46 0x0000400000000000ull
+#endif
+#ifndef BIT47
+ #define BIT47 0x0000800000000000ull
+#endif
+#ifndef BIT48
+ #define BIT48 0x0001000000000000ull
+#endif
+#ifndef BIT49
+ #define BIT49 0x0002000000000000ull
+#endif
+#ifndef BIT50
+ #define BIT50 0x0004000000000000ull
+#endif
+#ifndef BIT51
+ #define BIT51 0x0008000000000000ull
+#endif
+#ifndef BIT52
+ #define BIT52 0x0010000000000000ull
+#endif
+#ifndef BIT53
+ #define BIT53 0x0020000000000000ull
+#endif
+#ifndef BIT54
+ #define BIT54 0x0040000000000000ull
+#endif
+#ifndef BIT55
+ #define BIT55 0x0080000000000000ull
+#endif
+#ifndef BIT56
+ #define BIT56 0x0100000000000000ull
+#endif
+#ifndef BIT57
+ #define BIT57 0x0200000000000000ull
+#endif
+#ifndef BIT58
+ #define BIT58 0x0400000000000000ull
+#endif
+#ifndef BIT59
+ #define BIT59 0x0800000000000000ull
+#endif
+#ifndef BIT60
+ #define BIT60 0x1000000000000000ull
+#endif
+#ifndef BIT61
+ #define BIT61 0x2000000000000000ull
+#endif
+#ifndef BIT62
+ #define BIT62 0x4000000000000000ull
+#endif
+#ifndef BIT63
+ #define BIT63 0x8000000000000000ull
+#endif
+
+#ifdef ASSERT
+ #undef ASSERT
+ #define ASSERT(x)
+#endif
+
+#endif
diff --git a/src/northbridge/amd/cimx/rd890/cbtypes.h b/src/northbridge/amd/cimx/rd890/cbtypes.h
new file mode 100644
index 0000000..ade55d7
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/cbtypes.h
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2010 - 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _CBTYPES_H_
+#define _CBTYPES_H_
+
+//#include <stdint.h>
+
+/*
+typedef int64_t __int64;
+typedef void VOID;
+typedef uint32_t UINTN;//
+typedef int8_t CHAR8;
+typedef uint8_t UINT8;
+typedef uint16_t UINT16;
+typedef uint32_t UINT32;
+typedef uint64_t UINT64;
+*/
+typedef signed long long __int64;
+typedef void VOID;
+typedef unsigned int UINTN;//
+typedef signed char CHAR8;
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef unsigned int UINT32;
+typedef signed int INT32;
+typedef unsigned long long UINT64;
+
+#define TRUE 1
+#define FALSE 0
+typedef unsigned char BOOLEAN;
+
+#ifndef VOLATILE
+#define VOLATILE volatile
+#endif
+
+#ifndef IN
+#define IN
+#endif
+#ifndef OUT
+#define OUT
+#endif
+
+//porting.h
+#ifndef CONST
+#define CONST const
+#endif
+#ifndef STATIC
+#define STATIC static
+#endif
+#ifndef VOLATILE
+#define VOLATILE volatile
+#endif
+
+#endif
diff --git a/src/northbridge/amd/cimx/rd890/chip.h b/src/northbridge/amd/cimx/rd890/chip.h
new file mode 100644
index 0000000..c2f985b
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/chip.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef _CIMX_RD890_CHIP_H_
+#define _CIMX_RD890_CHIP_H_
+
+extern struct chip_operations northbridge_amd_cimx_rd890_ops;
+
+/**
+ * RD890 specific device configuration
+ */
+struct northbridge_amd_cimx_rd890_config
+{
+ u8 gpp1_configuration;
+ u8 gpp2_configuration;
+ u8 gpp3a_configuration;
+ u16 port_enable;
+};
+
+#endif /* _CIMX_RD890_CHIP_H_ */
+
diff --git a/src/northbridge/amd/cimx/rd890/early.c b/src/northbridge/amd/cimx/rd890/early.c
new file mode 100644
index 0000000..8008223
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/early.c
@@ -0,0 +1,113 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include "NbPlatform.h"
+#include "rd890_cfg.h"
+#include "nb_cimx.h"
+
+
+/**
+ * @brief disable GPP1 Port0,1, GPP2, GPP3a Port0,1,2,3,4,5, GPP3b
+ *
+ * SR5650/5670/5690 RD890 chipset, read pci config space hang at POR,
+ * Disable all Pcie Bridges to work around It.
+ */
+void sr56x0_rd890_disable_pcie_bridge(void)
+{
+ u32 nb_dev;
+ u32 mask;
+ u32 val;
+ AMD_NB_CONFIG_BLOCK cfg_block;
+ AMD_NB_CONFIG_BLOCK *cfg_ptr = &cfg_block;
+ AMD_NB_CONFIG *nb_cfg = &(cfg_block.Northbridges[0]);
+
+ nb_cfg->ConfigPtr = &cfg_ptr;
+ nb_dev = MAKE_SBDFO(0, 0x0, 0x0, 0x0, 0x0);
+ val = (1 << 2) | (1 << 3); /*GPP1*/
+ val |= (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 16) | (1 << 17); /*GPP3a*/
+ val |= (1 << 18) | (1 << 19); /*GPP2*/
+ val |= (1 << 20); /*GPP3b*/
+ mask = ~val;
+ LibNbPciIndexRMW(nb_dev | NB_MISC_INDEX, NB_MISC_REG0C,
+ AccessS3SaveWidth32,
+ mask,
+ val,
+ nb_cfg);
+}
+
+
+/**
+ * @brief South Bridge CIMx romstage entry,
+ * wrapper of AmdPowerOnResetInit entry point.
+ */
+void nb_Poweron_Init(void)
+{
+ NB_CONFIG nb_cfg[MAX_NB_COUNT];
+ HT_CONFIG ht_cfg[MAX_NB_COUNT];
+ PCIE_CONFIG pcie_cfg[MAX_NB_COUNT];
+ AMD_NB_CONFIG_BLOCK gConfig;
+ AMD_NB_CONFIG_BLOCK *ConfigPtr = &gConfig;
+ AGESA_STATUS status;
+
+ printk(BIOS_DEBUG, "cimx/rd890 early.c %s() Start\n", __func__);
+ CIMX_INIT_TRACE();
+ CIMX_TRACE((BIOS_DEBUG, "NbPowerOnResetInit entry\n"));
+ rd890_cimx_config(&gConfig, &nb_cfg[0], &ht_cfg[0], &pcie_cfg[0]);
+
+ if (ConfigPtr->StandardHeader.CalloutPtr != NULL) {
+ ConfigPtr->StandardHeader.CalloutPtr(CB_AmdSetNbPorConfig, 0, &gConfig);
+ }
+
+ status = AmdPowerOnResetInit(&gConfig);
+ printk(BIOS_DEBUG, "cimx/rd890 early.c %s() End. return status=%x\n", __func__, status);
+}
+
+/**
+ * @brief South Bridge CIMx romstage entry,
+ * wrapper of AmdHtInit entry point.
+ */
+void nb_Ht_Init(void)
+{
+ AGESA_STATUS status;
+ NB_CONFIG nb_cfg[MAX_NB_COUNT];
+ HT_CONFIG ht_cfg[MAX_NB_COUNT];
+ PCIE_CONFIG pcie_cfg[MAX_NB_COUNT];
+ AMD_NB_CONFIG_BLOCK gConfig;
+ AMD_NB_CONFIG_BLOCK *ConfigPtr = &gConfig;
+ u32 i;
+
+ rd890_cimx_config(&gConfig, &nb_cfg[0], &ht_cfg[0], &pcie_cfg[0]);
+
+ //Initialize HT structure
+ LibSystemApiCall(AmdHtInitializer, &gConfig);
+ for (i = 0; i < MAX_NB_COUNT; i ++) {
+ if (ConfigPtr->StandardHeader.CalloutPtr != NULL) {
+ ConfigPtr->StandardHeader.CalloutPtr(CB_AmdSetHtConfig, 0, (VOID*)&(gConfig.Northbridges[i]));
+ }
+ }
+
+ status = LibSystemApiCall(AmdHtInit, &gConfig);
+ printk(BIOS_DEBUG, "AmdHtInit status: %x\n", status);
+}
+
+void nb_S3_Init(void)
+{
+ //TODO
+}
diff --git a/src/northbridge/amd/cimx/rd890/late.c b/src/northbridge/amd/cimx/rd890/late.c
new file mode 100644
index 0000000..62a842a
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/late.c
@@ -0,0 +1,269 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <arch/ioapic.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include "NbPlatform.h"
+#include "nb_cimx.h"
+#include "rd890_cfg.h"
+
+
+/**
+ * Global RD890 CIMX Configuration structure
+ */
+static NB_CONFIG nb_cfg[MAX_NB_COUNT];
+static HT_CONFIG ht_cfg[MAX_NB_COUNT];
+static PCIE_CONFIG pcie_cfg[MAX_NB_COUNT];
+static AMD_NB_CONFIG_BLOCK gConfig;
+
+
+/**
+ * Reset PCIE Cores, Training the Ports selected by port_enable of devicetree
+ * After this call EP are fully operational on particular NB
+ */
+void nb_Pcie_Early_Init(void)
+{
+ LibSystemApiCall(AmdPcieEarlyInit, &gConfig); //AmdPcieEarlyInit(&gConfig);
+}
+
+void nb_Pcie_Late_Init(void)
+{
+ LibSystemApiCall(AmdPcieLateInit, &gConfig);
+}
+
+void nb_Early_Post_Init(void)
+{
+ LibSystemApiCall(AmdEarlyPostInit, &gConfig);
+}
+
+void nb_Mid_Post_Init(void)
+{
+ LibSystemApiCall(AmdMidPostInit, &gConfig);
+}
+
+void nb_Late_Post_Init(void)
+{
+ LibSystemApiCall(AmdLatePostInit, &gConfig);
+}
+
+static void rd890_enable(device_t dev)
+{
+ u32 address = 0;
+ u32 mask;
+ u32 val;
+ u32 devfn;
+ u32 port;
+ AMD_NB_CONFIG *NbConfigPtr = NULL;
+
+ u8 nb_index = 0; /* The first IO Hub, TODO: other NBs */
+ address = MAKE_SBDFO(0, 0x0, 0x0, 0x0, 0x0);
+ NbConfigPtr = &(gConfig.Northbridges[nb_index]);
+
+ devfn = dev->path.pci.devfn;
+ port = devfn >> 3;
+ printk(BIOS_INFO, "rd890_enable ");
+ printk(BIOS_INFO, "Bus-%x Dev-%X Fun-%X, enable=%x\n",
+ 0, (devfn >> 3), (devfn & 0x07), dev->enabled);
+ if (port != 0) {
+ if (dev->enabled) {
+ NbConfigPtr->pPcieConfig->PortConfiguration[port].ForcePortDisable = OFF;
+ } else {
+ NbConfigPtr->pPcieConfig->PortConfiguration[port].ForcePortDisable = ON;
+ }
+ }
+
+ switch (port) {
+ case 0x0: /* Root Complex, and ClkConfig */
+
+ if ((devfn & 0x07) == 1) { /* skip dev-0 fun-1 */
+ break;
+ }
+
+ /* CIMX configuration defualt initialize */
+ rd890_cimx_config(&gConfig, &nb_cfg[0], &ht_cfg[0], &pcie_cfg[0]);
+ if (gConfig.StandardHeader.CalloutPtr != NULL) {
+ /* NOTE: not use LibNbCallBack */
+ gConfig.StandardHeader.CalloutPtr(CB_AmdSetPcieEarlyConfig, (u32)dev, (VOID*)NbConfigPtr);
+ }
+ /* Reset PCIE Cores, Training the Ports selected by port_enable of devicetree
+ * After this call EP are fully operational on particular NB
+ */
+ nb_Pcie_Early_Init();
+ break;
+
+ case 0x2: /* Gpp1 Port0 */
+ case 0x3: /* Gpp1 Port1 */
+ mask = ~(1 << port);
+ val = (dev->enabled ? 0 : 1) << port;
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+ break;
+
+ case 0x4: /* Gpp3a Port0 */
+ case 0x5: /* Gpp3a Port1 */
+ case 0x6: /* Gpp3a Port2 */
+ case 0x7: /* Gpp3a Port3 */
+ mask = ~(1 << port);
+ val = (dev->enabled ? 0 : 1) << port;
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+ break;
+
+ case 0x8: /* SB ALink */
+ mask = ~(1 << 6);
+ val = (dev->enabled ? 1 : 0) << 6;
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+ break;
+
+ case 0x9: /* Gpp3a Port4 */
+ case 0xa: /* Gpp3a Port5 */
+ mask = ~(1 << (7 + port));
+ val = (dev->enabled ? 0 : 1) << (7 + port);
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+ break;
+
+ case 0xb: /* Gpp2 Port0 */
+ case 0xc: /* Gpp2 Port1 */
+ mask = ~(1 << (7 + port));
+ val = (dev->enabled ? 0 : 1) << (7 + port);
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+ break;
+
+ case 0xd: /* Gpp3b */
+ mask = ~(1 << (7 + port));
+ val = (dev->enabled ? 0 : 1) << (7 + port);
+ LibNbPciIndexRMW(address | NB_MISC_INDEX, NB_MISC_REG0C, AccessS3SaveWidth32, mask, val, NbConfigPtr);
+
+ /* Init NB at Early Post */
+ if (gConfig.StandardHeader.CalloutPtr != NULL) {
+ gConfig.StandardHeader.CalloutPtr(CB_AmdSetEarlyPostConfig, 0, (VOID*)NbConfigPtr);
+ }
+ nb_Early_Post_Init();//
+ if (gConfig.StandardHeader.CalloutPtr != NULL) {
+ gConfig.StandardHeader.CalloutPtr(CB_AmdSetMidPostConfig, 0, (VOID*)NbConfigPtr);
+ }
+ nb_Mid_Post_Init();
+ nb_Pcie_Late_Init();
+ if (gConfig.StandardHeader.CalloutPtr != NULL) {
+ gConfig.StandardHeader.CalloutPtr(CB_AmdSetLatePostConfig, 0, (VOID*)NbConfigPtr);
+ }
+ nb_Late_Post_Init();
+ break;
+
+ default:
+ printk(BIOS_INFO, "Buggy Device Tree\n");
+ break;
+ }
+}
+
+struct chip_operations northbridge_amd_cimx_rd890_ops = {
+ CHIP_NAME("ATI rd890")
+ .enable_dev = rd890_enable,
+};
+
+
+static void ioapic_init(struct device *dev)
+{
+ u32 ioapic_base;
+
+ pci_write_config32(dev, 0xF8, 0x1);
+ ioapic_base = pci_read_config32(dev, 0xFC) & 0xfffffff0;
+ setup_ioapic(ioapic_base, 1);
+}
+
+static void rd890_read_resource(struct device *dev)
+{
+ pci_dev_read_resources(dev);
+
+ /* rpr6.2.(1). Write the Base Address Register (BAR) */
+ pci_write_config32(dev, 0xF8, 0x1); /* set IOAPIC's index as 1 and make sure no one changes it. */
+ pci_get_resource(dev, 0xFC); /* APIC located in sr5690 */
+
+ compact_resources(dev);
+}
+
+/* If IOAPIC's index changes, we should replace the pci_dev_set_resource(). */
+static void rd890_set_resources(struct device *dev)
+{
+ pci_write_config32(dev, 0xF8, 0x1); /* set IOAPIC's index as 1 and make sure no one changes it. */
+ pci_dev_set_resources(dev);
+}
+
+static struct pci_operations lops_pci = {
+ .set_subsystem = pci_dev_set_subsystem,
+};
+
+static struct device_operations ht_ops = {
+ .read_resources = rd890_read_resource,
+ .set_resources = rd890_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = ioapic_init,
+ .scan_bus = 0,
+ .ops_pci = &lops_pci,
+};
+
+static const struct pci_driver ht_driver_sr5690 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_SR5690_HT,
+};
+
+static const struct pci_driver ht_driver_sr5670 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_SR5670_HT,
+};
+
+static const struct pci_driver ht_driver_sr5650 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_SR5650_HT,
+};
+
+static const struct pci_driver ht_driver_rd890tv __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_RD890TV_HT,
+};
+
+static const struct pci_driver ht_driver_rx780 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_RX780_HT,
+};
+
+static const struct pci_driver ht_driver_rd780 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_RD780_HT,
+};
+
+static const struct pci_driver ht_driver_rd890 __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_RD890_HT,
+};
+
+static const struct pci_driver ht_driver_990fx __pci_driver = {
+ .ops = &ht_ops,
+ .vendor = PCI_VENDOR_ID_ATI,
+ .device = PCI_DEVICE_ID_AMD_990FX_HT,
+};
diff --git a/src/northbridge/amd/cimx/rd890/nb_cimx.h b/src/northbridge/amd/cimx/rd890/nb_cimx.h
new file mode 100644
index 0000000..a6f77db
--- /dev/null
+++ b/src/northbridge/amd/cimx/rd890/nb_cimx.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _NB_CIMX_H_
+#define _NB_CIMX_H_
+
+/**
+ * @brief disable GPP1 Port0,1, GPP2, GPP3a Port0,1,2,3,4,5, GPP3b
+ *
+ * SR5650/5670/5690 RD890 chipset, read pci config space hang at POR,
+ * Disable all Pcie Bridges to work around It.
+ */
+void sr56x0_rd890_disable_pcie_bridge(void);
+
+/**
+ * Northbridge CIMX entries point
+ */
+void nb_Poweron_Init(void);
+void nb_Ht_Init(void);
+void nb_S3_Init(void);
+void nb_Early_Post_Init(void);
+void nb_Mid_Post_Init(void);
+void nb_Late_Post_Init(void);
+void nb_Pcie_Early_Init(void);
+void nb_Pcie_Late_Init(void);
+
+#endif//_RD890_EARLY_H_
+
Kerry Sheh (shekairui(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/562
-gerrit
commit 3203aa050b753dd1bf931fba462369cada510501
Author: Kerry Sheh <shekairui(a)gmail.com>
Date: Tue Jan 31 20:42:20 2012 +0800
SIO: Add smsc/sch4037 superio support
Change-Id: I3b113a27541b8efd096f3bd44e6621344ec916a5
Signed-off-by: Kerry Sheh <kerry.she(a)amd.com>
Signed-off-by: Kerry Sheh <shekairui(a)gmail.com>
---
src/superio/smsc/Kconfig | 3 +
src/superio/smsc/Makefile.inc | 2 +
src/superio/smsc/sch4037/Makefile.inc | 20 +++
src/superio/smsc/sch4037/chip.h | 34 ++++
src/superio/smsc/sch4037/sch4037.h | 227 +++++++++++++++++++++++++
src/superio/smsc/sch4037/sch4037_early_init.c | 71 ++++++++
src/superio/smsc/sch4037/superio.c | 123 +++++++++++++
7 files changed, 480 insertions(+), 0 deletions(-)
diff --git a/src/superio/smsc/Kconfig b/src/superio/smsc/Kconfig
index 7378d18..ddd5b96 100644
--- a/src/superio/smsc/Kconfig
+++ b/src/superio/smsc/Kconfig
@@ -2,6 +2,7 @@
## This file is part of the coreboot project.
##
## Copyright (C) 2009 Ronald G. Minnich
+## Copyright (C) 2012 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
@@ -39,3 +40,5 @@ config SUPERIO_SMSC_KBC1100
bool
config SUPERIO_SMSC_SMSCSUPERIO
bool
+config SUPERIO_SMSC_SCH4037
+ bool
diff --git a/src/superio/smsc/Makefile.inc b/src/superio/smsc/Makefile.inc
index 68d4d56..bfdc68e 100644
--- a/src/superio/smsc/Makefile.inc
+++ b/src/superio/smsc/Makefile.inc
@@ -2,6 +2,7 @@
## This file is part of the coreboot project.
##
## Copyright (C) 2009 Ronald G. Minnich
+## Copyright (C) 2012 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
@@ -28,3 +29,4 @@ subdirs-y += lpc47n227
subdirs-y += sio10n268
subdirs-y += kbc1100
subdirs-y += smscsuperio
+subdirs-y += sch4037
diff --git a/src/superio/smsc/sch4037/Makefile.inc b/src/superio/smsc/sch4037/Makefile.inc
new file mode 100644
index 0000000..8f36f2a
--- /dev/null
+++ b/src/superio/smsc/sch4037/Makefile.inc
@@ -0,0 +1,20 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ramstage-$(CONFIG_SUPERIO_SMSC_SCH4037) += superio.c
diff --git a/src/superio/smsc/sch4037/chip.h b/src/superio/smsc/sch4037/chip.h
new file mode 100644
index 0000000..3223750
--- /dev/null
+++ b/src/superio/smsc/sch4037/chip.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SUPERIO_SCH_4037_CHIP_H
+#define SUPERIO_SCH_4037_CHIP_H
+
+#include <pc80/keyboard.h>
+#include <uart8250.h>
+
+struct chip_operations;
+extern struct chip_operations superio_smsc_sch4037_ops;
+
+struct superio_smsc_sch4037_config {
+
+ struct pc_keyboard keyboard;
+};
+
+#endif //SUPERIO_SCH_4037_CHIP_H
\ No newline at end of file
diff --git a/src/superio/smsc/sch4037/sch4037.h b/src/superio/smsc/sch4037/sch4037.h
new file mode 100644
index 0000000..f429723
--- /dev/null
+++ b/src/superio/smsc/sch4037/sch4037.h
@@ -0,0 +1,227 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SUPERIO_SCH_4037_H
+#define SUPERIO_SCH_4037_H
+
+/* BITS Define */
+#ifndef BIT0
+#define BIT0 0x0000000000000001ull
+#endif
+#ifndef BIT1
+#define BIT1 0x0000000000000002ull
+#endif
+#ifndef BIT2
+#define BIT2 0x0000000000000004ull
+#endif
+#ifndef BIT3
+#define BIT3 0x0000000000000008ull
+#endif
+#ifndef BIT4
+#define BIT4 0x0000000000000010ull
+#endif
+#ifndef BIT5
+#define BIT5 0x0000000000000020ull
+#endif
+#ifndef BIT6
+#define BIT6 0x0000000000000040ull
+#endif
+#ifndef BIT7
+#define BIT7 0x0000000000000080ull
+#endif
+#ifndef BIT8
+#define BIT8 0x0000000000000100ull
+#endif
+#ifndef BIT9
+#define BIT9 0x0000000000000200ull
+#endif
+#ifndef BIT10
+#define BIT10 0x0000000000000400ull
+#endif
+#ifndef BIT11
+#define BIT11 0x0000000000000800ull
+#endif
+#ifndef BIT12
+#define BIT12 0x0000000000001000ull
+#endif
+#ifndef BIT13
+#define BIT13 0x0000000000002000ull
+#endif
+#ifndef BIT14
+#define BIT14 0x0000000000004000ull
+#endif
+#ifndef BIT15
+#define BIT15 0x0000000000008000ull
+#endif
+#ifndef BIT16
+#define BIT16 0x0000000000010000ull
+#endif
+#ifndef BIT17
+#define BIT17 0x0000000000020000ull
+#endif
+#ifndef BIT18
+#define BIT18 0x0000000000040000ull
+#endif
+#ifndef BIT19
+#define BIT19 0x0000000000080000ull
+#endif
+#ifndef BIT20
+#define BIT20 0x0000000000100000ull
+#endif
+#ifndef BIT21
+#define BIT21 0x0000000000200000ull
+#endif
+#ifndef BIT22
+#define BIT22 0x0000000000400000ull
+#endif
+#ifndef BIT23
+#define BIT23 0x0000000000800000ull
+#endif
+#ifndef BIT24
+#define BIT24 0x0000000001000000ull
+#endif
+#ifndef BIT25
+#define BIT25 0x0000000002000000ull
+#endif
+#ifndef BIT26
+#define BIT26 0x0000000004000000ull
+#endif
+#ifndef BIT27
+#define BIT27 0x0000000008000000ull
+#endif
+#ifndef BIT28
+#define BIT28 0x0000000010000000ull
+#endif
+#ifndef BIT29
+#define BIT29 0x0000000020000000ull
+#endif
+#ifndef BIT30
+#define BIT30 0x0000000040000000ull
+#endif
+#ifndef BIT31
+#define BIT31 0x0000000080000000ull
+#endif
+#ifndef BIT32
+#define BIT32 0x0000000100000000ull
+#endif
+#ifndef BIT33
+#define BIT33 0x0000000200000000ull
+#endif
+#ifndef BIT34
+#define BIT34 0x0000000400000000ull
+#endif
+#ifndef BIT35
+#define BIT35 0x0000000800000000ull
+#endif
+#ifndef BIT36
+#define BIT36 0x0000001000000000ull
+#endif
+#ifndef BIT37
+#define BIT37 0x0000002000000000ull
+#endif
+#ifndef BIT38
+#define BIT38 0x0000004000000000ull
+#endif
+#ifndef BIT39
+#define BIT39 0x0000008000000000ull
+#endif
+#ifndef BIT40
+#define BIT40 0x0000010000000000ull
+#endif
+#ifndef BIT41
+#define BIT41 0x0000020000000000ull
+#endif
+#ifndef BIT42
+#define BIT42 0x0000040000000000ull
+#endif
+#ifndef BIT43
+#define BIT43 0x0000080000000000ull
+#endif
+#ifndef BIT44
+#define BIT44 0x0000100000000000ull
+#endif
+#ifndef BIT45
+#define BIT45 0x0000200000000000ull
+#endif
+#ifndef BIT46
+#define BIT46 0x0000400000000000ull
+#endif
+#ifndef BIT47
+#define BIT47 0x0000800000000000ull
+#endif
+#ifndef BIT48
+#define BIT48 0x0001000000000000ull
+#endif
+#ifndef BIT49
+#define BIT49 0x0002000000000000ull
+#endif
+#ifndef BIT50
+#define BIT50 0x0004000000000000ull
+#endif
+#ifndef BIT51
+#define BIT51 0x0008000000000000ull
+#endif
+#ifndef BIT52
+#define BIT52 0x0010000000000000ull
+#endif
+#ifndef BIT53
+#define BIT53 0x0020000000000000ull
+#endif
+#ifndef BIT54
+#define BIT54 0x0040000000000000ull
+#endif
+#ifndef BIT55
+#define BIT55 0x0080000000000000ull
+#endif
+#ifndef BIT56
+#define BIT56 0x0100000000000000ull
+#endif
+#ifndef BIT57
+#define BIT57 0x0200000000000000ull
+#endif
+#ifndef BIT58
+#define BIT58 0x0400000000000000ull
+#endif
+#ifndef BIT59
+#define BIT59 0x0800000000000000ull
+#endif
+#ifndef BIT60
+#define BIT60 0x1000000000000000ull
+#endif
+#ifndef BIT61
+#define BIT61 0x2000000000000000ull
+#endif
+#ifndef BIT62
+#define BIT62 0x4000000000000000ull
+#endif
+#ifndef BIT63
+#define BIT63 0x8000000000000000ull
+#endif
+
+#define SCH4037_FDD 0 /* FDD */
+#define SCH4037_LPT 3 /* LPT */
+#define SMSCSUPERIO_SP1 4 /* Com1 */
+#define SMSCSUPERIO_SP2 5 /* Com2 */
+#define SCH4037_RTC 6 /* RTC */
+#define SCH4037_KBC 7 /* KBC */
+#define SCH4037_HWM 8 /* HWM */
+#define SCH4037_RUNTIME 0x0A /* Runtime */
+#define SCH4037_XBUS 0x0B /* X-BUS */
+
+#endif //SUPERIO_SCH_4037_H
diff --git a/src/superio/smsc/sch4037/sch4037_early_init.c b/src/superio/smsc/sch4037/sch4037_early_init.c
new file mode 100644
index 0000000..1ff7aba
--- /dev/null
+++ b/src/superio/smsc/sch4037/sch4037_early_init.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Pre-RAM driver for the SMSC KBC1100 Super I/O chip */
+
+#include <arch/romcc_io.h>
+#include "sch4037.h"
+
+static inline void pnp_enter_conf_state(device_t dev)
+{
+ unsigned port = dev>>8;
+ outb(0x55, port);
+}
+
+static void pnp_exit_conf_state(device_t dev)
+{
+ unsigned port = dev>>8;
+ outb(0xaa, port);
+}
+
+static inline void sch4037_early_init(unsigned port)
+{
+ device_t dev;
+
+ dev = PNP_DEV (port, SMSCSUPERIO_SP1);
+ pnp_enter_conf_state(dev);
+
+ /*Auto power management*/
+ pnp_write_config (dev, 0x22, BIT3+BIT4+BIT5 );
+ pnp_write_config (dev, 0x23, 0 );
+
+ /* Enable SMSC UART 0 */
+ dev = PNP_DEV (port, SMSCSUPERIO_SP1);
+ pnp_set_logical_device(dev);
+ pnp_set_enable(dev, 0);
+
+ pnp_set_iobase(dev, PNP_IDX_IO0, CONFIG_TTYS0_BASE);
+ pnp_set_irq(dev, PNP_IDX_IRQ0, 0x4);
+
+ /* Enabled High speed, disabled MIDI support. */
+ pnp_write_config (dev, 0xF0, 0x02);
+ pnp_set_enable(dev, 1);
+
+ /* Enable keyboard */
+ dev = PNP_DEV (port, SCH4037_KBC);
+ pnp_set_logical_device(dev);
+ pnp_set_enable(dev, 0);
+ pnp_set_irq(dev, 0x70, 1); /* IRQ 1 */
+ pnp_set_irq(dev, 0x72, 12); /* IRQ 12 */
+ pnp_set_enable(dev, 1);
+
+ pnp_exit_conf_state(dev);
+
+}
+
diff --git a/src/superio/smsc/sch4037/superio.c b/src/superio/smsc/sch4037/superio.c
new file mode 100644
index 0000000..af4040f
--- /dev/null
+++ b/src/superio/smsc/sch4037/superio.c
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* RAM driver for the SMSC KBC1100 Super I/O chip */
+
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pnp.h>
+#include <console/console.h>
+#include <device/smbus.h>
+#include <string.h>
+#include <bitops.h>
+#include <uart8250.h>
+#include <pc80/keyboard.h>
+#include <stdlib.h>
+#include "chip.h"
+#include "sch4037.h"
+
+/* Forward declarations */
+static void enable_dev(device_t dev);
+static void sch4037_pnp_set_resources(device_t dev);
+static void sch4037_pnp_enable_resources(device_t dev);
+static void sch4037_pnp_enable(device_t dev);
+static void sch4037_init(device_t dev);
+
+static void pnp_enter_conf_state(device_t dev);
+static void pnp_exit_conf_state(device_t dev);
+
+struct chip_operations superio_smsc_sch4037_ops = {
+ CHIP_NAME("SMSC SCH4037 Super I/O")
+ .enable_dev = enable_dev,
+};
+
+static struct device_operations ops = {
+ .read_resources = pnp_read_resources,
+ .set_resources = sch4037_pnp_set_resources,
+ .enable_resources = sch4037_pnp_enable_resources,
+ .enable = sch4037_pnp_enable,
+ .init = sch4037_init,
+};
+
+static struct pnp_info pnp_dev_info[] = {
+ { &ops, SCH4037_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
+};
+
+static void enable_dev(device_t dev)
+{
+ printk(BIOS_EMERG, "file '%s',line %d, %s()\n", __FILE__, __LINE__, __func__);
+ pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+}
+
+static void sch4037_pnp_set_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void sch4037_pnp_enable_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_enable_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void sch4037_pnp_enable(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_logical_device(dev);
+
+ if(dev->enabled) {
+ pnp_set_enable(dev, 1);
+ }
+ else {
+ pnp_set_enable(dev, 0);
+ }
+ pnp_exit_conf_state(dev);
+}
+
+static void sch4037_init(device_t dev)
+{
+ struct superio_smsc_sch4037_config *conf = dev->chip_info;
+ struct resource *res0, *res1;
+
+ if (!dev->enabled) {
+ return;
+ }
+
+ switch(dev->path.pnp.device) {
+
+ case SCH4037_KBC:
+ res0 = find_resource(dev, PNP_IDX_IO0);
+ res1 = find_resource(dev, PNP_IDX_IO1);
+ pc_keyboard_init(&conf->keyboard);
+ break;
+ }
+}
+
+static void pnp_enter_conf_state(device_t dev)
+{
+ outb(0x55, dev->path.pnp.port);
+}
+
+static void pnp_exit_conf_state(device_t dev)
+{
+ outb(0xaa, dev->path.pnp.port);
+}
Kerry Sheh (shekairui(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/563
-gerrit
commit d8b2a084872d25a935c2dd57e9c567a17eda30c2
Author: Kerry Sheh <shekairui(a)gmail.com>
Date: Tue Jan 31 20:42:22 2012 +0800
SIO: Add smsc sio1036 superio
Change-Id: Iaf5519f304f9f16f7ff6e4b02060bb75a3605ce9
Signed-off-by: Kerry Sheh <kerry.she(a)amd.com>
Signed-off-by: Kerry Sheh <shekairui(a)gmail.com>
---
src/superio/smsc/Kconfig | 2 +
src/superio/smsc/Makefile.inc | 1 +
src/superio/smsc/sio1036/Makefile.inc | 21 ++++
src/superio/smsc/sio1036/chip.h | 34 +++++++
src/superio/smsc/sio1036/sio1036.h | 25 +++++
src/superio/smsc/sio1036/sio1036_early_init.c | 101 ++++++++++++++++++++
src/superio/smsc/sio1036/superio.c | 122 +++++++++++++++++++++++++
7 files changed, 306 insertions(+), 0 deletions(-)
diff --git a/src/superio/smsc/Kconfig b/src/superio/smsc/Kconfig
index ddd5b96..d4f07ec 100644
--- a/src/superio/smsc/Kconfig
+++ b/src/superio/smsc/Kconfig
@@ -40,5 +40,7 @@ config SUPERIO_SMSC_KBC1100
bool
config SUPERIO_SMSC_SMSCSUPERIO
bool
+config SUPERIO_SMSC_SIO1036
+ bool
config SUPERIO_SMSC_SCH4037
bool
diff --git a/src/superio/smsc/Makefile.inc b/src/superio/smsc/Makefile.inc
index bfdc68e..d07afea 100644
--- a/src/superio/smsc/Makefile.inc
+++ b/src/superio/smsc/Makefile.inc
@@ -29,4 +29,5 @@ subdirs-y += lpc47n227
subdirs-y += sio10n268
subdirs-y += kbc1100
subdirs-y += smscsuperio
+subdirs-y += sio1036
subdirs-y += sch4037
diff --git a/src/superio/smsc/sio1036/Makefile.inc b/src/superio/smsc/sio1036/Makefile.inc
new file mode 100644
index 0000000..4e48899
--- /dev/null
+++ b/src/superio/smsc/sio1036/Makefile.inc
@@ -0,0 +1,21 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ramstage-$(CONFIG_SUPERIO_SMSC_SIO1036) += superio.c
+
diff --git a/src/superio/smsc/sio1036/chip.h b/src/superio/smsc/sio1036/chip.h
new file mode 100644
index 0000000..abed430
--- /dev/null
+++ b/src/superio/smsc/sio1036/chip.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SUPERIO_SMSC_SIO1036_CHIP_H
+#define SUPERIO_SMSC_SIO1036_CHIP_H
+
+#include <pc80/keyboard.h>
+#include <uart8250.h>
+
+struct chip_operations;
+extern struct chip_operations superio_smsc_kbc1100_ops;
+
+struct superio_smsc_sio1036_config {
+ struct uart8250 com1;
+};
+
+#endif //SUPERIO_SMSC_SIO1036_CHIP_H
+
diff --git a/src/superio/smsc/sio1036/sio1036.h b/src/superio/smsc/sio1036/sio1036.h
new file mode 100644
index 0000000..cdd5a8b
--- /dev/null
+++ b/src/superio/smsc/sio1036/sio1036.h
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define SIO1036_SP1 0 /* Com1 */
+
+#define UART_POWER_DOWN (1 << 7)
+#define LPT_POWER_DOWN (1 << 2)
+#define IR_OUPUT_MUX (1 << 6)
+
diff --git a/src/superio/smsc/sio1036/sio1036_early_init.c b/src/superio/smsc/sio1036/sio1036_early_init.c
new file mode 100644
index 0000000..980e8c5
--- /dev/null
+++ b/src/superio/smsc/sio1036/sio1036_early_init.c
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Pre-RAM driver for the SMSC KBC1100 Super I/O chip */
+
+#include <arch/romcc_io.h>
+#include "sio1036.h"
+
+#ifndef CONFIG_TTYS0_BASE
+#define CONFIG_TTYS0_BASE 0x3F8
+#endif
+static inline void sio1036_enter_conf_state(device_t dev)
+{
+ unsigned port = dev>>8;
+ outb(0x55, port);
+}
+
+static inline void sio1036_exit_conf_state(device_t dev)
+{
+ unsigned port = dev>>8;
+ outb(0xaa, port);
+}
+
+static u8 detect_sio1036_chip(unsigned port)
+{
+ device_t dev;
+ dev = PNP_DEV (port, SIO1036_SP1);
+ unsigned data;
+ sio1036_enter_conf_state (dev);
+ data = pnp_read_config (dev, 0x0D);
+ sio1036_exit_conf_state(dev);
+ /* detect smsc sio1036 chip */
+ if (data == 0x82) {
+ /* Found SMSC SIO1036 chip */
+ return 0;
+ }
+ else {
+ return -1;
+ };
+}
+
+static inline void sio1036_early_init(unsigned port)
+{
+ device_t dev;
+ dev = PNP_DEV (port, SIO1036_SP1);
+
+ if (detect_sio1036_chip(port) != 0) {
+ /* Not found SMSC SIO1036 */
+ return;
+ }
+ sio1036_enter_conf_state (dev);
+
+ /* Enable SMSC UART 0 */
+ /* Valid configuration cycle */
+ pnp_write_config (dev, 0x00, 0x28);
+
+ /* PP power/mode/cr lock */
+ pnp_write_config (dev, 0x01, 0x98 | LPT_POWER_DOWN);
+ pnp_write_config (dev, 0x02, 0x08 | UART_POWER_DOWN);
+
+ /*Auto power management*/
+ pnp_write_config (dev, 0x07, 0x00 );
+
+ /*ECP FIFO threhod */
+ pnp_write_config (dev, 0x0A, 0x00 | IR_OUPUT_MUX);
+
+ /*GPIO direction register 2 */
+ pnp_write_config (dev, 0x033, 0x00);
+
+ /*UART Mode */
+ pnp_write_config (dev, 0x0C, 0x02);
+
+ /* GPIO polarity regisgter 2 */
+ pnp_write_config (dev, 0x034, 0x00);
+
+ /* Enable SMSC UART 0 */
+ /*Set base io address */
+ pnp_write_config (dev, 0x25, (u8)((u16)CONFIG_TTYS0_BASE >> 2));
+
+ /* Set UART IRQ onto 0x04 */
+ pnp_write_config (dev, 0x28, 0x04);
+
+ sio1036_exit_conf_state(dev);
+}
+
diff --git a/src/superio/smsc/sio1036/superio.c b/src/superio/smsc/sio1036/superio.c
new file mode 100644
index 0000000..2522d92
--- /dev/null
+++ b/src/superio/smsc/sio1036/superio.c
@@ -0,0 +1,122 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2012 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* RAM driver for the SMSC SIO1036 Super I/O chip */
+
+#include <arch/io.h>
+#include <device/device.h>
+#include <device/pnp.h>
+#include <console/console.h>
+#include <device/smbus.h>
+#include <string.h>
+#include <bitops.h>
+#include <uart8250.h>
+#include <pc80/keyboard.h>
+#include <stdlib.h>
+#include "chip.h"
+#include "sio1036.h"
+
+/* Forward declarations */
+static void enable_dev(device_t dev);
+static void sio1036_pnp_set_resources(device_t dev);
+static void sio1036_pnp_enable_resources(device_t dev);
+static void sio1036_pnp_enable(device_t dev);
+static void sio1036_init(device_t dev);
+
+static void pnp_enter_conf_state(device_t dev);
+static void pnp_exit_conf_state(device_t dev);
+
+struct chip_operations superio_smsc_sio1036_ops = {
+ CHIP_NAME("SMSC SIO1036 Super I/O")
+ .enable_dev = enable_dev
+};
+
+static struct device_operations ops = {
+ .read_resources = pnp_read_resources,
+ .set_resources = sio1036_pnp_set_resources,
+ .enable_resources = sio1036_pnp_enable_resources,
+ .enable = sio1036_pnp_enable,
+ .init = sio1036_init,
+};
+
+static struct pnp_info pnp_dev_info[] = {
+ {},
+};
+
+static void enable_dev(device_t dev)
+{
+ pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+}
+
+static void sio1036_pnp_set_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void sio1036_pnp_enable_resources(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_enable_resources(dev);
+ pnp_exit_conf_state(dev);
+}
+
+static void sio1036_pnp_enable(device_t dev)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_logical_device(dev);
+
+ if(dev->enabled) {
+ pnp_set_enable(dev, 1);
+ }
+ else {
+ pnp_set_enable(dev, 0);
+ }
+ pnp_exit_conf_state(dev);
+}
+
+static void sio1036_init(device_t dev)
+{
+ struct superio_smsc_sio1036_config *conf = dev->chip_info;
+ struct resource *res0, *res1;
+
+
+
+ if (!dev->enabled) {
+ return;
+ }
+
+ switch(dev->path.pnp.device) {
+
+ default:
+ break;
+ }
+}
+
+static void pnp_enter_conf_state(device_t dev)
+{
+ outb(0x55, dev->path.pnp.port);
+}
+
+static void pnp_exit_conf_state(device_t dev)
+{
+ outb(0xaa, dev->path.pnp.port);
+}
+