sb/amd/cs5536: Remove includes of C files

The romstage for CS5536 platforms were including early_smbus.c and
early_setup.c.  Build these into romstage from the makefile, and remove
the #includes.

Add a Kconfig option for platforms that do not use the
early smbus code.

Change-Id: I2e6a9cd859292b4dd4720b547d1ff0bbb6c319cf
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/20607
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Martin Roth 2017-07-16 11:29:02 -07:00
parent 60a7e78de2
commit a271b1d13d
27 changed files with 36 additions and 48 deletions

View File

@ -28,8 +28,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/smsc/smscsuperio/smscsuperio.h> #include <superio/smsc/smscsuperio/smscsuperio.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -25,8 +25,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -25,8 +25,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -25,8 +25,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>
int spd_read_byte(unsigned int device, unsigned int address) int spd_read_byte(unsigned int device, unsigned int address)

View File

@ -22,8 +22,7 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/gx2def.h> #include <cpu/amd/gx2def.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c" #include <southbridge/amd/cs5536/cs5536.h>
#include "southbridge/amd/cs5536/early_setup.c"
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)

View File

@ -26,8 +26,6 @@
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include "spd_table.h" #include "spd_table.h"
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>
int spd_read_byte(unsigned int device, unsigned int address) int spd_read_byte(unsigned int device, unsigned int address)

View File

@ -27,8 +27,6 @@
#include <cpu/amd/car.h> #include <cpu/amd/car.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>
int spd_read_byte(unsigned int device, unsigned int address) int spd_read_byte(unsigned int device, unsigned int address)

View File

@ -23,8 +23,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -26,8 +26,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -25,8 +25,6 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <southbridge/amd/cs5536/early_smbus.c>
#include <southbridge/amd/cs5536/early_setup.c>
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627ehg/w83627ehg.h> #include <superio/winbond/w83627ehg/w83627ehg.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -27,8 +27,6 @@
#include <cpu/amd/car.h> #include <cpu/amd/car.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <southbridge/amd/cs5536/early_smbus.c>
#include <southbridge/amd/cs5536/early_setup.c>
#include <superio/smsc/smscsuperio/smscsuperio.h> #include <superio/smsc/smscsuperio/smscsuperio.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -27,9 +27,8 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <southbridge/amd/cs5536/smbus.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/ite/common/ite.h> #include <superio/ite/common/ite.h>
#include <superio/ite/it8712f/it8712f.h> #include <superio/ite/it8712f/it8712f.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -28,8 +28,7 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include "southbridge/amd/cs5536/early_smbus.c" #include <southbridge/amd/cs5536/smbus.h>
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/ite/common/ite.h> #include <superio/ite/common/ite.h>
#include <superio/ite/it8712f/it8712f.h> #include <superio/ite/it8712f/it8712f.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -28,8 +28,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/ite/common/ite.h> #include <superio/ite/common/ite.h>
#include <superio/ite/it8712f/it8712f.h> #include <superio/ite/it8712f/it8712f.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -28,8 +28,7 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include "southbridge/amd/cs5536/early_smbus.c" #include <southbridge/amd/cs5536/smbus.h>
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/ite/common/ite.h> #include <superio/ite/common/ite.h>
#include <superio/ite/it8712f/it8712f.h> #include <superio/ite/it8712f/it8712f.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select POWER_BUTTON_DEFAULT_DISABLE select POWER_BUTTON_DEFAULT_DISABLE
select HAVE_OPTION_TABLE select HAVE_OPTION_TABLE
select HAVE_CMOS_DEFAULT select HAVE_CMOS_DEFAULT
select NO_EARLY_SMBUS
config MAINBOARD_DIR config MAINBOARD_DIR
string string

View File

@ -30,10 +30,6 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
/* The ALIX1.C has no SMBus; the setup is hard-wired. */
static void cs5536_enable_smbus(void) { }
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>

View File

@ -10,6 +10,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select UDELAY_TSC select UDELAY_TSC
select BOARD_ROMSIZE_KB_512 select BOARD_ROMSIZE_KB_512
select POWER_BUTTON_FORCE_DISABLE select POWER_BUTTON_FORCE_DISABLE
select NO_EARLY_SMBUS
config MAINBOARD_DIR config MAINBOARD_DIR
string string

View File

@ -30,11 +30,6 @@
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) #define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
/* The ALIX.2D has no SMBus; the setup is hard-wired. */
static void cs5536_enable_smbus(void) { }
#include "southbridge/amd/cs5536/early_setup.c"
/* The part is a Hynix hy5du121622ctp-d43. /* The part is a Hynix hy5du121622ctp-d43.
* *
* HY 5D U 12 16 2 2 C <blank> T <blank> P D43 * HY 5D U 12 16 2 2 C <blank> T <blank> P D43

View File

@ -26,8 +26,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>
int spd_read_byte(unsigned int device, unsigned int address) int spd_read_byte(unsigned int device, unsigned int address)

View File

@ -27,8 +27,6 @@
#include <cpu/amd/lxdef.h> #include <cpu/amd/lxdef.h>
#include <southbridge/amd/cs5536/cs5536.h> #include <southbridge/amd/cs5536/cs5536.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c"
#include "southbridge/amd/cs5536/early_setup.c"
#include <superio/winbond/common/winbond.h> #include <superio/winbond/common/winbond.h>
#include <superio/winbond/w83627hf/w83627hf.h> #include <superio/winbond/w83627hf/w83627hf.h>
#include <northbridge/amd/lx/raminit.h> #include <northbridge/amd/lx/raminit.h>

View File

@ -24,8 +24,7 @@
#include <cpu/x86/msr.h> #include <cpu/x86/msr.h>
#include <cpu/amd/gx2def.h> #include <cpu/amd/gx2def.h>
#include <spd.h> #include <spd.h>
#include "southbridge/amd/cs5536/early_smbus.c" #include <southbridge/amd/cs5536/cs5536.h>
#include "southbridge/amd/cs5536/early_setup.c"
static inline int spd_read_byte(unsigned int device, unsigned int address) static inline int spd_read_byte(unsigned int device, unsigned int address)
{ {

View File

@ -16,3 +16,12 @@
config SOUTHBRIDGE_AMD_CS5536 config SOUTHBRIDGE_AMD_CS5536
bool bool
select UDELAY_TSC select UDELAY_TSC
if SOUTHBRIDGE_AMD_CS5536
config NO_EARLY_SMBUS
def_bool n
help
Skip the CS5536 early SMBUS initialization.
endif

View File

@ -15,6 +15,9 @@
ifeq ($(CONFIG_SOUTHBRIDGE_AMD_CS5536),y) ifeq ($(CONFIG_SOUTHBRIDGE_AMD_CS5536),y)
romstage-y += early_smbus.c
romstage-y += early_setup.c
ramstage-y += cs5536.c ramstage-y += cs5536.c
ramstage-y += ide.c ramstage-y += ide.c
ramstage-y += pirq.c ramstage-y += pirq.c

View File

@ -442,6 +442,10 @@
#if defined(__PRE_RAM__) #if defined(__PRE_RAM__)
void cs5536_setup_onchipuart(int uart); void cs5536_setup_onchipuart(int uart);
void cs5536_disable_internal_uart(void); void cs5536_disable_internal_uart(void);
void cs5536_early_setup(void);
void cs5536_enable_smbus(void);
int smbus_read_byte(unsigned device, unsigned address);
#else #else
void chipsetinit(void); void chipsetinit(void);
#endif #endif

View File

@ -19,6 +19,12 @@
* AMD Geode GX Processor CS5536 Companion Device GeodeROM Porting Guide. * AMD Geode GX Processor CS5536 Companion Device GeodeROM Porting Guide.
*/ */
#include <arch/io.h>
#include <cpu/x86/bist.h>
#include <cpu/x86/msr.h>
#include <cpu/amd/lxdef.h>
#include "cs5536.h"
/** /**
* @brief Setup PCI IDSEL for CS5536 * @brief Setup PCI IDSEL for CS5536
*/ */
@ -244,7 +250,7 @@ void cs5536_setup_onchipuart(int uart)
* and we don't want to hang on serial, so they are * and we don't want to hang on serial, so they are
* commented out * commented out
*/ */
static void cs5536_early_setup(void) void cs5536_early_setup(void)
{ {
msr_t msr; msr_t msr;

View File

@ -13,13 +13,17 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <arch/io.h>
#include "cs5536.h" #include "cs5536.h"
#include "smbus.h" #include "smbus.h"
/* initialization for SMBus Controller */ /* initialization for SMBus Controller */
static void cs5536_enable_smbus(void) void cs5536_enable_smbus(void)
{ {
if (IS_ENABLED(CONFIG_NO_EARLY_SMBUS))
return;
/* Set SCL freq and enable SMB controller */ /* Set SCL freq and enable SMB controller */
/*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); */ /*outb((0x20 << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); */
outb((0x7F << 1) | SMB_CTRL2_ENABLE, SMBUS_IO_BASE + SMB_CTRL2); outb((0x7F << 1) | SMB_CTRL2_ENABLE, SMBUS_IO_BASE + SMB_CTRL2);
@ -29,7 +33,7 @@ static void cs5536_enable_smbus(void)
} }
static inline int smbus_read_byte(unsigned device, unsigned address) int smbus_read_byte(unsigned device, unsigned address)
{ {
return do_smbus_read_byte(SMBUS_IO_BASE, device, address); return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
} }